Open-source Monocular Python HawkEye for Tennis
With ❤️ by ArtLabs
To track the ball we used TrackNet - deep learning network for tracking high-speed objects. For players detection ResNet50 was used. See ArtLabs/projects for more or similar projects.
Input | Output |
---|---|
This project requires compatible GPU to install tensorflow, you can run it on your local machine in case you have one or use Google Colaboratory with Runtime Type changed to GPU.
git clone https://github.com/ArtLabss/tennis-tracking.git
pip install -r requirements.txt
python3 predict_video.py --input_video_path=VideoInput/video_input3.mp4 --output_video_path=VideoOutput/video_output.mp4 --minimap=0 --bounce=0
predict_video.py
, change Runtime Type to GPU and connect it to Google drive
from google.colab import drive
drive.mount('/content/drive')
predict_video.py
are. In my case,
import os
os.chdir('drive/MyDrive/Colab Notebooks/tennis-tracking')
!pip install filterpy sktime
predict_video.py
!python3 predict_video.py --input_video_path=VideoInput/video_input3.mp4 --output_video_path=VideoOutput/video_output.mp4 --minimap=0 --bounce=0
After the compilation is completed, a new video will be created in VideoOutput folder if --minimap
was set 0
, if --minimap=1
three videos will be created: video of the game, video of minimap and a combined video of both
P.S. If you stumble upon an error or have any questions feel free to open a new Issue
--minimap
--minimap=0 |
--minimap=1 |
---|---|
To predict bounce points machine learning library for time series sktime was used. Specifically, TimeSeriesForestClassifier was trained on 3 variables: x
, y
coordinates of the ball and V
for velocity (V2-V1/t2-t1
). Data for training the model - df.csv
--bounce=1
bounce points can be detected and displayed
The model predicts true negatives (not bounce) with accuracy of 98% and true positives (bounce) with 83%.
Help us by contributing, check out the CONTRIBUTING.md. Contributing is easy!
Yu-Chuan Huang, "TrackNet: Tennis Ball Tracking from Broadcast Video by Deep Learning Networks," Master Thesis, advised by Tsì-Uí İk and Guan-Hua Huang, National Chiao Tung University, Taiwan, April 2018.
Yu-Chuan Huang, I-No Liao, Ching-Hsuan Chen, Tsì-Uí İk, and Wen-Chih Peng, "TrackNet: A Deep Learning Network for Tracking High-speed and Tiny Objects in Sports Applications," in the IEEE International Workshop of Content-Aware Video Analysis (CAVA 2019) in conjunction with the 16th IEEE International Conference on Advanced Video and Signal-based Surveillance (AVSS 2019), 18-21 September 2019, Taipei, Taiwan.
Joseph Redmon, Ali Farhadi, "YOLOv3: An Incremental Improvement", University of Washington, https://arxiv.org/pdf/1804.02767.pdf