# khadija-aitmeddour/flower-classifier architecture

> Architecture diagram of the GitHub repository khadija-aitmeddour/flower-classifier, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/khadija-aitmeddour/flower-classifier
- Repository: https://github.com/khadija-aitmeddour/flower-classifier

## Overview

Flower Image Classifier fine-tunes a pretrained PyTorch model on flower datasets, evaluates it, saves a checkpoint, and uses a checkpoint to produce and display top-five image predictions. The graph separates training, inference, and shared utilities; edges reflect calls visible in the excerpts or capabilities explicitly documented in the README. Source excerpts show the main runtime wiring, but do not establish every detail of checkpoint contents or notebook behavior.

Main entry points: [`scripts/predict.py`](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/scripts/predict.py) (Prediction entry point), [`scripts/train.py`](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/scripts/train.py) (Training entry point), [`utils/data_utils.py`](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/utils/data_utils.py) (Dataset loaders), [`utils/model_utils.py`](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/utils/model_utils.py) (Checkpoint saving)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Training and evaluation"]
  node_trainer["Training entry point<br/>[train.py]"]
  node_training_loop["Train and validate<br/>[train.py]"]
  node_test_eval["Test evaluation<br/>[train.py]"]
end

subgraph group_inference["Prediction and display"]
  node_predictor["Prediction entry point<br/>[predict.py]"]
  node_class_names["Class name mapping<br/>[cat_to_name.json]"]
  node_prediction_display["Prediction display<br/>[predict.py]"]
end

subgraph group_shared["Shared utilities"]
  node_training_args["Training arguments<br/>[arg_parsers.py]"]
  node_loaders["Dataset loaders<br/>[data_utils.py]"]
  node_model_factory["Model factory<br/>[model_utils.py]"]
  node_checkpoint_save["Checkpoint saving<br/>[model_utils.py]"]
  node_prediction_args["Prediction arguments<br/>[arg_parsers.py]"]
  node_image_processing["Image preprocessing<br/>[data_utils.py]"]
  node_inference_model["Inference model<br/>[model_utils.py]"]
end

node_dataset["Flower image dataset"]
node_checkpoint["Model checkpoint"]
node_image_input(("Input image"))
node_user(("User"))

node_user -->|"starts training"| node_trainer
node_trainer -->|"parses"| node_training_args
node_trainer -->|"loads datasets"| node_loaders
node_dataset -.->|"provides images"| node_loaders
node_trainer -->|"creates model"| node_model_factory
node_trainer -->|"trains"| node_training_loop
node_loaders -.->|"provides train and validation batches"| node_training_loop
node_trainer -->|"evaluates"| node_test_eval
node_loaders -.->|"provides test batches"| node_test_eval
node_trainer -->|"saves checkpoint"| node_checkpoint_save
node_checkpoint_save -.->|"writes"| node_checkpoint
node_user -->|"requests prediction"| node_predictor
node_image_input -->|"supplies image"| node_predictor
node_predictor -->|"parses"| node_prediction_args
node_predictor -->|"creates model"| node_inference_model
node_predictor -->|"loads checkpoint"| node_checkpoint
node_predictor -->|"preprocesses image"| node_image_processing
node_predictor -->|"reads names"| node_class_names
node_predictor -->|"shows results"| node_prediction_display
node_prediction_display -->|"presents predictions"| node_user

