Skip to content

Instantly share code, notes, and snippets.

@frogermcs
Created May 27, 2019 19:53
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/46e3747a9279760234ace93f6bbe5c37 to your computer and use it in GitHub Desktop.
Save frogermcs/46e3747a9279760234ace93f6bbe5c37 to your computer and use it in GitHub Desktop.
# Get images and labels batch from validation dataset generator
val_image_batch, val_label_batch = next(iter(valid_generator))
true_label_ids = np.argmax(val_label_batch, axis=-1)
print("Validation batch shape:", val_image_batch.shape)
# >> Validation batch shape: (32, 224, 224, 3)
# Get predictions for images batch
tf_model_predictions = flowers_model.predict(val_image_batch)
print("Prediction results shape:", tf_model_predictions.shape)
# >> Prediction results shape: (32, 5)
# Convert prediction results to Pandas dataframe, for better visualization
tf_pred_dataframe = pd.DataFrame(tf_model_predictions)
tf_pred_dataframe.columns = dataset_labels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment