Unsupervised Pixel-Level Domain Adaptation with Generative Adversarial Networks

12/16/2016 ∙ by Konstantinos Bousmalis, et al. ∙ Google 0

Collecting well-annotated image datasets to train modern machine learning algorithms is prohibitively expensive for many tasks. One appealing alternative is rendering synthetic data where ground-truth annotations are generated automatically. Unfortunately, models trained purely on rendered images often fail to generalize to real images. To address this shortcoming, prior work introduced unsupervised domain adaptation algorithms that attempt to map representations between the two domains or learn to extract features that are domain-invariant. In this work, we present a new approach that learns, in an unsupervised manner, a transformation in the pixel space from one domain to the other. Our generative adversarial network (GAN)-based method adapts source-domain images to appear as if drawn from the target domain. Our approach not only produces plausible samples, but also outperforms the state-of-the-art on a number of unsupervised domain adaptation scenarios by large margins. Finally, we demonstrate that the adaptation process generalizes to object classes unseen during training.



There are no comments yet.


page 1

page 4

page 5

page 6

page 11

page 14

page 15

Code Repositories


Domain Adaptation

view repo
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

(a) Image examples from the Linemod dataset.
(b) Examples generated by our model, trained on Linemod.
Figure 1: RGBD samples generated with our model vs real RGBD samples from the Linemod dataset [22, 46]. In each subfigure the top row is the RGB part of the image, and the bottom row is the corresponding depth channel. Each column corresponds to a specific object in the dataset. See Sect. 4 for more details.

Large and well–annotated datasets such as ImageNet

[9], COCO [29] and Pascal VOC [12]

are considered crucial to advancing computer vision research. However, creating such datasets is prohibitively expensive. One alternative is the use of synthetic data for model training. It has been a long-standing goal in computer vision to use game engines or renderers to produce virtually unlimited quantities of labeled data. Indeed, certain areas of research, such as deep reinforcement learning for robotics tasks, effectively require that models be trained in synthetic domains as training in real–world environments can be excessively expensive 

[38, 43]. Consequently, there has been a renewed interest in training models in the synthetic domain and applying them in real–world settings [8, 48, 38, 43, 25, 32, 35, 37]. Unfortunately, models naively trained on synthetic data do not typically generalize to real images.

A solution to this problem is using unsupervised domain adaptation. In this setting, we would like to transfer knowledge learned from a source domain, for which we have labeled data, to a target domain for which we have no labels. Previous work either attempts to find a mapping from representations of the source domain to those of the target [41], or seeks to find domain-invariant representations that are shared between the two domains  [14, 44, 31, 5]. While such approaches have shown good progress, they are still not on par with purely supervised approaches trained only on the target domain.

In this work, we train a model to change images from the source domain to appear as if they were sampled from the target domain while maintaining their original content. We propose a novel Generative Adversarial Network (GAN)–based architecture that is able to learn such a transformation in an unsupervised manner, i.e. without using corresponding pairs from the two domains. Our unsupervised pixel-level domain adaptation method (PixelDA) offers a number of advantages over existing approaches:

Decoupling from the Task-Specific Architecture:

In most domain adaptation approaches, the process of domain adaptation and the task-specific architecture used for inference are tightly integrated. One cannot switch a task–specific component of the model without having to re-train the entire domain adaptation process. In contrast, because our PixelDA model maps one image to another at the pixel level, we can alter the task-specific architecture without having to re-train the domain adaptation component.

Generalization Across Label Spaces:

Because previous models couple domain adaptation with a specific task, the label spaces in the source and target domain are constrained to match. In contrast, our PixelDA model is able to handle cases where the target label space at test time differs from the label space at training time.

Training Stability:

Domain adaptation approaches that rely on some form of adversarial training [5, 14] are sensitive to random initialization. To address this, we incorporate a task–specific loss trained on both source and generated images and a pixel similarity regularization that allows us to avoid mode collapse [40]

and stabilize training. By using these tools, we are able to reduce variance of performance for the same hyperparameters across different random initializations of our model (see

section 4).

Data Augmentation:

Conventional domain adaptation approaches are limited to learning from a finite set of source and target data. However, by conditioning on both source images and a stochastic noise vector, our model can be used to create virtually unlimited stochastic samples that appear similar to images from the target domain.


The output of PixelDA, a domain–adapted image, is much more easily interpreted than a domain adapted feature vector.

To demonstrate the efficacy of our strategy, we focus on the tasks of object classification and pose estimation, where the object of interest is in the foreground of a given image, for both source and target domains. Our method outperforms the state-of-the-art unsupervised domain adaptation techniques on a range of datasets for object classification and pose estimation, while generating images that look very similar to the target domain (see

Figure 1).

2 Related Work

Learning to perform unsupervised domain adaptation is an open theoretical and practical problem. While much prior work exists, our literature review focuses primarily on Convolutional Neural Network (CNN) methods due to their empirical superiority on the problem 

[14, 31, 41, 45].

Unsupervised Domain Adaptation:

Ganin et al[13, 14] and Ajakan et al[3]

introduced the Domain–Adversarial Neural Network (DANN): an architecture trained to extract domain-invariant features. Their model’s first few layers are shared by two classifiers: the first predicts task-specific class labels when provided with source data while the second is trained to predict the domain of its inputs. DANNs minimize the domain classification loss with respect to parameters specific to the domain classifier, while maximizing it with respect to the parameters that are common to both classifiers. This minimax optimization becomes possible in a single step via the use of a gradient reversal layer. While DANN’s approach to domain adaptation is to make the features extracted from both domains similar, our approach is to adapt the source images to look as if they were drawn from the target domain. Tzeng

et al. [45] and Long et al. [31] proposed versions of DANNs where the maximization of the domain classification loss is replaced by the minimization of the Maximum Mean Discrepancy (MMD) metric [20], computed between features extracted from sets of samples from each domain. Ghifary et al. [ghifary2016deep] propose an alternative model in which the task loss for the source domain is combined with a reconstruction loss for the target domain, which results in learning domain-invariant features. Bousmalis et al. [5] introduce a model that explicitly separates the components that are private to each domain from those that are common to both domains. They make use of a reconstruction loss for each domain, a similarity loss (eg. DANN, MMD) which encourages domain invariance, and a difference loss which encourages the common and private representation components to be complementary.

Other related techniques involve learning a mapping from one domain to the other at a feature level. In such a setup, the feature extraction pipeline is fixed during the domain adaptation optimization. This has been applied in various non-CNN based approaches [17, 6, 19] as well as the more recent CNN-based Correlation Alignment (CORAL) [41] algorithm.

Generative Adversarial Networks:

Our model uses GANs [18] conditioned on source images and noise vectors. Other recent works have also attempted to use GANs conditioned on images. Ledig et al. [28]

used an image-conditioned GAN for super-resolution. Yoo

et al. [47] introduce the task of generating images of clothes from images of models wearing them, by training on corresponding pairs of the clothes worn by models and on a hanger. In contrast to our work, neither method conditions on both images and noise vectors, and ours is also applied to an entirely different problem space.

The work perhaps most similar to ours is that of Liu and Tuzel [30] who introduce an architecture of a pair of coupled GANs, one for the source and one for the target domain, whose generators share their high-layer weights and whose discriminators share their low-layer weights. In this manner, they are able to generate corresponding pairs of images which can be used for unsupervised domain adaptation. on the ability to generate high quality samples from noise alone.

Style Transfer:

The popular work of Gatys et al. [15, 16] introduced a method of style transfer

, in which the style of one image is transferred to another while holding the content fixed. The process requires backpropagating back to the pixels. Johnson

et al. [24] introduce a model for feed forward style transfer. They train a network conditioned on an image to produce an output image whose activations on a pre-trained model are similar to both the input image (high-level content activations) and a single target image (low-level style activations). However, both of these approaches are optimized to replicate the style of a single image as opposed to our work which seeks to replicate the style of an entire domain of images.

3 Model

Figure 2: An overview of the model architecture. On the left, we depict the overall model architecture following the style in [34]. On the right, we expand the details of the generator and the discriminator components. The generator generates an image conditioned on a synthetic image and a noise vector . The discriminator discriminates between real and fake images. The task–specific classifier assigns task–specific labels

to an image. A convolution with stride 1 and 64 channels is indicated as n64s1 in the image. lrelu stands for leaky ReLU nonlinearity. BN stands for a batch normalization layer and FC for a fully connected layer. Note that we are not displaying the specifics of

as those are different for each task and decoupled from the domain adaptation process.

We begin by explaining our model for unsupervised pixel-level domain adaptation (PixelDA) in the context of image classification, though our method is not specific to this particular task. Given a labeled dataset in a source domain and an unlabeled dataset in a target domain, our goal is to train a classifier on data from the source domain that generalizes to the target domain. Previous work performs this task using a single network that performs both domain adaptation and image classification, making the domain adaptation process specific to the classifier architecture. Our model decouples the process of domain adaptation from the process of task-specific classification, as its primary function is to adapt images from the source domain to make them appear as if they were sampled from the target domain. Once adapted, any off-the-shelf classifier can be trained to perform the task at hand as if no domain adaptation were required. Note that we assume that the differences between the domains are primarily low-level (due to noise, resolution, illumination, color) rather than high-level (types of objects, geometric variations, etc).

More formally, let represent a labeled dataset of samples from the source domain and let represent an unlabeled dataset of samples from the target domain. Our pixel adaptation model consists of a generator function , parameterized by , that maps a source domain image and a noise vector to an adapted, or fake, image . Given the generator function , it is possible to create a new dataset of any size. Finally, given an adapted dataset , the task-specific classifier can be trained as if the training and test data were from the same distribution.

3.1 Learning

To train our model, we employ a generative adversarial objective to encourage to produce images that are similar to the target domain images. During training, our generator maps a source image and a noise vector to an adapted image . Furthermore, the model is augmented by a discriminator function that outputs the likelihood that a given image has been sampled from the target domain. The discriminator tries to distinguish between ‘fake’ images produced by the generator, and ‘real’ images from the target domain . Note that in contrast to the standard GAN formulation [18] in which the generator is conditioned only on a noise vector, our model’s generator is conditioned on both a noise vector and an image from the source domain. In addition to the discriminator, the model is also augmented with a classifier which assigns task-specific labels to images .

Our goal is to optimize the following minimax objective:


where and are weights that control the interaction of the losses. represents the domain loss:


is a task-specific loss, and in the case of classification we use a typical softmax cross–entropy loss:



is the one-hot encoding of the class label for source input

. Notice that we train with both adapted and non-adapted source images. When training only on adapted images, it’s possible to achieve similar performance, but doing so may require many runs with different initializations due to the instability of the model. Indeed, without training on source as well, the model is free to shift class assignments (e.g. class 1 becomes 2, class 2 becomes 3 etc) while still being successful at optimizing the training objective. We have found that training classifier on both source and adapted images avoids this scenario and greatly stabilizes training (See Table 5). might use a different label space (See Table 4).

In our implementation,

is a convolutional neural network with residual connections that maintains the resolution of the original image as illustrated in figure

2. Our discriminator is also a convolutional neural network. The minimax optimization of Equation 1 is achieved by alternating between two steps. During the first step, we update the discriminator and task-specific parameters , while keeping the generator parameters fixed. During the second step we fix and update .

3.2 Content–similarity loss

In certain cases, we have prior knowledge regarding the low-level image adaptation process. For example, we may expect the hues of the source and adapted images to be the same. In our case, for some of our experiments, we render single objects on black backgrounds and consequently we expect images adapted from these renderings to have similar foregrounds and different backgrounds from the equivalent source images. Renderers typically provide access to z-buffer masks that allow us to differentiate between foreground and background pixels. This prior knowledge can be formalized via the use of an additional loss that penalizes large differences between source and generated images for foreground pixels only. Such a similarity loss grounds the generation process to the original image and helps stabilize the minimax optimization, as shown in Sect. 4.4 and Table 5. Our optimization objective then becomes:


where , , and are weights that control the interaction of the losses, and is the content–similarity loss.

A number of losses could anchor the generated image to the original image in some meaningful way (e.g. L1, or L2 loss, similarity in terms of the activations of a pretrained VGG network). In our experiments for learning object instance classification from rendered images, we use a masked pairwise mean squared error, which is a variation of the pairwise mean squared error (PMSE) [11]. This loss penalizes differences between pairs of pixels rather than absolute differences between inputs and outputs. Our masked version calculates the PMSE between the generated foreground and the source foreground. Formally, given a binary mask , our masked-PMSE loss is:


where is the number of pixels in input , is the squared -norm, and is the Hadamard product. This loss allows the model to learn to reproduce the overall shape of the objects being modeled without wasting modeling power on the absolute color or intensity of the inputs, while allowing our adversarial training to change the object in a consistent way. Note that the loss does not hinder the foreground from changing but rather encourages the foreground to change in a consistent way. In this work, we apply a masked PMSE loss for a single foreground object because of the nature of our data, but one can trivially extend this to multiple foreground objects.

4 Evaluation

Figure 3: Visualization of our model’s ability to generate samples when trained to adapt MNIST to MNIST-M. (a) Source images from MNIST; (b) The samples adapted with our model with random noise ; (c) The nearest neighbors in the MNIST-M training set of the generated samples in the middle row. Differences between the middle and bottom rows suggest that the model is not memorizing the target dataset.

We evaluate our method on object classification datasets used in previous work111The most commonly used dataset for visual domain adaptation in the context of object classification is Office [39]. However, we do not use it in this work as there are significant high–level variations due to label pollution. For more information, see the relevant explanation in [5]., including MNIST, MNIST-M [14], and USPS [10] as well as a variation of the LineMod dataset [22, 46], a standard for object instance recognition and 3D pose estimation, for which we have synthetic and real data. Our evaluation is composed of qualitative and quantitative components, using a number of unsupervised domain adaptation scenarios. The qualitative evaluation involves the examination of the ability of our method to learn the underlying pixel adaptation process from the source to the target domain by visually inspecting the generated images. The quantitative evaluation involves a comparison of the performance of our model to previous work and to “Source Only” and “Target Only” baselines that do not use any domain adaptation. In the first case, we train models only on the unaltered source training data and evaluate on the target test data. In the “Target Only” case we train task models on the target domain training set only and evaluate on the target domain test set. The unsupervised domain adaptation scenarios we consider are listed below: MNIST to USPS: Images of the 10 digits (0-9) from the MNIST [27] dataset are used as the source domain and images of the same 10 digits from the USPS [10] dataset represent the target domain. To ensure a fair comparison between the “Source–Only” and domain adaptation experiments, we train our models on a subset of 50,000 images from the original 60,000 MNIST training images. The remaining 10,000 images are used as validation set for the “Source–Only” experiment. The standard splits for USPS are used, comprising of 6,562 training, 729 validation, and 2,007 test images.

MNIST to MNIST-M: MNIST [27] digits represent the source domain and MNIST-M [14] digits represent the target domain. MNIST-M is a variation on MNIST proposed for unsupervised domain adaptation. Its images were created by using each MNIST digit as a binary mask and inverting with it the colors of a background image. The background images are random crops uniformly sampled from the Berkeley Segmentation Data Set (BSDS500) [4]. All our experiments follow the experimental protocol by [14]. We use the labels for 1,000 out of the 59,001 MNIST-M training examples to find optimal hyperparameters.

Synthetic Cropped LineMod to Cropped LineMod: The LineMod dataset [22] is a dataset of small objects in cluttered indoor settings imaged in a variety of poses. We use a cropped version of the dataset  [46], where each image is cropped with one of 11 objects in the center. The 11 objects used are ‘ape’, ‘benchviseblue’, ‘can’, ‘cat’, ‘driller’, ‘duck’, ‘holepuncher’, ‘iron’, ‘lamp’, ‘phone’, and ‘cam’. A second component of the dataset consists of CAD models of these same 11 objects in a large variety of poses rendered on a black background, which we refer to as Synthetic Cropped LineMod. We treat Synthetic Cropped LineMod as the source dataset and the real Cropped LineMod as the target dataset. We train our model on 109,208 rendered source images and 9,673 real-world target images for domain adaptation, 1,000 for validation, and a target domain test set of 2,655 for testing. Using this scenario, our task involves both classification and pose estimation. Consequently, our task–specific network outputs both a class and a 3D pose estimate in the form of a positive unit quaternion vector . The task loss becomes:


where the first and second terms are the classification loss, similar to subsection 3.1, and the third and fourth terms are the log of a 3D rotation metric for quaternions [23]. is the weight for the pose loss, represents the ground truth 3D pose of a sample, , . Table 2 reports the mean angle the object would need to be rotated (on a fixed 3D axis) to move from predicted to ground truth pose [22].

