Year: 2021

Abstract:
This paper considers few-shot learning under the cross-domain scenario. The cross-domain setting imposes a critical challenge, i.e., using very few (support) samples to generalize the already-learned model to a novel domain. We hold a hypothesis, i.e., if a deep model is capable to fast generalize itself to different domains (using very few samples) during training, it will maintain such domain generalization capacity for testing. It motivates us to propose a novel DomainSwitch Learning (DSL) framework. DSL embeds the cross-domain scenario into the training stage in a “fast switching” manner. Specifically, DSL uses a single domain for a training iteration and switches into another domain for the following iteration. During the switching, DSL enforces two constraints: 1) the deep model should not over-fit the domain in the current iteration and 2) the deep model should not forget the already-learned knowledge of other domains. These two constraints jointly promote fast generalization across different domains. Experimental results confirm that the cross-domain generalization capacity can be inherited from the training stage to the testing stage, validating our key hypothesis. Consequentially, DSL significantly improves cross-domain few-shot classification and sets up new state of the art (e.g., 74.28% accuracy on CUB for 5-way 5-shot task).

heading: 1 INTRODUCTION
text: This paper challenges a realistic problem, i.e., the cross-domain scenario, for few-shot learning. Basically, the few-shot learning task uses a classifier learned on the training set to recognize novel classes with very few support samples. In real-world applications, there is usually a domain gap between the training samples and the support samples Tseng et al. (2020); Guo et al. (2020); Chen et al. (2019). The domain gap further imposes a critical challenge: since the support samples are very rare, they do not suffice for mitigating the domain gap between the support set (for novel classes) and the training set. Consequentially, the domain gap significantly compromises the recognition accuracy of the novel classes. Therefore, learning a model with strong cross-modality generalization capacity is important for cross-domain few-shot learning Tseng et al. (2020).
We argue that we may enhance the desired cross-modality generalization by “learning-togeneralize”. To be more specific, we hold a hypothesis / intuition that if a deep model learns to fast generalize itself to different domains (using very few samples) during training, it will maintain the good domain generalization capacity for testing.
We model our intuition into a novel Domain-Switch Learning (DSL) framework, as illustrated in Fig. 1. DSL uses multiple (M > 1) domains to construct cross-domain training scenario in a “fast switching” manner. Instead of simply mixing all the domains to construct a mini-batch (Fig. 1 (a)), DSL includes only a single domain into every training iteration and switches to another domain for the following iteration (Fig. 1 (b)). Moreover, each iteration contains very few samples per category, so as to imitate the few-shot setting. Therefore, after every switch, the deep model crosses into a domain different from the former one, yielding the cross-domain few-shot scenario.
An important advantage of this domain-switch learning manner is that it favors domain-general knowledge over domain-specific knowledge, as illustrated in Fig. 1. Specifically, we consider each domain contains both domain-general and domain-specific knowledge. If we mix all the domains for each training iteration (Fig. 1 (a)), the deep model may memorize all the domain-specific knowledge (apart from the domain-general knowledge). Consequentially, during testing, the domain-specific
knowledge hinders generalization towards the novel domain and thus compromises few-shot classification accuracy. In contrast, in DSL (Fig. 1 (b)), the model only learns from one single domain in an iteration. Since the domain-specific knowledge of the current domain does not fit the following domain, the deep model should favor the domain-general knowledge and ignore the domain-specific knowledge, so as to prepare for the fast domain switching.
However, the preference for domain-general knowledge (over domain-specific knowledge) does not guarantee that DSL learns more domain general knowledge than the domain-mix learning scheme does. To further promote cross-domain generalization in this domain-switch learning scheme, DSL enforces two constraints as follows:
1) The deep model should not over-fit the domain in the current iteration, because over-fitting the current domain makes the model memorize much of the domain-specific knowledge. The first constraint is implemented with a domain-specific prompter module (consisted of multiple prompters). After the model learns from the i-th training domain Di and gets updated, its prediction accuracy on Di increases. We store this edition of model as the prompter for Di. Next time when the learning domain switches to Di again, we average the softmax prediction of the prompter and the learner as the final prediction. Since the prompter fits Di well, it reduces the prediction errors of the final prediction and thus attenuates the penalty on the learner. The details of the domain-specific prompter module are to be accessed in Section 3.3.
2) The deep model should not forget the already-learned knowledge of former domains, so that next time the model crosses into these domains again, it can directly re-use the corresponding knowledge for prediction. The second constraint is implemented with a domain-general teacher module. Specifically, we collect several historical models and average their parameters to get a mean model. During training, we use the softmax prediction of the mean model as the auxiliary supervising signals for the learner (apart from the ground truth label). The mean model serves as a teacher distilling the already-learned knowledge of former domains to the learner. Since this teacher has no obvious bias towards any single domain, we name it as a domain-general teacher. The details of the domaingeneral teacher module are to be accessed in Section 3.4.
These two constraints achieve complementary benefits for DSL, and jointly reinforce the crossdomain generalization. Extensive experiments under four cross-domain scenarios show that DSL consistently improves cross-domain few-shot learning and achieves performance on par with the state-of-the-art methods.
Our main contributions are summarized as follows:
•We propose a novel Domain-Switch Learning (DSL) framework for cross-domain few-shot learning. DSL uses multiple domains for training and switches the domain in consecutive training iterations. It provides a cross-domain learning scenario where the deep model learns to generalize across different domains.
• Under the DSL framework, we integrate two modules, i.e., the domain-specific prompter and the domain-general teacher. These two modules achieve complementary benefits for DSL and jointly reinforce the cross-domain generalization.
•We conduct extensive experiments to validate the effectiveness of the proposed DSL. Experimental results confirm that the fast generalization capacity can be inherited from training to testing and thus improves cross-domain few-shot classification. On all the four popular benchmarks, DSL achieves performance on par with the state of the art.

heading: 2 RELATED WORKS
text: Few-Shot Learning. Few shot learning methods could be roughly categorized into two branches: meta-learning and fine-tuning methods. Some meta-learningSatorras & Estrach (2018); Mishra et al. (2018); Ren et al. (2018); Snell et al. (2017); Sung et al. (2018); Vinyals et al. (2016) methods map the few-shot samples into a non-linear embedding space and evaluate the similarity between support samples and the query samples. Recently, fine-tuning methods Chen et al. (2019); Tian et al. (2020); Afrasiyabi et al. (2020) propose to pre-train the model on the training set (typically in a classification learning approach), and fine-tune the classifier on the novel classes. The finetuning methods achieve competitive performance compared with the state-of-the-art meta-learning methods. This work considers the few-shot learning task under the cross-domain scenario and adopts the fine-tuning pipeline as the baseline.
Domain Generalization and Adaptation may be viewed as two closely related concepts. Domain adaptation uses abundant (unlabeled) samples to adapt the already-learned model from the source domain to the target domain Ganin & Lempitsky (2015); Tzeng et al. (2017); Long et al. (2017; 2015; 2016); Tzeng et al. (2014). In contrast, domain generalization aims to generalize the knowledge from multiple source domains to the target domain without learning any samples of the target domain during the training stage Balaji et al. (2018); Li et al. (2018). In cross-domain fewshot learning, there is a domain gap between the training set and the testing set. To promote the cross-domain generalization, Tseng et al. (2020) considers the challenge is more of a domain generalization problem than a domain adaptation problem. This consideration is reasonable because the support samples are very rare and do thus not suffice for a typical domain adaptation.
From the viewpoint of domain generalization, FWT Tseng et al. (2020) proposes to simulate the cross-domain scenario to improve the domain generalization capacity. It indeed inspires us of the multi-domain training strategy. In spite of sharing the multi-domain training strategy, DSL significantly differs from FWT: First, FWT uses changes the training domain epoch-by-epoch. It does not rely on fast switching for better generalization. In contrast, DSL is featured for the novel fast switching manner and finds that this manner promotes learning domain-general knowledge. Second, DSL further considers two constraints in multi-domain training strategy, i.e., the deep model should not over-fit every single domain and keep recognition on learned knowledge shared with other domains. Finally, DSL achieves superior cross-domain effect than FWT (Section 4.2).
Catastrophic forgetting. Catastrophic forgetting plays an important role in the mechanism of DSL. When the deep model is trained sequentially on multiple tasks (domains), there is a tendency that the knowledge learned on former tasks (domains) is abruptly lost, yielding the so-called catastrophic forgetting Kirkpatrick et al. (2017); McCloskey & Cohen (1989); French (1999).
In DSL, when the deep model switches from a domain to another, it forgets much of the knowledge on the former domain, due to catastrophic forgetting. Forgetting the domain-specific knowledge is beneficial, while forgetting the domain-general knowledge is harmful. In response, next time the deep model comes across the former domain again, we 1) supplement it with the corresponding knowledge with a domain-specific prompter to prevent over-fitting the domain-specific knowledge and 2) use a domain-general teacher to reinforce the common knowledge shared among all the former domains. In a word, in its mechanism, DSL actually utilizes catastrophic forgetting to improve cross-domain generalization.

