Paper commentary
A Neural Algorithm of Artistic Style
Deep neural networks can separate and recombine the content and style of images
- Problem Artistic images blend a scene's content with a distinctive style, and no artificial system had matched that skill. It was unclear whether a network's internal representations hold content and style as separate parts.
- Method The method matches network content and style features in a noise image.
- Results The synthesised images keep a photograph's scene while taking colours and local structures from five paintings. The trade-off is set by the content-to-style weight ratio, with values of 1×10−3 or 1×10−4.
Why content and style are hard to separate
Deep Neural Networks have reached near-human performance on object and face recognition, but until this work no artificial system could produce artistic images with comparable skill. The study asks whether the internal representations of a network trained for object recognition hold content and style as separate components that can be recombined.
Content and style read from the same network
A Convolutional Neural Network is a feed-forward stack of layers, each made of small units that act as image filters, so each layer outputs feature maps that are filtered copies of the input. Along the stack the number of filters grows while the spatial size of the filtered images shrinks through a downsampling step such as max-pooling.
Higher layers encode object-level content and the arrangement of objects while leaving exact pixel values largely unconstrained, and the authors call these higher-layer feature responses the content representation. Reconstructions from the lower layers conv1 1, conv2 1 and conv3 1 come out almost identical to the input, whereas the higher layers conv4 1 and conv5 1 keep the scene's content while losing detailed pixel information.
The style representation is built from correlations between filter responses over the spatial extent of each feature map, computed in several layers at once, so it captures texture and appearance but drops the global arrangement. For a layer with N_l filters and feature maps of size M_l, the responses are stored in a matrix F^l, and the correlations form a Gram matrix whose entries are given by \[ G^l_{ij}=\sum_k F^l_{ik}F^l_{jk} \].
Making each representation visible
Content reconstructions start from a white noise image and are changed by gradient descent until their feature responses in one layer match those of the original image. The squared-error content loss is \[ \mathcal{L}_{content}(\vec p,\vec x,l)=\frac{1}{2}\sum_{i,j}(F^l_{ij}-P^l_{ij})^2 \], where P^l is the representation of the original image and F^l that of the generated image.
Style reconstructions use the same optimisation, but match Gram matrices instead of raw responses. Each layer contributes \[ E_l=\frac{1}{4N_l^2M_l^2}\sum_{i,j}(G^l_{ij}-A^l_{ij})^2 \], where A^l is the Gram matrix of the style image, and the total style loss is the sum of the E_l weighted by w_l.
Style reconstructions from more layers reproduce colours and localised structures of the input, and the size and complexity of these structures grow as higher layers are included. The authors explain this growth by the increasing receptive field sizes and feature complexity along the hierarchy.
Joint optimisation of content and style
The synthesis runs on the VGG-Network, using its 16 convolutional layers and 5 pooling layers, and the fully connected layers are not used. For image synthesis the max-pooling operation is replaced by average pooling, which the authors found improves gradient flow and gives slightly more appealing results.
The generated image x starts as white noise and is updated to minimise the weighted sum \[ \mathcal{L}_{total}(\vec p,\vec a,\vec x)=\alpha\mathcal{L}_{content}(\vec p,\vec x)+\beta\mathcal{L}_{style}(\vec a,\vec x) \], where p is the photograph and a the artwork. The ratio α/β sets how strongly the content term is weighted against the style term, and it is the knob used to trade one off against the other.
For the images in Fig 2, the content was matched at layer conv4 2, and the style at conv1 1, conv2 1, conv3 1, conv4 1 and conv5 1, each with weight 1/5 and all other layers at zero. The ratio α/β was 1×10−3 for panels B, C and D and 1×10−4 for panels E and F.
Photograph rendered in painting styles
In the synthesised images the global arrangement of the Neckarfront photograph is kept, while the colours and local structures come from the artwork. The result looks like the artwork, yet it shows the same scene as the photograph.
The five painting styles are Turner's The Shipwreck of the Minotaur (1805), van Gogh's The Starry Night (1889), Munch's Der Schrei (1893), Picasso's Femme nue assise (1910) and Kandinsky's Composition VII (1913), shown in panels B to F. Each panel is a separate synthesis from the same photograph, so the comparison isolates the effect of the style image.
Layer depth and content-style weighting
Matching style only up to a few lower layers gives a different visual result than matching up to higher layers, and including higher layers yields smoother and more continuous images. The authors find the most appealing images when the style is matched up to the highest layers.
A strong weight on style produces a texturised version of the painting that hardly shows the photograph's content, whereas a strong weight on content makes the photograph clearly recognisable while the painting's style is matched less well. Fig 3 shows this for the painting Composition VII by Kandinsky, with the α/β ratio printed above each column and the style layer subsets varied across the rows.
Content and style cannot be completely disentangled: usually no image matches both constraints exactly, but the two loss terms are separate enough to be weighted independently. Because of this separation, the emphasis can be moved smoothly between reconstructing the content and reconstructing the style.
Links to biological vision
Earlier texture transfer methods manipulate pixel values with non-parametric techniques, whereas this approach manipulates feature spaces that encode the high-level content of an image. Earlier separation of style from content was tested on simpler inputs such as handwritten characters and face images in different poses.
The authors suggest that correlations between neurons, a computation attributed to complex cells in V1, could yield a content-independent representation of appearance, but this is a hypothesis and was not tested here. They also propose that learning object recognition makes the network invariant to image variation that preserves object identity, which could explain why content and style separate.
Limitations and open questions
The evidence for the synthesised images is visual, drawn from a small set of chosen examples, and the text reports no numerical score for the images or for comparisons with earlier methods. Content and style cannot be fully separated during synthesis, because usually no image satisfies both constraints at once.
All results are obtained with the VGG-Network, and the text does not test other network architectures. The synthesis is also tuned by choices such as the average pooling and the α/β values, and the study reports only the settings used for its figures.
The authors conjecture that a stationary style feature space could classify artworks by period more accurately than raw network activations, but this was not tested.
Paper info
- Authors
- Leon A. Gatys, Alexander S. Ecker, Matthias Bethge
- Venue
- arXiv · Preprint
- First published
- 2015-8-26
- Added
- 2026-11-12
- Updated
- 2015-9-2
- Version
- v2
- arXiv
- 1508.06576
- Category
- cs.CV · cs.NE · q-bio.NC
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Leon A. Gatys, Alexander S. Ecker, Matthias Bethge (2015). A Neural Algorithm of Artistic Style. arXiv:1508.06576v2. https://arxiv.org/abs/1508.06576v2
BibTeX
@misc{gatys2015neural,
title = {{A Neural Algorithm of Artistic Style}},
author = {Leon A. Gatys and Alexander S. Ecker and Matthias Bethge},
year = {2015},
eprint = {1508.06576},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1508.06576v2}
}