import tensorflow as tf
import os
def read_image_data():
dirname, filename = os.path.split(os.path.abspath(__file__))
#Create a list of filenames (for whaledata they are jpegs)
filenames = ['/data_dir/w_7489.jpg']
#Create a queue that produces the filenames to read
filename_queue = tf.train.string_input_producer(filenames)
#Create a reader for the filequeue
reader = tf.WholeFileReader()
#Read in the files
key, value = reader.read(filename_queue)
#Convert the Tensor(of type string) to representing the Tensor of type uint8
# and shape [height, width, channels] representing the images
images = tf.image.decode_jpeg(value, channels=3)
#convert images to floats and attach image summary
float_images = tf.cast(images, tf.float32)
tf.image_summary('images', float_images)
#Create session
sess = tf.Session()
summary_op = tf.merge_all_summaries()
tf.initialize_all_variables()
#Write summary
summary_writer = tf.train.SummaryWriter(dirname+'/log/', graph_def=sess.graph_def)
summary_str = sess.run(summary_op)
summary_writer.add_summary(summary_str)
#Close session
sess.close()
def main(argv=None):
read_image_data()
return 0
if __name__ == '__main__':
tf.app.run()
When I execute this code the following happens:1) The /log/ directory and an event file called events.out.tfevents.1447627799.Durhams-MacBook-Pro.local is created2) The program never finishes execution (I need to kill -9 <pid> it)Any insight into solving this would be great.Additionally it would be great if someone can tell me how to handle cases where the jpegs I need to read in do not have the same dimensions.
--
You received this message because you are subscribed to the Google Groups "Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss+u...@tensorflow.org.
To post to this group, send email to dis...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/discuss/126e2ffe-e6d8-4e55-b2d9-09717d6569f9%40tensorflow.org.
--
You received this message because you are subscribed to a topic in the Google Groups "Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/a/tensorflow.org/d/topic/discuss/ik7hSLIKEBM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to discuss+u...@tensorflow.org.
To post to this group, send email to dis...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/discuss/71ce2932-dfe6-458a-8c29-d3d989b66bd8%40tensorflow.org.