Last active
June 24, 2020 04:17
-
-
Save khalidmeister/39933abe43fefccc80d8fc718e1da2bc to your computer and use it in GitHub Desktop.
Testing the model and show the result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Show the images and the ground truth | |
dataiter = iter(dataloaders['test']) | |
images, labels = dataiter.next() | |
imshow(torchvision.utils.make_grid(images)) | |
print('GroundTruth: ', ', '.join('%5s' % class_names[x] for x in labels)) | |
# Predict the model | |
images = images.to(device) | |
labels = images.to(device) | |
output = model_resnet(images) | |
_, predicted = torch.max(output, 1) | |
print('Predicted: ', ', '.join('%5s' % class_names[x] for x in predicted)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment