python - tf.WholeFileReader() not reading -
my code seems find jpeg image perfectly, because if mess path not proceed, printed out return match_filenames_once , there correct list of image files. following code not seem load images queue. wrong filename_queue?
here code:
filename_queue = tf.train.string_input_producer( tf.train.match_filenames_once("./resized2/*.jpg"),shuffle=false) image_reader = tf.wholefilereader() myfilename, image_file = image_reader.read(filename_queue) image = tf.image.decode_jpeg(image_file) # start new session show example output. tf.session() sess: init_op = tf.global_variables_initializer(), tf.local_variables_initializer() sess.run(init_op) # start populating filename queue. coord = tf.train.coordinator() threads = tf.train.start_queue_runners(coord=coord) in range(1): #length of filename list image_tensor = image.eval() #here image tensor :) print(myfilename) print(image.shape) #image.fromarray(np.asarray(image_tensor)).show() coord.request_stop() coord.join(threads)
here output:
tensor("readerreadv2:0", shape=(), dtype=string) (?, ?, ?)
try print shape of image_tensor
print(image_tensor.shape)
image
in code tensor, , has unknown size, because come graph arbitrary jpeg image, , tf can't define it's size, when tf create graph. image_tensor
np.array
image loaded disk.
Comments
Post a Comment