PD-GAN
PD-GAN: Probabilistic Diverse GAN for Image Inpainting (CVPR 2021) github.com/KumapowerLI…
Motivation
image inpainting 输出的结果应该是多样的。在需要被修复的hole中,越靠近边缘其确定性越强,越处于空洞中心的部分其多样性越强。采用GAN的框架,利用latent code对来影响孔洞内容,GAN的特性就是多样性,同时也保证了生成内容能够与上下文融为一体。
Method
整体框架图
coarse prediction
使用预训练好的Partial Convolutional encoder-decoder 粗略生成P
modulate latent code to image space
Input:coarse prediction 、mask image
模块:SPDNorm(hard、soft),修改传统的Spade Norm并设计了probabilistic diversity map来控制P的内容置信度
Hard SPDNorm
Hard SPDNorm中的Dh就是我们的hard probabilistic diversity map(不用学习的固定值的map), Dh是通过dilation operation去实现的,越往中心走数值越靠近0越往边界走则越靠进1,background区域的数值则为1,显式地控制生成内容多样性
Soft SPDNorm
网络应该是learnable,提出了软SPDNorm自适应地学习产生多种内容(prior information and the inpainting mask)的概率达到更好的效果修复的结果。
M为binary mask,Fp为P经过CNN后学习到的feature。之所以要学soft probabilistic diversity map,是因为Hard SPDNorm对于训练来说不够稳定,容易造成artifact,我们让网络自己学习一个调节机制帮助最后的结果生成的更加合理
Perceptual Diversity Loss
不同z隐码修复的图片差异性更大,衡量生成图片的多样性。
其中代表的是VGG的第i层feature,M代表binary mask。首先用VGG提取输出图像特征有利于防止最后输出往1或者-1两个极端值靠近,同时乘M可以保证只影响生成区域而不影响到背景区域
Whole Loss
In addition to the perceptual diversity loss, we follow the SPADE and utilize the reconstruction loss , feature matching loss and hinge adversarial loss
Experiments
- Datasets:Paris StreetView , CelebA-HQ , Places2