小编Chr*_*ant的帖子

如何将张量写入 PNG 图像文件?

我正在尝试将具有以下属性的张量写入 PNG 文件。

type(adv_x) 
<class 'tensorflow.python.framework.ops.EagerTensor'>

adv_x.shape
(1, 600, 800, 3)

tf.rank(adv_x) 
tf.Tensor(4, shape=(), dtype=int32)
Run Code Online (Sandbox Code Playgroud)

我知道如何将张量显示为图像 ( plt.imshow(adv_x[0])),但我想将其写入文件,以便最终得到 600 x 800 像素的 RGB .PNG 文件。

提前致谢。

image machine-learning tensorflow

2
推荐指数
2
解决办法
3774
查看次数

标签 统计

image ×1

machine-learning ×1

tensorflow ×1