Title: ADVERSARIAL FEATURE LEARNING

Abstract: The ability of the Generative Adversarial Networks (GANs) framework to learn generative models mapping from simple latent distributions to arbitrarily complex data distributions has been demonstrated empirically, with compelling results showing that the latent space of such generators captures semantic variation in the data distribution. Intuitively, models trained to predict these semantic latent representations given data may serve as useful feature representations for auxiliary problems where semantics are relevant. However, in their existing form, GANs have no means of learning the inverse mapping -projecting data back into the latent space. We propose Bidirectional Generative Adversarial Networks (BiGANs) as a means of learning this inverse mapping, and demonstrate that the resulting learned feature representation is useful for auxiliary supervised discrimination tasks, competitive with contemporary approaches to unsupervised and self-supervised feature learning.

1. INTRODUCTION:

Deep convolutional networks (convnets) have become a staple of the modern computer vision pipeline.

After training these models on a massive database of image-label pairs like ImageNet (Russakovsky et al., 2015) , the network easily adapts to a variety of similar visual tasks, achieving impressive results on image classification (Donahue et al., 2014; Zeiler & Fergus, 2014; Razavian et al., 2014) or localization (Girshick et al., 2014; Long et al., 2015) tasks. In other perceptual domains such as natural language processing or speech recognition, deep networks have proven highly effective as well (Bahdanau et al., 2015; Sutskever et al., 2014; Vinyals et al., 2015; Graves et al., 2013) . However, all of these recent results rely on a supervisory signal from large-scale databases of hand-labeled data, ignoring much of the useful information present in the structure of the data itself.

Meanwhile, Generative Adversarial Networks (GANs) (Goodfellow et al., 2014) have emerged as a powerful framework for learning generative models of arbitrarily complex data distributions. The GAN framework learns a generator mapping samples from an arbitrary latent distribution to data, as well as an adversarial discriminator which tries to distinguish between real and generated samples as accurately as possible. The generator's goal is to "fool" the discriminator by producing samples which are as close to real data as possible. When trained on databases of natural images, GANs produce impressive results (Radford et al., 2016; Denton et al., 2015) .

Interpolations in the latent space of the generator produce smooth and plausible semantic variations, and certain directions in this space correspond to particular semantic attributes along which the data distribution varies. For example, Radford et al. (2016) showed that a GAN trained on a database of human faces learns to associate particular latent directions with gender and the presence of eyeglasses.

A natural question arises from this ostensible "semantic juice" flowing through the weights of generators learned using the GAN framework: can GANs be used for unsupervised learning of rich feature representations for arbitrary data distributions? An obvious issue with doing so is that the features data

z G G(z) x E E(x) G(z), z

x, E(x) D P (y)

Figure 1 : The structure of Bidirectional Generative Adversarial Networks (BiGAN).

generator maps latent samples to generated data, but the framework does not include an inverse mapping from data to latent representation.

Hence, we propose a novel unsupervised feature learning framework, Bidirectional Generative Adversarial Networks (BiGAN). The overall model is depicted in Figure 1 . In short, in addition to the generator G from the standard GAN framework (Goodfellow et al., 2014) , BiGAN includes an encoder E which maps data x to latent representations z. The BiGAN discriminator D discriminates not only in data space (x versus G(z)), but jointly in data and latent space (tuples (x, E(x)) versus (G(z), z)), where the latent component is either an encoder output E(x) or a generator input z.

It may not be obvious from this description that the BiGAN encoder E should learn to invert the generator G. The two modules cannot directly "communicate" with one another: the encoder never "sees" generator outputs (E(G(z)) is not computed), and vice versa. Yet, in Section 3, we will both argue intuitively and formally prove that the encoder and generator must learn to invert one another in order to fool the BiGAN discriminator.

Because the BiGAN encoder learns to predict features z given data x, and prior work on GANs has demonstrated that these features capture semantic attributes of the data, we hypothesize that a trained BiGAN encoder may serve as a useful feature representation for related semantic tasks, in the same way that fully supervised visual models trained to predict semantic "labels" given images serve as powerful feature representations for related visual tasks. In this context, a latent representation z may be thought of as a "label" for x, but one which came for "free," without the need for supervision.

An alternative approach to learning the inverse mapping from data to latent representation is to directly model p(z|G(z)), predicting generator input z given generated data G(z). We'll refer to this alternative as a latent regressor, later arguing (Section 4.1) that the BiGAN encoder may be preferable in a feature learning context, as well as comparing the approaches empirically.

BiGANs are a robust and highly generic approach to unsupervised feature learning, making no assumptions about the structure or type of data to which they are applied, as our theoretical results will demonstrate. Our empirical studies will show that despite their generality, BiGANs are competitive with contemporary approaches to self-supervised and weakly supervised feature learning designed specifically for a notoriously complex data distribution -natural images. et al. (2016) independently proposed an identical model in their concurrent work, exploring the case of a stochastic encoder E and the ability of such models to learn in a semi-supervised setting.

Dumoulin:



2. PRELIMINARIES:

Let p X (x) be the distribution of our data for x ∈ Ω X (e.g. natural images). The goal of generative modeling is capture this data distribution using a probabilistic model. Unfortunately, exact modeling of this probability density function is computationally intractable (Hinton et al., 2006; Salakhutdinov & Hinton, 2009) for all but the most trivial models. Generative Adversarial Networks (GANs) (Good-fellow et al., 2014) instead model the data distribution as a transformation of a fixed latent distribution p Z (z) for z ∈ Ω Z . This transformation, called a generator, is expressed as a deterministic feed forward network

G : Ω Z → Ω X with p G (x|z) = δ (x -G(z)) and p G (x) = E z∼p Z [p G (x|z)].

The goal is to train a generator such that p G (x) ≈ p X (x).

The GAN framework trains a generator, such that no discriminative model D : Ω X → [0, 1] can distinguish samples of the data distribution from samples of the generative distribution. Both generator and discriminator are learned using the adversarial (minimax) objective min

G max D V (D, G), where V (D, G) := E x∼p X [log D(x)] + E x∼p G [log (1 -D(x))] Ez∼p Z [log(1-D(G(z)))]

(1) Goodfellow et al. (2014) showed that for an ideal discriminator the objective C(G) := max D V (D, G) is equivalent to the Jensen-Shannon divergence between the two distributions p G and p X .

The adversarial objective 1 does not directly lend itself to an efficient optimization, as each step in the generator G requires a full discriminator D to be learned. Furthermore, a perfect discriminator no longer provides any gradient information to the generator, as the gradient of any global or local maximum of V (D, G) is 0. To provide a strong gradient signal nonetheless, Goodfellow et al. (2014) slightly alter the objective between generator and discriminator updates, while keeping the same fixed point characteristics. They also propose to optimize (1) using an alternating optimization switching between updates to the generator and discriminator. While this optimization is not guaranteed to converge, empirically it works well if the discriminator and generator are well balanced.

Despite the empirical strength of GANs as generative models of arbitrary data distributions, it is not clear how they can be applied as an unsupervised feature representation. One possibility for learning such representations is to learn an inverse mapping regressing from generated data G(z) back to the latent input z. However, unless the generator perfectly models the data distribution p X , a nearly impossible objective for a complex data distribution such as that of high-resolution natural images, this idea may prove insufficient.

3. BIDIRECTIONAL GENERATIVE ADVERSARIAL NETWORKS:

In Bidirectional Generative Adversarial Networks (BiGANs) we not only train a generator, but additionally train an encoder E : Ω X → Ω Z . The encoder induces a distribution p E (z|x) = δ(z -E(x)) mapping data points x into the latent feature space of the generative model. The discriminator is also modified to take input from the latent space, predicting P D (Y |x, z), where Y = 1 if x is real (sampled from the real data distribution p X ), and

Y = 0 if x is generated (the output of G(z), z ∼ p Z ).

The BiGAN training objective is defined as a minimax objective

EQUATION

where

V (D, E, G) := E x∼p X E z∼p E (•|x) [log D(x, z)] log D(x,E(x)) + E z∼p Z E x∼p G (•|z) [log (1 -D(x, z))] log(1-D(G(z),z))

.

(3)

We optimize this minimax objective using the same alternating gradient based optimization as Goodfellow et al. (2014) . See Section 3.4 for details.

BiGANs share many of the theoretical properties of GANs (Goodfellow et al., 2014) , while additionally guaranteeing that at the global optimum, G and E are each other's inverse. BiGANs are also closely related to autoencoders with an 0 loss function. In the following sections we highlight some of the appealing theoretical properties of BiGANs.

Definitions Let p GZ (x, z) := p G (x|z)p Z (z) and p EX (x, z) := p E (z|x)p X (x) be the joint distributions modeled by the generator and encoder respectively. Ω := Ω X × Ω Z is the joint latent and data space. For a region R ⊆ Ω,

P EX (R) := Ω p EX (x, z)1 [(x,z)∈R] d(x, z) = Ω X p X (x) Ω Z p E (z|x)1 [(x,z)∈R] dz dx P GZ (R) := Ω p GZ (x, z)1 [(x,z)∈R] d(x, z) = Ω Z p Z (z) Ω X p G (x|z)1 [(x,z)∈R] dx dz

are probability measures over that region. We also define

P X (R X ) := Ω X p X (x)1 [x∈R X ] dx P Z (R Z ) := Ω Z p Z (z)1 [z∈R Z ] dz

as measures over regions R X ⊆ Ω X and R Z ⊆ Ω Z . We refer to the set of features and data samples in the support of P X and P Z as ΩX := supp(P X ) and ΩZ := supp(P Z ) respectively. D KL ( P || Q ) and D JS ( P || Q ) respectively denote the Kullback-Leibler (KL) and Jensen-Shannon divergences between probability measures P and Q. By definition,

D KL ( P || Q ) := E x∼P [log f P Q (x)] D JS ( P || Q ) := 1 2 D KL P P +Q 2 + D KL Q P +Q 2 ,

where f P Q := dP dQ is the Radon-Nikodym (RN) derivative of measure P with respect to measure Q, with the defining property that P (R) = R f P Q dQ. The RN derivative f P Q : Ω → R ≥0 is defined for any measures P and Q on space Ω such that P is absolutely continuous with respect to Q: i.e., for any R ⊆ Ω, P (R) > 0 =⇒ Q(R) > 0.

3.1. OPTIMAL DISCRIMINATOR, GENERATOR, & ENCODER:

We start by characterizing the optimal discriminator for any generator and encoder, following Goodfellow et al. (2014) . This optimal discriminator then allows us to reformulate objective (3), and show that it reduces to the Jensen-Shannon divergence between the joint distributions P EX and P GZ .

Proposition 1 For any E and G, the optimal discriminator D *

EG := arg max D V (D, E, G) is the Radon-Nikodym derivative f EG := dP EX d(P EX +P GZ ) : Ω → [0, 1] of measure P EX with respect to measure P EX + P GZ . Proof. Given in Appendix A.1.

This optimal discriminator now allows us to characterize the optimal generator and encoder.

Proposition 2 The encoder and generator's objective for an optimal discriminator C(E, G)

:= max D V (D, E, G) = V (D *

EG , E, G) can be rewritten in terms of the Jensen-Shannon divergence between measures P EX and P GZ as

C(E, G) = 2 D JS ( P EX || P GZ ) -log 4. Proof. Given in Appendix A.2. Theorem 1 The global minimum of C(E, G) is achieved if and only if P EX = P GZ . At that point, C(E, G) = -log 4 and D * EG = 1 2 . Proof. From Proposition 2, we have that C(E, G) = 2 D JS ( P EX || P GZ ) -log 4. The Jensen- Shannon divergence D JS ( P || Q ) ≥ 0 for any P and Q, and D JS ( P || Q ) = 0 if and only if P = Q.

Therefore, the global minimum of C(E, G) occurs if and only if P EX = P GZ , and at this point the value is C(E, G) = -log 4. Finally, P EX = P GZ implies that the optimal discriminator is chance:

D * EG = dP EX d(P EX +P GZ ) = dP EX 2 dP EX = 1 2 .

The optimal discriminator, encoder, and generator of BiGAN are similar to the optimal discriminator and generator of the GAN framework (Goodfellow et al., 2014) . However, an important difference is that BiGAN optimizes a Jensen-Shannon divergence between a joint distribution over both data X and latent features Z. This joint divergence allows us to further characterize properties of G and E, as shown below.

3.2. OPTIMAL GENERATOR & ENCODER ARE INVERSES:

We first present an intuitive argument that, in order to "fool" a perfect discriminator, a deterministic BiGAN encoder and generator must invert each other. (Later we will formally state and prove this property.) Consider a BiGAN discriminator input pair (x, z). Due to the sampling procedure, (x, z) must satisfy at least one of the following two properties:

(a) x ∈ ΩX ∧ E(x) = z (b) z ∈ ΩZ ∧ G(z) = x

If only one of these properties is satisfied, a perfect discriminator can infer the source of (x, z) with certainty: if only (a) is satisfied, (x, z) must be an encoder pair (x, E(x)) and D * EG (x, z) = 1; if only (b) is satisfied, (x, z) must be a generator pair (G(z), z) and D * EG (x, z) = 0. Therefore, in order to fool a perfect discriminator at (x, z) (so that 0 < D * EG (x, z) < 1), E and G must satisfy both (a) and (b). In this case, we can substitute the equality E(x) = z required by (a) into the equality G(z) = x required by (b), and vice versa, giving the inversion properties

x = G(E(x)) and z = E(G(z)).

Formally, we show in Theorem 2 that the optimal generator and encoder invert one another almost everywhere on the support ΩX and ΩZ of P X and P Z .

Theorem 2 If E and G are an optimal encoder and generator, then

E = G -1 almost everywhere; that is, G(E(x)) = x for P X -almost every x ∈ Ω X , and E(G(z)) = z for P Z -almost every z ∈ Ω Z . Proof. Given in Appendix A.4.

While Theorem 2 characterizes the encoder and decoder at their optimum, due to the non-convex nature of the optimization, this optimum might never be reached. Experimentally, Section 4 shows that on standard datasets, the two are approximate inverses; however, they are rarely exact inverses. It is thus also interesting to show what objective BiGAN optimizes in terms of E and G. Next we show that BiGANs are closely related to autoencoders with an 0 loss function.

3.3. RELATIONSHIP TO AUTOENCODERS:

As argued in Section 1, a model trained to predict features z given data x should learn useful semantic representations. Here we show that the BiGAN objective forces the encoder E to do exactly this: in order to fool the discriminator at a particular z, the encoder must invert the generator at that z, such that E(G(z)) = z.

Theorem 3 The encoder and generator objective given an optimal discriminator C(E, G) := max D V (D, E, G) can be rewritten as an 0 autoencoder loss function

C(E, G) = E x∼p X 1 [E(x)∈ ΩZ ∧G(E(x))=x] log f EG (x, E(x)) + E z∼p Z 1 [G(z)∈ ΩX ∧E(G(z))=z] log (1 -f EG (G(z), z))

with log f EG ∈ (-∞, 0) and log (1 -f EG ) ∈ (-∞, 0) P EX -almost and P GZ -almost everywhere.

Proof. Given in Appendix A.5.

Here the indicator function 1 [G(E(x):

)=x] in the first term is equivalent to an autoencoder with 0 loss, while the indicator 1 [E(G(z))=z] in the second term shows that the BiGAN encoder must invert the generator, the desired property for feature learning. The objective further encourages the functions E(x) and G(z) to produce valid outputs in the support of P Z and P X respectively. Unlike regular autoencoders, the 0 loss function does not make any assumptions about the structure or distribution of the data itself; in fact, all the structural properties of BiGAN are learned as part of the discriminator.

3.4. LEARNING:

