Skip to content

francescopiocirillo/soccer-players-tracking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โšฝ Soccer Players Tracking

=====================================================

๐Ÿš€ An end-to-end computer vision pipeline for soccer player detection, multi-object tracking and ROI-based behavior analysis from broadcast videos.

Developed for the Artificial Vision (MSc in Computer Engineering) course at the University of Salerno, and evaluated on the SoccerNet 2023 Tracking dataset using HOTAโ‚€.โ‚… and normalized MAE (nMAE) metrics.

Demonstrates practical experience in deep learning, multi-object tracking, re-identification, camera motion compensation and performance-driven experimental design.


๐Ÿ“ธ System Overview Snapshot

behavior_Screen.Recording.2025-12-22.at.13.32.09_clip.mp4

๐Ÿ“Œ Overview

This project implements a complete pipeline that performs:

  • โšฝ Player, referee and linesman detection
  • ๐Ÿ” Multi-object tracking with ID consistency
  • ๐Ÿง  Behavior analysis (number of players inside predefined ROIs)
  • ๐Ÿ“Š Evaluation using HOTAโ‚€.โ‚… (tracking) and nMAE (behavior)
  • ๐Ÿ† Final ranking metric: PTBS = HOTAโ‚€.โ‚… + nMAE

The system was tested on the official SoccerNet Tracking 2023 dataset and evaluated using the simulation tool provided by the course instructors.

Full technical details are available in:
๐Ÿ“„ 1 - Documentazione_Artificial_Vision_Cirillo_Fasolino.pdf


๐ŸŒ Language Note

All code comments and internal documentation are written in Italian, as the project was developed during a group exam at the University of Salerno (Italy).

Despite this, the codebase follows international best practices, with clear method names and class structures that make it easily understandable for global developers and recruiters.


๐Ÿง  System Architecture

The final pipeline consists of:

  1. YOLO12m (fine-tuned on SoccerNet) for detection
  2. Soccer pitch mask filtering (color-based with safety threshold)
  3. Bot SORT tracker (tuned)
    • Camera Motion Compensation (sparse optical flow)
    • Re-identification using Omni-Scale Network (MSMT17 pretrained)
  4. ROI-based behavior analysis
  5. Output generation in official contest format

๐Ÿ”„ Processing Pipeline

CodeVideo โ†’ YOLO Detection โ†’ Pitch Mask Filtering โ†’ Bot SORT Tracking
โ†’ Tracking Output (.txt)
โ†’ ROI Counting โ†’ Behavior Output (.txt)

The final inference pipeline consumes < 500MB RAM, making it deployable on mid-range devices.


๐Ÿ”ฌ Technologies Used

๐Ÿง  Detection

  • YOLOv8 / YOLO11 / YOLO12 (Ultralytics)
  • Final model: YOLO12m fine-tuned on SoccerNet
  • Resolution: 1024
  • Optimizer: AdamW

๐Ÿ” Tracking

  • ByteTrack (baseline + tuning)
  • Bot SORT (final choice)
  • ReID: Omni-Scale Network x0_25
  • Camera Motion Compensation

๐Ÿ–ผ Vision & Utilities

  • OpenCV
  • Ultralytics
  • boxmot
  • Optical Flow
  • Morphological operators

๐Ÿ“Š Metrics

๐ŸŽฏ Tracking Metric

  • HOTAโ‚€.โ‚… = 0.762231

๐Ÿง  Behavior Metric

  • MAE = 0.184925
  • Normalized MAE (nMAE) = 0.981507

๐Ÿ† Final Score

PTBS = HOTAโ‚€.โ‚… + nMAE = 1.743739

The system was evaluated using the official simulator provided by the course (not present in this repository).


๐Ÿ“‚ Repository Structure

