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

Handwriting reader (numbers)

The MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/) has a training set of 60,000 examples, and a test set of 10,000 examples. It is a subset of a larger set available from NIST. The digits have been size-normalized and centered in a fixed-size image.


We now use the famous MNIST database of handwritten digits to train our neural network to recognize handwritten numbers.

!pip install jovian --upgrade --quiet
project_name = 'handwriting-recogniser'
import numpy as np
import torch
import torchvision
import matplotlib.pyplot as plt
from time import time
from torchvision import datasets, transforms
from torch import nn, optim
import torch.nn.functional as F
transform = transforms.Compose([transforms.ToTensor(),transforms.Normalize((0.5,), (0.5,)),])