All models

fast_neural_style

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

Diffusion and generative · 64 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 (54 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
64
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
m4841
Graph hash
ef9e9d868dcd7b87ade14c5a8d6c0c3ff1335c2b86f3e2cb325a393aa3910445
Skeleton hash
fb1bdeecc0c9b69d81b38d706c905e56eba54e02cc07562ad908544d0b4efb86
Architecture hash
873f1d7d3af842f60e31ccf45db70aad5fb7798605b42736e5257cf667785fe1
Diagram SHA-256
707df769f185a5f9acda729abe40a447aac97f8629893c748d8f67cf029922fe
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 PyTorch project's own example reimplementation from pytorch/examples.

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}, 
}