Deep Automodulators

2019·Arxiv

Abstract

Abstract

We introduce a new category of generative autoencoders called automodulators. These networks can faithfully reproduce individual real-world input images like regular autoencoders, but also generate a fused sample from an arbitrary combination of several such images, allowing instantaneous ‘style-mixing’ and other new applications. An automodulator decouples the data flow of decoder operations from statistical properties thereof and uses the latent vector to modulate the former by the latter, with a principled approach for mutual disentanglement of decoder layers. Prior work has explored similar decoder architecture with GANs, but their focus has been on random sampling. A corresponding autoencoder could operate on real input images. For the first time, we show how to train such a general-purpose model with sharp outputs in high resolution, using novel training techniques, demonstrated on four image data sets. Besides style-mixing, we show state-of-the-art results in autoencoder comparison, and visual image quality nearly indistinguishable from state-of-the-art GANs. We expect the automodulator variants to become a useful building block for image applications and other data domains.

1 Introduction

This paper introduces a new category of generative autoencoders for learning representations of image data sets, capable of not only reconstructing real-world input images, but also of arbitrarily combining their latent codes to generate fused images. Fig. 1 illustrates the rationale: The same model can encode input images (far-left), mix their features (middle), generate novel ones (middle), and sample new variants of an image (conditional sampling, far-right). Without discriminator networks, training such an autoencoder for sharp high resolution images is challenging. For the first time, we show a way to achieve this.

Recently, impressive results have been achieved in random image generation (e.g., by GANs [5, 14, 25]). However, in order to manipulate a real input image, an ‘encoder’ must first infer the correct representation of it. This means simultaneously requiring sufficient output image quality and the ability for reconstruction and feature extraction, which then allow semantic editing. Deep generative autoencoders provide a principled approach for this. Building on the PIONEER autoencoder [18], we proceed to show that modulation of decoder layers by leveraging adaptive instance normalization (AdaIn, [12, 23, 44]) further improves these capabilities. It also yields representations that are less entangled, a property here broadly defined as something that allows for fine and independent control of one semantic (image) sample attribute at a time. Here, the inductive bias is to assume each such attribute to only affect certain scales, allowing disentanglement [33]. Unlike [23], previous GAN-based works on AdaIn [6, 25] have no built-in encoder for new input images.

In a typical autoencoder, input images are encoded into a latent space, and the information of the latent variables is then passed through successive layers of decoding until a reconstructed image has been formed. In our model, the latent vector independently modulates the statistics of each layer of the decoder so that the output of layer n is no longer solely determined by the input from layer

Figure 1: Illustration of some automodulator capabilities. The model can directly encode real (unseen) input images (left). Inputs can be mixed by modulating one with another or with a randomly drawn sample, at desired scales (center); e.g., ‘coarse’ scales affect pose and gender etc. Finally, taking random modulations for certain scales produces novel samples conditioned on the input image (right).

A key idea in our work is to reduce the mutual entanglement of decoder layers. For robustness, the samples once encoded and reconstructed by the autoencoder could be re-introduced to the encoder, repeating the process, and we could require consistency between the passes. In comparison to stochastic models such as VAEs [28, 40], our deterministic model is better suited to take advantage of this. We can take the latent codes of two separate samples, drive certain layers (scales) of the decoder with one and the rest with the other, and then separately measure whether the information contained in each latent is conserved during the full decode–encode cycle. This enforces disentanglement of layer-specific properties, because we can ensure that the latent code introduced to affect only certain scales on the 1st pass should not affect the other layers on the 2nd pass, either.

In comparison to implicit (GAN) methods, regular image autoencoders such as VAEs tend to have poor output image quality. In contrast, our model simultaneously balances sharp image outputs with the capability to encode and arbitrarily mix latent representations of real input images.

The contributions of this paper are as follows. (i) We provide techniques for stable fully unsupervised training of a high-resolution automodulator, a new form of an autoencoder with powerful properties not found in regular autoencoders, including scale-specific style transfer [13]. In contrast to architecturally similar ‘style’-based GANs, the automodulator can directly encode and manipulate new inputs. (ii) We shift the way of thinking about autoencoders by presenting a novel disentanglement loss that further helps to learn more disentangled representations than regular autoencoders, a principled approach for incorporating scale-specific prior information in training, and a clean scale-specific approach to attribute modification. (iii) We demonstrate promising qualitative and quantitative performance and applications on FFHQ, CELEBA-HQ, and LSUN Bedrooms and Cars data sets.

2 Related Work

Our work builds upon several lines of previous work in unsupervised representation learning. The most relevant concepts are variational autoencoders (VAEs, [28, 40]) and generative adversarial networks (GANs, [14]). In VAEs, an encoder maps data points to a lower dimensional latent space and a decoder maps the latent representations back to the data space. The model is learnt by minimizing the reconstruction error, under a regularization term that encourages the distribution of latents to match a predefined prior. Latent representations often provide useful features for applications (e.g., image analysis and manipulation), and allow data synthesis by random sampling from the prior. However, with images, the samples are often blurry and not photorealistic, with imperfect reconstructions.

Current state-of-the-art in generative image modeling is represented by GAN models [5, 25, 26] which achieve higher image quality than VAE-based models. Nevertheless, these GANs lack an encoder for obtaining the latent representation for a given image, limiting their usefulness. In some cases, a given image can be semantically mapped to the latent space via generator inversion but this iterative process is prohibitively slow for many applications (see comparison in App. G), and the result may depend on initialization [1, 8].

Bidirectional mapping has been targeted by VAE-GAN hybrids [30, 34–36], and adversarial models [10, 11]. These models learn mappings between the data space and latent space using combinations of encoders, generators, and discriminators. However, even the latest state-of-the-art variant BigBiGAN [9] focuses on random sampling and downstream classification performance, not on faithfulness of reconstructions. InfoGAN [7, 32] uses an encoder to constrain sampling but not for full reconstruction. IntroVAE [22] and Adversarial Generator Encoder (AGE, [45]) only comprise an encoder and a decoder, adversarially related. PIONEER scales AGE to high resolutions [17, 18]. VQ-VAE [39, 47] achieves high sample quality with a discrete latent space, but such space cannot, e.g., be interpolated, which hinders semantic image manipulation and prevents direct comparison.

Architecturally, our decoder and use of AdaIn are similar to the recent StyleGAN [25] generator (without the ‘mapping network’ f), but having a built-in encoder instead of the disposable discriminator leads to fundamental differences. AdaIn-based skip connections are different from regular (non-modulating) 1-to-many skip connections from latent space to decoder layers, such as, e.g., in BEGAN [3, 31]. Those skip connections have not been shown to allow ‘mixing’ multiple latent codes, but merely to map the one and the same code to many layers, for the purpose of improving the reconstruction quality. Besides the AGE-based training [45], we can, e.g., also recirculate style-mixed reconstructions as ‘second-pass’ inputs to further encourage the independence and disentanglement of emerging styles and conservation of layer-specific information. The biologically motivated recirculation idea is conceptually related to many works, going back to at least 1988 [20]. Utilizing the outputs of the model as inputs for the next iteration has been shown to benefit, e.g., image classification [49], and is used extensively in RNN-based methods [15, 16, 41].

3 Methods

We begin with the primary underlying techniques used to construct the automodulator: the progressive growing of the architecture necessary for high-resolution images and the AGE-like adversarial training as combined in the PIONEER [17, 18], but now with an architecturally different decoder to enable ‘modulation’ by AdaIn [12, 23, 25, 44] (Sec. 3.1). The statistics modulation allows for multiple latent vectors to contribute to the output, which we leverage for an improved unsupervised loss function in Sec. 3.2. We then introduce an optional method for weakly supervised training setup, applicable when there are known scale-specific invariances in the training data itself Sec. 3.3.

3.1 Automodulator Components

Our overall scheme starts from unsupervised training of a symmetric convolution–deconvolution autoencoder-like model. Input images x are fed through an encoder to form a low-dimensional latent space representation z (we use , normalized to unity). This representation can then be decoded back into an image through a decoder

Adversarial generator encoder loss To utilize adversarial training, the automodulator training builds upon AGE and PIONEER. The encoder and the decoder are trained on separate steps, where attempts to push the latent codes of training images towards a unit Gaussian distribution N(0, I), and the codes of random generated images away from it. attempts to produce random samples with the opposite goal. In consecutive steps, one optimizes loss and [45], with margin for [18] (negative KL term of dropped, as customary [17, 46]), defined as

where x is sampled from the training set, is L1 or L2 distance, and is the cosine distance. The KL divergence can be calculated from empirical distributions of and . Still, the model inference is deterministic, so we could retain, in principle, the full information contained in the image, at every stage of the processing. For any latent vector z, decoded back to image space as , and re-encoded as a latent , it is possible and desirable to require that z is as close to as possible, yielding the latent reconstruction error . We will generalize this term in 3.2.

Progressively growing autoencoder architecture To make the AGE-like training stable in high resolution, we build up the architecture and increase image resolution progressively during training,

Figure 2: (a) The autoencoder-like usage of the model. (b) Modulations in the decoder can come from different latent vectors. This can be leveraged in feature/style mixing, conditional sampling, and during the model training (first pass). (c) The second pass during training, yielding

starting from tiny images and gradually growing them, making the learning task harder (see [17, 24] and Supplement Fig. 7). The convolutional layers of the symmetric encoder and decoder are faded in gradually during the training, in tandem with the resolution of training images and generated images (Fig. 7).

Automodulation To build a separate pathway for modulation of decoder layer statistics, we need to integrate the AdaIn operation for each layer (following [25]). In order to generate an image, a traditional image decoder would start by mapping the latent code to the first deconvolutional layer to form a small-resolution image () and expand the image layer by layer () until the full image is formed. In contrast, our decoder is composed of layer-wise functions separately take a ‘canvas’ variable denoting the output of the preceding layer (see Figs. 2a and 7), and the actual (shared) latent code z. First, for each feature map #j of the deconvolutional layer #i, we compute the activations from as in traditional decoders. But now, we modulate (i.e., re-scale) into having a new mean and standard deviation , based on z (e.g., a block of four layers with 16 channels uses scalars). To do this, we need to learn a mapping . We arrive at the AdaIn normalization (also see App. B):

We implement as a fully connected linear layer (in ), with output size for channels. Layer #1 starts from a constant input . Without loss of generality, here we focus on pyramidal decoders with monotonically increasing resolution and decreasing number of channels.

3.2 Conserving Scale-specific Information Over Cycles

We now proceed to generalize the reconstruction losses in a way that specifically benefits from the automodulator architecture. We encourage the latent space to become hierarchically disentangled with respect to the levels of image detail, allowing one to separately retrieve ‘coarse’ vs. ‘fine’ aspects of a latent code. This enables, e.g., conditional sampling by fixing the latent code at specific decoder layers, or mixing the scale-specific features of multiple input images—impossible feats for a traditional autoencoder with mutually entangled decoder layers.

First, reinterpret the latent reconstruction error in Eq. (2) as ‘reconstruction at decoder layer #0’. One can then trivially generalize it to any layer #by measuring differences in , instead. We simply pick a layer of measurement, record , pass the sample through a full encoder–decoder cycle, and compare the new . But now, in the automodulator, different latent codes can be introduced on a per-layer basis, enabling us to measure how much information about a specific latent code is conserved at a specific layer, after one more full cycle. Without loss of generality, here we only consider mixtures of two codes. We can present the output of a decoder (Fig. 2b) with N layers, split after the one, as a composition Crucially, we can choose (extending the method of [25]), such as and for (image) inputs . Because the earlier layers #1:j operate on image content at lower (‘coarse’) resolutions, the fusion image has the ‘coarse’ features of and the ‘fine’ features of . Now, any z holds feature information at different levels of detail, some empirically known to be mutually independent (e.g., skin color and pose), and we want them separately retrievable, i.e., to keep them ‘disentangled’ in z. Hence, when we re-encode into , then should extract the same output as , unaffected by

This motivates us to minimize the layer disentanglement loss

for some distance function d (here, L2 norm), with . In other words, the fusion image can be encoded into a new latent vector

in such a way that, at each layer, the decoder will treat the new code similarly to whichever of the original two separate latent codes was originally used there (see Fig. 2c). For a perfect network, can be viewed as a ‘layer entanglement error’. Randomizing j during the training, we can measure for any layers of the decoder. A similar loss for the later stage is also possible, but due to more compounded noise and computation cost (longer cycle), was omitted for now.

Figure 3: Breakdown of the 1-pass flow loss terms.

Full unsupervised loss We expect the fusion images to increase the number of outliers during training. To manage this, we replace L1/L2 in Eq. (1) by a robust loss generalizes various norms via an explicit parameter vector remains as in Eq. (1) but with

where with , and , with a set 3:4 ratio of regular and mixed samples for batch size from Eq. (5). Margin , except for CELEBAHQ and Bedrooms HQ ). To avoid discontinuities in , we introduce a progressively-growing variation of , where we first learn the in the lowest resolution (e.g., ). There, each corresponds to one pixel Then, whenever doubling the resolution, we initialize the new—now four times as large—in the higher resolution by replicating each to cover the new that now corresponds to and , in the higher resolution.

We summarize the final loss computation as follows. At the encoder training step (Fig. 3a)[45], we compute by first encoding training samples x into latents z, minimizing the KL divergence between the distribution of z and . Simultaneously, we encode randomly generated samples , maximizing their corresponding divergence from . We also decode each z into , with the reconstruction error 3 . At the decoder training step, we first compute the 1-pass terms of (Fig. 3b) by generating random samples , each decoded from either a single or a mixture pair drawn from N(0, I). We encode each into and minimize the KL divergence between their distribution and . We compute the latent reconstruction error between each z and its re-encoded counterpart . Finally, for , we do the second pass, adding the term (see Fig. 2c).

3.3 Enforcing Known Invariances at Specific Layers

As an extension to the main approach described so far, one can independently consider the following. The architecture and the cyclic training method also allow for a novel principled approach to leverage known scale-specific invariances in training data. Assume that images and have identical characteristics at some scales, but differ on others, with this information further encoded into and , correspondingly. In the automodulator, we could try to have the shared information affect only the decoder layers #, we then must have Assume that it is possible to represent the rest of the information in the images of that data set in layers #. This situation occurs, e.g., when two images are known to differ only in high-frequency properties, representable in the ‘fine’ layers. By mutual independence of layers, our goal is to have interchangeable at the middle:

which turns into the optimization target (for some distance function d)

By construction of , this is equivalent to directly minimizing

where . By symmetry, the complement term can be constructed by swapping . For each known invariant pair of the minibatch, you can now add the terms of Eq. (6). Note that in the case of to the regular sample reconstruction loss, revealing our formulation as a generalization thereof.

