Skip to content

Srijan-Ratrey/Football-Player-Re-Identification-System-

Repository files navigation

Football Player Re-Identification System

Project Overview

This project implements a robust player re-identification system for football footage, specifically focusing on maintaining consistent player IDs in a single video feed. The system successfully tracks players even when they leave and re-enter the frame, ensuring reliable player identification throughout the video.

Key Features

  • Robust Player Detection: Using YOLOv11 model for accurate player detection
  • Multi-modal Feature Extraction: Combining appearance, motion, and temporal features
  • Advanced Tracking: Kalman filter-based tracking with feature matching
  • Re-identification: Maintaining consistent IDs when players re-enter the frame
  • Comprehensive Visualization: Detailed tracking visualization and statistics

Performance Metrics

  • Track Continuity: 1.00 (Perfect track maintenance)
  • Track Consistency: 0.32 (Identity preservation)
  • Processing Speed: 0.38 FPS (with visualization)
  • Average Track Length: 126.5 frames (5 seconds at 25 FPS)
  • Unique Tracks: 45 players tracked
  • Average Tracks/Frame: 15.18 players

Quick Start

1. Environment Setup

# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Run setup script
python setup_environment.py

2. Run the Demo

# Full demo with visualization
python demo.py --full

# Quick test (faster, no visualization)
python demo.py --quick

Project Structure

├── README.md                          # Project documentation
├── requirements.txt                   # Python dependencies
├── setup_environment.py              # Environment setup script
├── demo.py                           # Demo script
├── single_feed_reidentification.py   # Main implementation
├── TECHNICAL_REPORT.md               # Technical details
├── best.pt                           # YOLOv11 model
├── data/
│   └── 15sec_input_720p.mp4         # Input video
├── src/
│   ├── player_detector.py           # YOLO-based detection
│   ├── feature_extractor.py         # Multi-modal features
│   ├── tracker.py                   # Kalman filter tracking
│   └── utils.py                     # Utilities
└── results/                         # Output directory

Technical Implementation

1. Player Detection

  • YOLOv11 model for player detection
  • Confidence threshold: 0.5
  • Minimum detection area: 500 pixels
  • Class filtering for player-specific detections

2. Feature Extraction

  • Appearance Features: 512-dimensional CNN features
  • Motion Features: Optical flow-based motion patterns
  • Temporal Features: Track history and consistency
  • Combined Features: Weighted combination of all features

3. Tracking System

  • Kalman Filter: 8-state tracking (position, velocity, size)
  • Association: Hungarian algorithm with multi-modal costs
  • Track Management:
    • Max age: 60 frames
    • Min hits: 5 frames
    • IOU threshold: 0.4
    • Feature threshold: 0.6

4. Re-identification

  • Feature-based matching for re-identification
  • Motion prediction for occluded players
  • Temporal consistency maintenance
  • Track history management

Output and Analysis

Generated Files

  • Video Output: results/demo_single_feed_output.mp4
  • Tracking Results: results/demo_single_feed/tracking_results.json
  • Statistics:
    • Track timeline visualization
    • Track length distribution
    • Tracks per frame analysis
    • Processing summary

Performance Analysis

  • Detection Quality: Consistent player detection
  • Track Persistence: Long-term track maintenance
  • Re-identification: Successful ID preservation
  • Processing Speed: Real-time capable with GPU

System Requirements

Dependencies

  • Python 3.8+
  • PyTorch 2.0+
  • Ultralytics (YOLOv11)
  • OpenCV
  • NumPy, SciPy
  • Matplotlib, Seaborn

Hardware

  • Minimum: CPU processing
  • Recommended: CUDA-capable GPU

Usage Examples

Basic Usage

python single_feed_reidentification.py \
    --input data/15sec_input_720p.mp4 \
    --model best.pt \
    --output results/output.mp4

Advanced Options

python single_feed_reidentification.py \
    --input data/15sec_input_720p.mp4 \
    --model best.pt \
    --output results/output.mp4 \
    --conf-threshold 0.6 \
    --output-dir results/analysis/

Command Line Options

  • --input, -i: Input video path
  • --model, -m: YOLOv11 model path
  • --output, -o: Output video path
  • --output-dir: Results directory
  • --conf-threshold: Detection confidence
  • --no-visualize: Skip visualization

Troubleshooting

Common Issues

  1. Model Loading: Ensure best.pt is in project root
  2. Dependencies: Run setup_environment.py
  3. GPU Issues: System falls back to CPU automatically
  4. Memory: Use --no-visualize for large videos

Performance Tips

  1. Use GPU for faster processing
  2. Adjust confidence threshold based on video quality
  3. Use --no-visualize for faster processing
  4. Close other applications for large videos

Future Improvements

  1. Enhanced feature extraction
  2. Improved track consistency
  3. Real-time processing optimization
  4. Cross-camera player mapping

About

⚽️A deep learning-based system designed for re-identifying football players across video frames and camera angles using person re-identification techniques. This project combines computer vision, feature extraction, and player tracking to help automate sports analytics and player recognition.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages