The most of the codes and the contents of README in this project are adapted from [5].
Disclaimer: This is not an official implementation. TrackNet is a deep learning network to track the tennis ball from broadcast videos in which the ball images are small, blurry, and sometimes with afterimage tracks or even invisible. The proposed heatmap-based deep learning network is trained to not only recognize the ball image from a single frame but also learn flying patterns from consecutive frames. TrackNet takes images with the size of 640 × 360 to generate a detection heatmap from several consecutive frames to position the ball and can achieve high precision even on public domain videos. This implementation leverages TensorFlow and Keras to achieve precise tracking of tennis balls in dynamic video environments
TrackNet2 was used in badminton; however, here it was tried in tennis ball tracking. TrackNet2 adds U-Net and Weighted Binary Crossentropy(WBCE) loss function to improve the efficiency of ball tracking. TrackNet2 does not have the softmax function in the final layer, instead it uses the sigmoid function as the final layer. Besides, the y labels are binary labels(0 and 1).
Dataset is available via the link: https://nycu1-my.sharepoint.com/:u:/g/personal/tik_m365_nycu_edu_tw/ETCr6-M0e1VDhGCdMbvljcsBu31AJTO5xa_1cW8pHa7niA Dataset consists of video clips of 10 broadcast video. Each video contains several clips from a game. There are 19.835 labeled frames in the dataset.
- Clone the repository 'github.com/pdchyy/MyTrackNet.git'
- Install the necessary packages
pip install -r requirements.txt - Follow the below steps to convert videos to training images and heat-maps.
- Create an
imagessubdirectory under the home directory of the repository - Extract the game directories from the dataset in
imagesfolder - Create ground truth images and train/test labels via
python generate_groundtruth.py. - Move
labels_train.csv and labels_val.csvto home directory
- Create an
- Run
python train.pyto train the model of origianal TrackNet. - Run
python train.1.pyto train the model of TrackNetV2.
- Use infer.1.py to test the model of TrackNet or TrackNetU+ SSCE(Sparce Categorical Cross_Entropy) loss function
- Use infer.2.py to test the model of Tracknet2(U_Net + Sigmoid) + WBCE_loss
- https://arxiv.org/abs/1907.03698 TrackNet: A Deep Learning Network for Tracking High-speed and Tiny Objects in Sports Applications
- https://github.com/hgupt3/TRACE/blob/main/README.md
- https://gitlab.nol.cs.nycu.edu.tw/open-source/TrackNet
- https://gitlab.nol.cs.nycu.edu.tw/open-source/TrackNetv2
- https://github.com/tan1199/TrackNet/tree/master
- https://github.com/qaz812345/TrackNetV3/blob/master/model.py