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

Image classification on Fruits 360

In this notebook we'll be working on a model to classify images from a Fruits 360 dataset (in kaggle). You can find out the dataset link here

The dataset contains 131 classes and each class/folder has close to 500 images in it. We'll divide this dataset for both training and validation sets using random split.

Let's look at some steps to be followed to do the project.

Steps to be followed:

  1. Pick a dataset
  2. Download the dataset
  3. Import the dataset
  4. Explore the dataset
  5. Prepare the dataset for training

Import the required libraries, Download the dataset and import it into PyTorch

I'm gonna use opendatasets by Jovian in order to download the dataset.

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
from torchvision.transforms import ToTensor
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline

matplotlib.rcParams['figure.facecolor'] = '#ffffff'
project_name='fruits-360-kaggle'
# install the opendataset library 
!pip install opendatasets --upgrade --q