Style-Aware Normalized Loss for Improving Arbitrary Style Transfer

Jiaxin Cheng, Ayush Jaiswal, Yue Wu, Pradeep Natarajan, Prem Natarajan

Abstract

Neural Style Transfer (NST) has quickly evolved from single-style to infinite-style models, also known as Arbitrary Style Transfer (AST). Although appealing results have been widely reported in literature, our empirical studies on four well-known AST approaches (GoogleMagenta, AdaIN, LinearTransfer, and SANet) show that more than 50% of the time, AST stylized images are not acceptable to human users, typically due to under- or over-stylization. We systematically study the cause of this imbalanced style transferability (IST) and propose a simple yet effective solution to mitigate this issue. Our studies show that the IST issue is related to the conventional AST style loss, and reveal that the root cause is the equal weightage of training samples irrespective of the properties of their corresponding style images, which biases the model towards certain styles. Through investigation of the theoretical bounds of the AST style loss, we propose a new loss that largely overcomes IST. Theoretical analysis and experimental results validate the effectiveness of our loss, with over 80% relative improvement in style deception rate and 98% relatively higher preference in human evaluation.

Introduction: The Problem of Imbalanced Stylization

Arbitrary Style Transfer (AST) aims to apply the artistic style of any reference image to a content image in real-time. While recent models like AdaIN and SANet have shown impressive capabilities, they often suffer from Imbalanced Style Transferability (IST). In practice, these models are inconsistent: they may only transfer basic colors (under-stylization) or completely destroy the content structure with excessive texture (over-stylization). Empirical studies suggest that over 50% of AST-generated images are considered unacceptable by human evaluators due to these extremes.

The Root Cause: Biased Style Loss

The researchers identified that the root cause of IST lies in the standard Gram matrix-based style loss used during training. This loss function exhibits a massive dynamic range; some style images naturally produce loss values up to 1,000 times larger than others.

During the training process, the model treats every style-content pair as a separate task. Because the loss values are not normalized, the model naturally prioritizes "high-loss" styles—those with high internal variance or complex textures. This creates a bias where the model over-fits to complex styles (leading to over-stylization) while neglecting simpler ones (leading to under-stylization).

Methodology: Style-Aware Normalization

To address this, the authors propose treating AST as a multi-task learning problem and introducing a Style-Aware Normalized Loss.

  1. Theoretical Bounds: The team mathematically derived the supremum (upper bound) and infimum (lower bound) for the Gram-matrix style loss.
  2. Normalization: Instead of using raw loss values, the layer-wise style loss is divided by its theoretical supremum. This maps the loss for every style into a consistent range (0 to 1).
  3. Balanced Training: By normalizing the loss based on the properties of the style image itself, every style exerts an equal influence on the model's weight updates. This prevents "heavy" styles from dominating the training process.

Experimental Validation

The proposed loss was integrated into four state-of-the-art AST frameworks. The results demonstrate a significant leap in visual quality and consistency.

Comparison of the proposed balanced loss versus the classic loss in mitigating under-stylization and over-stylization across various content and style pairs.

Key Metrics:

  • Human Preference: In large-scale studies, users preferred the balanced loss results 55.9% of the time, compared to 28.2% for the classic loss—a 98% relative improvement.
  • Deception Rate: Using an artist classification model to evaluate how well the style was captured, the new loss achieved an 80%+ relative improvement in deception rates.
  • Qualitative Success: As shown in the figure above, the new loss successfully captures intricate textures in cases of previous under-stylization and preserves content edges in cases of previous over-stylization.

Conclusion

By identifying and correcting the inherent bias in the Gram-matrix style loss, this research provides a robust framework for more reliable Arbitrary Style Transfer. The Style-Aware Normalized Loss is computationally efficient, data-independent, and easily integrated into existing neural architectures, paving the way for more consistent and artistically faithful AI-generated art.

Summary updated

BibTeX
@inproceedings{cheng2021style,
  author = {Jiaxin Cheng and Ayush Jaiswal and Yue Wu and Pradeep Natarajan and Prem Natarajan},
  title = {{Style-Aware Normalized Loss for Improving Arbitrary Style Transfer}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  url = {https://openreview.net/forum?id=F8tWqfvxoN5},
}
Figure