Figure 4: Visualization of our model’s ability to generate samples when trained to adapt Synth Cropped Linemod to Cropped Linemod. Top Row: Source RGB and Depth image pairs from Synth Cropped LineMod ; Middle Row: The samples adapted with our model with random noise ; Bottom Row: The nearest neighbors between the generated samples in the middle row and images from the target training set. Differences between the generated and target images suggest that the model is not memorizing the target dataset.

4.1 Implementation Details

All the models are implemented using TensorFlow

222Our code is available here: https://goo.gl/fAwCPw [1] and are trained with the Adam optimizer [26]. We optimize the objective in Equation 1 for “MNIST to USPS” and “MNIST to MNIST-M” scenarios and the one in Equation 4 for the “Synthetic Cropped Linemod to Cropped Linemod” scenario. We use batches of 32 samples from each domain and the input images are zero-centered and rescaled to . In our implementation, we let take the form of a convolutional residual neural network that maintains the resolution of the original image as shown in Figure 2. is a vector of

elements, each sampled from a uniform distribution

. It is fed to a fully connected layer which transforms it to a channel of the same resolution as that of the image channels, and is subsequently concatenated to the input as an extra channel. In all our experiments we use a with . The discriminator is a convolutional neural network where the number of layers depends on the image resolution: the first layer is a stride 1x1 convolution (motivated by [33]), which is followed by repeatedly stacking stride 2x2 convolutions until we reduce the resolution to less or equal to 4x4. The number of filters is in all layers of , and is 64 in the first layer of and repeatedly doubled in subsequent layers. The output of this pyramid is fed to a fully–connected layer with a single activation for the domain classification loss. 333Our architecture details can be found in the supplementary material. For all our experiments, the CNN topologies used for the task classifier are identical to the ones used in  [14, 5] to be comparable to previous work in unsupervised domain adaptation.

4.2 Quantitative Results

Model MNIST to MNIST to
Source Only 78.9 63.6 (56.6)
CORAL [41] 81.7 57.7
MMD [45, 31] 81.1 76.9
DANN [14] 85.1 77.4
DSN [5] 91.3 83.2
CoGAN [30] 91.2 62.0
Our PixelDA 95.9 98.2
Target-only 96.5 96.4 (95.9)
Table 1: Mean classification accuracy (%) for digit datasets. The “Source-only” and “Target-only” rows are the results on the target domain when using no domain adaptation and training only on the source or the target domain respectively. We note that our Source and Target only baselines resulted in different numbers than previously published works which we also indicate in parenthesis.

We have not found a universally applicable way to optimize hyperparameters for unsupervised domain adaptation. Consequently, we follow the experimental protocol of [5] and use a small set (1,000) of labeled target domain data as a validation set for the hyperparameters of all the methods we compare. We perform all experiments using the same protocol to ensure fair and meaningful comparison. The performance on this validation set can serve as an upper bound of a satisfactory validation metric for unsupervised domain adaptation. As we discuss in section 4.5, we also evaluate our model in a semi-supervised setting with 1,000 labeled examples in the target domain, to confirm that PixelDA is still able to improve upon the naive approach of training on this small set of target labeled examples.

We evaluate our model using the aforementioned combinations of source and target datasets, and compare the performance of our model’s task architecture to that of other state-of-the-art unsupervised domain adaptation techniques based on the same task architecture . As mentioned above, in order to evaluate the efficacy of our model, we first compare with the accuracy of models trained in a “Source Only” setting for each domain adaptation scenario. This setting represents a lower bound on performance. Next we compare models in a “Target Only” setting for each scenario. This setting represents a weak upper bound on performance—as it is conceivable that a good unsupervised domain adaptation model might improve on these results, as we do in this work for “MNIST to MNIST-M”.

Quantitative results of these comparisons are presented in Tables 1 and 2. Our method is able to not just achieve better results than previous work on the “MNIST to MNIST-M” scenario, it is also able to outperform the “Target Only” performance we are able to get with the same task classifier. Furthermore, we are also able to achieve state-of-the art results for the “MNIST to USPS” scenario. Finally, PixelDA is able to reduce the mean angle error for the “Synth Cropped Linemod to Cropped Linemod” scenario to more than half compared to the previous state-of-the-art.

4.3 Qualitative Results

The qualitative results of our model are illustrated in figures 1, 3, and 4. In figures 3 and 4 one can see the visualization of the generation process, as well as the nearest neighbors of our generated samples in the target domain. In both scenarios, it is clear that our method is able to learn the underlying transformation process that is required to adapt the original source images to images that look like they could belong in the target domain. As a reminder, the MNIST-M digits have been generated by using MNIST digits as a binary mask to invert the colors of a background image. It is clear from figure 3 that in the “MNIST to MNIST-M” case, our model is able to not only generate backgrounds from different noise vectors , but it is also able to learn this inversion process. This is clearly evident from e.g. digits and in the figure. In the “Synthetic Cropped Linemod to Cropped Linemod” case, our model is able to sample, in the RGB channels, realistic backgrounds and adjust the photometric properties of the foreground object. In the depth channel it is able to learn a plausible noise model.

Model Classification Mean Angle
Accuracy Error
Source-only 47.33%
MMD [45, 31] 72.35%
DANN [14] 99.90%
DSN [5] 100.00%
Our PixelDA 99.98%
Target-only 100.00%
Table 2: Mean classification accuracy and pose error for the “Synth Cropped Linemod to Cropped Linemod” scenario.

4.4 Model Analysis

We present a number of additional experiments that demonstrate how the model works and to explore potential limitations of the model.

Model–RGB-only Classification Mean Angle
Accuracy Error
Table 3: Mean classification accuracy and pose error when varying the background of images from the source domain. For these experiments we used only the RGB portions of the images, as there is no trivial or typical way with which we could have added backgrounds to depth images. For comparison, we display results with black backgrounds and Imagenet backgrounds (INet), with the “Source Only” setting and with our model for the RGB-only case.
Sensitivity to Used Backgrounds

In both the “MNIST to MNIST-M” and “Synthetic-Cropped LineMod to Cropped LineMod” scenarios, the source domains are images of digits or objects on black backgrounds. Our quantitative evaluation (Tables  1 and  2) illustrates the ability of our model to adapt the source images to the target domain style but raises two questions: Is it important that the backgrounds of the source images are black and how successful are data-augmentation strategies that use a randomly chosen background image instead? To that effect we ran additional experiments where we substituted various backgrounds in place of the default black background for the Synthetic Cropped Linemod dataset. The backgrounds are randomly selected crops of images from the ImageNet dataset. In these experiments we used only the RGB portion of the images —for both source and target domains— since we don’t have equivalent “backgrounds” for the depth channel. As demonstrated in Table 3, PixelDA is able to improve upon training ‘Source-only’ models on source images of objects on either black or random Imagenet backgrounds.

Generalization of the Model

Two additional aspects of the model are relevant to understanding its performance. Firstly, is the model actually learning a successful pixel-level data adaptation process, or is it simply memorizing the target images and replacing the source images with images from the target training set? Secondly, is the model able to generalize about the two domains in a fashion not limited to the classes of objects seen during training?

To answer the first question, we first run our generator on images from the source images to create an adapted dataset. Next, for each transferred image, we perform a pixel-space nearest neighbor lookup in the target training images to determine whether the model is simply memorizing images from the target dataset or not. Illustrations are shown in figures 3 and 4, where the top rows are samples from , the middle rows are generated samples , and the bottom rows are the nearest neighbors of the generated samples in the target training set. It is clear from the figures that the model is not memorizing images from the target training set.

Next, we evaluate our model’s ability to generalize to classes unseen during training. To do so, we retrain our best model using a subset of images from the source and target domains which includes only half of the object classes for the “Synthetic Cropped Linemod” to “Cropped Linemod” scenario. Specifically, the objects ‘ape’, ‘benchviseblue’, ‘can’, ‘cat’, ‘driller’, and ‘duck’ are observed during the training procedure, and the other objects are only used during testing. Once is trained, we fix its weights and pass the full training set of the source domain to generate images used for training the task-classifier . We then evaluate the performance of on the entire set of unobserved objects (6,060 samples), and the test set of the target domain for all objects for direct comparison with Table  2.

