Learn practical skills, build real-world projects, and advance your career
Updated 4 years ago
Digit Classifier From Scratch & Gradient Descent
Reference Links:
- FastAI Book chapter 4: https://github.com/fastai/fastbook/blob/master/04_mnist_basics.ipynb
- FastAI v2 library docs: https://dev.fast.ai/
We'll attempt to create a baseline model to classify images of handwritten digits, from the MNIST dataset
# 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')]