An end-to-end football player tracking demo that takes an HD match video and produces an overlay video with:
- player bounding boxes
- persistent track IDs
- jersey number + confidence (when readable)
This repo is demo-focused and config-driven. Large artifacts (videos, datasets, weights, runs, outputs) are not tracked in git.
Pipeline stages:
- Detection: YOLO model detects players, referees, and ball.
- Tracking: assigns stable IDs across frames (adapter planned).
- Jersey recognition: classifier predicts jersey numbers for player crops.
- Overlay: draws boxes + labels on frames and writes output video.
Tracked source:
src/footy_tracker/— Python packageconfigs/— YAML configsscripts/— training + demo scriptstest-stuff/— local experiments (ignored in git)
Not tracked (you must supply locally):
data/— datasets + sample videosweights/— trained modelsoutputs/— generated demos/logsruns/— Ultralytics training outputs
Create a local paths override:
cp configs/paths_local_example.yaml configs/paths_local.yamlEdit configs/paths_local.yaml to point at your local videos and weights.
Install dependencies:
pip install -r requirements.txtThe core demo pipeline handles frame extraction and video stitching. An ML step is expected to write annotated frames into the ML output directory before stitching.
Run:
python -m footy_tracker --config configs/pipeline.yamlIf you want only extraction or only stitching, toggle steps in configs/pipeline.yaml.
For a simple, interactive end-to-end pass on a single video:
python scripts/quick_video_jersey_overlay.pyWhat it does:
- Prompts for input video (default from
configs/paths_local.yaml) - Runs YOLO detection
- Crops jersey regions for players only
- Runs jersey classifier on those crops
- Draws boxes + labels, writes a temporary video
- Plays a preview and asks where to save
Expected local files:
weights/yolo/player.ptweights/jersey/jersey.pt(symlinked tooutputs/train/jersey/best.ptif trained locally)outputs/train/jersey/label_mapping.json
- Ensure dataset is extracted:
data/sn_jersey/jersey-2023/train/
- Train:
python scripts/train_jersey.py --config configs/jersey_train.yamlOutputs:
outputs/train/jersey/best.ptoutputs/train/jersey/label_mapping.json
You can symlink to inference path:
ln -sf ../../outputs/train/jersey/best.pt weights/jersey/jersey.ptTrain the detector (optional if you already have weights):
python scripts/train_yolo.pyEnsure configs/yolo.yaml points to weights/yolo/player.pt.
configs/pipeline.yaml— end-to-end pipeline wiringconfigs/yolo.yaml— detection thresholds + weightsconfigs/jersey.yaml— jersey model path + crop strategyconfigs/tracker.yaml— tracking paramsconfigs/paths_local.yaml— local paths (git-ignored)
Commands are designed to work on Windows/PowerShell:
python -m footy_tracker --config configs\pipeline.yamlThis repo focuses on a demo-ready pipeline with:
- YOLO player detection trained on SoccerNet-Tracking
- Jersey classifier trained on sn-jersey
- Interactive video overlay script
Tracking integration and full end-to-end orchestration are still in progress.