Domain Generalization by Learning and Removing Domain-specific Features
Abstract
Deep Neural Networks (DNNs) suffer from domain shift when the test dataset follows a distribution different from the training dataset.
Domain generalization aims to tackle this issue by learning a model that can generalize to unseen domains.
In this paper, we propose a new approach that aims to explicitly remove domain-specific features for domain generalization.
Following this approach, we propose a novel framework called Learning and Removing Domain-specific features for Generalization (LRDG) that learns a domain-invariant model by tactically removing domain-specific features from the input images.
Specifically, we design a classifier to effectively learn the domain-specific features for each source domain, respectively.
We then develop an encoder-decoder network to map each input image into a new image space where the learned domain-specific features are removed.
With the images output by the encoder-decoder network, another classifier is designed to learn the domain-invariant features to conduct image classification.
Extensive experiments demonstrate that our framework achieves superior performance compared with state-of-the-art methods.
Code is available at https://github.com/yulearningg/LRDG .
Introduction
Deep Neural Networks (DNNs) have achieved great performance in computer vision tasks [26].
However, the performance would drop if the test dataset follows a distribution different from the training dataset.
This issue is also known as domain shift [39].
Recent research has found that DNNs tend to learn decision rules differently from humans [17, 21, 16].
For example, in ImageNet-based [37] image classification tasks, Convolutional Neural Networks (CNNs) tend to learn local textures to discriminate objects, while we humans could use the knowledge of global object shapes as cues.
The features learned by the DNNs may only belong to specific domains and are not generalized for other domains.
For example, in real-world photos, objects belonging to the same category have similar textures, but in sketches [27], objects are only drawn by lines and contain no texture information.
For a CNN that uses textures to discriminate objects in the photos, poor performance can be expected when it is applied to the sketches.
This situation calls for DNNs that can learn features invariant across domains instead of learning features that are domain-specific.
In this paper, we focus on the research topic of domain generalization and follow the multiple source domain generalization setting in the literature.
Its goal is to train a model that can perform well on unseen domains.
In this setting, we can access multiple labeled source domains and one or more unlabeled target domains.
All the source and target domains share the same label space.
During the training process, the source domains are available but the target domains are unseen.
The target domains are only provided in the test phase.
One typical approach to domain generalization is to learn domain-invariant representations across domains [18, 30, 42, 3, 11, 14, 45, 31, 35].
This approach is based on the assumption that each domain has its domain-specific features and that all domains share domain-invariant features.
For example, textures are domain-specific features for the photos but shapes are domain-invariant features for both photos and sketches.
Previous works propose methods that seek to distill the domain-invariant features.
Although demonstrating promising performance, these methods do not clearly inform the deep neural networks that the domain-specific features shall be effectively removed.
Instead, it is only hoped that they would be removed through achieving the final goal of learning the domain-invariant features.
The lack of this clear guidance to the network may affect its learning efficacy.
In this paper, we propose a new approach that aims to explicitly remove the domain-specific features in order to achieve domain generalization.
As indicated above, CNNs tend to learn the domain-specific features rather than the domain-invariant features for classification.
To prevent this from taking place, we actively remove the domain-specific features and guide the CNNs to learn the domain-invariant features for classification.
Following this approach, we propose a novel framework:
Learning and
Removing Domain-specific features for Generalization (LRDG).
Our framework consists of domain-specific classifiers, an encoder-decoder network, and a domaininvariant classifier.
The training process of our framework includes two steps.
In the first step, each domain-specific classifier is designed to effectively learn the domain-specific features from one source domain.
Specifically, a domain-specific classifier is designed to discriminate the images across different classes within one particular source domain.
At the same time, this classifier is required to be unable to discriminate the images across different classes within any other source domain.
Each source domain therefore corresponds to one domain-specific classifier under this design.
In the second step, the encoder-decoder network maps the input images into a new image space where the domain-specific features learned above are to be removed from the input images by utilizing the domain-specific classifiers.
Different from the first step, each domain-specific classifier here is unable to discriminate the mapped images across different classes within the corresponding source domain.
The mapped images are expected to contain much fewer domain-specific features compared with the original input images.
The domain-invariant classifier is then appended to the encoder-decoder network and trained with the mapped images.
By this design, the encoder-decoder network actively removes the domain-specific features and the domain-invariant classifier will be better guided to learn the domain-invariant features.
Once trained, the encoder-decoder network and the domain-invariant classifier will be used for the classification of the unseen target domains.
It is worth noting that our framework is different from the data augmentation based methods for domain generalization [43, 34, 46, 7].
Our framework aims to remove the domain-specific features from the input images while the data augmentation based methods generate various images with novel domain-specific features.
Besides, our framework just maps the input images into a new image space and does not augment them to enlarge the training dataset.
We demonstrate the effectiveness of our framework with experiments on three benchmarks in domain generalization.
Our framework consistently achieves state-of-the-art performance.
We also experimentally verify that our framework effectively reduces the distribution difference among the source and target domains according to the generalization risk bound in the literature [2].
Proposed framework
Assuming that we are given N source domains D s
= { D 1 s , D 2 s , . . .
, D Ns } which follow different distributions.
For each domain (dataset), D is = { ( x ij , y ij ) } n i j =1 where n i is the number of samples in
D is , and ( x ij , y ij ) is the data-label pair for the j th sample in the i th domain.
Following the literature, we assume that all source and target domains share the same label space.
The goal of domain generalization is to use these source domains D s to learn a model for the unseen target domain D t .
𝐹𝐹𝐿𝐿 𝐶𝐶 𝐿𝐿 𝑈𝑈 : Uncertainty Loss 𝐿𝐿 𝐶𝐶 : Classification Loss
M 𝐱𝐱𝐱𝐱𝐱𝐱 N freeze 𝐱𝐱𝐱𝐱𝐱𝐱 𝑁𝑁 … …
𝐿𝐿 𝑈𝑈 𝐿𝐿 𝑈𝑈 𝐹𝐹𝐿𝐿 𝑈𝑈 freeze 𝐱𝐱𝐱𝐱𝐱𝐱 𝑁𝑁 … …
𝐿𝐿 𝐶𝐶 𝐿𝐿 𝑈𝑈 ��� … …
𝐹𝐹𝐹𝐹𝐹𝐹 𝑁𝑁 𝐹𝐹 𝐿𝐿 𝑈𝑈 𝐿𝐿 𝑈𝑈 𝐿𝐿 𝑈𝑈 𝐿𝐿 𝐶𝐶 𝐳𝐳𝐳𝐳𝐳𝐳 N 𝐿𝐿 𝑅𝑅
M 𝐱𝐱 t 𝐹𝐹 prediction 𝐱𝐱 𝑖𝑖 : Images from source domain 𝐷𝐷 𝑠𝑠𝑖𝑖 𝐹𝐹 𝑖𝑖 : Domain-specific Classifier for source domain 𝐷𝐷 𝑠𝑠𝑖𝑖
M : Encoder-decoder Network
F : Domain-invariant Classifier 𝐳𝐳 𝑖𝑖 : Mapped Images of 𝐱𝐱 𝑖𝑖 𝐿𝐿 𝑅𝑅 : Reconstruction Loss 𝐱𝐱 𝑡𝑡 : Images from target domain 𝐷𝐷 𝑡𝑡
[Figure]
) 𝐹𝐹 𝑁𝑁 freeze 𝐱𝐱𝐱𝐱𝐱𝐱 𝑁𝑁 … 𝐿𝐿 𝑈𝑈 … 𝐿𝐿 𝑈𝑈 𝐿𝐿 𝐶𝐶
Our work is inspired by recent work [32], where it uses a "lens" network (i.e. image-to-image translation network) to remove "shortcuts" (low-level visual features that a CNN can quickly learn, such as watermarks and color aberrations) from input images in a self-supervised learning task.
Differently, our work focuses on removing the domain-specific features from the input images for the domain generalization task.
We use an encoder-decoder network similar to the "lens" network, but we design a different method to leverage the encoder-decoder network to remove the domain-specific features.
In this section, we illustrate our framework in detail.
We also provide theoretical analysis for our framework.
Fig.
1 gives an overview of the entire framework.
2.1 Learning domain-specific features
Our framework starts by training N individual domain-specific classifiers F S
= { F 1 , F 2 , . .
. , F N } in which the classifier F i is designed to only use the domain-specific features from the source domain D is to discriminate images.
The domain-specific classifiers F S should not use the domaininvariant features as cues.
In other words, F i is expected to be able to effectively discriminate images across different classes within D is
but it should be difficult for F i to discriminate images across different classes within any other domains.
Domains excluding D is are used to maximize the classification uncertainty or adversarially increase the difficulty of classification for F i .
The classification performance of F i on the domains excluding D is should be similar to a random guess.
Specifically, the classifier F i is trained by minimizing a classification loss L F S C on D is ,
[Equation]
and maximizing an uncertainty loss L F S U on the remaining domains { D 1 s , . .
, D i
[Equation]
1 s
[Equation]
where θ i denotes the parameters of the classifier F i .
L C and L U are the classification loss function and the uncertainty loss function, respectively.
We use the cross-entropy loss as the classification loss.
For the uncertainty loss, since we aim to make the prediction similar to a random guess, we use entropy loss,
[Equation]
where C is the number of classes and p ( y = l | F i ( x kj ; θ i )) denotes the probability of x kj belonging to class l .
Least likely loss [32] is an alternative to the entropy loss.
The classifier first predicts an image and obtains the probabilities of all the classes.
The class with the lowest probability is called the least likely class.
This image is assigned with a label of this class.
Then we train the classifier to predict the least likely class.
The least likely loss is
[Equation]
where ˆ y kj = arg
[Equation]
However, experiments show that the entropy loss can better achieve the classification randomness than the least likely loss, so we use the entropy loss as the default uncertainty loss.
After training, we freeze the parameters θ of these domain-specific classifiers F S and use these classifiers to learn domain-invariant features.
2.2 Removing domain-specific features
To remove the domain-specific features learned by the domain-specific classifiers, we utilize an encoder-decoder network M that maps the images into a new image space Z .
The output images are fed into the domain-specific classifiers F S and a new domain-invariant classifier F .
Unlike the training of the domain-specific classifier F i where the source domain D is is used for minimizing the classification loss, on the contrary, the source domain D is in this step is used to maximize the uncertainty loss L MU
[Equation]
The parameters θ i of F i are frozen and the parameters θ M of the encoder-decoder network M are trained.
Maximizing the uncertainty loss forces the output image
z i = M
( x i ) to contain fewer domain-specific features than the input images.
In doing so, the encoder-decoder network can remove the domain-specific features in the input images x and retain domain-invariant features in the output images z .
To maintain the overall similarity between the input and output images, we add a reconstruction loss
L MR for the encoder-decoder network,
[Equation]
where L R is the reconstruction loss function.
We use pixel-wise l 2 loss as the default reconstruction loss for its simplicity and reasonably good performance.
Other reconstruction losses could also be employed, such as pixel-wise l 1 loss and perceptual losses [24].
Detailed discussion is available in the supplementary material.
We then train the domain-invariant classifier F by minimizing the classification loss L FMC on the output images of all the source domains,
[Equation]
where θ F are the parameters of the domain-invariant classifier F .
This classification loss L FMC also updates the encoder-decoder network to prevent the encoder-decoder network from losing the domain-invariant features due to the uncertainty loss.
The uncertainty loss also has the potential to remove the domain-invariant features if it is difficult to separate the domain-specific features from the domain-invariant features.
Overall, when training the domain-specific classifiers we optimize
[Equation]
and when learning the domain-invariant features, we optimize
[Equation]
[Equation]
where λ 1 , λ 2 and λ 3 are hyperparameters that control the relative weight of these losses.
For convenience, we denote the encoder-decoder network M and the domain-invariant classifier F as a domain-invariant model.
In the testing phase, the domain-invariant model is used for classification on the target domain D t .
2.3 Explanation of LRDG with respect to existing theory
We first introduce the generalization risk bound for domain generalization [2] and then further explain the effectiveness of our framework with respect to this.
Theoretically, the corresponding task for a domain is defined as a deterministic true labeling function f , where f : X → Y .
X and Y are the input space and the label space, respectively.
We denote the space of the candidate hypothesis as
H , where a hypothesis h : X → Y .
The risk of the hypothesis h on a domain
D is defined as
[Equation]
where L : Y × Y → R + measures the difference between the hypothesis and the true labeling function.
Following [2], for the source domains {D 1 s , D 2 s , . . .
, D Ns } , we define the convex hull Λ S of the source domains as a set of mixture source distributions: Λ S
= { ¯ D : ¯ D ( · ) =
(cid:80) Ni =
1 π i D is ( · ) , 0 ≤ π i ≤ 1 , (cid:80) Ni
=
π i = 1 } .
We also define ¯ D t ∈ Λ S as the closest domain to the target domain D t .
¯ D t is given by arg min π 1 ,...,π N d H [ D t , (cid:80) Ni =
π i D is ] , where d H [ · , · ] is H -divergence [25] that quantifies the distribution difference of two domains.
We use the following generalization risk bound [2] for the target domain D t .
Theorem 1 (Generalization risk bound [2])
Given the previous setting, the following inequality holds for the risk R t [ h ] , ∀ h ∈ H for any domain D t ,
[Equation]
where γ = d H [ D t , ¯ D t ] , ϵ = sup
i,j ∈ [ N ] d H [ D is , D js ] and λ π is the minimum sum of the risks achieved by some h ∈ H on D t and ¯ D t .
γ measures the distribution difference between the source domains and the target domain.
ϵ is the maximum pairwise
H -divergence among source domains.
Theorem 1 shows that the upper bound for the target domain depends on γ and ϵ .
We show that our framework could lower the value of this generalization risk bound for a given domain generalization task.
Recall that our encoder-decoder network maps the input images into a new image space.
We denote the mapped source domains as { (cid:98) D 1 s , (cid:98) D 2 s , . . .
, (cid:98) D Ns } and the mapped target domain as (cid:98) D t .
With the domain-specific classifiers, many domain-specific features are removed from the source domains and the features of the mapped source domains tend to be more domain-invariant.
As a result, the mapped source domains { (cid:98) D 1 s , (cid:98) D 2 s , . .
, (cid:98) D Ns } would have smaller distribution difference than the raw source domains, i.e. d H [ (cid:98) D is , (cid:98) D js ]
≤ d H [ D is , D js ] , indicating that ϵ in Eq.
11 would probably be reduced.
After removing the domain-specific features for each source domain, the mapped target domain (cid:98) D t would be closer to the mapped source domains, so our framework could also be likely to reduce γ in Eq.
Concerning Theorem 1, these changes provide a principled explanation and warrant to the effectiveness of the proposed framework.
We will demonstrate these changes in the experiment section (Sec. 3.3).
Experiments
We evaluate our framework on three benchmark datasets and compare the performance with previous methods.
After that, we study the domain divergence among the source and target domains.
3.1 Datasets and settings
Datasets.
We evaluate our framework on three object recognition datasets for domain generalization.
PACS [27] contains four domains: Photo ( P ), Art Painting ( A ), Cartoon ( C ) and Sketch ( S ) with each domain covering seven categories including dog, elephant, giraffe, guitar, horse, house, and person.
VLCS [39] also has four domains: PASCAL VOC 2007 ( V ), LabelMe ( L ), Caltech ( C ) and
Sun ( S ).
The images belong to five categories of bird, chair, car, dog, and person.
Office-Home [40] has images from 65 categories over four domains including Art ( A ), Clipart ( C ), Product ( P ), and
Real-World ( R ).
For each dataset, following the literature, the experimental protocol is to consider three domains as the source domains and the remaining one as the target domain.
Networks and loss functions.
We use U-net [36] for the encoder-decoder network.
Following the standard setting in the domain generalization literature [13, 45, 22], we use AlexNet [26], ResNet [20] and ResNet50 [20] as backbones for the domain-specific classifiers and the domain-invariant classifier.
We use AlexNet for PACS and VLCS, ResNet18 for PACS and Office-Home, and ResNet for PACS.
AlexNet and ResNet are pre-trained by ImageNet [37] for all the experiments.
We use the standard cross-entropy loss as the classification loss L C .
For the uncertainty loss L U , we choose the entropy loss.
For the reconstruction loss L R , we utilize the pixel-wise l 2 loss.
A detailed analysis of the loss functions is available in the supplementary material.
Training setting.
The encoder-decoder network, the domain-specific classifiers, and the domaininvariant classifier are all optimized with Stochastic Gradient Descent.
The source datasets are split into a training set and a validation set.
The learning rate is decided by the validation set.
We set λ 1 = 1 for all the experiments.
We give equal weight to the classification loss and the uncertainty loss for training the domain-specific classifiers.
For λ 2 and λ 3 , we follow the literature [13, 4] and directly use the leave-one-domain-out cross-validation to select their values.
Methods for comparison.
We compare our framework with previous domain generalization works including domain-invariant based methods [30, 41, 11, 45, 14, 31, 35, 8] and other state-of-the-art methods [15, 4, 9, 28, 13, 46, 34, 22, 7, 44, 10] including data augmentation based methods [34, 46, 7], meta-learning based methods [4, 28, 13]
[Table]
etc.
The baseline is defined as the method of empirical risk minimization (ERM).
It trains a classifier by minimizing the classification loss on all source domains
[Table] [Table]
[7] [44] [22] (ours)
A
[Table] [Table]
[Table]
C
[Table]
P
[Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
] (ours)
A
[Table]
57 C
[Table] [Table]
78 P
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
3.2 Main results
PACS contains four domains of Art painting, Cartoon, Photo, and Sketch.
These datasets have large domain gaps.
The classification results of the previous methods and our framework are shown in
Table 1.
Averagely, our framework consistently achieves the best performance in all three backbones compared with previous works.
Especially on Sketch, the accuracy of our framework is averagely 3% better than the previous SOTA methods, showing superior performance.
Our framework also obtains the best performance on Art painting in AlexNet and maintains the highest accuracy on Cartoon in ResNet50 (ours: 85 .
78% vs. SOTA: 83 .
This indicates that removing the domain-specific features from the input images is an effective approach for domain generalization.
We can also study whether the domain-specific features would benefit or hurt the performance on the unseen target domain by comparing with mDSDI [8], as mDSDI uses the domain-specific features in addition to the domain-invariant features for domain generalization.
We can see that our method significantly outperforms mDSDI on Cartoon and Sketch, and achieves a higher average classification performance than mDSDI in ResNet50.
Meanwhile, mDSDI obtains better classification results than ours on Art and Photo.
This shows that although Art and Photo may contain similar domain-specific features and these features would benefit each other, these domain-specific features would not benefit or even hurt
Cartoon and Sketch.
VLCS also contains four domains.
Table 2 shows the classification accuracy of the domain generalization methods using the AlexNet backbone.
It can be seen that our framework obtains comparable performance to the best-performing methods, and outperforms the prior approaches on LabelMe and
Sun.
For Office-Home, ResNet18 is used as the backbone.
The classification performance is shown in
Table 3.
Our framework outperforms the previous methods and achieves the best average performance.
Besides, our framework obtains the best performance on Art.
These experimental results demonstrate that removing the domain-specific features can significantly improve the generalization performance.
[Table] [Table]
3.3 Domain divergence
In this section
[Table]
we investigate the distribution difference among the source domains and the target domain to demonstrate that our framework can effectively reduce domain divergence.
3.3.1 Source domain divergence
To investigate the distribution difference among the source domains
[Table]
we compute the H -divergence.
Following the works of [6, 5], we can approximate the H -divergence by a learning algorithm to discriminate between pairwise source domains.
For example, with source domains D is and D js , we label the samples of D is by 1 , and the samples of D js by 0 .
We then train a classifier (e.g. linear SVM) to discriminate between these two domains.
Given a test error ε of this classifier, Proxy A-distance (PAD) is defined as 2(1 − 2 ε ) , which can approximate the H -divergence.
We follow the method from [19, 12, 1] to compute the PAD.
For a pair of source domains, we combine these domains and construct a new dataset.
This dataset is randomly split into two subsets of equal size.
One subset is used for training and the other one is used for test.
We train a collection of linear
SVMs (with different values of regularization parameters) on the training set and compute the errors ε of all the SVMs on the test dataset.
The lowest error ε is used to compute the PAD.
Proxy A-distance on baseline 1 .1 .1 .1 .1 .2 .
P r o xy
A - d i s t a n ce o n
L R D
G
A,C
A,P
C,PC,P
P,S C,S
A,C
A,S
C,S
A,P
P,SA,S A: Art
C: Cartoon P: Photo
S: Sketch (a) 1 .1 .1 .1 .1 .1 .1 .2 .
Proxy A-distance on baseline 1 .1 .1 .1 .1 .1 .1 .2 .
P r o xy
A - d i s t a n ce o n
L R D
G { A,C,P } ,S { C,P,S } ,A { A,P,S } ,C { A,C,S } ,P
A: Art C: Cartoon
P: Photo S: Sketch (b)
Fig.
2a compares the PAD of the raw source domains and the mapped source domains.
The experiments are conducted on PACS with the AlexNet backbone.
For the raw source domains, we extract features from the baseline model (i.e. the last pooling layer of AlexNet) to train the linear
SVMs, while for the mapped source domains, we use features from our domain-invariant classifier.
In the figure, each dot represents a pair of source domains (e.g. Art and Photo).
It has two values: the
PAD of the source domain pair obtained upon the baseline model ( x axis) and the PAD of the same pair computed upon our framework ( y axis).
All the dots are below the diagonal meaning that the
PAD values of the mapped pairwise source domains are lower than the raw pairwise source domains.
With our framework, the mapped source domains become harder to be distinguished, indicating that removing the domain-specific features reduces the distribution difference among the source domains.
This also proves that ϵ in the generalization risk bound (Eq. 11) would be reduced by our framework.
3.3.2 Source-Target domain divergence
We also investigate the distribution difference between the source domains and the target domain.
Specifically, we measure the domain divergence between the target domain and the closest mixture source domain ¯ D t to the target domain.
To obtain this mixture source domain, as defined in
Sec. 2.3, we need to find π i for each source domain D is , so that ¯ D t = (cid:80) Ni
=1 π i D is , where 0 ≤ π i ≤ 1 and (cid:80) Ni =
1 π i = 1 .
Because π i can be any real value in the interval of [0 , 1] , traversing all values to find the desired π i is impossible.
Therefore, We limit the values of π i to the set of { 0 , 0 . 1 , 0 . 2 , · · · , 0 . 9 , 1 } (11 values in total), and find the setting of { π i } Ni =1 that can obtain ¯ D t .
[Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
We traverse all possible settings of { π i } Ni =1 and obtain all possible mixture source domains ¯ D = (cid:80) Ni
=1 π i D is .
For each setting of { π i } Ni =1 , we random sample π i n t samples from each source domain
D is and concate- nate all these samples into a mixture source dataset.
n t is the number of samples in the target domain.
By this design, each mixture source domain has an equal number of samples to the target domain.
Similar to Sec.
3.3.1, we also train classifiers (i.e. linear
SVMs) to discriminate between each mixture source domain and the corresponding target domain.
The linear SVMs are trained on image features extracted from the baseline model.
We then use the test error to compute the PAD between each mixture source dataset and the target dataset.
The mixture source domain with the lowest PAD is the closest mixture source domain ¯ D t to the target domain.
The detailed settings of π i for the closest mixture source domains to the corresponding target domains on PACS are listed in Table 4.
For convenience, we denote the closest mixture source domain ¯ D t and the target domain D t together as a source-target domain pair.
Fig.
2b shows the PAD of the raw source-target domains and the mapped source-target domains.
Similar to Sec.
3.3.1, for the raw source-target domains, we extract the image features from the baseline model to train the linear SVMs.
To compute the PAD of the mapped source-target domains, we extracted the image features from our domain-invariant classifier to train the linear SVMs.
In the figure, each dot represents a source-target domain pair (e.g. {Cartoon, Photo, Sketch}, Art).
We can see that all the dots are below the diagonal.
The PAD values of the mapped source-target pairs are lower than the raw source-target pairs.
This indicates that the distribution difference between the source domains and the target domain is reduced by our framework.
γ in the generalization risk bound (Eq. 11) would be lowered.
Removing the domain-specific features from the source domains can also reduce the distribution difference between the source domains and the target domain.
In summary, our framework can reduce the distribution difference not only among the source domains but also between the source domains and the target domain.
This also demonstrates that our framework could effectively lower the value of the generalization risk bound by reducing ϵ and γ .
Related work
Domain generalization is a challenging task that requires models to be well performed on unseen domains.
One common approach is to learn domain-invariant features among the source domains.
Previous methods aim to distill the domain-invariant features, but they do not clearly inform the
DNNs that the domain-specific features shall be effectively removed.
Muandet et al.
[33] propose to reduce the domain dissimilarity by a kernel-based method.
Ghifary et al.
[18] reduce dataset bias by extracting features that are shared among the source domains with a multi-task autoencoder network.
Li et al.
[29] utilize Maximum Mean Discrepancy (MMD) on adversarial autoencoders to align the distributions across source domains.
Li et al.
[30] design an end-to-end conditional invariant deep neural network that minimizes the discrepancy of conditional distributions across domains.
Arjovsky et al.
[3] develop Invariant Risk Minimization (IRM) that uses a causal mechanism to obtain the optimal invariant classifier upon the representation space.
Chattopadhyay et al.
[11] propose to learn domain-specific binary masks to balance the domain-invariant and domain-specific features for the prediction of unseen target domains.
Zhao et al.
[45] propose an entropy regularization method to learn the domain-invariant conditional distributions by using a classification loss and a domain adversarial loss.
Du et al.
[14] develop a probabilistic meta-learning method that learns domain-invariant representations with meta variational information bottleneck principle derived from variational bounds of mutual information.
Mahajan et al.
[31] assume that domains are generated by mixing causal and non-causal features and that the same object from different domains should have similar representations.
Based on this, they propose a new method called MatchDG to build a domain-invariant classifier by matching similar inputs.
Rame et al.
[35] match the gradients among the source domains to minimize domain invariance.
Unlike the above works, Bui et al.
[8] assume that, besides the domain-invariant features, some domain-specific features also provide useful information for the target domain.
However, this cannot always be guaranteed since the target domain is unseen.
For example, the backgrounds in the domain Photo may benefit the domain Art, but they would not benefit or even hurt the domain Sketch.
Our framework follows the common assumption that the domain-invariant features are generalized across domains, regardless of the effect of the domain-specific features [30, 3, 45].
Recent papers demonstrate that CNNs tend to classify objects based on features from superficial local textures and backgrounds, while humans rely on global object shapes for classification [23, 17].
To address this issue, some methods aim to capture the global object shapes from the images.
These methods are proposed based on the assumption that the local textures and backgrounds are the domainspecific features, and the global object shapes are the domain-invariant features.
Wang et al.
[42] extract semantic representations by penalizing features extracted with gray-level co-occurrence matrix (GLCM) which are sensitive to texture.
Wang et al.
[41] penalize the earlier layers of CNNs from learning local representations and make the CNNs rely on the global representations for classification.
Although addressing the superficial local features is a promising approach, the superficial local features may be one kind of domain-specific features and other forms of domain-specific features may also exist.
Compared with these methods, our framework is proposed to address the more general domain-specific features rather than the superficial local features.
Conclusion
In this work, we propose a new approach that aims to explicitly remove domain-specific features for domain generalization.
To this end, we develop a novel domain generalization framework that learns the domain-invariant features by actively removing the domain-specific features from the input images.
We also experimentally verify the reduced domain divergence among the source domains and the target domain brought by our approach.
Experiments show that our framework achieves strong performance on various datasets compared with existing domain generalization methods.
Despite the advantages of our framework, it has some potential limitations to be further addressed.
We need to train the same number of domain-specific classifiers as the source domains.
When there are more source domains, more computational resources will be required to train the domain-specific classifiers.
This may be addressed by designing a novel domain-specific classifier that can learn the domain-specific features of multiple source domains simultaneously.
Another limitation of our framework is that it cannot remove the domain-specific features of the unseen target domain.
These domain-specific features should also be removed since they would negatively affect the classification performance.
For example, our framework performs slightly worse than the baseline when Photo is the target domain (as shown in Table 1).
This may be because Photo contains rich domain-specific features compared with the source domains, and our framework would make incorrect predictions due to these domain-specific features.
Besides, this result also shows that domain-specific knowledge is useful for Photo.
As the target domain is not available during training, how to remove the domainspecific features from the target domain and whether to retain the domain-specific features of the source domains will be challenging issues to be addressed.
One possible future work may be to remove the domain-specific features in a latent feature space.
To achieve this, the framework may need to be adjusted, including the domain-specific classifiers and the domain-invariant classifier.
The encoder-decoder network incurs extra computational overhead, but performing on a latent space may have the benefit that we may no longer need the encoder-decoder network and the overall framework can be computationally more efficient.
Acknowledgment
Yu Ding was supported by CSIRO Data61 PhD Scholarship and the University of Wollongong International Postgraduate Tuition Award.
This research was undertaken with the assistance of resources and services from the National Computational Infrastructure (NCI) and the CSIRO Accelerator
Cluster-Bracewell.
Checklist
For all authors... (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope?
[Yes] (b) Did you describe the limitations of your work?
[Yes] See Section 5.
(c) Did you discuss any potential negative societal impacts of your work?
[N/A] (d) Have you read the ethics review guidelines and ensured that your paper conforms to them?
[Yes] 2.
If you are including theoretical results... (a) Did you state the full set of assumptions of all theoretical results?
[N/A] (b) Did you include complete proofs of all theoretical results?
[N/A] 3.
If you ran experiments... (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)?
[Yes] (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?
[Yes] In the Appendix.
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)?
[Yes] In the Appendix.
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)?
[Yes] In the Appendix. 4.
If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... (a) If your work uses existing assets, did you cite the creators?
[Yes] In the Appendix.
(b) Did you mention the license of the assets?
[Yes] In the Appendix.
(c) Did you include any new assets either in the supplemental material or as a URL?
[N/A] (d) Did you discuss whether
and how consent was obtained from people whose data you’re using/curating?
[Yes] In the Appendix.
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content?
[N/A] 5.
If you used crowdsourcing or conducted research with human subjects... (a) Did you include the full text of instructions given to participants and screenshots, if applicable?
[N/A] (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable?
[N/A] (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation?
[N/A]