Skip to content

neural-style

Torch implementation of the Gatys et al. neural style transfer paper, blending one image's content with anothe

Stars
18.3k
Forks
2.6k
Licence
MIT
Language
Lua
Last update
8.7 years ago
Type
App

No commits in over a year — check for forks or alternatives before adopting.

What it is

This project takes two images, a content photo and a style image such as a painting, and produces a new image that keeps the content of the first while adopting the artistic style of the second. It is a Lua implementation built on the Torch framework, following the 2015 paper "A Neural Algorithm of Artistic Style" that uses convolutional neural networks to do this. People use it to experiment with artistic filters on their own photos.

  • Render a photo in the style of a painting using the -style_scale flag to change the scale of style features
  • Blend two or more style images together and control their relative weight through style interpolation
  • Keep the original colors of a photo while transferring only the style, using -original_colors 1
  • Adjust the trade-off between content fidelity and style strength to get different looks

Great for

  • Researchers or students reproducing the Gatys et al. style transfer paper
  • Hobbyists who want to render their photos in the style of famous paintings
  • Developers exploring neural style transfer with the Torch framework
  • People who want to blend multiple style images with adjustable weights

Not ideal for

  • Users who need a simple point-and-click app, since setup requires installing Torch and several dependencies
  • Anyone wanting a modern Python or PyTorch workflow, because the README describes a Torch/Lua codebase
  • Users without a suitable GPU who need fast results, since the README mentions CUDA, cuDNN and OpenCL backends but the truncated text does not describe CPU performance
Step-by-step guide: how to use neural-styleInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Clone and build from source

    You'll need: Torch7 · loadcaffe · Optional: CUDA 6.5+ with cunn, or cuDNN via cudnn.torch, or OpenCL via cltorch and clnn

    Download the VGG model after installing dependencies

    sh models/download_models.sh
  2. 2

    Run it

    • Install Torch7 and the loadcaffe dependency
    • Clone the repository with git clone https://github.com/jcjohnson/neural-style
    • Run sh models/download_models.sh to download the VGG-19 model
    • Run the neural style script with your content and style images (exact command not shown in the truncated README)
  3. 3

    Get the most out of it

    • Use -style_scale to control the size of the style features transferred
    • Combine multiple style images and use style interpolation weights to blend them
    • Use -original_colors 1 to keep the content image's colors
    • Enable the cuDNN or CUDA backend if you have a compatible GPU, as listed in the README's optional dependencies

Downloads

Strengths

  • Well-known reference implementation of the influential Gatys et al. paper, with many example outputs in the README
  • Supports several flags for controlling style scale, multiple styles, and color retention
  • MIT licensed

Trade-offs

  • Built on Torch7 and Lua, an older stack with dependencies that may be hard to install today
  • The README's last push date is 2018-02-23, so the project may not be actively maintained
  • Setup requires downloading the VGG-19 model via a script, and the truncated README does not show full usage instructions

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.