Computer vision pipeline for analyzing padel tennis game videos. Processes video through court calibration, player detection and tracking, ball tracking, scoreboard OCR, and analytics to produce annotated videos and structured data exports.
- Court Calibration - DeepLSD line detection + template fitting for court registration
- Player Detection & Tracking - YOLO11 + ByteTrack for up to 4 players
- Ball Detection & Tracking - TrackNetV4 model with Kalman filtering and event detection
- Scoreboard OCR - PaddleOCR-based score extraction
- Analytics - Speed, acceleration, zone occupancy, formations, rally metrics
- Export - Annotated video, minimap overlay, JSON, and CSV outputs
- Python 3.10 or 3.11
- NVIDIA GPU with CUDA 12.6+ (or AMD GPU with ROCm)
- uv package manager
git clone --recurse-submodules https://github.com/<your-org>/padle-game-analysis.git
cd padle-game-analysisIf you already cloned without submodules:
git submodule update --init --recursiveuv sync --devThis installs all Python dependencies including PyTorch with CUDA 12.6 support, ultralytics (YOLO11), PaddleOCR, and DeepLSD.
Create the models directory:
mkdir -p data/modelsDeepLSD weights (court line detection):
wget -O data/models/deeplsd_md.tar https://cvg-data.inf.ethz.ch/DeepLSD/deeplsd_md.tarTrackNetV4 model (ball detection):
- Clone the TrackNetV4 repository:
git clone https://github.com/TrackNetV4/TrackNetV4.git third_party/TrackNetV4- Download TrackNetV4
.kerasweights from Google Drive and setball_tracking.tracknetv4.model_pathinconfigs/default.yaml. The default config currently points at:
data/models/best_model_V1_NF_RIO_10u_e17.keras
Available weight variants:
- Install TensorFlow (required for TrackNetV4):
uv sync --extra tracknetv4YOLO11 and PaddleOCR models are downloaded automatically on first run.
uv run python scripts/run_mvp.py --video <input.mp4> --config configs/default.yaml --out data/outputs/Options:
| Flag | Default | Description |
|---|---|---|
--video |
(required) | Path to input video |
--config |
configs/default.yaml |
Config YAML path |
--out |
data/outputs |
Output directory |
--log-level |
INFO |
Logging verbosity (DEBUG, INFO, WARNING, ERROR) |
data/outputs/
├── tracks.json # Player tracks and ball detections
├── metrics.csv # Per-frame kinematics
├── annotated.mp4 # Video with overlays
└── minimap.mp4 # Top-down court minimap
All pipeline parameters are in configs/default.yaml. Key sections:
court- Court dimensions (standard padel: 10m x 20m)detection- YOLO model variant and confidence thresholdtracking- ByteTrack hyperparameterscalibration- DeepLSD settings and weights pathball_tracking- TrackNetV4 model path and Kalman filter tuningscoreboard- OCR engine and sampling intervalexport- Output formats and video options
The project includes dev container configurations for both NVIDIA (CUDA) and AMD (ROCm) GPUs in .devcontainer/. Open in VS Code or GitHub Codespaces for a pre-configured environment.
uv run pytestuv run ruff check src/ scripts/ tests/src/
├── calibration/ # Court registration (DeepLSD, template fitting)
├── detection/ # Player detection (YOLO11)
├── tracking/ # Player tracking (ByteTrack, identity assignment)
├── ball_tracking/ # Ball detection (TrackNetV4, Kalman filtering)
├── coordinates/ # Homography projection, smoothing
├── analytics/ # Kinematics, zone analysis, rally metrics
├── scoreboard/ # Scoreboard detection, OCR, state machine
├── export/ # JSON, CSV, video writers
├── visualization/ # Overlay annotations, minimap
├── video_io/ # Video I/O utilities
├── config/ # Configuration loader
└── schemas.py # Pydantic data models
scripts/
├── run_mvp.py # Full pipeline entry point
└── evaluate_*.py # Component evaluation scripts
configs/
└── default.yaml # Default pipeline configuration
third_party/TrackNetV4/ # TrackNetV4 ball detection (cloned separately)