Skip to main content

Tactical intelligence and computer vision pipeline for football analytics.

Project description

Gaffer's Guide

A computer vision pipeline for automated video analysis, player tracking, and tactical metrics extraction. Designed for sports footage processing with configurable quality profiles to balance speed and accuracy.


Table of Contents


Overview

Gaffer's Guide processes sports video footage through an end-to-end cloud pipeline to produce:

  • Player tracking data
  • Tactical metrics
  • Annotated output video

The system exposes a CLI (gaffers-guide) with configurable quality profiles, allowing you to trade off inference speed against detection accuracy depending on your use case.


Installation

1. Clone the repository

git clone https://github.com/amartyatatspandey/GaffersGuide-to-a-good-game.git
cd GaffersGuide-to-a-good-game

2. Create and activate a virtual environment

python -m venv .venv
source .venv/bin/activate        # macOS/Linux
.venv\Scripts\activate           # Windows

3. Install dependencies

pip install -r backend/requirements.txt

Environment Setup

The project uses two source roots. Set PYTHONPATH before running any command:

export PYTHONPATH=backend:src      # macOS/Linux
set PYTHONPATH=backend;src        # Windows

Tip: Add this to your .env or shell profile to avoid setting it each session.


CLI Usage

Run the pipeline

python -m gaffers_guide.cli run \
  --video "<path_to_video>" \
  --output out \
  --quality-profile <profile>
Flag Required Description
--video Path to the input video file
--output Output directory name
--quality-profile One of: fast, balanced, high_res, sahi

List available profiles

python -m gaffers_guide.cli profiles list

Prints all available quality profiles with their descriptions.


Quality Profiles

Profile Speed Accuracy Best For
fast ⚡⚡⚡ ★★☆ Quick previews, large batch jobs
balanced ⚡⚡ ★★★ General-purpose processing
high_res ★★★★ High-detail analysis, final output
sahi ★★★★★ Crowded scenes, small object detection
  • fast — Optimised for throughput. Reduced resolution and simplified detection. Suitable when turnaround time matters more than precision.
  • balanced — Default recommended profile. Good accuracy at a reasonable processing speed.
  • high_res — Full-resolution inference. Best for final deliverables or tactical review where detail matters.
  • sahi — Uses Slicing Aided Hyper Inference (SAHI) for detecting small or densely packed objects. Highest accuracy, slowest runtime.

Example

PYTHONPATH=backend:src python -m gaffers_guide.cli run \
  --video "footage/match_01.mp4" \
  --output backend/output \
  --quality-profile balanced

Output

All outputs are written to backend/output/:

File Description
*_tracking_data.json Frame-by-frame player position and tracking data
*_tactical_metrics.json Derived tactical metrics (formations, zones, events)
*.mp4 Annotated video with overlaid tracking visualisation

Performance Notes

  • SAHI significantly increases processing time due to tiled inference — use only when small-object detection is critical.
  • high_res requires more VRAM; ensure your environment has adequate GPU memory before use.
  • For batch processing of multiple videos, fast profile is recommended to reduce queue time.
  • All profiles use the same underlying pipeline (scripts.pipeline_core.run_e2e_cloud) — only inference parameters differ.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gaffers_guide-2.0.0.tar.gz (71.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gaffers_guide-2.0.0-py3-none-any.whl (88.0 kB view details)

Uploaded Python 3

File details

Details for the file gaffers_guide-2.0.0.tar.gz.

File metadata

  • Download URL: gaffers_guide-2.0.0.tar.gz
  • Upload date:
  • Size: 71.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for gaffers_guide-2.0.0.tar.gz
Algorithm Hash digest
SHA256 422c8cd28abb6746bed1f5efcfabe3b84b69fede241091241fa612155e2e74dc
MD5 b433e5708eb1723b8c57071ab5886ba9
BLAKE2b-256 5a86f3f6bb90a72ebc17c93c7b3062a25dd545b71ca9e5373bbe5fa4c0c12682

See more details on using hashes here.

File details

Details for the file gaffers_guide-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: gaffers_guide-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 88.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for gaffers_guide-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15205f7cdc16e65e929a61cdafaa16a8f6cb1cea3cb31260e3361c34cdfb7e17
MD5 a73f44b8a3256162b8f8a3b0374de556
BLAKE2b-256 3cc55a5df86330392ff424b7e755abe5ed5867e34ca5e61aad0cad15ec65cb11

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page