Used fastai and ResNet50 model and error_rate and accuracy as evaluation metrics to develop this image recognition model with ~98.5% accuracy.I gathered more than 4.5k data to train the model.
The ultimate goal of this project is to distinguish the 15 most popular different types of Sports Activities around the world.
The types are following:
- archery
- baseball swing
- basketball shot
- boxing jab
- cricket batting
- cycling sprint
- golf swing
- horse riding gallop
- ice hockey slapshot
- rowing
- rugby tackle
- skiing parallel
- soccer kick
- surfing cutback
- volleyball spike
Data Collection: I collected the necessary data from DuckDuckGo using the label name.
DataLoader: The DataLoader was configured using the fastai DataBlock API.
Data Augmentation: Fastai offers GPU-operated default data augmentation. You can find the details in notebooks/data_preparation.ipynb
file.
Model Training: I used ResNet50 transfer learning model to train my model. I used 10 epochs at first time training,5 epochs at second time training,3 epochs at third time training and 2 epochs at fourth time training. Finally, I found ~98.5% Accuracy,~1.5% Error Rate,~5% Validation Loss and ~9.87% Train Loss.
Data Cleaning: This part was the most time consuming part of this project. I cleaned the data based on the Confusion Matrix scores four times. At the very beginning, there was a lot of noise and irrelevant data in my dataset. Using the fastai ImageClassifierCleaner, I updated and cleaned the dataset. With the exception of the final iteration, which produced the final version of the model, I purged the data after every training or fine-tuning iteration.
After training the model and cleaning the data I deployed the final model sports-action-recognizer-version3.pkl
into HuggingFace Spaces Gradio App. The implementation can be found in deployment folder or here
Finally, I made a simple two page website using HTML, CSS and JavaScript where I integrated the model API here and I used Github Pages to host my website. Implementation and other details can be found in docs
folder.
Python version 3.10 or 3.11 is required.
To get started with the project, follow these steps:
-
Clone the project repository from GitHub
git clone https://github.com/armanulalam/Sports-Activity-Recognizer.git
-
Set up the required dependencies and libraries by executing the following command:
pip install -r requirements.txt
-
Obtain a dataset of images representing the 25 photography styles by executing the following notebook: data_preparation.ipynb.
-
Train the machine learning model using the dataset by executing the following notebook: modelTraining_and_dataCleaning.ipynb.
-
Now, you can identify the photography style of any image by executing the following commands:
cd .\deployment\ python app.py
Or you can visit Hugging Face Space: Armanul/sports-activity-recognizer) to recognize different types of sports activity.
If you have any further queries then you can send me an email to [email protected]