Skip to content

x-Surreal/Image-Classification-with-CNN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

Image-Classification-with-CNN

This repo includes an approach for classification of Natural Scenes around the world. A detailed explanation with some metrics can be found below.

Problem details

image

image

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

Model

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.

Image augmentations

I used the following Image augmentations

  • Flip
  • Rotation
  • RGB Randomize
  • Random lighting and contrast change
  • Jitter

Images with Augmentations

image

Resnet50

image

Top losses and confusion matrix

image

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.

image

Further Learning

  • 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

Run

  1. In order to run the Resnet50 model run the ImageClassificationwithCNN.ipynb file
  2. 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 a kaggle.json file and when you run opendatsets.download you can then input your username and your Kaggle API from the downloadeded file

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages