创新点:
①训练一个生成高质量人脸的GAN网络,然后放到U型结构的解码侧,再通过低分辨率图像输入U型结构中进行微调(以前的工作没有微调,指pixel2style2pixel)。
②以前的工作没有解决背景复杂情况下的问题
BFR(Blind face restoration)是一个典型的不适定反问题(ill-posed inverse problem)。
well-posed:解存在唯一以及稳定
反问题:已知y求x(已知模糊图像求原图)
动机和框架
以往的DNN方法是给x求一个y,而在不适定问题中y不是唯一的,因此产生的y通常是y空间中的一个均值,而这个值过度平滑而且丢失很多细节。

本文的方法将x通过CNN编码器映射到潜在空间中的z(对应SytleGAN的从w到z),然后GAN网络再输出图像y。
结构

整体结构就是CNN跟StyleGAN2的结合。z经过Mapping网络之后生成的w被广播到每个GAN Block中。
损失函数
①La对抗性损失(X是ground-truth,X~是LQ图像)

②Lc是内容损失,是生成图和ground-truth之间的L1范数
③Lf是感知损失,感知网络不用VGG而是判别器

最后总损失

CODE
主体结构
class FullGenerator(nn.Module):
...
def forward(self,
inputs,
return_latents=False,
inject_index=None,
truncation=1,
truncation_latent=None,
input_is_latent=False,
):
noise = []
# 首先进入卷积层,层数为log(size)
for i in range(self.log_size-1):
ecd = getattr(self, self.names[i])
inputs = ecd(inputs)
noise.append(inputs)
#print(inputs.shape)
inputs = inputs.view(inputs.shape[0], -1)
# 进入FC层提取特征
outs = self.final_linear(inputs)
#print(outs.shape)
# 把列表重复多次,也就是广播噪声
noise = list(itertools.chain.from_iterable(itertools.repeat(x, 2) for x in noise))[::-1]
# 进入StyleGAN2网络
outs = self.generator([outs], return_latents, inject_index, truncation, truncation_latent, input_is_latent, noise=noise[1:])
return outs

