StyleRig: Rigging StyleGAN for 3D Control over Portrait Images(CVPR20 oral)

4. Semantic Rig Parameters

使用parametric face model对人脸建模based on a set of semantic control parameters p = ( α , β , δ , R , t ) ∈ R 257 \mathbf{p}=\left ( \alpha, \beta, \delta, \mathbf{R}, \mathbf{t} \right )\in \mathbb{R}^{257} p=(α,β,δ,R,t)R257,其中

  • facial shape α ∈ R 80 \alpha\in\mathbb{R}^{80} αR80
  • skin reflectance β ∈ R 80 \beta\in\mathbb{R}^{80} βR80
  • facial expression δ ∈ R 64 \delta\in\mathbb{R}^{64} δR64
  • scene illumination γ ∈ R 27 \gamma\in\mathbb{R}^{27} γR27
  • head rotation R ∈ S O ( 3 ) \mathbf{R}\in SO(3) RSO(3) S O ( 3 ) SO(3) SO(3)表示三维旋转群
  • translation t ∈ R 3 \mathbf{t}\in\mathbb{R}^3 tR3

文献[4](3DMM)中的200 scans of human faces,包含53k vertices,分别提取80个facial shape和skin reflectance的主成分

文中提到了表情基的计算方式,与文献[2, 6]有关,对a set of blendshapes进行PCA,每个主成分表示vertices的位移

scene illumination表示为three bands of spherical harmonics per color channel,在MOFA论文的解释更加详细

5. Training Corpus

StyleGAN中 w \mathbf{w} w空间的维度是 18 × 512 18\times512 18×512,首先采样200k个 w \mathbf{w} w,并生成对应的图像 I w = S t y l e G A N ( w ) \mathbf{I}_\mathbf{w} = StyleGAN(\mathbf{w}) Iw=StyleGAN(w)

既然都已经得到了 ( w , I w ) \left ( \mathbf{w}, \mathbf{I}_\mathbf{w} \right ) (w,Iw) pair,为什么作者还说 Each training sample is generated by combining up to 5 separately sampled latent vectors, similar to the mixing regularizer?
在这里插入图片描述

6. Network Architecture

Differentiable Face Reconstruction

整个框架中的一个组件叫做differentiable face reconstruction (DFR),包含一个parameter regressor F \mathcal{F} F和一个differentiable render layer R \mathcal{R} R

parameter regressor F \mathcal{F} F的作用是将latent code转换为parameters,记作 p = F ( w ) \mathbf{p}=\mathcal{F}(\mathbf{w}) p=F(w),具体结构为一个3层MLP

如何衡量预测的parameter是否准确,需要将 p \mathbf{p} p渲染成图像 R ( p ) \mathcal{R}(\mathbf{p}) R(p),与 I w \mathbf{I}_\mathbf{w} Iw进行比较,故有如下的rendering loss
L render ( I w , p ) = L photo ( I w , p ) + λ land L land ( I w , p ) ( 1 ) \mathcal{L}_\text{render}(\mathbf{I}_\mathbf{w}, \mathbf{p})=\mathcal{L}_\text{photo}(\mathbf{I}_\mathbf{w}, \mathbf{p})+\lambda_\text{land}\mathcal{L}_\text{land}(\mathbf{I}_\mathbf{w}, \mathbf{p}) \qquad(1) Lrender(Iw,p)=Lphoto(Iw,p)+λlandLland(Iw,p)(1)

其中,第1项称为dense photometric alignment loss:
L photo ( I w , p ) = ∥ M ⊙ ( I w − R ( p ) ) ∥ 2 2 ( 2 ) \mathcal{L}_\text{photo}(\mathbf{I}_\mathbf{w}, \mathbf{p})=\left \| \mathbf{M}\odot\left ( \mathbf{I}_\mathbf{w}-\mathcal{R}(\mathbf{p}) \right ) \right \|_2^2 \qquad(2) Lphoto(Iw,p)=M(IwR(p))22(2)
渲染方式采用point-based rendering,背景渲染不到,所以需要使用 M \mathbf{M} M来指示被渲染的区域

第2项称为sparse landmark loss:
L land ( I w , p ) = ∥ L I w − L M ∥ 2 2 ( 3 ) \mathcal{L}_\text{land}(\mathbf{I}_\mathbf{w}, \mathbf{p})=\left \| \mathbf{L}_{\mathbf{I}_\mathbf{w}}-\mathbf{L}_\mathbf{M} \right \|_2^2 \qquad(3) Lland(Iw,p)=LIwLM22(3)
L I w ∈ R 66 × 2 \mathbf{L}_{\mathbf{I}_\mathbf{w}}\in\mathbb{R}^{66\times2} LIwR66×2 I w \mathbf{I}_\mathbf{w} Iw上的62个关键点, L M \mathbf{L}_\mathbf{M} LM是由预测parameter -> 3D mesh -> 2D投影关键点

除此之外,其实还有第3项loss,没有明确写在公式(1)上,we also employ statistical regularization on the parameters of the face model, as done in MoFA

使用数据集 ( w , I w ) \left ( \mathbf{w}, \mathbf{I}_\mathbf{w} \right ) (w,Iw)就可以训练DFR,训练完成后就有了一个工具,将latent code翻译为parameter,Fig. 3展示了DFR的人脸重建效果

注:rendering loss体现了一种思想,就是 w \mathbf{w} w可以通过2条路径转换为图像(在Fig. 2中可以看到),一是由StyleGAN直接生成图像,二是先翻译为 p \mathbf{p} p,然后再渲染成图像,两幅生成的图像就可以衡量误差了
在这里插入图片描述
框架中的另一个组件就是本文的重点,RigNet

RigNet的作用是做信息的融合,有一个 w \mathbf{w} w,另外有一个 v \mathbf{v} v,可翻译为 p v \mathbf{p_v} pv,我们想要一个新的有head pose编辑效果的 w ^ \hat{\mathbf{w}} w^,那么就将 w \mathbf{w} w p v \mathbf{p_v} pv的head rotation分量送入RigNet,即可得到 w ^ \hat{\mathbf{w}} w^,记为 w ^ = R i g N e t ( w , p v ) \hat{\mathbf{w}}=RigNet\left ( \mathbf{w}, \mathbf{p_v} \right ) w^=RigNet(w,pv)

RigNet Encoder

输入一个 18 × 512 18\times512 18×512维的 w \mathbf{w} w,将它的维度降到32,得到 18 × 32 18\times32 18×32维的 l \mathbf{l} l,具体结构为18个独立的FC Layer

RigNet Decoder

输入为 l \mathbf{l} l p \mathbf{p} p(准确来说应该是 p \mathbf{p} p的若干个分量,如head rotation/expression/illumination),输出为 d \mathbf{d} d,再加上Encoder的输入 w \mathbf{w} w,构成残差结构 w ^ = d + w \hat{\mathbf{w}}=\mathbf{d}+\mathbf{w} w^=d+w,具体结构同样也是18个独立的FC Layer

7. Self-supervised Training

Our goal is to train RigNet such that we can inject a subset of parameters into a given latent code w \mathbf{w} w.

每一次前向传播涉及2个latent code ( w , v ) \left ( \mathbf{w},\mathbf{v} \right ) (w,v),于是可根据二者是否相等分为2种情况

(1) 当 w = v \mathbf{w}=\mathbf{v} w=v时,相当于自己注入自己的信息来做编辑,称为Reconstruction

我们有一个 w \mathbf{w} w,然后注入自己的parameter F ( w ) \mathcal{F}(\mathbf{w}) F(w),得到的结果应该与 w \mathbf{w} w相等,从而有如下的reconstruction loss
L rec = ∥ R i g N e t ( w , F ( w ) ) − w ∥ 2 2 \mathcal{L}_\text{rec}=\left \| RigNet\left ( \mathbf{w},\mathcal{F}(\mathbf{w}) \right )-\mathbf{w} \right \|_2^2 Lrec=RigNet(w,F(w))w22

(2) 当 w ≠ v \mathbf{w}\neq\mathbf{v} w=v时,可以做双向的编辑(把谁注入谁),这里以向 w \mathbf{w} w注入 v \mathbf{v} v的head rotation信息来做编辑为例

首先有 { w , p w , I w , } , { v , p v , I v } \left \{ \mathbf{w}, \mathbf{p_w}, \mathbf{I_w}, \right \}, \left \{ \mathbf{v}, \mathbf{p_v}, \mathbf{I_v} \right \} {w,pw,Iw,},{v,pv,Iv};向 w \mathbf{w} w中注入 p v \mathbf{p_v} pv的head rotation分量,得 w ^ = R i g N e t ( w , p v ) \hat{\mathbf{w}}=RigNet\left ( \mathbf{w}, \mathbf{p_v} \right ) w^=RigNet(w,pv);将 w ^ \hat{\mathbf{w}} w^翻译为 p ^ = F ( w ^ ) \hat{\mathbf{p}}=\mathcal{F}(\hat{\mathbf{w}}) p^=F(w^)

此时 p ^ \hat{\mathbf{p}} p^的head rotation分量应该与 p v \mathbf{p_v} pv的head rotation分量相等,于是可以做L2 Loss,但在文献[33]中已经证实了在parameter空间衡量误差的方法效果并不好(直观理解,过于严格了),所以还是需要渲染成图像才能衡量 p ^ \hat{\mathbf{p}} p^的好坏

我们的做法是,将 p ^ \hat{\mathbf{p}} p^的head rotation分量抽出来,覆盖到 p v \mathbf{p_v} pv上,得到新的 p v \mathbf{p_v} pv记作 p edit \mathbf{p}_\text{edit} pedit,于是可以复用衡量parameter好坏的公式(1),得到一项称为Cycle-Consistent Per-Pixel Editing Loss的损失
L edit = L render ( I v , p edit ) \mathcal{L}_\text{edit}=\mathcal{L}_\text{render}(\mathbf{I_v}, \mathbf{p}_\text{edit}) Ledit=Lrender(Iv,pedit)

另一方面,对于 p ^ \hat{\mathbf{p}} p^,如果我们关注非head rotation分量,应该与 p w \mathbf{p_w} pw的非head rotation相等才行,所以采用同样的做法,将 p ^ \hat{\mathbf{p}} p^的非head rotation分量抽出来,覆盖到 p w \mathbf{p_w} pw上,得到新的 p w \mathbf{p_w} pw记作 p consist \mathbf{p}_\text{consist} pconsist,于是有如下的Cycle-consistent Per-pixel Consistency Loss
L consist = L render ( I w , p consist ) \mathcal{L}_\text{consist}=\mathcal{L}_\text{render}(\mathbf{I_w}, \mathbf{p}_\text{consist}) Lconsist=Lrender(Iw,pconsist)

最终的损失函数为
L totcal = L rec + L edit + L consist \mathcal{L}_\text{totcal}=\mathcal{L}_\text{rec}+\mathcal{L}_\text{edit}+\mathcal{L}_\text{consist} Ltotcal=Lrec+Ledit+Lconsist
需要注意的是, L edit , L consist \mathcal{L}_\text{edit}, \mathcal{L}_\text{consist} Ledit,Lconsist是双向的编辑,并且本文并没有为每一个loss项赋予权重

小结:凡是做image editting,都要关注两个方面,一是注入信息的准确性(即要有属性编辑的效果),二是非注入信息的保留性(即其他属性不能更改),所以引申出了文中的2个consistency loss;另外,还需要考虑自己注入自己的特殊情况

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值