Disentangling GAN withOne-Hot Sampling and Orthogonal Regularization

Disentangling GAN with One-Hot Sampling and Orthogonal Regularization


Exploring the potential of GANs for unsupervised disentanglement learning, this paper proposes a novel GAN-based disentanglement framework with One-Hot Sampling and Orthogonal Regularization (OOGAN). While previous works mostly attempt to tackle disentanglement learning through VAE and seek to implicitly minimize the Total Correlation (TC) objective with various sorts of approximation methods, we show that GANs have a natural advantage in disentangling with an alternating latent variable (noise) sampling method that is straightforward and robust. Furthermore, we provide a brand-new perspective on designing the structure of the generator and discriminator, demonstrating that a minor structural change and an orthogonal regularization on model weights entails an improved disentanglement. Instead of experimenting on simple toy datasets, we conduct experiments on higher-resolution images and show that OOGAN greatly pushes the boundary of unsupervised disentanglement.

1 Introduction

A disentangled representation is one that separates the underlying factors of variation such that each dimension exclusively encodes one semantic feature [5, 21]. While the benefits of the learned representation for downstream tasks is questioned by \citeauthorlocatello2018challenging \shortcitelocatello2018challenging, disentangling a Deep Neural Network (DNN) is still of great value in terms of human-controllable data generation, data manipulation and post-processing, and increasing the model interpretability. Moreover, disentanglement learning in an unsupervised manner can effectively highlight the biased generative factors from a given dataset, and yield appealing data-analytic properties. In this work, we focus on the unsupervised disentanglement learning using GANs [14] on images, which brings substantial advancement in tasks such as semantic image understanding and generation, and potentially aids research on zero-shot learning and reinforcement learning [5, 15, 24, 36].

The most popular methods to tackle the unsupervised disentangling problem are based on GANs [14] or VAEs [22], and many instantiations of these [30, 1, 13, 2, 26] draw on information-theoretical concepts [31]. InfoGAN [9] seeks to maximize a Mutual Information (MI) lower bound between a sampled conditional vector and the generated data, with the expectation that the generator and discriminator will disentangle the vector with respect to the true underlying factors. In contrast, VAE-based approaches [8, 21, 11] attempt to optimize a Total Correlation (TC) [33] objective imposed on the inferred latent vector, which achieves disentanglement by encouraging inter-dimensional independence in the latent vector.

TC-based VAE models have proven fruitful in disentangling. However, there is usually a trade-off between the degree of achievable disentanglement and the data-generating ability of VAE [21]. In practice, VAE struggles significantly when trained on higher-resolution images due to its restricted generative power. Furthermore, it only approximates the TC, since both the marginal distribution of the learned latent representation and the product of its marginals are intractable in VAE, which makes the optimization process implicit and complicated. In contrast, with rapid advances in recent years [34, 28, 20], GANs have become more stable to train, and their generative power has become unparalleled even on high-resolution images. Nonetheless, less attention has been paid to GANs in unsupervised disentanglement learning. Accordingly, we propose OOGAN, a novel framework based on GANs that can explicitly disentangle while generating high-quality images. The framework’s components can readily be adopted to other GAN models.

Unlike in VAEs, where a latent vector has to be inferred, in GANs, noise is actively sampled as the latent vector during training. We exploit this property to enable OOGAN to directly learn a disentangled latent vector, by means of one-hot vectors as latent representation to enforce exclusivity and to encourage each dimension to capture different semantic features. This is achieved without sacrificing the continuous nature of the latent space through an alternating sampling procedure. We argue that our proposed OOGAN fully highlights the structural advantage of GANs over VAEs for disentanglement learning, which, to our knowledge, has not been exploited before.

We achieve disentanglement in OOGAN through three contributions: 1) We propose an alternating one-hot sampling procedure for GANs to encourage greater disentanglement. 2) We adopt an orthogonal regularization on the model weights to better accompany our objective. 3) We identify a weakness in InfoGAN and related models with similar structure, which we summarize as the compete and conflict issue, and propose a model-structural change to resolve it. Moreover, we propose a compact and intuitive metric targeting the disentanglement of the generative part in the models. We present both quantitative and qualitative results along with further analysis of OOGAN, and compare its performance against VAEs and InfoGAN.

2 Related Work

-VAE-based models: In the settings of -VAE and its variants [15, 7, 8, 21, 12], a factorized posterior is learned such that each dimension of a sampled is able to encode a disentangled representation of data . The fundamental objective that -VAE tries to maximize (also known as the Evidence Lower-Bound Optimization) is:


where is usually selected to place stronger emphasis on the KL term for a better disentanglement learning. \citeauthorburgess2018understanding \shortciteburgess2018understanding motivate the effect of from an information-theoretical perspective, where the KL divergence term can be regarded as an upper bound that forces to carry less information, thus becoming disentangled.

Follow-up research extends the explanation by deriving a Total Correlation from the KL term in the -VAE objective, and highlights this TC term as the key factor to learning disentangled representations. Given a multi-dimensional continuous vector , the TC quantifies the redundancy and dependency among each dimension . It is formally defined as the KL divergence from the joint distribution to the independent distribution of :


where . However, the TC term requires the evaluation of the density , which depends on the distribution of the entire dataset and usually is intractable. For the sake of a better optimization on the TC term, \citeauthorNIPS2017_7178 \shortciteNIPS2017_7178 propose TC-VAE, which uses a minibatch-weighted sampling method to approximate TC. \citeauthorkim2018disentangling \shortcitekim2018disentangling perform the same estimation using an auxiliary discriminator network in their Factor-VAE. Furthermore, \citeauthoresmaeili2018structured \shortciteesmaeili2018structured suggest a more generalized objective where the marginals can be further decomposed into more TC terms, in case each learns independent but entangled features, which leads to a hierarchically factorized VAE. \citeauthordupont2018learning \shortcitedupont2018learning leverage the Gumbel Max trick [17] to enable disentangled learning of discrete features for VAE.

GAN-based models: InfoGAN [9] reveals the potential of Generative Adversarial Networks [14] in the field of unsupervised disentanglement learning. In a typical GAN setting, a generator and a discriminator are trained by playing an adversarial game formulated as:


While this mini-max game guides towards generating realistic from noise drawn from the isotropic Gaussian distribution, the variation of often remains entangled. InfoGAN manages to make learn a disentangled transformation from a latent code , which is concatenated to before being fed to . InfoGAN achieves this by maximizing a Mutual Information (MI) lower-bound between and the generated sample , where the MI can be calculated directly by matching to , where is an auxiliary network that seeks to predict the sampled latent vector from . In practice, shares most weights with . However, such a lower-bound constraint only ensures gains control over the generation process, but cannot guarantee any disentanglement as increases its dimensionality, because this lower-bound does not encourage any independence across each dimension of .

A more recent GAN-based disentanglement work is the Information-Bottleneck-GAN [18]. However, it fails to take advantage of the GAN structure, instead trying to implicitly minimize the TC in the same way as -VAE. The method requires an extra network that encodes noise into to a control vector and lets the original and play the decoder’s role to reconstruct . This severely hurts the generation quality, since starts the generation from , which has a much lower dimensionality than , and the increased network modules and loss objectives make the training scheme tedious and less likely to find the proper hyper-parameters that allow the model to converge.

Figure 1: OOGAN makes minimal changes upon a basic GAN. denotes the continuous control vector, is the noise vector, is the feature representation of fake images.

3 Proposed Method

Our approach accomplishes both the task of disentangled feature extraction and human-controllable data generation in an unsupervised setting within the GAN framework. We define our problem as follows: For a continuous control vector sampled from , we wish our generator to be disentangled such that each dimension in solely controls one feature of the generated data ( is the noise vector), and our feature extractor (mostly the discriminator with a few layers on top that gives vector outputs) is able to emit a feature representation , given , that is disentangled in the same way as .

Our model is illustrated in Figure 1, and the complete training process is described in Algorithm 1. Similar to the design of InfoGAN, we let the feature extractor be a sub-module that shares weights with the discriminator . takes the feature map of a generated image as input and tries to predict the control vector used by the generator . We describe the three components of our OOGAN framework in the following sub-sections.

3.1 Alternating Continuous and One-hot Sampling

Previous methods of minimizing TC to achieve disentanglement have two limitations. First, due to the intractability, extra network modules and objectives have to be invoked to approximate TC, which leads to undesired hyper-parameter tuning, a non-trivial training regime, and a high computational overhead. Second, to optimize the derived TC objectives in VAE-based models, the data generation quality is sacrificed [21, 8], and can hardly perform well on higher-resolution image data. In contrast, in the GAN setting, the latent vector is sampled instead of inferred as in VAEs. This motivates us to approach disentanglement by deliberately sampling latent vectors that possess the property of inter-dimensional independence and training the networks using these sampled vectors.

To this end, we propose an alternating continuous-discrete sampling procedure: we alternate between sampling continuous from (as typically done in InfoGAN) and sampling as one-hot vectors. The one-hot vector implies that the generated image should only exhibit one feature, and, ideally, the prediction from should also be a one-hot vector. On both the and sides, any presence of other features should be penalized, while alternating with continuous uniform sampling is necessary to ensure the continuity of the representation. Interestingly, such a one-hot sampling resembles a classification task. Therefore, we can jointly train and directly via a cross-entropy loss. In such a process, is trained to generate images that possess the specified features and avoids retaining any other features, while is trained to summarize the highlighted feature only in one dimension and refrain from spreading the feature representation into multiple dimensions.

Note that we treat as a continuous vector in the whole training process, and the alternating one-hot sampling can be seen as an regularizor for and . When we sample from as in InfoGAN, we ensure the correlation between and remains. Furthermore, when we interleave that with one-hot samples, the process can be interpreted as getting the extremely typical samples (those samples that lie on the boundary of the uniform distribution) for the model. We argue that sampling data at the distribution boundaries makes the model pay more attention to these boundaries, yielding a clearer distribution shape highlighting the semantics of these boundary factors. These typical samples are vital for the model to learn inter-dimension exclusivity, as a one-hot regularizes to generate images with only one factor and to only capture this one factor.

In other words, alternating one-hot sampling and uniform sampling results in a more desirable prior distribution for disentangling GANs, which provides much more typical samples on the margin than a single uniform distribution. Such an alternating procedure, which injects the categorical sampling (i.e., the one-hot sampling) into a continuous , makes it possible that gains continuous control over the generation process while simultaneously paying more attention to those typical examples, and therefore achieves better disentanglement.

Formally, our complete objective for OOGAN is:


Despite the lack of any TC terms in our objective, the one-hot sampling still ensures that we have a well-disentangled feature extractor and generator that learn features with no overlap between each dimension in , without any approximations and extra network modules involved.

3.2 Compete-Free Generator

InfoGAN [9] and many conditional-GAN variants leverage an auxiliary vector that is concatenated with noise before being fed into , with the expectation that carries the human-controllable information. From a size perspective, the dimensionality of is usually much more significant than ( typically has around a hundred dimensions, while has in the order of 10). Intuitively, will have much less impact in the generation process. With the objective of the unsupervised disentanglement learning, the large portion of influence is taking in the generation process is undesirable, which we refer to as the competing and conflicting issue.

Usually, a disentangled feature learned by can also be entangled in . During the training process, if with holding a high signal on a certain feature is paired with some with many dimensions holding the same feature with a conflict signal, this signal, entangled in , will easily overpower . Thus, the generated images will not present ’s signal. Such a conflict will discourage from mastering the learned feature and cause it to stray away to some easier-to-achieve but less distinct features. An example is shown in Figure 2. More discussion can be found in the experiments section.

Figure 2: Latent traversals trained on CelebA to showcase the competing and conflicting issue. The images are from the same set of (, ) on one fixed dimension of after different training iterations. We observe that InfoGAN begins to capture what appears to be a “wearing glasses” feature at a very early stage, but discards it during training in all dimensions of . In contrast, when OOGAN begins to capture this feature, it consistently masters it in the end.

To avoid the aforementioned competing and conflicting issue, we propose a new Compete-Free Design of the generator’s input block, which switches the role between and by letting control the fundamental content even when the dimensionality of is low, and ensures that has limited influence in the generation process.

To start with, we project the low-dimensional control vector into a multi-channel feature map by a convTransposed layer. Then, we add this feature map to a learned constant tensor with the same dimensionality.

The weights for the constant tenor are randomly initialized before training and will be used for all generations. These weights are trained via back-propagation just like all other model weights. This learned constant can be regarded as an additive bias that is learned from the dataset, and is necessary since it is responsible for representing the features that are not captured in . Ideally, when given a with all zeros as input, this constant should let the generator output the most “neutral” . In our experiments, we find such constant important for providing a stabilized learning process. It makes OOGAN faster to converge to the disentangled factors. Intuitively, one can imagine this constant as placing an anchor at the center of the target distribution, such that all latent factors can expand towards different directions. This behavior encourages the model to focus on learning the correlation between and the generated images. Without this ”constant”, OOGAN will still work as it is but will be slower to converge for .

To encourage the variance and complement the details for a higher-quality generation, the traditional noise is still taken into the generator, but only after the feature map level. To prevent from causing the competing and conflicting issue, we leverage an attention mask generated from on the features from , which means that only the approved part of by can join in the generation process. Different layers in CNNs have been studied extensively [20], where the first few layers tend to generate fundamental compositions, and higher layers only refine the details. So our design makes more natural to control the key generative factors without the interference of . The design details are illustrated in Figure 3-(a).

Our generator design resembles the one proposed for StyleGAN [20], as we both base the generation on a fixed multi-dimensional feature map instead of an input vector , and take as input only in later layers. As claimed by Karras et al., such a design leads to a better separation in the data attributes and a more linear interpolation along latent factors. However, both the motivation and structure details are different. The disentanglement we study here is a more strict term than what Karras et al. used. The fundamental difference is that the fixed weights in our proposed model only serve as a supportive bias, and will be directly changed by , while in StyleGAN the fixed weights are solely used to start the image generation process.

Figure 3: Model structures: (a) Input block of the compete-free . (b) Orthogonal-regularized grouped

3.3 Orthogonal Regularized & Grouped Feature Extractor

To learn a disentangled representation, we propose a new structure of that uses grouped convolutions [23, 35] instead of traditional fully connected ones, with an orthogonal regularization on the weights among every convolution kernel. The intuition is, since we hope that will be a highly disentangled feature extractor, a fully connected (FC) design is not favorable, since, in a FC convolution, each feature prediction has to take into consideration all the feature maps from the previous layer. A grouped convolution, on the other hand, can focus its decision making on a much smaller group of previous features, and may thus be less distracted by potentially irrelevant features.

To make sure that each group is indeed attending to different features, we impose an additional loss function on the weights of the convolutional layers to enforce the orthogonality between different kernels. Weight orthogonality in DNNs has been studied [6, 16, 4]. However, these studies each focused on different tasks, and none of them revealed the potential for disentanglement learning.

The orthogonal regularization we use is straightforward: during each forward pass of the OOGAN, compute and minimize the cosine similarity between every convolutional kernel. With grouped feature extraction and orthogonal regularization, structurally more easily captures diversified features in each dimension. Note that the group design is not only applicable to convolutional layers but also to grouped linear layers or other weights indicated as “transformer” in Figure 3-(b). Similarly, the orthogonal regularization can be applied on weights of all these grouped layers.

4 Perceptual Diversity Metric

