# mansoorkhandurrani/vision-classify-cnn architecture

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

- Interactive diagram: https://gitdiagram.com/mansoorkhandurrani/vision-classify-cnn
- Repository: https://github.com/mansoorkhandurrani/vision-classify-cnn

## Overview

Vision Classify CNN trains and evaluates scene classifiers, then serves the MobileNetV2 model through a Flask upload-and-predict web app. The user workflow runs from selecting or dropping an image in the browser, through the prediction endpoint’s image transforms and model inference, to displaying a class and confidence. The repository also includes dataset inspection, augmentation, scratch-CNN training, transfer learning, experiment runs, and confusion-matrix evaluation. Training and evaluation connections follow the shown imports and calls; the README documents the page and sample-image capabilities.

Main entry points: [`src/train.py`](https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/src/train.py) (CNN training), [`app/app.py`](https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/app/app.py) (Flask prediction API), [`app/static/script.js`](https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/app/static/script.js) (Upload interface), [`models/transfer_mobilenet.pth`](https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/models/transfer_mobilenet.pth) (Saved model weights)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web prediction"]
  node_browser["Upload interface<br/>[script.js]"]
  node_page["Web page<br/>[index.html]"]
  node_api["Flask prediction API<br/>[app.py]"]
end

subgraph group_learning["Training"]
  node_inspection["Dataset inspection<br/>[inspect_data.py]"]
  node_transforms["Image transforms<br/>[preprocess.py]"]
  node_scratch["Scratch CNN<br/>[model.py]"]
  node_training["CNN training<br/>[train.py]"]
  node_transfer["MobileNet fine-tuning<br/>[train_transfer.py]"]
  node_experiments["Training experiments<br/>[run_experiments.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_evaluation["Model evaluation<br/>[evaluate.py]"]
end

subgraph group_artifacts["Model artifacts"]
  node_weights["Saved model weights"]
  node_reports["Evaluation reports"]
end

node_user(("Image user"))
node_dataset[("Scene image dataset")]

node_user -->|"selects image"| node_browser
node_browser -->|"posts image"| node_api
node_api -->|"returns prediction"| node_browser
node_browser -->|"shows result"| node_user
node_api -->|"renders page"| node_page
node_api -->|"loads weights"| node_weights
node_inspection -->|"inspects images"| node_dataset
node_training -->|"loads images"| node_dataset
node_training -->|"uses transforms"| node_transforms
node_training -->|"instantiates"| node_scratch
node_training -->|"saves weights"| node_weights
node_transfer -->|"loads data"| node_training
node_transfer -->|"saves weights"| node_weights
node_experiments -->|"runs training"| node_training
node_evaluation -->|"loads data"| node_training
node_evaluation -->|"loads weights"| node_weights
node_evaluation -->|"writes reports"| node_reports

click node_browser "https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/app/static/script.js"
click node_page "https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/app/templates/index.html"
click node_api "https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/app/app.py"
click node_inspection "https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/src/inspect_data.py"
click node_transforms "https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/src/preprocess.py"
click node_scratch "https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/src/model.py"
click node_training "https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/src/train.py"
click node_transfer "https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/src/train_transfer.py"
click node_experiments "https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/src/run_experiments.py"
click node_evaluation "https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/src/evaluate.py"
click node_weights "https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/models/transfer_mobilenet.pth"
click node_reports "https://github.com/mansoorkhandurrani/vision-classify-cnn/tree/main/results"

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_browser,node_page,node_api,node_user toneBlue
class node_inspection,node_transforms,node_scratch,node_training,node_transfer,node_experiments,node_dataset toneAmber
class node_evaluation toneMint
class node_weights,node_reports toneRose
```

## Components

### Web prediction

- [Upload interface](https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/app/static/script.js): `app/static/script.js`
- [Web page](https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/app/templates/index.html): `app/templates/index.html`
- [Flask prediction API](https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/app/app.py): `app/app.py`

### Training

- [Dataset inspection](https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/src/inspect_data.py): `src/inspect_data.py`
- [Image transforms](https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/src/preprocess.py): `src/preprocess.py`
- [Scratch CNN](https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/src/model.py): `src/model.py`
- [CNN training](https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/src/train.py): `src/train.py`
- [MobileNet fine-tuning](https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/src/train_transfer.py): `src/train_transfer.py`
- [Training experiments](https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/src/run_experiments.py): `src/run_experiments.py`

### Evaluation

- [Model evaluation](https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/src/evaluate.py): `src/evaluate.py`

### Model artifacts

- [Saved model weights](https://github.com/mansoorkhandurrani/vision-classify-cnn/blob/main/models/transfer_mobilenet.pth): `models/transfer_mobilenet.pth`
- [Evaluation reports](https://github.com/mansoorkhandurrani/vision-classify-cnn/tree/main/results): `results`

### Other components

- **Image user**
- **Scene image dataset**

## Connections

- Image user → Upload interface: selects image (evidence: `app/static/script.js`)
- Upload interface → Flask prediction API: posts image (evidence: `app/static/script.js`)
- Flask prediction API → Upload interface: returns prediction (evidence: `app/app.py`)
- Upload interface → Image user: shows result (evidence: `app/static/script.js`)
- Flask prediction API → Web page: renders page (evidence: `README.md`)
- Flask prediction API → Saved model weights: loads weights (evidence: `app/app.py`)
- Dataset inspection → Scene image dataset: inspects images (evidence: `src/inspect_data.py`)
- CNN training → Scene image dataset: loads images (evidence: `src/train.py`)
- CNN training → Image transforms: uses transforms (evidence: `src/train.py`)
- CNN training → Scratch CNN: instantiates (evidence: `src/train.py`)
- CNN training → Saved model weights: saves weights (evidence: `src/train.py`)
- MobileNet fine-tuning → CNN training: loads data (evidence: `src/train_transfer.py`)
- MobileNet fine-tuning → Saved model weights: saves weights (evidence: `src/train_transfer.py`)
- Training experiments → CNN training: runs training (evidence: `src/run_experiments.py`)
- Model evaluation → CNN training: loads data (evidence: `src/evaluate.py`)
- Model evaluation → Saved model weights: loads weights (evidence: `src/evaluate.py`)
- Model evaluation → Evaluation reports: writes reports (evidence: `src/evaluate.py`)
