This project implements a Player Re-Identification system designed for sports video analysis. It automatically detects players in each frame, assigns them unique IDs, and maintains identity consistency—even when players leave and re-enter the scene. The system leverages a fine-tuned YOLOv11 model for detection and DeepSORT for real-time, appearance-aware tracking. The modular design allows individual component testing, feature extraction, and flexible customization.
| Component | Technology / Library |
|---|---|
| 🧠 Detection | YOLOv11 (Ultralytics) |
| 🔁 Tracking | DeepSORT |
| 🔬 Feature Extraction | Color histograms, spatial & texture descriptors |
| 🖼️ Visualization | OpenCV |
| 🐍 Language | Python 3.8+ |
| 📦 Dependencies | PyTorch, OpenCV, NumPy, scikit-learn, matplotlib, tqdm, requests |
- 🎯 Player Detection using a fine-tuned YOLOv11 model.
- 🔁 Player Tracking using DeepSORT for maintaining consistent IDs.
- 🧠 Feature Extraction including color, texture, and spatial features for re-identification.
- 📊 ID Management to match re-appearing players with previous IDs.
- 🖼️ Visualization with bounding boxes and track IDs.
- 🧪 Modular Testing of all components (detection, tracking, extraction, etc.).
- ✅ Easy setup via a single
setup.pyscript.
player-reidentification/
│
├── data/ # Input videos (e.g., 15sec\_input\_720p.mp4)
├── models/ # YOLOv11 model weights (best.pt)
├── output/ # Output videos with annotated tracking
├── src/ # Core source modules
│ ├── detector.py # Player detection (YOLOv11 wrapper)
│ ├── feature\_extractor.py # Color, texture, spatial features
│ ├── tracker.py # DeepSORT-based tracking
│ ├── visualizer.py # Bounding box & track ID rendering
│ └── main.py # Main pipeline runner
│
├── download\_model.py # Script to download the YOLOv11 model
├── test\_system.py # Unit tests for pipeline and modules
├── setup.py # Installation, setup, and testing script
├── requirements.txt # Python dependencies
├── .gitignore # Files and folders to ignore in Git
└── README.md # Project overview and documentation
git clone https://github.com/priyam864/player-reidentification.git
cd player-reidentificationThis will:
- Check Python version
- Create required directories
- Install dependencies
- Download YOLOv11 weights
- Run a basic test
python setup.py📥 If the model fails to download automatically, you can download it manually:
Manual Model Link
Save it as: models/best.pt
python -m src.main data/your_video.mp4--output output/your_result.mp4 # Custom output path
--save-comparison # Save side-by-side comparison view
--show-detections # Show raw detections only (no tracking)python -m src.main data/15sec_input_720p.mp4 --output output/tracked.mp4 --save-comparisonYou can verify that all components (detector, tracker, extractor, visualizer) are working by running:
python test_system.pyThis runs:
- Frame detection
- Feature extraction
- Dummy frame tracking
- Drawing visualizations
- The YOLOv11 model used is fine-tuned to detect players (
class 0). - The system is modular, allowing individual testing or replacement of parts.
- Videos are saved automatically in
output/.
Dependencies are listed in requirements.txt and installed via setup.py. Major libraries include:
ultralytics(YOLOv11)opencv-pythontorch,torchvisionnumpy,scikit-learntqdm,requests,matplotlib,pillow,scipy
For questions or collaboration, feel free to reach out via GitHub.