【发布时间】:2016-11-17 17:48:06
【问题描述】:
目前我正在为 Inception v3 提供测试:
image_data = tf.gfile.FastGFile(image_path, 'rb').read()
softmax_tensor = sess.graph.get_tensor_by_name('final_result:0')
predictions = sess.run(softmax_tensor, \
{'DecodeJpeg/contents:0': image_data})
但是我需要在将图像输入 CNN 之前对其进行裁剪,因此我使用了 imread 并裁剪了矩阵。 但如果我这样做,我不能将它用作 image_data,因为它需要一个 jpeg 二进制文件。
【问题讨论】:
-
快速解决方法应该是:裁剪您的垫子,将其以 jpeg 格式保存在临时文件夹中,然后读取新图像。我不知道 tensorflow,但我认为应该可以直接从内存中读取解码后的图像。
-
这就是我作为快速修复所做的,但它错过了通过将许多图像写入高清而将 tensorFlow 与 GPU 结合使用的全部要点。
标签: python opencv neural-network tensorflow