Member-only story

Identifying hand-written digits(MNIST) using PyTorch

Sonam Tripathi
8 min readOct 30, 2020

--

Source: MNIST database(Wikipedia)

We will use the famous MNIST Handwritten Digits Databases as our training dataset.It consists of 28px by 28px grayscale images of handwritten digits(0–9), along with labels for each image indicating which digit it represents. MNIST stands for Modified National Institute of Standards and Technology.PyTorch is an optimised tensor library for deep learning using GPUs and CPUs.

Quick Navigation

1. Brief about PyTorch

2. Working with images in PyToch(using MNIST Dataset)

3. Splitting a dataset into training, Validation and test sets

4. Creating PyTorch models with custom logic by extending the nn.Module Class

5. Interpreting model outputs as probabilities using softmax, and picking predicted labels

6. Picking a good evaluation metric(accuracy) and loss function(cross entropy) for Classification problems

7.Setting up a training loop that also evaluates the model using Validation set

8. Testing the model manually on randomly picked examples

9.Saving and loading the model checkpoints to avoid retraining from scratch

10. References

## Imports
import torch
import torchvision…

--

--

Sonam Tripathi
Sonam Tripathi

Written by Sonam Tripathi

Sr. Associate Manager @Lilly | Researcher | Full-time Learner

No responses yet