Episodic Training for Domain Generalization

Da Li, Jianshu Zhang, Yongxin Yang, Cong Liu, Yi-Zhe Song, Timothy M. Hospedales

Abstract

Domain Generalization (DG) remains a significant challenge in machine learning, where models must perform on unseen target domains without any prior adaptation. This paper introduces an "episodic" training framework that simulates domain shift during the training phase. By decomposing networks into feature extractors and classifiers and training them with "mismatched" partners from different domains, the proposed method produces more robust representations. Experimental results on benchmarks like PACS and Visual Decathlon demonstrate that this approach outperforms standard data aggregation and specialized DG algorithms, even surpassing standard ImageNet-trained features in general-purpose utility.

Introduction

The brittleness of neural networks under domain shift is a well-documented problem. In the context of Domain Generalization, the goal is to train a model on a set of source domains such that it generalizes to an unknown target domain. Surprisingly, simple data pooling (Vanilla Aggregation) often outperforms more complex DG methods. This research introduces a training strategy that maintains the simplicity of aggregation while explicitly preparing the model for the "shock" of a new domain at runtime.

Methods

The proposed framework decomposes a neural network into a feature extractor ($\theta$) and a classifier ($\psi$). The core innovation is Episodic Training, which "stress tests" these components by pairing them with "naive" partners—components that have not seen the current domain's data.

Domain-Specific Decomposition

To facilitate episodic training, the model first considers domain-specific components. As shown in Figure 1, each source domain $D_i$ can be associated with its own feature extractor $\theta_i$ and classifier $\psi_i$. These serve as the building blocks for creating mismatched pairs during the episodic training phase.

Figure 1: Decomposition of the model into domain-specific feature extractors and classifiers, providing the basis for episodic training.

Episodic Training Strategies

The authors employ three primary strategies:

  1. Episodic Feature Extractor Training: The shared feature extractor is trained to produce representations that a classifier trained on a different domain can still interpret correctly. This forces the features to be domain-agnostic.
  2. Episodic Classifier Training: The shared classifier is trained to remain accurate even when receiving inputs from a feature extractor trained on a different domain.
  3. Random Classifier Regularization (Epi-RCR): For heterogeneous DG where label sets may differ, the feature extractor is trained to support a fixed, random classifier. This extreme mismatch forces the extractor to find highly robust, general-purpose features.
Figure 2: The episodic training process using a random classifier (Epi-RCR) to regularize the feature extractor, simulating extreme domain shift.

Results

The method, termed Epi-FCR, was evaluated across multiple benchmarks including IXMAS, VLCS, PACS, and the large-scale Visual Decathlon.

  • PACS Benchmark: Using an AlexNet architecture, Epi-FCR improved accuracy by 3.3% over vanilla aggregation and 1.7% over previous state-of-the-art methods.
  • Visual Decathlon: On this ten-dataset challenge, the episodic approach significantly outperformed standard ImageNet features and other DG competitors in both average accuracy and the composite VD-Score.
  • Efficiency: Despite the episodic steps, the computational overhead remains low, making it faster than many meta-learning alternatives.

Discussion and Key Insights

A critical finding of this work is the "Mismatched Partner" intuition: a novel domain at test time effectively acts as a "badly tuned" neighbor to any given layer. By simulating this during training, the model learns to compensate for such shifts. Furthermore, noise-perturbation analysis reveals that episodic training leads to "wider" minima in the loss landscape, which inherently provides greater robustness to input variations.

Notably, the DG-trained features were found to be superior general-purpose representations compared to those from standard ImageNet training, suggesting that episodic training is a powerful tool for learning truly universal features.

Limitations

Despite its success, the method faces some challenges. There is a slight "forgetting" of specific ImageNet features when fine-tuning for DG, which the authors currently address through feature concatenation. Additionally, the method introduces hyperparameters ($\lambda$) for balancing episodic losses that may require tuning for new tasks. Future work will explore extending this framework to more complex tasks like object detection and segmentation.

Summary updated

BibTeX
@inproceedings{li2019episodic,
  author = {Da Li and Jianshu Zhang and Yongxin Yang and Cong Liu and Yi-Zhe Song and Timothy M. Hospedales},
  title = {{Episodic Training for Domain Generalization}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2019},
  doi = {10.1109/iccv.2019.00153},
}
Figure