In practice, as in the GAN framework (Goodfellow et al., 2014) , each BiGAN module D, G, and E is a parametric function (with parameters θ D , θ G , and θ E , respectively). As a whole, BiGAN can be optimized using alternating stochastic gradient steps. In one iteration, the discriminator parameters θ D are updated by taking one or more steps in the positive gradient direction ∇ θ D V (D, E, G), then the encoder parameters θ E and generator parameters θ G are together updated by taking a step in the negative gradient direction -∇ θ E ,θ G V (D, E, G). In both cases, the expectation terms of V (D, E, G) are estimated using mini-batches of n samples {x (i) ∼ p X } n i=1 and {z (i) ∼ p Z } n i=1 drawn independently for each update step. Goodfellow et al. (2014) found that an objective in which the real and generated labels Y are swapped provides stronger gradient signal to G. We similarly observed in BiGAN training that an "inverse" objective provides stronger gradient signal to G and E. For efficiency, we also update all modules D, G, and E simultaneously at each iteration, rather than alternating between D updates and G, E updates. See Appendix B for details.

3.5. GENERALIZED BIGAN:

It is often useful to parametrize the output of the generator G and encoder E in a different, usually smaller, space Ω X and Ω Z rather than the original Ω X and Ω Z . For example, for visual feature learning, the images input to the encoder should be of similar resolution to images used in the evaluation. On the other hand, generating high resolution images remains difficult for current generative models. In this situation, the encoder may take higher resolution input while the generator output and discriminator input remain low resolution.

We generalize the BiGAN objective V (D, G, E) (3) with functions g X : Ω X → Ω X and g Z : Ω Z → Ω Z , and encoder E : Ω X → Ω Z , generator G : Ω Z → Ω X , and discriminator D :

Ω X × Ω Z → [0, 1]: E x∼p X E z ∼p E (•|x) [log D(g X (x), z )] log D(g X (x),E(x)) + E z∼p Z E x ∼p G (•|z) [log (1 -D(x , g Z (z)))] log(1-D(G(z),g Z (z)))

An identity g X (x) = x and g Z (z) = z (and Ω X = Ω X , Ω Z = Ω Z ) yields the original objective. For visual feature learning with higher resolution encoder inputs, g X is an image resizing function that downsamples a high resolution image x ∈ Ω X to a lower resolution image x ∈ Ω X , as output by the generator. (g Z is identity.)

In this case, the encoder and generator respectively induce probability measures P EX and P GZ over regions R ⊆ Ω of the joint space Ω := Ω X × Ω Z , with P EX (R) :=

Ω X Ω X Ω Z p EX (x, z )1 [(x ,z )∈R] δ(g X (x) -x ) dz dx dx = Ω X p X (x)1 [(g X (x),E(x)

)∈R] dx, and P GZ defined analogously. For optimal E and G, we can show P EX = P GZ : a generalization of Theorem 1. When E and G are deterministic and optimal, Theorem 2 -that E and G invert one another -can also be generalized:

∃ z∈ ΩZ {E(x) = g Z (z) ∧ G(z) = g X (x)} for P X -almost every x ∈ Ω X , and ∃ x∈ ΩX {E(x) = g Z (z) ∧ G(z) = g X (x)} for P Z -almost every z ∈ Ω Z .

4. EVALUATION:

We evaluate the feature learning capabilities of BiGANs by first training them unsupervised as described in Section 3.4, then transferring the encoder's learned feature representations for use in auxiliary supervised learning tasks. To demonstrate that BiGANs are able to learn meaningful feature representations both on arbitrary data vectors, where the model is agnostic to any underlying structure, as well as very high-dimensional and complex distributions, we evaluate on both permutation-invariant MNIST (LeCun et al., 1998) and on the high-resolution natural images of ImageNet (Russakovsky et al., 2015) .

In all experiments, each module D, G, and E is a parametric deep (multi-layer) network. The BiGAN discriminator D(x, z) takes data x as its initial input, and at each linear layer thereafter, the latent representation z is transformed using a learned linear transformation to the hidden layer dimension and added to the non-linearity input.

4.1. BASELINE METHODS:

Besides the BiGAN framework presented above, we considered alternative approaches to learning feature representations using different GAN variants.

Discriminator The discriminator D in a standard GAN takes data samples x ∼ p X as input, making its learned intermediate representations natural candidates as feature representations for related tasks. 

G(z):

x This alternative is appealing as it requires no additional machinery, and is the approach used for unsupervised feature learning in Radford et al. (2016) . On the other hand, it is not clear that the task of distinguishing between real and generated data requires or benefits from intermediate representations that are useful as semantic feature representations. In fact, if G successfully generates the true data distribution p X (x), D may ignore the input data entirely and predict P (Y = 1) = P (Y = 1|x) = 1 2 unconditionally, not learning any meaningful intermediate representations.

G(E(x))

Latent regressor:

We consider an alternative encoder training by minimizing a reconstruction loss L(z, E(G(z))), after or jointly during a regular GAN training, called latent regressor or joint latent regressor respectively. We use a sigmoid cross entropy loss L as it naturally maps to a uniformly distributed output space. Intuitively, a drawback of this approach is that, unlike the encoder in a BiGAN, the latent regressor encoder E is trained only on generated samples G(z), and never "sees" real data x ∼ p X . While this may not be an issue in the theoretical optimum where p G (x) = p X (x) exactly -i.e., G perfectly generates the data distribution p X -in practice, for highly complex data distributions p X , such as the distribution of natural images, the generator will almost never achieve this perfect result. The fact that the real data x are never input to this type of encoder limits its utility as a feature representation for related tasks, as shown later in this section.

