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

Classifying images of everyday objects using a neural network

The ability to try many different neural network architectures to address a problem is what makes deep learning really powerful, especially compared to shallow learning techniques like linear regression, logistic regression etc.

In this assignment, you will:

  1. Explore the CIFAR10 dataset: https://www.cs.toronto.edu/~kriz/cifar.html
  2. Set up a training pipeline to train a neural network on a GPU
  3. Experiment with different network architectures & hyperparameters

As you go through this notebook, you will find a ??? in certain places. Your job is to replace the ??? with appropriate code or values, to ensure that the notebook runs properly end-to-end. Try to experiment with different network structures and hypeparameters to get the lowest loss.

You might find these notebooks useful for reference, as you work through this notebook:

# Uncomment and run the commands below if imports fail
!pip install numpy pandas pytorch torchvision cpuonly
!pip install matplotlib --upgrade --quiet
Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (1.19.5) Requirement already satisfied: pandas in /usr/local/lib/python3.7/dist-packages (1.1.5) Collecting pytorch Downloading https://files.pythonhosted.org/packages/ee/67/f403d4ae6e9cd74b546ee88cccdb29b8415a9c1b3d80aebeb20c9ea91d96/pytorch-1.0.2.tar.gz Requirement already satisfied: torchvision in /usr/local/lib/python3.7/dist-packages (0.9.1+cu101) ERROR: Could not find a version that satisfies the requirement cpuonly (from versions: none) ERROR: No matching distribution found for cpuonly
import torch
import torchvision
import numpy as np
import matplotlib.pyplot as plt
import torch.nn as nn
import torch.nn.functional as F
from torchvision.datasets import CIFAR10
from torchvision.transforms import ToTensor
from torchvision.utils import make_grid
from torch.utils.data.dataloader import DataLoader
from torch.utils.data import random_split
%matplotlib inline
# Project name used for jovian.commit
project_name = '03-cifar10-feedforward'

Exploring the CIFAR10 dataset