Skip to content

building-experiments/ML-auto-baseball-pitching-overlay

 
 

Repository files navigation

⚾ Overlaying pitching motion and trajectory automatically with machine learning!

This project takes your baseball pitching clips and automatically generates 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 will apply 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 checkout the Todo list.

The idea came from this incredible overlay.

💻 Getting Started

These instructions will get you a copy of the project, and generates your own pitching overlay clip!

Get a copy

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

Prerequisites

Before running the project, we have to install all the dependencies from requirements.txt

pip install -r requirements.txt

Overlay!

Last, run the project with your own clips!

Try a sample

python picthing_overlay.py

Try with yout own clips

Place your pitching videos in a folder, then specify the path in the CLI.

python pitching_overlay.py --videos_folder "./videos/videos2"

☑️ Todo

  • Implement image registration to deal with camera shift
  • Build a demo web app for people to use it in realtime on web
  • Improve the visual effect
  • Write a Medium post to explain the technical workflow
  • Draw a structure diagram

About

⚾ Automatic baseball pitching overlay with machine learning.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%