4.2. PERMUTATION-INVARIANT MNIST:

We first present results on permutation-invariant MNIST (LeCun et al., 1998) . In the permutationinvariant setting, each 28×28 digit image must be treated as an unstructured 784D vector (Goodfellow et al., 2013) . In our case, this condition is met by designing each module as a multi-layer perceptron (MLP), agnostic to the underlying spatial structure in the data (as opposed to a convnet, for example). See Appendix C.1 for more architectural and training details. We set the latent distribution p Z = [U(-1, 1)] 50 -a 50D continuous uniform distribution.

Table 1 compares the encoding learned by a BiGAN-trained encoder E with the baselines described in Section 4.1, as well as autoencoders (Hinton & Salakhutdinov, 2006) trained directly to minimize either 2 or 1 reconstruction error. The same architecture and optimization algorithm is used across all methods. All methods, including BiGAN, perform at roughly the same level. This result is not overly surprising given the relative simplicity of MNIST digits. For example, digits generated by G in a GAN nearly perfectly match the data distribution (qualitatively), making the latent regressor (LR) baseline method a reasonable choice, as argued in Section 4.1. Qualitative results are presented in Figure 2 . 

x G(E(x))

x G(E(x))

x G(E(x)) the data, but often capture some interesting aspects. Here, each of D, G, and E is a convnet. In all experiments, the encoder E architecture follows AlexNet (Krizhevsky et al., 2012) through the fifth and last convolution layer (conv5). We also experiment with an AlexNet-based discriminator D as a baseline feature learning approach. We set the latent distribution p Z = [U(-1, 1)] 200 -a 200D continuous uniform distribution. Additionally, we experiment with higher resolution encoder input images -112 × 112 rather than the 64 × 64 used elsewhere -using the generalization described in Section 3.5. See Appendix C.2 for more architectural and training details.

Qualitative results:

The convolutional filters learned by each of the three modules are shown in Figure 3 . We see that the filters learned by the encoder E have clear Gabor-like structure, similar to those originally reported for the fully supervised AlexNet model (Krizhevsky et al., 2012) . The filters also have similar "grouping" structure where one half (the bottom half, in this case) is more color sensitive, and the other half is more edge sensitive. (This separation of the filters occurs due to the AlexNet architecture maintaining two separate filter paths for computational efficiency.)

In Figure 4 we present sample generations G(z), as well as real data samples x and their BiGAN reconstructions G(E(x)). The reconstructions, while certainly imperfect, demonstrate empirically that conv1 conv2 conv3 conv4 conv5 Random (Noroozi & Favaro, 2016) 48 The object detection and semantic segmentation tasks go a step further by requiring the objects to be localized, with semantic segmentation requiring this at the finest scale: pixelwise prediction of object identity. For detection, the pretrained model is used as the initialization for Fast R-CNN (Girshick, 2015) (FRCN) training; and for semantic segmentation, the model is used as the initialization for Fully Convolutional Network (Long et al., 2015) (FCN) training, in each case replacing the AlexNet (Krizhevsky et al., 2012) model trained fully supervised for ImageNet classification. We report results on each of these tasks in Table 3 , comparing BiGANs with contemporary approaches to unsupervised (Krähenbühl et al., 2016) and self-supervised (Doersch et al., 2015; Agrawal et al., 2015; Wang & Gupta, 2015; Pathak et al., 2016) feature learning in the visual domain, as well as the baselines discussed in Section 4.1.

4.4. DISCUSSION:

Despite making no assumptions about the underlying structure of the data, the BiGAN unsupervised feature learning framework offers a representation competitive with existing self-supervised and even weakly supervised feature learning approaches for visual feature learning, while still being a purely generative model with the ability to sample data x and predict latent representation z. Furthermore, BiGANs outperform the discriminator (D) and latent regressor (LR) baselines discussed in Section 4.1, confirming our intuition that these approaches may not perform well in the regime of highly complex data distributions such as that of natural images. The version in which the encoder takes a higher resolution image than output by the generator (BiGAN 112 × 112 E) performs better still, and this strategy is not possible under the LR and D baselines as each of those modules take generator outputs as their input.

Although existing self-supervised approaches have shown impressive performance and thus far tended to outshine purely unsupervised approaches in the complex domain of high-resolution images, purely unsupervised approaches to feature learning or pre-training have several potential benefits. Krizhevsky et al., 2012) model frozen. In the fc8 column, only the linear classifier (a multinomial logistic regression) is learned -in the case of BiGAN, on top of randomly initialized fully connected (FC) layers fc6 and fc7. In the fc6-8 column, all three FC layers are trained fully supervised with all convolution layers frozen. Finally, in the all column, the entire network is "fine-tuned". BiGAN outperforms other unsupervised (unsup.) feature learning approaches, including the GAN-based baselines described in Section 4.1, and despite its generality, is competitive with contemporary self-supervised (self-sup.) feature learning approaches specific to the visual domain.

BiGAN and other unsupervised learning approaches are agnostic to the domain of the data. The self-supervised approaches are specific to the visual domain, in some cases requiring weak supervision from video unavailable in images alone. For example, the methods are not applicable in the permutation-invariant MNIST setting explored in Section 4.2, as the data are treated as flat vectors rather than 2D images.