heading: 3 METHODS

heading: 3.1 PRELIMINARIES
text: In the cross-domain few-shot learning task, there is a significant domain gap between the training set and the testing set. The testing set consists the support set and query set, which are sampled from the same novel categories (which are unseen in the training set). The support set provides very few labeled samples for recognizing the unlabeled samples in the query. Concretely, the support set contains C classes and each class has K samples, which is a C-way K-shot setup in few-shot learning.
Our work is based on a popular fine-tuning pipeline Chen et al. (2019); Tian et al. (2020); Afrasiyabi et al. (2020). The fine-tuning baseline uses the training set D to learn a deep model consisted of a feature encoder F and a feature classifier Y . F is parameterized with θ and Y is parameterized with a weight matrix W . During training, given a sample x, the feature encoder first maps x into a feature F (x;θ) ∈ Rd. Then the feature classifier Y predicts the softmax probability of x belonging to each training category as P (i|x;θ,W ) = exp(w T i F (x;θ))∑
j exp(w T j F (x;θ)) (wi is the weight vector for the i-th category). The training is supervised with a popular classification loss function, i.e., the cross-entropy loss, which is formulated as:
LCE(x) = − log(P (y|x;θ,W )) = − log exp(wTy F (x;θ))∑ j exp(w T j F (x;θ)) , (1)
where y is the label for x, wy is the weight vector corresponding to the ground-truth category.
During the testing stage, we replace the feature classifier Y with a new linear classifier L. L is a C-way classifier, corresponding to the total number of classes in the support set. We freeze the parameters of the feature encoder F and fine-tune the parameters of Lwith samples from the support set. Finally, we use the feature encoder F and the learned L as the predictor for the query.
This paper focuses on the training stage, i.e., learning the feature encoder F and the classifier Y on the training set.

