Improved StyleGAN Embedding: Where are the Good Latents?

Peihao Zhu, Rameen Abdal, Yipeng Qin, John Femiani, Peter Wonka

Introduction

GAN inversion (embedding) refers to the task of computing a latent code for a given input image. The goal of the embedding is typically to perform some subsequent image processing tasks, such as image interpolation or semantic image editing. Due to the high visual quality of generated images and comparatively lightweight architecture, most recent papers build on StyleGAN (Karras et al., 2019) and StyleGAN2 (Karras et al., 2020b, a) to develop GAN inversion algorithms. The resulting embedding methods represent a trade-off of two main concerns: the reconstruction quality and the editing quality. The reconstruction quality considers how similar an embedded image is to the input image. The editing quality describes the visual quality and realism of images after performing editing operations in latent space, e.g., editing the pose, lighting, or age of in face images (Härkönen et al., 2020).

In this paper, we set out to provide some analysis of existing embedding methods and use that analysis as the basis for an improved image-to-StyleGAN embedding method. One important consideration is the choice of the embedding space, e.g., ZZ space, W{W} space, or W+{W}+ space. These spaces each impose trade-offs – the ZZ space, used when training StyleGAN or StyleGAN2, restricts latent codes to a hypersphere. The W{W} space does not have a sphere constraint and uses a mapping network to disentangle latent codes. The W{W} space is therefore less entangled than the ZZ space. However, both spaces use 512 dimensional latent codes. This does not provide enough expressiveness to represent all real-world faces well. In (Abdal et al., 2020a) it was shown that W+{W}+ codes, in which the degrees of freedom are 18 times larger than W{W} space, are capable of reconstructing images well. However, these additional degrees of freedom make GAN inversion an ill-conditioned problem. Thus, non regularized inversion of W+{W}+ codes can find embeddings in low-density portions of the latent space, so that even if a particular image is reconstructed well, the reconstruction is in a region that will not normally be reached by the mapping network. Empirically, this leads to undesirable images after GAN-based image manipulations such as interpolation or semantic editing.

We propose a suitable space, called PNP_{N} space, to perform the analysis. In PNP_{N} space, the distribution of StyleGAN latent codes has a surprisingly simple structure, illustrated in Fig. 1, which we approximate by a multivariate normal distribution. This enables an explanation of where good latent codes can be found. A major insight of the analysis is that the quality of a latent code is closely related to the distance from the center of PNP_{N} space. The L2L_{2} norm in PNP_{N} space is a Mahalanobis distance of latent codes, so that L2L_{2} regularization in this space will bias embeddings towards more densely sampled regions of the GAN latent space. We find that reconstruction quality favors latent codes that are far from the origin in PNP_{N} space, but editing quality favors latent codes close to the origin in PNP_{N} space. This requires a trade-off between reconstruction quality and editing quality. Investigating the individual dimensions of latent codes in PNP_{N} space gives a strong understanding of the trade-offs made by current methods.

We propose an improved embedding algorithm by introducing a regularizer that encourages embeddings to stay closer to the origin of the PNP_{N} space, which is where the W{W} latent-codes of training data have the highest density. We further extend this to the much higher capacity W+{W}+ space, introducing a corresponding PN+P_{N}^{+}{} regularizer. The advantage of our regularizer is that it explicitly controls the distance to the origin and does not have undesirable side effects. In particular, a regularizer will bias solutions towards more dense and editable portions of latent space, but it will not prevent optimization from finding solutions that reduce the reconstruction error. Regularizing will slightly reduce reconstruction quality, but much less-so than a constraint. Further, a regularization hyperparameter allows control over the trade-off between reconstruction quality and editability. Finally, we present the first comprehensive evaluation comparing different state-of-the-art embedding algorithms. The evaluation does not just consider reconstruction quality, but also the effect of a variety of edits (pose, lighting, and age) and the impact of embedding algorithms on conditional embedding tasks (super-resolution, image colorization, and inpainting). Our main contributions are:

the introduction of PNP_{N} and PN+P_{N}^{+} space for analyzing and regularizing StyleGAN embeddings.

a new regularizer for StyleGAN embedding that provides the best trade-off between reconstruction and editing quality.

a comprehensive evaluation of many state-of-the-art embedding algorithms. Our evaluation not only emphasizes reconstruction, but also the impact on downstream editing tasks.

Related Work

The seminal paper by Goodfellow et al. (Goodfellow et al., 2014) started an avalanche of GAN papers that together lead to impressive improvements over the last years (Radford et al., 2015; Arjovsky et al., 2017; Karras et al., 2017; Miyato et al., 2018; Karras et al., 2019; Karras et al., 2020b, a). Similar to most other work in GAN image embedding, we build on StyleGAN (Karras et al., 2020b; Karras et al., 2019; Karras et al., 2020a) due to its exceptional visual quality and comparatively lightweight architecture.

Since the recent inception of Image2StyleGAN (I2S) (Abdal et al., 2019) which first proposed a feasible method to embed a given image into the W+{W}+ latent space of the StyleGAN generator, there have been many works trying to improve upon the initial idea.

Most of the existing methods have the same goal: finding a balance between the reconstruction quality and the editing quality. For example, I2S++ (Abdal et al., 2020a) improved the reconstruction quality of I2S by incorporating a noise optimization step to restore the high-frequency details in the input image. Similarly, StyleGAN2 (Karras et al., 2020b) uses an additive ramped-down noise to help the latent space exploration. These two methods lead to different trade-offs: I2S++ embeds images into the W+{W}+ space that sacrifices a bit of editing quality to achieve better reconstruction quality; while on the contrary, the StyleGAN2 embeds images in the W{W} space that enables better editing but at the cost of worse reconstruction. Following a different approach, PIE (Tewari et al., 2020a) first embeds an image into the W{W} space for better editing quality and then improves the reconstruction quality by optimizing the latent obtained in the W+{W}+ space. Such a two-stage encoding process is also employed by several concurrent works based on encoder networks (Bau et al., 2019; Zhu et al., 2020; Guan et al., 2020; Bau et al., 2020), which to our knowledge first appears in iGAN (Zhu et al., 2016). In their methods, an initial latent code is first obtained by passing the input image through a pre-trained StyleGAN encoder. Then, the initial latent code is further optimized to improve its reconstruction quality. Using only the encoder network by itself leads to poor reconstruction quality.

Unlike previous methods, PULSE (Menon et al., 2020) formulated embedding as traversing the manifold consisting of good latents. However, they constrained the latents to be on the surface of a hypersphere that only contains a subset of good latents. As a result, their method usually leads to poorer reconstruction quality. Inspired by PULSE, in this work, we provide a thorough analysis of where the good latents are and how to evaluate an embedding. Based on our analysis, we propose an improved embedding algorithm that outperforms all existing methods.

Which Space to Use: a Statistical Analysis of Latent Distributions

The goal of this section is to identify a space where the distribution of latent codes has a simple structure. A suitable space will make it easier to reason about good and bad latent codes for the StyleGAN generator (Karras et al., 2019; Karras et al., 2020b). To find such a latent space, we conduct a statistical analysis on the latent distributions in different latent spaces illustrated in Fig. 2, including W{W}, PNP_{N}, W+{W}+, and PN+P_{N}^{+} spaces.

The W{W} space proposed in StyleGAN (Karras et al., 2019) is the most straightforward choice of latent space. Therefore, we start our investigation by analyzing the distribution of 11 a million latent codes in W{W} space and visually checking the statistics of their marginal distributions. We sample this space by first generating random samples in ZZ space, and then forward-propagating through the mapping layers of StyleGAN2. We use the same input distribution as StyleGAN, in which the latent-codes in ZZ space are projected onto a hypersphere before propagating them through the mapping network. As Fig. 1 (a) shows, the marginal distributions are heavily skewed.

P Space:

To get rid of the skewness of marginal distributions, we transform the W{W} space to the PP space by inverting the last Leaky ReLU layer in the StyleGAN mapping network. Since the last Leaky ReLU uses a slope of 15\frac{1}{5} we invert it using

where w\mathbf{w} and x\mathbf{x} are latent codes in W{W} and PP space respectively. Similar to those in W{W} space, we plot the marginal distributions of latent codes in PP space and observed that they appear to follow a simple Gaussian-like distribution. We plot the pairwise joint distribution of latent codes (See Fig. 1b) and observe that the dimensions are not statistically independent. Based on the marginal plots, we suspected that the distribution may be a Multivariate Normal Distribution, so we performed a Henze-Zirkler (Henze and Zirkler, 1990) test for multivariate normality in 512 dimensions, using 1,000 samples, the resulting test indicates that the data is not normal, with a significance of α=5%\alpha=5\%. We also used a Mardia test (Mardia, 1974, 1970) of multivariate normality, which is based on a measurement of multivariate skewness, and kurtosis. The Mardia test had similar results; the distribution is not normal, with a significance of 5%5\%. We tested the marginal distribution of the data along each principal component axis, and found that 219 of the 512 marginal are normal at 5%5\% significance according to the Mardia test. We show two marginal distributions where the Mardia statistic indicates that the data is not normal in Fig 3. Since the distribution visually appears to have a unimodal bell-shaped marginal distribution when we look at a single axis, we used a Dip test (Hartigan and Hartigan, 1985) for unimodality and confirmed that the multivariate distribution does indeed have a single peak. Although the distribution is not a multivariate normal distribution, is it unimodal and has correlated features. Visual inspection of Fig 1 and Fig 3 indicates that even if it is not normal, the data could be well-approximated by a normal distribution. Another reason why the data cannot be a true normal distribution is because the mapping network uses an MLP architecture. Such an architecture creates a distribution with compact support, and the generated latent variables cannot be arbitrarily large. This motivates us to introduce the PNP_{N} Space in which the latent distribution is easier to characterize.

Our PNP_{N} space is inspired by principal component analysis (PCA) whitening, and aims to eliminate the dependencies among latent variables in PP space. We define a transformation from PP to our PNP_{N} space as:

where Λ\mathbf{\Lambda} is a diagonal matrix of singular values, U\mathbf{U} is an orthogonal matrix of principal component directions, and μ\boldsymbol{\mu} is a mean vector. Intuitively, this whitening, or sphering, transform maps the distribution of each latent variable to be of zero mean and unit variance. As a result, the latent distribution in our PNP_{N} space will look like a ball that is isotropic in all directions (Fig. 1c).

The L2L2 norm v^\|\hat{\mathbf{v}}\| is related to the Mahalanobis distance dM()d_{M}(\cdot) of points xN(μ,Σ)\mathbf{x}\sim N(\boldsymbol{\mu},\mathbf{\Sigma}) with the singular value decomposition of symmetric Σ=UΛUT\mathbf{\Sigma}=\mathbf{U}\mathbf{\Lambda}\mathbf{U}^{T}, that is

This space has useful properties for regularizing our embedding algorithm because it biases the solution towards the mode μ\boldsymbol{\mu} of embeddings, and it is more sensitive (regularization has more effect) to directions of low variance in the space used when training the GAN. The effect of this space on latent codes is illustrated in Fig 4

We are inspired by generalized Tikhonov regularization, which biases latent codes to more dense portions of the latent space. Unlike truncation, this regularization approach has a much greater effect on subspaces where the input distribution has higher precision, and it has less effect in subspaces where the input distribution has high variance. Simply shifting a latent code towards the origin in W+{W}+ space would, for example, also change the components of the latent code that are important for reconstruction. On the other hand, regularizing based on dMd_{M} (i.e. in PNP_{N} space) has the desirable effect that it preserves components that also have high variation in the training corpus.

