Cricket 🏏 is often described as a contest between bat and ball, and batting is considered one of its prime disciplines. While batting a batter tries to hit the ball with a different variety of shots to guide the ball in any specific direction of their wish. The types of shots include cover drive, straight drive, pull shot, reverse sweep, and many more. It is tedious task to classify shots manually and provide the insights for the batsman. Our goal is to classify the shot using AI and to provide an analysis of how well someone plays a particular shot. This can be achieved by collecting the required image data, extracting features, feeding to the machine learning or deep learning algorithms, and generating the classifier output. We have implemented the model using SVM which works better with less data.
-
Clone this repo:
git clone https://github.com/gtmray/cricket-shots.git
-
Create virtualenv and activate:
virtualenv env
.\env\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Bat Detection:
py predict_bat.py IMAGE_PATH
-
Shots Classification:
py predict_shot.py model/shot_classification.pkl IMAGE_PATH
-
For running API:
uvicorn fast_api:app
or py -m uvicorn fast_api:app
-
Predict shots and efficiency:
py shots_eff.py IMAGE_PATH