Quantitative metrics for the disentanglement are mostly proposed in VAE-based works and for simulated toy datasets with available ground truth information. \citeauthorhiggins2017beta \shortcitehiggins2017beta suggest training a low-capacity linear classifier on the obtained latent representations of the simulated data from the trained encoder, and report the error rate of the classifier as the disentanglement score of the generative model. \citeauthorkim2018disentangling \shortcitekim2018disentangling argue that the introduction of an extra classifier could lead to undesirable uncertainties due to the increased hyper-parameters to tune. Thus, they favor a majority-vote classifier that is achievable directly from the latent representations.

We concur with \citeauthorkim2018disentangling \shortcitekim2018disentangling in arguing that, to the best of our knowledge, there is no convincing metric for disentanglement on a dataset for which no ground truth latent factor is provided. Therefore, we propose a method that is capable of relatively evaluating partial properties of a disentangling model when certain conditions are satisfied.

Our intuition is that if a generative model is well-disentangled, then varying each dimension of the controlling vector should yield different feature changes of the generated data . Suppose the feasible value range for is , and for a pair of () where is a uniformly sampled vector and and are two randomly selected indices, we get by setting and , and by setting and . Given the fact that and each control different factors, we expect and to be different. Therefore, we can use a pre-trained VGG [32] model to extract the feature map of and , and report their distance as the disentanglement score, with a higher distance indicating dimensions and are more independent. The final score of this proposed perceptual diversity metric will be the average score of many samples of paired (). A formalized algorithmic procedure can be found in the appendix.

We argue that such a metric can adequately reflect the separability and diversity of the learned factors, especially when used for comparing similarly structured models on high-resolution datasets, where higher diversity should already be considered better, and on datasets in which latent factors are known to control a good amount of visual differences. As shown in Figure 4, the proposed metric can efficiently capture the disentangle performance in terms of how diversified each dimension is in .

Limitations: The perceptual diversity metric should not be generally used to compare differently structured models, and cannot solely capture the disentanglement ability of a model. First, the L1 distance between feature maps is not an absolute measure. For example, a VAE model produces blurry images that could lead to a lower value from this metric compared to a GAN model , where images are sharp and high-contrast, but this does not necessarily imply that disentangles worse than .

Hence, we only use this metric on the CelebA dataset for comparisons within GAN models, where the aforementioned drawbacks are irrelevant. In such cases, this metric remains valuable in providing an intuitive and direct measure of how well the generative part of the models disentangle.

Figure 4: Generated images for CelebA: In each group, the left-most image is generated from a randomly sampled , and the following ones are generated by changing the value of each dimension in to 1. (a) OOGAN exhibits greater visual differences among each dimension, reflecting its ability to learn diverse latent factors. (b) Without the proposed one-hot sampling, OOGAN still manages to learn some distinguishable features, reflecting the advantage of its structural design. (c) The 4 top right images show that the learned features for an InfoGAN have a large overlap across the latent dimensions in , lacking proper disentanglement.

5 Experiments

We conduct quantitative and qualitative experiments to demonstrate the advantages of our method on several datasets. First, we perform quantitative experiments on the dSprites datasets [27] following the metric proposed by \citeauthorkim2018disentangling \shortcitekim2018disentangling. After that, we show the superiority of OOGAN in terms of generating quality images while maintaining competitive disentanglement compared to VAE-based models on CelebA [25] and 3D-chair [3] data. Based on the disentangling benchmark guidance from \citeauthoreastwood2018framework \shortciteeastwood2018framework, we also present an elaborated learned-factor identification experiment to showcase the effectiveness of OOGAN and validate our compete-and-conflicting issue observations. Finally, we conduct an ablation study on the proposed components in OOGAN with our metric. All the model structures, training details, and more qualitative results are given in the Appendix, and all the code for our experiments is also submitted.

Quantitative results on dSprites: Several quantitative metrics have been proposed on the dSprites dataset [15, 21, 10, 8]. While these metrics achieve a thorough evaluation of the disentanglement abilities of the feature-extractor (i.e., the encoder in VAE and in GANs), they pay no attention to the generative part of the models. Therefore, we only select \citeauthorkim2018disentangling’s metric for its intuitiveness and simplicity to demonstrate our model’s competitiveness on the feature extractor’s end.

Figure 5: Latent traversals on dSprites

For all the models, we follow the same setup as \citeauthorkim2018disentangling \shortcitekim2018disentangling and \citeauthorjeon2019ibgan \shortcitejeon2019ibgan. Due to the simplicity of the dataset, we train all the GAN models with the “instance noise technique” introduced by \citeauthorsonderby2016amortised \shortcitesonderby2016amortised to get stable and good quality results.

As can be seen from Table 1 and Figure 5, our proposed OOGAN genuinely does a better job on both the feature extractor and generator parts. While Factor-VAE is only able to disentangle three out of the five ground truth factors effectively, OOGAN retrieves all the generative factors and manages to put the variables of the discrete factor “shape” into different dimensions. Additionally, we would like to highlight the robustness of our model, where varying the hyper-parameters of (1 to 5) and (0.2 to 2) in our loss function always yields consistent performance.

Figure 6: Latent traversals on 3D Chair

Qualitative results on 3D Chairs: On the 3D Chairs data, we use RGB images with batch size 64 for all training runs. To demonstrate the robustness and performance of OOGAN in generating higher-quality images and potentially learning more latent factors, we consider the dimensionality of for up to 16, where previous works only experiment on a smaller dimensionality such as 6.

