Deep learning, how to save the tensor type vector (or matrix) generated by the network as a picture

As shown below: lateral_map_2 is a tensor type vector (prediction map) generated by the network, and now I want to convert it into a picture, and the personal test is effective.

		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)

Guess you like

Origin blog.csdn.net/weixin_44025103/article/details/131881855