As we push the invariant information to layers #j:k, and the other information away from them, there are less layers available for the rest of the image information. Thus, we may need to add extra layers to retain the overall decoder capacity. Note that in a pyramidal deconvolutional stack where the resolution increases monotonically, if the layers #j:k span more than two consecutive levels of detail, the scales in-between cannot be extended in that manner.

4 Experiments

Since automodulators offer more applications than either typical autoencoders or GANs without an encoder, we strive for reasonable performance across experiments, rather than beating any specific metric. (Experiment details in App. A.) Any generative model can be evaluated in terms of sample quality and diversity. To measure them, we use Fréchet inception distance (FID) [19], which is comparable across models when sample size is fixed [4], though notably uninformative about the ratio of precision and recall [29]. Encoder–decoder models can further be evaluated in terms of their ability to reconstruct new test inputs, which underlies their ability to perform more interesting applications such as latent space interpolation and, in our case, mixing of latent codes. For a similarity metric between original and reconstructed face images (center-cropped), we use LPIPS [50], a metric with better correspondence to human evaluation than, e.g., traditional L2 norm.

The degree of latent space disentanglement is often considered the key property of a latent variable model. Qualitatively, it is the necessary condition for, e.g., style mixing capabilities. Quantitatively, one could expect that, for a constant-length step in the latent space, the less entangled the model, the smaller is the overall perceptual change. The extent of this change, measured by LPIPS, is the basis of measuring disentanglement as Perceptual Path Length (PPL) [25].

Table 1: Effect of loss terms on CELEBA-HQ at with 40M seen samples (50k FID batch) before applying layer noise.

We justify our choice of a loss function in Eq. (6), compare to baselines on relevant measures, demonstrate the style-mixing capabilities specific to automodulators, and show a proof-of-concept for leveraging scale-specific invariances (see Sec. 3.3). In the following, we use Eqs. (1) and (6), and polish the output by adding a source of unit Gaussian noise with a learnable scaling factor before the activation in each decoder layer, as in StyleGAN [25], also improving FID.

Ablation study for the loss metric In Table 1, we illustrate the contribution of the layer disentanglement loss and the robust loss on the FID for regular and mixed samples from the model at resolution, as well as PPL. We train the model variants on CELEBA-HQ [24] data set to convergence (40M seen samples) and choose the best of three restarts with different random seeds. Our hypothesis was that improves the FID of mixed samples and that replacing L1 sample reconstruction loss with improves FID further and makes training more stable. The results confirm this. Given the improvement from also for the mixed samples, we separately tested the effect of without and find that it produces even slightly better FID for regular samples but then considerably worse FID for the mixed ones, due to, presumably, more mutually entangled layers. For ablation of the term, see [18]. The effect of the term was studied in [45] (for cos instead of L2, see [46]).

Encoding, decoding, and random sampling To compare encoding, decoding, and random sampling performance, autoencoders are more appropriate baselines than GANs without an encoder, since the latter tend to have higher quality samples, but are more limited since they cannot manipulate real input samples. However, we do also require reasonable sampling performance from our model, and hence separately compare to non-autoencoders. In Table 2a, we compare to autoencoders: Balanced PIONEER [18], a vanilla VAE, and a more recent Wasserstein Autoencoder (WAE) [43]. We train on CELEBA-HQ, with our proposed architecture (‘AdaIn’) and the regular one (‘classic’). We measure LPIPS, FID (50k batch of generated samples compared to training samples, STD over 3 runs < 1 for all models) and PPL. Our method has the best LPIPS and PPL.

In Table 2b, we compare to non-autoencoders: StyleGAN, Progressively Growing GAN (PGGAN) [24], and GLOW [27]. To show that our model can reasonably perform for many data sets, we train at on CELEBA-HQ, FFHQ [25], LSUN Bedrooms and LSUN Cars [48]. We measure PPL and FID (uncurated samples in Fig. 4 (right), STD of FID over 3 runs < .1). The performance of the automodulator is comparable to the Balanced PIONEER on most data sets. GANs have clearly best FID results on all data sets (NB: a hyper-parameter search with various schemes was used in [25] to achieve their high PPL values). We train on the actual 60k training set of FFHQ only (StyleGAN trained on all 70k images). We also tested what will happen if we try invert the StyleGAN by finding a latent code for an image by an optimization process. Though this can be done, the inference is over 1000 times slower to meet and exceed the automodulator LPIPS score (see App. G and Fig. 16). We also evaluate the 4-way image interpolation capabilities in unseen FFHQ test images (Fig. 13 in the supplement) and observe smooth transitions. Note that in GANs without an encoder, one can only interpolate between the codes of random samples, revealing little about the recall ability of the model.

Style mixing The key benefit of the automodulators over regular autoencoders is the style-mixing capability (Fig. 2b), and the key benefit over style-based GANs is that ‘real’ unseen test images can be instantly style-mixed. We demonstrate both in Fig. 4. For comparison with prior work, we use the randomly generated source images from the StyleGAN paper [25]. Importantly, for our model, they appear as unseen ‘real’ test images. Performance in mixing real-world images is similar (Supplementary Figs. 14 and 15). In Fig. 4, we mix specific input faces (from source A and B) so that the ‘coarse’ (latent resolutions ), ‘intermediate’ () or ‘fine’ () layers of the decoder use one input, and the rest of the layers use the other.

Invariances in a weakly supervised setup In order to leverage the method of Sec. 3.2, one needs image data that contains pairs or sets that share a scale-specific prominent invariant feature (or, conversely, are identical in every other respect except that feature). To this end, we demonstrate a

Table 2: Performance in CELEBA-HQ (CAHQ), FFHQ, and LSUN Bedrooms and Cars. We measure LPIPS, Fréchet Inception Distance (FID), and perceptual path length (PPL). Resolution is . For all numbers, smaller is better. Only the ‘-AdaIn’ architectures are functionally equivalent to the automodulator (encoding and latent mixing). GANs in gray.

Figure 4: (Left): Feeding the random fake source images in Karras et al. [25] into our model as ‘real’ inputs, reconstructing at and mixing at three scales. (The same for real faces, see Supplement.) (Right): Uncurated random samples of

proof-of-concept experiment that uses the simplest image transformation possible: horizontal flipping. For CELEBA-HQ, this yields pairs of images that share every other property except the azimuth rotation angle of the face, making the face identity invariant amongst each pair. Since the original rotation of faces in the set varies, the flip-augmented data set contains faces rotated across a wide continuum of angles. For further simplicity, we make an artificially strong hypothesis that the 2D projected face shape is the only relevant feature at scale and does not need to affect scales finer than . This lets us enforce the loss for layers #1–2. Since we do not want to restrict the scale for the shape features alone, we add an extra layer after layer #2 of the regular stack, so that layers #2–3 both operate at , layer #4 only at that corresponds to the horizontally flipped counterpart of . Our choices amount to j = 3, k = N, allowing us to drop the outermost part of Eq. (9). Hence, our additional encoder loss terms are

Fig. 5a shows the results after training with the new loss (50% of the training samples flipped in each minibatch). With the invariance enforcement, the model forces decoder layers #1–2 to only affect the pose. We generate images by driving those layers with faces at different poses, while modulating the rest of the layers with the face whose identity we seek to conserve. The resulting face variations now only differ in terms of pose, unlike in regular automodulator training.

