mahmoudnafifi / HistoGAN

Reference code for the paper HistoGAN: Controlling Colors of GAN-Generated and Real Images via Color Histograms (CVPR 2021).
MIT License
267 stars 27 forks source link

Normalize image #18

Closed yxh6825123 closed 2 years ago

yxh6825123 commented 2 years ago

Hello, The input image seems have no noralized to [0,1] in histoGAN.py, but RGBuvHistBlock clamp the input into [0,1].

mahmoudnafifi commented 2 years ago

Thanks for catching this. It looks i did this clamping when i was polishing the code and didn’t notice this issue.

If you can create a PR to fix this issue that would be great.

mahmoudnafifi commented 2 years ago

I checked the code again. Unfortunately, I don't have the environment setup in my current device to test. But, I couldn't catch where the input is not normalized? All inputs should go through the transform function which implicitly normalize images to 0-1 range. Please let me know where exactly you find the (0-255) images to check again.

yxh6825123 commented 2 years ago

Sorry to reply this late, I checked this code again, I find that I ignore the totensor() function will normalize images to 0-1, so there is no more issures, I will close this.