← all repositories
xunhuang1995/AdaIN-style

Style transfer that finally stopped training a model per painting

A 2017 ICCV paper that made neural style transfer real-time and style-agnostic by normalizing features on the fly.

1.6k stars Lua Image · Video · Audio
AdaIN-style
Velocity · 7d
+0.5
★ / day
Trend
steady
star history

What it does This is the original Torch/Lua implementation of AdaIN (Adaptive Instance Normalization). It takes a content image and any style image—no retraining required—and produces a stylized result in a single forward pass. The authors report 15 FPS at 512×512 on a Pascal Titan X, roughly 720× faster than Gatys et al.’s optimization-based approach.

The interesting bit The trick is an AdaIN layer that sits between a VGG encoder and a learned decoder. Instead of baking style knowledge into network weights, it computes affine parameters (mean and standard deviation) from the style image’s feature maps and applies them to the content image’s features. Think of it as a real-time remix of instance normalization where the “style” knob is turned dynamically rather than fixed at training time.

Key highlights

  • Arbitrary style transfer: works with any style image, not just the one(s) seen during training
  • Content-style trade-off via -alpha (0 to 1)
  • Color preservation mode (-preserveColor) to keep the content image’s palette
  • Style interpolation across multiple images with weighted blending
  • Spatial control via binary masks for different styles on foreground/background
  • Video stylization support through styVid.sh wrapper

Caveats

  • Built for Torch7, which is effectively a legacy framework now; you’ll need Lua and old CUDA toolchains
  • The README has a typo in one example (-styleSize described as “content image” twice) and a malformed image tag (lenna_cropped.jpg has a comma in its width attribute)
  • No mention of memory requirements or whether it runs CPU-only at usable speeds

Verdict Worth studying if you’re implementing or comparing style transfer methods—AdaIN remains a foundational technique. Skip if you want a plug-and-play modern PyTorch/TensorFlow tool; this is research archaeology with dependencies from 2017.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.