Learn practical skills, build real-world projects, and advance your career
Updated 4 years ago
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:
- Explore the CIFAR10 dataset: https://www.cs.toronto.edu/~kriz/cifar.html
- Set up a training pipeline to train a neural network on a GPU
- 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
!conda install numpy pandas pytorch torchvision cpuonly -c pytorch -y
!pip install matplotlib --upgrade --quiet
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /opt/conda
added / updated specs:
- cpuonly
- numpy
- pandas
- pytorch
- torchvision
The following packages will be downloaded:
package | build
---------------------------|-----------------
ca-certificates-2020.6.20 | hecda079_0 145 KB conda-forge
certifi-2020.6.20 | py37hc8dfbb8_0 151 KB conda-forge
numpy-1.18.5 | py37h8960a57_0 5.1 MB conda-forge
pandas-1.0.5 | py37h0da4684_0 10.1 MB conda-forge
------------------------------------------------------------
Total: 15.5 MB
The following packages will be UPDATED:
ca-certificates 2020.4.5.2-hecda079_0 --> 2020.6.20-hecda079_0
certifi 2020.4.5.2-py37hc8dfbb8_0 --> 2020.6.20-py37hc8dfbb8_0
numpy 1.18.1-py37h8960a57_1 --> 1.18.5-py37h8960a57_0
pandas 1.0.3-py37h0da4684_1 --> 1.0.5-py37h0da4684_0
Downloading and Extracting Packages
ca-certificates-2020 | 145 KB | ##################################### | 100%
certifi-2020.6.20 | 151 KB | ##################################### | 100%
numpy-1.18.5 | 5.1 MB | ##################################### | 100%
pandas-1.0.5 | 10.1 MB | ##################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
ERROR: osmnx 0.14.1 has requirement geopandas>=0.7, but you'll have geopandas 0.6.3 which is incompatible.
ERROR: hypertools 0.6.2 has requirement scikit-learn<0.22,>=0.19.1, but you'll have scikit-learn 0.23.1 which is incompatible.
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'