This repo includes an approach for classification of Natural Scenes around the world. A detailed explanation with some metrics can be found below.
Main task is to classify the images with respective categories:
- Buildings
- Forest
- Glacier
- Mountain
- Sea
- Street
The accompanying Kaggle kernel can be found here: https://www.kaggle.com/puneet6060/intel-image-classification
I used the Resnet50 which was pretrained on the ImageNet dataset. I have used the fastai library as it provides a lot of flexibility, speed, easo-of-use. Fastai also has implemented a Learning rate finder which provides the best value for the learning rate parameter after training a sample batch.
I used the following Image augmentations
- Flip
- Rotation
- RGB Randomize
- Random lighting and contrast change
- Jitter
Top losses and confusion matrix
The number of classes correctly classified and the number of classes misclassified can be clearly seen by the confusion matrix. The model struggles to classify mountains and glaciers and buildings and streets as the dataset is a bit inconsistent in this regard. Some images are also not properly labelled.
- We can try implementing deeper architectures like the Resnet101 which has deeper layers and is capable of capturing more fine grained features
- Based on a couple researches, the fundamental problem of Imagenet pretrained models are that they are pretrained on an object classification dataset therefore it becomes an arduous task to train all the layers instead of just training the last layers of the model. An approach based on the Resnet50 model pretrained on the Places365 dataset should be able to perform better
- A significant boost could be achieved by removing mislabelled images or images which have a low confidence score
- In order to run the Resnet50 model run the ImageClassificationwithCNN.ipynb file
- I have used the
opendatasets
python library from Kaggle to download the dataset. You need to sign in to Kaggle. Create an API token (you can find it in your profile) which downloads akaggle.json
file and when you runopendatsets.download
you can then input your username and your Kaggle API from the downloadeded file