heading: 3.2 OVERVIEW OF DOMAIN-SWITCH LEARNING
text: Domain-Switch learning (DSL) employs M datasets to construct the training set, i.e., D = {D1, D2, ..., DM}. Di is an individual domain, which may be selected from some popular fewshot datasets, e.g., CUB Welinder et al. (2010), Cars Krause et al. (2013), Places Zhou et al. (2018), Plantae Horn et al. (2018). These switchable training sets are relatively small, and does not suffice for learning a discriminative feature encoder. Therefore, following Tseng et al. (2020), we employ a relatively large-scale dataset mini-ImageNet Deng et al. (2009) as a “basic” training set. During training, each mini-batch actually contains samples from the basic mini-ImageNet and a switchable training set Di. We note that such implementation does NOT contradict our motivation of using a single domain for each training iteration, because we may view the mixture of mini-ImageNet and a Di as a single “compound” domain.
During training, DSL uses samples from a single switchable domain Di (and the mini-ImageNet) for each iteration, as illustrated in Fig. 2. Since mini-ImageNet appears for every iteration, we omit it in Fig. 2 for simplicity. The domain-switching process is formulated as:
Bj ← Di | Di ∈ D; i = j − b j
M c ×M (2)
where Bj is the training batch at the j-th iteration, Di is the i-th domain, b·c is the rounding down operation. We define a enumeration of all the M domains as a switching round.
In order to further improve the cross-domain generalization in the above “fast switching”, DSL enforces two constraints: 1) the deep model should not over-fit the domain in the current iteration and 2) the deep model should not forget the knowledge of other domains. These two constraints are implemented with a Domain-Specific Prompter (Section.3.3) and a Domain-General Teacher (Section.3.4) module, respectively.

