naoto0804 / pytorch-inpainting-with-partial-conv

Unofficial pytorch implementation of 'Image Inpainting for Irregular Holes Using Partial Convolutions' [Liu+, ECCV2018]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

why change mask before output computation?

joemathai opened this issue · comments

hi,
Thanks for the implementation. I want to know why you have decided to do this

mask_sum = output_mask.masked_fill_(no_update_holes, 1.0)
in your implementation when the original implementation details don't mention it.
http://masc.cs.gmu.edu/wiki/partialconv

Thank you for visiting this repository!
This is to assign pseudo value where output_mask == 0. Actually, the value 1.0 can be any value a except 0.0. Without that, zero division error will raise at the pixel where mask_sum == 0 in

output_pre = (output - output_bias) / mask_sum + output_bias

After that, we replace a with 0.0 again to keep correct value in
new_mask = new_mask.masked_fill_(no_update_holes, 0.0)

Thanks for the clarification.