Skip to main content

A Python package for sports analytics.

Project description

SportsLabKit

Introduction

Meet SportsLabKit: The essential toolkit for advanced sports analytics. Designed for pros and amateurs alike, we convert raw game footage into actionable data.

We're kicking off with soccer and expanding to other sports soon. Need to quantify your game? Make human movement computable with SportsLabKit.

Features

Core Capabilities

  • High-Performance Tracking: In-house implementations of SORT, DeepSORT, ByteTrack, and TeamTrack for object tracking in sports.

Flexibility

  • Plug-and-Play Architecture: Swap out detection and ReID models on the fly. Supported models include YOLOv8 and torch-ReID.

Usability

  • 2D Pitch Calibration: Translate bounding boxes to 2D pitch coordinates.

  • DataFrame Wrappers: BoundingBoxDataFrame and CoordinatesDataFrame for effortless manipulation and analysis of tracking data.

Tutorials

  • Get Started: Your first steps in understanding and setting up SportsLabKit.
  • User Guide: A comprehensive guide for effectively using the toolkit in real-world scenarios.
  • Core Components: Deep dive into the essential elements that make up SportsLabKit, including tracking algorithms and DataFrame wrappers.

Installation

To install SportsLabKit, simply run:

pip install SportsLabKit

Note: We're in active development, so expect updates and changes.

Example Usage

To get started with tracking your first game, follow this simple example:

import sportslabkit as slk

# Initialize your camera and models
cam = slk.Camera(path_to_mp4)
det_model = slk.detection_model.load('YOLOv8x')
motion_model = slk.motion_model.load('KalmanFilter')

# Configure and execute the tracker
tracker = slk.mot.SORTTracker(detection_model=det_model, motion_model=motion_model)
bbdf = tracker.track(cam)

# The tracking data is now ready for analysis

The output is a BoundingBoxDataFrame, a multi-level Pandas DataFrame that contains Team ID, Player ID, and various attributes like bounding box dimensions. Each row is indexed by Frame ID for easy analysis. The DataFrame is also customizable, allowing you to adapt Team and Player IDs as needed.

Example of BoundingBoxDataFrame

Roadmap

  • Better CV tools: Implement state of the art tracking methods, add event detection etc.

  • Unified Data Representation: In the pipeline are event data detection and a single DataFrame structure for both event and trajectory data.

  • Enhanced Compatibility: Upcoming support for data export to standard formats for easy integration with other tools.

Contributing

See the Contributing Guide for more information.

Contributors

All Contributors

Atom Scott
Atom Scott

🚧
Ikuma Uchida
Ikuma Uchida

This project follows the all-contributors specification. Contributions of any kind welcome!

Related Papers

SoccerTrack:
A Dataset and Tracking Algorithm for Soccer with Fish-eye and Drone Videos

Atom Scott*, Ikuma Uchida*, Masaki Onishi, Yoshinari Kameda, Kazuhiro Fukui, Keisuke Fujii

Presented at CVPR Workshop on Computer Vision for Sports (CVSports'22). *Authors contributed equally.

See papers that cite SoccerTrack on Google Scholar.

Citation

@inproceedings{scott2022soccertrack,
  title={SoccerTrack: A Dataset and Tracking Algorithm for Soccer With Fish-Eye and Drone Videos},
  author={Scott, Atom and Uchida, Ikuma and Onishi, Masaki and Kameda, Yoshinari and Fukui, Kazuhiro and Fujii, Keisuke},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={3569--3579},
  year={2022}
}

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

sportslabkit-0.3.1.tar.gz (152.4 kB view details)

Uploaded Source

Built Distribution

sportslabkit-0.3.1-py3-none-any.whl (181.5 kB view details)

Uploaded Python 3

File details

Details for the file sportslabkit-0.3.1.tar.gz.

File metadata

  • Download URL: sportslabkit-0.3.1.tar.gz
  • Upload date:
  • Size: 152.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.12 Darwin/22.5.0

File hashes

Hashes for sportslabkit-0.3.1.tar.gz
Algorithm Hash digest
SHA256 ea0fde6341af22685a892755c7aaf14a23f0157c6c3afc0a96585e7d4dea249d
MD5 e205b6242457c0e92f973e8334ec5949
BLAKE2b-256 a08521f2c0bb7357eaa4ed67046fd405745398aef06c66826a99b8ac3d8dfc98

See more details on using hashes here.

File details

Details for the file sportslabkit-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: sportslabkit-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 181.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.12 Darwin/22.5.0

File hashes

Hashes for sportslabkit-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 68a92d614f67d29f84faab6b7998a7e8b561170c3ad66f874486832592c9babe
MD5 bd163582278d8334ebcee5a08be75b10
BLAKE2b-256 0768a4f9cbd0d943f9e9c9c2945fbca85093624ed9be7ec5f6958de40943f0ce

See more details on using hashes here.

Supported by

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