注意img为pytorch-tensor,取值范围0-1

from PIL import Image
def save_img(img,img_path):
    image = (img * 255).numpy().astype(np.uint8)
    img = Image.fromarray(image, mode='L') 
    img.save(img_path)
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