Tennis Analysis

Mar 20, 2024 · 2 min read
Tennis Analysis

This project analyzes Tennis players in a video to measure their speed, ball shot speed and number of shots. This project will detect players and the tennis ball using YOLO and also utilizes CNNs to extract court keypoints. The motivation behind this project to analyze tennis players in a video to measure their speed, ball shot speed and number of shots, so that the analysis can be used to improve the performance of the players. Not only that, it also helps for the coaches to analyze the performance of the players and provide feedback to the players. And to make the judgement for referees easier.

Features

  • Player Detection: Detects players in the video using YOLO Models.
  • Tennis Ball Detection: Detects tennis ball in the video continuously.
  • Court Key Point Extraction: Extracts court keypoints using CNNs.
  • Speed Measurement: Measures the speed of the players and the tennis ball.
  • Shot Count: Counts the number of shots played by the players.

Frameworks and Libraries

  • YOLO - YOLO is a state-of-the-art, real-time object detection system. It is a deep learning algorithm that can detect objects in real-time. YOLO is a clever neural network for doing object detection in real-time. YOLO stands for ‘You Only Look Once’.
  • PyTorch - PyTorch is an open source machine learning library based on the Torch library. It is used for applications such as natural language processing. It is primarily developed by Facebook’s AI Research lab.
  • OpenCV - OpenCV is a library of programming functions mainly aimed at real-time computer vision. Originally developed by Intel, it was later supported by Willow Garage then Itseez. The library is cross-platform and free for use under the open-source BSD license.
  • CNNs - In deep learning, a convolutional neural network (CNN, or ConvNet) is a class of deep neural networks, most commonly applied to analyzing visual imagery.

Models Used

  • YOLO v8 for player detection
  • Fine Tuned YOLO for tennis ball detection
  • Court Key point extraction

Installation & Running

  1. Clone the repository and navigate to the directory
git clone https://github.com/Chaganti-Reddy/Tennis-Analysis-YOLOV8.git && cd Tennis-Analysis-YOLOV8
  1. Change the path of video file to be analyzed in the main.py file.

  2. Install these requirements.

  • python3.8
  • ultralytics
  • pytroch
  • pandas
  • numpy
  • opencv
  1. Then run the following command to run the application.
python main.py