Amir2000 Image Automation | Case Study

Automate high-volume photo sets into deterministic filenames, review-ready metadata, and publish-ready website assets while keeping a mandatory human approval gate.

Python 3.13 SQLite + MySQL + FTP Ollama local inference Review-first publishing

0. Section Map (What Each Point Means)

This map explains the purpose of each numbered section so any reader can quickly understand where to find business, product, and engineering context.

Why this matters by audience:

1. Executive Summary

The automation solves a practical production problem: moving from manual, error-prone image publishing to a repeatable, auditable pipeline where every image has explicit lifecycle state in a database.

1A. Live Data Snapshot (Current Catalog)

To complement the narrative, this snapshot reads live from MySQL table photos_info_revamp and shows scale, quality mix, and camera evolution. This is intentionally a compact data view to support the story without overwhelming it.

Catalog rows

42,923

Largest QC band

Good (18,588 / 43.3%)

Top camera volume

Canon EOS 5D Mark IV (19,637)

Cumulative Growth (Live)

QC Status Distribution

Camera Mix by Year (Top 5)

Live source: photos_info_revamp. The charts show catalog evolution and quality mix, not an exact automation start date.

2. Problem Context

Manual workflows worked for small sets, but failed at scale. The pain points were not isolated bugs; they were system-level reliability issues.

Concrete before/after naming examples

After (more specific subject/location naming and cleaner metadata context)

  • Cosmos_pink_and_white_petals_with_bright_yellow_disk_Flower_Photography_Macro_Photography_004.JPG
  • Booking_com_campus_Offices_Amsterdam_Netherlands_Night_Photography_001.JPG

3. Objectives And Constraints

Primary objectives:

Constraints:

4. Solution Overview

The system is organized as a guided multi-stage pipeline. Operational state is stored in SQLite, and publish is a deliberate final step from the review editor.

Amir2000 Image Automation pipeline flow chart

Figure 1: End-to-end flow chart used as architecture overview.

5. Workflow Walkthrough (Stage By Stage)

The production stage flow implemented in main_set.py:

  1. Validate sets: sanity checks before any data mutation.
  2. Prepare DB and copy to incoming: establish working context and staged inputs.
  3. Extract EXIF and initial metadata: seed technical metadata and base fields.
  4. Insert/refresh review rows: create or update review_queue records.
  5. AI quality scoring: compute quality metrics and initial quality classification.
  6. Resize for Ollama: generate temporary model inputs and set ollama_path.
  7. Caption/keywords prefill: local LLM suggestions for caption, alt text, and keywords, with optional CLIP nature classifier hints, species-aware wildlife consistency checks, strict duplicate controls, Stage 6 timeout/quarantine safeguards, and pre-review QC report output in data/prefill_qc_last.json.
  8. Open review editor: enter the human decision phase.
Startup log confirming Ollama processor mode GPU with context and VRAM

Runtime check: startup log confirms active processor mode, context, and VRAM before stage execution.

Prefill QC summary dialog showing duplicate and suspicious row checks

Prefill QC: duplicate and suspicious metadata checks run before the review editor opens.

After the review editor opens (release path):

  1. Review and edit each row for caption, alt text, keywords, filename, and quality fields.
  2. Use Generate for row-level metadata retry; regenerated text is checked against pending-row duplicates before save.
  3. Set each row status to Approved or Rejected based on final human judgment.
  4. Trigger publish for Approved rows only.
  5. Uploader sends full + thumbnail assets to FTP destinations.
  6. Uploader performs MySQL upsert by File_Name and syncs local mirror IDs.
  7. On clean publish, temp Ollama paths are cleaned and final statuses are persisted.
  8. Operator validates logs and website output as final QA.

Correction flow is intentionally fast: when a result is not good enough, reject can reverse the item path so it can be redone cleanly for better output.

Runtime failure handling is also rollback-oriented. If a blocking error occurs (for example caption model missing), the session rollback restores files and releases reserved filenames so the run can be safely retried.

Rollback behavior after caption model error in Amir2000 Image Automation

Figure 2: Real rollback event after caption-stage model error, showing session cleanup and filename reservation release.

The result is a controlled transition from raw files to reviewed records to published assets.

6. Operator Experience And Review Gate

The Multi-Set interface is designed for batch processing with visible stage progression and explicit review decisions.

Multi-set UI for Amir2000 image automation

Figure 3: Multi-set operator UI used to run stages and enter review workflow.

Review editor showing Generate action for row-level metadata retry

Review editor: Generate action retries metadata for the current row without bypassing manual approval.

Review editor output after regeneration with action rows separated

Review editor output: regenerated metadata with primary and secondary action rows kept separate.

7. Key Engineering Decisions

8. Stack And Ownership

9. Tradeoffs, Roadmap, And ML Planning

Current tradeoffs:

Explicit non-goals (scope boundaries):

Next platform steps:

ML planning track:

10. Deep-Dive Documentation Map

To keep documentation focused and professional, the deep dive is reduced to a core sequence. These are the pages that matter most, in the order readers should follow from Step 0 to Step 5.

Supporting references (optional by need)
© 2026 Amir Darzi
Privacy Policy  |  Photography site | W3C-Valid  |  Cookie settings