This project contains Python scripts for computer vision tasks related to football, specifically 2D football detection and trajectory tracking.
-
Clone the repository:
git clone https://github.com/1Divy1/Computer-Vision-Challenge-dotLumen.git cd computer-vision-challenge -
Create and activate a virtual environment (recommended):
python -m venv .venv source .venv/bin/activate # On Windows, use `.venv\Scripts\activate`
-
Install dependencies: The project uses
ultralyticsfor YOLO models andopencv-python. You can install them via pip:pip install ultralytics opencv-python
-
Download the YOLO model: Ensure you have the
yolo11n.ptmodel file in thecomputer_vision_models/directory. If it's missing, you might need to download it from the Ultralytics official sources or train your own.
The main script main.py orchestrates the different computer vision tasks.
python main.py- Video File: The input video is expected at
data/rgb.avi. You can change this path inmain.py. - Output Folder: All generated output videos will be saved in uniquely named subfolders within the
output/directory. This folder is automatically created if it doesn't exist.
Currently, the project supports:
- 2D Football Detection: Detects footballs in video frames and generates an output video with detections.
- Football Trajectory Tracking: Tracks the trajectory of detected footballs and overlays the path on the video.
Processed videos will be saved in the output/ directory, organized into subfolders with timestamps for each run.
Feel free to explore and modify the main.py, trajectory_tracking.py, two_dimensional_football_detection.py, and utils.py files to customize behavior.