Furthermore, BiGAN and other unsupervised approaches needn't suffer from domain shift between the pre-training task and the transfer task, unlike self-supervised methods in which some aspect of the data is normally removed or corrupted in order to create a non-trivial prediction task. In the context prediction task (Doersch et al., 2015) , the network sees only small image patches -the global image structure is unobserved. In the context encoder or inpainting task (Pathak et al., 2016) , each image is corrupted by removing large areas to be filled in by the prediction network, creating inputs with dramatically different appearance from the uncorrupted natural images seen in the transfer tasks.

Other approaches (Agrawal et al., 2015; Wang & Gupta, 2015) rely on auxiliary information unavailable in the static image domain, such as video, egomotion, or tracking. Unlike BiGAN, such approaches cannot learn feature representations from unlabeled static images.

We finally note that the results presented here constitute only a preliminary exploration of the space of model architectures possible under the BiGAN framework, and we expect results to improve significantly with advancements in generative image models and discriminative convolutional networks alike.

APPENDIX A ADDITIONAL PROOFS:

A.1 PROOF OF PROPOSITION 1 (OPTIMAL DISCRIMINATOR)

Proposition 1 For any E and G, the optimal discriminator D * EG := arg max D V (D, E, G) is the Radon-Nikodym derivative f EG := dP EX d(P EX +P GZ ) : Ω → [0, 1] of measure P EX with respect to measure P EX + P GZ .

Proof. For measures P and Q on space Ω, with P absolutely continuous with respect to Q, the RN derivative f P Q := dP dQ exists, and we have

EQUATION

Let the probability measure P EG := P EX +P GZ 2 denote the average of measures P EX and P GZ . Both P EX and P GZ are each absolutely continuous with respect to P EG . Hence the RN derivatives

f EG := dP EX d(P EX +P GZ ) = 1 2 dP EX dP EG and f GE := dP GZ d(P EX +P GZ ) = 1 2 dP GZ

dP EG exist and sum to 1:

EQUATION

We use ( 4) and ( 5) to rewrite the objective V (3) as a single expectation under measure P EG : 

EQUATION

* EG = 1 -f EG = f GE ) we rewrite the objective C(E, G) = max D V (D, E, G) = V (D * EG , E, G) = E (x,z)∼P EX [log D * EG (x, z)] + E (x,z)∼P GZ [log (1 -D * EG (x, z))] = E (x,z)∼P EX [log f EG (x, z)] + E (x,z)∼P GZ [log f GE (x, z)] = E (x,z)∼P EX [log (2f EG (x, z))] + E (x,z)∼P GZ [log (2f GE (x, z))] -log 4 = D KL ( P EX || P EG ) + D KL ( P GZ || P EG ) -log 4 = D KL P EX P EX +P GZ 2 + D KL P GZ P EX +P GZ 2 -log 4 = 2 D JS ( P EX || P GZ ) -log 4.

A.3 MEASURE DEFINITIONS FOR DETERMINISTIC E AND G:

While Theorem 1 and Propositions 1 and 2 hold for any encoder p E (z|x) and generator p G (x|z), stochastic or deterministic, Theorems 2 and 3 assume the encoder E and generator G are deterministic functions; i.e., with conditionals p E (z|x) = δ(z -E(x)) and p G (x|z) = δ(x -G(z)) defined as δ functions.

We'll make use of the definitions of P EX and P GZ for deterministic E and G found in Appendix A.3. The integral term of the KL divergence expression given in (6) over a particular region R ⊆ Ω will be denoted by

F (R) := R log dP EX d (P EX + P GZ ) dP EX = R log f dP EX .

Next we will show that f > 0 holds P EX -almost everywhere, and hence F is always well defined and finite. We then show that F is equivalent to an autoencoder-like reconstruction loss function.

Proposition 3 f > 0 P EX -almost everywhere.

Proof. Let R f =0 := {(x, z) ∈ Ω : f (x, z) = 0} be the region of Ω in which f = 0. Using the definition of the Radon-Nikodym derivative f , the measure

P EX (R f =0 ) = R f =0 f d(P EX + P GZ ) = R f =0 0 d(P EX + P GZ ) = 0 is zero. Hence f > 0 P EX -almost everywhere.

Proposition 3 ensures that log f is defined P EX -almost everywhere, and F (R) is well-defined. Next we will show that F (R) mimics an autoencoder with 0 loss, meaning F is zero for any region in which G(E(x)) = x, and non-zero otherwise.

Proposition 4 The KL divergence F outside the support of P GZ is zero: F (Ω \ supp(P GZ )) = 0.

We'll first show that in region R S := Ω \ supp(P GZ ), we have f = 1 P EX -almost everywhere. Let R f <1 := {(x, z) ∈ R S : f (x, z) < 1} be the region of R S in which f < 1. Let's assume that P EX (R f <1 ) > 0 has non-zero measure. Then, using the definition of the Radon-Nikodym derivative,

P EX (R f <1 ) = R f <1 f d(P EX + P GZ ) = R f <1 f ≤ε<1 dP EX + R f <1 f dP GZ 0 ≤ εP EX (R f <1 ) < P EX (R f <1 ),

where ε is a constant smaller than 1. But P EX (R f <1 ) < P EX (R f <1 ) is a contradiction; hence P EX (R f <1 ) = 0 and f = 1 P EX -almost everywhere in R S , implying log f = 0 P EX -almost everywhere in R S . Hence F (R S ) = 0.