Without regularization, editing tasks are affected because images contain elements that are not modeled by the GAN, so that their embedding can end up in a less-explored region of the embedding space, where the GAN may be more likely to produce low quality results even though the particular image being inverted seems plausible. This effect can be observed by comparing the negative log-density (the Mahalanobis distance, dM2=v^2d^{2}_{M}=\|\hat{\mathbf{v}}\|^{2}) vs the number of optimization steps for GAN inversion with and without regularization, shown in Fig 5. Reconstruction quality is improved by a negligible amount, whereas the log-density becomes arbitrarily high. An edit operation shifts the embedding to a new location, so if the original embedding was in a high density part of the embedding space the perturbed embedding is also likely to be nearby in a high density region. However, in the low-density portion of the space, a perturbed image will also have a low-density and since it is not the result of inverting a ‘real world’ image it may be perceived as low quality or unrealistic.

To verify the validity of our PNP_{N} space, we sample from a standard Normal distribution in PNP_{N} space and compare the FID scores we get with those of StyleGAN2 (Karras et al., 2020b). PNP_{N} space sampling yields an FID of 3.283.28 compared to an FID of 2.812.81. Such as small difference supports the validity of our PNP_{N} space. By contrast, fitting a normal distribution to W{W} space and sampling from it yields an FID of 76.6376.63. Although good for characterization of latent distributions, PNP_{N} space is too restrictive for image embedding. To this end, we extend it to PN+P_{N}^{+} space following I2S (Abdal et al., 2019).

P_{N}^{+} Space: Similar to the extension from W{W} space to W+{W}+ space in which 18 different 512-dimensional W{W} latents (wi\mathbf{w}_{i}) are concatenated (Abdal et al., 2019),

we extend PNP_{N} space to PN+P_{N}^{+} space as

Improved I2S

One important aspect of I2S is to use a perceptual regularizer based on VGG-perceptual loss (Simonyan and Zisserman, 2014). However, we find that using LPIPS (Zhang et al., 2018) results in a noticeable improvement. Following PULSE (Menon et al., 2020) we also propose to use bicubic downsampling on the generated images and Lanczos downsampling (Turkowski, [n.d.]) on the reference image. We did not use Lanczos for both as it is not differentiable. Nevertheless, we observed that the current setup works better than using bicubic sampling for both cases.

P_{N}^{+} Density Based Loss Based on our results, it seems most promising to devise a regularizer that penalizes an embedding if it goes too far from the center in PN+P_{N}^{+}. Let II be the input image, L=LLPIPS+L2L=L_{LPIPS}+L_{2} be a loss function consisting of LPIPS and pixel-wise L2 loss terms, w+\mathbf{w^{+}} and v\mathbf{v} be the latent codes in W+W^{+} and PN+P_{N}^{+} space respectively, and λ\lambda is a hyperparameter controlling the amount of regularization. We have:

3. Implementation Details

For our method, we used a learning rate of 0.01 with 1300 steps for all images. We used the ADAM optimizer with standard settings to obtain the results.

Evaluation

The purpose of this section is to provide an extensive evaluation and comparison of different embedding algorithms. We propose a sequence of tasks for that purpose.

We extensively tested many methods that have code available and selected the methods that performed best for a more detailed comparison. We compare our proposed II2S method (Section 4) with the following state-of-the-art methods:

I2S (Abdal et al., 2019) is the baseline method we would like to improve upon which embeds images into the W+{W}+ space.

PULSE (Menon et al., 2020) proposed embedding onto the surface of a hypersphere in ZZ space.

StyleGAN2 (Karras et al., 2020b) embeds images into the W space with the help of noise regularization.

StyleGAN2Encoder (robertluxemburg, 2020) embeds images into the W+{W}+ space using logcosh image loss, MS-SSIM loss, L1 penalty on latents and several other losses. In addition, they also use early stopping to prevent overfitting.