Code๐Ÿ“ฆ soccer-players-tracking  
โ”œโ”€โ”€ ๐Ÿ“ docs  
โ”‚   โ”œโ”€โ”€ 0 - Contest presentation.pdf  
โ”‚   โ”œโ”€โ”€ 1 - Documentazione_Artificial_Vision_Cirillo_Fasolino.pdf  
โ”‚   โ””โ”€โ”€ 2 - output_simulator.txt  
โ”‚  
โ”œโ”€โ”€ ๐Ÿ“ scripts  
โ”‚   โ”œโ”€โ”€ 0 - dataset_download.py  
โ”‚   โ”œโ”€โ”€ 1 - create_behavior_gt.ipynb  
โ”‚   โ”œโ”€โ”€ 2 - dataset_conversion.ipynb  
โ”‚   โ”œโ”€โ”€ 3 - yolo_training.ipynb  
โ”‚   โ”œโ”€โ”€ 4 - yolo_validation.ipynb  
โ”‚   โ””โ”€โ”€ 5 - tracking_pipeline_inference_script.ipynb  
โ”‚  
โ”œโ”€โ”€ ๐Ÿ“ weights  
โ”‚   โ””โ”€โ”€ best_yolo12m_v2.pt  
โ”‚  
โ”œโ”€โ”€ LICENSE  
โ””โ”€โ”€ README.md

๐Ÿงช Development Workflow

1๏ธโƒฃ Dataset Preparation

  • Conversion from SoccerNet format โ†’ YOLO format
  • Removal of ball annotations
  • ROI generation
  • Behavior ground truth generation

Scripts:

  • dataset_conversion.ipynb
  • create_behaviour_gt.ipynb

2๏ธโƒฃ Training & Validation

  • Fine-tuning of YOLO12m
  • Validation split created from training set
  • Hyperparameter exploration (freeze vs full fine-tuning)

Notebook:

  • yolo_training.ipynb
  • yolo_validation.ipynb

3๏ธโƒฃ Tracking Optimization

  • ByteTrack tuning
  • Switch to Bot SORT
  • ReID integration
  • Camera Motion Compensation
  • ID switch reduction analysis

4๏ธโƒฃ Final Inference

Full pipeline available in:

Codetracking_pipeline_inference_script.ipynb

Outputs:

  • tracking_K_XX.txt
  • behavior_K_XX.txt
  • Annotated output videos

๐ŸŽ“ Academic Context

Developed as a Project Work for:

Artificial Vision โ€“ MSc in Computer Engineering
University of Salerno
Academic Year 2025/2026

All internal documentation is written in Italian, as required by the course.


๐Ÿ’ก Key Challenges Addressed

  • Over-tracking and ID fragmentation
  • Camera panning & zoom effects
  • False detections outside the pitch
  • Appearance similarity among players
  • ROI-based counting robustness

๐Ÿ”ฎ Future Improvements

  • Semantic segmentation-based pitch mask
  • Jersey number recognition for long-term re-identification
  • Player Attribute Recognition (PAR)
  • Further tracker optimization
  • More robust handling of adverse weather conditions (e.g., snow)

โญ Final Note

This project highlights:

  • Applied deep learning
  • Multi-object tracking optimization
  • Experimental methodology
  • Metric-driven development
  • End-to-end system design

If you find it interesting, feel free to โญ the repository.


๐Ÿ“ฌ Contacts

โœ‰๏ธ Got feedback or want to contribute? Feel free to open an Issue or submit a Pull Request!


๐Ÿ“ˆ SEO Tags

Soccer Player Tracking, SoccerNet Tracking 2023, Multi-Object Tracking, MOT Computer Vision, YOLO12 Fine-Tuning, YOLO Soccer Detection, Bot SORT Tracker, ByteTrack Tracking, Player Re-Identification, ReID Computer Vision, Camera Motion Compensation, Optical Flow Tracking, Sports Video Analytics, Soccer Video Understanding, ROI Behavior Analysis, HOTA Metric, HOTA 0.5 Evaluation, Detection and Association Accuracy, Normalized MAE, PTBS Score, Deep Learning for Sports, Broadcast Video Analysis, Real-Time Object Tracking, Ultralytics YOLO, Computer Vision MSc Project, Artificial Vision Project, Python Computer Vision, Soccer Analytics AI, End-to-End Vision Pipeline, University of Salerno Project

๐Ÿ“„ License

This project is licensed under the MIT License, a permissive open-source license that allows anyone to use, modify, and distribute the software freely, as long as credit is given and the original license is included.

In plain terms: use it, build on it, just donโ€™t blame us if something breaks.

โญ Like what you see? Consider giving the project a star!


About

๐Ÿ“ธ Computer vision project for soccer player detection, multi-object tracking and behavior analysis from broadcast videos. Evaluated using HOTA0.5 and normalized MAE, with final PTBS score. Developed for an Artificial Vision academic challenge.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors