- Deep learning library
- Setting up Colab
- Getting the data
- Training the model
The fastai deep learning library, version 1.0.61 was utilized. Fastai runs on top of PyTorch. The fastai MOOC was officially released to the public in early 2019.
The data was retrieved and analyzed on Google Colab Platform(GCP).
For this project, I used a single 12GB NVIDIA Tesla K80 GPU.
The Indian-Cattle-Breed-Images data was used which included 30 popular indian breed cattles categories with a total of 4K images. Thus, each class had around 150 images, of which all are manually reviewed test images:
Since all the images were collected through internet via several sources like YouTube, Pinterest, Google Images etc., the training images were not cleaned, and thus they contained large amount of noise. This comes mostly in the form of intense colors, low quality, blurr and sometimes wrong labels. All images were rescaled to have a maximum side length of 512 pixels.
Ajit Kumar Singh, IIT Guwahati, Indian-Cattle-Breed-Images - 2020
The dataset size is around 3GB and can be retrieved using:
wget https://drive.google.com/uc?export=download&id=1VSTdl6-AN701ER5mmu2MbO_V26a4C811
I used the Resnet-50 CNN architecture. The model took about 7 hours to run on Google Colab.
The code used for training the data is available in the repository sajit9285/cattle-breed-classifier in the notebook section.
The output of the deep learning model is a file with weights. The file is called export.pkl
(or model.pkl
). If you train the model as in this repo, the model is saved to the models
folder.
The export.pkl
file can be downloaded to your local computer from Jupyter.
The export.pkl
file may be too large to be included in the git commit. There are various options for proceeding with that size dataset:
- Store the model on google drive.
- Store the model on GitHub releases.
- Store the model on a bucket in the cloud.
I stored my final model data file on google drive: https://drive.google.com/uc?export=download&id=1VSTdl6-AN701ER5mmu2MbO_V26a4C811