In Factor-VAE, when we increase the dimensionality of from 6 to 16, it struggles to disentangle at a similar quality, and the reconstruction ability is severely sacrificed. In contrast, our model is not affected by an increase of the dimensionality, and apart from learning somewhat more obvious features such as scale and azimuth, our model also discovers several exciting features that have never been reported in previous work. For example, Figure 6-(c) shows a linear transformation of different back styles and leg thickness of the chairs, and Figure 6-(d) shows that our model successfully disentangles discrete features such as “color” and “chair type” without any additional tweaks and tricks, for which additional tweaks such as various approximation approaches would have to be incorporated in a VAE approach.

Model Score
-VAE 0.63 0.033
Factor-VAE 0.73 0.112
InfoGAN 0.59 0.078
IB-GAN 0.80 0.062
OOGAN 0.81 0.077
Table 1: Disentanglement using Kim et al.’s metric
Model Score Cos-simil. in
InfoGAN 2.39 0.03 0.21 0.01
OOGAN w/o One-hot 2.44 0.05 0.09 0.03
OOGAN w/o Ortho-reg 2.65 0.05 0.21 0.01
OOGAN w/o Compt-free G 2.69 0.03 0.09 0.03
OOGAN 2.77 0.06 0.09 0.03
Table 2: Disentanglement using Perceptual Diversity metric

Disentangling at a higher resolution on CelebA: We consider OOGAN as a suite of three modules that can be plugged into any GAN frameworks, and it is orthogonal to other disentanglement approaches based on GANs such as IBGAN. In other words, it can be incorporated into other methods and inherits the breakthroughs made in GANs [34, 28, 20]. Therefore, we focus on demonstrating the advantages OOGAN has over VAE-based models in qualitative experiments. The comparison with InfoGAN will be presented as quantitative results in an ablation study.

Figure 7: Latent traversals trained on CelebA

On the CelebA dataset, while previous work operates at a resolution of , we train all the models on the resolution of to showcase the advantage of OOGAN and expose a shortcoming of the VAE-based models. Figure 4-(a) shows the images trained in a plain DCGAN manner [29] and Figure 7-(a) shows the images trained in a progressively up-scaling manner [19], demonstrating a strong ability to disentangle while maintaining a high image quality. On the other hand, VAE-based models deteriorate when reconstructing high-contrast images, and are unable to maintain the same disentangle performance as the resolution increases. Thanks to the detail richness of the generated images, OOGAN can discover more interesting facial features such as “chin” and “cheek”, which no VAE-based models have achieved.

Learned attribute analysis: To provide a more transparent breakdown on what is learned [10], we train 40 binary classifiers on the 40 provided visual attributes from the CelebA dataset, each only predicting one attribute. Then we use these classifiers to monitor the generated images across the training iterations of InfoGAN and OOGAN.

In Figure 8, there are 40 different colors on the lines, each color representing an attribute, with 16 lines per color representing the 16 dimensions in . In terms of sampling , we set one dimension’s value to one and sample the remaining dimensions from , repeating the same operation for all dimensions. For InfoGAN, the lines with the same color stick together and have the same tendency to change, which means different dimensions in are learning similar factors. In contrast, for OOGAN, we observe that lines in the same color (the same attribute) develop differently during the iterations. Moreover, at each iteration, the lines in the same color get different prediction scores, which implies that different dimensions in are learning different factors.

We then average the curves of each attribute into one to show the prediction score for each ground truth attribute in Figure 9, which confirms the competing and conflicting issue. If a prediction score is constantly increasing, this means that is improving its ability to represent the respective attribute. For InfoGAN, the attribute predictions show rising and falling fluctuations, a sign of an unstable learning process. In contrast, OOGAN steadily increases the prediction score for some visual attributes.

Figure 8: Binary classification of each labeled attributes for each dimension
Figure 9: Binary classification of each labeled attributes for all dimensions

Ablation studies: Based on the plain InfoGAN setting, we conduct ablation studies on the effectiveness of our proposed three modules quantitatively using our proposed metric, with InfoGAN as the baseline. The experiments are conducted only on learning continuous factors, as InfoGAN already performs well in disentangling categorical latent variables.

There are two types of we can choose from when training OOGAN or InfoGAN. A deterministic will try to directly output , which is considered as a reconstruction of ; and a probabilistic will assume that each dimension of is from a Gaussian and try to output the mean and standard deviation of that distribution given different input images. To optimize a deterministic , we can directly minimize the L1 loss between predicted and the input , and to optimize the probabilistic , we can minimize the negative log-likelihood given the sampled and predicted and . In both cases, our proposed one-hot sampling trick can participate in the optimization directly, where for the probabilistic , we just minimize the cross-entropy between and .

Figure 10: (a)(b): L1 losses between sampled and predicted . (c) TC estimation during training

When the dimensionality of the latent factors goes beyond 6, InfoGAN fails to disentangle them, which is also confirmed in previous work [21, 18]. As shown in Figure 4, most dimensions in InfoGAN produce similar images as many features remain entangled. In the meantime, OOGAN has a better tendency to learn disentangled representations thanks to its structural design, and a direct objective to learn independent features driven by the proposed alternating one-hot sampling.

For the proposed perceptual diversity metric, we fine-tune the VGG model on the CelebA dataset with the provided 40 facial attributes, to make it more sensitive to the visual attributes.

As shown in Table 2, the one-hot sampling makes the most substantial contribution, while orthogonal-regularized and compete-free generator also provide significant improvements. The averaged cosine similarity among the weights is effectively minimized with the proposed orthogonal regularization. In Figures 10-(a) and 10-(b), we train the models with a deterministic that directly attempts to reconstruct , and plot the L1 distance between the sampled and predicted (the L1 distance for one-hot is not used as an objective loss to train InfoGAN). Note how InfoGAN’s L1 loss is similarly minimized when is uniformly sampled, but struggles to decrease when is one-hot, which means that the output of InfoGAN is highly correlated (there are correlated latent factors encoded into multiple dimensions, implying poor disentanglement), while OOGAN’s is not. In Figure 10-(c), we train the models with probabilistic and estimate TC following the method from \citeauthorNIPS2018_7527 \shortciteNIPS2018_7527. The TC from InfoGAN remains high, while OOGAN can maintain a low TC consistently, which shows the effectiveness of our method.

6 Conclusion

We propose a robust framework that disentangles even high-resolution images with high generation quality. Our one-hot sampling highlights the structural advantage of GANs for easy manipulation on the input distribution that can lead to disentangled representation learning, while the architectural design provides a new perspective on GAN designs. Instead of tweaking the loss functions (designing a new loss, adjusting loss weights, which are highly unstable and inconsistent across datasets), we show that sampling noise from multiple distributions to achieve disentanglement and interpretability is robust and straightforward. It leads to a promising new direction of how to train GANs, opening up substantial avenues for future research, e.g., choosing what distribution to sample from, allocating alternating ratios, etc. The impact of this goes beyond disentangling, as future research can also be conducted on model interpretability and human-controllable data generation. In the future, we plan to explore more dynamic and fluent sampling methods that can be integrated into the GAN framework for better performance, and we will attempt to validate the benefits of these sampling methods theoretically.

OOGAN: Disentangling GAN with

One-Hot Sampling and Orthogonal Regularization

Appendix A OOGAN Training Algorithm

The complete training process of the proposed OOGAN model is described in Algorithm 1.

Input : generator , discriminator , feature extractor ,
batch size , real data , iteration , control vector dimension .
Output : well trained , ,
for  in iterations do
       if  is odd then
       end if
       update via ;
       update via ;
       if  is odd then
       end if
      update via ;
end for
Algorithm 1 OOGAN training algorithm

Appendix B Perceptual Diversity Metric

The complete process for the proposed Perceptual-diversity metric is formalized in Algorithm 2.

Karras et al. [21] in their StyleGAN work propose the Perceptual Path Length criterion, which is a pairwise image difference between two DNN embeddings of any small cut along with interpolation, and a minor change between the cuts indicates more focused information. However, such a perceptual pairwise distance only reflects the linearity of the interpolated images but cannot determine if a linear change entangles multiple factors or not. Additionally, it has a failure case that when there is no change along with the interpolation, this dimension will get the best score, but actually, nothing is learned.

Input : generative model , pre-trained VGG model , sample times , latent dimension , latent variable range [, ].
Output : score
for  iterations do
       Sample from ;
       Sample from (0, );
       = ;
       = ;
end for
return ;
Algorithm 2 Metric: Perceptual diversity L1 difference

On the other hand, our proposed Perceptual Diversity metric measures how each dimension in encodes different features that will reflect on the generated images. Moreover, in our experiment on celebA data, we fine-tune the VGG model on the celebA dataset with the provided 40 attributes describing the visual features, to make the VGG model better extract the on-point features, thus making the final score more meaningful.

Note that our proposed metric involves computing the paired L1 difference between two dimensions, while setting one dimension to the maximum value , we will also set the value on the other dimension to the minimum value , to better highlight the visual differences between the dimensions. Since a is uniformly sampled, the original value in on and dimension could already be high and close to , so to ensure the two samples and are comparable, we have to force the values in one dimension to .

Appendix C Experiments

c.1 GAN Models

Hardware and training conditions: We perform all the experiments on one NVIDIA RTX 2080Ti GPU with 11GB vrams. For all the experiments, we train the GAN models with hinge loss and apply spectral norm on all the convolutional layers. We also tried adding a gradient penalty loss, but found that it is not necessary. We rely on Adam optimization with the learning rate set to 1e-4 and betas set to (0.5, 0.99).

For a vanilla GAN, the running time of OOGAN is nearly identical to InfoGAN, since they share similar training schemas, where for 50,000 iterations, it takes both OOGAN and InfoGAN around 2 hours to train on 32x32 images, 4 hours on 64x64 images, and 10 hours on 128x128 images. The training time is similar to VAE-based models, while a Factor-VAE takes only around half the time to train for the same iterations, it usually takes twice as many iterations to converge to a similar generation quality as GANs.

For progressively up-scaled GANs, due to the structural similarity, we based our OOGAN on a StyleGAN structure. We modify StyleGAN by adding the proposed Compete-free generator input block, the orthogonal-regularized group convolution , and training with the alternating one-hot trick. It takes around 20 hours to train on 128x128 images.

