Abstract
Domain Generalization (DG) aims to train models that can generalize to unseen testing domains by leveraging data from multiple training domains. However, traditional DG methods rely on the availability of multiple diverse training domains, limiting their applicability in data-constrained scenarios. Single Domain Generalization (SDG) addresses the more realistic and challenging setting by restricting the training data to a single domain distribution. The main challenges in SDG stem from the limited diversity of training data and the inaccessibility of unseen testing data distributions. To tackle these challenges, we propose a single domain generalization method that leverages an adversarial memory bank to augment training features. Our memory-based feature augmentation network maps both training and testing features into an invariant subspace spanned by diverse memory features, implicitly aligning the training and testing domains in the projected space. To maintain a diverse and representative feature memory bank, we introduce an adversarial feature generation method that creates features extending beyond the training domain distribution. Experimental results demonstrate that our approach achieves state-of-the-art performance on standard single domain generalization benchmarks.
Introduction
In machine learning, Domain Generalization (DG) represents a significant hurdle: training a model on specific source datasets such that it performs robustly on entirely different, unseen target domains. While traditional DG assumes access to multiple source domains to identify domain-invariant features, real-world constraints often limit researchers to a single source dataset. This scenario, known as Single Domain Generalization (SDG), is particularly challenging due to the limited diversity of the training data and the unpredictable nature of testing domain shifts.
Existing SDG approaches often rely on random data augmentations, which may not adequately capture the complex distribution shifts encountered in practice. To address this, we introduce SDGAM (Single Domain Generalization with Adversarial Memory), a framework that utilizes an adversarial memory bank to synthesize diverse feature representations, effectively preparing the model for unseen domain shifts.
Methodology
The SDGAM framework is built upon two core innovations designed to enhance feature diversity and domain alignment:
1. Memory-Based Feature Augmentation
Rather than relying solely on the raw feature vector $z$ extracted from an image, SDGAM maintains a memory bank of diverse features. An attention mechanism is employed to compare the current image's features against this memory bank, generating an augmented feature $z^a$. By concatenating the original and augmented features, the model learns to project data into an invariant subspace. This process implicitly aligns the training and testing data within a shared mathematical space, facilitating better generalization.
2. Adversarial Memory Bank Updates
The effectiveness of the memory bank depends on its diversity. To prevent the bank from merely replicating the limited training distribution, we employ adversarial feature generation. Using Langevin dynamics-based diffusion, we apply noisy gradients to "push" training features outside their original distribution. These out-of-distribution (OOD) features are then stored in the memory bank. To ensure the bank remains informative, we use entropy-based pruning: features that yield low-entropy (high-confidence) predictions are removed to make room for more challenging, informative adversarial features.
Experimental Results
We evaluated SDGAM across three standard benchmarks: Digits, PACS, and DomainNet.
Performance on Digits Benchmark
On the Digits benchmark (training on MNIST and testing on SVHN, MNIST-M, SYN, and USPS), SDGAM achieved a state-of-the-art average accuracy of 80.5%. This represents a significant improvement over previous leading methods like MCL (78.8%) and SimDE (76.8%).
PACS and DomainNet
On the PACS dataset (training on "Photo"), SDGAM reached a top score of 59.9%, demonstrating superior performance against artistic shifts. On the large-scale DomainNet benchmark, SDGAM achieved 28.7% average accuracy, outperforming competitors like ACVC and SimDE by nearly 2%.
Ablation Study
To understand the contribution of each component, we conducted an ablation study on the Digits benchmark. The results highlight that the adversarial update process is critical; removing it leads to a performance drop from 80.5% to 77.7%. Furthermore, the concatenation of features and the use of the memory bank itself are vital for maintaining high accuracy across diverse target domains.
Conclusion
SDGAM offers a robust solution for Single Domain Generalization by leveraging an adversarial memory bank to simulate diverse domain shifts. By mapping features into an invariant subspace, the model achieves state-of-the-art performance across multiple benchmarks. Future work will explore the computational efficiency of the memory bank updates and the scalability of this approach to large-scale Vision Transformers.
Summary updated