Learn practical skills, build real-world projects, and advance your career
!pip install jovian --upgrade --quiet
# Project name used for jovian.commit
project_name = 'Handwritten Digit Recognition'

About Dataset

MNIST contains 70,000 images of handwritten digits: 60,000 for training and 10,000 for testing. The images are grayscale, 28x28 pixels, and centered to reduce preprocessing and get started quicker.

Known Challenge with dataset: The images are of not same size so we need to tranform before feeding to our neural network

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

Creating a transformer function that will help us to transform the images to get a uniform size. We do this using torchvision library form torch. It will help us transform (using torchvision.transform) and load our dataset (using torchvision.dataset).