SpeedServAI is a machine learning project that tracks tennis players' speed, position, and ball speed in real-time video. Using YOLO for object detection and CNNs for feature extraction, it provides accurate, real-time insights into match dynamics, enhancing performance analysis .
-
Clone the git repo :
git clone https://github.com/AniruthSuresh/SpeedServ---AI.git cd SpeedServ---AI
-
Create the conda environment (tennis in this case) using the provided
env.yml
file and activate it:conda env create -f env.yml conda activate tennis
-
To get the final output :
cd src python3 main.py
To train the models used in SpeedServAI, follow these steps:
- Navigate to the
src/training
directory. - Open and run
tennis_ball_training.ipynb
. - Save the trained model as
yolo5_last.pt
in thesrc/models
directory.
- Navigate to the
src/training
directory. - Open and run
tennis_keypoint_court.ipynb
. - Save the trained model as
keypoints_detect.pth
in thesrc/models
directory.
-
Custom Ball Tracking with YOLO: SpeedServAI initially employed a pretrained YOLO (You Only Look Once) model for ball tracking. However, to achieve more accurate results, a custom YOLO model was trained specifically for tennis ball tracking. Outliers in ball positions were removed, and the remaining positions were interpolated for smoother trajectory estimation.
-
Player Tracking with Pretrained YOLO: Leveraging a pretrained YOLO model, SpeedServAI identifies and tracks players on the court in real-time.
-
Keypoint Detection with ResNet50 + Updated CNN: To enhance accuracy further, SpeedServAI employs a ResNet50 architecture combined with an updated CNN on its final layer. This configuration allows for precise detection of keypoints on the court, providing detailed insights into player positioning and movement patterns.
This GIF demonstrates the output of SpeedServAI in action, showcasing its capabilities in tracking tennis players , ball and analyzing match dynamics in real-time.
SpeedServAI has potential for enhancement in the following areas:
- Improved Ball Tracking
- Larger Dataset Training: Enhance ball tracking accuracy by training the YOLO model on a larger dataset. This would allow for smoother trajectory estimation and more robust tracking in varying conditions.
- Enhanced Keypoint Detection
- Homography for Keypoint Estimation: Implement homography techniques to reconstruct shifted keypoints accurately. This method could improve the precision of player position detection on the court, especially in dynamic gameplay scenarios.