How dewolf1/option2_football_player_tracking works
Project Type and Purpose
• This is a standalone computer-vision video-processing pipeline (no traditional “frontend/backend” split).
File Structure Highlights
• main.py: orchestrates the entire pipeline
• static/assets/: holds input videos and YOLOv5 model weights (best.pt)
• static/reid_model/: holds pretrained OSNet weights (osnet_x1_0_imagenet.pth)
• requirements.txt: lists dependencies (PyTorch, ultralytics, torchreid, OpenCV, pytesseract, scikit-learn)
Main Components
A. Input Source
• Video file reader (OpenCV VideoCapture)
B. Preprocessing Module
C. Detection Module
D. Feature Extraction & Classification
1. ReID feature extractor (OSNet via torchreid)
3. OCR module (pytesseract) for jersey number text
E. ID Assignment Engine
F. Output Writer
• Annotated frames → OpenCV VideoWriter → output_with_consistent_ids.mp4
G. Model Storage
• static/assets/best.pt, static/reid_model/osnet_x1_0_imagenet.pth
Relationships & Data Flows
• to ReID extractor
• to HSV classifier
• to OCR module
Architectural Patterns & Principles
• Pipeline pattern: clear, linear stages
• Modular separation: detection, feature extraction, classification, tracking logic
• Single responsibility: each block does one core CV task
Technology & Libraries Call-outs
• YOLOv5 (ultralytics) for detection
• PyTorch for model inference (CUDA support)
• torchreid for ReID feature extraction
• OpenCV for I/O, preprocessing, annotation, video writing
• pytesseract for OCR
• scikit-learn for spatial heuristics/clustering
• Python 3.8+ runtime