# qaz812345/tracknetv3 architecture

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

- Interactive diagram: https://gitdiagram.com/qaz812345/tracknetv3
- Repository: https://github.com/qaz812345/tracknetv3

## Overview

TrackNetV3 is a shuttlecock-tracking application: video and labels are prepared into frame sequences, a heatmap model predicts locations, and an optional trajectory model repairs occluded predictions. The repository also supports model training, prediction output, evaluation workflows, interactive error analysis, and label correction. The graph follows documented workflows and indexed imports; evaluation internals are not mapped because test.py is referenced but absent from the supplied tree.

Main entry points: [`predict.py`](https://github.com/qaz812345/tracknetv3/blob/master/predict.py) (Video prediction), [`train.py`](https://github.com/qaz812345/tracknetv3/blob/master/train.py) (Model training), [`generate_mask_data.py`](https://github.com/qaz812345/tracknetv3/blob/master/generate_mask_data.py) (Mask generation), [`preprocess.py`](https://github.com/qaz812345/tracknetv3/blob/master/preprocess.py) (Frame preprocessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_preprocess["Frame preprocessing<br/>[preprocess.py]"]
  node_dataset["Sequence dataset<br/>[dataset.py]"]
  node_utilities["Data and model utilities<br/>[general.py]"]
end

subgraph group_models["Tracking models"]
  node_tracknet["TrackNet heatmaps<br/>[model.py]"]
  node_inpaintnet["InpaintNet repair<br/>[model.py]"]
end

subgraph group_operations["Training and inference"]
  node_training["Model training<br/>[train.py]"]
  node_maskgen["Mask generation"]
  node_prediction["Video prediction<br/>[predict.py]"]
  node_metrics["Tracking metrics<br/>[metric.py]"]
  node_visualization["Training visualization<br/>[visualize.py]"]
end

subgraph group_review["Review tools"]
  node_erroranalysis["Error analysis<br/>[error_analysis.py]"]
  node_labelcorrection["Label correction UI<br/>[correct_label.py]"]
end

node_user(("User"))
node_video["Match video"]
node_labels["Trajectory labels"]

node_user -->|"prepares data"| node_preprocess
node_video -->|"extracts frames"| node_preprocess
node_labels -->|"uses labels"| node_preprocess
node_preprocess -->|"prepares inputs"| node_dataset
node_dataset -->|"loads sequences"| node_training
node_user -->|"trains models"| node_training
node_training -->|"computes loss"| node_metrics
node_training -->|"visualizes progress"| node_visualization
node_training -->|"uses helpers"| node_utilities
node_utilities -->|"constructs model"| node_tracknet
node_user -->|"generates masks"| node_maskgen
node_maskgen -->|"loads model"| node_utilities
node_maskgen -->|"predicts trajectories"| node_tracknet
node_maskgen -->|"prepares repair training"| node_inpaintnet
node_user -->|"submits video"| node_prediction
node_video -->|"provides frames"| node_prediction
node_prediction -->|"loads sequences"| node_dataset
node_prediction -->|"predicts locations"| node_tracknet
node_prediction -->|"repairs trajectory"| node_inpaintnet
node_prediction -->|"returns predictions"| node_user
node_user -->|"reviews results"| node_erroranalysis
node_erroranalysis -->|"compares ground truth"| node_labels
node_user -->|"corrects labels"| node_labelcorrection
node_labelcorrection -->|"writes corrections"| node_labels

click node_preprocess "https://github.com/qaz812345/tracknetv3/blob/master/preprocess.py"
click node_dataset "https://github.com/qaz812345/tracknetv3/blob/master/dataset.py"
click node_utilities "https://github.com/qaz812345/tracknetv3/blob/master/utils/general.py"
click node_tracknet "https://github.com/qaz812345/tracknetv3/blob/master/model.py"
click node_inpaintnet "https://github.com/qaz812345/tracknetv3/blob/master/model.py"
click node_training "https://github.com/qaz812345/tracknetv3/blob/master/train.py"
click node_maskgen "https://github.com/qaz812345/tracknetv3/blob/master/generate_mask_data.py"
click node_prediction "https://github.com/qaz812345/tracknetv3/blob/master/predict.py"
click node_metrics "https://github.com/qaz812345/tracknetv3/blob/master/utils/metric.py"
click node_visualization "https://github.com/qaz812345/tracknetv3/blob/master/utils/visualize.py"
click node_erroranalysis "https://github.com/qaz812345/tracknetv3/blob/master/error_analysis.py"
click node_labelcorrection "https://github.com/qaz812345/tracknetv3/blob/master/correct_label.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_preprocess,node_dataset,node_utilities,node_user toneBlue
class node_tracknet,node_inpaintnet toneAmber
class node_training,node_maskgen,node_prediction,node_metrics,node_visualization toneMint
class node_erroranalysis,node_labelcorrection toneRose
class node_video,node_labels toneIndigo
```

## Components

### Data preparation

- [Frame preprocessing](https://github.com/qaz812345/tracknetv3/blob/master/preprocess.py): `preprocess.py`
- [Sequence dataset](https://github.com/qaz812345/tracknetv3/blob/master/dataset.py): `dataset.py`
- [Data and model utilities](https://github.com/qaz812345/tracknetv3/blob/master/utils/general.py): `utils/general.py`

### Tracking models

- [TrackNet heatmaps](https://github.com/qaz812345/tracknetv3/blob/master/model.py): `model.py`
- [InpaintNet repair](https://github.com/qaz812345/tracknetv3/blob/master/model.py): `model.py`

### Training and inference

- [Model training](https://github.com/qaz812345/tracknetv3/blob/master/train.py): `train.py`
- [Mask generation](https://github.com/qaz812345/tracknetv3/blob/master/generate_mask_data.py): `generate_mask_data.py`
- [Video prediction](https://github.com/qaz812345/tracknetv3/blob/master/predict.py): `predict.py`
- [Tracking metrics](https://github.com/qaz812345/tracknetv3/blob/master/utils/metric.py): `utils/metric.py`
- [Training visualization](https://github.com/qaz812345/tracknetv3/blob/master/utils/visualize.py): `utils/visualize.py`

### Review tools

- [Error analysis](https://github.com/qaz812345/tracknetv3/blob/master/error_analysis.py): `error_analysis.py`
- [Label correction UI](https://github.com/qaz812345/tracknetv3/blob/master/correct_label.py): `correct_label.py`

### Other components

- **User**
- **Match video**
- **Trajectory labels**

## Connections

- User → Frame preprocessing: prepares data (evidence: `README.md`)
- Match video → Frame preprocessing: extracts frames (evidence: `preprocess.py`)
- Trajectory labels → Frame preprocessing: uses labels (evidence: `preprocess.py`)
- Frame preprocessing → Sequence dataset: prepares inputs (evidence: `README.md`)
- Sequence dataset → Model training: loads sequences (evidence: `train.py`)
- User → Model training: trains models (evidence: `README.md`)
- Model training → Tracking metrics: computes loss (evidence: `train.py`)
- Model training → Training visualization: visualizes progress (evidence: `train.py`)
- Model training → Data and model utilities: uses helpers (evidence: `train.py`)
- Data and model utilities → TrackNet heatmaps: constructs model (evidence: `utils/general.py`)
- User → Mask generation: generates masks (evidence: `README.md`)
- Mask generation → Data and model utilities: loads model (evidence: `generate_mask_data.py`)
- Mask generation → TrackNet heatmaps: predicts trajectories (evidence: `README.md`)
- Mask generation → InpaintNet repair: prepares repair training (evidence: `README.md`)
- User → Video prediction: submits video (evidence: `README.md`)
- Match video → Video prediction: provides frames (evidence: `predict.py`)
- Video prediction → Sequence dataset: loads sequences (evidence: `predict.py`)
- Video prediction → TrackNet heatmaps: predicts locations (evidence: `predict.py`)
- Video prediction → InpaintNet repair: repairs trajectory (evidence: `README.md`)
- Video prediction → User: returns predictions (evidence: `README.md`)
- User → Error analysis: reviews results (evidence: `README.md`)
- Error analysis → Trajectory labels: compares ground truth (evidence: `error_analysis.py`)
- User → Label correction UI: corrects labels (evidence: `correct_label.py`)
- Label correction UI → Trajectory labels: writes corrections (evidence: `correct_label.py`)