Scale-specific attribute editing Consider the mean difference in latent codes of images that display or do not display an attribute of interest (e.g., smile). Appropriately scaled, such codes can added to any latent code to modify that attribute. Here, one can restrict the effect of the latent code only to the layers driving the expected scale of the attribute (e.g., ), yielding precise manipulation (App. B, comparisons in Supplement) with only a few exemplars (e.g., [18] used 32).

Figure 5: Examples of controlling individual decoder layer ranges at training time and at evaluation time. (a) Training with face identity invariance enforcement under azimuth rotation. We generate images with the ‘non-coarse’ styles of source A and the ‘coarse’ ones from each top row image. With ‘Enforced identity invariance’, the top row only drives the face pose while conserving identity. In comparison, the ‘Regular’ training lets the top row also affect other characteristics, including identity. (b) Modifying an attribute in latent space by using only 4 exemplar images of it. In ‘regular’ all-scales manipulation, the variance in the exemplars causes unwanted changes in, e.g., texture and pose. When the latent vector only drives the relevant scales, the variance in other scales is inconsequential.

5 Discussion and Conclusion

In this paper, we proposed a new generative autoencoder model with a latent representation that independently modulates each decoder layer. The model supports reconstruction and style-mixing of real images, scale-specific editing and sampling. Despite the extra skill, the model still largely outperforms or matches other generative autoencoders in terms of latent space disentanglement, faithfulness of reconstructions, and sample quality. We use the term automodulator to denote any autoencoder that uses the latent code only to modulate the statistics of the information flow through the layers of the decoder. This could also include, e.g., 3D or graph convolutions.

Various improvements to the model are possible. The mixture outputs still show occasional artifacts, indicating that the factors of variation have not been perfectly disentangled. Also, while the layerinduced noise helps training, using it in evaluation to add texture details would often reduce output quality. Also, to enable even more general utility of the model, the performance could be measured on auxiliary downstream tasks such as classification.

Potential future applications include introducing completely interchangeable ‘plugin’ layers or modules in the decoder, trained afterwards on top of the pretrained base automodulator, leveraging the mutual independence of the layers. The affine maps themselves could also be re-used across domains, potentially offering mixing of different domains. Such examples highlight that the range of applications of our model is far wider than the initial ones shown here, making the automodulators a viable alternative to state-of-the-art autoencoders and GANs.

Our source code is available at https://github.com/AaltoVision/automodulator.

Broader Impact

The presented line of work intends to shift the focus of generative models from random sample generation towards controlled semantic editing of existing inputs. In essence, the ultimate goal is to offer ‘knobs’ that allow content editing based on high-level features, and retrieving and combining desired characteristics based on examples. While we only consider images, the techniques can be extended to other data domains such as graphs and 3D structures.

Ultimately, such research could reduce very complex design tasks into approachable ones and thus reduce dependency on experts. For instance, contrast an expert user of a photo editor or design software, carefully tuning details, with a layperson who simply finds images or designs with the desired characteristics and guiding the smart editor to selectively combine them.

Leveling the playing field in such tasks will empower larger numbers of people to contribute to design, engineering and science, while also multiplying the effectiveness of the experts. The downside of such empowerment will, of course, include the threats of deepfakes and spread of misinformation. Fortunately, public awareness of these abuses has been increasing rapidly. We attempt to convey the productive prospects of these technologies by also including image data sets with cars and bedrooms, while comparison with prior work motivates the focus on face images.

Acknowledgments and Disclosure of Funding

The authors wish to acknowledge the Aalto Science-IT project and CSC – IT Center for Science, Finland, for computational resources. Authors acknowledge funding from GenMind Ltd. This research was supported by the Academy of Finland grants 308640, 324345, 277685, 295081, and 309902. We thank Jaakko Lehtinen and Janne Hellsten (NVIDIA) for the StyleGAN latent space projection script (for the baseline, only) and advice on its usage. We also thank Christabella Irwanto, Tuomas Kynkäänniemi, and Paul Chang for comments on the manuscript.

References

[1] R. Abdal, Y. Qin, and P. Wonka. Image2StyleGAN: How to embed images into the StyleGAN latent space? In International Conference on Computer Vision (ICCV), 2019.

[2] J. T. Barron. A general and adaptive robust loss function. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 4331–4339, 2019.

[3] D. Berthelot, T. Schumm, and L. Metz. BEGAN: Boundary equilibrium generative adversarial networks. arXiv preprint arXiv:1703.10717, 2017.

[4] M. Binkowski, D. J. Sutherland, M. Arbel, and A. Gretton. Demystifying MMD GANs. In International Conference on Learning Representations (ICLR), 2018.

[5] A. Brock, J. Donahue, and K. Simonyan. Large scale GAN training for high fidelity natural image synthesis. In International Conference on Learning Representations (ICLR), 2019.

[6] T. Chen, M. Lucic, N. Houlsby, and S. Gelly. On self modulation for generative adversarial networks. In International Conference on Learning Representations (ICLR), 2019.

[7] X. Chen, Y. Duan, R. Houthooft, J. Schulman, I. Sutskever, and P. Abbeel. InfoGAN: Interpretable representation learning by information maximizing generative adversarial nets. In Advances in Neural Information Processing Systems 29 (NIPS), pages 2172–2180. Curran Associates, Inc., 2016.

[8] A. Creswell and A. A. Bharath. Inverting the generator of a generative adversarial network. IEEE Transactions on Neural Networks and Learning Systems, 30(7):1967–1974, 2019.

[9] J. Donahue and K. Simonyan. Large scale adversarial representation learning. In Advances in Neural Information Processing Systems (NeurIPS), pages 10541–10551. Curran Associates, Inc., 2019.

[10] J. Donahue, P. Krähenbühl, and T. Darrell. Adversarial feature learning. In International Conference on Learning Representations (ICLR), 2017.

[11] V. Dumoulin, I. Belghazi, B. Poole, O. Mastropietro, A. Lamb, M. Arjovsky, and A. Courville. Adversarially learned inference. In International Conference on Learning Representations (ICLR), 2017.

[12] V. Dumoulin, J. Shlens, and M. Kudlur. A learned representation for artistic style. In International Conference on Learning Representations (ICLR), 2017.

[13] L. A. Gatys, A. S. Ecker, and M. Bethge. Image style transfer using convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 2414–2423, 2016.

[14] I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative adversarial nets. In Advances in Neural Information Processing Systems (NIPS), volume 27, pages 2672–2680. Curran Associates, Inc., 2014.

[15] K. Gregor, I. Danihelka, A. Graves, D. Rezende, and D. Wierstra. DRAW: A recurrent neural network for image generation. In Proceedings of the 32nd International Conference on Machine Learning (ICML), volume 37 of PMLR, pages 1462–1471, 2015.

[16] K. Gregor, F. Besse, D. J. Rezende, I. Danihelka, and D. Wierstra. Towards conceptual compression. In Advances in Neural Information Processing Systems (NIPS), volume 29, pages 3549–3557. Curran Associates, Inc., 2016.

[17] A. Heljakka, A. Solin, and J. Kannala. Pioneer networks: Progressively growing generative autoencoder. In Asian Conference on Computer Vision (ACCV), pages 22–38, 2018.

[18] A. Heljakka, A. Solin, and J. Kannala. Towards photographic image manipulation with balanced growing of generative autoencoders. In IEEE Winter Conference on Applications of Computer Vision (WACV), 2020.

[19] M. Heusel, H. Ramsauer, T. Unterthiner, B. Nessler, and S. Hochreiter. GANs trained by a two time-scale update rule converge to a local Nash equilibrium. In Advances in Neural Information Processing Systems (NIPS), volume 30, pages 6626–6637. Curran Associates, Inc., 2017.