By definition, F (Ω \ supp(P EX )) = 0 is also zero. The only region where F might be non-zero is R1 := supp(P EX ) ∩ supp(P GZ ).

Proposition 5 f < 1 P EX -almost everywhere in R 1 .

Let R f =1 := (x, z) ∈ R 1 : f (x, z) = 1 be the region in which f = 1. Let's assume the set R f =1 = ∅ is not empty. By definition of the support 1 , P EX (R f =1 ) > 0 and P GZ (R f =1 ) > 0. The Radon-Nikodym derivative on R f =1 is then given by

P EX (R f =1 ) = R f =1 f d(P EX + P GZ ) = R f =1 1 d(P EX + P GZ ) = P EX (R f =1 ) + P GZ (R f =1 ),

which implies P GZ (R f =1 ) = 0 and contradicts the definition of support. Hence R f =1 = ∅ and f < 1 P EX -almost everywhere on R 1 , implying log f < 0 P EX -almost everywhere.

Theorem 3 The encoder and generator objective given an optimal discriminator C(E, G) := max D V (D, E, G) can be rewritten as an 0 autoencoder loss function

C(E, G) = E x∼p X 1 [E(x)∈ ΩZ ∧G(E(x))=x] log f EG (x, E(x)) + E z∼p Z 1 [G(z)∈ ΩX ∧E(G(z))=z] log (1 -f EG (G(z), z))

with log f EG ∈ (-∞, 0) and log (1 -f EG ) ∈ (-∞, 0) P EX -almost and P GZ -almost everywhere.

Proof. Proposition 4 (F (Ω \ supp(P GZ )) = 0) and F (Ω \ supp(P EX )) = 0 imply that R 1 := supp(P EX ) ∩ supp(P GZ ) is the only region of Ω where F may be non-zero; hence F (Ω) = F (R 1 ). x ∈ ΩX condition from inside an expectation over P X , as P X -almost all x / ∈ ΩX have 0 probability.) Therefore,

D KL P EX P EX +P GZ 2 -log 2 = F (Ω) = F (R 1 ) = R 1 log f (x, z) dP EX = Ω 1 [(x,z)∈R 1 ] log f (x, z) dP EX = E (x,z)∼P EX 1 [(x,z)∈R 1 ] log f (x, z) = E x∼p X 1 [(x,E(x))∈R 1 ] log f (x, E(x)) = E x∼p X 1 [E(x)∈ ΩZ ∧G(E(x))=x] log f (x, E(x)) .

Finally, with Propositions 3 and 5, we have f ∈ (0, 1) P EX -almost everywhere in R 1 , and therefore log f ∈ (-∞, 0), taking a finite and strictly negative value P EX -almost everywhere.

An analogous argument (along with the fact that f EG + f GE = 1) lets us rewrite the other KL divergence term

D KL P GZ P EX +P GZ 2 -log 2 = E z∼p Z 1 [G(z)∈ ΩX ∧E(G(z))=z] log f GE (G(z), z) = E z∼p Z 1 [G(z)∈ ΩX ∧E(G(z))=z] log (1 -f EG (G(z), z))

The Jensen-Shannon divergence is the mean of these two KL divergences, giving C(E, G):

C .

In practice, θ G and θ E are updated by moving in the positive gradient direction of this inverse objective ∇ θ E ,θ G Λ, rather than the negative gradient direction of the original objective.

We also observed that learning behaved similarly when all parameters θ D , θ G , θ E were updated simultaneously at each iteration rather than alternating between θ D updates and θ G , θ E updates, so we took the simultaneous updating (non-alternating) approach for computational efficiency. (For standard GAN training, simultaneous updates of θ D , θ G performed similarly well, so our standard GAN experiments also follow this protocol.)

:

We use the definition U ∩ C = ∅ =⇒ µ(U ∩ C) > 0 here.

Figures and Tables:

Figure 2: Qualitative results for permutation-invariant MNIST BiGAN training, including generator samples G(z), real data x, and corresponding reconstructions G(E(x)).

Figure 3: The convolutional filters learned by the three modules (D, G, and E) of a BiGAN (left, top-middle) trained on the ImageNet (Russakovsky et al., 2015) database. We compare with the filters learned by a discriminator D trained with the same architecture (bottom-middle), as well as the filters reported by Noroozi & Favaro (2016), and by Krizhevsky et al. (2012) for fully supervised ImageNet training (right).

Figure 4: Qualitative results for ImageNet BiGAN training, including generator samples G(z), real data x, and corresponding reconstructions G(E(x)).

)) log (1 -D(x, z))] . Note that arg max y {a log y + (1 -a) log(1 -y)} = a for any a ∈ [0, 1]. Thus, D * EG = f EG . A.2 PROOF OF PROPOSITION 2 (ENCODER AND GENERATOR OBJECTIVE) Proposition 2 The encoder and generator's objective for an optimal discriminator C(E, G) := max D V (D, E, G) = V (D * EG , E, G) can be rewritten in terms of the Jensen-Shannon divergence between measures P EX and P GZ as C(E, G) = 2 D JS ( P EX || P GZ ) -log 4. Proof. Using Proposition 1 along with (5) (1 -D

