Keywords

1 Introduction

The ability to generalize across datasets is one of the holy grails of computer vision. Designing models that can perform well on datasets sharing similar characteristics such as classes, but also presenting different underlying data structures (for instance different backgrounds, colorspaces, or acquired with different devices) is key in applications where labels are scarce or expensive to obtain. However, traditional learning machines struggle in performing well out of the datasets (or domains) they have been trained with. This is because models generally assume that both training (or source) and test (or target) data are issued from the same generating process. In vision problems, factors such as objects position, illumination, number of channels or seasonality break this assumption and call for adaptation strategies able to compensate for such shifts, or domain adaptation strategies [1].

In a first rough subdivision, domain adaptation strategies can be separated into unsupervised and semi-supervised domain adaptation: the former assumes that no labels are available in the target domain, while the latter assumes the presence of a few labeled instances in the target domain that can be used as reference points for the adaptation. In this paper, we propose a contribution for the former, more challenging case. Let \(\mathbf {x}^s \in \mathbb {X}^S\) be the source domain examples with the associated labels \(y^s \in \mathbb {Y}^S\). Similarly, let \(\mathbf {x}^t \in \mathbb {X}^T\) be the target domain images, but with unknown labels. The goal of the unsupervised domain adaptation is to learn the classifier f in the target domain by leveraging the information from the source domain. To this end, we have access to a source domain dataset \(\{\mathbf {x}^s_i,y^s \}_{i=1,\dots ,n^s}\) and a target domain dataset \(\{\mathbf {x}^t_i \}_{i=1,\dots ,n^t}\) with only observations and no labels.

Early unsupervised domain adaptation research tackled the problem as the one of finding a common representation between the domains, or a latent space, where a single classifier can be used independently from the datapoint’s origin [2, 3]. In [4], the authors propose to use discrete optimal transport to match the shifted marginal distributions of the two domains under constraints of class regularity in the source. In [5] a similar logic is used, but the joint distributions are aligned directly using a coupling accounting for the marginals and the class-conditional distributions shift jointly. However, the method has two drawbacks, for which we propose solutions in this paper: (1) first, the JDOT method in [5] scales poorly, as it must solve a \(n_1 \times n_2\) coupling, where \(n_1\) and \(n_2\) are the samples to be aligned; (2) secondly, the optimal transport coupling \(\gamma \) is computed between the input spaces (and using a \(\ell _2\) distance), which is a poor representation to be aligned, since we are interested in matching more semantic representations supposed to ease the work of the classifier using them to take decisions.

We solve the two problems above by a strategy based on deep learning. On the one hand, using deep learning algorithms for domain adaptation has found an increasing interest and has shown impressive results in recent computer vision literature [6,7,8,9]. On the other hand (and more importantly), a Convolutional Neural Network (CNN) offers the characteristics needed to solve our two problems: (1) by gradually adapting the optimal transport coupling along the CNN training, we obtain a scalable solution, an approximated and stochastic version of JDOT; (2) by learning the coupling in a deep layer of the CNN, we align the representation the classifier is using to take its decision, which is a more semantic representation of the classes. In summary, we learn jointly the embedding between the two domains and the classifier in a single CNN framework. We use a domain adaptation-tailored loss function based on optimal transport and therefore call our proposition Deep Joint Distribution Optimal Transportation (DeepJDOT).

We test DeepJDOT on a series of visual domain adaptation tasks and compare favorably against several recent state of the art competitors.

2 Related Works

Unsupervised Domain Adaptation. Unsupervised domain adaptation studies the situation where the source domain carries labeled instances, while the target domain is unlabeled, yet accessible during training [10]. Earlier approaches consider projections aligning data spaces to each other [2, 11, 12], thus trying to exploit shift-invariant information to match the domains in their original (input) space. Later works extended such logic to deep learning, typically by weight sharing [6]/reconstruction [13], by adding Maximum Mean Discrepancy (MMD) and association-based losses between source and target layers [14,15,16]. Other major developments focus on the inclusion of adversarial loss functions pushing the CNN to be unable to discriminate whether a sample comes from the source or the target domain [7, 8, 17]. Finally, the most recent works extend this adversarial logic to the use of GANs [18, 19], for example using two GAN modules with shared weights [9], forcing image to image architectures to have similar activation distributions [20] or simply fooling a GAN’s discriminator discerning between domains [21]. These adversarial image generation based methods [18,19,20] use a class-conditioning or cycle consistency term to learn the discriminative embedding, such that semantically similar images in both domains are projected closeby in the embedding space. Our proposed DeepJDOT uses the concept of a shared embedding for both domains [17] and is built on a similar logic as the MMD-based methods, yet adding a clear discriminative component to the alignment: the proposed DeepJDOT associates representation and discriminative learning, since the optimal transport coupling ensures that distributions are matched, while (i) the JDOT class loss performs source label propagation to the target samples  and (ii) the fact of learning the coupling in deep layers of the CNN ensures discrimination power.