heading: 3.3 DOMAIN-SPECIFIC PROMPTER
text: Definition of the prompter: Let us consider in the j-th iteration, the model has already learned from Di and gets updated. We store this edition of model as the prompter for the (j +M)-th iteration (when the learner is to learn from Di again), as illustrated in Fig. 2. The prompter aims to prevent the learner from over-fitting the current domain Di.
Given a sample x in current domain, DSL averages the softmax prediction of the prompter (P (y|x;θP ,WP), where the upper-script P denotes the prompter) and the softmax prediction of the learner (P (y|x;θ,W )), which is formulated as:
P̂ =
{ λP (y|x;θ,W ) + (1− λ)P (y|x;θP ,WP), argmax
i P (i|x,θP ,WP) = y
P (y|x;θ,W ), otherwise (3)
where λ is a hyper-parameter. The condition argmax i P (i|x;θP ,WP) = y is to ensure the prompter makes the correct prediction.
With the re-weighted softmax prediction P̂ , the cross-entropy loss for supervising the classification is transformed into a Re-weighted Cross-Entropy loss (RCE loss in Fig. 2):
LRCE = − log(P̂) (4)
We explain how the domain-specific prompter prevents the learner from over-fitting the current domain with two following remarks (Remark1 and Remark2).
Remark1: Compared with the learner, the prompter has relatively higher predicted probability on the ground-truth category, i.e., P (y|x;θP ,WP) ≥ P (y|x;θ,W ). Remark1 is intuitive. Without losing generality, we assume the current learning domain in Fig. 2 is D1. The domain-specific prompter is the former model updated by D1 and thus fits D1 well. In contrast, the current learner is newly updated by DM and forgets some knowledge of D1, due to the well-known “catastrophic forgetting”. Therefore, the prompter has higher predicted probability on
the ground-truth category than the learner does. We empirically validate the above analysis in Fig. 3, from which we clearly observe that the prompter has higher prediction accuracy than the learner.
Remark2: Since P (y|x;θP ,WP) ≥ P (y|x;θ,W ) (i.e., Remark1), the re-weighted procedure in Eq. 3 alleviates the penalty on the learner, which is beneficial to exclude domain-specific knowledge. Please refer to the Appendix for the conceptual proof. Consequentially, the prompter counters overfitting the current domain.

heading: 3.4 DOMAIN-GENERAL TEACHER
text: Definition of the domain-general teacher: We recall that a switching round is a period within which all the M domains are enumerated. As illustrated in Fig. 2, we average the parameters of all the M encoders updated in the past switching round to generate the domain-general teacher for the current domain Di, which is formulated as:
θT ← 1M ∑j=i−1 j=i−M θj (5)
The teacher aims to preserve and distill the domain-general knowledge learned in former domains to the current learner.
We note that the domain-general teacher is different from the popular temporal moving average for semi-supervised and unsupervised task Tarvainen & Valpola (2017); He et al. (2020); Grill et al. (2020). In temporal moving average, the teacher absorbs parameters from all the historical models (with higher weighting factor for the more recent model). In contrast, our domain-general teacher absorbs parameters from only M historical models with equal weighting factor.
Remark3: When the learner gets updated from Di, it has higher prediction accuracy on Di than the teacher does. Meanwhile, the teacher has higher prediction accuracy on former domains Dj(j 6= i). Remark3 is intuitive. It is because the teacher absorbs knowledge from M historical learners, therefore preserving historical knowledge of the former domains. We empirically validate this intuition in Fig. 3 (b), which is consistent with Remark3. Moreover, since the teacher averages the parameters of all the M historical learners, it has no obvious bias towards any single domain. Therefore, the teacher has relatively smaller variation of accuracy on all the domains, as shown in Fig. 3 (b).
Binary Kullback-Leibler divergence loss. Given a sample x in the current domain, we use the output of the teacher P (y|x;θT ,W T ) as an auxiliary supervising signal for the learner. To this end, we propose a novel Binary Kullback-Leibler divergence (KLD) Loss as follows:
LBKLD = P Ty · log P Ty Py + (1− P Ty ) · log 1− P Ty 1− Py , (6)
where Py = P (y|x;θ,W ) and P Ty = P (y|x;θT ,W T ).
The difference between the proposed BKLD loss and the popular KLD loss is: KLD aims to make the student consistent with the teacher at all the entries of the softmax prediction. In contrast, the proposed BKLD loss only focuses on the consistency at the ground-truth entry. In the experiment in Section 4.4, we empirically show BKLD loss is better than the KLD loss for DSL.
Overall Training. We recall that besides the switchable domains, mini-ImageNet is employed as a “basic” training set, which is sampled into all the training iterations. For mini-ImageNet, we adopt the cross-entropy loss as a basic loss LBasic. The overall training loss is as follows:
L = LBasic + α · LRCE + (1− α) · LBKLD (7)
where α is a weighting factor.

heading: 4 EXPERIMENTS

heading: 4.1 EXPERIMENTAL SETUPS
text: We evaluate the proposed DSL on five datasets: i.e., 4 fine-grained datasets (CUB Welinder et al. (2010), Cars Krause et al. (2013), Places Zhou et al. (2018), and Plantae Horn et al. (2018)) and 1 popular large scale dataset mini-ImageNet Deng et al. (2009). We use ResNet-10 He et al. (2016) without pretraining as the backbone network. Please refer to the Appendix for more experimental setups and implementation details.

heading: 4.2 COMPARISON WITH THE STATE OF THE ARTS
text: We compare DSL with the existing state of the arts on 4 benchmarks. We adopt the leave-one-out setting, i.e., one of the fine-grained datasets is chosen as a testing set and the other 3 datasets (out of the 4 datasets) are used as the training sets. Meanwhile, we employ mini-ImageNet as a “basic” training set, which is available during the whole training stage. The results of 5-way 1-shot and 5-way 5-shot are summarized in Table 1 and Table 2, respectively.
From Table 1, we clearly observe the superiority of DSL under 5-way 1-shot classification. First, comparing DSL with all the single-domain training methods, we find that DSL achieves significant superiority. For example, DSL outperforms the most competing single-domain method (“RelationNet + ATA (s)”) Wang & Deng (2021) by +7.13%, +5.34%, +2%, +7.45% on CUB, Cars, Places and Plantae, respectively. Second, while the multi-domain training methods achieve considerable improvement (over their single-domain counterpart), DSL still outperforms them with a clear margin. For example, DSL outperforms the most competing multi-domain method (“RelationNet + LFT (m)”) by +1.77%, +4.92%, +2.42%, +6.17% on CUB, Cars, Places and Plantae, respectively.
From Table 2, we clearly observe that DSL achieves competitive accuracy under the 5-way 5-shot classification. Most of the competing methods already appear in the comparison of 5-way 1-shot setting (Table 1). Compared with all these methods (except NASE Liang et al. (2021)), DSL maintains significant superiority on all the four benchmarks. For example, DSL surpasses “RelationNet + LFT(m)”Tseng et al. (2020) by +8.58%, +15.09%, +6.75%, +11.71% on CUB, Cars, Places and Plantae, respectively.
NASE in Table 2 is a very recent and competitive single-domain training method. It splits the support samples of the same category into two sub-sets for similarity learning. Therefore, it requires more than 1 support samples for each category and is incompatible to the 1-shot setting. With this unique similarity-learning manner, it achieves very competitive performance (e.g., 68.51% on CUB). Compared with NASE, DSL obtains consistent superiority under two conditions (with and without Batch Spectral Regularization (BSR) Liu et al. (2020)) For example, without BSR, DSL surpasses NASE by 5.06% on CUB. With BSR, “DSL + BSR” surpasses “NASE + BSR” by +2.36% on CUB.

heading: 4.3 THE EFFECTIVENESS OF THE DOMAIN-SWITCH OPERATION
text: A key characteristic of DSL is the domain-switch operation. In Table 3, we compare the singledomain baseline (on mini-ImageNet), the domain-mix and the proposed domain-switch scheme (without domain-general teacher and the domain-specific prompter ) on CUB and Cars. We draw two following observations:
First, compared with single-domain training, the domain-mix learning scheme only brings slight improvement. Although it employs multiple domains (as well as multiple datasets) for training, the benefit of more training data is trivial (less than 1% improvement). We infer it is because in the domain-mix learning scheme, the disadvantage of learning domain-specific knowledge largely offsets the advantage of more training data.
Second, comparing “domain-mix” with “domain-switch”, we observe that domain-switch is a superior multi-domain learning manner. Specifically, domain-switch surpasses domain-mix by 1.60% accuracy under 5-way 5-shot setting, respectively. It is consistent with our conceptual analysis, i.e., the domain-switch learning manner better ignores the domain-specific knowledge, therefore improving the cross-domain generalization.

heading: 4.4 ABLATION STUDIES
text: Ablation on the prompter and teacher module. While the domain-switch framework already improves cross-domain generalization, DSL uses the domain-specific prompter and the domaingeneral teacher to prevent over-fitting domain-specific knowledge and to reinforce the domain-
general knowledge, respectively. We investigate their benefits through ablation in Table 4, from which we draw two observations:
First, both the domain-specific prompter and the domain-general teacher are beneficial. Based on the domain-switch operation, we find that adding the prompter or the teacher brings accuracy improvement. For example, under the 5-way 5-shot setting, adding the prompter and the teacher increases the accuracy by 4.80% and 4.12%, respectively.
Second, the domain-specific prompter and the domain-general teacher are complementary to each other. While both modules already bring independent improvement, combining them (“All (DSL)”) yields even higher accuracy. It validates that these two modules achieve complementary benefits (i.e., countering domain-specific knowledge and promoting domain-general knowledge).
Analysis on some important configurations of the teacher module. We investigate two configurations: 1) using a novel Binary KLD loss (instead of the popular KLD loss) for knowledge distillation and 2) using the historical models within a single switching round for generating the teacher.
Fig. 4 (a) shows that the domain-general teacher favors the Binary KLD loss than the canonical KLD loss. Under the 5-way 5-shot setting, the canonical KLD barely improves over “no teacher”, while the BKLD surpasses KLD by 1.69% accuracy. We infer it is because the knowledge from other domains is not accurate for the non-target classes. Therefore, forcing the learner to approximate the teacher w.r.t. all the non-target classes is inappropriate.
Fig. 4 (b) shows that using more switching rounds gradually compromises the effectiveness of the teacher, compared with using a single round. We infer it is because increasing switching rounds includes some severely out-of-date models, whose knowledge largely diverges from the up-of-date model. Therefore, we use a single switching round for generating the teacher model.

