Torchvision.utils.save_image() error?

I’m trying to save images that are read through torchvision.datasets.ImageFolder(). But if I save with only image tensor and filename arguments, it saves normalized images. And if I try to save with additional arguments like normalize=True, it returns Typeerror. Below is my code and error. How can I save images without normalization?

Do you want to save the original pictures?
the transform ToTensor return tensor that range from (0,1)
while save_image accept tensor range(-1,1)
so

image.sub_(0.5).div_(0.5) 
tv.utils.save_image(image,'image1.jpg')
1 Like

thank you so much :slight_smile:

But why is the argument “normalize” is not working?

I think maybe you should update your torchvision.

1 Like