Test Set Classification Mean Angle
Accuracy Error
Unseen Classes
Full test set
Table 4: Performance of our model trained on only 6 out of 11 Linemod objects. The first row, ‘Unseen Classes,’ displays the performance on all the samples of the remaining 5 Linemod objects not seen during training. The second row, ‘Full test set,’ displays the performance on the target domain test set for all 11 objects.
Stability Study

We also evaluate the importance of the different components of our model. We demonstrate that while the task and content losses do not improve the overall performance of the model, they dramatically stabilize training. Training instability is a common characteristic of adversarial training, necessitating various strategies to deal with model divergence and mode collapse [40]

. We measure the standard deviation of the performance of our models by running each model

times with different random parameter initialization but with the same hyperparameters. Table 5 illustrates that the use of the task and content–similarity losses reduces the level of variability across runs.

Classification Mean Angle
Accuracy std Error std
- - - 23.26 16.33
- - 22.32 17.48
- 2.04 3.24
1.60 6.97
Table 5: The effect of using the task and content losses , on the standard deviation (std) of the performance of our model on the “Synth Cropped Linemod to Linemod” scenario. means we use source data to train ; means we use generated data to train ; means we use our content–similarity loss. A lower std on the performance metrics means that the results are more easily reproducible.

4.5 Semi-supervised Experiments

Finally, we evaluate the usefulness of our model in a semi–supervised setting, in which we assume we have a small number of labeled target training examples. The semi-supervised version of our model simply uses these additional training samples as extra input to classifier during training. We sample 1,000 examples from the Cropped Linemod not used in any previous experiment and use them as additional training data. We evaluate the semi-supervised version of our model on the test set of the Cropped Linemod target domain against the 2 following baselines: (a) training a classifier only on these 1,000 target samples without any domain adaptation, a setting we refer to as ‘1,000-only’; and (b) training a classifier on these 1,000 target samples and the entire Synthetic Cropped Linemod training set with no domain adaptation, a setting we refer to as ‘Synth+1000’. As one can see from Table  6 our model is able to greatly improve upon the naive setting of incorporating a few target domain samples during training. We also note that PixelDA leverages these samples to achieve an even better performance than in the fully unsupervised setting (Table  2).

Method Classification Mean Angle
Accuracy Error
Our PixelDA
Table 6: Semi-supervised experiments for the “Synthetic Cropped Linemod to Cropped Linemod” scenario. When a small set of 1,000 target data is available to our model, it is able to improve upon baselines trained on either just these 1,000 samples or the synthetic training set augmented with these labeled target samples.

5 Conclusion

We present a state-of-the-art method for performing unsupervised domain adaptation. Our PixelDA models outperform previous work on a set of unsupervised domain adaptation scenarios, and in the case of the challenging “Synthetic Cropped Linemod to Cropped Linemod” scenario, our model more than halves the error for pose estimation compared to the previous best result. They are able to do so by using a GAN–based technique, stabilized by both a task-specific loss and a novel content–similarity loss. Furthermore, our model decouples the process of domain adaptation from the task-specific architecture, and provides the added benefit of being easy to understand via the visualization of the adapted image outputs of the model.


The authors would like to thank Luke Metz, Kevin Murphy, Augustus Odena, Ben Poole, Alex Toshev, and Vincent Vanhoucke for suggestions on early drafts of the paper.


Supplementary Material

A Additional Generated Images

Figure 1:

Linear interpolation between two random noise vectors demonstrates that the model is able to separate out style from content in the MNIST-M dataset. Each row is generated from the same MNIST digit, and each column is generated with the same noise vector.

Figure 2: Additional generation examples for the LineMod dataset. The left 4 columns are generated images and depth channels, while the corresponding right 4 columns are L2 nearest neighbors.

B Model Architectures and Parameters

Figure 3: Task classifier (T) architectures for each dataset. We use the same task classifiers as  [5, 14] to enable fair comparisons. The MNIST-M classifier is used for USPS, MNIST, and MNIST-M classification. During training, the task classifier is applied to both the synthetic and generated images when is enabled (see Paper Table 5). The ’Private’ parameters are only trained on one of these sets of images, while the ’Shared’ parameters are shared between the two. At test time on the target domain images, the classifier is composed of the Shared parameters and the Private parameters which are part of the generated images classifier. These first private layers allow the classifier to share high level layers even when the synthetic and generated images have different channels (such as 1 channel MNIST and RGB MNIST-M).