Optimal Transport in Domain Adaptation. Optimal transport [22,23,24] has been used in domain adaptation to learn the transformation between domains [4, 25, 26], with associated theoretical guarantees [27]. In those works, the coupling \(\gamma \) is used to transport (i.e. transform) the source data samples through an estimated mapping called barycentric mapping. Then, a new classifier is trained on the transported source data representation. But those different methods can only address problems of small to medium sizes because they rely on the exact solution of the OT problem on all samples. Very recently, Shen et al. [28] used the Wasserstein distance as a loss in a deep learning setting to promote similarities between embedded representations using the dual formulation of the problem exposed in [29]. However, none of those approaches considers an adaptation w.r.t. the discriminative content of the representation, as we propose in this paper.

3 Optimal Transport for Domain Adaptation

Our proposal is based on optimal transport. After recalling the associated basic notions and its relation with domain adaptation, we detail the JDOT method [5], which is the starting point of our proposition.

3.1 Optimal Transport

Optimal transport [24] (OT) is a theory that allows to compare probability distributions in a geometrically sound manner. It permits to work on empirical distributions and to exploit the geometry of the data embedding space. Formally, OT searches a probabilistic coupling \(\gamma \in \varPi (\mu _1,\mu _2)\) between two distributions \(\mu _1\) and \(\mu _2\) which yields a minimal displacement cost

$$\begin{aligned} OT_c(\mu _1,\mu _2) = \inf _{\gamma \in \varPi (\mu _1,\mu _2)} \int _{\mathcal {R}^2} c(\mathbf {x}_1,\mathbf {x}_2)d \gamma (\mathbf {x}_1,\mathbf {x}_2) \end{aligned}$$
(1)

w.r.t. a given cost function \(c(\mathbf {x}_1,\mathbf {x}_2)\) measuring the dissimilarity between samples \(\mathbf {x}_1\) and \(\mathbf {x}_2\). Here, \(\varPi (\mu _1,\mu _2)\) describes the space of joint probability distributions with marginals \(\mu _1\) and \(\mu _2\). In a discrete setting (both distributions are empirical) this becomes:

$$\begin{aligned} OT_c(\mu _1,\mu _2) = \min _{\gamma \in \varPi (\mu _1,\mu _2)} <\gamma , \mathbf {C}>_F, \end{aligned}$$
(2)

where \(\langle \cdot , \cdot \rangle _F\) is the Frobenius dot product, \(\mathbf {C} \ge 0\) is a cost matrix \(\in \mathbb {R}^{n_1\times n_2}\) representing the pairwise costs \(c(\mathbf {x}_i,\mathbf {x}_j)\), and \(\gamma \) is a matrix of size \(n_1\times n_2\) with prescribed marginals. The minimum of this optimization problem can be used as a distance between distributions, and, whenever the cost c is a norm, it is referred to as the Wasserstein distance. Solving Eq. (2) is a simple linear programming problem with equality constraints, but scales super-quadratically with the size of the sample. Efficient computational schemes were proposed with entropic regularization [30] and/or stochastic versions using the dual formulation of the problem [29, 31, 32], allowing to tackle small to middle sized problems.

3.2 Joint Distribution Optimal Transport

Courty et al. [5] proposed the joint distribution optimal transport (JDOT) method to prevent the two-steps adaptation (i.e. first adapt the representation and then learn the classifier on the adapted features) by directly learning a classifier embedded in the cost function c. The underlying idea is to align the joint features/labels distribution instead of only considering the features distribution. Consequently, \(\mu _s\) and \(\mu _t\) are measures of the product space \(\mathcal {X}\times \mathcal {Y}\). The generalized cost associated to this space is expressed as a weighted combination of costs in the feature and label spaces, reading

