Last active
November 27, 2018 15:07
-
-
Save ispamm/41e8cfa8386b481e44d81d43f5325966 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reads an image from a file, decodes it into a dense tensor, and resizes it | |
# to a fixed shape. | |
def _parse_function(filename, label): | |
image_string = tf.read_file(filename) | |
image_decoded = tf.image.decode_jpeg(image_string, channels=3) # Channels needed because some test images are b/w | |
image_resized = tf.image.resize_images(image_decoded, [40, 40]) | |
image_shape = tf.cast(tf.shape(image_decoded), tf.float32) | |
label = tf.concat([label[0:5] / image_shape[0], label[5:10] / image_shape[1], label[10:]], axis=0) | |
return {"x": image_resized}, label |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment