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

Digit Classifier From Scratch & Gradient Descent

Reference Links:

We'll attempt to create a baseline model to classify images of handwritten digits, from the MNIST dataset

alt
# Install the fastai v2 library
!pip install fastai2 --quiet

# Import required functions
from fastai2.vision.all import *
matplotlib.rc('image', cmap='Greys')

To keep things simple, we'll use a subset of the dataset which only contains 3s and 7s.

# Download data
path = untar_data(URLs.MNIST_SAMPLE)
Path.BASE_PATH = path # For eaiser printing
path.ls()
(#3) [Path('valid'),Path('labels.csv'),Path('train')]
# Look inside the train folder
(path/'train').ls()
(#2) [Path('train/7'),Path('train/3')]