I downloaded the code of ch5's test-input-image.jpg and tried to replicate the results shown at the bottom of the page, array([[[..., but I couldn't get it run.
import tensorflow as tf
import numpy as np
import Image
sess = tf.Session()
image_filename = "test-input-image.jpg"
loaded the image directly in the folder of the script
Clearly, the image was not read in properly, otherwise why shape=(?,?,?) after decode_jpeg. I also used the python code to display the input at the beginening to make sure the jpeg image was correctly read in, which is true.
I would appreciate it if someone could provide some insights what the problem could be.
Thanks in advance for your time.
I downloaded the code of ch5's test-input-image.jpg and tried to replicate the results shown at the bottom of the page, array([[[..., but I couldn't get it run.
import tensorflow as tf import numpy as np import Image sess = tf.Session() image_filename = "test-input-image.jpg"
loaded the image directly in the folder of the script
display images in python
img = Image.open(image_filename)
img.show()
display images in python
print image_filename filename_queue = tf.train.string_input_producer(tf.train.match_filenames_once(image_filename)) print filename_queue image_reader = tf.WholeFileReader() key,image_file = image_reader.read(filename_queue) print key print image_file image = tf.image.decode_jpeg(image_file) print image sess.run(tf.global_variables_initializer()) sess.run(image) print(sess.run(image)) and the results are <tensorflow.python.ops.data_flow_ops.FIFOQueue object at 0x7f555b882110> Tensor("ReaderRead:0", shape=(), dtype=string) Tensor("ReaderRead:1", shape=(), dtype=string) Tensor("DecodeJpeg:0", shape=(?, ?, ?), dtype=uint8)
Clearly, the image was not read in properly, otherwise why shape=(?,?,?) after decode_jpeg. I also used the python code to display the input at the beginening to make sure the jpeg image was correctly read in, which is true. I would appreciate it if someone could provide some insights what the problem could be. Thanks in advance for your time.