click node_trainer "https://github.com/khadija-aitmeddour/flower-classifier/blob/main/scripts/train.py"
click node_training_args "https://github.com/khadija-aitmeddour/flower-classifier/blob/main/utils/arg_parsers.py"
click node_loaders "https://github.com/khadija-aitmeddour/flower-classifier/blob/main/utils/data_utils.py"
click node_model_factory "https://github.com/khadija-aitmeddour/flower-classifier/blob/main/utils/model_utils.py"
click node_training_loop "https://github.com/khadija-aitmeddour/flower-classifier/blob/main/scripts/train.py"
click node_test_eval "https://github.com/khadija-aitmeddour/flower-classifier/blob/main/scripts/train.py"
click node_checkpoint_save "https://github.com/khadija-aitmeddour/flower-classifier/blob/main/utils/model_utils.py"
click node_predictor "https://github.com/khadija-aitmeddour/flower-classifier/blob/main/scripts/predict.py"
click node_prediction_args "https://github.com/khadija-aitmeddour/flower-classifier/blob/main/utils/arg_parsers.py"
click node_image_processing "https://github.com/khadija-aitmeddour/flower-classifier/blob/main/utils/data_utils.py"
click node_inference_model "https://github.com/khadija-aitmeddour/flower-classifier/blob/main/utils/model_utils.py"
click node_class_names "https://github.com/khadija-aitmeddour/flower-classifier/blob/main/cat_to_name.json"
click node_prediction_display "https://github.com/khadija-aitmeddour/flower-classifier/blob/main/scripts/predict.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_trainer,node_training_loop,node_test_eval,node_user toneBlue
class node_predictor,node_class_names,node_prediction_display toneAmber
class node_training_args,node_loaders,node_model_factory,node_checkpoint_save,node_prediction_args,node_image_processing,node_inference_model toneMint
class node_dataset,node_checkpoint,node_image_input toneIndigo
```

## Components

### Training and evaluation

- [Training entry point](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/scripts/train.py): `scripts/train.py`
- [Train and validate](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/scripts/train.py): `scripts/train.py`
- [Test evaluation](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/scripts/train.py): `scripts/train.py`

### Prediction and display

- [Prediction entry point](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/scripts/predict.py): `scripts/predict.py`
- [Class name mapping](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/cat_to_name.json): `cat_to_name.json`
- [Prediction display](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/scripts/predict.py): `scripts/predict.py`

### Shared utilities

- [Training arguments](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/utils/arg_parsers.py): `utils/arg_parsers.py`
- [Dataset loaders](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/utils/data_utils.py): `utils/data_utils.py`
- [Model factory](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/utils/model_utils.py): `utils/model_utils.py`
- [Checkpoint saving](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/utils/model_utils.py): `utils/model_utils.py`
- [Prediction arguments](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/utils/arg_parsers.py): `utils/arg_parsers.py`
- [Image preprocessing](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/utils/data_utils.py): `utils/data_utils.py`
- [Inference model](https://github.com/khadija-aitmeddour/flower-classifier/blob/main/utils/model_utils.py): `utils/model_utils.py`

### Other components

- **Flower image dataset**
- **Model checkpoint**
- **Input image**
- **User**

## Connections

- User → Training entry point: starts training (evidence: `README.md`)
- Training entry point → Training arguments: parses (evidence: `scripts/train.py`)
- Training entry point → Dataset loaders: loads datasets (evidence: `scripts/train.py`)
- Flower image dataset → Dataset loaders: provides images
- Training entry point → Model factory: creates model (evidence: `scripts/train.py`)
- Training entry point → Train and validate: trains (evidence: `scripts/train.py`)
- Dataset loaders → Train and validate: provides train and validation batches (evidence: `scripts/train.py`)
- Training entry point → Test evaluation: evaluates (evidence: `scripts/train.py`)
- Dataset loaders → Test evaluation: provides test batches (evidence: `scripts/train.py`)
- Training entry point → Checkpoint saving: saves checkpoint (evidence: `scripts/train.py`)
- Checkpoint saving → Model checkpoint: writes
- User → Prediction entry point: requests prediction (evidence: `README.md`)
- Input image → Prediction entry point: supplies image (evidence: `scripts/predict.py`)
- Prediction entry point → Prediction arguments: parses (evidence: `scripts/predict.py`)
- Prediction entry point → Inference model: creates model (evidence: `scripts/predict.py`)
- Prediction entry point → Model checkpoint: loads checkpoint (evidence: `scripts/predict.py`)
- Prediction entry point → Image preprocessing: preprocesses image (evidence: `scripts/predict.py`)
- Prediction entry point → Class name mapping: reads names (evidence: `scripts/predict.py`)
- Prediction entry point → Prediction display: shows results (evidence: `scripts/predict.py`)
- Prediction display → User: presents predictions (evidence: `scripts/predict.py`)