pSp (Richardson et al., 2020) proposes a novel encoder architecture to map the given image to the W+{W}+ space. The method is concurrently developed and only available on arXiv. However, we include it to make the comparison stronger.

Note that we updated I2S and PULSE to use StyleGAN2 and adjusted the hyperparameter settings for I2S to limit overfitting. We do not compare to the IDInvert method (Zhu et al., 2020) and Multi-code embedding (Gu et al., 2020) because they only work on the original StyleGAN architecture (Karras et al., 2019) at a low resolution of 256×256256\times 256. We also do not use noise embedding as proposed by I2S++ (Abdal et al., 2020a) because it is too hard to control with respect to editing quality.

For the evaluation, it is important to use a set of test images that were not part of the set used to train SyleGAN2. We collected a dataset of 120 images from the website Unsplash. The remaining subsections describe the tasks and metrics used to evaluate the system.

In this work, we measure the reconstruction quality of an embedding both i) absolutely using RMSE, PSNR and ii) perceptually using SSIM, VGG perceptual similarity, LPIPS perceptual similarity and the FID (Heusel et al., 2017) score between the input and embedded image. The results are shown in Table 1. Our method II2S with λ=0.001\lambda=0.001 and I2S are either ranked first or second across all metrics, except SSIM. However, we note that the metrics are less important than perceptual user evaluations. Table 2 presents a user study for a stronger regularized setting with λ=0.005\lambda=0.005. This is our recommended setting for the best compromise between editing quality and reconstruction quality. Here, II2S reconstruction results were accepted by users more than any competing method except I2S. In Fig. 6, we show the reconstruction quality. Notice that other methods can have visual artifacts or differ substantially from the original for some examples when viewing the embedding results at higher resolution.

2. Editing Quality

Unlike reconstruction, the editing quality of an embedding has not been studied, because competitive editing frameworks just became available very recently (Shen et al., 2020; Härkönen et al., 2020; Tewari et al., 2020b; Abdal et al., 2020b). Note that these editing frameworks are orthogonal to our work, as they do not propose new embedding algorithms. We choose StyleFlow (Abdal et al., 2020b) as our main evaluation method for editing as it generally leads to the highest quality edits.

We propose to test the editing quality using the following editing operations: pose, age, and lighting. For the pose editing task, we set the target yaw of each image to 20∘. To edit age, we set the target age to 50 years old. In lighting change experiments, we set the target light direction to point towards the viewer’s right. In Fig. 7, we visually compare editing results of different methods. Notice how our method keeps the identity of the original image and preserves the realism after the edits.

The user study results presented in Table 2 show that editing operations on latent codes derived by II2S maintain image quality across different editing tasks. Our editing results are preferred to the edits of other methods for all tasks. Somewhat surprisingly, SG2 is the second-best method for editing. Based on our visual analysis of the results, we observe the following problem. Some embedding algorithms compute latent codes that cannot be edited well. After an edit, the new latent code may produce a new image that is very similar and did not fully accomplish the editing task. For example, when performing an edit to change the age, PULSE produces results that look noticeably younger than the target age. We further study this phenomenon using the state-of-the-art classifier Microsoft Face API (Microsoft, 2020) in supplementary materials.

3. Conditional Embedding Quality

We consider four conditional embedding applications: image colorization, inpainting, super resolution, and style transfer. Let II be an input “condition” image, and GG be a StyleGAN generator. Conditional embedding aims to locate an optimal latent code w+{\mathbf{w}^{+}}^{*} in W+W^{+} space so that the embedded image G(w+)G({\mathbf{w}^{+}}^{*}) i) faithfully captures the “condition” of II and ii) is a realistic face image. Accordingly, we define conditional embedding as:

where ff is a “condition” function that modifies an image to satisfy a pre-defined condition (e.g. grayscale), LL is a loss function measuring the similarity between two images (e.g. pixel-wise L2L2 loss, perceptual loss), λ\lambda is a hyperparameter, and RR is the regularizer. Note that the only difference between ordinary and conditional embedding is the incorporation of ff.

For image colorization, the input image II is a grayscale image and the condition function ff coverts a color image to grayscale. For inpainting, the input image II is an incomplete image and the condition function ff is a mask function that erases the pixels in a given region. In our tests, the missing region is half the image. For super resolution, the input image II is a 32×3232\times 32 low-resolution image and the condition function ff is a downsampling function.

The style transfer task is accomplished using a different approach. Let GG and GG^{\prime} be two StyleGAN generaters, GG is trained on the FFHQ dataset and GG^{\prime} is a variant of GG fine-tuned on the MetFace (Karras et al., 2020a) dataset. Our style transfer is implemented by embedding the input image into GG and then evaluating the resulting latent code using GG^{\prime}.

The corresponding user study results for all four applications are presented in Table 2. Examples of visual results for the first three tasks are shown in Fig. 8 and results for style transfer are shown in Fig. 7. From the user study we can note that users ranked our image colorization results to be the most successful. Surprisingly, they are ranked even more realistic than the ground truth images. We attribute this to the fact that several ground truth images are stylized photographs. For the superresolution results, we asked users which image was closest to the ground truth. Our result is clearly preferred to all published competitors, I2S and PULSE. While our results are also better than pSp, they are not statistically significant. For inpainting we also significantly outperform all competitors. This is the only result where our method clearly looses to the ground truth. We ascribe this to the fact that we do inpainting for a very large missing region (half the image). This is a very challenging task. For pSp we could not complete the colorization and inpainting comparisons because pSp needs to pre-train a separate encoder for each task. Corresponding encoders were not provided by the authors. Similarly, we did not compare to SG2 and S2E on the first three tasks. This would have required us to reimplement conditional embedding in TensorFlow.

4. User Studies

We carried out a series of user studies using Amazon Mechanical Turk (MTurk). For each task, images were generated using II2S and a competing method. Each pair of images was presented to workers on Amazon Mechanical Turk twice, once in the order (II2S, Source, Other), and once in the reverse order, so that preferences for the image based on its position in the survey would not be an issue. Users were given a prompt to select the image that best accomplishes the task with the fewest artifacts. Table 2 shows the percentage of responses that selected a II2s over a competing method, and a number above 50% means that the II2S solution was selected more frequently. Each survey received 120 responses, so any number below 40% or above 60% is statistically significant at 95% confidence. II2S outperforms competing methods on most tasks, with only a few exceptions. Reconstruction results are better with I2S, however I2S is effectively the same approach without regularization, and thus one would expect it to do better at reconstruction and poorer for editing tasks. The pSp approach for editing age was favored by more users, however the results were not statistically significant. For conditional GAN tasks, II2S is outperformed by Ground Truth, which is expected. To summarize, we argue that our evaluation demonstrates that our proposed regularizer has a significant impact on downstream applications.

5. Ablation Study

The most important parameter in our method is the strength of the regularizer. Based on many experiments, we manually selected three settings of λ\lambda to compare to: 0.010.01, 0.0050.005, and 0.0010.001. These settings were selected so that a visual difference is noticeable between images generated from the embeddings. In Fig. 6 we show the visual difference between λ=0.005\lambda=0.005 and λ=0.001\lambda=0.001. In Tab. 1 we show how λ\lambda affects reconstruction metrics. However, reconstruction metrics are not as informative as human perception. A user study to evaluate different choices of λ\lambda is shown in Table 3, and based on the average user response we picked λ=0.005\lambda=0.005 for all tests in the paper as a trade-off between reconstruction and editing quality.

6. Histogram of the Embeddings