heading: 5 CONCLUSION
text: This paper proposes a novel Domain-Switch Learning (DSL) method for cross-domain few-shot classification. DSL embeds the cross-domain scenario into the training stage in a fast switching manner. We show that during the domain switching procedure, the deep model favors domaingeneral knowledge and is prone to ignoring the domain-specific knowledge, so as to fast adapt itself to different domains. Moreover, DSL employs a domain-specific prompter and a domain-general teacher module to further promote the cross-domain generalization capacity. Experiments conducted on multiple benchmarks demonstrate that DSL improves cross-domain few-shot classification and the achieved results are on par with the state of the arts.
ETHICS STATEMENT
This paper can help to improve the model generalization capacity in recognizing novel classes with limited labeled samples (e.g., the rare birds, the rare plants,etc) under a significant domain gap between training sets. It may be applied to some environmental protection projects which require monitoring on the diversity of species. Specifically, it can help recognize some rare species in the wild reserve. We will explore more application scenarios of few-shot learning, as well as crossdomain few-shot learning. Moreover, we will try to improve the reliability of few-shot learning systems to reduce the potential problems.
REPRODUCIBILITY STATEMENT
The DSL is reproducible. In the main text, we describe the utilized datasets in DSL, i.e., 4 finegrained datasets (CUB, Cars, Places, and Plantae) and 1 popular large scale dataset mini-ImageNet. We provide the details about the experimental implementation, the proof of the proposed remark and the analysis of some hyper parameters in appendix.

