⚾🤖⚾ Automatic baseball pitching overlay in realtime
⚾ Automatically overlaying pitch motion and trajectory with machine learning!
This project takes your baseball pitching clips and automatically generates the overlay. The input pitching clip could be directly from your phone or camera. The release point will be automatically detected by the program. This system will trace the trajectory and align all the videos to generate the overlay.
A fine-tuned YOLOv4 model is used to get the location of the ball. Then, I implemented SORT tracking algorithm to keep track of each individual ball. Lastly, I have applied some image registration techniques to deal with slight camera shift on each clip.
I'm still trying to improve it! Feel free to follow this project, also check out the Todo list.
The idea came from this incredible overlay.
These instructions will get you a copy of the project, and generates your own pitching overlay clip!
Get a copy of this project by simply running the git clone command.
git clone https://github.com/chonyy/ML-auto-baseball-pitching-overlay.git
Before running the project, we have to install all the dependencies from requirements.txt
pip install -r requirements.txt
Last, run the project with your own clips!
Place your pitching videos in a folder, then specify the path in the CLI.
python pitching_overlay.py --videos_folder "./videos/videos"