Semi-Supervised Domain Generalization with Stochastic StyleMatch

Kaiyang Zhou, Chen Change Loy, Ziwei Liu

TL;DR

This paper introduces Semi-Supervised Domain Generalization (SSDG), a challenging task where models must generalize to unseen target domains using only a handful of labeled examples and abundant unlabeled data from multiple source domains. The authors propose StyleMatch, a framework that combines stochastic modeling to prevent overfitting with a multi-view consistency approach that leverages style transfer to bridge domain gaps.

What Problem Does This Paper Address?

Deep learning models are notoriously brittle when faced with "domain shift"—the difference between training data (e.g., photos) and real-world test data (e.g., sketches). While Domain Generalization (DG) aims to build robust models by training on diverse sources, it typically assumes all source data is labeled. Conversely, Semi-Supervised Learning (SSL) handles unlabeled data well but usually assumes all data comes from a single distribution.

The authors identify a critical gap: in many real-world scenarios, we have data from multiple sources, but labeling it all is too expensive. This leads to the SSDG problem. As shown in the figure below, existing DG methods fail because they can't utilize unlabeled data, while standard SSL methods like FixMatch struggle because the domain shifts between sources confuse the pseudo-labeling process.

Comparison of DG, SSL, and the proposed SSDG setting.

Methods

The authors propose StyleMatch, which builds upon the popular FixMatch algorithm but adds two novel components specifically designed for the multi-source, low-label regime:

  1. Stochastic Classifier (SNN): To prevent the model from overfitting to the very small set of labeled data, StyleMatch replaces a standard linear classifier with a stochastic one. It models the classifier's weights as Gaussian distributions. During training, weights are sampled, effectively creating an implicit ensemble that produces more reliable, less "overconfident" predictions.
  2. Multi-view Consistency Learning: Standard FixMatch enforces consistency between a "weakly augmented" image (used to generate a pseudo-label) and a "strongly augmented" version. StyleMatch adds a third view: Style Augmentation. Using Adaptive Instance Normalization (AdaIN), the model generates a version of the image with the style of a different source domain. By forcing the model to predict the same label across all three views, it learns features that are invariant to both geometric changes and stylistic shifts.
The StyleMatch architecture featuring the Stochastic Neural Network (SNN) and multi-view consistency.

Datasets

The authors re-purposed two standard DG datasets to create new SSDG benchmarks:

  • PACS: Contains 7 classes across four domains: Art painting, Cartoon, Photo, and Sketch.
  • OfficeHome: A larger dataset with 65 classes across four domains: Art, Clipart, Product, and Real World.

In these benchmarks, they test extreme low-data scenarios, such as having only 5 or 10 labeled images per class per source domain.

Key Insights and Ideas

  • SSL is a better baseline than DG: Surprisingly, standard SSL methods (which ignore domain labels) often outperform specialized DG methods in the SSDG setting because the ability to leverage unlabeled data is more valuable than domain-specific alignment when labels are scarce.
  • The Overconfidence Trap: In low-data regimes, models often become "overconfident" in their wrong guesses. This creates a vicious cycle in pseudo-labeling. The stochastic classifier acts as a crucial regularizer, keeping the model's confidence in check until it has actually learned meaningful patterns.
  • Style as a Bridge: By explicitly forcing consistency across style-transferred versions of the same image, the model learns to ignore domain-specific "textures" and focus on the underlying object shape and semantics.

Key Results

StyleMatch achieves state-of-the-art performance across both benchmarks, significantly outperforming both DG and SSL baselines.

  • PACS: With 10 labels per class, StyleMatch achieves an average accuracy of 80.41%, surpassing the "Full-Labels" oracle (79.50%) which uses 100% of the source labels. This suggests that the combination of unlabeled data and style-invariant learning is incredibly potent.
  • OfficeHome: On this more complex dataset, StyleMatch maintains a clear lead, especially in the 5-labels-per-class setting, where it beats the nearest SSL competitor by over 1.3%.
  • Ablation Studies: The authors show that the SNN and Multi-view components are complementary. As seen in Figure 5, adding the SNN provides a steady boost, which is then further amplified by the multi-view consistency.
Ablation study showing the performance gains from SNN and Multi-view components.

Limitations and Future Work

  • Distribution Shift Scope: The paper focuses on shifts in the input distribution ($P(X)$) while assuming the label space ($P(Y)$) remains constant across domains. Real-world scenarios might involve "open-set" problems where domains have different classes.
  • Computational Cost: While the inference is efficient (using mean parameters of the SNN), the training involves generating multiple views and sampling weights, which may increase training time compared to vanilla models.
  • Future Directions: The authors suggest that exploring more sophisticated uncertainty estimation and extending SSDG to other modalities (like video or sensor data) are promising next steps.

Summary updated

BibTeX
@article{zhou2021semi,
  author = {Kaiyang Zhou and Chen Change Loy and Ziwei Liu},
  title = {{Semi-Supervised Domain Generalization with Stochastic StyleMatch}},
  journal = {Int. J. Comput. Vis.},
  year = {2021},
  doi = {10.1007/s11263-023-01821-x},
}
Figure