Data Visualisation

It is a good practice to visualize the dataset that we work on. It gives us some idea of what kind of data is present and therefore can affect some decisions on the way of designing and training the neural networks.

data_iterator = iter(train_loader)
images, labels = data_iterator.next()

print('Shape of input: {}, Shape of output: {}'.format(images.shape, labels.shape))

fig = plt.figure()
num_images = 60
for image_index in range(num_images):
    plt.subplot(6, 10, image_index+1)
    plt.imshow(images[image_index].numpy().squeeze(), cmap='gray_r')

Discussion

1

0