NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Improving Domain Generalization using Style Regularization

Gustavo Pérez2021

Abstract: We study the problem of improving domain generalization on deep networks by reducing the bias towards texture learned by these models when pre-trained in large color image datasets like ImageNet. To do so, we present a style regularization to enforce more shape-biased learning. Also, we propose an experimental setup using synthetically created test sets using state-of the-art style transfer methods. We report our experiments on stylized versions of CIFAR-10 and STL-10 datasets. In our preliminary results presented here, we show that our style regularization improves performance on new domains but not as significantly as with style augmentation.

Introduction

Current deep learning models, particularly those pre-trained on massive datasets like ImageNet, exhibit a significant "texture bias." While humans typically recognize objects by their global shape and structure, neural networks often rely heavily on local texture patterns. For instance, a model might identify a cat primarily by the pattern of its fur rather than its silhouette.

This bias presents a major challenge for Domain Generalization. When a model trained on standard photographs is deployed in environments with different visual styles—such as sketches, paintings, or stylized digital art—it often fails because the textures have changed, even if the underlying shapes remain recognizable. While "style augmentation" (generating numerous stylized versions of training images) can mitigate this, it is computationally expensive and requires auxiliary pre-trained models. This research proposes a "style regularization" technique to bake shape-focus directly into the training process.

Methodology: Style Regularization

The proposed Style Regularization aims to achieve the benefits of style augmentation without the heavy overhead of image generation. The hypothesis is that style augmentation works by reducing the spectral norm of the Gram matrix, which represents the correlations between different feature channels in a convolutional layer.

Instead of generating new images, the authors introduce a penalty term to the loss function:

  1. Gram Matrix Calculation: For a batch of images, the Gram matrix $G$ is computed for specific convolutional layers.
  2. Penalty Term: The spectral norm (or L2 norm) of these matrices is calculated.
  3. Optimization: By minimizing this norm during training, the model is encouraged to reduce the correlation between feature activations. This pushes the model to ignore domain-specific "style" patterns and focus on more robust features like shape.

Experimental Setup

The study evaluates performance on two datasets with custom-made "stylized" versions for testing:

  • CIFAR-10: 32x32 images using the LeNet architecture.
  • STL-10: 96x96 images using the Inception v3 architecture.

To evaluate domain generalization, the authors created synthetic test sets by applying 20 distinct, "far-away" styles to the original test images using state-of-the-art style transfer methods.

Examples of stylized images used to evaluate domain generalization.

Results and Discussion

The experiments reveal a clear hierarchy in performance when testing on stylized (out-of-domain) images. While style regularization provides a notable boost over baseline models, it currently trails behind full style augmentation.

Quantitative Performance

On the STL-10 dataset, the baseline model (no augmentation) achieved only 15.3% accuracy on stylized test sets. Implementing Style Regularization (spectral norm penalty) increased this to 23.6%. In comparison, full Style Augmentation reached 58.2%.

Performance comparison on STL-10 dataset across different augmentation and regularization strategies.

Key Insights

  • Texture as Overfitting: Domain bias can be viewed as a form of overfitting to the specific textures of the training set.
  • Resolution and Style: On low-resolution CIFAR-10 images, simple color jittering performed almost as well as complex style augmentation, suggesting that for small images, "style" is largely synonymous with "color."
  • Preserving Source Performance: A significant advantage of style regularization is that it improves generalization without degrading performance on the original, non-stylized dataset—a common side effect of aggressive data augmentation.

Conclusion and Future Work

While style regularization provides a computationally efficient way to improve domain generalization, a performance gap remains compared to style augmentation. This suggests that the Gram matrix penalty may not yet capture the full complexity of style variation. Future research will explore alternative norms (such as the nuclear norm) and investigate why the performance gap widens on higher-resolution images like those in STL-10.

Summary updated

BibTeX
@misc{perez2021improving,
  author = {Gustavo Pérez},
  title = {{Improving Domain Generalization using Style Regularization}},
  year = {2021},
  doi = {10.52591/lxai2021062512},
}
Figure