-
-
Save HSShashank/9922309502f7cb6318ab0b59b3e852e2 to your computer and use it in GitHub Desktop.
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
fig,axes = plt.subplots(5,5) | |
fig.subplots_adjust(0,0,3,3) | |
for i in range(0,5,1): | |
for j in range(0,5,1): | |
num = random.randint(0,len(test_X)-1) | |
display_image = test_X[num].squeeze(0) | |
image = test_X[num] | |
predicted_prob = model.predict(image) | |
predicted_class = np.argmax(predicted_prob) | |
ground_truth =classes[y_test.iloc[num]] | |
axes[i,j].imshow(display_image) | |
axes[i,j].imshow(display_image) | |
if(classes[predicted_class] != classes[y_test.iloc[num]]): | |
t = 'PREDICTED {} \n GROUND TRUTH[{}]'.format(classes[predicted_class], classes[y_test.iloc[num]]) | |
axes[i,j].set_title(t, fontdict={'color': 'darkred'}) | |
else: | |
t = '[CORRECT] {}'.format(classes[predicted_class]) | |
axes[i,j].set_title(t) | |
axes[i,j].axis('off') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment