【问题标题】:Tensorboard tf.summary.image strange image colorsTensorboard tf.summary.image 奇怪的图像颜色
【发布时间】:2018-01-26 14:23:03
【问题描述】:

我正在使用以下方法将一系列 128x128 uint8 彩色图像加载到 Tensorflow:

x = tf.placeholder(tf.float32, shape=[None, img_size,img_size,num_channels], name='x-input')

我首先检查我正在加载的图像是否正常,所以我使用 Matplotlib 检查它(注意 Matplotlib 使用 BGR 颜色,所以我在显示之前修复它):

plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
plt.show()

我得到以下图像:

这是我所期望的。然后我加载到 Tensorboard:

tf.summary.image('input', x, 1)

但图像显示是:

图像还可以,但颜色都乱了。有什么想法会发生什么吗?

【问题讨论】:

    标签: python image-processing tensorflow tensorboard


    【解决方案1】:

    没关系,是 CV2.imread 导致了问题。 CV2 读取 BGR 而不是 RGB,因此加载不正确的图像和 Tensorflow 显示它们应该是正确的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-21
      • 1970-01-01
      • 1970-01-01
      • 2018-09-25
      • 2013-05-19
      • 2018-02-22
      • 1970-01-01
      相关资源
      最近更新 更多