We visually analyze the histograms in the PN+P_{N}^{+} space to obtain additional insights about the different embedding algorithms. To compute the histograms we embed the 120 images of our dataset using the different algorithms. Then we take the 20th20^{th} dimension of each latent code in PN+P_{N}^{+}. For all methods except SG2, there are 18 such latent codes per embedded image. For SG2, we repeat the same value 18 times. In Fig. 9 we show the histograms. For the first histogram, denoted by I2S Overfitting, we run I2S with a high learning rate. As we know that this setting leads to overfitting, we can observe that overfitting correlates with a histogram that is wider, has higher variance, and more outliers. The histograms of the encoders, pSp and S2E, have the lowest variance, indicating that the embedded latent codes are closer to the origin of PN+P_{N}^{+}. It is our conjecture that narrow histograms correlate with underfitting. The histogram for SG2 looks very strange. This might be due to the fact that SG2 has fewer unique samples. Still, the variance is significantly higher than we would have expected.

Limitations, Future Work, and Conclusion

Our work has some limitations that we leave to future work. One limitation is that we did not investigate correlations between the (18) different components of an extended latent space. From sampling new latent codes in Z+Z^{+} space, we know that sampling the 18 components independently leads to poor results. However, it is unclear if their similarity should be enforced by an additional regularizer, as we could not really observe a consistent improvement when experimenting with different regularizers proposed in the literature (e.g. hierarchical optimization or an L2L2 similarity term). In the future, we would like to revisit this topic.

We introduced the PNP_{N} space as a tool to facilitate improved StyleGAN embedding and to analyze different embedding algorithms. The switch to PNP_{N} space can significantly help follow-up work. We proposed a new regularizer for StyleGAN embedding that provides the best trade-off between reconstruction quality and editing quality. Finally, we conducted an extensive evaluation, highlighting the strength and weaknesses of previous work. The evaluation demonstrates that our results clearly outperform all competing methods for downstream applications.

References

Appendix A Metrics

We choose StyleFlow (Abdal et al., 2020b) as our main evaluation method for editing as it generally leads to the highest quality edits. In addition, we compare against another editing approach, GANSpace (Härkönen et al., 2020) in this supplemental material.

We propose to test the editing quality using the following editing operations: pose, age, lighting, gender and eyeglasses. For the pose editing task, we set the target yaw of each image to 20∘. To edit age, we set the target age to 50 years old. In lighting change experiments, we set the target light direction to point towards the viewer’s right. For the gender transfer task, we swap the gender of the input image. In eyeglasses experiments, we add eyeglasses to each image. Note that the only conditional edit is the gender swap. Here the goal of the edit depends on the input image. For other edits, there is a fixed goal, such as adding eyeglasses. If the person had eyeglasses before, the image is not supposed to change. Similarly, for the pose, there is a fixed target pose. Some images are expected to change more than others under these edits. Images that are already in the target pose are expected not to change.

We already show examples of pose, age, and lighting in the main paper. In Fig. 10, we visually compare the remaining editing results (gender, eyeglasses and lighting+pose) of different methods. Notice how our method keeps the identity of the original image and preserves the realism after the edits. Quantitative results for various edits are presented in Table 4. To create the table, attributes were measured using Microsoft’s face API (Microsoft, 2020). Lighting is measured by a different network (Zhou et al., 2019). Overall, our method has the best results. pSp is very slightly better than ours in two edits, but clearly worse in two others.

In addition to using StyleFlow (Abdal et al., 2020b) as the evaluation method of editing quality, for the pose change experiments, we use the right-left pose edit from GANSpace (Härkönen et al., 2020). Specifically, for a latent code in the GANSpace coordinate system, we can set the coordinate corresponding to pose to five different values: -2σ\sigma, -σ\sigma, 0, σ\sigma, and +2σ\sigma, where σ\sigma is the eigenvalue for the direction. Fig. 11 shows the qualitative results of pose change edits. Quantitative results are presented in Table 5. We observe that the strength of an edit depends on the initial latent code and the embedding method. This poses a challenge for the evaluation of different embedding methods using GANSpace.

A.2. Linear Interpolation

