{'fraction_non_alphanumeric': 0.02012562948200082, 'fraction_numerical': 0.00886168300798975, 'mean_word_length': 4.708858187728565, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Synthesizing facial photometries and corresponding geometries using generative adversarial networks

Artificial data synthesis is currently a well studied topic with useful applications in data science, computer vision, graphics and many other fields. Generating realistic data is especially challenging since human perception is highly sensitive to non realistic appearance. In recent times, new levels of realism have been achieved by advances in GAN training procedures and architectures. These successful models, however, are tuned mostly for use with regularly sampled data such as images, audio and video. Despite the successful application of the architecture on these types of media, applying the same tools to geometric data poses a far greater challenge. The study of geometric deep learning is still a debated issue within the academic community as the lack of intrinsic parametrization inherent to geometric objects prohibits the direct use of convolutional filters, a main building block of today's machine learning systems. In this paper we propose a new method for generating realistic human facial geometries coupled with overlayed textures. We circumvent the parametrization issue by imposing a global mapping from our data to the unit rectangle. We further discuss how to design such a mapping to control the mapping distortion and conserve area within the mapped image. By representing geometric textures and geometries as images, we are able to use advanced GAN methodologies to generate new geometries. We address the often neglected topic of relation between texture and geometry and propose to use this correlation to match between generated textures and their corresponding geometries. We offer a new method for training GAN models on partially corrupted data. Finally, we provide empirical evidence demonstrating our generative model's ability to produce examples of new identities independent from the training data while maintaining a high level of realism, two traits that are often at odds.


INTRODUCTION
The generation of realistic examples of everyday objects is a challenging and interesting problem which relates to several research fields such as geometry, computer graphics, and computer vision. The ability to capture the essence of a class of objects is key to the task of generating diverse datasets which may be used in turn during the training of many machine learning based algorithms. The main challenge posed by the task of data generation is to construct the model that is able to generalize to many variations while still maintaining high detail and quality. Furthermore, the challenge of generating geometric data is even greater since Both geometry and texture of an object must be synthesized while taking into account the underlying relations between them.
In this work, we propose to learn the latent space of 3D textured objects. We focus our efforts on human faces, and show that by using a canonical transformation that maps geometric data to images, we are able to learn the distribution of such images via the GAN framework. By representing both texture and geometry of the face as transformed geometric images, we can learn the underlying distribution of faces, and later generate new faces at will. The generation of realistic human faces is a useful tool with applications in face recognition, puppetry, reconstruction and rendering. Our main contributions are the proposition of a new model for 3D human faces which is composed in the 2D image domain, as well as the modeling of the relation between texture and geometry, further improving realism. By generating geometries and textures using state of the art GANs, it is possible create highly detailed data samples while maintaining the ability go generalize to unseen data, two desirable propertied that are often at odds.
While deep learning and convolutional networks have revolutionized many fields in recent years, they have been mostly employed on structured data which is intrinsically ordered. Arranged data such as audio, video, images, and text can be processed according to the order of samples, frames, pixels or words. This inherent ordering permits the application of convolution operations which are the main building block of convolutional networks, a powerful and popular variant of deep networks. Contrary to typical parameterized data, geometric data represented by two dimensional manifolds lacks an intrinsic parameterization and is therefore more difficult to process via convolutional networks. This important class of data is crucial to the task of modeling our world as most solid objects can be represented by a closed manifold accompanied by a texture overlay.
Recently, geometric data has grown dramatically in availability as more accurate and affordable acquisition devices have come into use. This abundance of data has attracted the attention of the computer vision and machine learning communities, leading to many new approaches for modeling and processing of geometries. One family of techniques for geometric data processing aims to define new operators which can be applied directly to the manifold and are able to replace to some extent the convolution operation within the processing pipeline. Other methods attempt to process geometries in the spectral domain or represent them in voxel space. These families of methods each have their merits but suffer from other issues such as loss of generality and memory inefficiency. In contrast, we propose to transform our geometric data via a canonical mapping into two dimensional gridded data. This allows us to process the geometric data as images. While this approach on its own is not new we show that by careful construction of the transformed dataset we are able to harness the power of convolutional networks with little loss of data fidelity. Furthermore, we are able to design our transformation process in order to control the distortion, thus reducing it in important areas while spreading it to the non essential areas of the data. Finally, we propose to encode both the geometry and texture as mapped images which means the processing pipeline remains identical for both cases.

RELATED WORK
Data augmentation is a common practice within the machine learning community. By applying various transformations to existing data samples it is possible to simulate a much larger dataset than is available and introduce robustness to transformations. A more advanced method for data augmentation takes into account the geometry of the scene. The technique which we term geometric data augmentation consists of a geometry recovery stage, then transformation is performed on the geometry and finally a new image is created by projecting the geometry. In [Masi et al. 2016], the authors show that by performing geometric data augmentation on a dataset of facial images they are able to reach state of the art results on difficult facial recognition benchmarks. Despite its proven usefulness geometric augmentation still lacks the ability to create completely new data samples outside the scope of the dataset. A complementary method to data augmentation is data generation. Bu constructing a high quality model for data generation it is possible to produce an infinitely large dataset. In addition, some models may permit control over the characteristics of each data sample. Within the domain of faces this would mean control over parameters such as age, gender, expression, pose and lighting conditions. When dealing with image data a recent popular approach is to use a GAN [Goodfellow et al. 2014] which is in essence a neural network with a trainable loss function. While this class of methods is well suited for images, reformulation in the context of geometry is more challenging and several competing approaches exist in this field. [Gecer et al. 2018] and [Shrivastava et al. 2017] propose to construct samples from a low quality linear model, and then use a GAN in order enforce the realism of the data. [Litany et al. 2018] and [Ranjan et al. 2018] both propose the use of convolutional autoencoders which are trained on pre-aligned geometric data. These methods however do not take into account the model texture. In addition [Wu et al. 2016] have used the popular voxel grid representation for geometries, and are able to generate 3D objects using this notion. This method however is memory inefficient and in practice can produce only coarse geometries.
In addition to data augmentation and generation the objective of pose normalization is to decouple the subjects identity from other factors such as expression and pose which may confuse a classifier. This can be either done by geometric reconstruction manipulation of the facial geometry or by performing normalization directly in the image domain. While [Chu et al. 2014] and [Bas et al. 2017] leverage a geometric representation in order to transform the data, [Tran et al. 2017b] and [Huang et al. 2017] are able to frontalize faces directly in the image domain as part of their pipeline. Although useful methods which help the training process by limiting data variation, these methods still do not explicitly model new data samples which is our ultimate goal.
An additional method for geometrically manipulating facial data which has gained success is geometric reconstruction from a single image. One popular family of methods aim to fit a parametric model to an image. This idea was first introduced by [Blanz and Vetter 1999] and has since been extended by works such as [Booth et al. 2017]. An approach which involves regressing the coefficients of a given model via a deep network were popularized by [Richardson et al. 2016] and extended by  and [Tran et al. 2017a]. More recently methods which are not restricted to a specific model or attempt to learn the model during training time such as , [Tewari et al. 2018] and [Tran and Liu 2018] have been able leave the restricting assumptions of linear models such as 3DMM. Complementary efforts such as [Deng et al. 2018] propose to reconstruct occluded texture regions in order to gain a full textured reconstruction from challenging poses as well. Another recent work by [Saito et al. 2017] focuses on improving the quality of facial texture used in reconstructed faces in order to improve realism. An additional complimentary approach proposed by [Riza Alp Güler 2016] is to learn a direct mapping from an 39:4 Gil Shamai*, Ron Slossberg*, and Ron Kimmel image to a template model. All of the above approaches while useful, are based on fitting some geometry to a given image by relying on some underlying geometric model. This model however is not explicitly used in order to generate novel faces but rather to reconstruct existing ones.
Our most direct competition comes from several works in the field of facial generative modeling. The seminal work by [Blanz and Vetter 1999] which pioneered the field almost two decades ago is still widely used within many methods, some of which were mentioned above. The linear 3D Morphable Model proposed is extremely flexible; however it has the drawback of using a small number of PCA vectors which limit its ability to present highly detailed models. A recent large scale effort taken by [Booth et al. 2016] and [Booth et al. 2018] has produced the largest publicly known 3DMM by scanning 10k subjects and using their scans to construct the model. In contrast to linear models much more complex relations can be captured by training deep networks to take the part of data generators. To this end, [Tewari et al. 2018] and [Tran and Liu 2018] were able to jointly learn a reconstruction encoder while also learning the facial model itself. Given the trained model one could plausibly generate faces, however the authors have not shown any experiments to this effect. [Ranjan et al. 2018] on the other hand has employed mesh autoencoders to construct new facial geometries, however this method does not produce texture and was trained on a limited dataset of very few subjects. In this work we will propose a new GAN based facial geometric generative model, and analyze the ability of our model to extend to new identities. We also relate between the geometric and texture models which are intrinsically correlated and discuss different ways of exploiting this correlation for our cause.

3D MORPHABLE MODEL
One of the early attempts to capture facial geometry and photometry (texture) by a linear low dimensional space is the Blanz and Vetter [Blanz and Vetter 1999] 3D Morphable Model (3DMM). Using the 3DMM, textures and geometries of faces can be synthesized as a linear combination of the elements of an orthogonal basis. The basis is constructed from a collection of facial scans and by applying the principal component analysis after alignment of the faces. That is, the basis construction process relies on a vertex to vertex alignment of the facial scans, which is achieved by computationally finding a dense correspondence between each scan to a template model. The aligned vertices provide a set of spatial and texture coordinates which are then decomposed into the principal components of the set. Once the basis is constructed, it is possible to represent each face by projecting it onto the first k components of both the geometry and the texture bases.
This linear model was used to reconstruct 3D faces from 2D images; Blanz and Vetter [Blanz and Vetter 1999] took an analysis-by-synthesis approach, which attempts to fit a projected surface model embedded in R 3 into a given 2D image. This was established by constructing a fully differentiable parametric image formation pipeline, and performing a gradient descent procedure optimizing for an image to image loss on the model parameters. The parameters consist of the geometry and texture models coefficients of the face, as well as the lighting and pose parameters. This process results in a set of coefficients which encode the geometry and texture of any given face up to their projections on the principal components basis, effectively reconstructing the curved surface structure and the photometry of the given image of a face.

Model Construction
According to the 3DMM model, each face is represented as an ordered set of m geometric coordinates д = (x 1 ,ŷ 1 ,ẑ 1 ,x 2 , . . . ,ŷ m ,ẑ m ) ∈ R 3m and texture coordinates in RGB space t = (r 1 ,д 1 ,b 1 ,r 2 , . . . ,д m ,b m ) ∈ R 3m . Given a set of n faces, each represented by geometry д i and texture t i vectors, construct the 3m × n matrices G and T by column wise concatenation of all Synthesizing facial photometries and corresponding geometries using generative adversarial networks 39:5 geometric coordinates and all corresponding texture coordinates. Since the alignment process ensures an ordered universal representation of all faces, Principal Component Analysis (PCA) [Jolliffe 1986] can be applied to extract the optimal first k orthogonal basis components in terms of L 2 reconstruction error. To that end, denote by V д and V t the 3m × n matrices that contain the left singular vectors of ∆G = G − µ д 1 T and ∆T = T − µ t 1 T , respectively, where µ д and µ t are the average geometry and texture of the faces and 1 is a vector of ones.
By ordering V д and V t according to the magnitude of the singular values in a descending order, the texture and the geometric coordinates of each given face can be approximated by the linear combination where α д i and α t i are the coefficients vectors, obtained by . Following this formulation, it is possible to use such a model to generate new faces by randomly selecting the geometry and texture coefficients and plugging them into Equation 1. According to [Blanz and Vetter 1999], the distribution of the coefficients can be approximated as a multivariate normal distribution, such that the probability for a coefficient vector α is given by where Σ is a covariance matrix that can be empirically estimated from the data, and is generally assumed to be diagonal.

Synthesis model
The 3D morphable model is useful not only in the context of representation and reconstruction, but, as noted in the previous section, it also allows for the generation of new faces which can not be found in the training set. The synthesis is achieved by randomizing linear combinations of the basis vectors. The random coefficients are drawn according to the model prior from the distribution described in Equation 2. As is common practice when dealing with principal components, only the first k ≪ n vectors can be taken into account as part of the model. The number k can be obtained by analyzing the decay of the singular values which is proportional to the error produced by ignoring the associated basis vector. By excluding the vectors for which the singular variables are sufficiently small we can guarantee minimal loss of data. Even though two decades have passed since the inception of the 3DMM, it is still widely used in cutting edge applications. By harnessing the generative powers of this model, it has been used as a tool for data augmentation and data creation for training of convolutional networks [Gecer et al. 2018;Richardson et al. 2016. Furthermore, the model has been integrated into deep learning pipelines in order to provide structure and regularization to the learning process [Tewari et al. 2018]. In spite of the wide use and apparent success of the model it is clear that the faces obtained from it tend to be over-smoothed and in some cases non-realistic. Furthermore, the multivariate normal distribution model from which the coefficients are drawn is over simplified and does not represent the true distribution of faces. In particular, the texture and geometry are treated as two uncorrelated variables, in contradiction to empirical evidence. Figure 1 shows a few samples of synthesized 3DMM faces and depicts the difference between the distributions of 3DMM generated faces and real ones.

PROGRESSIVE GROWING GAN
Generation of novel plausible data samples requires learning the underlying distribution of the data. Given a perfect discriminator which can differentiate between real and fake data samples it is possible to construct a training loss for a generator model which tries to maximally confuse the discriminator. For complex realistic data, finding such a discriminator is a difficult problem on its own and requires learning from realistic and fake examples.
The fundamental idea of the GAN framework is to train both of these networks simultaneously. Essentially, this means that we use a trainable loss function for the generator which constantly evolves as the generator improves. This process can be formulated as Equation 3 where D, G are the discriminator and generator parametric functions, x, z are the real data samples and latent representation vector respectively. Since we wish to produce high resolution textures for facial geometries, we propose to use a recent successful GAN, namely [Karras et al. 2017]. The progressive growing GAN is built in levels which gradually increasing the resolution of the output image. During the training process each level is added consecutively while smoothly blending the new levels into the output as they are added. This, and several other techniques were shown to increase the training stability as well as the variation of the produced data.
The difficulty concerning geometric data is that it lacks the regular intrinsic ordering which exists in 2D images, which are essentially large matrices. For this reason, it is unclear how to apply spatial filtering, which is the core building block of neural network layers, to arbitrary geometric structures. Significant progress has been made in this direction by several recent papers. A comprehensive survey is presented in [Bronstein et al. 2017]. These methods, however, are not yet widely used and supported within standard deep learning coding libraries. In order to harness the full power of recent state of the art developments in the field, it is sometimes preferable to work in the domain of images. For this reason, we built a data processing pipeline which maps the geometric scanned data into a flat canonical image which allows the utilization of the progressively growing GAN without major modifications.

TRAINING DATA CONSTRUCTION
In this section we describe the process by which we produce our training data. We start with digital geometric scans of human faces. By making use of a surface to surface alignment process [Weise et al. 2009], we are able to bring all the scans into correspondence with each other. Next, applying a universal mapping from the mesh to the 2D plane, we can transfer the facial texture into a canonically parametrized image. These aligned texture images are used to train our texture generation model. We provide several alternatives for constructing the facial geometry which accompanies each texture. One solution is to learn the relation between 3DMM texture and geometry coefficients which is prevalent in the training data. In addition, we can similarly process the geometric data of the faces as well. By applying the same canonical transformation and encoding the (x, y, z) coordinates of the model vertices as RGB channels of an image, we can learn to generate geometries as well as textures using the same methodology.

Face scanning and marking
Our training data formulation process starts by acquiring digital high resolution facial scans. Using a 3DMD scanner, roughly 1000 different subjects were scanned, each making five distinct facial expressions including a neutral expression. The subjects were selected to form a balanced mixture of genders and ethnic backgrounds. Each scan is comprised of the facial geometry, represented by a triangulated mesh, as well as two high resolution photographs, which capture a 180 degree view of the subject's face. Each mesh triangle is automatically mapped to one of the photos, allowing the facial texture to be transferred onto the mesh.
Due to the variety of facial geometries, as well as limitations of the scanning process, the meshes may contain imperfections such as holes and areas of missing texture. These data corruptions may affect the training data samples that are given to the network and care must be taken not to hinder the training process. The straightforward path is to filter out the erroneous data samples completely. This leads to a significant reduction in the overall size of the training set size of roughly 20%. Instead, we propose a new approach which incorporates corrupted scans without compromising the integrity of the training data. We describe our approach to learning from corrupted data in section 6.
In order to facilitate the alignment process described in subsection 5.2, we annotate each face by 43 landmark locations. These locations are determined automatically by projecting the facial surface into an image and applying one of many 2D facial landmark detectors such as Dlib [King 2009]. The landmarks are then back-projected onto the surface to determine their location. Finally, 39:8 Gil Shamai*, Ron Slossberg*, and Ron Kimmel the locations of the automatically generated landmarks are manually refined in order to prevent displacements that could lead to large errors during the alignment process.

Non-Rigid Alignment
The goal of the alignment process is to find a dense correspondence between all the facial geometries. It is performed by aligning all scans to a single facial template. This correspondence is achieved by deforming the template into the scanned surface, a process guided by the pre-computed landmarks.
Initially, a rigid alignment between the scanned surface and template is performed as preprocessing step. This is done by solving for the rotation, translation, and uniform scaling between the scan and template landmarks. The deformation process is performed by defining a fitting energy which takes into account both surfaces and known landmarks and measures how closely they fit each other. The energy also includes a regularization term which penalizes non-smooth deformations. The template mesh is deformed by moving each vertex according to the energy gradient in an iterative manner.
The loss function which is minimized during the alignment process was first described by [Blanz and Vetter 1999] and is comprised of 3 terms which contribute to the final alignment. The first term accumulates the distances between the facial landmark points on the scanned facial surface and their corresponding points on the template mesh. The second term accumulates the distances between all the template mesh points to the scanned surface. The third term serves as a regularization, and penalizes non-smooth deformations. The loss term is minimized by taking the derivative of the loss with respect to the template vertex coordinates, then deforming the template in the gradient direction. This process naturally provides a dense point to point correspondence between each and every scanned surface.

Universal mapping
Given a facial scanned surface with unknown parametrization, our goal in this section is to discover a 2D parameterization of the surface which maps it to a unit rectangle, such that this mapping is consistent for all scans. In subsection 5.2, we described the process of aligning the facial surface template to a scanned facial surface, and by that, bring them into correspondence. The obtained correspondence allows to transfer the parametrization from the template to all scans, thus establishing a universal parametrization. In the following section, we define the unique parameterization between the template face and the unit rectangle.
The authors of [Slossberg et al. 2018] defined tbe mapping between the scan and the plane by using a ray casting technique built into the animation rendering toolbox of Blender [Blender Online Community 2017]. Figure 3 depicts several examples of the resulting mapped facial photometry. Although it would be possible to make use of the same parametrizatoin, an alternative definition may suite us better. The Blender mapping, for example, does not exploit the entire squared image for the mapping. Moreover, it does not take the facial structure into account. The eyes, nose, and mouth, for instance, clearly contain more details than smoother parts of the face such as the cheeks and forehead. It is reasonable to assume that it would be easier to learn and reconstruct the main features, perhaps at the expense of other parts if they take up a larger portion of the input images.
To that end, we propose to construct a weighted parametrization that will allow us to control the relative area in the plane taken up by each facial feature.
In [Floater 1997], the authors presented a parametrization technique that allows to choose for each vertex its baricentric coordinates with respect to its neighbors. The authors demonstrate that any set of baricentric coordinates has a unique planar graph with a valid triangulation that fulfills it. As an extension, they also provided a method for a weighted least square parametrization that Synthesizing facial photometries and corresponding geometries using generative adversarial networks 39:9 allows some control over the edge lengths in the resulting parametrization. The method is briefly described as below. Given any triangulated mesh, the object is to map it into a valid planar graph with the same connectivity. Assuming a mesh with N vertices, choose a set of K boundary vertices from the mesh and fix their 2D mapping values to some desired convex boundary, u 1 , ..., u K . For any other vertex i > K in the mesh, choose a set of non-negative baricentric coordinates λ i, j , such that N j=1 λ i, j = 1, and λ i, j = 0 if and only if i and j are not connected. Then, for i = K + 1, ..., N , solve the linear system of equations The authors in [Floater 1997] prove that Equation 4 has a closed form unique solution that coincides with the chosen baricentric coordinates. According to [Floater 1997], this technique could be extended to a weighted least square parametrization. For any desired set of weights w i, j , it was shown that the choice of minimizes the functional j:(i, j)∈E w i, j ∥u i − u j ∥ 2 , where E represents the set of edges.
Following this technique, we designed the weights w i, j such that eyes, nose and mouth would recieve a larger area in the parametrization plane. We defined a weight for each vertex in the template face, and then gave each edge the average weight of its two adjacent vertices. Note that the resulting edge lengths also depend on the density of vertices in the mesh. In other words, when choosing a constant weight for all edges, the edge lengths of the resulting parametrization termed the uniform baricentric parametrization, is not constant. To design the edge weights more intuitively, we normalize the edge weights by the ones resulting from the uniform baricentric parametrization. A visualization of the edge weights is shown in Figure 3.
To choose the boundary vertices u 1 , . . . , u K , we follow the outer boundary of the facial mesh, starting from the center bottom (a point on the chin), while measuring the length of edges we pass through, L 1 , ..., L k . Assume the image boundary is parametrized by C(t) = {x(t), y(t)} for 0 ≤ t ≤ 1, such that C(0) = C(1) is the bottom center of the image. Then, we set u i = C(t i ), where Lastly, unlike [Slossberg et al. 2018], we propose to construct a symmetric mapping, in order to augment the data by mirroring the training samples. This could be done by ensuring that the template is intrinsically symmetric, as well as the choice of boundary vertices and edge weight. The resulting mapping and a visualization of the edge weights are shown in Figure 3. The rightmost part in Figure 3 shows that when mapping back the unwrapped texture to the facial geometry, a better resolution is obtained when using the proposed method.

LEARNING FROM CORRUPTED DATA
The semi-automatic data acquisition pipeline described in section 5 is used to construct a dataset of 2D images that will be used to train the GAN. Naturally, some of the generated data samples contain corrupted parts due to errors in one or more of the pipeline stages. In the so-called 3D scanning process, for example, facial textures that contain hair are often not captured well. Another reasons for incomplete texture are occlusions and limited camera field of view. The geometry of the eyes is occasionally distorted due to their high specular reflection properties. In the landmark annotation stage, some landmarks can be inaccurate or even wrong, resulting in various distortions

39:10
Gil Shamai*, Ron Slossberg*, and Ron Kimmel Fig. 3. Left: A visualization of the proposed edge weights. Each vertex is colored by the average weights of its edges. Bright colors represent larger weights. Next: The deformed template, after its alignment process to some arbitrary scan. Center: the resulting 2D image, using the texture mapping suggested in [Slossberg et al. 2018] and the proposed one. Right: A comparison between the texture mapping methods. An unwrapped texture is mapped back to the template, showing a slightly better resolution in the proposed method. in the final output. Figure 4 provides several examples of such data corruptions. One way to handle data corruption is to ignore imperfect images and keep only the valid ones. In our case, manual screening of the data reduced the number of samples from 4, 963 to only 3, 679 valid ones, thus, eliminating 25% of the data. Here, we propose a novel technique for training GANs using partially incomplete data that is able to exploit undamaged parts and robustly deal with corrupted data.
To that end, we propose to pair a binary valid mask to each training data image, that represents areas in the image that should be ignored. Without loss of generality, black areas in the masks (zero values) correspond to corrupted regions in the image we would like to ignore, and white regions (values of one) correspond to valid parts we would like to exploit for training the network. We propose to multiply these valid masks by their corresponding images, as well as concatenate them as a forth channel (R-G-B-mask). Recall that the discriminator receives as an input a batch of real images and a batch of fake images. To prevent the discriminator from discriminating real and fake images by the valid masks, the same masks are multiplied and concatenated to both real and fake batches. The generator, which does not get the masks as an input, must produce complete images in-painting the masked regions. Otherwise, the discriminator would be able to easily identify masked parts that do not match the valid masks and conclude that the image is fake. The valid masks could be constructed either manually or using automatic image processing technique for detection of the unwanted parts. The discriminator and generator of the proposed GAN model are demonstrated in Figure 5.
To demonstrate the performance of the proposed GAN we constructed a synthetic dataset of different colored shapes randomly located in 10, 000 images of size 256 × 256. In this simple experiment, we treat the red circles as corruptions that we would like our model to ignore. Figure 6 Synthesizing facial photometries and corresponding geometries using generative adversarial networks 39:11 Fig. 5. The proposed GAN model of learning from incomplete data. A valid mask is fitted for each training sample according to the corrupted regions. The real and fake samples are concatenated and masked by the same valid masks and then passed to the discriminator unit. The discriminator cannot distinguish between the real and fake images by their masks. The generator cannot generate corrupted images since corruptions are masked. The generator does not have any information about the mask and therefore cannot generate corrupted images since they would not fit the masked regions. shows the data images, the valid masks, and the resulting GAN output. It is clearly seen that the proposed GAN model generated new data images without the unwanted red circles.

FACIAL SURFACE GENERATOR
We propose to train a model which is able to generate realistic geometries and photometries (textures or colors) of human faces. The training data for our model is constructed according to section 5, and used to train a NN according to a GAN loss. At inference, the trained model is used to produce random plausible facial textures which are mapped by our predefined parametrization described in subsection 5.3. In order to also generate corresponding facial geometries for each new texture, we propose two novel approaches. The first approach is based on training a similar model for geometries. This is done by mapping the training set geometry coordinates using the canonical parametrization into the unit rectangle. By treating each coordinate as a color channel, an we form geometry images which we use to train our geometry generator model. The second approach relies on the classical 3DMM model. For both approaches we suggest a method to generate a geometry which is a plausible fit for a given texture. In the following sections we describe the two proposed approaches in detail.

Generating textures using GAN
Our texture generation model is based on a Convolutional Neural Network which is trained using a GAN loss. Due to this loss, we are able to train a model that satisfies the distribution of real data samples, by drawing new samples out of this distribution. By training our model on our dataset which we constructed according to section 5, we are able generate new plausible textures which are all mapped to the unit rectangle plane according to the predefined parametrization described in subsection 5.3. As we will show in the following sections, the generated textures by the proposed model present novel yet realistic human faces. Since texture and geometry are both inseparable attributes of the same geometric entity, it is necessary to take the relationship between them into account when generating the corresponding geometries. In section 8 and subsection 7.2 we describe in detail the process of the proposed geometry generation pipeline which takes as input a generated texture and produces a corresponding plausible geometry. Several outputs from the suggested texture generation model are depicted in Figure 7 7.2 Assigning geometries to textures Once novel textures have been generated, we would like to assign them plausible synthetic geometries in order to obtain realistic face models. One way to generate geometries is by exploiting the 3DMM model by which geometries can be recovered through proper selection of the coefficients.
In what follows, we discuss and compare several methods for obtaining the 3DMM geometry coefficients.
7.2.1 Random. The simplest way of synthesizing a geometry to a given texture is by picking random 3DMM geometry coefficients. We follow the formulation in Equation 2. The probability of a coefficient α i is given by where, σ 2 i is the i-th eigenvalue of the covariance of ∆G. σ 2 i can be computed more efficiently as σ 2 i = 1 n δ 2 i , where δ i is the i-th singular value of ∆G. To fit a geometry to a given texture, we randomize a vector of coefficients from the above probability distribution and reconstruct the geometry using the 3DMM formulation.
Random geometries are simple to generate. Yet, not every geometry can actually fit any texture. As a convincing visualization, we computed the canonical correlation [Hotelling 1936] between the 3DMM texture and geometry coefficients, {α t i } n i=1 and {α дi } n i=1 , of the facial scans. Figure 8 shows u w.r.t. v, the first two canonical variables of the correlation. In what follows, we attempt to generate geometries which are suited for their textures. 7.2.2 Nearest neighbour. Given a new texture, a simple way to fit a geometry that is likely to match it, is by finding the data sample with the nearest texture, and projecting its geometry onto the 3DMM subspace. For that task, we define a distance between two textures as the L 2 norm between their 3DMM texture coefficients. Only the 3DMM texture and geometry coefficients of the data need to be stored. Nearest neighbor geometries are simple to obtain; however they are restricted to the training data geometries alone.

Maximum likelihood. The maximum likelihood estimator (ML) is typically used when one
can formulate assumptions about the data distribution. In our case, given input facial textures, ML could be used to obtain the most likely geometries under a set of assumptions. We first construct a mutual 3DMM basis by concatenating textures and geometries. Define a vertical concatenation of geometries G and textures T as the 6m × n matrix M = G T , such that G,T are defined in section 3.
Define ∆M = M − µ M 1 T , where µ M holds the average of the rows of M. Denote by U the 6m × k matrix that contains the first k basis vectors of ∆M, i.e., corresponding to the largest magnitude eigenvalues. These vectors can be computed either as eigenvectors of ∆M∆M T or, more efficiently, as the left singular vectors of ∆M. Denote by U д and µ M д the upper halves of U and µ M , and denote by U t and µ M t the lower halves U and µ M , respectively, such that Note that U д and U t , unlike V д and V t that were defined in section 3, are not orthogonal. Nevertheless, any geometry д and texture t of a given face in M can be represented as a linear combination where the coefficient vector β is mutual to the geometry and texture. Using the notations and definitions above, any new facial texture could be approximated through a coefficient vector β as

39:14
Gil Shamai*, Ron Slossberg*, and Ron Kimmel The maximum likelihood assumption is that β, noise t , and noise д follow a multivariate normal distributions with zero mean. Given a facial texture t, our goal is to compute the most likely coefficient vector β * under this assumption, and then obtain the most likely geometry as Following Bayes' rule, one could formulate the most likely coefficient vector as Since P(t |β) and P(β) follow multivariate normal distributions, denote their covariance matrices by Σ t |β and Σ β , and their mean vectors by µ t |β = U t β and µ β = ì 0, respectively. Thus, One could obtain a closed form solution for β * by vanishing its gradient, which yields We estimate the covariance matrices Σ β and Σ t |β empirically from the data. Since the mean of each coefficient in β with respect to all samples is zero, the covariance Σ β can be estimated by where, β i is the coefficient vector for face sample i. The 3m × 3m covariance matrix Σ t |β is very large, impractical to estimate from a few thousands of samples or to invert once estimated. Hence, for simplicity, we approximate it as a diagonal matrix that does not depend on β. One can verify that the mean of each element in noise t = U t β + µ M t − t with respect to all samples is zero. Hence, we estimate its j-th diagonal value as 7.2.4 Least squares. Least squares (LS) minimization is a simple and very useful approach that should be typically used when the amount of data samples is large enough. It can be thought of as training a multivariate linear regression with an L 2 loss. Assume a facial sample is represented by a texture vector t and a geometry vector д. Denote by α t and α д the column vectors with the first k t and k д texture and geometry 3DMM coefficients of the face. These coefficients can be obtained by projecting t and д onto the 3DMM basis V t and V д . Let the k t × n matrix A t hold the texture coefficient vectors of all samples in its columns, and let the k д × n matrix A д hold the geometry coefficient vectors of all samples in its columns in the same order as A t . The correlation between A t and A д could be linearly approximated by Synthesizing facial photometries and corresponding geometries using generative adversarial networks 39:15 Fig. 9. Left: Mapped textures from the test set. Right: Corresponding geometries that were reconstructed using the each proposed approach. Average L2 reconstruction error for each method appears above each method illustration.
Note that we would not benefit from generalizing from a linear to an affine correlation. This is because the mean of each row in A t and A д are zero, as they hold singular values of a centered set of samples. Following Equation 17, we would like to find a matrix W that minimizes A closed form solution is easily obtained to be DefineṼ t andṼ д as holding the first k t and k д texture and geometry 3DMM basis vectors. W * can be estimated using a set of training samples. Then, given a new texture t, one could fit a geometry д by computing the texture coefficients as computing the geometry coefficients as and finally, computing the geometry as 7.2.5 Geometry reconstruction method comparison. To evaluate how well the assigned geometries fit each textures, we use a test set of textures and their corresponding geometries obtained from 297 scans that did not participate in neither the GAN training or geometry fitting procedures. Given these unseen textures as input, we estimate their geometries using the approaches presented above, and compare them to their ground truth. For this comparison, we computed the average L 2 norm between the vertices of the reconstructed and true geometry for each of the methods. In this experiment, we chose k = k t = k д = 200. Figure 9 shows examples of test textures mapped onto their assigned geometries that were obtained using each of the above methods. It is clear that the LS approach obtains the best results on the test set. Since it is also simple and efficient, we choose to use the LS approach to approximate the geometries in the following sections. Note, however, that the rest of the methods could be beneficial for other applications, depending on each case. Figure 10 visually compares the reconstructed geometries to the true ones for different textures from the test scans, using the LS approach. The L 2 norm between the reconstruction and true geometries are given below each example. The geometries, predicted solely from textures of identities that were never seen before, are surprisingly very similar to the true ones. This validates the strong correlation assumption between textures and geometries.

GENERATING GEOMETRIES USING GAN
In subsection 7.2, we reconstructed geometries using the 3DMM model. Indeed, projecting geometries onto the subspace of 3DMM has almost no visual effect on the appearance of the faces. The 3DMM, however, is constrained to the subspace of training set geometries and cannot generalize to unseen examples.
In subsection 5.3, we mapped facial textures into 2D images, with the goal of producing new textures. The same methodology can be used for producing new geometries as well. To that end, we propose to construct a dataset of aligned facial geometries and train a GAN to generate new ones by repeating the texture mapping process while replacing its RBG texture values by its XYZ geometry values.
As for data augmentation, while the amount of texture samples can be doubled by horizontal mirroring each of the images, we found that mirroring each one of the X , Y , and Z values independently results in a valid facial geometry. Thus, the amount of geometry samples can be augmented by a factor of 8. Note, however, that when mirroring X values, one should perform C − X , where C is a constant that could be set, for example, to the maximal X value in all training samples. The training data and resulting generated geometries are shown in Figure 11.

ADDING EXPRESSIONS
In previous sections we proposed a method for generating new facial textures and corresponding geometries. In order to complete the model we must also take expressions into consideration. We follow [Chu et al. 2014] who define a linear basis for expressions by taking the difference Synthesizing facial photometries and corresponding geometries using generative adversarial networks 39:17 Fig. 11. Left: the template aligned to 4 real 3D facial scans, colored by their X , Y , and Z values. Center-left: geometry values mapped to an image using the proposed universal mapping. These images are used to train a GAN. Center-right: fake geometry image generated by the GAN. Right: the synthesized geometries mapped back to 3D. д dif f = д expr − д neut r al for every face in the set. We then remove the mean difference vector to We compute the principal components of ∆G dif f to obtain our geometric expression model. The expression difference model can be used by randomizing the expression coefficients and adding the linear combination of the difference vectors to a generated neutral face as so д exp = д neut r al + µ dif f + α д + V exp α exp . Since the expression model must be applied to neutral faces, we should define a model for neutral faces. In order to span only the space of neutral expressionless faces we suggest to replace all the geometries in our training set with their neutral counterpart. By following this course, the texture model still benefits from all the textures available to us while our geometry model learns to predict only neutral models for any texture with or without expression. This method can be applied to either the 3DMM based geometry model from subsection 7.2 or the GAN based geometry model described in section 8.

EXPERIMENTAL RESULTS
In order to demonstrate the ability of our model to generate new realistic identities we perform several quantitative as well as qualitative experiments. As our first results we generate several random textures and obtain their corresponding geometry according to subsection 7.2. We are able to vary the expression by applying a linear expression model as described in section 9. According to this model each expression can be represented by a variation from the mean face which leads to a specific facial movement. By combining various movements of the face one can generate any expression desired. The faces are then rendered under various poses and lighting conditions. The rendered faces are depicted in Figure 13 39:18 Gil Shamai*, Ron Slossberg*, and Ron Kimmel Our next qualitative experiment demonstrates the ability of our model to generate completely new textures by combining facial features from different training examples. To this end we search for the nearest neighbor to the generated texture from within the training data. It can be seen in Figure 14 that the demonstrated examples have nearest neighbors that are significantly different from them and cannot be considered as the same identity. Within the following section we will analyze both the generative ability of our model to produce new faces as well its realism and similarity to realistic examples. In addition, we also search for generated texture samples which are nearest to several validation set examples. By finding close by textures we demonstrate the generalization capability of our model to unseen textures. This is demonstrated in Figure 15 The previous qualitative assessment is complimented by a more in depth examination of the nearest neighbors across 10K generated faces. For the following experiments we have freedom to choose our distance metric. We aim to find a natural metric which coincides with human perception of faces. We therefore choose to render each generated and real face from a frontal perspective and process the rendered images via a pre-trained facial recognition network. Using a model based on [Amos et al. 2016] we extract the last feature from within the network as our facial descriptor. The distance is calculated as dist = ∥D 1 − D 2 ∥ 2 where D 1 , D 2 are the descriptors corresponding to the first and second face respectively. By analyzing the distribution of such distances we can assess the spread of identities which exists within each dataset as well as the relation between different datasets.
We use the distribution of distances between generated faces and the training and validation sets of real faces in order to assess the quality of our generative model. In Figure 14 we plot the distribution of distances between generated sample and their nearest real training sample. This plot implies that these distances are distributed as a shifted Gaussian. This implies that on average new identities are located in between the real samples and not directly near them. Our analysis of the distances to the neighbors of the validation set also depicted in Figure 14 shows that our model is able to produce identities of subjects similar to ones found in the validation set which were not used to train the model. This validates our claim that our model is producing new identities by combining features from the training set faces, and that these identities are not too similar to the training set yet can still generalize to the unseen validation set.
Following [Karras et al. 2017] we perform an analysis of sliced Wasserstein distance [Rabin et al. 2011] on our generated textures and geometries. By assessing the distance between the distribution of patches taken from textures generated by our model relative to patches taken from faces generated by 3DMM we can analyze the multi-resolution similarity between the generated and real examples. Table 1 and Table 2 show the SWD for each resolution relative to the training data.
In both experiments it is clear that the SWD is lower for our model at every resolution indicating that at every level of detail the patches produced by our model are more similar to patches in the training data.
In addition to assessing the patch level feature resemblance, we wish to uncover the distances between the distribution of identities. To this end we conduct two more experiments which gauge the similarity between the distributions of generated identities to that of the real ones. In order to qualitatively assess these distributions we depict our identities using the common dimensionality reduction scheme T-SNE [Maaten and Hinton 2008]. Figure 16 depicts the low dimensional representation of the embedding proposed by our model and the 3DMM overlaid on top of the real data embedding. In addition Figure 16 also depicts the clustering of different ethnic groups as well as gender as data points of different colors. By assigning each generated sample to the nearest cluster, we can automatically assign each new sample with its nearest cluster in order to obtain automatic annotation of our generated data. In addition we perform a quantitative   Table 3.

DISCUSSION
In this paper we present a new model for generating high detail textures and corresponding geometries of human faces. Our claim is that an effective method for processing geometric surfaces via CNNs is to first align the geometric dataset to a template model, and then map each geometry to a 2D image using a predefined mapping. Once in image form, A GAN loss can be employed to train a generator model which aims to imitate the distribution of the training data images. We further show that by training a generator for both textures and geometries it is possible to synthesize high-detail textures and geometries which are linked to each other by a single canonical mapping.
In addition, we describe in subsection 7.2 several methods for fitting 3DMM geometries by learning the underlying relation between texture and geometry, a relation that has been largely neglected in previous work. In subsection 7.2 we also provide a quantitative and qualitative evaluation of each geometry reconstruction method. our proposed face generation pipeline therefore consists of a high resolution texture generator combined with a geometry that was either produced by a similar geometric generation model or by employing a learning scheme which produces the most likely corresponding 3DMM coefficients. Besides the main pipeline, we propose two extra data processing steps which improve sample quality. In subsection 5.3 we describe the design and construction of our canonical mapping. Our mapping by design is intended to reduce distortion in important high detail areas while spreading the flattening distortion to non essential areas. Our mapping was also designed in order to take maximal advantage of the available area in each image. In subsection 5.3 we also show that our improved mapping compared to [Slossberg et al. 2018] indeed preserves delicate texture details in our predefined high importance regions. In section 6 we also present a new technique for dealing with partially corrupted data. This is especially important when the data acquisition is expensive and prone to errors. By adding a corruption mask to the data at train time the network is able to ignore the affected areas while still learning from the mostly unaffected ones. In the case of our dataset this increases the amount of usable data by roughly 20%.
In order to evaluate our proposed model we preformed a quantitative as well as qualitative analysis of several aspects of our model. Our main objective was to create a realistic model, a requirement which we break down into several factors. Our model should produce high quality plausible facial textures which look as much like the training data as possible, but also compose new faces not seen during training rather than repeat previously seen faces. To that end we use an efficient approximation of Wasserstein distance between distributions in order to evaluate the local and global scale features of the produced textures and geometries as well as the distance between distributions of real and generated identities. Our results show that in both identity distribution and image feature resemblance we outperform the 3DMM model which the most widely used model to date.

ACKNOWLEDGMENTS
This research was partially supported by the Israel Ministry of Science, grant number 3-14719 and the Technion Hiroshi Fujiwara Cyber Security Research Center and the Israel Cyber Bureau. We would also like to thank Intel RealSense group for sharing their data and computational resources with us.