Skip to content

Commit

Permalink
Fixed decoding based on tf bug tensorflow/tensorflow#9356.
Browse files Browse the repository at this point in the history
  • Loading branch information
dcunhas committed Nov 3, 2017
1 parent 167764c commit c73ffcc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion TFReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ def __init__(self, records_list, image_options={}, batch_size=1):
self.dataset = self.dataset.repeat()

def _input_parser(self, image_filename, name, annotation_filename=None):
image = tf.image.decode_image(tf.read_file(image_filename))
#Based on https://github.com/tensorflow/tensorflow/issues/9356, decode_jpeg and decode_png both decode both formats
#This is a workaround because decode_image does not return a static size, which breaks resize_images
image = tf.image.decode_jpeg(tf.read_file(image_filename))
if self.image_options.get("resize", False):
image = tf.image.resize_images(image, (self.image_options["resize_size"], self.image_options["resize_size"]))
annotation = None
Expand Down

0 comments on commit c73ffcc

Please sign in to comment.