Learn how to classify
Stanford Cars into their rightful classes using Deep Neural Networks and pretrained models like ResNet. Explore CNN, Data Augmentation and ResNets in this real life classification project.
The objective of this notebook is to showcase the use of Deep Neural Networks in a real life classification project scenario and to display how powerful and applicable pretrained Neural Networks are.
To achieve that we will seek to successfully classify
Stanford Cars into their rightful classes. We'll use the
Stanford Cars dataset from https://www.kaggle.com/jutrera/stanford-car-dataset-by-classes-folder .We have 16,185 images of 196 classes of cars. The data is split into 8,144 training images and 8,041 testing images, where each class has been split roughly in a 50-50 split. Classes are typically at the level of Make, Model, Year.
In this notebook you will find
ResNet 9 Modelbuilt from scratch
We can use the
opendatasets library to download the dataset from Kaggle.
opendatasets uses the Kaggle Official API for downloading datasets from Kaggle.
!pip install opendatasets --upgrade --quiet
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'
import opendatasets as od dataset_url = 'https://www.kaggle.com/jutrera/stanford-car-dataset-by-classes-folder' od.download(dataset_url)
Downloading stanford-car-dataset-by-classes-folder.zip to ./stanford-car-dataset-by-classes-folder
100%|██████████| 1.83G/1.83G [00:52<00:00, 37.2MB/s]