Skip to content

Commit

Permalink
Fix data shape for classification images (#9)
Browse files Browse the repository at this point in the history
Data argument (https://www.tensorflow.org/api_docs/python/tf/summary/image#arguments) for `tf.summary.image` expects data to have the shape `[k, h, w, c]`
  • Loading branch information
Bidski authored Jun 4, 2021
1 parent cd9d08e commit d0c5776
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion training/callbacks/classification_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ def on_epoch_end(self, epoch, logs=None):
# Sort by hash so the images show up in the same order every time
with self.writer.as_default():
for i, img in enumerate(sorted(images, key=lambda image: image[0])):
tf.summary.image("images/{}".format(i), tf.expand_dims(img[1], axis=-1), step=epoch, max_outputs=1)
tf.summary.image("images/{}".format(i), tf.expand_dims(img[1], axis=0), step=epoch, max_outputs=1)

0 comments on commit d0c5776

Please sign in to comment.