# alok-senapati/cifar100-cnn architecture

> Architecture diagram of the GitHub repository alok-senapati/cifar100-cnn, 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/alok-senapati/cifar100-cnn
- Repository: https://github.com/alok-senapati/cifar100-cnn

## Overview

CIFAR-100 CNN is a PyTorch image-classification project whose main workflow configures a run, loads and normalizes deterministic train/validation/test data, trains one of three CNN variants, selects the lowest-validation-loss checkpoint, and evaluates it. A Streamlit dashboard separately discovers saved runs and serves test-image predictions. The README documents augmentation, schedulers, BatchNorm, metrics, and checkpoint artifacts. Some script and trainer details are unsampled; edges use README statements or visible/import-index evidence rather than assuming internal calls.

Main entry points: [`src/cifar100_cnn/model/trainer.py`](https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/model/trainer.py) (Training and evaluation), [`scripts/train_gap_classifier.py`](https://github.com/alok-senapati/cifar100-cnn/blob/main/scripts/train_gap_classifier.py) (GAP run), [`scripts/train_baseline.py`](https://github.com/alok-senapati/cifar100-cnn/blob/main/scripts/train_baseline.py) (Baseline run), [`scripts/train_reduced_pooling.py`](https://github.com/alok-senapati/cifar100-cnn/blob/main/scripts/train_reduced_pooling.py) (Reduced-pooling run)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Training workflow"]
  node_config["Run configuration<br/>[parser_classes.py]"]
  node_baseline_run["Baseline run<br/>[train_baseline.py]"]
  node_gap_run["GAP run"]
  node_reduced_run["Reduced-pooling run"]
end

subgraph group_data["Dataset preparation"]
  node_cifar[("CIFAR-100 data<br/>[loader.py]")]
  node_transforms["Image transforms<br/>[transforms.py]"]
end

subgraph group_models["CNN architectures"]
  node_baseline_model["Baseline CNN<br/>[baseline.py]"]
  node_gap_model["GAP CNN<br/>[gap_classifier.py]"]
  node_reduced_model["Reduced-pooling CNN<br/>[reduced_pooling.py]"]
end

subgraph group_runtime["Training and evaluation"]
  node_trainer["Training and evaluation<br/>[trainer.py]"]
  node_checkpoint["Checkpoint reconstruction<br/>[loader.py]"]
  node_diagnostics["Gradient diagnostics<br/>[diagnose.py]"]
  node_console["Console formatting<br/>[printer.py]"]
  node_timing["Epoch timing<br/>[timer.py]"]
  node_plots["Metric and result plots<br/>[visualizer.py]"]
end

subgraph group_inference["Inference dashboard"]
  node_dashboard["Streamlit inference<br/>[app.py]"]
end

node_user(("Researcher"))

node_user -->|"starts training"| node_baseline_run
node_user -->|"starts training"| node_gap_run
node_user -->|"starts training"| node_reduced_run
node_user -->|"opens dashboard"| node_dashboard
node_baseline_run -->|"reads options"| node_config
node_gap_run -->|"reads options"| node_config
node_reduced_run -->|"reads options"| node_config
node_baseline_run -->|"loads splits"| node_cifar
node_gap_run -->|"loads splits"| node_cifar
node_reduced_run -->|"loads splits"| node_cifar
node_gap_run -->|"configures augmentation"| node_transforms
node_baseline_run -->|"trains variant"| node_baseline_model
node_gap_run -->|"trains variant"| node_gap_model
node_reduced_run -->|"trains variant"| node_reduced_model
node_baseline_run -->|"invokes training"| node_trainer
node_gap_run -->|"invokes training"| node_trainer
node_reduced_run -->|"invokes training"| node_trainer
node_trainer -->|"measures epochs"| node_timing
node_trainer -->|"uses diagnostics"| node_diagnostics
node_trainer -->|"formats output"| node_console
node_trainer -->|"renders metrics"| node_plots
node_dashboard -->|"loads selected model"| node_checkpoint
node_dashboard -->|"loads test data"| node_cifar

click node_config "https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/args/parser_classes.py"
click node_baseline_run "https://github.com/alok-senapati/cifar100-cnn/blob/main/scripts/train_baseline.py"
click node_gap_run "https://github.com/alok-senapati/cifar100-cnn/blob/main/scripts/train_gap_classifier.py"
click node_reduced_run "https://github.com/alok-senapati/cifar100-cnn/blob/main/scripts/train_reduced_pooling.py"
click node_cifar "https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/data/loader.py"
click node_transforms "https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/data/transforms.py"
click node_baseline_model "https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/model/baseline.py"
click node_gap_model "https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/model/gap_classifier.py"
click node_reduced_model "https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/model/reduced_pooling.py"
click node_trainer "https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/model/trainer.py"
click node_checkpoint "https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/model/loader.py"
click node_diagnostics "https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/utils/diagnose.py"
click node_console "https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/utils/printer.py"
click node_timing "https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/utils/timer.py"
click node_plots "https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/utils/visualizer.py"
click node_dashboard "https://github.com/alok-senapati/cifar100-cnn/blob/main/app.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_config,node_baseline_run,node_gap_run,node_reduced_run toneBlue
class node_cifar,node_transforms toneAmber
class node_baseline_model,node_gap_model,node_reduced_model toneMint
class node_trainer,node_checkpoint,node_diagnostics,node_console,node_timing,node_plots toneRose
class node_dashboard,node_user toneIndigo
```

## Components

### Training workflow

- [Run configuration](https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/args/parser_classes.py): `src/cifar100_cnn/args/parser_classes.py`
- [Baseline run](https://github.com/alok-senapati/cifar100-cnn/blob/main/scripts/train_baseline.py): `scripts/train_baseline.py`
- [GAP run](https://github.com/alok-senapati/cifar100-cnn/blob/main/scripts/train_gap_classifier.py): `scripts/train_gap_classifier.py`
- [Reduced-pooling run](https://github.com/alok-senapati/cifar100-cnn/blob/main/scripts/train_reduced_pooling.py): `scripts/train_reduced_pooling.py`

### Dataset preparation

- [CIFAR-100 data](https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/data/loader.py): `src/cifar100_cnn/data/loader.py`
- [Image transforms](https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/data/transforms.py): `src/cifar100_cnn/data/transforms.py`

### CNN architectures

- [Baseline CNN](https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/model/baseline.py): `src/cifar100_cnn/model/baseline.py`
- [GAP CNN](https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/model/gap_classifier.py): `src/cifar100_cnn/model/gap_classifier.py`
- [Reduced-pooling CNN](https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/model/reduced_pooling.py): `src/cifar100_cnn/model/reduced_pooling.py`

### Training and evaluation

- [Training and evaluation](https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/model/trainer.py): `src/cifar100_cnn/model/trainer.py`
- [Checkpoint reconstruction](https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/model/loader.py): `src/cifar100_cnn/model/loader.py`
- [Gradient diagnostics](https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/utils/diagnose.py): `src/cifar100_cnn/utils/diagnose.py`
- [Console formatting](https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/utils/printer.py): `src/cifar100_cnn/utils/printer.py`
- [Epoch timing](https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/utils/timer.py): `src/cifar100_cnn/utils/timer.py`
- [Metric and result plots](https://github.com/alok-senapati/cifar100-cnn/blob/main/src/cifar100_cnn/utils/visualizer.py): `src/cifar100_cnn/utils/visualizer.py`

### Inference dashboard

- [Streamlit inference](https://github.com/alok-senapati/cifar100-cnn/blob/main/app.py): `app.py`

### Other components

- **Researcher**

## Connections

- Researcher → Baseline run: starts training (evidence: `README.md`)
- Researcher → GAP run: starts training (evidence: `README.md`)
- Researcher → Reduced-pooling run: starts training (evidence: `README.md`)
- Researcher → Streamlit inference: opens dashboard (evidence: `README.md`)
- Baseline run → Run configuration: reads options (evidence: `scripts/train_baseline.py`)
- GAP run → Run configuration: reads options (evidence: `scripts/train_gap_classifier.py`)
- Reduced-pooling run → Run configuration: reads options (evidence: `scripts/train_reduced_pooling.py`)
- Baseline run → CIFAR-100 data: loads splits (evidence: `scripts/train_baseline.py`)
- GAP run → CIFAR-100 data: loads splits (evidence: `scripts/train_gap_classifier.py`)
- Reduced-pooling run → CIFAR-100 data: loads splits (evidence: `scripts/train_reduced_pooling.py`)
- GAP run → Image transforms: configures augmentation (evidence: `scripts/train_gap_classifier.py`)
- Baseline run → Baseline CNN: trains variant (evidence: `README.md`)
- GAP run → GAP CNN: trains variant (evidence: `README.md`)
- Reduced-pooling run → Reduced-pooling CNN: trains variant (evidence: `README.md`)
- Baseline run → Training and evaluation: invokes training (evidence: `scripts/train_baseline.py`)
- GAP run → Training and evaluation: invokes training (evidence: `scripts/train_gap_classifier.py`)
- Reduced-pooling run → Training and evaluation: invokes training (evidence: `scripts/train_reduced_pooling.py`)
- Training and evaluation → Epoch timing: measures epochs (evidence: `src/cifar100_cnn/model/trainer.py`)
- Training and evaluation → Gradient diagnostics: uses diagnostics (evidence: `src/cifar100_cnn/model/trainer.py`)
- Training and evaluation → Console formatting: formats output (evidence: `src/cifar100_cnn/model/trainer.py`)
- Training and evaluation → Metric and result plots: renders metrics (evidence: `src/cifar100_cnn/model/trainer.py`)
- Streamlit inference → Checkpoint reconstruction: loads selected model (evidence: `app.py`)
- Streamlit inference → CIFAR-100 data: loads test data (evidence: `app.py`)
