Skip to content

Commit

Permalink
Add tensorflow function to read images
Browse files Browse the repository at this point in the history
  • Loading branch information
ocampor committed Sep 14, 2019
1 parent 15c2dab commit 837b164
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions notebooks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ def get_scaled_size() -> tf.Tensor:
return tf.cast(rescaled_image, dtype)


@tf.function
def read_image(filename: str, **kwargs) -> tf.Tensor:
stream = tf.io.read_file(filename)
return tf.image.decode_image(stream, **kwargs)


def show_images(images: list, **kwargs):
fig, axs = plt.subplots(1, len(images), figsize=(19, 10))
for image, ax in zip(images, axs):
Expand Down

0 comments on commit 837b164

Please sign in to comment.