深度学习,如何将网络生成的tensor类型的向量(或矩阵)保存为图片

如下所示:lateral_map_2 是网络生成的tensor类型向量(预测图),现在想将其转换为图片,亲测有效。

		from torchvision.utils import save_image
		res = lateral_map_2 # [1,1,352,352]
        # res = res * 255
        res.cuda()
        tensor_float = res.float()
        img = tensor_float[0]
        # (图片,存放图片的路径)
        save_image(img, opt.save_path + name)

猜你喜欢

转载自blog.csdn.net/weixin_44025103/article/details/131881855
今日推荐