# lucagurima/image_inspector architecture

> Architecture diagram of the GitHub repository lucagurima/image_inspector, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lucagurima/image_inspector
- Repository: https://github.com/lucagurima/image_inspector

## Overview

Image Inspector is a desktop visual-inspection and dataset-capture application. Operators configure camera profiles and YOLO models, capture or reanalyze product images, review and classify inspection outcomes, and save inspection records. A separate dataset tab captures manually labeled images without inference and queues their paths for an external synchronizer; the README states that the app itself does not upload images. The graph follows documented workflows and shown source references; some UI-to-service wiring is only partially excerpted.

Main entry points: [`image_inspector/ui/main_window.py`](https://github.com/lucagurima/image_inspector/blob/main/image_inspector/ui/main_window.py) (Operation and configuration), [`image_inspector/ui/dataset_tab.py`](https://github.com/lucagurima/image_inspector/blob/main/image_inspector/ui/dataset_tab.py) (Dataset tab), [`image_inspector/app.py`](https://github.com/lucagurima/image_inspector/blob/main/image_inspector/app.py) (Application startup), [`image_inspector/ui/threads.py`](https://github.com/lucagurima/image_inspector/blob/main/image_inspector/ui/threads.py) (Capture and inference threads)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_app["Application startup<br/>[app.py]"]
  node_window["Operation and configuration<br/>[main_window.py]"]
  node_dataset_tab["Dataset tab<br/>[dataset_tab.py]"]
  node_threads["Capture and inference threads<br/>[threads.py]"]
end

subgraph group_inspection["Inspection runtime"]
  node_camera["Basler camera<br/>[basler_camera.py]"]
  node_inspection_service["Inspection service<br/>[inspection.py]"]
  node_model_registry["YOLO model registry<br/>[yolo_models.py]"]
  node_yolo["YOLO prediction<br/>[yolo_models.py]"]
end

subgraph group_dataset["Dataset collection"]
  node_collection["Dataset capture storage"]
  node_dataset_files[("Dataset images and metadata")]
  node_export_queue["Export path queue"]
end

subgraph group_persistence["Settings and records"]
  node_settings["Runtime settings<br/>[runtime.py]"]
  node_paths["User data paths<br/>[config.py]"]
  node_inspection_storage[("Inspection records<br/>[storage.py]")]
end

node_operator(("Operator"))
node_synchronizer(("External synchronizer"))

node_operator -->|"starts"| node_app
node_app -->|"opens"| node_window
node_app -->|"sets up logging"| node_settings
node_operator -->|"configures and reviews"| node_window
node_window -->|"loads and saves"| node_settings
node_window -->|"connects and captures"| node_camera
node_window -->|"requests analysis"| node_inspection_service
node_window -->|"saves review"| node_inspection_storage
node_window -.->|"dispatches work"| node_threads
node_threads -->|"captures frames"| node_camera
node_threads -->|"runs inference"| node_inspection_service
node_inspection_service -->|"gets models"| node_model_registry
node_model_registry -->|"loads and caches"| node_yolo
node_operator -->|"captures labeled images"| node_dataset_tab
node_dataset_tab -->|"previews and captures"| node_camera
node_dataset_tab -->|"saves captures"| node_collection
node_collection -->|"writes images and metadata"| node_dataset_files
node_dataset_tab -->|"queues session paths"| node_export_queue
node_export_queue -.->|"processed externally"| node_synchronizer
node_settings -->|"uses data location"| node_paths
node_inspection_storage -->|"uses inspection directory"| node_paths

click node_app "https://github.com/lucagurima/image_inspector/blob/main/image_inspector/app.py"
click node_window "https://github.com/lucagurima/image_inspector/blob/main/image_inspector/ui/main_window.py"
click node_dataset_tab "https://github.com/lucagurima/image_inspector/blob/main/image_inspector/ui/dataset_tab.py"
click node_threads "https://github.com/lucagurima/image_inspector/blob/main/image_inspector/ui/threads.py"
click node_camera "https://github.com/lucagurima/image_inspector/blob/main/image_inspector/core/basler_camera.py"
click node_inspection_service "https://github.com/lucagurima/image_inspector/blob/main/image_inspector/core/inspection.py"
click node_model_registry "https://github.com/lucagurima/image_inspector/blob/main/image_inspector/core/yolo_models.py"
click node_yolo "https://github.com/lucagurima/image_inspector/blob/main/image_inspector/core/yolo_models.py"
click node_settings "https://github.com/lucagurima/image_inspector/blob/main/image_inspector/core/runtime.py"
click node_paths "https://github.com/lucagurima/image_inspector/blob/main/image_inspector/config.py"
click node_inspection_storage "https://github.com/lucagurima/image_inspector/blob/main/image_inspector/core/storage.py"
click node_collection "https://github.com/lucagurima/image_inspector/blob/main/image_inspector/core/dataset_collection.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_window,node_dataset_tab,node_threads toneBlue
class node_camera,node_inspection_service,node_model_registry,node_yolo toneAmber
class node_collection,node_dataset_files,node_export_queue toneMint
class node_settings,node_paths,node_inspection_storage toneRose
class node_operator,node_synchronizer toneIndigo
```

## Components

### Desktop interface

- [Application startup](https://github.com/lucagurima/image_inspector/blob/main/image_inspector/app.py): `image_inspector/app.py`
- [Operation and configuration](https://github.com/lucagurima/image_inspector/blob/main/image_inspector/ui/main_window.py): `image_inspector/ui/main_window.py`
- [Dataset tab](https://github.com/lucagurima/image_inspector/blob/main/image_inspector/ui/dataset_tab.py): `image_inspector/ui/dataset_tab.py`
- [Capture and inference threads](https://github.com/lucagurima/image_inspector/blob/main/image_inspector/ui/threads.py): `image_inspector/ui/threads.py`

### Inspection runtime

- [Basler camera](https://github.com/lucagurima/image_inspector/blob/main/image_inspector/core/basler_camera.py): `image_inspector/core/basler_camera.py`
- [Inspection service](https://github.com/lucagurima/image_inspector/blob/main/image_inspector/core/inspection.py): `image_inspector/core/inspection.py`
- [YOLO model registry](https://github.com/lucagurima/image_inspector/blob/main/image_inspector/core/yolo_models.py): `image_inspector/core/yolo_models.py`
- [YOLO prediction](https://github.com/lucagurima/image_inspector/blob/main/image_inspector/core/yolo_models.py): `image_inspector/core/yolo_models.py`

### Dataset collection

- [Dataset capture storage](https://github.com/lucagurima/image_inspector/blob/main/image_inspector/core/dataset_collection.py): `image_inspector/core/dataset_collection.py`
- **Dataset images and metadata**
- **Export path queue**

### Settings and records

- [Runtime settings](https://github.com/lucagurima/image_inspector/blob/main/image_inspector/core/runtime.py): `image_inspector/core/runtime.py`
- [User data paths](https://github.com/lucagurima/image_inspector/blob/main/image_inspector/config.py): `image_inspector/config.py`
- [Inspection records](https://github.com/lucagurima/image_inspector/blob/main/image_inspector/core/storage.py): `image_inspector/core/storage.py`

### Other components

- **Operator**
- **External synchronizer**

## Connections

- Operator → Application startup: starts (evidence: `README.md`)
- Application startup → Operation and configuration: opens (evidence: `image_inspector/app.py`)
- Application startup → Runtime settings: sets up logging (evidence: `image_inspector/app.py`)
- Operator → Operation and configuration: configures and reviews (evidence: `README.md`)
- Operation and configuration → Runtime settings: loads and saves (evidence: `image_inspector/ui/main_window.py`)
- Operation and configuration → Basler camera: connects and captures (evidence: `image_inspector/ui/main_window.py`)
- Operation and configuration → Inspection service: requests analysis (evidence: `README.md`)
- Operation and configuration → Inspection records: saves review (evidence: `README.md`)
- Operation and configuration → Capture and inference threads: dispatches work (evidence: `image_inspector/ui/main_window.py`)
- Capture and inference threads → Basler camera: captures frames (evidence: `image_inspector/ui/threads.py`)
- Capture and inference threads → Inspection service: runs inference (evidence: `image_inspector/ui/threads.py`)
- Inspection service → YOLO model registry: gets models (evidence: `image_inspector/core/inspection.py`)
- YOLO model registry → YOLO prediction: loads and caches (evidence: `image_inspector/core/yolo_models.py`)
- Operator → Dataset tab: captures labeled images (evidence: `README.md`)
- Dataset tab → Basler camera: previews and captures (evidence: `image_inspector/ui/dataset_tab.py`)
- Dataset tab → Dataset capture storage: saves captures (evidence: `README.md`)
- Dataset capture storage → Dataset images and metadata: writes images and metadata (evidence: `README.md`)
- Dataset tab → Export path queue: queues session paths (evidence: `README.md`)
- Export path queue → External synchronizer: processed externally (evidence: `README.md`)
- Runtime settings → User data paths: uses data location (evidence: `image_inspector/core/runtime.py`)
- Inspection records → User data paths: uses inspection directory (evidence: `image_inspector/core/storage.py`)
