# alfayath17/tracknet-deep-learning-network architecture

> Architecture diagram of the GitHub repository alfayath17/tracknet-deep-learning-network, 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/alfayath17/tracknet-deep-learning-network
- Repository: https://github.com/alfayath17/tracknet-deep-learning-network

## Overview

TrackNet is a video-based object-localization and tracking project, with a separate bounce-detection branch. The main workflow prepares labeled frame data and heatmaps, trains/evaluates a neural network, then runs video inference to produce coordinates and a tracked video. The README documents trajectory analysis and bounce detection as capabilities; source excerpts directly support the core training and inference links. Some testing and bounce-analysis implementation is unsampled, so those links are shown only where documented.

Main entry points: [`main.py`](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/main.py) (Training workflow), [`infer_on_video.py`](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/infer_on_video.py) (Video inference), [`gt_gen.py`](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/gt_gen.py) (Ground truth generation), [`bounce_train.py`](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/bounce_train.py) (Bounce training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_frames[("Labeled frames")]
  node_gtgen["Ground truth generation<br/>[gt_gen.py]"]
  node_gtout[("Ground truth outputs")]
  node_dataset["Training data loader<br/>[datasets.py]"]
end

subgraph group_tracking["TrackNet workflow"]
  node_trainer["Training workflow<br/>[main.py]"]
  node_network["TrackNet model<br/>[model.py]"]
  node_trainval["Train and validate<br/>[general.py]"]
  node_checkpoint["Model checkpoint<br/>[model_last.pt]"]
  node_evaluator["Model testing<br/>[test.py]"]
  node_inference["Video inference<br/>[infer_on_video.py]"]
  node_coordinates["Object coordinates"]
  node_postprocess["Coordinate postprocessing<br/>[general.py]"]
  node_trajectory["Trajectory tracking<br/>[infer_on_video.py]"]
  node_output["Tracked video<br/>[tracked_output.mp4]"]
end

subgraph group_bounce["Bounce analysis"]
  node_bounce["Bounce training<br/>[bounce_train.py]"]
  node_bounce_model["Bounce model artifact"]
end

node_operator(("Researcher"))
node_video["Input video"]

node_operator -->|"generates labels"| node_gtgen
node_frames -->|"reads labels"| node_gtgen
node_gtgen -->|"writes targets"| node_gtout
node_gtout -->|"supplies targets"| node_dataset
node_operator -->|"starts training"| node_trainer
node_dataset -->|"provides batches"| node_trainer
node_trainer -->|"constructs model"| node_network
node_trainer -->|"calls training"| node_trainval
node_trainval -->|"runs forward pass"| node_network
node_trainer -->|"saves checkpoint"| node_checkpoint
node_operator -->|"runs evaluation"| node_evaluator
node_checkpoint -.->|"loads model"| node_evaluator
node_video -->|"supplies frames"| node_inference
node_operator -->|"runs inference"| node_inference
node_inference -->|"runs prediction"| node_network
node_inference -->|"decodes heatmap"| node_postprocess
node_postprocess -->|"returns coordinates"| node_coordinates
node_inference -->|"filters and interpolates"| node_trajectory
node_trajectory -->|"renders tracking"| node_output
node_operator -->|"starts analysis"| node_bounce
node_frames -.->|"reads labeled data"| node_bounce
node_bounce -.->|"trains model"| node_bounce_model

click node_frames "https://github.com/alfayath17/tracknet-deep-learning-network/tree/main/Dataset"
click node_gtgen "https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/gt_gen.py"
click node_gtout "https://github.com/alfayath17/tracknet-deep-learning-network/tree/main/GT_Output"
click node_dataset "https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/datasets.py"
click node_trainer "https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/main.py"
click node_network "https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/model.py"
click node_trainval "https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/general.py"
click node_checkpoint "https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/exps/default/model_last.pt"
click node_evaluator "https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/test.py"
click node_inference "https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/infer_on_video.py"
click node_postprocess "https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/general.py"
click node_trajectory "https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/infer_on_video.py"
click node_output "https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/tracked_output.mp4"
click node_bounce "https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/bounce_train.py"
click node_bounce_model "https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/ctb_regr_bounce.cbm"

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_frames,node_gtgen,node_gtout,node_dataset toneBlue
class node_trainer,node_network,node_trainval,node_checkpoint,node_evaluator,node_inference,node_coordinates,node_postprocess,node_trajectory,node_output toneAmber
class node_bounce,node_bounce_model toneMint
class node_operator,node_video toneIndigo
```

## Components

### Data preparation

- [Labeled frames](https://github.com/alfayath17/tracknet-deep-learning-network/tree/main/Dataset): `Dataset`
- [Ground truth generation](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/gt_gen.py): `gt_gen.py`
- [Ground truth outputs](https://github.com/alfayath17/tracknet-deep-learning-network/tree/main/GT_Output): `GT_Output`
- [Training data loader](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/datasets.py): `datasets.py`

### TrackNet workflow

- [Training workflow](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/main.py): `main.py`
- [TrackNet model](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/model.py): `model.py`
- [Train and validate](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/general.py): `general.py`
- [Model checkpoint](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/exps/default/model_last.pt): `exps/default/model_last.pt`
- [Model testing](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/test.py): `test.py`
- [Video inference](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/infer_on_video.py): `infer_on_video.py`
- **Object coordinates**
- [Coordinate postprocessing](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/general.py): `general.py`
- [Trajectory tracking](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/infer_on_video.py): `infer_on_video.py`
- [Tracked video](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/tracked_output.mp4): `tracked_output.mp4`

### Bounce analysis

- [Bounce training](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/bounce_train.py): `bounce_train.py`
- [Bounce model artifact](https://github.com/alfayath17/tracknet-deep-learning-network/blob/main/ctb_regr_bounce.cbm): `ctb_regr_bounce.cbm`

### Other components

- **Researcher**
- **Input video**

## Connections

- Researcher → Ground truth generation: generates labels (evidence: `README.md`)
- Labeled frames → Ground truth generation: reads labels (evidence: `gt_gen.py`)
- Ground truth generation → Ground truth outputs: writes targets (evidence: `README.md`)
- Ground truth outputs → Training data loader: supplies targets (evidence: `datasets.py`)
- Researcher → Training workflow: starts training (evidence: `README.md`)
- Training data loader → Training workflow: provides batches (evidence: `main.py`)
- Training workflow → TrackNet model: constructs model (evidence: `main.py`)
- Training workflow → Train and validate: calls training (evidence: `main.py`)
- Train and validate → TrackNet model: runs forward pass (evidence: `general.py`)
- Training workflow → Model checkpoint: saves checkpoint (evidence: `README.md`)
- Researcher → Model testing: runs evaluation (evidence: `README.md`)
- Model checkpoint → Model testing: loads model
- Input video → Video inference: supplies frames (evidence: `README.md`)
- Researcher → Video inference: runs inference (evidence: `README.md`)
- Video inference → TrackNet model: runs prediction (evidence: `infer_on_video.py`)
- Video inference → Coordinate postprocessing: decodes heatmap (evidence: `infer_on_video.py`)
- Coordinate postprocessing → Object coordinates: returns coordinates (evidence: `general.py`)
- Video inference → Trajectory tracking: filters and interpolates (evidence: `infer_on_video.py`)
- Trajectory tracking → Tracked video: renders tracking (evidence: `README.md`)
- Researcher → Bounce training: starts analysis (evidence: `README.md`)
- Labeled frames → Bounce training: reads labeled data
- Bounce training → Bounce model artifact: trains model
