build a soccer analysis platform
by rh5
Software Development Journey Overview
Follow this step-by-step software development journey to see real progress updates, challenges overcome, and practical experience.
Progress Updates (3 total)
Update #1: build a soccer analysis platform
I've been looking for a python project. I've been wanting to introduce myself to the realms of AI and Machine Learning. I love Arsenal. Browsing r/soccer or r/gunners I've seen posts of statistical analysis of matches, players, etc. and I have always been intrigued to make my own metrics or figure out how they do it.
Challenges Overcome: Over the past couple days I realized I want to take it one step further than just simple analysis. I think building an interactive GUI where you can upload your own clips and choose what metrics to analyze for your own pleasure would be pretty cool.
So I made a basic GUI so far using PySide and OpenCV where all it does is import a video.
Update #2: Collected data
10% completeFrankly, I was at a bit of a crossroads with starting this. There are so many pretrained models out there for detecting soccer players, but I am not skilled enough in computer vision yet to get to a point where I can take random teams and convert that training data to Arsenal... at least I don't think.
Additionally, I had to decide between using PyTorch, YOLO, Roboflow, etc. which each have their own benefits. I was going to use a pretrained model just to start, but then I found a great YouTube video by Computer Vision Engineer where he provided great resources to find images with annotations and bounding boxes included and how to do it yourself.
Based on the positive feedback in the comment section and some boredom I decided to follow along.
So, what I've done so far:
1. YouTube2MP4 Arsenal 3 - 1 Liverpool highlights
2. Wrote a python script using opencv to capture an image every 10 frames of the video
3. Annotated ~100 images for a training set using cvat.ai
4. Created a gui using PySide6 and OpenCV which can successfully import videos
Now I'm onto the next step of preprocessing and object detection.
Although 25% of the way through my milestones, I am keeping my completion level at 10% due to how much more expansion can be done.
Challenges Overcome: Decided on a path to venture down. I hope YOLO works out well, again I am very new to this.
Looking Back: I had to do some research on Convolutional Neural Networks to get a better understanding of YOLO, bounding boxes, annotations, etc.
Update #3: Video running in GUI with Detection
30% completeCool it's detecting. Using the annotations I made from the model using cvat, I tried a model via 3, 30, 100, and 1000 epochs. I was worried when I was annotating that the quality of the video would cause me some issues down the line because I only downloaded in 720p -- I think that is still the case. The 1000 epoch run only trained on 244 models because the prior 100 did not show any improvement, (yolov8 default patience value).
The main way to tell in the video is that the ball is rarely detected.
Challenges Overcome: - Ran my first ML model
- Detecting in GUI
- Threading (for displaying the frames while keeping the GUI alive)
Obstacles Faced: - How can I make this model better? Do I need to download higher quality images and then re-annotate?
- How can I make this modular for any team?
Looking Back: - Training your own model kinda sucks
- Make sure you have high quality videos
- I don't have any other baseline to compare, yet, but YOLOv8 seems really fast and is very intuitive
- Don't try to switch your python interpreter mid project.