heading: A APPENDIX
text: In the appendix, we supply the details which are not described in the main text due to space limitation. In Section A.1, we provide the details about the experimental implementation. In Section A.2, we prove the Remark2 in Section 3.3. In Section A.3, we investigate DSL on different backbones. In the main experiments, DSL and all the competing methods adopt the standard inductive inference. In Section A.4, we further provide some comparison under the transductive setup (e.g., with a label propagation method Liu et al. (2020)). In Section A.5, we analyze the impact of some hyper-parameters.
A.1 IMPLEMENTATION DETAILS.
We use ResNet-10 He et al. (2016) without pretraining as the backbone network. When training the model on the training set, we use the Adam Kingma & Ba (2015) optimizer. We train the model with 400 epochs and set the initial learning rate as 1e-3. In each training iteration, the mini-batch size of switchable domain and the “basic” training set are both 64. In each mini-batch , we randomly sample 16 classes from each domain (4 images per class).
We evaluate the classification accuracy over 1000 experiments on the test set. When fine-tuning the model on the support set, we randomly sample C classes and K samples per class, according to the C-way K-shot setting(e.g., C=5, K=1 or 5). We use the SGD Qian (1999) to optimize the linear classifier layer and the initial learning rate is 0.01. The weight decay of SGD is 0.001 and the SGD momentum is 0.9.
A.2 REMARK2 PROOF.
We first recall the domain-specific prompter in Section 3.3. Given a sample x in current domain, we average the softmax predictions of the prompter P (y|x;θP ,WP) and learner P (y|x;θ,W ) to get re-weighted softmax prediction P̂ . It can prevent the learner from over-fitting the current domain.
Remark2: Given P (y|x;θP ,WP) ≥ P (y|x;θ,W ), we have the re-weighted softmax prediction P̂ ≥ P (y|x;θ,W ). It thus reduces final prediction errors (on the current domain), alleviating the penalty on the learner. The proof is as illustrated by:
1 P (y|x;θP ,WP) ≤ 1 P (y|x;θ,W )
⇒ 1 λ · P (y|x;θ,W ) + (1− λ) · P (y|x;θP ,WP) ≤
1
P (y|x;θ,W )
⇒ λ λ · P (y|x;θ,W ) + (1− λ) · P (y|x;θP ,WP) ≤
1
P (y|x;θ,W )
⇒|dLRCE dP̂ | ≤ | dLCE dP (y|x;θP ,WP) |
(8)
where | · | denotes the value of vector. λ ∈ [0, 1] is a hyper parameter.
A.3 DSL ON VARIOUS BACKBONES.
We further analyze the adaptation of our methods on Conv4 and ResNet18. The performance on CUB are shown in Fig. 5. We adopt “domain-mix” learning manner as the baseline. We observe that the proposed method can still achieve considerable improvements on both shallow or deeper backbone settings, which proves the robustness of the proposed method.
A.4 ADDITIONAL EXPERIMENTS.
We adopt a simple label propagation method Liu et al. (2020) for DSL and compare “DSL+LP” with label-propagation based methods.
From Table 5, we observe that when all the methods use transductive setup (e.g., label propagation), DSL achieves competitive accuracy under the 5-way 5-shot classification. ’DSL+LP’ outperforms GNN + LFT by +3.61%, +12.33%, +0.05%, +6.86%on CUB, Cars, Places and Plantae, respectively.
A.5 HYPER-PARAMETERS ANALYSIS.
We analyze the impact of three important hyper-parameters,i.e.,λ in re-predicted procedure(Eq. 3), the α in overall loss(Eq. 7) and the temperature coefficient µ in computing the predictions P Ty = P (y|x;θT ,W T ) of domain-general teacher.
In Fig. 6, we evaluate the impact of hyper-parameter λ, which controls the weight of predictions from domain-specific prompter in Eq. 3. We observe that the accuracy first increases (when λ increases from 0 to 0.4) and then decreases (when λ further increases to 1.0). We set λ = 0.4 as the weight factor.
In Fig. 7, we evaluate the impact of hyper-parameter α, which controls the weight of Binary KLD loss and RCE loss in Eq. 7. We observe that the accuracy first increases (when α increases from 0 to 0.7) and then decreases (when α further increases to 1.0). We set α = 0.7 as the weight factor.
In Fig. 8, we evaluate the impact of hyper-parameter µ, which denotes the temperature coefficient in computing predictions P Ty = P (y|x;θT ,W T ) of domain-general teacher. When the temperature coefficient µ ≥ 1, we consider that the predictions of domain-general teacher are more smooth and thus transfer more general knowledge shared with other domains. We set µ to vary from 1 to 2. It is observed that the accuracy undergoes an increase (when µ increases from 1 to 1.25) and then a decrease (when µ > 1.25). Therefore, we set µ = 1.25 as the optimized threshold for domain-general teacher.

Review summaries:
The goal of this paper is to improve the generalization ability of the few-shot model on novel domains. To this end, this work introduces a learning manner named domain-switch learning (DSL). To make DSL feasible, the work further proposes two modules (i.e., domain-specific prompter and the domain-general teacher). The experimental results show the effectiveness of the proposed framework.

This paper proposes a novel training scheme termed Domain Switch Learning (DSL) to pursue the few-shot learning problem under the cross-domain scenario. In practice, DSL uses the data from one domain for a training iteration and switches to another domain for the next iteration. During the switching, two regularization terms are also introduced to balance the domain-specific knowledge and domain-general knowledge. The extensive experimental result demonstrates the effectiveness of the proposed method on several standard benchmarks.

This paper aims to address the problem of cross-domain few-shot classification. The main contribution is that it introduces domain-switch learning that simulates cross-domain scenario for training, and thus improves the model’s generalization. To this end, it uses multiple domains during training – it only trains on a single domain at each iteration and switches the domain in consecutive training iterations. This training mechanism is different from widely-used strategies like mixing different domains, and it forces the model to learn domain-general knowledge. In addition, two constraints are proposed to further improve the generalization. First, a domain-specific prompter module is introduced, so that the model is not overfitting to the domain in the current iteration. Second, a domain-general teacher module is introduced, so that the model does not forget the already-learned knowledge of other domains. The approach is tested on four datasets, including CUB, Cars, Places, and Plantae, and compared with competing results.