Skip to content

auraCodesKM/ReIdentify-FC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Player Re-Identification in Sports Footage

This project is a solution for the Machine Learning Internship assignment from a Stealth Mode startup. It focuses on player re-identification in sports analytics, a critical task for tracking players across video frames.

Task

The chosen task is Option 2: Re-Identification in a Single Feed. The objective is to identify each player in a 15-second video clip (15sec_input_720p.mp4) and maintain a consistent ID for each player, even if they are temporarily occluded or leave the frame.

Objective

This project aims to accurately detect and track football players in a 15-second video clip. The primary goal is to implement a robust tracking system that assigns and maintains a persistent ID for each player, even when they are temporarily occluded or leave and re-enter the frame.

The key requirements are:

  • Track only players (class_id = 0).
  • Completely ignore the ball (class_id = 1).
  • Maintain ID consistency using a combination of motion and appearance cues.

Approach

  1. Player Detection: A pre-trained YOLOv11 model (best.pt) is used to detect players and the ball in each frame of the video.
  2. Player Tracking & Re-Identification: A custom tracking algorithm is implemented to assign and maintain unique IDs for each detected player. This involves using appearance-based features (e.g., color histograms) to re-identify players who re-enter the scene.

Tracking Methodology

The tracking pipeline is designed to be robust and focus solely on players:

  • Player-Only Filtering: The system first detects all objects, then explicitly filters out all non-player detections (like the ball) before they are processed by the tracker. This ensures the tracker only ever receives player data.
  • Hybrid Tracking Algorithm: Player IDs are maintained using a two-stage matching process:
    1. IoU Matching: Active tracks are first matched with new detections based on Intersection over Union (IoU) to handle smooth, continuous motion.
    2. Appearance Re-Identification (ReID): If a player is lost (e.g., occluded) and later reappears, their ID is recovered by comparing the appearance features (HSV color histograms) of the new detection with those of lost tracks.
  • Modular Design: The ball is ignored by default, but the modular code allows for a separate ball tracker to be added easily outside the PlayerTracker class if needed in the future.

Project Structure

.STEALTH/
├── data/ # Input video files
│   ├── 15sec_input_720p.mp4
│   ├── broadcast.mp4
│   └── tacticam.mp4
├── models/ # Pre-trained models
│   └── best.pt
├── output/
├── src/ # Source code
│   ├── main.py           # Main script to run the pipeline
│   ├── tracker.py        # Core PlayerTracker class
│   └── reid_utils.py     # Utilities for appearance feature extraction
├── requirements.txt # Project dependencies
├── README.md # This file
└── report.md

Setup

  1. Clone the repository

  2. Create a virtual environment and activate it:

    python -m venv venv
    source venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt

How to Run

Execute the main script from within the src directory:

cd src
python main.py

The processed video will be saved in the output/ directory.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages