只是给出一个完整的答案:
filename_queue = tf.train.string_input_producer(['/Users/HANEL/Desktop/tf.png']) # list of files to readreader = tf.WholeFileReader()key, value = reader.read(filename_queue)my_img = tf.image.depre_png(value) # use png or jpg deprer based on your files.init_op = tf.global_variables_initializer()with tf.Session() as sess: sess.run(init_op) # Start populating the filename queue. coord = tf.train.Coordinator() threads = tf.train.start_queue_runners(coord=coord) for i in range(1): #length of your filename list image = my_img.eval() #here is your image Tensor :) print(image.shape) Image.fromarray(np.asarray(image)).show() coord.request_stop() coord.join(threads)
或者,如果您有图像目录,则可以通过此Github源文件将其全部添加
@mttk和@ salvador-dali:我希望这是您需要的