Model structure details: On the vanilla GAN’s generator, apart from the first input layers, we use convolutional layers with kernel size 3 and stride 1 plus a bi-linear upscale with scale factor 2 to achieve the feature map up-scaling. On the Discriminator side, we also use a convolution layer with kernel size 3 and stride 1, plus an average-pooling with kernel 2 stride 2 to simulate down-scaling. We do not use residual blocks in our models. We generally find such a structure tends to produce smoother images and more stable training compared to using convTransposed layers in the generator. Additionally, we consider the choice of layer to be orthogonal to this work. For a fair comparison, we also conducted an experiment on Factor-VAE with similar convolutional layer up-scaling design, but found VAE to not be sensitive to such model structural changes.

Our model structure overview can be found in Table 3, where is short for batch normalization, is LeakyReLU, means average pooling with stride 2 kernel 2, means a bi-linear up-sampling with factor 2. Our model for 128x128 images is constructed in the same way, with just one more conv-layer block on and .

Approximation of TC: We also calculate the TC during training to see if our proposed model can produce a lower TC that aligns well with other TC-based methods. To calculate TC, we train the GANs with probabilistic and using the Minibatch Stratified Sampling method proposed by Chen et al. The derivation and details can be found in their paper (TC-VAE)’s appendix section C.2.

