In the light of feature distributions: moment matching for Neural Style Transfer

Nikolai Kalischek, Jan Dirk Wegner, Konrad Schindler

TL;DR

This paper introduces a more rigorous way to perform Neural Style Transfer (NST) by matching higher-order moments of feature distributions. By moving beyond simple mean and variance matching to use Central Moment Discrepancy (CMD), the authors achieve more faithful artistic style reproduction and better separation of style from image content.

What Problem Does This Paper Address?

Neural Style Transfer works by taking the "content" of one image and the "style" of another. In the deep learning era, "style" is typically defined as the distribution of features in a pre-trained Convolutional Neural Network (CNN).

The authors argue that most existing methods are theoretically limited because they only align the first and second moments (mean and variance) of these distributions. For example, the famous Gram matrix approach (Gatys et al.) and popular real-time methods like AdaIN only capture basic statistics. However, two very different distributions can share the same mean and variance—think of a bell-shaped Gaussian curve versus a sharp, peaked Laplace distribution. In the context of art, this means failing to capture the subtle "fingerprint" of an artist's brushwork, leading to color leaking from the content image or muddy textures.

Methods

The core innovation is the application of Central Moment Discrepancy (CMD) to the style transfer loss function.

  • Higher-Order Matching: Unlike previous methods, CMD matches all centralized moments (variance, skewness, kurtosis, etc.) up to a specified order $K$ (the authors found $K=5$ to be a sweet spot).
  • Theoretical Guarantee: CMD is a probability metric; if you match all moments in the limit, the distributions are identical. This provides a much stronger mathematical foundation than previous heuristic approaches.
  • Implementation: To make it work in practice, the authors wrap feature maps in a sigmoid function to bound them between 0 and 1. They then compute marginal central moments, which keeps the method computationally efficient while still capturing complex distribution shapes.
Figure 2: Illustration of distribution matching in 1D. The source ∼Beta(2, 3) and target ∼Beta(0.5, 0.45) cannot be aligned with MMD, MM or OT (which in 1D is the same as MM). On the contrary, CMD aligns them well already with five moments, and the residual error decreases asymptotically as more moments are added. See text for details.

Datasets

  • Content Images: The authors used the Kodak image dataset along with other standard images frequently used in NST research (portraits, landscapes, etc.).
  • Style Images: A diverse set of 20 paintings from famous artists including Picasso, Kandinsky, Van Gogh, Richter, and Monet.
  • Evaluation: They generated a massive set of 620 stylized images per algorithm for a comprehensive user study.

Key Insights and Ideas

  • Style is in the Skewness: The "aha moment" is that artistic style isn't just about average color or contrast. Higher-order moments capture the specific "lopsidedness" or "pointiness" of feature distributions, which translates to the unique textures and brushstroke patterns of an artist.
  • Better Disentanglement: By matching the style distribution more precisely, the method is less likely to let the content image's colors "leak" into the result. It forces the output to strictly follow the style's color palette.
  • Efficiency vs. Rigor: The authors show that you don't need expensive Optimal Transport calculations to get high-quality results; a well-designed moment-matching loss is both fast and effective.

Key Results

  • User Preference: In a study with 56 participants, the CMD method was the most preferred, receiving 21.7% of votes. It outperformed the classic Gatys et al. method (19.7%) and several other state-of-the-art techniques.
  • Qualitative Superiority: The method excels at reproducing "granular" textures like canvas and oriented brush strokes that other methods often blur or ignore.
  • Performance: While it is an iterative optimization method (taking about 33 seconds for a 512x512 image on a GTX 1080Ti), it adds less than 10% computational overhead compared to the original Gatys method, making it a "drop-in" improvement for quality-focused style transfer.
Figure 1: Style transfer results: artists’ portraits rendered in their own painting style by our method.

Limitations and Future Work

  • Speed: Like all iterative optimization methods, it is significantly slower than "one-shot" feed-forward models (like AdaIN). It is not currently suitable for real-time video applications.
  • Marginal Assumption: For the sake of speed, the authors match marginal moments (treating each feature channel independently). They acknowledge that capturing correlations between channels might improve results further, though it would be much more computationally expensive.
  • Future Directions: The authors suggest that integrating CMD into the training of feed-forward networks could combine the quality of their approach with the speed of real-time models.

Summary updated

BibTeX
@inproceedings{kalischek2021light,
  author = {Nikolai Kalischek and Jan Dirk Wegner and Konrad Schindler},
  title = {{In the light of feature distributions: moment matching for Neural Style Transfer}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  doi = {10.1109/cvpr46437.2021.00926},
}
Figure