# pradyumna-chacham/yolov9-deepsort-mot architecture

> Architecture diagram of the GitHub repository pradyumna-chacham/yolov9-deepsort-mot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pradyumna-chacham/yolov9-deepsort-mot
- Repository: https://github.com/pradyumna-chacham/yolov9-deepsort-mot

## Overview

This repository is a configurable video multi-object tracking application. Its main workflow loads configuration, constructs a detector and tracker, processes video frames into persistent tracks, annotates and writes video, and optionally exports JSON and MOT predictions. A separate evaluation utility compares MOT predictions with sequence ground truth. The README documents these capabilities; the sampled orchestrator confirms the main frame loop and exports, while some entry-point and evaluation relationships rely on README statements or the source index.

Main entry points: [`src/pipeline/orchestrator.py`](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/pipeline/orchestrator.py) (Pipeline orchestrator), [`scripts/run_demo.py`](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/scripts/run_demo.py) (Demo entry point), [`src/schemas.py`](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/schemas.py) (Tracking schemas), [`src/config.py`](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/config.py) (Config loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Run setup"]
  node_configfiles["YAML settings<br/>[default.yaml]"]
  node_config["Config loader<br/>[config.py]"]
  node_entry["Demo entry point<br/>[run_demo.py]"]
  node_detfactory["Detector factory<br/>[factory.py]"]
  node_trackfactory["Tracker factory<br/>[factory.py]"]
end

subgraph group_tracking["Tracking pipeline"]
  node_orchestrator["Pipeline orchestrator<br/>[orchestrator.py]"]
  node_reader["Video reader<br/>[video_reader.py]"]
  node_detectorbase["Detector interface<br/>[base.py]"]
  node_ultra["Ultralytics detector"]
  node_yolo["YOLOv9 adapter<br/>[yolov9.py]"]
  node_trackerbase["Tracker interface<br/>[base.py]"]
  node_deepsort["DeepSORT tracker"]
  node_bbox["Box utilities<br/>[bbox_utils.py]"]
  node_schemas["Tracking schemas<br/>[schemas.py]"]
end

subgraph group_outputs["Tracking outputs"]
  node_annotator["Frame annotator<br/>[annotator.py]"]
  node_writer["Video writer<br/>[video_writer.py]"]
  node_exporter["MOT exporter<br/>[mot_exporter.py]"]
  node_jsonout["Track JSON export<br/>[orchestrator.py]"]
  node_videoout["Annotated video"]
  node_motout["MOT predictions"]
  node_captionbase["Caption interface<br/>[base.py]"]
  node_captioner["Template captioner"]
end

subgraph group_evaluation["MOT evaluation"]
  node_evaluator["MOT evaluator<br/>[evaluate_mot.py]"]
  node_groundtruth["MOT ground truth"]
  node_metrics["Evaluation metrics"]
end

node_user(("Run tracking"))
node_video["Input video"]

node_user -->|"starts"| node_entry
node_configfiles -->|"loaded by"| node_config
node_entry -->|"loads"| node_config
node_entry -->|"creates detector"| node_detfactory
node_entry -->|"creates tracker"| node_trackfactory
node_entry -->|"runs"| node_orchestrator
node_config -->|"configures"| node_detfactory
node_config -->|"configures"| node_trackfactory
node_detfactory -->|"selects"| node_ultra
node_detfactory -->|"selects"| node_yolo
node_trackfactory -->|"selects"| node_deepsort
node_orchestrator -->|"reads frames"| node_reader
node_video -->|"supplies"| node_reader
node_orchestrator -->|"detects frames"| node_detectorbase
node_ultra -->|"implements"| node_detectorbase
node_yolo -->|"implements"| node_detectorbase
node_orchestrator -->|"updates tracks"| node_trackerbase
node_deepsort -->|"implements"| node_trackerbase
node_deepsort -->|"converts boxes"| node_bbox
node_orchestrator -->|"annotates tracks"| node_annotator
node_orchestrator -->|"writes frames"| node_writer
node_writer -->|"produces"| node_videoout
node_orchestrator -->|"exports tracks"| node_exporter
node_exporter -->|"writes predictions"| node_motout
node_orchestrator -->|"saves JSON"| node_jsonout
node_detectorbase -->|"returns detections"| node_schemas
node_trackerbase -->|"returns tracks"| node_schemas
node_annotator -->|"renders tracks"| node_schemas
node_exporter -->|"formats tracks"| node_schemas
node_captioner -->|"implements"| node_captionbase
node_captionbase -->|"uses segments"| node_schemas
node_user -->|"runs evaluation"| node_evaluator
node_motout -->|"evaluated by"| node_evaluator
node_groundtruth -->|"compared with"| node_evaluator
node_evaluator -->|"writes report"| node_metrics

click node_configfiles "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/configs/default.yaml"
click node_config "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/config.py"
click node_entry "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/scripts/run_demo.py"
click node_detfactory "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/detectors/factory.py"
click node_trackfactory "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/trackers/factory.py"
click node_orchestrator "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/pipeline/orchestrator.py"
click node_reader "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/io/video_reader.py"
click node_detectorbase "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/detectors/base.py"
click node_ultra "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/detectors/ultralytics_adapter.py"
click node_yolo "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/detectors/yolov9.py"
click node_trackerbase "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/trackers/base.py"
click node_deepsort "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/trackers/deepsort_tracker.py"
click node_bbox "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/utils/bbox_utils.py"
click node_schemas "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/schemas.py"
click node_annotator "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/annotator.py"
click node_writer "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/io/video_writer.py"
click node_exporter "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/io/mot_exporter.py"
click node_jsonout "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/pipeline/orchestrator.py"
click node_captionbase "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/captioning/base.py"
click node_captioner "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/captioning/template_captioner.py"
click node_evaluator "https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/evaluation/evaluate_mot.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_configfiles,node_config,node_entry,node_detfactory,node_trackfactory toneBlue
class node_orchestrator,node_reader,node_detectorbase,node_ultra,node_yolo,node_trackerbase,node_deepsort,node_bbox,node_schemas toneAmber
class node_annotator,node_writer,node_exporter,node_jsonout,node_videoout,node_motout,node_captionbase,node_captioner toneMint
class node_evaluator,node_groundtruth,node_metrics toneRose
class node_user,node_video toneIndigo
```

## Components

### Run setup

- [YAML settings](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/configs/default.yaml): `configs/default.yaml`
- [Config loader](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/config.py): `src/config.py`
- [Demo entry point](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/scripts/run_demo.py): `scripts/run_demo.py`
- [Detector factory](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/detectors/factory.py): `src/detectors/factory.py`
- [Tracker factory](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/trackers/factory.py): `src/trackers/factory.py`

### Tracking pipeline

- [Pipeline orchestrator](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/pipeline/orchestrator.py): `src/pipeline/orchestrator.py`
- [Video reader](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/io/video_reader.py): `src/io/video_reader.py`
- [Detector interface](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/detectors/base.py): `src/detectors/base.py`
- [Ultralytics detector](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/detectors/ultralytics_adapter.py): `src/detectors/ultralytics_adapter.py`
- [YOLOv9 adapter](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/detectors/yolov9.py): `src/detectors/yolov9.py`
- [Tracker interface](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/trackers/base.py): `src/trackers/base.py`
- [DeepSORT tracker](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/trackers/deepsort_tracker.py): `src/trackers/deepsort_tracker.py`
- [Box utilities](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/utils/bbox_utils.py): `src/utils/bbox_utils.py`
- [Tracking schemas](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/schemas.py): `src/schemas.py`

### Tracking outputs

- [Frame annotator](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/annotator.py): `src/annotator.py`
- [Video writer](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/io/video_writer.py): `src/io/video_writer.py`
- [MOT exporter](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/io/mot_exporter.py): `src/io/mot_exporter.py`
- [Track JSON export](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/pipeline/orchestrator.py): `src/pipeline/orchestrator.py`
- **Annotated video**
- **MOT predictions**
- [Caption interface](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/captioning/base.py): `src/captioning/base.py`
- [Template captioner](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/src/captioning/template_captioner.py): `src/captioning/template_captioner.py`

### MOT evaluation

- [MOT evaluator](https://github.com/pradyumna-chacham/yolov9-deepsort-mot/blob/main/evaluation/evaluate_mot.py): `evaluation/evaluate_mot.py`
- **MOT ground truth**
- **Evaluation metrics**

### Other components

- **Run tracking**
- **Input video**

## Connections

- Run tracking → Demo entry point: starts (evidence: `README.md`)
- YAML settings → Config loader: loaded by (evidence: `README.md`)
- Demo entry point → Config loader: loads (evidence: `README.md`)
- Demo entry point → Detector factory: creates detector (evidence: `README.md`)
- Demo entry point → Tracker factory: creates tracker (evidence: `README.md`)
- Demo entry point → Pipeline orchestrator: runs (evidence: `README.md`)
- Config loader → Detector factory: configures (evidence: `src/detectors/factory.py`)
- Config loader → Tracker factory: configures (evidence: `src/trackers/factory.py`)
- Detector factory → Ultralytics detector: selects (evidence: `src/detectors/factory.py`)
- Detector factory → YOLOv9 adapter: selects (evidence: `src/detectors/factory.py`)
- Tracker factory → DeepSORT tracker: selects (evidence: `src/trackers/factory.py`)
- Pipeline orchestrator → Video reader: reads frames (evidence: `src/pipeline/orchestrator.py`)
- Input video → Video reader: supplies (evidence: `README.md`)
- Pipeline orchestrator → Detector interface: detects frames (evidence: `src/pipeline/orchestrator.py`)
- Ultralytics detector → Detector interface: implements (evidence: `src/detectors/ultralytics_adapter.py`)
- YOLOv9 adapter → Detector interface: implements (evidence: `src/detectors/yolov9.py`)
- Pipeline orchestrator → Tracker interface: updates tracks (evidence: `src/pipeline/orchestrator.py`)
- DeepSORT tracker → Tracker interface: implements (evidence: `src/trackers/deepsort_tracker.py`)
- DeepSORT tracker → Box utilities: converts boxes (evidence: `src/trackers/deepsort_tracker.py`)
- Pipeline orchestrator → Frame annotator: annotates tracks (evidence: `src/pipeline/orchestrator.py`)
- Pipeline orchestrator → Video writer: writes frames (evidence: `src/pipeline/orchestrator.py`)
- Video writer → Annotated video: produces (evidence: `README.md`)
- Pipeline orchestrator → MOT exporter: exports tracks (evidence: `src/pipeline/orchestrator.py`)
- MOT exporter → MOT predictions: writes predictions (evidence: `README.md`)
- Pipeline orchestrator → Track JSON export: saves JSON (evidence: `src/pipeline/orchestrator.py`)
- Detector interface → Tracking schemas: returns detections (evidence: `src/detectors/base.py`)
- Tracker interface → Tracking schemas: returns tracks (evidence: `src/trackers/base.py`)
- Frame annotator → Tracking schemas: renders tracks (evidence: `src/annotator.py`)
- MOT exporter → Tracking schemas: formats tracks (evidence: `src/io/mot_exporter.py`)
- Template captioner → Caption interface: implements (evidence: `src/captioning/template_captioner.py`)
- Caption interface → Tracking schemas: uses segments (evidence: `src/captioning/base.py`)
- Run tracking → MOT evaluator: runs evaluation (evidence: `README.md`)
- MOT predictions → MOT evaluator: evaluated by (evidence: `README.md`)
- MOT ground truth → MOT evaluator: compared with (evidence: `README.md`)
- MOT evaluator → Evaluation metrics: writes report (evidence: `README.md`)
