Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import numpy as np
- # functions to show an image
- def imshow(img):
- img = img / 2 + 0.5 # unnormalize
- npimg = img.numpy()
- plt.imshow(np.transpose(npimg, (1, 2, 0)))
- plt.show()
- dataiter = iter(testloader)
- images, labels = dataiter.next()
- # print images
- imshow(torchvision.utils.make_grid(images))
- print('GroundTruth: ', ' '.join('%5s' % classes[labels[j]] for j in range(4)))
- outputs = net(images)
- _, predicted = torch.max(outputs, 1)
- print('Predicted: ', ' '.join('%5s' % classes[predicted[j]]
- for j in range(4)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement