How abdullahtarek/football_analysis works
Below are detailed instructions tailored to this project:
Main Components
• Input/Video Source: Represent the folder (input_videos) as the entry point for video data.
• YOLO Inference Module: Represent “yolo_inference.py” as the module that performs object detection using the trained YOLO v5 model.
• Detection & Tracking: Sketch “trackers/tracker.py” to indicate how detections are tracked over frames.
• Camera Movement Estimator: Represent “camera_movement_estimator” that uses optical flow methods to measure camera motion.
• Perspective/ View Transformer: Include “view_transformer” for converting pixel distances into world metrics via perspective transformation.
• Speed and Distance Estimator: Represent this module by “speed_and_distance_estimator”, which calculates movement metrics.
• Utility & Supporting Libraries: Note the “utils” folder (e.g., bbox_utils.py, video_utils.py) that provide auxiliary functions. Also, mark “stubs” and “models” as supporting data or configuration components.
• Main Application: Represent "main.py" as the orchestrator that ties all these components together.
Component Relationships and Data Flow
• The Tracker module for tracking continuity across frames.
• The Player Ball Assigner and Team Assigner components for associating detected objects with semantic labels.
• In parallel, a sub-path routes video frames into the Camera Movement Estimator, whose output feeds into the Speed and Distance Estimator. The View Transformer should be positioned to adjust for perspective changes—converting pixel paths into real-world distance measures.
• Consolidate outputs so that the processed data (player stats, tracking logs, team assignments) feed into either a result visualizer or an output generation module.
Architectural Patterns and Design Principles
• Modular Structure: Each functionality (detection, assignment, tracking, transformation, estimation) is encapsulated in independent Python modules, indicating a clear separation of concerns.
• Data Flow and Pipeline Orientation: The system is organized as a series of transformation steps on video data, where outputs from early modules (object detection) become inputs for later ones (tracking, estimation).
• Pipeline Flexibility: Given the presence of experimental notebooks (training, development_and_analysis), it is clear that the design supports iterative improvements and tuning of models.