# roar3691/art_image_classifier architecture

> Architecture diagram of the GitHub repository roar3691/art_image_classifier, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/roar3691/art_image_classifier
- Repository: https://github.com/roar3691/art_image_classifier

## Overview

##### Project type and purpose
- This is a standalone deep‑learning training pipeline for an image‑based defect detector (“Art_image_classifier”).
- It ingests labeled images, preprocesses them, trains two base architectures (MobileNetV3Large and InceptionV3), ensembles their outputs, evaluates performance, and exports the best model.

##### File structure
- Top‑level files:
– train_model.py: the main training script and orchestrator.
– best_model.keras: the serialized ensemble model ready for inference.
– README.md, LICENSE, .gitignore: metadata/config.
- Absence of a data/ folder implies images are loaded via paths or a data‑pipeline inside train_model.py.
- No separate modules or subdirectories—everything lives in a single script, so the logical components are embedded in code blocks.

##### Extract insights from the README
- Two backbone networks: MobileNetV3Large and InceptionV3.
- A custom data pipeline handles loading, augmentation, batching, and class‑weighting.
- An ensemble strategy combines the two model outputs to yield a final prediction.
- TensorFlow is the core framework.

##### Main components
a. Data Source
– Labeled image directories or file manifest (external storage)
b. Data Pipeline
– Image loader
– Preprocessing (resizing, normalization, augmentation)
– Batch generator with class‑weighting logic
c. Model Training Pipelines (parallel)
– MobileNetV3Large branch
– InceptionV3 branch
d. Ensemble Module
– Aggregator that merges predictions from both branches (e.g., weighted average or meta‑learner)
e. Evaluation
– F1‑score calculator, confusion matrix generator, logs
f. Model Export
– Serialization to best_model.keras for deployment/use
g. External Dependencies
– TensorFlow/Keras
– Any logging, metrics, or visualization libraries

##### Relationships and interactions
- Data flows from the Data Source into the Data Pipeline.
- Preprocessed batches are sent to both MobileNetV3Large and InceptionV3 branches concurrently.
- Each branch produces prediction logits.
- The Ensemble Module takes both sets of logits and outputs final predictions.
- The Evaluation component consumes true labels and final predictions.
- Upon satisfactory metrics, the trained ensemble is exported to best_model.keras.

##### Important architectural patterns
- Parallelism: two model training branches run in tandem on the same data.
- Modular pipeline: clear separation between data handling, model definition, ensembling, and evaluation.
- Export‑ready artifact: decoupling training logic (train_model.py) from inference artifact (best_model.keras).

## Diagram (Mermaid)

```mermaid
flowchart TD
    DS["Data Source\n(Labeled Images)"]:::data
    DP["Data Pipeline\n(Image loading, preprocessing,\naugmentation, batching,\nclass-weighting)"]:::data
    subgraph "Model Training"
        MN["MobileNetV3Large\n(TensorFlow)"]:::model
        IN["InceptionV3\n(TensorFlow)"]:::model
    end
    EN["Ensemble Module\n(weighted aggregator)"]:::model
    EV["Evaluation\n(F1-score, confusion matrix,\nlogging)"]:::eval
    EX["Model Export\n(best_model.keras)"]:::eval
    ED["External Dependencies\n(TensorFlow/Keras,\nlogging/metrics)"]:::external

    DS -->|"raw images"| DP
    DP -->|"batches"| MN
    DP -->|"batches"| IN
    MN -->|"logits"| EN
    IN -->|"logits"| EN
    EN -->|"predictions"| EV
    EV -->|"metrics"| EX

    ED -.-> DP
    ED -.-> MN
    ED -.-> IN
    ED -.-> EN
    ED -.-> EV
    ED -.-> EX

    click DP "https://github.com/roar3691/art_image_classifier/blob/main/train_model.py"
    click MN "https://github.com/roar3691/art_image_classifier/blob/main/train_model.py"
    click IN "https://github.com/roar3691/art_image_classifier/blob/main/train_model.py"
    click EN "https://github.com/roar3691/art_image_classifier/blob/main/train_model.py"
    click EV "https://github.com/roar3691/art_image_classifier/blob/main/train_model.py"
    click EX "https://github.com/roar3691/art_image_classifier/blob/main/best_model.keras"
    click ED "https://github.com/roar3691/art_image_classifier/blob/main/train_model.py"

    classDef data fill:#AED6F1,stroke:#1F618D,color:#1B4F72;
    classDef model fill:#ABEBC6,stroke:#239B56,color:#1D8348;
    classDef eval fill:#FAD7A0,stroke:#D68910,color:#B9770E;
    classDef external fill:#D5DBDB,stroke:#566573,color:#2C3E50;
```
