Domain Generalization Emerges from Dreaming

Hwan Heo, Youngjin Oh, Jaewon Lee, Hyunwoo J. KimarXiv 2023

Abstract

Recent studies have proven that DNNs, unlike human vision, tend to exploit texture information rather than shape. Such texture bias is one of the factors for the poor generalization performance of DNNs. We observe that the texture bias negatively affects not only in-domain generalization but also out-of-distribution generalization, i.e., Domain Generalization. Motivated by the observation, we propose a new framework to reduce the texture bias of a model by a novel optimization-based data augmentation, dubbed Stylized Dream. Our framework utilizes adaptive instance normalization (AdaIN) to augment the style of an original image yet preserve the content. We then adopt a regularization loss to predict consistent outputs between Stylized Dream and original images, which encourages the model to learn shape-based representations. Extensive experiments show that the proposed method achieves state-of-the-art performance in out-of-distribution settings on public benchmark datasets: PACS, VLCS, OfficeHome, TerraIncognita, and DomainNet.

Introduction

Deep Neural Networks (DNNs) often fail in new environments because they rely on "texture shortcuts" rather than understanding object shapes. This phenomenon, known as texture bias, is a significant hurdle in Domain Generalization (DG). While humans identify a dog by its shape, a standard ResNet might identify it by the texture of its fur. In a new domain like "Sketch," where fur texture is absent, the model fails.

Interestingly, models trained on artistic domains often generalize better than those trained solely on photos because art forces the model to look past realistic textures. Motivated by this, we introduce Stylized Dream, an optimization-based data augmentation that generates "dreamed" versions of images with altered textures but preserved shapes, forcing the model to learn robust, shape-based representations.

Methodology: Stylized Dream

The Stylized Dream (SD) framework consists of two main components designed to break the model's reliance on texture:

  1. Stylized Dream Augmentation: Inspired by "DeepDream," this method uses an optimization process to perturb an input image. Using Adaptive Instance Normalization (AdaIN), it takes a content image $x$ and a style image $\bar{x}$ (randomly sampled from the same class), then updates the pixels of $x$ to maximize a "dream loss." This loss encourages the feature statistics (mean and variance) of the content image to match those of the style image. The result is a version of the original image with a completely different, "dream-like" texture but the same underlying geometry.
  2. Consistency Training: During training, the model sees both the original image and its "Stylized Dream" counterpart. We apply a Consistency Loss (specifically Kullback–Leibler divergence) to ensure the model produces the same output for both. This explicitly penalizes the model for relying on texture; if the texture changes but the prediction must stay the same, the model is forced to focus on the invariant shape.
The Stylized Dream framework: an input image x is transformed into a stylized version x' using AdaIN and gradient-based optimization. Consistency loss ensures the model focuses on shape rather than texture.

Experimental Evaluation

We evaluated our method on five standard Domain Generalization benchmarks: PACS, VLCS, OfficeHome, TerraIncognita, and DomainNet.

Key Results

  • State-of-the-Art Performance: The proposed method, Ours$_{SDA}$, achieved a top average accuracy of 88.96% on PACS, outperforming established methods like SWAD (88.1%) and SagNet (86.3%).
  • The Importance of Consistency: Ablation studies showed that simply feeding "dreamed" images into the model as standard augmentation improved accuracy to 85.66%, but adding the consistency loss caused performance to jump to 88.96%.
  • Architecture Agnostic: The method showed consistent gains regardless of whether the backbone was a VGGNet-16, ResNet-18, or ResNet-50.
  • Single-Source Success: In the difficult setting of training on only one domain (e.g., only Photos) and testing on all others, our method outperformed the previous best (SelfReg) by nearly 4%.

Insights and Discussion

One of the most compelling findings is the shift in what the model "sees." When performing adversarial attacks (PGD) on a model trained with Stylized Dream, the resulting perturbations clearly outline the shape of the object (e.g., a dog's ears and snout). In baseline models, these perturbations appear as random noise. This provides visual evidence that the model has successfully learned to prioritize geometric features over texture shortcuts.

While Stylized Dream requires an optimization loop for every training batch—making it computationally more expensive than simple flips—the authors note that even a single iteration ($K=1$) provides significant benefits. This framework demonstrates that by systematically removing texture as a reliable cue, we can build models that generalize more like humans.

Summary updated

BibTeX
@misc{heo2023domain,
  author = {Hwan Heo and Youngjin Oh and Jaewon Lee and Hyunwoo J. Kim},
  title = {{Domain Generalization Emerges from Dreaming}},
  year = {2023},
  eprint = {2302.00980},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2302.00980},
}
Figure