# lingtengqiu/yolo_nano architecture

> Architecture diagram of the GitHub repository lingtengqiu/yolo_nano, 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/lingtengqiu/yolo_nano
- Repository: https://github.com/lingtengqiu/yolo_nano

## Overview

PyTorch-YOLO_Nano is an object-detection implementation supporting model training, evaluation/testing, and inference over image or video datasets. The main workflow configures a dataset and model, trains with augmentation and learning-rate scheduling, and saves checkpoints; inference loads weights, runs detection, and writes annotated video. The graph includes the documented augmentation and training features. Some connections are based on SOURCE INDEX references rather than complete excerpts, so uncertain call paths are omitted.

Main entry points: [`train.py`](https://github.com/lingtengqiu/yolo_nano/blob/master/train.py) (Train model), [`utils/datasets.py`](https://github.com/lingtengqiu/yolo_nano/blob/master/utils/datasets.py) (Dataset loading), [`inference.py`](https://github.com/lingtengqiu/yolo_nano/blob/master/inference.py) (Run inference), [`models/darknet.py`](https://github.com/lingtengqiu/yolo_nano/blob/master/models/darknet.py) (Darknet network)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entrypoints["Product workflows"]
  node_training_run["Train model<br/>[train.py]"]
  node_testing["Test model<br/>[test.py]"]
  node_inference["Run inference<br/>[inference.py]"]
  node_detection["Detect objects<br/>[detect.py]"]
  node_video_output["Annotated video"]
end

subgraph group_data["Data preparation"]
  node_dataset["Dataset loading<br/>[datasets.py]"]
  node_catalog["Dataset catalog<br/>[default_path.py]"]
  node_augmentation["Image augmentation<br/>[augmentations.py]"]
  node_memcached["Memcached reader<br/>[mc_reader.py]"]
end

subgraph group_model["Detection model"]
  node_darknet["Darknet network<br/>[darknet.py]"]
  node_nano["YOLO Nano network"]
  node_config_parser["Config parsing<br/>[parse_config.py]"]
  node_detection_utils["Detection utilities<br/>[utils.py]"]
end

subgraph group_training["Training support"]
  node_scheduler["Learning-rate policy<br/>[optim.py]"]
  node_logger["Training logger<br/>[logger.py]"]
  node_visualizer["TensorBoard visualizer<br/>[board.py]"]
  node_checkpoints[("Saved checkpoints")]
end

node_engineer(("User"))

node_engineer -->|"starts training"| node_training_run
node_engineer -->|"runs tests"| node_testing
node_engineer -.->|"starts inference"| node_inference
node_engineer -.->|"starts detection"| node_detection
node_training_run -->|"parses config"| node_config_parser
node_training_run -->|"loads batches"| node_dataset
node_training_run -->|"trains network"| node_darknet
node_training_run -->|"trains network"| node_nano
node_training_run -->|"sets learning rate"| node_scheduler
node_training_run -->|"logs metrics"| node_logger
node_training_run -->|"saves weights"| node_checkpoints
node_training_run -.->|"evaluates model"| node_testing
node_dataset -->|"gets dataset paths"| node_catalog
node_dataset -->|"augments images"| node_augmentation
node_dataset -.->|"reads cached data"| node_memcached
node_darknet -->|"parses model config"| node_config_parser
node_darknet -->|"builds targets"| node_detection_utils
node_testing -.->|"loads evaluation data"| node_dataset
node_testing -.->|"evaluates network"| node_darknet
node_inference -->|"loads inputs"| node_dataset
node_inference -->|"runs network"| node_darknet
node_inference -->|"runs network"| node_nano
node_inference -->|"processes detections"| node_detection_utils
node_inference -->|"writes video"| node_video_output
node_detection -->|"loads images"| node_dataset
node_detection -->|"uses detection helpers"| node_detection_utils
node_visualizer -.->|"records metrics"| node_logger

click node_training_run "https://github.com/lingtengqiu/yolo_nano/blob/master/train.py"
click node_testing "https://github.com/lingtengqiu/yolo_nano/blob/master/test.py"
click node_inference "https://github.com/lingtengqiu/yolo_nano/blob/master/inference.py"
click node_detection "https://github.com/lingtengqiu/yolo_nano/blob/master/detect.py"
click node_dataset "https://github.com/lingtengqiu/yolo_nano/blob/master/utils/datasets.py"
click node_catalog "https://github.com/lingtengqiu/yolo_nano/blob/master/data/default_path.py"
click node_augmentation "https://github.com/lingtengqiu/yolo_nano/blob/master/utils/augmentations.py"
click node_memcached "https://github.com/lingtengqiu/yolo_nano/blob/master/utils/mc_reader.py"
click node_darknet "https://github.com/lingtengqiu/yolo_nano/blob/master/models/darknet.py"
click node_nano "https://github.com/lingtengqiu/yolo_nano/blob/master/models/yolo_nano_helper.py"
click node_config_parser "https://github.com/lingtengqiu/yolo_nano/blob/master/utils/parse_config.py"
click node_detection_utils "https://github.com/lingtengqiu/yolo_nano/blob/master/utils/utils.py"
click node_scheduler "https://github.com/lingtengqiu/yolo_nano/blob/master/utils/optim.py"
click node_logger "https://github.com/lingtengqiu/yolo_nano/blob/master/utils/logger.py"
click node_visualizer "https://github.com/lingtengqiu/yolo_nano/blob/master/utils/board.py"
click node_video_output "https://github.com/lingtengqiu/yolo_nano/tree/master/result"

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_training_run,node_testing,node_inference,node_detection,node_video_output,node_engineer toneBlue
class node_dataset,node_catalog,node_augmentation,node_memcached toneAmber
class node_darknet,node_nano,node_config_parser,node_detection_utils toneMint
class node_scheduler,node_logger,node_visualizer,node_checkpoints toneRose
```

## Components

### Product workflows

- [Train model](https://github.com/lingtengqiu/yolo_nano/blob/master/train.py): `train.py`
- [Test model](https://github.com/lingtengqiu/yolo_nano/blob/master/test.py): `test.py`
- [Run inference](https://github.com/lingtengqiu/yolo_nano/blob/master/inference.py): `inference.py`
- [Detect objects](https://github.com/lingtengqiu/yolo_nano/blob/master/detect.py): `detect.py`
- [Annotated video](https://github.com/lingtengqiu/yolo_nano/tree/master/result): `result`

### Data preparation

- [Dataset loading](https://github.com/lingtengqiu/yolo_nano/blob/master/utils/datasets.py): `utils/datasets.py`
- [Dataset catalog](https://github.com/lingtengqiu/yolo_nano/blob/master/data/default_path.py): `data/default_path.py`
- [Image augmentation](https://github.com/lingtengqiu/yolo_nano/blob/master/utils/augmentations.py): `utils/augmentations.py`
- [Memcached reader](https://github.com/lingtengqiu/yolo_nano/blob/master/utils/mc_reader.py): `utils/mc_reader.py`

### Detection model

- [Darknet network](https://github.com/lingtengqiu/yolo_nano/blob/master/models/darknet.py): `models/darknet.py`
- [YOLO Nano network](https://github.com/lingtengqiu/yolo_nano/blob/master/models/yolo_nano_helper.py): `models/yolo_nano_helper.py`
- [Config parsing](https://github.com/lingtengqiu/yolo_nano/blob/master/utils/parse_config.py): `utils/parse_config.py`
- [Detection utilities](https://github.com/lingtengqiu/yolo_nano/blob/master/utils/utils.py): `utils/utils.py`

### Training support

- [Learning-rate policy](https://github.com/lingtengqiu/yolo_nano/blob/master/utils/optim.py): `utils/optim.py`
- [Training logger](https://github.com/lingtengqiu/yolo_nano/blob/master/utils/logger.py): `utils/logger.py`
- [TensorBoard visualizer](https://github.com/lingtengqiu/yolo_nano/blob/master/utils/board.py): `utils/board.py`
- **Saved checkpoints**

### Other components

- **User**

## Connections

- User → Train model: starts training (evidence: `README.md`)
- User → Test model: runs tests (evidence: `README.md`)
- User → Run inference: starts inference
- User → Detect objects: starts detection
- Train model → Config parsing: parses config (evidence: `train.py`)
- Train model → Dataset loading: loads batches (evidence: `train.py`)
- Train model → Darknet network: trains network (evidence: `train.py`)
- Train model → YOLO Nano network: trains network (evidence: `train.py`)
- Train model → Learning-rate policy: sets learning rate (evidence: `train.py`)
- Train model → Training logger: logs metrics (evidence: `train.py`)
- Train model → Saved checkpoints: saves weights (evidence: `train.py`)
- Train model → Test model: evaluates model (evidence: `train.py`)
- Dataset loading → Dataset catalog: gets dataset paths (evidence: `utils/datasets.py`)
- Dataset loading → Image augmentation: augments images (evidence: `utils/datasets.py`)
- Dataset loading → Memcached reader: reads cached data (evidence: `utils/datasets.py`)
- Darknet network → Config parsing: parses model config (evidence: `models/darknet.py`)
- Darknet network → Detection utilities: builds targets (evidence: `models/darknet.py`)
- Test model → Dataset loading: loads evaluation data
- Test model → Darknet network: evaluates network
- Run inference → Dataset loading: loads inputs (evidence: `inference.py`)
- Run inference → Darknet network: runs network (evidence: `inference.py`)
- Run inference → YOLO Nano network: runs network (evidence: `inference.py`)
- Run inference → Detection utilities: processes detections (evidence: `inference.py`)
- Run inference → Annotated video: writes video (evidence: `inference.py`)
- Detect objects → Dataset loading: loads images (evidence: `detect.py`)
- Detect objects → Detection utilities: uses detection helpers (evidence: `detect.py`)
- TensorBoard visualizer → Training logger: records metrics
