Okay, got it. Here's the updated README with the model training section:
This project aims to develop a set of tools to thoroughly analyze football match videos. From the videos, the system is able to detect and track players, estimate their movements, speeds and distances covered, as well as identify the teams involved.
- Detection and tracking of players in the videos using YOLOv5 and YOLOv8 models
- Camera motion estimation to adjust player positions
- View transformation to obtain an ideal perspective
- Ball position interpolation
- Estimation of player speed and distance covered
- Automatic assignment of players to their respective teams using K-means clustering for team color identification
- Identification of ball possession by the different teams
The player detection and tracking models were trained using the YOLOv5 and YOLOv8 architectures. The training datasets were collected and annotated using Roboflow.
To train the models:
- Prepare the dataset:
- Collect football match videos and annotate the players using Roboflow.
- Split the dataset into training, validation, and test sets.
- Train the YOLOv5 and YOLOv8 models:
- Use the Roboflow SDK or the official YOLOv5 and YOLOv8 repositories to train the models on the prepared dataset.
- Fine-tune the models for optimal performance on the football video analysis task.
- Save the trained models:
- Export the trained models and save them in the
models/
directory.
- Export the trained models and save them in the
- Clone the Git repository:
git clone https://github.com/Amiche02/Advanced-Football-Video-Analysis.git
- Install the dependencies:
pip install -r requirements.txt
- Download the pre-trained models:
wget https://www.dropbox.com/scl/fo/hybscdrucozk29pbda15u/AN3zedKh1YYlkVtnXFH13Vk?rlkey=8rr5owurn3mu6pfarofh7tctq&st=s96ogmos&dl=0 -P models/
- Place the input videos in the
input_videos/
folder. - Run the main script:
python main.py
- The analyzed videos will be saved in the
output_videos/
folder.
Here is a preview of the output video:
Contributions are welcome! Feel free to open an issue or submit a pull request if you have any suggestions for improvement or if you have found a problem.