Zhaoyi-Yan / Shift-Net

Shift-Net: Image Inpainting via Deep Feature Rearrangement (ECCV, 2018)
http://openaccess.thecvf.com/content_ECCV_2018/papers/Zhaoyi_Yan_Shift-Net_Image_Inpainting_ECCV_2018_paper.pdf
MIT License
101 stars 17 forks source link

About maskModel weight #2

Open JinMengKang opened 6 years ago

JinMengKang commented 6 years ago

Why is the maskModel weight = 1/16? Like this -> netG.modules[41].weight:fill(1/16) (train.lua Line 152) Thank you for your patient answer.

Zhaoyi-Yan commented 6 years ago

Hi, in fact it is a trick to define the masked region in feature space. Always, the simplest way is directly resizing the mask. However, in fact the border of masked and unmasked region is blur as convolution makes information spread from outside into inside. As we use convolutions with 4*4 kernels. We process the mask with the similar operation(with 4*4 convs) as how we process the input image. So we need to fill them with '1/16'. In this case, if the window of the conv falls totally in the masked region, it gets '1' everywhere. If the window falls partly in the masked region, it gets a decimal number. A threshold is set to figure out the border.