张量流队列中的预处理图像

时间:2016-08-07 19:07:16

标签: python image machine-learning queue tensorflow

我在tensorflow队列中加载了多个jpeg图像。图像文件都是不同的维度,所以我使用wholefileReader()来读取我的图像文件。我想调整大小并通过prep_image函数裁剪image_file,但无法弄清楚如何做到这一点。 此外,如何通过队列运行器获取输入批处理并处理所有批处理并在其上运行我的分类器。

filename_queue = tf.train.string_input_producer(tf.train.match_filenames_once("path_to_image_files"))

image_reader = tf.WholeFileReader()

_, image_file = image_reader.read(filename_queue)

image = tf.image.decode_jpeg(image_file)
image = prep_image(image)

with tf.Session() as sess:
tf.initialize_all_variables().run()
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(coord=coord)
image_ = sess.run([image])
print(type(image_))
print image_
image1 = prep_image(image_)
coord.request_stop()
coord.join(threads)

0 个答案:

没有答案
相关问题