Rethinking and Improving the Robustness of Image Style Transfer

Pei Wang, Yijun Li, Nuno Vasconcelos

TL;DR

This paper identifies a key architectural bottleneck in modern neural networks (specifically residual connections) that hinders their effectiveness in image style transfer, a task that traditionally relies on older VGG architectures. They propose a simple "activation smoothing" technique (SWAG) that significantly improves style transfer quality across various architectures, even outperforming VGG in some cases.

What Problem Does This Paper Address?

Neural style transfer, a technique that allows users to render an image in the artistic style of another, has seen remarkable success using features extracted from pre-trained VGG networks. However, a puzzling observation is that when more modern and performant networks like ResNet are used as feature extractors, the style transfer quality degrades significantly. This is particularly surprising because VGG networks with randomly initialized weights can still perform comparably to pre-trained ones for style transfer, suggesting the architecture itself is more critical than learned weights. The paper aims to understand why this performance gap exists between VGG and other architectures, and to propose a solution that makes style transfer robust across a wider range of networks.

Methods

The core of the paper's investigation lies in analyzing the statistical properties of feature activations within different network architectures. They hypothesize that the "residual connections" prevalent in modern networks like ResNet are the primary cause of the degradation.

  1. Statistical Analysis: The authors compare the entropy and peakiness of feature activations and their corresponding Gram matrices (which encode style) between VGG and ResNet architectures. They observe that ResNet's activations have low entropy and high peaks, especially in deeper layers, indicating a dominance of a few feature channels and a loss of diversity.
  2. Architectural Ablation: They systematically remove residual connections from ResNet (creating "NoResNet") and observe a dramatic improvement in style transfer quality, bringing it closer to VGG performance. Further modifications to make "NoResNet" more VGG-like also showed improvements, but the deletion of residual connections was identified as the most impactful change.
  3. Activation Smoothing (SWAG): To address the low entropy and peakiness of activations in residual networks, they propose a simple post-hoc modification. Instead of directly using the raw feature activations in the style and content loss functions, they apply a softmax transformation to smooth them. This "Stylization With Activation smoothing" (SWAG) technique aims to increase the uniformity of activation distributions and reduce the dominance of a few channels.

Datasets

The paper does not explicitly mention specific datasets for training the networks. However, it implies the use of standard image datasets for evaluating style transfer, such as those used in previous style transfer research. For experiments, they use content and style images to generate stylized outputs. They also mention using ImageNet for pre-training the VGG and ResNet models.

Key Insights and Ideas

  • Residual Connections are the Culprit: The paper convincingly demonstrates that residual connections, a cornerstone of modern deep learning architectures for classification, are detrimental to image style transfer. They lead to "peaky" and low-entropy feature activations that fail to capture the rich diversity of style information.
  • Architecture Trumps Learned Weights: The finding that random VGG networks perform comparably to pre-trained ones for style transfer is a crucial insight. It highlights that the inductive biases of the architecture are more important than the specific weights learned for other tasks.
  • Entropy is Key for Style Diversity: Low entropy in feature activations means that only a few channels are strongly activated, limiting the network's ability to represent and transfer diverse stylistic elements. High entropy, as seen in VGG, allows for a richer representation.
  • Simple Softmax Fixes a Complex Problem: The proposed SWAG method is remarkably simple yet effective. Applying a softmax to the activations before computing loss functions is a lightweight modification that significantly boosts performance, even for architectures that previously struggled.

Key Results

  • SWAG Improves Performance Across Architectures: SWAG significantly enhances style transfer quality for ResNet, Inception-v3, and Wide ResNet (WRN) models, making their performance comparable to or even better than the standard VGG.
  • Random Networks Benefit Greatly: SWAG enables random-weight ResNet models to achieve stylization quality comparable to pre-trained VGG models.
  • Qualitative Improvements: Visual examples show that SWAG-enhanced models transfer higher-level style features like strokes and textures more faithfully, producing more aesthetically pleasing results.
  • Quantitative User Study: A user study showed that users preferred images generated by SWAG-enhanced models over those from standard models, including VGG, in a significant majority of cases.
  • Ablation Study on Reconstruction/Synthesis: SWAG also improved performance on image reconstruction and texture synthesis tasks, further supporting the idea that residual connections hinder the effective use of deeper layer features.

Limitations and Future Work

  • Inception Architecture Nuances: The paper notes that the improvement with SWAG was less pronounced for the Inception-v3 architecture, speculating that its complex parallel connections might make feature merging more challenging for style transfer. Further investigation into this specific architecture is suggested.
  • Hyperparameter-Free Nature of SWAG: While the authors chose a simple softmax without a temperature parameter for SWAG, they mention that other smoothing methods and temperature variations were explored and found to work, suggesting potential for further tuning or exploration of different smoothing strategies.
  • Focus on Gram Matrix Loss: The primary analysis and proposed solution are centered around the Gram matrix loss, a common choice in style transfer. While they mention results hold for other losses, a deeper dive into SWAG's impact on different loss formulations could be beneficial.

Summary updated

BibTeX
@inproceedings{wang2021rethinking,
  author = {Pei Wang and Yijun Li and Nuno Vasconcelos},
  title = {{Rethinking and Improving the Robustness of Image Style Transfer}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  doi = {10.1109/cvpr46437.2021.00019},
}
Figure