Plotting the trajectory of a basketball shot with Tensorflow's Object Detection API.
STEP 1: Clone Tensorflow's Object Detection Repository: https://github.com/tensorflow/models/tree/master/research/object_detection
STEP 2: Follow their installation guide:
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md
STEP 3: Download this repository and move all the files into the folder "object_detection" of the tensorflow repository
STEP 4: Place your video of your shot in the same folder and run it.
e.g. How to run it on "test.mp4":
>>> python3 annotate_video.py test.mp4
NOTE: If the ball is being shot from the left side of the screen is moving towards the right, add the flag "--left_to_right":
>>> python3 annotate_video.py test_flipped.mp4 --left_to_right
STEP 5: Adjust the release point with the slider at the bottom of the window. Pick a frame of the video with the second slider. Close the window.
RESULT: The analyzed picture and the annotated movie have been saved.
- imageio
- numpy
- matplotlib
- tensorflow
- pillow
- Stablize the camera or phone when you are recording the video.
- Cut the video beforehand and feed in short videos to the script.
- Use a high quality video becuase this maximizes the likelyhood of the basketball being recognized.
- Make sure that there is only ONE basketball in the video. Otherwise a "wrong basketball" might be recognized.
- Use a brown basketball.