explaingit

anishathalye/neural-style

5,543PythonAudience · researcherComplexity · 3/5LicenseSetup · moderate

TLDR

A Python program that repaints any photo in the visual style of another image, like making a selfie look like a Van Gogh painting, using a pre-trained neural network.

Mindmap

mindmap
  root((neural-style))
    What it does
      Transfers art style to photos
      Blends multiple styles
      Preserves original colors
    Inputs
      Content image
      Style image(s)
      Style weights
    Tech Stack
      Python
      TensorFlow
      Pre-trained VGG network
    Use Cases
      Artistic photo filters
      Style blending
      Research experiments
    Audience
      Researchers
      Creative coders
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Turn a photo into an artwork that looks painted in the style of a famous artist like Van Gogh or Picasso.

USE CASE 2

Blend multiple style images together with custom weights to create a mixed artistic effect on any photo.

USE CASE 3

Experiment with command-line settings to control how abstract or detailed the style transfer output looks.

USE CASE 4

Use as a research baseline for neural style transfer experiments on custom images.

Tech stack

PythonTensorFlow

Getting it running

Difficulty · moderate Time to first run · 1h+

Requires downloading a ~500MB pre-trained VGG network file before first use, GPU significantly speeds up processing.

Licensed under GPLv3, you can use and modify it freely but must release your changes under the same license.

In plain English

neural-style is a Python program that applies the visual style of one image to the content of another. You give it two images: a content photo (such as a picture of a building or a person) and a style reference (such as a painting by Van Gogh or Picasso), and it produces a new image that looks like the content photo repainted in the visual style of the reference. The technique comes from a published research paper on using neural networks to separate and recombine image content and style. The program is built with TensorFlow, a machine learning library. Running it requires downloading a pre-trained image recognition network file (about 500MB) that the program uses to analyze the visual features of your images. After that, you run a command specifying your input files and where to save the result. A typical 512x512 image takes about 90 seconds on a modern laptop chip and significantly less time with a dedicated graphics card. You can blend multiple style images together by assigning each one a weight, so the output can draw from several references at once. Several command-line settings let you control how detailed or abstract the style transfer is, whether to preserve the original colors of the content image, and how the model processes features internally. The README includes visual examples showing how adjusting these settings changes the output. The project is released under the GPLv3 license. It is a research implementation intended for experimentation rather than production use, and the author notes that some parameter tuning may be needed to get good results with different images.

Copy-paste prompts

Prompt 1
I want to make a photo look like it was painted by Van Gogh using neural-style. Walk me through downloading the required model file and running the style transfer command.
Prompt 2
How do I blend two style images in neural-style so the output draws from both? Show me the exact command with weights.
Prompt 3
What command-line flags in neural-style control how much the original colors are preserved versus replaced by the style image's colors?
Prompt 4
I want to run neural-style on my laptop without a GPU. What settings should I use to make it feasible and how long will it take for a 512x512 image?
Prompt 5
How does neural-style separate image content from style using the pre-trained VGG network? Explain it in simple terms.
Open on GitHub → Explain another repo

← anishathalye on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.