Skip to content

Instantly share code, notes, and snippets.

@frogermcs
Created May 27, 2019 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frogermcs/12cb89263587c832f910e3d562a800d2 to your computer and use it in GitHub Desktop.
Save frogermcs/12cb89263587c832f910e3d562a800d2 to your computer and use it in GitHub Desktop.
# Get predictions for each image
predicted_ids = np.argmax(tf_model_predictions, axis=-1)
predicted_labels = dataset_labels[predicted_ids]
# Print images batch and labels predictions
plt.figure(figsize=(10,9))
plt.subplots_adjust(hspace=0.5)
for n in range(30):
plt.subplot(6,5,n+1)
plt.imshow(val_image_batch[n])
color = "green" if predicted_ids[n] == true_label_ids[n] else "red"
plt.title(predicted_labels[n].title(), color=color)
plt.axis('off')
_ = plt.suptitle("Model predictions (green: correct, red: incorrect)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment