leehomyc / Faster-High-Res-Neural-Inpainting

High-Resolution Image Inpainting using Multi-Scale Neural Patch Synthesis
http://www.harryyang.org/inpainting
MIT License
1.3k stars 213 forks source link

why are matrix values being changed here? #6

Closed coderTazz closed 7 years ago

coderTazz commented 7 years ago

Hi, I noticed that in run_content_network.lua, these two lines have been used:

    output[output:gt(1)]=1
    output[output:lt(-1)]=-1

I was wondering what is the reason behind this?

MarcoForte commented 7 years ago

That's just to clip the output values to between [-1, 1] for when the images are saved to a file. Otherwise the save to file will scale according to min and max values of output, which will result in incorrect color scaling of the image.

leehomyc commented 7 years ago

That's just to clip the output values to between [-1, 1] for when the images are saved to a file. Otherwise the save to file will scale according to min and max values of output, which will result in incorrect color scaling of the image.

Exactly