EX ) = {(x, E(x)) : x ∈ ΩX } supp(P GZ ) = {(G(z), z) : z ∈ ΩZ } =⇒ R 1 := supp(P EX ) ∩ supp(P GZ ) = {(x, z) : E(x) = z ∧ x ∈ ΩX ∧ G(z) = x ∧ z ∈ ΩZ } So a point (x, E(x)) is in R 1 if x ∈ ΩX , E(x) ∈ ΩZ ,and G(E(x)) = x. (We can omit the

(E, G) = 2 D JS ( P EX || P GZ ) -log 4 = D KL P EX P EX +P GZ 2 + D KL P GZ P EX +P GZ 2-log 4= E x∼p X 1 [E(x)∈ ΩZ ∧G(E(x))=x] log f EG (x, E(x)) + E z∼p Z 1 [G(z)∈ ΩX ∧E(G(z))=z] log (1 -f EG (G(z), z))APPENDIX B LEARNING DETAILSIn this section we provide additional details on the BiGAN learning protocol summarized in Section 3.4.Goodfellow et al. (2014) found for GAN training that an objective in which the real and generated labels Y are swapped provides stronger gradient signal to G. We similarly observed in BiGAN training that an "inverse" objective Λ (with the same fixed point characteristics as V ) provides stronger gradient signal to G and E, whereΛ(D, G, E) = E x∼p X E z∼p E (•|x) [log (1 -D(x, z))]log(1-D(x,E(x)))+ E z∼p Z E x∼p G (•|z) [log D(x, z)]log D(G(z),z)

One Nearest Neighbors (1NN) classification accuracy (%) on the permutation-invariantMNIST (LeCun et al., 1998)  test set in the feature space learned by BiGAN, Latent Regressor (LR), Joint Latent Regressor (JLR), and an autoencoder (AE) using an 1 or 2 distance.

Table content: <table><tr><td>BiGAN</td><td>D</td><td>LR</td><td colspan="2">JLR AE ( 2 ) AE ( 1 )</td></tr><tr><td>97.39</td><td colspan="3">97.30 97.44 97.13</td><td>97.58</td><td>97.63</td></tr></table>

Classification accuracy (%) for the ImageNet LSVRC(Russakovsky et al., 2015) validation set with various portions of the network frozen, or reinitialized and trained from scratch, following the evaluation fromNoroozi & Favaro (2016). In, e.g., the conv3 column, the first three layers -conv1 through conv3 -are transferred and frozen, and the last layers -conv4, conv5, and fully connected layers -are reinitialized and trained fully supervised for ImageNet classification. BiGAN is competitive with these contemporary visual feature learning methods, despite its generality. (*Results fromNoroozi & Favaro (2016) are not directly comparable to those of the other methods as a different base convnet architecture with larger intermediate feature maps is used.) the BiGAN encoder E and generator G learn approximate inverse mappings, as shown theoretically in Theorem 2. In Appendix C.2, we present nearest neighbors in the BiGAN learned feature space.

Table content: <table><tr><td>.5</td><td>41.0</td><td>34.8</td><td>27.1</td><td>12.0</td></tr></table>

Classification and Fast R-CNN(Girshick, 2015) detection results for thePASCAL VOC  2007(Everingham et al., 2014) test set, and FCN(Long et al., 2015) segmentation results on the PASCAL VOC 2012 validation set, under the standard mean average precision (mAP) or mean intersection over union (mIU) metrics for each task. Classification models are trained with various portions of the AlexNet (

Table content: <table><tr><td/><td>FRCN</td><td>FCN</td></tr><tr><td>Classification</td><td colspan="2">Detection Segmentation</td></tr><tr><td>(% mAP)</td><td>(% mAP)</td><td>(% mIU)</td></tr></table>

Peer review (iclr2017):
The authors extend GANs by an inference path from the data space to the latent space and a discriminator that operates on the joint latend/data space. They show that the theoretical properties of GANs still hold for BiGAN and evaluate the features learned unsupervised in the inference path with respect to performance on supervised tasks after retraining deeper layers. I see one structural issue with this paper: Given that, as stated in the abstract, the main purpose of the paper is to learn unsupervised features (and not to improve GANs), the paper might spent too much space on detailing the relationship to GANs and all the theoretical properties. It is not clear whether they actually would help with the goal of learning good features. While reading the paper, I actually totally forgot about the unsupervised features until they reappeared on page 6. I think it would be helpful if the text of the paper would be more aligned with this main story. Still, the BiGAN framework is an elegant and compelling extension to GANs. However, it is not obvious how much the theoretical properties help us as the model is clearly not fully converged. To me, especially Figure 4 seems to suggest that G(E(x)) might be doing not much more than some kind of nearest neighbour retrival (and indeed one criticism for GANs has always been that they might just memorize some samples). By the way, it would be very interesting to know how well the discriminator actually performs after training. Coming back to the goal of learning powerful features: The method does not reach state-of-the-art performance on most evaluated tasks (Table 2 and 3) but performs competitive and it would be interesting to see how much this improves if the BiGAN training (and the convolutional architecture used) would be improved. The paper is very well written and provides most necessary details, although some more details on the training (learning rates, initialization) would be helpful for reproducing the results. Overall I think the paper provides a very interesting framework for further research, even though the results presented here are not too impressive both with respect to the feature evaluation (and the GAN learning). Minor: It might be helpful to highlight the best performance numbers in Tables 2 and 3.