项目场景:pytorch生成图像
描述:np数组保存图像,使用matplotlib
下面展示一些 代码片
。
import matplotlib
matplotlib.image.imsave('name.png', array)
#我的array是32*32*3
问题描述
疑惑:如果用PIL的话,会报错attributeerror: module 'pil.image' has no attribute 'formarray'
不建议使用,也可能是我使用姿势不对
from PIL import Image
im = Image.fromarray(A)
im.save("your_file.jpeg")
疑惑:如果用PIL直接将tensor转为图像也有点问题'
参考链接
感谢:https://blog.youkuaiyun.com/zhuoyuezai/article/details/79635120