All models

Fast Neural Style Transfer

A feed-forward image transformation network trained with perceptual losses for real-time style transfer.

Diffusion and generative · 54 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (45 KB)

Open in a new tab

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
1.7M
Operations
54
Framework
PyTorch
Recurrent
No
Published
ECCV 2016
Cited by
11,252 (as of 17 October 2026)
Authors
Justin Johnson, Alexandre Alahi, Li Fei-Fei
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 diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m16635
Graph hash
cd31a6dd91d1d833f382d8b5295292f58e2405f631386162615a032ef56860d3
Skeleton hash
846c4e9721a3e9a1e12d3032fa149a38fbcc5a58da792b1f27ab8f6e1c4aca73
Architecture hash
dcaa187315b63c036cb83576297b89a58efa5443c8652fbcb412be0d3bf3dca8
Diagram SHA-256
86a2c548d4f0f70927633868c584554c522d6d8d6130678783121ee3e806f7f1
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

This is the authors' original Lua Torch implementation, which also includes an implementation of instance normalization.

About this model's family

Fast Neural Style is the network that made artistic style transfer run in real time: a convolutional image transformation network in which a feed-forward network is trained to solve the optimization problem proposed by Gatys et al in real-time. The idea is to change the training signal rather than the architecture: instead of a per-pixel loss, the network is trained with perceptual loss functions based on high-level features extracted from pretrained networks. Compared to the optimization-based method, the network gives similar qualitative results but is three orders of magnitude faster.

Those features come from a pretrained VGG-16 loss network that is used only in training; the graph here is the transformation network. The transformation network has no pooling layers, instead using strided and fractionally strided convolutions for in-network downsampling and upsampling. Its body consists of five residual blocks, and other than the first and last layers which use 9 × 9 kernels, all convolutional layers use 3 × 3 kernels. The output layer uses a scaled tanh to ensure that the output image has pixels in the range [0, 255]. For style transfer the input and output are both color images of shape 3 × 256 × 256, which is the size traced here.

Two copies are captured: the authors' original repository, which also includes an implementation of instance normalization, a simple trick that significantly improves the quality of feedforward style transfer models. The second is the PyTorch project's own example, listed in pytorch/examples under Implement the Neural Style Transfer algorithm on images. With the authors' code, stylizing a 1200x630 image of the Stanford campus takes 50 milliseconds on a Pascal Titan X.

Key idea. Training a feed-forward image transformation network with perceptual losses from a fixed pretrained loss network, so style transfer runs three orders of magnitude faster than optimization.

  • fast neural style
  • Fast Neural Style Transfer
  • fast_neural_style
  • TransformerNet
  • perceptual loss
  • Johnson style transfer
  • real-time style transfer
  • image transformation network

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{johnson2016perceptuallossesrealtimestyle,
      title={Perceptual Losses for Real-Time Style Transfer and Super-Resolution}, 
      author={Justin Johnson and Alexandre Alahi and Li Fei-Fei},
      year={2016},
      eprint={1603.08155},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/1603.08155}, 
}