Learn practical skills, build real-world projects, and advance your career

MultiClass Image Classification problem provided by Kaggle

Dataset found on Kaggle - https://www.kaggle.com/puneet6060/intel-image-classification

The dateset consists of 6 classes of images of 'buildings', 'forest', 'glacier', 'mountain', 'sea', 'street'. We have been provided with 3 folders for training, testing and prediction.

As it is an image classification problem we will go with convolutional neural network to solve this problem. We will be using resnet34 pretrained model provided by pytorch to support our model for training.

Lets import all necessary libraries to solve this problem

!pip install opendatasets --upgrade --quiet
project_name = 'kaggle-image-classifcation-course-project'
import os
import torch
import torchvision
import tarfile
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from torchvision.datasets.utils import download_url
from torchvision.datasets import ImageFolder
from torch.utils.data import DataLoader
import torchvision.transforms as tt
from torch.utils.data import random_split
from torchvision.utils import make_grid
import shutil
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline

matplotlib.rcParams['figure.facecolor'] = '#ffffff'


import opendatasets as od

Opendatasets is an opensource library to get online datasets to your notebook easily

To download from Kaggle you need to create an account on Kaggle and get your own kaggle.json file which has your kaggle credentials

Then you need to upload the Kaggle.json file to this notebook to download the dataset to this environment