# panharo/foodimage architecture

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

- Interactive diagram: https://gitdiagram.com/panharo/foodimage
- Repository: https://github.com/panharo/foodimage

## Overview

FoodImage is a command-line computer-vision toolkit, not a web application. Its main workflow trains either MobileNetV2 or EfficientNet-B0 on the ten-class image dataset, saves the best checkpoint and training reports, and supports checkpoint evaluation with classification metrics. A separate utility preprocesses YOLO detection data, while another collects images and rebuilds the laphet thoke dataset. The training and preprocessing paths are documented or excerpted; evaluation internals and the image-download script’s detailed behavior were not inspected.

Main entry points: [`trained_models/mobilenet/train.py`](https://github.com/panharo/foodimage/blob/master/trained_models/mobilenet/train.py) (MobileNet Training), [`trained_models/efficientnet/train.py`](https://github.com/panharo/foodimage/blob/master/trained_models/efficientnet/train.py) (EfficientNet Training), [`dataset`](https://github.com/panharo/foodimage/tree/master/dataset) (Classification Dataset), [`trained_models/checkpoints`](https://github.com/panharo/foodimage/tree/master/trained_models/checkpoints) (Model Checkpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_classification["Food Classification"]
  node_mobile_cli["MobileNet CLI<br/>[cli.py]"]
  node_efficient_cli["EfficientNet CLI<br/>[cli.py]"]
  node_dataset["Classification Dataset"]
  node_mobile_eval["MobileNet Evaluation"]
  node_efficient_eval["EfficientNet Evaluation"]
end

subgraph group_modeling["Model Training"]
  node_mobile_train["MobileNet Training<br/>[train.py]"]
  node_efficient_train["EfficientNet Training<br/>[train.py]"]
  node_mobile_prep["MobileNet Transforms<br/>[preprocessing.py]"]
  node_efficient_prep["EfficientNet Transforms<br/>[preprocessing.py]"]
  node_mobile_model["MobileNet Model"]
  node_efficient_model["EfficientNet Model"]
  node_mobile_config["MobileNet Config<br/>[config.py]"]
  node_efficient_config["EfficientNet Config<br/>[config.py]"]
  node_checkpoints["Model Checkpoints"]
  node_metrics["Training Reports<br/>[metrics.py]"]
  node_reports["Generated Reports"]
end

subgraph group_yolo["YOLO Preprocessing"]
  node_yolo_data["YOLO Dataset"]
  node_yolo_preprocess["YOLO Preprocessor<br/>[preprocess_yolo.py]"]
  node_yolo_output["Processed YOLO Data"]
end

subgraph group_data_tools["Dataset Tools"]
  node_image_downloader["Image Collection<br/>[download_image.py]"]
end

node_user(("CLI User"))

node_user -->|"selects action"| node_mobile_cli
node_user -->|"selects action"| node_efficient_cli
node_user -->|"runs preprocessing"| node_yolo_preprocess
node_user -->|"runs collection"| node_image_downloader
node_mobile_cli -->|"dispatches training"| node_mobile_train
node_mobile_cli -->|"dispatches evaluation"| node_mobile_eval
node_efficient_cli -->|"dispatches training"| node_efficient_train
node_efficient_cli -->|"dispatches evaluation"| node_efficient_eval
node_mobile_train -->|"loads splits"| node_dataset
node_efficient_train -->|"loads splits"| node_dataset
node_mobile_train -->|"uses transforms"| node_mobile_prep
node_efficient_train -->|"uses transforms"| node_efficient_prep
node_mobile_train -->|"builds and tunes"| node_mobile_model
node_efficient_train -->|"builds and tunes"| node_efficient_model
node_mobile_train -->|"reads settings"| node_mobile_config
node_efficient_train -->|"reads settings"| node_efficient_config
node_mobile_train -->|"saves best weights"| node_checkpoints
node_efficient_train -->|"saves best weights"| node_checkpoints
node_mobile_train -->|"saves history"| node_metrics
node_efficient_train -->|"saves history"| node_metrics
node_metrics -->|"writes plots and CSVs"| node_reports
node_mobile_eval -.->|"loads checkpoint"| node_checkpoints
node_mobile_eval -.->|"evaluates test split"| node_dataset
node_efficient_eval -.->|"loads checkpoint"| node_checkpoints
node_efficient_eval -.->|"evaluates test split"| node_dataset
node_yolo_preprocess -->|"reads splits"| node_yolo_data
node_yolo_preprocess -->|"writes processed data"| node_yolo_output
node_image_downloader -->|"rebuilds class data"| node_dataset

click node_mobile_cli "https://github.com/panharo/foodimage/blob/master/trained_models/mobilenet/cli.py"
click node_efficient_cli "https://github.com/panharo/foodimage/blob/master/trained_models/efficientnet/cli.py"
click node_mobile_train "https://github.com/panharo/foodimage/blob/master/trained_models/mobilenet/train.py"
click node_efficient_train "https://github.com/panharo/foodimage/blob/master/trained_models/efficientnet/train.py"
click node_mobile_prep "https://github.com/panharo/foodimage/blob/master/trained_models/mobilenet/preprocessing.py"
click node_efficient_prep "https://github.com/panharo/foodimage/blob/master/trained_models/efficientnet/preprocessing.py"
click node_mobile_model "https://github.com/panharo/foodimage/blob/master/trained_models/mobilenet/feature_extraction.py"
click node_efficient_model "https://github.com/panharo/foodimage/blob/master/trained_models/efficientnet/feature_extraction.py"
click node_mobile_config "https://github.com/panharo/foodimage/blob/master/trained_models/mobilenet/config.py"
click node_efficient_config "https://github.com/panharo/foodimage/blob/master/trained_models/efficientnet/config.py"
click node_dataset "https://github.com/panharo/foodimage/tree/master/dataset"
click node_mobile_eval "https://github.com/panharo/foodimage/tree/master/trained_models/mobilenet"
click node_efficient_eval "https://github.com/panharo/foodimage/tree/master/trained_models/efficientnet"
click node_checkpoints "https://github.com/panharo/foodimage/tree/master/trained_models/checkpoints"
click node_metrics "https://github.com/panharo/foodimage/blob/master/trained_models/metrics.py"
click node_reports "https://github.com/panharo/foodimage/tree/master/reports"
click node_yolo_data "https://github.com/panharo/foodimage/tree/master/SEA_food_detection_cleaned_yolov11"
click node_yolo_preprocess "https://github.com/panharo/foodimage/blob/master/preprocess_yolo.py"
click node_image_downloader "https://github.com/panharo/foodimage/blob/master/download_image.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_mobile_cli,node_efficient_cli,node_dataset,node_mobile_eval,node_efficient_eval,node_user toneBlue
class node_mobile_train,node_efficient_train,node_mobile_prep,node_efficient_prep,node_mobile_model,node_efficient_model,node_mobile_config,node_efficient_config,node_checkpoints,node_metrics,node_reports toneAmber
class node_yolo_data,node_yolo_preprocess,node_yolo_output toneMint
class node_image_downloader toneRose
```

## Components

### Food Classification

- [MobileNet CLI](https://github.com/panharo/foodimage/blob/master/trained_models/mobilenet/cli.py): `trained_models/mobilenet/cli.py`
- [EfficientNet CLI](https://github.com/panharo/foodimage/blob/master/trained_models/efficientnet/cli.py): `trained_models/efficientnet/cli.py`
- [Classification Dataset](https://github.com/panharo/foodimage/tree/master/dataset): `dataset`
- [MobileNet Evaluation](https://github.com/panharo/foodimage/tree/master/trained_models/mobilenet): `trained_models/mobilenet`
- [EfficientNet Evaluation](https://github.com/panharo/foodimage/tree/master/trained_models/efficientnet): `trained_models/efficientnet`

### Model Training

- [MobileNet Training](https://github.com/panharo/foodimage/blob/master/trained_models/mobilenet/train.py): `trained_models/mobilenet/train.py`
- [EfficientNet Training](https://github.com/panharo/foodimage/blob/master/trained_models/efficientnet/train.py): `trained_models/efficientnet/train.py`
- [MobileNet Transforms](https://github.com/panharo/foodimage/blob/master/trained_models/mobilenet/preprocessing.py): `trained_models/mobilenet/preprocessing.py`
- [EfficientNet Transforms](https://github.com/panharo/foodimage/blob/master/trained_models/efficientnet/preprocessing.py): `trained_models/efficientnet/preprocessing.py`
- [MobileNet Model](https://github.com/panharo/foodimage/blob/master/trained_models/mobilenet/feature_extraction.py): `trained_models/mobilenet/feature_extraction.py`
- [EfficientNet Model](https://github.com/panharo/foodimage/blob/master/trained_models/efficientnet/feature_extraction.py): `trained_models/efficientnet/feature_extraction.py`
- [MobileNet Config](https://github.com/panharo/foodimage/blob/master/trained_models/mobilenet/config.py): `trained_models/mobilenet/config.py`
- [EfficientNet Config](https://github.com/panharo/foodimage/blob/master/trained_models/efficientnet/config.py): `trained_models/efficientnet/config.py`
- [Model Checkpoints](https://github.com/panharo/foodimage/tree/master/trained_models/checkpoints): `trained_models/checkpoints`
- [Training Reports](https://github.com/panharo/foodimage/blob/master/trained_models/metrics.py): `trained_models/metrics.py`
- [Generated Reports](https://github.com/panharo/foodimage/tree/master/reports): `reports`

### YOLO Preprocessing

- [YOLO Dataset](https://github.com/panharo/foodimage/tree/master/SEA_food_detection_cleaned_yolov11): `SEA_food_detection_cleaned_yolov11`
- [YOLO Preprocessor](https://github.com/panharo/foodimage/blob/master/preprocess_yolo.py): `preprocess_yolo.py`
- **Processed YOLO Data**

### Dataset Tools

- [Image Collection](https://github.com/panharo/foodimage/blob/master/download_image.py): `download_image.py`

### Other components

- **CLI User**

## Connections

- CLI User → MobileNet CLI: selects action (evidence: `README.md`)
- CLI User → EfficientNet CLI: selects action (evidence: `README.md`)
- CLI User → YOLO Preprocessor: runs preprocessing (evidence: `README.md`)
- CLI User → Image Collection: runs collection (evidence: `README.md`)
- MobileNet CLI → MobileNet Training: dispatches training (evidence: `trained_models/mobilenet/cli.py`)
- MobileNet CLI → MobileNet Evaluation: dispatches evaluation (evidence: `trained_models/mobilenet/cli.py`)
- EfficientNet CLI → EfficientNet Training: dispatches training (evidence: `trained_models/efficientnet/cli.py`)
- EfficientNet CLI → EfficientNet Evaluation: dispatches evaluation (evidence: `trained_models/efficientnet/cli.py`)
- MobileNet Training → Classification Dataset: loads splits (evidence: `trained_models/mobilenet/train.py`)
- EfficientNet Training → Classification Dataset: loads splits (evidence: `trained_models/efficientnet/train.py`)
- MobileNet Training → MobileNet Transforms: uses transforms (evidence: `trained_models/mobilenet/train.py`)
- EfficientNet Training → EfficientNet Transforms: uses transforms (evidence: `trained_models/efficientnet/train.py`)
- MobileNet Training → MobileNet Model: builds and tunes (evidence: `trained_models/mobilenet/train.py`)
- EfficientNet Training → EfficientNet Model: builds and tunes (evidence: `trained_models/efficientnet/train.py`)
- MobileNet Training → MobileNet Config: reads settings (evidence: `trained_models/mobilenet/train.py`)
- EfficientNet Training → EfficientNet Config: reads settings (evidence: `trained_models/efficientnet/train.py`)
- MobileNet Training → Model Checkpoints: saves best weights (evidence: `trained_models/mobilenet/train.py`)
- EfficientNet Training → Model Checkpoints: saves best weights (evidence: `trained_models/efficientnet/train.py`)
- MobileNet Training → Training Reports: saves history (evidence: `trained_models/mobilenet/train.py`)
- EfficientNet Training → Training Reports: saves history (evidence: `trained_models/efficientnet/train.py`)
- Training Reports → Generated Reports: writes plots and CSVs (evidence: `trained_models/metrics.py`)
- MobileNet Evaluation → Model Checkpoints: loads checkpoint
- MobileNet Evaluation → Classification Dataset: evaluates test split
- EfficientNet Evaluation → Model Checkpoints: loads checkpoint
- EfficientNet Evaluation → Classification Dataset: evaluates test split
- YOLO Preprocessor → YOLO Dataset: reads splits (evidence: `README.md`)
- YOLO Preprocessor → Processed YOLO Data: writes processed data (evidence: `README.md`)
- Image Collection → Classification Dataset: rebuilds class data (evidence: `README.md`)
