Skip to content

Tennis match analysis via computer vision techniques.

Notifications You must be signed in to change notification settings

StanlyHardy/open-tennis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenTennis

OpenTennis is a framework under active development to analyze Tennis matches. Currently, it supports cour edge extraction, and player information extraction via scoreboard analysis.

System ArchitectureFeaturesDemoInstallationInferenceConfigurationsRoadmap

System Architecture

Features

  • Court Edge Detection
  • Recognize the Player Names.
  • Determine the scores.
  • Find the current serving player.
  • Evaluate the average correct match.

Demo

Installation

Requirements

  • Linux
  • CUDA>= 10.0
  • Python >= 3.6

Steps

  1. Create a virtual conda environment and activate it.
conda create -n scorewatch python=3.9 -y
conda activate scorewatch
  1. Install Pytorch
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
  1. Install TensorRT
pip install -U nvidia-tensorrt --index-url https://pypi.ngc.nvidia.com
  1. Clone the repository
git clone https://github.com/StanlyHardy/score_watch # clone
cd score_watch
  1. Install other requirements
pip install -r requirements.txt # install
  1. The provided .engine file is platform specifc. So, export detector.pt within assets/models to TensorRT engine using the official exporter .

Inference

Inference could run either on Video or Image streams. The configuration could be changed via assets/config/app_config.yaml. If the evaluation is set to true, the inference occurs in validatation dataset and performs evaluation to determine the Average scores for correct Player names, Scores and Serving Player. Please change the input paths of video or images.

python app.py 

Configurations

App configuration(click to expand)
Section Feature Description
  Paths   video_path  Path of the video on which the evaluation needs to be done.
 img_path  Directory containing the test images. Ground truth needs to be available for evaluation with image set.
 players_path  Path containing player informations
 groundtruth_path  Ground truth data which is in json format that has got the player information.
 output_video_path  The path to save the video if the output needs to be saved and visualized later.
 logs_path  Path where the output log will be saved.
  Streamer   should_draw'  Draws over the frames for visualization , if enabled.
 view_imshow  The output visualization shall be turned on/off with this parameter.
 save_stream  Turning on this field enables the video output to be saved in the path defined in output_video_path
 debug  Displays debug logs if enabled
 evaluation  Turn on if the evaluation has to be done over the image set. Both image set and the annotations are required in this case.
  Models   score_det_model'   Path of the score detector model.
 detector_config   Path of the config file for the score detector.
 text_rec_model  CRNN Model path responsible for Player information recognition.
 text_rec_config  Path to the configuration for the CRNN model
 ocr_engine  Choose between CRNN or PyTesseract.
Detector Configuration(click to expand)
Section Feature Description
  YOLOv5   execution_env  ONNX Runtime provides support for CUDA, CPU and TensorRT. By default, CUDA is chosen. ONNX Runtime falls back to cpu if CUDA is unavailable.
 conf_thresh  Detection confidence
 iou_thres  IOU threshold to gauge the overlap.
 warm_up  Number of samples to be used during the warm up phase.
 class_labels  Class labels

Roadmap

  • Train CRNN with wide set of Data from ATP/Wimbledon matches.
  • Implement Ball Tracking, Trajectory Analysis
  • Player tracking.
  • Predict the style and the outcome of shot
  • Player activity analysis

Acknowledgement