Towards Unsupervised Domain Generalization

Xingxuan Zhang, Linjun Zhou, Renzhe Xu, Peng Cui, Zheyan Shen, Haoxin Liu

Abstract

Deep learning models often struggle with domain shift, failing when test data comes from a different distribution than training data. While Domain Generalization (DG) addresses this, it typically relies on expensive labeled data across multiple domains. This paper introduces Unsupervised Domain Generalization (UDG) and proposes DARLING (Domain-Aware Representation LearnING). DARLING is a contrastive learning framework that utilizes "cheap" domain labels to learn domain-invariant features from unlabeled data. Our results show that DARLING significantly outperforms standard self-supervised baselines, particularly in low-label regimes, and even surpasses ImageNet-1k pretraining in some generalization tasks.

Introduction

Traditional deep learning assumes that training and testing data are Independent and Identically Distributed (I.I.D.). However, real-world applications often face distribution shifts—for instance, a model trained on clear photos failing on sketches or rainy-day images. Domain Generalization (DG) aims to build models that are robust to such shifts by learning features invariant to domain-specific "styles."

The primary bottleneck in DG is the requirement for large-scale labeled datasets across diverse domains. Conversely, unlabeled data is abundant. Current self-supervised learning (SSL) methods, like MoCo or SimCLR, often fail in multi-domain settings because they learn "shortcuts"—distinguishing domains (e.g., photo vs. sketch) rather than semantic categories (e.g., dog vs. cat). We bridge this gap by introducing UDG and the DARLING framework.

Methodology: DARLING

DARLING (Domain-Aware Representation LearnING) modifies the standard contrastive learning objective to be "domain-aware." It leverages domain labels—metadata that is often available for free—to guide the representation learning process.

The DARLING architecture featuring a similarity predictor and domain-specific negative sampling to learn domain-invariant features.

The architecture consists of two key innovations:

  1. Domain-Aware Likelihood: A similarity predictor estimates the domain similarity between images. This allows the model to reweight the contrastive loss, effectively ignoring features that are purely domain-related (like textures or lighting) and focusing on category-discriminative "content."
  2. Domain-Specific Negative Samples: To prevent the model from simply learning to distinguish domains, DARLING maintains a set of "hard" negative samples for each domain. By forcing the model to distinguish between a "positive" image and "negative" images within the same domain, the model is pressured to learn semantic invariants.

Experimental Setup

We evaluated DARLING on several rigorous DG benchmarks:

  • DomainNet: A large-scale dataset with 345 categories across six domains (Clipart, Infograph, Painting, Quickdraw, Real, Sketch).
  • PACS: A standard benchmark featuring Photo, Art, Cartoon, and Sketch domains.
  • CIFAR-10-C & CIFAR-100-C: Datasets corrupted with various noise types to simulate distribution shifts.

Results and Discussion

DARLING demonstrates significant improvements over state-of-the-art self-supervised methods, especially when labeled data is extremely scarce.

Performance comparison on DomainNet across various label fractions (1%, 5%, 10%, 100%). DARLING consistently outperforms baselines.

Key findings include:

  • Superior Low-Label Performance: With only 1% of labels on DomainNet, DARLING achieves 13.29% overall accuracy, outperforming MoCo V2 (10.05%) and SimCLR V2 (11.80%).
  • Efficiency of Domain Labels: Domain labels act as a powerful form of "cheap" supervision. They are sufficient to guide unsupervised learning toward features that generalize better than those learned by standard SSL.
  • Data Diversity vs. Volume: Surprisingly, DARLING pretrained on the diverse DomainNet dataset can outperform models pretrained on the much larger ImageNet-1k. This suggests that for generalization, the diversity of the training distribution is more critical than the sheer volume of data.

Conclusion

DARLING establishes a new baseline for Unsupervised Domain Generalization. By making contrastive learning domain-aware, we can leverage abundant unlabeled data to build models that are robust to distribution shifts. Future work will explore automatic domain discovery to remove the dependence on explicit domain labels and investigate the scalability of these objectives with larger architectures like Vision Transformers.

Summary updated

BibTeX
@inproceedings{zhang2021towards,
  author = {Xingxuan Zhang and Linjun Zhou and Renzhe Xu and Peng Cui and Zheyan Shen and Haoxin Liu},
  title = {{Towards Unsupervised Domain Generalization}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
}
Figure