Linear interpolation of latent codes can generate a morph between two embedded images. It is also a powerful tool to determine whether an embedding is semantically meaningful. In other words, we can tell if an embedding is good if the interpolated images between it and a randomly sampled image are of high quality. To this end, we test the interpolation results in the W+W^{+} space. Specifically, we compute the FIDs between the 120 images of our dataset and 2,500 interpolated images obtained by i) sampling 500 image pairs from the dataset and ii) interpolating 5 images for each pair at proportions 0.1, 0.25, 0.5, 0.75 and 0.9. Table 6 shows the results on various methods. Qualitative results are shown in Fig. 15. We propose the use of PN+P_{N}^{+} as a regularizer, however it is a nonlinear mapping from W+{W}+ space, which can negatively impact entanglement. However, we show the results of linear interpolation in Fig. 16, While we have the best quantitative results together with I2S one has to consider that FID is only calculated on a smaller set of images (2500 instead of 50000). While several other authors also report FID on smaller sets of images for editing and manipulation tasks, the metric is not entirely conclusive. For the qualitative results, it is important to mention that our method has the best reconstruction quality.

A.3. Style Mixing

As two sides of the same coin, the results of style mixing and structural edits (e.g. pose editing) both reflect how good a latent disentangles the style and contents at different layers of the StyleGAN generator. Thus, it is also worthwhile to check whether an embedding enables high-quality style mixing. We take the variables from the first 7 layers from one image and from the remaining 11 layers from another image and test the FID of the results with the original images.

Table 6 shows the result of style mixing on various methods. Qualitative results are shown in Fig. 17. Again, even though our method has the best results, FID is calculated for a smaller set of 500 images. Also, for the qualitative results, it’s important to consider that our method has the best reconstruction quality.

Appendix B Ablation Study

We conducted two additional ablation studies for the supplementary materials. The first ablation study compares the results when embedding in Z+Z^{+} space rather than W+W^{+} space. While other authors advocate for embedding in Z+Z^{+} space, we obtain clearly worse results in our implementation. Specifically, we observe artifacts for several of the embedded images. A quantitative evaluation in shown in Table 7.

Another ablation study investigates the result of the different downsampling operation and the effect of choosing LPIPS as regularizer over VGG. The different downsampling operation has a very minor effect on the results, but exchanging VGG for LPIPS leads to significant and important differences. We show quantitative results in Table 8 and qualitative results in Fig. 12.

Appendix C Looking at the “Eyes” and “Mouth”

Several existing evaluations in previous work may overemphasize reconstruction quality in the hyperparameter settings, when the goal it editing. For example, we could observe that Zhu et al. (Zhu et al., 2020) and Tewari et al. (Tewari et al., 2020a) use suboptimal I2S (Abdal et al., 2019) hyperparameter settings for some comparisons. One simple test is to check the visual realism of the eyes and teeth during the embedding to observe the transition from reasonable editing quality to overfitting and poor editing quality. In Fig. 18 we show a progression of the embedding process with closeup insets of the eyes of the original I2S algorithm. This simple test is of high practical importance. Our proposed regularizer is very important, because it is too difficult and impractical to set the number of iterations for each image separately for I2S. While it is too time-consuming to do this for our complete dataset, we believe that I2S results would improve using per image fine-tuning. See Fig. 14 for a visualization how the regularizer can prevent overfitting. This makes a big difference for eyes and teeth.

Appendix D Visual Explanation of the Pulse Regularizer Problem

To better illustrate the problem of the Pulse regularizer, we perform an experiment of repeatedly embedding the same image. For most methods, embedding the same image multiple times leads to almost the same result. However, the Pulse regularizer uses a projection onto a subset of the latent space and a random initialization. This Pulse subset has high quality, but overall the restriction is unnecessarily restrictive. Also, the initial starting point and the location of the initial projection has a big influence on the final result. We believe Pulse is the only method embedding method that gives widely different results for the same input. Also, if the random initialization of Pulse is unlucky, the result of the embedding will be very different from the input image. See Fig. 13 for an example.