Skip to content

About

Computer vision and machine learning tools for badminton video analysis

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

88 Commits

Folders and files

Repository files navigation

BaddieVision

BaddieVision turns static-camera singles badminton video into structured rally intervals. It also contains research tooling for player pose, court projection, shuttle tracking, annotation, and shot classification.

Example badminton video with BaddieVision's predicted rally-state overlay

From match video to rally intervals: an example prediction overlay. Watch the ten-second demo.

The maintained RallySegmenter uses player/court observations and player-relative pose. It does not need shuttle candidates, training labels, or an annotation teacher at inference time. It is an offline model with centered temporal context.

The six-source, four-camera research baseline reports macro frame F1 0.718, ROC AUC 0.890, interval F1 0.41915, and boundary MAE 26.11 frames on 126 rallies / 52,012 labeled frames. These results come from a small private dataset; they are not a public benchmark or a production accuracy guarantee. See the evaluation protocol.

Install

Use Python 3.11 and install FFmpeg on your system.

git clone --recurse-submodules https://github.com/MaxLinCode/BaddieVision.git
cd BaddieVision
python3.11 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements-inference.txt

For Linux CPU-only installations, first install the matching CPU wheels:

python -m pip install torch==2.7.1 torchvision==0.22.1 \
  --index-url https://download.pytorch.org/whl/cpu
python -m pip install -r requirements-inference.txt

For development, install requirements-dev.txt with the inference pins as constraints, then run tests:

python -m pip install -r requirements-dev.txt -r requirements-inference.txt
python -m pytest -q
python scripts/check_private_assets.py

The TrackNet submodule is pinned by its Git commit. Do not replace that commit with a moving branch during setup or CI.

Video to rally CSV and overlay

python -m src.workflow rally predict \
  --video match.mp4 \
  --output-dir outputs/match \
  --model rally-six-source-v1 \
  --device auto

If court calibration is missing, the command reports it and opens the browser calibration tool. Save the calibration to continue. For a noninteractive run, provide --calibration court.json.

The named model is downloaded only from its versioned release and every asset is checked against its size and SHA-256. The verified rally-six-source-v1 release includes public weights and the approved ten-second sample. For an extracted release bundle or a sanitized local export, use:

python -m src.workflow rally predict \
  --video match.mp4 --calibration court.json --output-dir outputs/match \
  --checkpoint release/rally-segmenter.pt --model-manifest release/manifest.json

The pipeline registers an immutable source, extracts or verifies person tracks and pose, predicts one state per frame, then writes:

outputs/match/
  source.json
  court/calibration.json
  players/                       Observations and stage receipts
  rallies/predictions.jsonl       One probability/state record per frame
  rallies/rallies.csv             Inclusive zero-based rally intervals
  rallies/overlay.mp4             Prediction-only video overlay
  rallies/run.manifest.json       Inputs, versions, and output fingerprints

A verified cached rerun reuses the same outputs. Stale or incomplete artifacts fail with a --force recovery instruction. --no-overlay skips video rendering. CUDA, MPS, and CPU are supported; auto selects the first available device.

See inference and release instructions for the complete command, registered-source reuse, checkpoint export, and sample preparation.

Run on a remote GPU

Configure your SSH destination and remote checkout in the worktree's ignored .env. Run ./scripts/gpu doctor to check CUDA and the remote environment. Submit an inference or training command with ./scripts/gpu submit -- before the command and use --device cuda where supported. The launcher sends the current worktree's source and runs the job on the remote machine. Place videos and calibrations on the remote host before submitting an unattended run.

See the remote GPU guide for setup, job status, logs, and fetching outputs.

Private data

Videos, annotations, extracted features, model weights, local recording configs, and detector training images/labels stay outside tracked Git files. The checkout contains synthetic regression fixtures and generic example configs. Restore your own data locally; none is necessary for the default test suite.

Previously committed data remains in Git history. This change preserves history and prevents the known private asset classes from being reintroduced in future commits. Release packages use an explicit file allowlist. Only approved sample media and inference assets belong in a verified release.

Other workflows

The shot classifier remains a separate workflow. Its (36, 76) feature arrays contain 66 pose coordinates, seven shuttle features, and a three-value court anchor. Older 73-input checkpoints require feature regeneration and retraining.

Court calibration represents one static camera segment, uses image_size, and maps floor points to metres. Camera movement requires a new source/calibration. Airborne-shuttle projection does not recover true 3D location.

License

The project is MIT licensed. TrackNet retains its own license. Detector/pose assets retain their upstream license terms; redistribution must include the applicable notices in the model card.

About

Computer vision and machine learning tools for badminton video analysis

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages