martinarjovsky / WassersteinGAN

BSD 3-Clause "New" or "Revised" License
3.2k stars 725 forks source link

convert the real images and generated images back to original format to display??? #33

Closed eriche2016 closed 7 years ago

eriche2016 commented 7 years ago

Hi, here when displaying the images , donot we need to convert back to the original images value range before storing them to disk.

LukasMosser commented 7 years ago

@eriche2016 I believe that happens in vutils.save_image

https://github.com/pytorch/vision/blob/master/torchvision/utils.py#L81

eriche2016 commented 7 years ago

@LukasMosser , hi, i notice that here the real image tensor Input has been normalized to Out by mean = [0.5, 0.5, 0.5] and std = [0.5, 0.5, 0.5], should the transformed value be converted back by using Out * 0.5 + 0.5 before storing back to the disk??

eriche2016 commented 7 years ago

Hi, i think we should converted back by inserting the line

real_cpu = real_cpu.mul(0.5).add(0.5) 

above here and

fake.data = fake.data.mul(0.5).add(0.5)

above here, otherwise, the generated images including the saved real images will not be good looking with some sharp weird edges.