python - tf return Invalid JPEG data, size 1100 -
i new in tensor flow , trying feed jpg images tensorflow return error.
this code:
import tensorflow tf filename_queue = tf.train.string_input_producer(['d-maiz-bueno/lista']) reader = tf.wholefilereader() key, value = reader.read(filename_queue) my_img = tf.image.decode_jpeg(value,channels=0) # jpg decoder init_op = tf.initialize_all_variables() tf.session() sess: sess.run(init_op) coord = tf.train.coordinator() threads = tf.train.start_queue_runners(coord=coord) in range(50): #length of filename list image = my_img.eval() #here image tensor :) # print(image.shape) # image.show(image.fromarray(np.asarray(image))) # # coord.request_stop() # coord.join(threads)
the images in d-maiz-bueno/lista , lista list jpg images. images jpg 640x480 pixels size 24.2kb
the error is:
tensorflow.python.framework.errors.invalidargumenterror: invalid jpeg data, size 1100 [[node: decodejpeg = decodejpegacceptable_fraction=1, channels=0, fancy_upscaling=true, ratio=1, try_recover_truncated=false, _device="/job:localhost/replica:0/task:0/cpu:0"]] caused op 'decodejpeg', defined at:
you have feed list of filenames queue. so, instance,
with open('d-maiz-bueno/lista', 'r') f: filename_list = f.read().splitlines() filename_queue = tf.train.string_input_producer(filename_list)
Comments
Post a Comment