【发布时间】:2021-11-23 06:51:17
【问题描述】:
我有一些用于 tensorflow 数据集的代码。 它以前工作得很好,它可能仍然有效。但我不这么认为
img = parse_image(img_paths[0])
img = tf.image.resize(img, [224, 224])
plt.imshow(img)
只输出一个空白的224x224 画布。
img = parse_image(img_paths[0])
plt.imshow(img)
正确输出图像。
img_paths 是带有路径名的字符串列表
我试过了:
img = parse_image(img_paths[0])
img = tf.image.resize([img], [224, 224])
plt.imshow(img[0])
和
img = parse_image(img_paths[0])
img = tf.image.resize(img, [224, 224])
plt.imshow(img.numpy())
和
img = parse_image(img_paths[0])
img = tf.image.resize([img], [224, 224])
plt.imshow(img.numpy()[0])
形状是正确的,这段代码以前也有效。 并且可能仍然有效,我想我可能无法正确使用它了(我写它已经有一段时间了)。
感谢您提供的任何提示或想法?当然还有解决方案;-)
【问题讨论】:
标签: python tensorflow matplotlib image-processing tensorflow-datasets