We present the exact model architectures used for each experiment along with hyperparameters needed to reproduce results. The general form for the generator, G, and discriminator, D, are depicted in Figure 2 of the paper. For G, we vary the number of filters and the number of residual blocks. For D, we vary the amount of regularization and the number of layers.

Optimization consists of alternating optimization of the discriminator and task classifier parameters, referred to as the D step, with optimization of the generator parameters, referred to as the G step.

Unless otherwise specified, the following hyperparameters apply to all experiments:

  • Batch size 32

  • Learning rate decayed by 0.95 every 20,000 steps

  • All convolutions have a 3x3 filter kernel

  • Inject noise drawn from a zero centered Gaussian with stddev 0.2 after every layer of discriminator

  • Dropout every layer in discriminator with keep probability of 90%

  • Input noise vector is 10 dimensional sampled from a uniform distribution

  • We follow conventions from the DCGAN paper [36] for several aspects

    • An L2 weight decay of is applied to all parameters

    • Leaky ReLUs have a leakiness parameter of 0.2

    • Parameters initialized from zero centered Gaussian with stddev 0.02

    • We use the ADAM optimizer with

b.1 USPS Experiments

The Generator and Discriminator are identical to the MNIST-M experiments.

Loss weights:
  • Base learning rate is

  • The discriminator loss weight is 1.0

  • The generator loss weight is 1.0

  • The task classifier loss weight in G step is 1.0

  • There is no similarity loss between the synthetic and generated images

b.2 MNIST-M Experiments (Paper Table 1)


The generator has 6 residual blocks with 64 filters each


The discriminator has 4 convolutions with 64, 128, 256, and 512 filters respectively. It has the same overall structure as paper Figure 2

Loss weights:
  • Base learning rate is

  • The discriminator loss weight is 0.13

  • The generator loss weight is 0.011

  • The task classifier loss weight in G step is 0.01

  • There is no similarity loss between the synthetic and generated images

b.3 LineMod Experiments

All experiments are run on a cluster of 10 TensorFlow workers. We benchmarked the inference time for the domain transfer on a single K80 GPU as 30 ms for a single example (averaged over 1000 runs) for the LineMod dataset.


The generator has 4 residual blocks with 64 filters each


The discriminator matches the depiction in paper Figure 2. The dropout keep probability is set to 35%.

Parameters without masked loss (Paper Table 2):
  • Base learning rate is , decayed by 0.75 every 95,000 steps

  • The discriminator loss weight is 0.004

  • The generator loss weight is 0.011

  • The task classification loss weight is 1.0

  • The task pose loss weight is 0.2

  • The task classifier loss weight in G step is 0

  • The task classifier is not trained on synthetic images

  • There is no similarity loss between the synthetic and generated images

Parameters with masked loss (Paper Table 5):
  • Base learning rate is , decayed by 0.75 every 95,000 steps.

  • The discriminator loss weight is 0.0088

  • The generator loss weight is 0.011

  • The task classification loss weight is 1.0

  • The task pose loss weight is 0.29

  • The task classifier loss weight in G step is 0

  • The task classifier is not trained on synthetic images

  • The MPSE loss weight is 22.9

C InfoGAN Connection

In the case that is a classifier, we can show that optimizing the task loss in the way described in the main text amounts to a variational approach to maximizing mutual information  [2], akin to the InfoGAN model  [7], between the predicted class and both the generated and the equivalent source images. The classification loss could be re-written, using conventions from  [7] as:


where represents mutual information, represents entropy, is assumed to be constant as in  [7],

is the random variable representing the class, and

is an approximation of the posterior distribution and is expressed in our model with the classifier . Again, notice that we maximize the mutual information of and the equivalent source and generated samples. By doing so, we are effectively regularizing the adaptation process to produce images that look similar for each class to the classifier . This helps maintain the original content of the source image and avoids, for example, transforming all objects belonging to one class to look like objects belonging to another.

D Deep Reconstruction-Classification Networks

Ghifary et al. [ghifary2016deep] report a result of 91.80% accuracy on the MNIST USPS domain pair, versus our result of 95.9%. We attempted to reproduce these results using their published code and our own implementation, but we were unable to achieve comparable performance.