[20] G. E. Hinton and J. L. McClelland. Learning representations by recirculation. In Neural Information Processing Systems (NIPS), pages 358–366. American Institute of Physics, 1988.

[21] Y. Hou, A. Heljakka, and A. Solin. Gaussian Process Priors for View-Aware Inference. arXiv preprint arXiv:1912.03249, 2019.

[22] H. Huang, Z. Li, R. He, Z. Sun, and T. Tan. IntroVAE: Introspective variational autoencoders for photographic image synthesis. In Neural Information Processing Systems (NeurIPS), volume 31, pages 52–63. Curran Associates, Inc., 2018.

[23] X. Huang and S. Belongie. Arbitrary style transfer in real-time with adaptive instance normalization. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), pages 1501–1510, 2017.

[24] T. Karras, T. Aila, S. Laine, and J. Lehtinen. Progressive growing of GANs for improved quality, stability, and variation. In International Conference on Learning Representations (ICLR), 2018.

[25] T. Karras, S. Laine, and T. Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 4401–4410, 2019.

[26] T. Karras, S. Laine, M. Aittala, J. Hellsten, J. Lehtinen, and T. Aila. Analyzing and improving the image quality of StyleGAN. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 8110–8119, 2020.

[27] D. P. Kingma and P. Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. In Advances in Neural Information Processing Systems (NeurIPS), volume 31, pages 10236–10245. Curran Associates, Inc., 2018.

[28] D. P. Kingma and M. Welling. Auto-encoding variational Bayes. In International Conference on Learning Representations (ICLR), 2014.

[29] T. Kynkäänniemi, T. Karras, S. Laine, J. Lehtinen, and T. Aila. Improved precision and recall metric for assessing generative models. In Advances in Neural Information Processing Systems (NeurIPS), pages 3929–3938. Curran Associates, Inc., 2019.

[30] A. Larsen, S. Kaae Sønderby, H. Larochelle, and O. Winther. Autoencoding beyond pixels using a learned similarity metric. In International Conference on Machine Learning (ICML), pages 1558–1566, 2016.

[31] Y. Li, N. Xiao, and W. Ouyang. Improved boundary equilibrium generative adversarial networks. IEEE Access, 6:11342–11348, 2018.

[32] Z. Lin, K. K. Thekumparampil, G. C. Fanti, and S. Oh. InfoGAN-CR: Disentangling generative adversarial networks with contrastive regularizers. arXiv preprint arXiv:1906.06034, 2019.

[33] F. Locatello, S. Bauer, M. Lucic, G. Rätsch, S. Gelly, and B. O. Schölkopf, B. Challenging common assumptions in the unsupervised learning of disentangled representations. In Proceedings of the 36th International Conference on International Conference on Machine Learning (ICML), volume 97 of PMLR, pages 4114–4124, 2019.

[34] A. Makhzani. Implicit autoencoders. arXiv preprint arXiv:1805.09804, 2018.

[35] A. Makhzani, J. Shlens, N. Jaitly, and I. Goodfellow. Adversarial autoencoders. In International Conference on Learning Representations (ICLR), 2016.

[36] L. Mescheder, S. Nowozin, and A. Geiger. Adversarial variational Bayes: Unifying variational autoencoders and generative adversarial networks. In Proceedings of the 34th International Conference on Machine Learning (ICML), volume 70 of PMLR, pages 2391–2400, 2017.

[37] T. Miyato, T. Kataoka, M. Koyama, and Y. Yoshida. Spectral normalization for generative adversarial networks. In International Conference on Learning Representations (ICLR), 2018.

[38] Puzer (GitHub user). StyleGAN encoder – Converts real images to latent space. https://github.com/Puzer/ stylegan-encoder, 2019. GitHub repository.

[39] A. Razavi, A. van den Oord, and O. Vinyals. Generating diverse high-fidelity images with VQ-VAE-2. In Advances in Neural Information Processing Systems (NeurIPS), volume 32, pages 14837–14847. Curran Associates, Inc., 2019.

[40] D. J. Rezende, S. Mohamed, and D. Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In Proceedings of the 31st International Conference on Machine Learning (ICML), volume 32 of PMLR, pages 1278–1286, 2014.

[41] D. J. Rezende, S. Mohamed, I. Danihelka, K. Gregor, and D. Wierstra. One-shot generalization in deep generative models. In Proceedings of the 33rd International Conference on International Conference on Machine Learning (ICML), volume 48 of PMLR, pages 1521–1529, 2016.

[42] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations (ICLR), 2015.

[43] I. Tolstikhin, O. Bousquet, S. Gelly, and B. Schölkopf. Wasserstein auto-encoders. In International Conference on Learning Representations (ICLR), 2018.

[44] D. Ulyanov, A. Vedaldi, and V. S. Lempitsky. Instance normalization: The missing ingredient for fast stylization. arXiv preprint arXiv:1607.08022, 2016.

[45] D. Ulyanov, A. Vedaldi, and V. Lempitsky. It takes (only) two: Adversarial generator-encoder networks. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence (AAAI), pages 1250–1257, 2018.

[46] D. Ulyanov, A. Vedaldi, and V. Lempitsky. Adversarial generator-encoder networks. https://github.com/ DmitryUlyanov/AGE, 2018. GitHub repository.

[47] A. van den Oord, O. Vinyals, and k. kavukcuoglu. Neural discrete representation learning. In Advances in Neural Information Processing Systems (NIPS), volume 30, pages 6306–6315. Curran Associates, Inc., 2017.

[48] F. Yu, A. Seff, Y. Zhang, S. Song, T. Funkhouser, and J. Xiao. LSUN: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.

[49] A. R. Zamir, T. Wu, L. Sun, W. B. Shen, B. E. Shi, J. Malik, and S. Savarese. Feedback networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1808–1817, 2017.

[50] R. Zhang, P. Isola, A. A. Efros, E. Shechtman, and O. Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 586–595, 2018.

In the appendix, we include further details underlying the model and the experiments and complement the results in the main paper with examples and more comprehensive results. We start with the details of training and evaluation (App. A), complemented by detailed description of architecture and data flow in the network (App. B). We then show a comparison of scale-specific attribute modification with the regular one, providing more context to the quick qualitative experiment in Sec. 4. We proceed with showing more random samples (App. D) and reconstructions (App. E). Note that there are reconstructions in the diagonals of all style-mixture images, too. Importantly, we show systematic style-mixture examples in App. F, corresponding to Fig. 4 but with real (unseen) input images from the FFHQ test set. We follow with showing latent space interpolations at all scales between real input images (which also could be done on a scale-specific basis). We then continue with an experiment regarding the inversion of StyleGAN Karras et al. [25] with an optimization process, and finish with an experiment focused on conditional sampling, in which certain scales of an input image are fixed in the reconstruction images but other scales are randomly sampled over, creating variations of the same input face.

A Training Details

The training method largely follows the Balanced PIONEER [18], with progressively growing encoder and decoder with symmetric high-level structure (Fig. 6a), and decreasing the batch size when moving to higher resolutions (Fig. 7). The encoder and decoder consist of 7 blocks each containing two residual blocks with a filter. In both blocks of the encoder, the convolutions are followed by a spectral normalization operation [37] and activation (conv - spectral norm - act). In the first block of the decoder, they are followed by binomial filtering, layer noise, activation and AdaIn normalization

Figure 6: (a) Top-level view, where a single decoder block corresponds to a specific resolution. (b) A single decoder block contains two convolutional layers and other repeating components. The noise is added to each channel of the layer using a single scale parameter per layer, i.e., a different random value is added across each activation map, but the scale is the same for all maps in the same layer. (c) The latent codes are connected to the modulation scalar (m,s) pair of every activation map of each of the convolutional layers. In the encoder, the number of channels in the convolutional blocks follows [18] as 64,128,256,512,512,512,512. In CELEBA-HQ, the decoder channels are the symmetric inverse: 512, 512, 512, 512, 256, 128, 64. In other datasets, it was beneficial to double the number of feature maps in high resolutions of the decoder, with the number of channels as: 512, 512, 512, 512, 512, 256, 128 for datasets. For FFHQ a final 64-channel block was added to this, resulting in 512, 512, 512, 512, 256, 128, 64.

Figure 7: The model grows step-wise during training; the resolution doubles on every step. Input x is encoded into a latent encoding z (a dimensionality of 512 used throughout this paper). The decoder acts by modulating an empty canvas by the latent encoding and produces the output explanation of the model architecture is provided in Fig. 2a.

(conv - binomial - noise - act - AdaIn); in the second block of decoder, by layer noise, activation and AdaIn normalization (conv - noise - act - AdaIn). A leaky ReLU (p = 0.2) is used as the activation. Equalized learning rate [24] is used for decoder convolutions. In the encoder, each block halves the resolution of the convolution map, while in the decoder, each block doubles it. The output of the final encoder layers is flattened into a 512-dimensional latent block. As in StyleGAN [25], the block is mapped by affine mapping layers so that each convolutional layer C in the decoder block is preceded by its own fully connected layer that maps the latent to two vectors each of length N, when N equals the number of channels in C.

Each resolution phase until , for all data sets, uses a learning rate and thereafter 0.001. Optimization is done with ADAM (). KL margin is 2.0 for the first two resolution steps, and therafter fixed to 0.5, except for CELEBA-HQ, for which it is switched to 0.2 at and 0.4 at , and for LSUN Bedrooms, for which the margin was 0.2 from upwards. We believe that 0.5 for low resolutions and 0.2 thereafter would work sufficiently across all these data sets. Note that unlike in [18], we use only one generator training step for each individual encoder training step. The length of each training phase amounts to 2.4M training samples until resolution phase, which lasts for 10.4M samples (totaling in 20.0M). For FFHQ, the phase uses 10.6M samples while CELEBA-HQ and LSUN Cars use 7.5M samples, and LSUN Bedrooms uses 4.8M samples. For FFHQ, the phase uses 5.0M samples, CELEBA-HQ uses 4.5M, LSUN Bedrooms 2.9M samples and LSUN Cars 2M samples. Then training with FFHQ up to , this final phase uses 6.7M samples. The training of the final stage was generally cut off when reasonable FID results had been obtained. More training and learning rate optimization would likely improve results. With two NVIDIA Titan V100 GPUs, the training times were 10 days for CELEBA-HQ, 10.5 days for FFHQ and (total) 22.5 days for FFHQ , for LSUN Bedrooms 18.5 days, and for Cars 18 days. 3 evaluation runs with different seeds were done for CELEBA-HQ (separately for each configuration of the ablation study, including the full loss with and without layer noise), 3 for FFHQ, 3 for LSUN Bedrooms and 3 for LSUN Cars (1 with and 2 without layer noise). Some runs shared the same pretrained network up to resolution (except in Ablation study, where each run was done from scratch).

