Volleyball Analytics is an end-to-end computer vision project that turns volleyball match video into structured, queryable informationโso you can move from โwatching footageโ to measuring what happened. Itโs built for practical, real-time workflows where coaches, analysts, and developers want automated tagging, breakdowns, and visual overlays from broadcast-style games.
At its core, the system combines game-state understanding (SERVICE / PLAY / NO-PLAY) with action and object detection (serve/receive/set/spike/block + ball) and court segmentation. These signals can be streamed into a live demo, exported as annotated video, and used as building blocks for higher-level KPIs (e.g., rally segmentation, action counts, and moment extraction like ace points).
The project also includes a FastAPI backend (optional) for storing and retrieving results, making it easier to integrate this pipeline into larger applications (dashboards, scouting tools, or data pipelines). The machine learning functionality is organized through a unified ML Manager module (included as a git submodule) to keep training/inference components reusable and cleanly separated.
This repository uses Git submodules for the ML Manager. You must clone it correctly:
# Clone with submodules (RECOMMENDED)
git clone --recursive https://github.com/masouduut94/volleyball_analytics.git
# OR if already cloned, initialize submodules
git submodule update --init --recursiveYou can set up the project using either uv (recommended for speed) or Conda.
Install dependencies directly from the pyproject.toml file:
# Create and sync the virtual environment
uv sync
# Activate the environment
source .venv/bin/activate # Linux / macOS
.venv\Scripts\activate # WindowsCreate the environment from the provided requirements.yml file:
# Create the conda environment
conda env create -f requirements.yml
# Activate the environment
conda activate volleyball_analyticsTo verify that the environment and models are set up correctly, run the setup.ipynb notebook located in the notebooks/ directory.
Before launching Jupyter Notebook, make sure your environment is available as a Jupyter kernel.
If using uv:
python -m ipykernel install --user --name volleyball_analytics --display-name "Python (volleyball_analytics)"If using Conda, activate the environment first and then run:
python -m ipykernel install --user --name volleyball_analytics --display-name "Python (volleyball_analytics)"jupyter notebookOpen:
notebooks/setup.ipynb
and select the Python (volleyball_analytics) kernel before running the notebook.
The notebook will download any required assets (if needed) and validate that the models and dependencies are installed correctly. โ
The system requires pre-trained models for inference. Weights are automatically downloaded when you first run the system, or you can download them manually.
from src.ml_manager import MLManager
# Weights are automatically downloaded if missing
manager = MLManager()from src.ml_manager.utils.downloader import download_all_models
# Download all models in one ZIP file
success = download_all_models()weights/
โโโ ๐ ball/weights/best.pt # Ball detection & segmentation
โโโ ๐ญ action/weights/best.pt # Action detection (6 classes)
โโโ ๐๏ธ court/weights/best.pt # Court segmentation
โโโ ๐ฎ game_state/ # Game state classification
โโโ [checkpoint files]
Download Source: Complete Weights ZIP
The system uses a unified ML Manager module for all machine learning operations:
from src.ml_manager import MLManager
import cv2
# Initialize ML Manager
ml_manager = MLManager(verbose=True)
cap = cv2.VideoCapture('sample_video.mp4')
frames = []
for i in range(16):
status, frame = cap.read()
frames.append(frame)
# Game state classification
game_state = ml_manager.classify_game_state(frames)
# Action detection
actions = ml_manager.detect_actions(frames[0])
# Ball detection
ball_detections = ml_manager.detect_ball(frames[0])๐ ML Manager Documentation: See src/ml_manager/README.md for comprehensive usage.
- ๐ ML Pipeline: Video classification + Object detection for volleyball analysis
- ๐ฎ Game State Classification: Service, Play, No-Play detection using VideoMAE
- ๐ญ Action Detection: 6 volleyball actions (serve, receive, set, spike, block, ball)
- ๐๏ธ Court Segmentation: Court boundary detection
- ๐ Analytics: Real-time statistics and insights
- ๐ API Backend: FastAPI-based backend for data storage and retrieval
This machine learning project runs in real-time on top of 2 deep learning models:
In a live broadcast game, it's important to run processes only when the game is on. To extract the periods when the game is active, HuggingFace VideoMAE is utilized.
๐ฏ Purpose: Game state classification with 3 labels
- ๐ SERVICE: Start of play when a player tosses the ball to serve
- ๐ฎ PLAY: Active game periods where players are playing
- โธ๏ธ NO-PLAY: Inactive periods where players are not playing
This state-of-the-art model is trained on a custom volleyball dataset for object detection and action recognition.
๐จ Detection Classes (6 different objects with color-coded bounding boxes):
- ๐ด Red box: Volleyball ball
- ๐ค Brown box: Volleyball service action
- ๐ข Green box: Volleyball reception action
- ๐ต Blue box: Volleyball setting action
- ๐ฃ Purple box: Volleyball blocking action
- ๐ Orange box: Volleyball spike action
The system provides real-time analysis with:
- ๐ฎ Game State: Displayed in top-left corner (SERVICE/PLAY/NO-PLAY)
- ๐ฏ Object Detection: Color-coded bounding boxes (only on SERVICE and PLAY frames)
- ๐ Analytics: Real-time statistics and insights
The system can extract specific game moments, like ace points:

Test specific components individually:
# Basic inference test using demo.py
python src/demo.py --video_path path/to/your/video.mp4
The video clips used for training and testing are sourced from:
- ๐บ YouTube Channel: Volleyball Watchdog
- ๐ Content: International volleyball matches and tournaments
-
๐ Data Analysis: Advanced KPIs and analytics
- Service success rate analysis
- Service zone analysis
- Reception success rate
- Player performance metrics
- Team strategy analysis
-
๐ฏ Real-time Analytics: Live match analysis
- Real-time statistics
- Live performance metrics
- Instant insights for coaches
volleyball_analytics/
โโโ ๐ง src/ # Main source code
โ โโโ ๐ ml_manager/ # ML Manager submodule
โ โโโ ๐ vb_backend/ # FastAPI backend
โ โโโ ๐ weights/ # Model weights
โ โโโ ๐ฌ main.py # Main ML pipeline (coming soon!)
โ โโโ ๐ฅ demo.py # Demo application
โโโ ๐ data/ # Datasets and processed data
โโโ ๐ notebooks/ # Jupyter notebooks
โโโ ๐ ๏ธ scripts/ # Utility scripts
โโโ ๐ conf/ # Configuration files
โโโ ๐ README.md # This file
- ๐ Wiki: Datasets and Weights
- ๐ API Documentation: API Guide
- ๐ฎ ML Manager: Comprehensive Documentation
- ๐ Examples: Usage Examples
- ๐ฎ Other datasets: Volleyball Spatiotemporal event spotting
๐ Happy Volleyball Analytics! Let's revolutionize the game with AI! ๐โจ