Since the code for all our experiments, approximations and metrics is also available (https://github.com/paper-anonymity/OOGAN), all the training details can be found in the code, if not mentioned here.

Discriminator Q Generator
Input 64x64 RGB image - Input c, z
1x1 conv(sd 1, ch 64) shared with D 4x4 convTans(sd 1, ch 512)
3x3 conv(sd 1, ch 128) shared with D 3x3 conv(sd 1, ch 256)
BN, lReLU(0.1), pool shared with D BN, lReLU(0.1), upsample
3x3 conv(sd 1, ch 256) shared with D 3x3 conv(sd 1, ch 256)
BN, lReLU(0.1), pool shared with D BN, lReLU(0.1), upsample
3x3 conv(sd 1, ch 256) 3x3 orth-group conv(sd 1, ch c) 3x3 conv(sd 1, ch 128)
BN, lReLU(0.1), pool lReLU(0.1), pool BN, lReLU(0.1), upsample
3x3 conv(sd 1, ch 512) 4x4 orth-group conv(sd 2, ch c) 3x3 conv(sd 1, ch 64)
BN, lReLU(0.1), pool lReLU(0.1), pool BN, lReLU(0.1), upsample
4x4 conv(sd 1, ch 1) linear layer with output c 3x3 conv(sd 1, ch 3), sigmoid
Table 3: 64x64 OOGAN for 3Dchair and dSprites

Appendix D More Qualitative Results

Figure 11: OOGAN based on Vanilla GAN. Latent traversals along different dimensions.
Figure 12: OOGAN based on Vanilla GAN. Latent traversals along different dimensions.
Figure 13: OOGAN based on StyleGAN. Latent traversals along different dimensions.
Figure 14: OOGAN based on StyleGAN. Latent traversals along different dimensions.
Figure 15: OOGAN on MNIST dataset, the 4 sections are 4 selected indices from the discrete vector (categorical one-hot vector), inside each section are latent traversals on the same 6 continuous dimensions.


  1. A. Achille and S. Soatto (2018) Information dropout: learning optimal representations through noisy computation. TPAMI 40 (12), pp. 2897–2905. Cited by: §1.
  2. A. Alemi, B. Poole, I. Fischer, J. Dillon, R. A. Saurus and K. Murphy (2018) An information-theoretic analysis of deep latent-variable models. External Links: Link Cited by: §1.
  3. M. Aubry, D. Maturana, A. Efros, B. Russell and J. Sivic (2014) Seeing 3d chairs: exemplar part-based 2d-3d alignment using a large dataset of cad models. In CVPR, Cited by: §5.
  4. N. Bansal, X. Chen and Z. Wang (2018) Can we gain more from orthogonality regularizations in training deep networks?. In NIPS, pp. 4261–4271. Cited by: §3.3.
  5. Y. Bengio, A. Courville and P. Vincent (2013) Representation learning: a review and new perspectives. TPAMI 35 (8), pp. 1798–1828. Cited by: §1.
  6. A. Brock, T. Lim, J. M. Ritchie and N. Weston (2016) Neural photo editing with introspective adversarial networks. ICLR. Cited by: §3.3.
  7. C. P. Burgess, I. Higgins, A. Pal, L. Matthey, N. Watters, G. Desjardins and A. Lerchner (2018) Understanding disentangling in -vae. arXiv preprint arXiv:1804.03599. Cited by: §2.
  8. T. Q. Chen, X. Li, R. B. Grosse and D. K. Duvenaud (2018) Isolating sources of disentanglement in variational autoencoders. In NIPS, S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi and R. Garnett (Eds.), pp. 2610–2620. External Links: Link Cited by: §1, §2, §3.1, §5.
  9. X. Chen, Y. Duan, R. Houthooft, J. Schulman, I. Sutskever and P. Abbeel (2016) Infogan: interpretable representation learning by information maximizing generative adversarial nets. In NIPS, pp. 2172–2180. Cited by: §1, §2, §3.2.
  10. C. Eastwood and C. K. Williams (2018) A framework for the quantitative evaluation of disentangled representations. ICLR. Cited by: §5, §5.
  11. B. Esmaeili, H. Wu, S. Jain, A. Bozkurt, N. Siddharth, B. Paige, D. H. Brooks, J. Dy and J. Meent (2019) Structured disentangled representations. In The 22nd International Conference on Artificial Intelligence and Statistics, pp. 2525–2534. Cited by: §1.
  12. B. Esmaeili, H. Wu, S. Jain, A. Bozkurt, N. Siddharth, B. Paige, D. H. Brooks, J. Dy and J. van de Meent (2018) Structured disentangled representations. stat 1050, pp. 12. Cited by: §2.
  13. M. Gabrié, A. Manoel, C. Luneau, N. Macris, F. Krzakala and L. Zdeborová (2018) Entropy and mutual information in models of deep neural networks. In NIPS, pp. 1826–1836. Cited by: §1.
  14. I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville and Y. Bengio (2014) Generative adversarial nets. In NIPS, pp. 2672–2680. Cited by: §1, §1, §2.
  15. I. Higgins, L. Matthey, A. Pal, C. Burgess, X. Glorot, M. Botvinick, S. Mohamed and A. Lerchner (2017) Beta-vae: learning basic visual concepts with a constrained variational framework. In ICLR, Cited by: §1, §2, §5.
  16. L. Huang, X. Liu, B. Lang, A. W. Yu, Y. Wang and B. Li (2018) Orthogonal weight normalization: solution to optimization over multiple dependent stiefel manifolds in deep neural networks. In AAAI, Cited by: §3.3.
  17. E. Jang, S. Gu and B. Poole (2016) Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144. Cited by: §2.
  18. I. Jeon, W. Lee and G. Kim (2019) IB-GAN: disentangled representation learning with information bottleneck GAN. External Links: Link Cited by: §2, §5.
  19. T. Karras, T. Aila, S. Laine and J. Lehtinen (2017) Progressive growing of gans for improved quality, stability, and variation. arXiv preprint arXiv:1710.10196. Cited by: §5.
  20. T. Karras, S. Laine and T. Aila (2018) A style-based generator architecture for generative adversarial networks. arXiv preprint arXiv:1812.04948. Cited by: §1, §3.2, §3.2, §5.
  21. H. Kim and A. Mnih (2018) Disentangling by factorising. arXiv preprint arXiv:1802.05983. Cited by: Appendix B, §1, §1, §1, §2, §3.1, §5, §5.
  22. D. P. Kingma and M. Welling (2013) Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114. Cited by: §1.
  23. A. Krizhevsky, I. Sutskever and G. E. Hinton (2012) Imagenet classification with deep convolutional neural networks. In NIPS, pp. 1097–1105. Cited by: §3.3.
  24. G. Lample, N. Zeghidour, N. Usunier, A. Bordes and L. Denoyer (2017) Fader networks: manipulating images by sliding attributes. In NIPS, pp. 5967–5976. Cited by: §1.
  25. Z. Liu, P. Luo, X. Wang and X. Tang (2015) Deep learning face attributes in the wild. In ICCV, Cited by: §5.
  26. C. Louizos, K. Ullrich and M. Welling (2017) Bayesian compression for deep learning. In NIPS, pp. 3288–3298. Cited by: §1.
  27. L. Matthey, I. Higgins, D. Hassabis and A. Lerchner (2017) DSprites: disentanglement testing sprites dataset. Note: https://github.com/deepmind/dsprites-dataset/ Cited by: §5.
  28. T. Miyato, T. Kataoka, M. Koyama and Y. Yoshida (2018) Spectral normalization for generative adversarial networks. arXiv preprint arXiv:1802.05957. Cited by: §1, §5.
  29. A. Radford, L. Metz and S. Chintala (2015) Unsupervised representation learning with deep convolutional generative adversarial networks. ICLR. Cited by: §5.
  30. A. M. Saxe, Y. Bansal, J. Dapello, M. Advani, A. Kolchinsky, B. D. Tracey and D. D. Cox (2018) On the information bottleneck theory of deep learning. ICLR. Cited by: §1.
  31. C. E. Shannon (1948) A mathematical theory of communication. Bell system technical journal 27 (3), pp. 379–423. Cited by: §1.
  32. K. Simonyan and A. Zisserman (2014) Very deep convolutional networks for large-scale image recognition. ICLR. Cited by: §4.
  33. S. Watanabe (1960) Information theoretical analysis of multivariate correlation. IBM Journal of research and development 4 (1), pp. 66–82. Cited by: §1.
  34. H. Zhang, I. Goodfellow, D. Metaxas and A. Odena (2018) Self-attention generative adversarial networks. arXiv preprint arXiv:1805.08318. Cited by: §1, §5.
  35. X. Zhang, X. Zhou, M. Lin and J. Sun (2018) Shufflenet: an extremely efficient convolutional neural network for mobile devices. In CVPR, pp. 6848–6856. Cited by: §3.3.
  36. Y. Zhu, M. Elhoseiny, B. Liu, X. Peng and A. Elgammal (2018) A generative adversarial approach for zero-shot learning from noisy texts. In CVPR, pp. 1004–1013. Cited by: §1.
Comments 0
Request Comment
You are adding the first comment!
How to quickly get a good reply:
  • Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
  • Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
  • Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
The feedback must be of minimum 40 characters and the title a minimum of 5 characters
Add comment
Loading ...
This is a comment super asjknd jkasnjk adsnkj
The feedback must be of minumum 40 characters
The feedback must be of minumum 40 characters

You are asking your first question!
How to quickly get a good answer:
  • Keep your question short and to the point
  • Check for grammar or spelling errors.
  • Phrase it like a question
Test description