Sign in

How to plot MNIST using Matplotlib?

As I mentioned in the last post, We cannot install PyTorch MNIST smoothly.

If you stuck in installing the MNIST, check

1, Plot multiple images

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

2, Plot an individual image

#obtain a batch of training images
idx = 0

If you’d like to get the image black and white in the other way, cmap = ‘gray_r’.

3, Plot an individual image with annotations

img = images[idx].squeeze()

Writer, programmer. Here to show what’s inside my head and to be understood.