For evaluating the model after training, a moving exponential running average of generator weights [18, 24] was used. For visual evaluation, the layer noise can be turned off, often yielding slightly more polished-looking results. For all data sets, training/test set splits were as follows: 60k/10k for FFHQ (download at https://github.com/NVlabs/ffhq-dataset), 27k/3k split for CELEBA-HQ (download with instructions at https://github.com/tkarras/progressive_growing_of_gans), 4,968,695/552,061 for LSUN Cars (download at https://github.com/fyu/lsun), and 3033042/300 for LSUN Bedrooms (download at https://github.com/fyu/lsun). Note that in regular GAN training, complete data sets are often used without train/test split, yielding larger effective training sets. For instance, in FFHQ, we train on the actual 60k training images only, whereas StyleGAN trained on all 70k. For FFHQ and CELEBA-HQ, cropping and alignment of the faces should be performed exactly as described by the authors of the data sets as referred to above, which also direct to the readily available scripts for the alignments (based on facial keypoint detection). For LSUN images, there was no preprocessing except cropping the Cars to . Mirror augmentation was used in training the face data sets, but not for training the LSUN data sets (for comparison with prior work).

For baselines in Table 2a and Table 2b, we used pre-trained models for StyleGAN, PGGAN, PIONEER, and GLOW with default settings provided by the authors, except Balanced PIONEER for FFHQ which we trained. FID of PGGAN for Cars and Bedrooms is from Karras et al. [24], whereas FID of FFHQ is from Karras et al. [25] and FID of CELEBA-HQ we computed for separately. We trained the VAE and WAE models manually. StyleGAN FID for LSUN Bedrooms is from Karras et al. [25] whereas the other FIDs were calculated for separately. PPLs for StyleGAN and PGGAN for FFHQ come from Karras et al. [25] while the PPL for StyleGAN v2 is from Karras et al. [26], PPL for PGGAN CELEBA-HQ from Heljakka et al. [18] and PPL for CELEBA-HQ of StyleGAN was computed from the pretrained model. For all VAE baselines the weight for KL divergence loss term was 0.005. For all WAE baseline, we used the WAE-MMD algorithm. The weight of the MMD loss term with automodular architecture (WAE-AdaIn) was four and with Balanced PIONEER (WAE-classic) architecture it was two. For VAEs, the learning rate for the encoder was 0.0001, and for the generator 0.0005. For WAEs, the learning rate for both was 0.0002. We trained Balanced PIONEER for FFHQ by otherwise using the CELEBA-HQ hyperparameters, but increasing the length of the and pretraining stages proportionally to the larger training set size (60k vs. 27k), training the former up to 20.04M samples and the latter to 27.86M samples, followed by the stage, which was trained up to 35.4M samples, after which we observed no further improvement. (With shorter pre-training stages, the model training did not converge properly.) Note: Some apparent discrepancies between reported FID results between papers are often explained by different resolutions. In Table 2b we have used resolution.

For evaluating the encoding and decoding performance, we used 10k unseen test images from the FFHQ data set, cropped the input and reconstruction to as in Karras et al. [25] and evaluated the LPIPS distance between the inputs and reconstructions. We evaluated 50k random samples in all data sets and compare against the provided training set. The GLOW model has not been shown to work with resolution on LSUN Bedrooms nor Cars (the authors show qualitative result only for for Bedrooms).

For Perceptual Path Length (PPL), we repeatedly take a random vector of length in the latent space, generate images at its endpoints, crop them around mid-face to measure the LPIPS between them [25]. PPL equals the scaled expectation of this value (for a sample of 100k vectors).

Hyperparameter selection The driving principle to select hyperparameters in this paper was to use the same values as Heljakka et al. [18] whenever necessary, and minimize variation across data sets, so as to show generalization rather than tuning for maximum performance in each data set. The learning rate was attempted at the same rate as in [18] () for the whole length of training. However, the pre-training stages up to appeared unstable, hence was attempted and found more stable for those stages. Margin values 0.2, 0.4 and 0.5 were attempted for training stages from upwards for FFHQ, CELEBA-HQ and LSUN Bedrooms. However, we did not systematically try out all possible combinations, but rather started from the values used in Heljakka et al. [18] and only tried other values if performance seemed insufficient. For the length of the training stage, separately for each data set, we first tried a long training session (up to 10M seen samples) and observed whether FID values were improving. We selected the cutoff point to for each data set based on approximately when the FID no longer seemed to improve for the lower resolution. The phase was then trained until FID no longer seemed to improve, or, in the ablation study, we decided to run for the fixed 40M seen samples. For the in the image space reconstruction loss, we tried values 1, 0.5 and 0.2, of which 0.2 appeared to best retain the same training dynamics as the L1 loss in CELEBA-HQ, and was hence used for all experiments. Other hyperparameters not mentioned here follow the values and reasoning of Heljakka et al. [18] by default.

B Detailed Explanation of Automodulation Architecture

As the structure of the proposed decoder is rather unorthodox (though very similar to Karras et al. [25]) and the modulation step especially is easy to misunderstand, we now explain the workings of the decoder step-by-step in detail.

Encoder The encoder works in the same way as any convolutional image encoder, where the last convolution block maps the highest-level features of the input image x into a single 512-dimensional

Figure 8: Modifying an attribute in latent space by using only 4 exemplar images of it, for two unseen test images. In ‘regular’ all-scales manipulation (bottom row), the variance in the exemplars causes unwanted changes in, e.g., texture, face size and pose. When the latent vector only drives the relevant scales, the variance in other scales is inconsequential (top row).

vector z. To understand the concept of latent mixing, we can immediately consider having two samples and which are mapped into and . In reality, we will use minibatches in the regular way when we train the decoder, but for the purposes of this explanation, let us assume that our batch has only these 2 invidiual samples. Thus our whole latent vector is of size [2, 512]. Each latent vector is independently normalized to unit hypersphere, i.e. to reside within [-1, 1].

Decoder high-level structure Corresponding to the 7 levels of image resolutions (from 4x4 to 256x256), the decoder comprises of 7 high-level blocks (Fig. 6a). Each such block has an internal structure as depicted in Fig. 6b. In order to understand the modulation itself, the individual activation map of a convolutional layer is the relevant level of abstraction.

Activation maps As usual, each deconvolutional operation produces a single activation map per channel, hence for a single deconvolutional layer (of which there are 2 per block), there can be e.g. 512 such maps (i.e., 1024 per block). We now proceed to modulate the mean and variance of each of those 512 maps separately, so that each map has two scalar values for that purpose. In other words, there will be 512 + 512 scalars to express the new channel-wise mean and variance for the single decoder layer. As in Eq. (3), the activations of each map are separately scaled to exactly amount to the new mean and variance. Note that those statistics pertain only within each map, not across all the maps in that layer.

Connecting the latent to the scaling factors In order to drive the modulating scalars with the original 512-dimensional latent vector z, we take add a fully connected linear layer that connects the latent vector to each and every modulating scalar, yielding connections where N is the total number of activation maps in the full decoder (Fig. 6c). Note that this linear layer is not affected at all by the way in which the decoder is structured; it only looks at the latent vector and each convolutional activation map.

Initiating the data flow with the constant inputs Hence, given a latent vector, one can start decoding. The inputs to the first deconvolutional operations at the top of the decoder are constant values of 1. This apparently counter-intuitive approach is actually nothing special. Consider that were the latent code simply connected to the first deconvolutional layers with weight 1 to create the mean and with weight 0 for the variance, this would essentially be the same as driving the first layer directly with the latent code, as in the traditional image decoder architecture.

The data flow Now, as the image content flows through the decoder blocks, each operation occurs as in regular decoders, except for the modulation step. Whenever an activation function is computed, a separate modulation operation will follow, with unique scaling factors. For the downstream operations, this modulation step is invisible, since it merely scaled the statistics of those activations. Then, the data flow continues in the same way, through each block, until at the last step, the content is mapped to a 3-dimensional grid with the size of the image, i.e., our final generated image.

C Scale-speciﬁc attribute modiﬁcation

Interesting attributes of a previously unseen input image can be modified by altering its latent code in the direction of the attribute. The direction can be found by taking N image samples with the attribute and N without it, encoding the images, and taking the difference between the mean encodings. Scaled

Figure 9: Uncurated random samples for an automodulator trained on FFHQ and CELEBA-HQ, respectively.

as desired, the resulting attribute latent vector can then be added to the latent code of a new unseen input image

The quality of the attribute vector depends on the selected exemplars (and, obviously, on the encoder). Given that all the exemplars have (or, for the opposite case, lack) the attribute A and are randomly drawn from a balanced distribution, then, as N increases (e.g., to N = 64), all other feature variation embedded in the latent vector except for the attribute should cancel out. However, for small N (e.g., N = 4), this does not happen, and the latent vector will be noisy. For the example in App. B, we now show the difference between applying such a vector on all scales as usually done (e.g., in [18]) in architectures that do not allow latent modulation, and applying it only on the layers that correspond to the scales where we expect the attribute to have an effect (App. B). Here, we simply determine the range of layers manually, as the for the smile on/off transform, layers for male-to-female, and for glasses. The effect of the noise in the attribute-coding vector is greatly reduced, since most of the scales simply are not touched by it.

Note that while autoencoder-like models can directly infer the latents from real exemplar images, in GANs without an encoder, you must take the reverse and more tedious route: the formation of latent vectors needs to take place by picking the desired attribute from randomly generated samples, presuming that it eventually appears in a sufficient number.

D Random Samples

Our model is capable of fully random sampling by specifying to be drawn from a unit Gaussian. Figs. 9a, 9b and 10 show samples from an automodulator trained with the FFHQ/CELEBAHQ/LSUN data sets up to resolution

Figure 10: Additional samples from an automodulator trained on LSUN Bedrooms and Cars a resolution of at

E Reconstructions

We include examples of the reconstruction capabilities of the automodulator at in for uncurated test set samples from the FFHQ and CELEBA-HQ data sets. These examples are provided in Figs. 11 and 12.

Figure 11: Uncurated examples of reconstruction quality in resolution with unseen images from the FFHQ test set (top row: inputs, bottom row: reconstructions).

Figure 12: Uncurated examples of reconstruction quality in resolution with unseen images from the CELEBA-HQ test set (top row: inputs, bottom row: reconstructions).

F Style Mixing and Interpolation

The well disentangled latent space allows for interpolations between encoded images. We show regular latent space interpolations between the reconstructions of new input images (Fig. 13).

As two more systematic style mixing examples, we include style mixing results based on both FFHQ and LSUN Cars. The source images are unseen real test images, not self-generated images. In Figs. 14 and 15 we show a matrix of cross-mixing either ‘coarse’ (latent resolutions ‘intermediate’ () latent features. Mixing coarse features results in large-scale changes, such as pose, while the intermediate features drive finer details, such as color.

G Comparison to GAN Inversion

Although a GAN trained without an encoder cannot take inputs directly, it is possible to fit images into its latent space by training an encoder after regular GAN training, or by using a separate optimization process. One may wonder how well such image reconstruction would compare to our results here, and we will focus on a readily available method using the latter approach - optimization.

Specifically, we can find the latent codes for StyleGAN [25] with an optimizer, leveraging VGG16 feature projections [38, 42]. The optimization takes place in the large latent W space, and the resulting latent codes are decoded back to image space in the regular way by the GAN generator network. It should be noted that the latent space of our automodulator is more compact – – and hence the two approaches are not directly comparable. However, according to Abdal et al. [1], the StyleGAN inversion does not work well if the corresponding original latent Z space of StyleGAN is used instead of the large W space.

Figure 13: Interpolation between random input images from FFHQ test set in (originals in the corners) which the model has not seen during training. The model captures most of the salient features in the reconstructions and produces smooth interpolations at all points in the traversed space.

Besides the higher dimensionality of the latent space, there are other issues that hamper straighforward comparison. First, the GAN inversion now hinges on a third (ad hoc) deep network, in addition to the GAN generator and discriminator. It is unclear whether inverting a model trained on one specific data set (faces) will work equally well with other data sets. Consider, e.g., the case of microscope imaging. Even though one could apply both the Automodulator and StyleGAN to learn such images in a straight-forward manner as long as they can be approached with convolutions, one is faced with a more complex question about which optimizer should now be chosen for StyleGAN inversion, given the potentially poorer performance of VGG16 features on such images. In any case, we now have a separate optimization problem to solve. This brings us to the second issue, the very slow convergence, which calls for evaluation as a function of optimization time. Third, the relationship of the projected latent coordinates of input images to their hypothetical optimal coordinates is an interesting open question, which we will tentatively address by evaluating the interpolated points between the projected latent coordinates.

First, for the convergence evaluation, we run the projector for a varying number of iterations, up to 200, or 68 seconds per image on average. We use the StyleGAN network pretrained on FFHQ, and compare to Automodulator also trained on FFHQ. We test the results on 1000 CELEBA-HQ test images, on a single NVIDIA Titan V gpu. The script is based on the implementation of Puzer (GitHub user) [38]. To measure the similarity of reconstructed images to the originals, we use the same LPIPS measure as before, with images cropped to in the middle of the face region. Note that StyleGAN images are matched at scale and then scaled down to before the cropping. (Note: concurrently to the publishing of this version of the manuscript, an improved version of StyleGAN with possibly better projection capabilities has been released in Karras et al. [26].)

The results (Fig. 16) are calculated for various stages of the optimization for StyleGAN, against the single direct encoding result of Automodulator. The Automodulator uses no separate optimization processes. The results indicate that on this hardware setup, it takes over 10 seconds for the opti- mization process to reconstruct a single image to match the LPIPS of Automodulator, whereas a single images takes only 0.0079 s for the Automodulator encoder inference (or 0.1271 s for a batch of 16 images). The performance difference is almost at the considerable four orders of magnitude. StyleGAN projection does, however, continue improving to produce significantly better LPIPS, given more optimization. Moreover, to get the best results, we used the resolution, which makes the optimization somewhat slower, and has not yet been matched by Automodulator. However, it is clear that a performance difference of limits the use cases of the GAN projection approach. For instance, in cases where the projected latent codes can be complemented by fast inference, such as Hou et al. [21], the optimization speed is not limiting.

Second, in order to evaluate the properties of the projected latent coordinates, we again projected 1000 CELEBA-HQ test images into the (FFHQ-trained) StyleGAN latent space and then sampled 10000 random points linearly interpolated between them (in the extended W latent space), with each point converted back into a generated image. For comparison, the similar procedure was done for the (FFHQ-trained) Automodulator, using the built-in encoder. We then evaluated the quality and diversity of the results in terms of FID, measured against 10000 CELEBA-HQ training set images. Although such a measure is not ideal when one has only used 1000 (test set) images to begin with, it can be reasonably justified on the basis of the fact that, due to combinatorial explosion, interpolations should cover a relatively diverse set of images that goes far beyond the original images. The results of this experiment yielded FID of for StyleGAN and FID of for Automodulator. Hence, in this specific measure, StyleGAN performed slightly worse (despite the fact that StyleGAN projection still used nearly 10000x more time).

Third, in order to evaluate the mixture properties of the projected latent coordinates, we once again projected 1000 CELEBA-HQ test images into the (FFHQ-trained) StyleGAN latent space, but now take 10000 random pairs of those encodings, and mix each pair in StyleGAN so that the first code drives the first two layers of the decoder, while the second code drives the rest. We then look at the FID against 10000 CELEBA-HQ training set images. We run this for a varying number of iterations (i.e. varying amounts of optimization time) for StyleGAN, and for a direct encoding-and-mixing result of Automodulator. The result (Fig. 17) indicates that the initial StyleGAN projections are inferior to the Automodulator results, but then improve with a larger iteration budget, reaching 26.5% lower FID, but thereafter begin to deteriorate again. Our hypothesis is that by increasing the number of iterations, one finds a StyleGAN latent code that produces a better local projection fit than the earlier iterations (corresponding to a better LPIPS)but resides in a more pathological neighborhood, yielding worse mixing results when combined with another similarly projected latent. More research is needed to investigate this.

Although more research is called for, the FID results suggest that only a fraction of the fidelity and diversity of StyleGAN random samples is retained during projection. More subtle evaluation methods, and e.g., the effect of layer noise, are a topic for future research. For an additional comparison, one could also run similar optimization in Automodulator latent space.

H Conditional Sampling

The automodulator directly allows for conditional sampling in the sense of fixing a latent encoding , but allowing some of the modulations come from a random encoding . In Fig. 18, we show conditional sampling of random face images based on ‘coarse’ (latent resolutions ) and ‘intermediate’ () latent features of the fixed input. The input image controls the coarse features (such as head shape, pose, gender) on the top and more fine features (expressions, accessories, eyebrows) on the bottom.

Figure 14: Style mixing of FFHQ face images. The source images are unseen real test images, not self-generated images. The reconstructions of the input images are shown on the diagonal.

Figure 14: Style mixing of FFHQ face images. The source images are unseen real test images, not self-generated images. The reconstructions of the input images are shown on the diagonal.

(a) Using ‘coarse’ (latent resolutions ) latent features from B and the rest from A. Most notably, the B cars drive the car pose.

Figure 15: Style mixing of LSUN Cars. The source images are unseen real test images, not self-generated images. The reconstructions of the input images are shown on the diagonal.

Figure 16: Comparison of LPIPS similarity of image reconstructions in Automodulator (ours) and StyleGAN (left: linear scale, right: log xscale). The error bars indicate standard deviations across evaluation runs. We show that optimization to StyleGAN latent space takes over 3 orders of magnitude more time to match the Automodulator (up to 16 s), but will continue improving thereafter. Here, the Automodulator encodes 1 image in 0.008 s, with the LPIPS shown as the constant horizontal line.

Figure 17: FID comparison of the results of images produced by mixing two reconstructions in Automodulator (ours) and StyleGAN (left: linear scale, right: log xscale), based on three random combination runs. Standard deviations (not visualized) are 0.38 at maximum for StyleGAN and 0.22 for Automodulator. The optimization to StyleGAN latent space takes about 3 orders of magnitude more time to match the Automodulator, continues to improve thereafter, but further optimization of single images leads to worse FID of their mixtures. Here, the Automodulator encodes 1 input image in 0.008 s, with the FID shown as the constant horizontal line.

Figure 18: Conditional sampling of random face images based on ‘coarse’ (latent resolutions ) and ‘intermediate’ () latent features of the fixed unseen test input. The input image controls the coarse features (such as head shape, pose, gender) on the top and more fine features (expressions, accessories, eyebrows) on the bottom.