// the find
jcjohnson/fast-neural-style
Feedforward style transfer
This is the reference code for Johnson, Alahi and Fei-Fei's 2016 perceptual-loss paper, which trains a feedforward network to apply one fixed style to any image in a single forward pass. It suits anyone who wants to read or reproduce the original fast style transfer method, or who needs a pretrained style model in a Torch pipeline.
- The core method is small enough to read in an afternoon. The loss lives in StyleLoss.lua, ContentLoss.lua and GramMatrix.lua, and the transformer network is in models.lua, so it is the quickest way to see how perceptual loss is wired together.
- InstanceNormalization.lua backs the half-width models, which are smaller and faster than the paper's networks. The README claims no loss in quality, and it is a practical baseline for real-time work.
- Training, inference and the Gatys-style optimization script share one loss code path, so the feedforward and optimization results can be compared fairly, as the README says.
- The options are documented in doc/flags.md and doc/training.md rather than buried in the README, which makes the scripts usable without reading the Lua source.
- The stack is dated. It requires Torch7, luarocks, and CUDA with optional cuDNN, and nothing has been pushed since October 2023. Expect to spend real time on the install before getting any output. The webcam demo leans on lua---camera and qtlua, which are old and rarely touched, so treat it as a historical demo.
- Each model is trained for one style, so there is no arbitrary-style path at inference time. A new look means a new training run with a dataset and GPU time. Later arbitrary-style methods such as AdaIN cover that case more easily.
- The license allows personal and research use only, and commercial use requires contacting the author. That is a blocker for anyone shipping a product, and it is not an open-source license, so check it before copying any code.