$$\begin{aligned} d \left( \mathbf {x}_i^s, \mathbf {y}_i^s;\mathbf {x}_j^t, \mathbf {y}_j^t \right) = \alpha c(\mathbf {x}_i^s,\mathbf {x}_j^t) + \lambda _t L(\mathbf {y}_i^s,\mathbf {y}_j^t) \end{aligned}$$
(3)

for the i-th source and j-th target element, and where \(c(\cdot ,\cdot )\) is chosen as a \(\ell ^2_2\) distance and \(L(\cdot ,\cdot )\) is a classification loss (e.g. hinge or cross-entropy). Parameters \(\alpha \) and \( \lambda _t\) are two scalar values weighing the contributions of distance terms. Since target labels \(\mathbf {y}_j^t\) are unknown, they are replaced by a surrogate version \(f(\mathbf {x}_j^t)\), which depends on a classifier \(f:\mathcal {X}\rightarrow \mathcal {Y}\). Accounting for the classification loss leads to the following minimization problem:

$$\begin{aligned} \min _{f,\gamma \in \varPi (\mu _s,\mu _t)} <\gamma , \mathbf {D}_f>_F, \end{aligned}$$
(4)

where \(\mathbf {D}_f\) depends on f and gathers all the pairwise costs \(d(\cdot ,\cdot )\). As a by-product of this optimization problem, samples that share a common representation and a common label (through classification) are matched, yielding better discrimination. Interestingly, it is proven in [5] that minimizing this quantity is equivalent to minimizing a learning bound on the domain adaptation problem. However, JDOT has two major drawbacks: (i) on large datasets, solving for \(\gamma \) becomes intractable because \(\gamma \) scales quadratically in size to the number of samples; (ii) the cost \(c(\mathbf {x}_i^s,\mathbf {x}_j^t)\) is taken in the input space as the squared Euclidean norm on images and can be uninformative of the dissimilarity between two samples. Our proposed DeepJDOT solves those two issues by introducing a stochastic version computing only small couplings along the iterations of a CNN, and by the fact that the optimal transport is learned between the semantic representations in the deeper layers of the CNN, rather than in the image space.

Fig. 1.
figure 1

Overview of the proposed DeepJDOT method. While the structure of the feature extractor g and the classifier f are shared by both domains, they are represented twice to distinguish between the two domains. Both the latent representations and labels are used to compute per batch a coupling matrix \(\gamma \) that is used in the global loss function.

4 Proposed Method

4.1 Deep Joint Distribution Optimal Transport(DeepJDOT)

The DeepJDOT model, illustrated in Fig. 1, is composed of two parts: an embedding function \(g:\mathbf {x} \rightarrow \mathbf {z}\), where the input is mapped into the latent space Z, and the classifier \(f: \mathbf {z} \rightarrow \mathbf {y}\), which maps the latent space to the label space on the target domain. The latent space can be any feature layer provided by a model, as in our case the penultimate fully connected layer of a CNN. DeepJDOT optimizes jointly this feature space and the classifier to provide a method that performs well on the target domain. The solution to this problem can be achieved by minimizing the following objective function:

$$\begin{aligned} \min _{\gamma \in \varPi (\mu _s,\mu _t), f,g}\quad \sum _i\sum _j \gamma _{ij} d \left( g(\mathbf {x}_i^s), \mathbf {y}_i^s;g(\mathbf {x}_j^t), f(g(\mathbf {x}_j^t)) \right) , \end{aligned}$$
(5)

