Skip to content

Instantly share code, notes, and snippets.

@sgodfrey66
Created June 17, 2020 00:47
Show Gist options
  • Save sgodfrey66/b7c435980679d57ad84d9367bda9cb3b to your computer and use it in GitHub Desktop.
Save sgodfrey66/b7c435980679d57ad84d9367bda9cb3b to your computer and use it in GitHub Desktop.
# Define the confusion matrix logging function
def cm_logger(epoch, logs):
# Create a name for this image
i_name='Confusion Matrix: {}; {}'.format(model_name, ds.dataset_name)
# Create the per-epoch callback for the confusion matrix
cm_image=image_funcs.plot_to_image(metrics_funcs.generate_heatmap(
dataset=ds,
model=model).figure)
# Write it to the logs
with cm_file_writer.as_default():
tf.summary.image(name=i_name, data=cm_image, step=epoch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment