Nonlinear 3D Face Morphable Model

Luan Tran, Xiaoming Liu

Introduction

3D Morphable Model (3DMM) is a statistical model of 3D facial shape and texture in a space where there are explicit correspondences . The morphable model framework provides two key benefits: first, a point-to-point correspondence between the reconstruction and all other models, enabling “morphing”, and second, modeling underlying transformations between types of faces (male to female, neutral to smile, etc.). 3DMM has been widely applied in numerous areas, such as computer vision , graphics , human behavioral analysis and craniofacial surgery .

3DMM is learnt through supervision by performing dimension reduction, normally Principal Component Analysis (PCA), on a training set of face images/scans. To model highly variable 3D face shapes, a large amount of high-quality 3D face scans is required. However, this requirement is expensive to fulfill. The first 3DMM was built from scans of 200200 subjects with a similar ethnicity/age group. They were also captured in well-controlled conditions, with only neutral expressions. Hence, it is fragile to large variances in the face identity. The widely used Basel Face Model (BFM) is also built with only 200200 subjects in neutral expressions. Lack of expression can be compensated using expression bases from FaceWarehouse or BD-3FE . After more than a decade, almost all models use less than 300300 training scans. Such a small training set is far from adequate to describe the full variability of human faces . Only recently, Booth et al. spent a significant effort to build 3DMM from scans of ∼10,000{\sim}10,000 subjects.

Second, the texture model of 3DMM is normally built with a small number of 2D face images co-captured with 3D scans, under well-controlled conditions. Therefore, such a model is only learnt to represent the facial texture in similar conditions, rather than in-the-wild environments. This substantially limits the application scenarios of 3DMM.

Finally, the representation power of 3DMM is limited by not only the size of training set but also its formulation. The facial variations are nonlinear in nature. E.g., the variations in different facial expressions or poses are nonlinear, which violates the linear assumption of PCA-based models. Thus, a PCA model is unable to interpret facial variations well. Given the barrier of 3DMM in its data, supervision and linear bases, this paper aims to revolutionize the paradigm of learning 3DMM by answering a fundamental question:

Whether and how can we learn a nonlinear 3D Morphable Model of face shape and texture from a set of unconstrained 2D face images, without collecting 3D face scans?

If the answer were yes, this would be in sharp contrast to the conventional 3DMM approach, and remedy all aforementioned limitations. Fortunately, we have developed approaches that offer positive answers to this question. Therefore, the core of this paper is regarding how to learn this new 3DMM, what is the representation power of the model, and what is the benefit of the model to facial analysis.

As shown in Fig. 1, starting with an observation that the linear 3DMM formulation is equivalent to a single layer network, using a deep network architecture naturally increases the model capacity. Hence, we utilize two network decoders, instead of two PCA spaces, as the shape and texture model components, respectively. With careful consideration of each component, we design different networks for shape and texture: the multi-layer perceptron (MLP) for shape and convolutional neural network (CNN) for texture. Each decoder will take a shape or texture representation as input and output the dense 3D face or a face texture. These two decoders are essentially the nonlinear 3DMM.

Further, we learn the fitting algorithm to our nonlinear 3DMM, which is formulated as a CNN encoder. The encoder takes a 2D face image as input and generates the shape and texture parameters, from which two decoders estimate the 3D face and texture. The 3D face and texture would perfectly reconstruct the input face, if the fitting algorithm and 3DMM are well learnt. Therefore, we design a differentiable rendering layer to generate a reconstructed face by fusing the 3D face, texture, and the camera projection parameters estimated by the encoder. Finally, the end-to-end learning scheme is constructed where the encoder and two decoders are learnt jointly to minimize the difference between the reconstructed face and the input face. Jointly learning the 3DMM and the model fitting encoder allows us to leverage the large collection of unconstrained 2D images without relying on 3D scans. We show significantly improved shape and texture representation power over the linear 3DMM. Consequently, this also benefits other tasks such as 2D face alignment and 3D reconstruction.

In this paper, we make the following contributions:

1) We learn a nonlinear 3DMM model that has greater representation power than its traditional linear counterpart.

2) We jointly learn the model and the model fitting algorithm via weak supervision, by leveraging a large collection of 2D images without 3D scans. The novel rendering layer enables the end-to-end training.

3) The new 3DMM further improves performance in related tasks: face alignment and face reconstruction.

Prior Work

Linear 3DMM. Since the original work by Blanz and Vetter , there has been a large amount of effort trying to improve 3DMM modeling mechanism. Paysan et al. use a Nonrigid Iterative Closest Point to directly align 3D scans as an alternative to the UV space alignment method in . Vlasic et al. use a multilinear model to model the combined effect of identity and expression variation on the facial shape. Later, Bolkart and Wuhrer show how such a multilinear model can be estimated directly from the 3D scans using a joint optimization over the model parameters and groupwise registration of 3D scans.

Improving Linear 3DMM. With PCA bases, the statistical distribution underlying 3DMM is Gaussian. Koppen et al. argue that single-mode Gaussian can’t represent real-world distribution. They introduce the Gaussian Mixture 3DMM that models the global population as a mixture of Gaussian subpopulations, each with its own mean, but shared covariance. Booth el al. aim to improve texture of 3DMM to go beyond controlled settings by learning “in-the-wild” feature-based texture model. However, both works are still based on statistical PCA bases. Duong et al. address the problem of linearity in face modeling by using Deep Boltzmann Machines. However, they only work with 2D face and sparse landmarks; and hence cannot handle faces with large-pose variations or occlusion well.

2D Face Alignment. 2D Face Alignment can be cast as a regression problem where 2D landmark locations are regressed directly . For large-pose or occluded faces, strong priors of 3DMM face shape have been shown to be beneficial. Hence, there is increasing attention in conducting face alignment by fitting a 3D face model to a single 2D image . Among the prior works, iterative approaches with cascades of regressors tend to be preferred. At each cascade, it can be a single or even two regressors . In contrast to aforementioned works that use a fixed 3DMM model, our model and model fitting are learned jointly. This results in a more powerful model: a single-pass encoder, which is learnt jointly with the model, achieves state-of-the-art face alignment performance on AFLW2000 benchmark dataset.

3D Face Reconstruction. 3DMM also demonstrates its strength in face reconstruction. Since with a single image, present information about the surface is limited; 3D face reconstruction must rely on prior knowledge like 3DMM . Besides 3DMM fitting methods , recently, Richardson et al. design a refinement network that adds facial details on top of the 3DMM-based geometry. However, this approach can only learn 2.5D depth map, which loses the correspondence property of 3DMM. The recent work of Tewari et al. reconstruct a 3D face by an elegant encoder-decoder network . While their ability to decompose lighting with reflectance is satisfactory, our work has a different objective of learning a nonlinear 3DMM.

Proposed Method

The 3D Morphable Model (3DMM) and its 2D counterpart, Active Appearance Model , provide parametric models for synthesizing faces, where faces are modeled using two components: shape and texture. In , Blanz et al. propose to describe the 3D face space with PCA:

The 3DMM can be used to synthesize novel views of the face. Firstly, a 3D face is projected onto the image plane with the weak perspective projection model:

where g(α,m)g(\alpha,\mathbf{m}) is the model construction and projection function leading to the 2D positions V\mathbf{V} of 3D vertices, ff is the scale factor, Pr=[100010]\mathbf{Pr}=\begin{bmatrix}1&0&0\\ 0&1&0\end{bmatrix} is the orthographic projection matrix, R\mathbf{R} is the rotation matrix constructed from three rotation angles pitch, yaw, roll, and t2d\mathbf{t}_{2d} is the translation vector. While the projection matrix MM has dimensions 2×42\times 4, it has six degrees of freedom, which is parameterized by a 66-dim vector m\mathbf{m}. Then, the 2D image is rendered using texture and an illumination model as described in .

2 Nonlinear 3DMM

As mentioned in Sec. 1, the linear 3DMM has the problems such as requiring 3D face scans for supervised learning, unable to leverage massive unconstrained face images for learning, and the limited representation power due to the linear bases. We propose to learn a nonlinear 3DMM model using only large-scale in-the-wild 2D face images.

In linear 3DMM, the factorization of each components (texture, shape) can be seen as a matrix multiplication between coefficients and bases. From a neural network’s perspective, this can be viewed as a shallow network with only one fully connected layer and no activation function. Naturally, to increase the model’s representative power, the shallow network can be extended to a deep architecture. In this work, we design a novel learning scheme to learn a deep 3DMM and its inference (or fitting) algorithm.

Specifically, as shown in Fig. 2, we use two deep networks to decode the shape, texture parameters into the 3D facial shape and texture respectively. To make the framework end-to-end trainable, these parameters are estimated by an encoder network, which is essentially the fitting algorithm of our 3DMM. Three deep networks join forces for the ultimate goal of reconstructing the input face image, with the assistance of a geometry-based rendering layer.

where R(m,S,T)\mathcal{R}(\mathbf{m},\mathbf{S},\mathbf{T}) is the rendering layer (Sec. 3.2.3).

2.2 Shape & Texture Representation

Fig. 3 illustrates three possible texture representations. Texture is defined per vertex in the linear 3DMM and recent work such as (Fig. 3(a)). There is a texture intensity value corresponding to each vertex in the face mesh. Since 3D vertices are not defined on a 2D grid, this representation will be parameterized as a vector, which not only loses the spatial relation of vertices, but also prevents it from leveraging the convenience of deploying CNN on 2D imagery. In contrast, given the rapid progress in image synthesis, it is desirable to choose a 2D image, e.g., a frontal-view face image in Fig. 3(b), as a texture representation. However, frontal faces contain little information of two sides, which would lose much texture information for side-view faces.

In light of these considerations, we use an unwrapped 2D texture as our texture representation (Fig. 3(c)). Specifically, each 3D vertex vS\mathbf{v}_{S} is projected onto the UV space using cylindrical unwarp. Assuming that the face mesh has the top pointing up the yy axis, the projection of vS=(x,y,z)\mathbf{v}_{S}=(x,y,z) onto the UV space vT=(u,v)\mathbf{v}_{T}=(u,v) is computed as:

where α1,α2,β1,β2\alpha_{1},\alpha_{2},\beta_{1},\beta_{2} are constant scale and translation scalars to place the unwrapped face into the image boundaries. Also, the texture decoder DTD_{T} is a CNN constructed by fractionally-strided convolution layers.

2.3 In-Network Face Rendering

To reconstruct a face image from the texture T\mathbf{T}, shape S\mathbf{S}, and projection parameter m\mathbf{m}, we define a rendering layer R(m,S,T)\mathcal{R}(\mathbf{m},\mathbf{S},\mathbf{T}). This is accomplished in three steps. Firstly, the texture value of each vertex in S\mathbf{S} is determined by its predefined location in the 2D texture T\mathbf{T}. Usually, it involves sub-pixel sampling via a bilinear sampling kernel: TS(vS)= ⁣ ⁣ ⁣∑u′∈{⌊u⌋,⌈u⌉}v′∈{⌊v⌋,⌈v⌉} ⁣ ⁣ ⁣T(u′,v′)(1−∣u−u′∣)(1−∣v−v′∣),\displaystyle\mathbf{T}_{S}(\mathbf{v}_{S})=\!\!\!\sum_{\begin{subarray}{c}u^{\prime}\in\{\lfloor u\rfloor,\lceil u\rceil\}\\ v^{\prime}\in\{\lfloor v\rfloor,\lceil v\rceil\}\end{subarray}}\!\!\!\mathbf{T}(u^{\prime},v^{\prime})(1{-}|u{-}u^{\prime}|)(1{-}|v{-}v^{\prime}|), (6) where vT=(u,v)\mathbf{v}_{T}=(u,v) is the UV space projection of vS\mathbf{v}_{S} via Eqn. 5. Secondly, the 3D shape/mesh S\mathbf{S} is projected to the image plane via Eqn. 3. Finally, the 3D mesh is then rendered using a Z-buffer renderer, where each pixel is associated with a single triangle of the mesh,

where Φ(g,m,n)={vS(1),vS(2),vS(3)}\Phi(g,m,n)=\{\mathbf{v}_{S}^{(1)},\mathbf{v}_{S}^{(2)},\mathbf{v}_{S}^{(3)}\} is an operation returning three vertices of the triangle that encloses the pixel (m,n)(m,n) after projection gg. In order to handle occlusions, when a single pixel resides in more than one triangle, the triangle that is closest to the image plane is selected. The value of each pixel is determined by interpolating the intensity of the mesh vertices via barycentric coordinates {λ(i)}i=13\{\lambda^{(i)}\}_{i=1}^{3}.

There are alternative designs to our rendering layer. If the texture representation is defined per vertex, as in Fig. 3(a), one may warp the input image Ii\mathbf{I}_{i} onto the vertex space of the 3D shape S\mathbf{S}, whose distance to the per-vertex texture representation can form a reconstruction loss. This design is adopted by the recent work of . In comparison, our rendered image is defined on a 2D grid while the alternative is on top of the 3D mesh. As a result, our rendered image can enjoy the convenience of applying the adversarial loss, which is shown to be critical in improving the quality of synthetic texture. Another design for rendering layer is image warping based on the spline interpolation, as in . However, this warping is continuous: every pixel in the input will map to the output. Hence this warping operation fails in the occlusion part. As a result, Cole et al. limit their scope to only synthesizing frontal faces by warping from normalized faces. Our rendering layer implementation is publicly available at https://github.com/tranluan/Nonlinear_Face_3DMM.

2.4 Network Architecture

We design our E,DTE,D_{T} network architecture as in Tab. 1. Also, DSD_{S} includes two fully connected layers with 1,0001,000-dim intermediate representation with eLU activation.

The entire network is end-to-end trained to reconstruct the input images, with the loss function:

where the reconstruction loss Lrec=∑i=1N∣∣I^i−Ii∣∣1L_{\text{rec}}=\sum_{i=1}^{N}||\mathbf{\hat{I}}_{i}-\mathbf{I}_{i}||_{1} enforces the rendered image I^i\mathbf{\hat{I}}_{i} to be similar to the input Ii\mathbf{I}_{i}, the adversarial loss LadvL_{\text{adv}} favors realistic rendering, and the landmark loss LLL_{L} enforces geometry constraint.

Adversarial Loss. Based on the principal of Generative Adversarial Network (GAN) , the adversarial loss is widely used to synthesize photo-realistic images , where the generator and discriminator are trained alternatively. In our case, networks that generate the rendered image I^i\mathbf{\hat{I}}_{i} is the generator. The discriminator includes a dedicated network DAD_{A}, which aims to distinguish between the real face image Ii\mathbf{I}_{i} and rendered image I^i\mathbf{\hat{I}}_{i}. During the training of the generator, the texture model DTD_{T} will be updated with the objective that I^i\mathbf{\hat{I}}_{i} is being classified as real faces by DAD_{A}. Since our face rendering already creates correct global structure of the face image, the global image-based adversarial loss may not be effective in producing high-quality textures on local facial regions. Therefore, we employ patchGAN in our discriminator. Here, DAD_{A} is a CNN consisting of four 3×33\times 3 conv layers with stride of 22, and number of filters are 3232, 6464, 128128 and 11, respectively. Finally, one of key reasons we are able to employ adversarial loss is that we are rendering in the 2D image space, rather than the 3D vertices space or unwrapped texture space. This shows the necessity and importance of our rendering layer.

Semi-Supervised Pre-Training. Fully unsupervised training using only the mentioned reconstruction and adversarial loss on the rendered image could lead to a degenerate solution, since the initial estimation is far from ideal to render meaningful images. Hence, we introduce pre-training loss functions to guide the training in the early iterations.

With face profiling technique, Zhu et al. expands the 300W dataset into 122,450122,450 images with the fitted 3DMM shape S~\widetilde{\mathbf{S}} and projection parameters m~\widetilde{\mathbf{m}}. Given S~\widetilde{\mathbf{S}} and m~\widetilde{\mathbf{m}}, we create the pseudo groundtruth texture T~\widetilde{\mathbf{T}} by referring every pixel in the UV space back to the input image, i.e., backward of our rendering layer. With m~\widetilde{\mathbf{m}}, S~\widetilde{\mathbf{S}}, T~\widetilde{\mathbf{T}}, we define our pre-training loss by:

Due to the pseudo groundtruth, using L0L_{0} may run into the risk that our solution learns to mimic the linear model. Thus, we switch to the loss of Eqn. 8 after L0L_{0} converges.

Sparse Landmark Alignment. To help DTD_{T} to better learn the facial shape, the landmark loss can be an auxiliary task.

Experimental Results

The experiments study three aspects of the proposed nonlinear 3DMM, in terms of its expressiveness, representation power, and applications to facial analysis. Using facial mesh triangle definition by Basel Face Model (BFM) , we train our 3DMM using 300W-LP dataset . The model is optimized using Adam optimizer with an initial learning rate of 0.0010.001 when minimizing L0L_{0}, and 0.00020.0002 when minimizing LL. We set the following parameters: Q=53,215Q=53,215, U=V=128U=V=128, lS=lT=160l_{S}=l_{T}=160. λ\lambda values are set to make losses to have similar magnitudes.

Exploring feature space. We use the entire CelebA dataset with ∼200{\sim}200k images to feed to our network to obtain the empirical distribution of our shape and texture parameters. By varying the mean parameter along each dimension proportional to their standard deviations, we can get a sense how each element contributes to the final shape and texture. We sort elements in the shape parameter fS\mathbf{f}_{S} based on their differences to the mean 3D shape. Fig. 5 shows four examples of shape changes, whose differences rank No.11, 4040, 8080, and 120120 among 160160 elements. Most of top changes are expression related. Similarly, in Fig. 6, we visualize different texture changes by adjusting only one element of fT\mathbf{f}_{T} off the mean parameter fˉT\bar{\mathbf{f}}_{T}. The elements with the same 44 ranks as the shape counterpart are selected.

Attribute Embedding. To better understand different shape and texture instances embedded in our two decoders, we dig into their attribute meaning. For a given attribute, e.g., male, we feed images with that attribute {Ii}i=1n\{\mathbf{I}_{i}\}_{i=1}^{n} into our encoder to obtain two sets of parameters {fSi}i=1n\{\mathbf{f}_{S}^{i}\}_{i=1}^{n} and {fTi}i=1n\{\mathbf{f}_{T}^{i}\}_{i=1}^{n}. These sets represent corresponding empirical distributions of the data in the low dimensional spaces. By computing the mean parameters fˉS,fˉT\mathbf{\bar{f}}_{S},\mathbf{\bar{f}}_{T}, and feed into their respective decoders, we can reconstruct the mean shape and texture with that attribute. Fig. 7 visualizes the reconstructed shape and texture related to some attributes. Differences among attributes present in both shape and texture.

2 Representation Power

Texture. Given a face image, assuming we know the groundtruth shape and projection parameters, we can unwarp the texture into the UV space, as we generate “pseudo groundtruth” texture in the weakly supervised step. With the groundtruth texture, by using gradient descent, we can estimate a texture parameter fT\mathbf{f}_{T} whose decoded texture matches with the groundtruth. Alternatively, we can minimize the reconstruction error in the image space, through the rendering layer with the groundtruth S\mathbf{S} and m\mathbf{m}. Empirically, the two methods give similar performances but we choose the first option as it involves only one warping step, instead of rendering in every optimization iteration. For the linear model, we use the fitting results of Basel texture and Phong illumination model given by . As in Fig. 8, our nonlinear texture is closer to the groundtruth than the linear model, especially for in-the-wild images (the first two rows). This is expected since the linear model is trained with controlled images. Quantitatively, our nonlinear model has significantly lower L1L_{1} reconstruction error than the linear model (0.0660.066 vs. 0.1030.103, as in Tab. 2).

3D Shape. We also compare the power of nonlinear and linear 3DMM in representing real-world 3D scans. We compare with BFM , the most commonly used 3DMM at present. We use ten 3D face scans provided by , which are not included in the training set of BFM. As these face meshes are already registered using the same triangle definition with BFM, no registration is necessary. Given the groundtruth shape, by using gradient descent, we can estimate a shape parameter whose decoded shape matches the groundtruth. We define matching criteria on both vertex distances and surface normal direction. This empirically improves fidelity of final results compared to only optimizing vertex distances. Also, to emphasize the compactness of nonlinear models, we train different models with different latent space sizes. Fig. 9 shows the visual quality of two models’ reconstructions. As we can see, our reconstructions closely match the face shapes. Meanwhile the linear model struggles with face shapes outside its PCA span.

To quantify the difference, we use NME, averaged per-vertex errors between the recovered and groundtruth shapes, normalized by inter-ocular distances. Our nonlinear model has a significantly smaller reconstruction error than the linear model, 0.01960.0196 vs. 0.02410.0241 (Tab. 3). Also, the non-linear models are more compact. They can achieve similar performances as linear models whose latent space’s sizes doubled.

3 Applications

Having shown the capability of our nonlinear 3DMM (i.e., two decoders), now we demonstrate the applications of our entire network, which has the additional encoder. Many applications of 3DMM are centered on its ability to fit to 2D face images. Fig. 10 visualizes our 3DMM fitting results on CelebA dataset. Our encoder estimates the shape S\mathbf{S}, texture T\mathbf{T} as well as projection parameter m\mathbf{m}. We can recover personal facial characteristic in both shape and texture. Our texture can have variety skin color or facial hair, which is normally hard to be recovered by linear 3DMM.

2D Face Alignment. Face alignment is a critical step for any facial analysis task such as face recognition. With enhancement in the modeling, we hope to improve this task (Fig. 11). We compare face alignment performance with state-of-the-art methods, SDM and 3DDFA , on the AFLW2000 dataset. The alignment accuracy is evaluated by the Normalized Mean Error (NME), the average of visible landmark error normalized by the bounding box size. Here, current state-of-the-art 3DDFA is a cascade of CNNs that iteratively refines its estimation in multiple steps, meanwhile ours is a single-pass of EE and DSD_{S}. However, by jointly learning model fitting with 3DMM, our network can surpass ’s performance, as in Tab. 4. Another perspective is that in conventional 3DMM fitting , the texture is used as the input to regress the shape parameter, while ours adopts an analysis-by-synthesis scheme and texture is the output of the synthesis. Further, for a more fair comparison of nonlinear vs. linear models, we train an encoder with the same architecture as our EE, whose output parameter will multiple with the linear shape bases A\mathbf{A}, and train with the landmark loss function (Eqn. 13). Again we observe the higher error from the linear model-based fitting.

3D Face Reconstruction. We compare our approach to recent works: the CNN-based iterative supervised regressor of Richardson et al. and unsupervised regressor method of Tewari et al. . The work by Tewari et al. is relevant to us as they also learn to fit 3DMM in an unsupervised fashion. However, they are limited to linear 3DMM bases, which of course are not jointly trained with the model. Also, we only compare with the coarse network in as their refinement network use SfS, which leads to a 2.5D representation and loses correspondence between different 3D shapes. This is orthogonal to our approach. Fig. 12 shows visual comparison. Following the same setting in , we also quantitatively compare our method with prior works on 99 subjects of FaceWarehouse database (Fig. 13). We achieve on-par results with Garrido et al. , an offline optimization method, while surpassing all other regression methods .

4 Ablation on Texture Learning

With great representation power, we would like to learn a realistic texture model from in-the-wild images. The rendering layer opens a possibility to apply adversarial loss in addition to global L1L_{1} loss. Using a global image-based discriminator is redundant as the global structure is guaranteed by the rendering layer. Also, we empirically find that using global image-based discriminator can cause severe artifacts in the resultant texture. Fig. 14 visualizes outputs of our network with different options of adversarial loss. Clearly, patchGAN offers higher realism and fewer artifacts.

Conclusions

Since its debut in 1999, 3DMM has became a cornerstone of facial analysis research with applications to many problems. Despite its impact, it has drawbacks in requiring training data of 3D scans, learning from controlled 2D images, and limited representation power due to linear bases. These drawbacks could be formidable when fitting 3DMM to unconstrained faces, or learning 3DMM for generic objects such as shoes. This paper demonstrates that there exists an alternative approach to 3DMM learning, where a nonlinear 3DMM can be learned from a large set of unconstrained face images without collecting 3D face scans. Further, the model fitting algorithm can be learnt jointly with 3DMM, in an end-to-end fashion.

Our experiments cover a diverse aspects of our learnt model, some of which might need the subjective judgment of the readers. We hope that both the judgment and quantitative results could be viewed under the context that, unlike linear 3DMM, no genuine 3D scans are used in our learning. Finally, we believe that unsupervisedly learning 3D models from large-scale in-the-wild 2D images is one promising research direction. This work is one step along this direction.

References