where \(d \left( g(\mathbf {x}_i^s), \mathbf {y}_i^s;g(\mathbf {x}_j^t), f(g(\mathbf {x}_j^t) \right) =\alpha \Vert g(x_i^s) - g(x_j^t) \Vert ^2 + \lambda _t L\left( y_i^s,f(g(x_j^t))\right) \), and \(\alpha \) and \(\lambda _t\) are the parameters controlling the tradeoff between the two terms, as in Eq. (3). Similarly to JDOT, the first term in the loss compares the compatibility of the embeddings for the source and target domain, while the second term considers the classifier f learned in the target domain and its regularity with respect to the labels available in the source. Despite similarities with the formulation of JDOT [5], our proposition comes with the notable difference that, in DeepJDOT, the Wasserstein distance is minimized between the joint (embedded space/label) distributions within the CNN, rather than between the original input spaces. As the deeper layers of a CNN encode both spatial and semantic information, we believe them to be more apt to describe the image content for both domains, rather than the original features that are affected by a number of factors such as illumination, pose or relative position of objects.

One can note that the formulation reported in Eq. (5) only depends on the classifier learned in the target domain. By doing so, one puts the emphasis on learning a good classifier for the target domain, and disregards the performance of the classifier when considering source samples. In recent literature, such a degradation in the source domain has been named as ‘catastrophic forgetting’ [33, 34]. To avoid such forgetting, one can easily re-incorporate the loss on the source domain in (5), leading to the final DeepJDOT objective:

$$\begin{aligned} \min _{\gamma , f,g} \frac{1}{n^s}\sum _i L_s\left( y_i^s, f(g(x_i^s))\right) + \sum _{i,j} \gamma _{ij} \left( \alpha \Vert g(x_i^s) - g(x_j^t) \Vert ^2 + \lambda _t L_t\left( y_i^s,f(g(x_j^t))\right) \right) . \end{aligned}$$
(6)

This last formulation is the optimization problem solved by DeepJDOT. However, for large sample sizes the constraint of computing a full \(\gamma \) yields a computationally infeasible problem, both in terms of memory and time complexity. In the next section, we propose an approximation method based on stochastic optimization.

4.2 Solving the Optimization Problem with Stochastic Gradients

In this section, we describe the approximate optimization procedure for solving DeepJDOT. Eq. (6) involves two groups of variables to be optimized: the OT matrix \(\gamma \) and the models f and g. This suggest the use of an alternative minimization approach (as proposed in the original JDOT). Indeed, when \(\hat{g}\) and \(\hat{f}\) are fixed, solving Eq. (6) boils down to a standard OT problem with associated cost matrix \(C_{ij} = \alpha \Vert \hat{g}(x_i^s) - \hat{g}(x_j^t) \Vert ^2 + \lambda _t L_t\left( y_i^s,\hat{f}(\hat{g}(x_j^t))\right) \). When fixing \(\hat{\gamma }\), optimizing g and f is a classical deep learning problem. However, computing the optimal coupling with the classical OT solvers is not scalable to large-scale datasets. Despite some recent development for large scale OT with general ground loss [31, 32], the model does not scale sufficiently to meet requirements of recent computer vision tasks.

Therefore, in this work we propose to solve the problem with a stochastic approximation using minibatches from both the source and target domains [35]. This approach has two major advantages: it is scalable to large datasets and can be easily integrated in modern deep learning frameworks. More specifically, the objective function (6) is approximated by sampling a mini-batch of size m, leading to the following optimization problem:

$$\begin{aligned} \min _{f,g} \mathbb {E}\left[ \frac{1}{m}\sum _{i=1}^{m} L_s\left( y_i^s, f(g(x_i^s)\right) +\min _{\gamma \in \Delta }\sum _{i,j}^{m} \gamma _{ij} \left( \alpha \Vert g(x_i^s) - g(x_j^t) \Vert ^2 + \lambda _t L_t\left( y_i^s,f(g(x_j^t))\right) \right) \right] \end{aligned}$$
(7)

where \(\mathbb {E}\) is the expected value with respect to the randomly sampled minibatches drawn from both source and target domains. The classification loss functions for the source (\(L_s\)) and target (\(L_t\)) domains can be any general class of loss functions that are twice differentiable. We opted for a traditional cross-entropy loss in both cases. Note that, as discussed in [35], the expected value over the minibtaches does not converge to the true OT coupling between every pair of samples, which might then lead to the appearance of connections between samples that would not have been connected in the full coupling. However, this can also be seen as a regularization that will promote sharing of the mass between neighboring samples. Finally note that we did not use the regularized version of OT as in [35], since it introduces an additional regularization parameter that should be cross-validated, which can make the model calibration even more complex. Still, the extension of DeepJDOT to regularized OT is straightforward and could be beneficial for high-dimensional embeddings g.

Consequently, we propose to obtain the stochastic update for Eq. (7) as follows (and summarized in Algorithm 4):

  1. 1.

    With fixed CNN parameters \((\hat{g},\hat{f})\) and for every randomly drawn minibatch (of m samples), obtain the coupling

    $$\begin{aligned} \min _{\gamma \in \varPi (\mu _s,\mu _t)}\quad \sum _{i,j=1}^{m} \gamma _{ij} \left( \alpha \Vert \hat{g}(x_i^s) - \hat{g}(x_j^t) \Vert ^2 + \lambda _t L_t\left( y_i^s,\hat{f}(g(x_j^t))\right) \right) \end{aligned}$$
    (8)

    using the network simplex flow algorithm.

  2. 2.

    With fixed coupling \(\hat{\gamma }\) obtained at the previous step, update the embedding function (g) and classifier (f) with stochastic gradient update for the following loss on the minibatch:

    $$\begin{aligned} \frac{1}{m}\sum _{i=1}^{m} L_s\left( y_i^s, f(g(x_i^s))\right) + \sum _{i,j=1}^{m} \hat{\gamma }_{ij} \left( \alpha \Vert g(x_i^s) - g(x_j^t) \Vert ^2 + \lambda _t L_t\left( y_i^s,f(g(x_j^t))\right) \right) . \end{aligned}$$
    (9)

    The domain alignment term aligns only the source and target samples with similar activation/labels and the sparse matrix \(\hat{\gamma }\) will automatically perform label propagation between source and target samples. The classifier f is simultaneously learnt in both source and target domain.

figure a

5 Experiments and Results

We evaluate DeepJDOT on three adaptation tasks: digits classification (Sect. 5.1), the OfficeHome dataset (Sect. 5.2), and the Visual Domain Adaptation challenge (visDA; Sect. 5.3). For each dataset, we first present the data, then detail the implementation and finally present and discuss the results.

5.1 Digit Classification

Datasets. We consider four data sources (domains) from the digits classification field: MNIST [36], USPS [37], MNIST-M, and the Street View House Numbers (SVHN) [38] dataset. Each dataset involves a 10-class classification problem (retrieving numbers 0-9):

  • USPS. The USPS datasets contains 7‘291 training and 2‘007 test grayscale images of handwritten images, each one of size \(16 \times 16\) pixels.

  • MNIST. The MNIST dataset contains 60‘000 training and 10‘000 testing grayscale images of size 28 \(\times \) 28.

  • MNIST M. We generated the MNIST-M images by following the protocol in [8]. MNIST-M is a variation on MNIST, where the (black) background is replaced by random patches extracted from the Berkeley Segmentation Data Set (BSDS500) [39]. The number of training and testing samples are the same as the MNIST dataset discussed above.

  • SVHN. The SVHN dataset contains house numbers extracted from Google Street View images. We used the Format2 version of SVHN, where the images are cropped into 32 \(\times \) 32 pixels. Multiple digits can appear in a single image, the objective is to detect the digit in the center of the image. This dataset contains 73‘212 training images, and 26‘032 testing images of size 32\(\times \) 32\(\times \)3. The respective examples of the each dataset is shown in Fig. 2.

Fig. 2.
figure 2

Examples from the MNIST, USPS, SVHN and MNIST-M datasets.

The three following experiments were run (the arrow direction corresponds to the sense of the domain adaptation):

  • USPS\(\leftrightarrow \)MNIST. The USPS images are zero-padded to reach the same size as MNIST dataset. The adaptation is considered in both directions: USPS \(\rightarrow \) MNIST, and MNIST \(\rightarrow \) USPS.

  • SVHN\(\rightarrow \)MNIST. The single-channel MNIST images are replicated three times to form a gray 3 channels image, and resized to match the resolution of the SVHN images. Here, the adaptation is considered in only one direction: SVHN\(\rightarrow \)MNIST. Adapting SVHN images to MNIST is challenging due to the variations in the SVHN images [8]

  • MNIST\(\rightarrow \)MNIST-M. MNIST is considered as the source domain and MNIST-M as the target domain. The color MNIST-M images can be easily identified by a human, however it is challenging for the CNN trained on MNIST, which is only grayscale. Again, the gray scale MNIST images are replicated three times to match the color resolution of the MNIST-M images.

Model. For all digits adaptation experiments, our embedding function g is trained from scratch with six \(3\times 3\) convolutional layers containing 32, 32, 64, 64, 128 and 128 filters, and one fully-connected layer of 128 hidden units followed by a sigmoid nonlinearity respectively. Classifier f then consists of a fully-connected layer, followed by a softmax to provide the class scores. The Adam optimizer (\(lr = 2e{-4}\)) is used to update our model using mini-batch sizes of \(m_S = m_T = 500\) for the two domains (50 samples per class in the source mini-batch). The hyper-parameters of DeepJDOT, \(\alpha = 0.001\) and \(\lambda _t = 0.0001\), are fixed experimentally.

We compare DeepJDOT with the following methods:

  • non-adversarial discrepancy methods: DeepCORAL [6], MMD [14], DRCN [40], DSN [41], AssocDA [16], Self-ensemble [42]Footnote 1,

  • adversarial discrepancy methods: DANN [8], ADDA [21],

  • adversarial image generation methods: CoGAN [9], UNIT [18], GenToAdapt [19] and I2I Adapt [20].

To ensure fair comparison, we re-implemented the most relevant competitors (CORAL, MMD, DANN, and ADDA). For the other methods, the results are directly reported from the respective articles.

Results. The performance of DeepJDOT on the four digits adaptation tasks is reported in Table 1. The first row (source only) shows the accuracies on target test data achieved with classifiers trained on source data without adaptation, and the row (target only) reports accuracies on the target test data achieved with classifiers trained on the target training data. This method is considered as an upper bound for our proposed method and can be seen as our gold standard. StochJDOT (stochastic adaptation of JDOT) refers to the accuracy of our proposed method, when the discrepancy between source and target domain is computed with an \(\ell _2\) distance in the original image space. Lastly, DeepJDOT-source indicates the source data accuracy, after adapting to the target domain, and can be considered a measure of catastrophic forgetting.

Fig. 3.
figure 3

t-SNE embeddings of 2‘000 test samples for MNIST (source) and MNIST-M (target) for Source only classifier, DANN, StochJDOT and DeepJDOT. The left column shows domain comparisons, where colors represent the domain. The right column shows the ability of the methods to discriminate classes (samples are colored w.r.t. their classes).

The experimental results show that DeepJDOT achieves accuracies comparable or higher to the current state-of-the-art methods. When the methods in the first block of Table 1 are considered, DeepJDOT outperforms the competitors by large margins, with the exception of DANN that have similar performance on the MNIST\(\rightarrow \)USPS task. In the more challenging adaptation settings (SVHN\(\rightarrow \)MNIST and MNIST\(\rightarrow \)MNIST-M), the state-of-the-art methodsFootnote 2 were not able to adapt well to the target domain. Next, when the methods in the second block of Table 1 is considered, our method showed impressive performance, despite DeepJDOT not using any complex procedure for generating target images to perform the adaptation.

t-SNE Embeddings. We visualize the quality of the embeddings for the source and target domain learnt by DeepJDOT, StochJDOT and DANN using t-SNE embedding on the MNIST\(\rightarrow \)MNIST-M adaptation task (Fig. 3). As expected, in the source model the samples from the source domain are well clustered and target samples are more scattered. The t-SNE embeddings with the DANN were not able to align the distributions well, and this observation also holds for StochJDOT. It is noted that StochJDOT does not align the distributions, but learns the classifier in target domain directly. The poor embeddings of the target samples with StochJDOT shows the necessity of computing the ground metric (cost function) of optimal transport in the deep CNN layers. Finally, DeepJDOT perfectly aligns the source domain samples and target domain samples to each other, which explains the good numerical performances reported above. The “tentacle”-shaped and near-perfect separation of the classes in the embedding illustrate the fact that DeepJDOT finds an embedding that both aligns the source/target distribution, but also maximizes the margin between the classes.

Table 1. Classification accuracy on the target test datasets for the digit classification tasks. Source only and target only refer to training on the respective datasets without domain adaptation and evaluating on the target test dataset. The accuracies reported in the first block are our own implementations, while the second block reports performances from the respective articles. Bold and italic indicates the best and second best results. The last line reports the performance of DeepJDOT on the source domain.

Ablation Study. Table 2 reports the results obtained in the USPS\(\rightarrow \)MNIST and MNIST\(\rightarrow \) MNIST-M cases for models using only parts of our proposed loss (Eq. (6)). When only the JDOT loss is considered (\(\alpha d+L_t\) case), the accuracy drops in both adaptation cases. This behavior might be due to overfitting of the target classifier to the noisy pseudo- (propagated) labels. However, the performance is comparable to non-adversarial discrepancy-based methods reported in Table 1. On the contrary, when only the feature space distribution is included in Eq. (6), i.e. the \(L_s+\alpha d\) experiment, the accuracy is close to our full model in USPS\(\rightarrow \)MNIST direction, but drops in the MNIST\(\rightarrow \) MNIST-M one. Overall the accuracies are improved compared to the original JDOT model, which highlights the importance of including the information from the source domain. Moreover, this also highlights the importance of simultaneously updating the classifier both in the source and target domain. Summarizing, this ablation study showed that the individual components bring complimentary information to achieve the best classification results.

Table 2. Ablation study of DeepJDOT.

5.2 Office-Home

Dataset. The Office-Home dataset [43] contains around \(15'500\) images in 65 categories from four different domains: artistic paintings, clipart, product and real-world images.

Model. In this case, we use a pre-trained VGG-16 model [44] with the last layer replaced, but perform no data augmentation. We use \(3'250\) samples per domain to compute the optimal couplings. We compared our model with following state-of-the-art methods: CORAL [45], JDA [46], DAN [47], DANN [8], and DAH [43].

Results. Table 3 lists the performance of DeepJDOT compared to a series of other adaptation methods. As can be seen, DeepJDOT outperforms all other models by a margin on all tasks, except for the adaptation from domain “product” to “clipart”.

Table 3. Performance of DeepJDOT on the Office-Home dataset. “Ar” = artistic paintings, “Cl” = clipart, “Pr” = product, “Rw” = real-world images. Performance figures of competitive methods are reported from [43].

5.3 VisDA-2017

Dataset. The Visual Domain Adaptation classification challenge of 2017 (VisDA-2017; [48]) requires training a model on renderings of 3D models for each of the 12 classes and adapting to natural images sampled from MS-COCO [49] (validation set) and YouTube BoundingBoxes [50] (test set), respectively. The test set performances reported here were evaluated on the official server.

Model. Due to VisDA’s strong adaptation complexity, we employ ResNet-50 [51] as a base model, replacing the last layer with two MLPs that map to 512 hidden an then to the 12 classes, respectively. We train a model on the source domain and then freeze it to calculate source feature vectors, adapting an intially identical copy to the target set. We use \(4'096\) samples per domain to calculate the couplings. Data augmentation follows the scheme of [42].

Results. DeepJDOT’s performance on VisDA-2017 is reported in Table 4 along with the baselines (DeepCORAL, DAN) from the evaluation serverFootnote 3 . Our entry in the evaluation server is mentioned as oatmil. We can see that our method achieved better accuracy than the distribution matching methods (DeepCORAL [6], DAN [47]) with all the classes, expect knife. We observe a negative transfer for the class car for DeepJDOT, however this phenomena is also valid with the most of the current methods (see the evaluation server results). For a fair comparison with the rest of the methods in the evaluation server, we also showed (values in bracket of Table 4) the accuracy difference between the source model and target model. Our method is ranked sixth when the mean accuracy is considered, and third when the difference between the source model and target model is considered at the time of publication. It is noted that the performance of our method depends on the capacity of the source model: if a larger CNN is used, the performance of our method could be improved further.

Table 4. Performance of DeepJDOT on the VisDA 2017 classification challenge. The scores in the bracket indicate the accuracy difference between the source (unadapted) model and target (adapted) model. The respective values of CORAL and DAN are reported from the evaluation server (See footnote 3).

6 Conclusions

In this paper, we proposed the DeepJDOT model for unsupervised deep domain adaptation based on optimal transport. The proposed method aims at learning a common latent space for the source and target distributions, that conveys discriminant information for both domains. This is achieved by minimizing the discrepancy of joint deep feature/labels domain distributions by means of optimal transport. We propose an efficient stochastic algorithm that solves this problem, and despite being simple and easily integrable into modern deep learning frameworks, our method outperformed the state-of-the-art on cross domain digits and office-home adaptation, and provided satisfactory results on the VisDA-2017 adaptation.

Future works will consider the evaluation of this method in multi-domains scenario, as well as more complicated cost functions taking into account similarities of the representations across the embedding layers and/or similarities of labels across different classifiers.