Skip to content

kavinh07/Sports-Ball-Recognizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sports Ball Recognizer

An image classification model from data collection, cleaning, model training, deployment and API integration.
The model can classify 10 different types of balls
The types are the following:
1. Football
2. Basketball
3. Volleyball
4. Rugby
5. Golf
6. Cricket
7. Tennis
8. Bowling
9. Billiards
10. Baseball

Dataset Preparation

Data Collection: Downloaded from DuckDuckGo using term name and adding extra string ' only balls images'. A total of 2872 images were collected initially. After unlinking the damaged data, the total number of images was 2776.
DataLoader: Used FastAI DataBlock API to set up the DataLoader.
Data Augmentation: FastAI provides default data augmentation which operates in GPU.
Details can be found in data_prep.ipynb or Colab

Training and Data Cleaning

Training: Fine-tuned several pre-trained models for 5 epochs and got resnet34 as the best model. Then resnet34 was finetuned for 4 more times (Total 5 times) and achieved ~99% accuracy.
Results Comparison:

Models Train Loss Valid Loss Error Rate Train Accuracy
Resnet34 0.052 0.043 0.011 98.87%
GoogleNet 0.694 0.811 0.213 78.65%
VGG16 0.472 0.557 0.176 82.4%
MobileNet V3 Small 0.920 0.882 0.250 74.91%

Data Cleaning: This part took the longest time. Since I collected data from the browser, there were many noises. Also, some images contained irrelevant data. I cleaned and updated data using FastAI ImageClassifierCleaner. I cleaned the data each time after training or fine-tuning, except for the last time which was the final iteration of the model.
You can check the data training and cleaning process in model_imp.ipynb or Colab.

Model Deployment

I deployed the model to the HuggingFace Spaces Gradio App. The implementation can be found in the deployment folder or Hugging Face Interface.
HuggingFaceSpaceImage.png

API integration with GitHub Pages

The deployed model API is integrated Git Interface in the GitHub Pages Website. Implementation and other details can be found in the docs folder.