Neural Style Transfer (Gatys)
Recasts a photograph in the style of a painting by matching CNN content features and Gram-matrix style correlations.
Diffusion and generative · 170 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Parameters
- 12.9M
- Operations
- 170
- Framework
- PyTorch
- Recurrent
- No
- Published
- Journal of Vision (arXiv 2015)
- Cited by
- 2,553 (as of 19 October 2026)
- Authors
- Leon A. Gatys, Alexander S. Ecker, Matthias Bethge
- Source
- GitHub: pytorch/tutorials
- License
- BSD-3-Clause
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m1897
- Graph hash
- fd38d601cd780468288c300dde2ece5ca69f8a9950907aadf192eff8fa595186
- Skeleton hash
- f5616f77c853d351a0d2590e4989b6db44280af033cef014c41d2e46a66cfb03
- Architecture hash
- 585a502e702de0464ee8f5fffacb0dc0da7f2e22afdb2c347e51b6b2c2208d24
- Diagram SHA-256
- 025d688edede5bd266e7ad1aab05aa7e895572dedc379d4e5706eed97b0ea7ed
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
Neural style transfer is an artificial system based on a deep neural network that creates artistic images of high perceptual quality. It uses neural representations to separate and recombine the content and style of arbitrary images, which the authors describe as a neural algorithm for the creation of artistic images. The key finding is that the representations of content and style inside a convolutional neural network are separable, so both can be manipulated independently to produce new, perceptually meaningful images.
Content lives in the feature responses of the network's higher layers, which capture objects and their arrangement without constraining exact pixel values. Style is captured by a feature space originally designed for texture, built from the correlations between filter responses over the spatial extent of the feature maps. Those correlations are given by the Gram matrix of each layer. The images are synthesised by finding an image that simultaneously matches the content representation of the photograph and the style representation of the artwork. The loss has two well-separated terms, so the emphasis on reconstructing content or style can be regulated smoothly.
The feature space comes from the 16 convolutional and 5 pooling layers of the 19 layer VGG-Network, with none of the fully connected layers used. One quirk: max-pooling was replaced by average pooling, which the authors found improves gradient flow and gives slightly more appealing results. For the figures in the paper, content was matched on layer 'conv4 2' and style on layers 'conv1 1' through 'conv5 1'. The demonstration renders a photograph of the Neckarfront in Tübingen, Germany in the style of several well-known artworks from different periods of art.
Key idea. A neural algorithm that separates and recombines the content and style of arbitrary images using the representations of a deep neural network trained on object recognition.
- neural style transfer
- Gatys
- A Neural Algorithm of Artistic Style
- artistic style
- style transfer
- Gram matrix
- content loss
- style loss
- VGG-19
- texture synthesis
- neural-style-gatys
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{gatys2015neuralalgorithmartisticstyle,
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},
primaryClass={cs.CV},
url={https://arxiv.org/abs/1508.06576},
}