← all repositories
naoto0804/pytorch-AdaIN

Style transfer that actually runs in real time

A clean PyTorch reimplementation of AdaIN, letting you paint any photo in the style of any other image without waiting for a GPU to catch its breath.

1.2k stars Python Image · Video · Audio
pytorch-AdaIN
Velocity · 7d
+0.4
★ / day
Trend
steady
star history

What it does Takes a content image and a style image, then redraws the content using the style’s textures and colors. The trick is Adaptive Instance Normalization — matching the mean and variance of content features to style features inside a VGG encoder-decoder pipeline. You can also blend multiple styles with weighted interpolation, dial stylization strength up or down with --alpha, or preserve the original colors.

The interesting bit The original authors wrote their reference in Torch; this repo translates the whole pipeline to PyTorch and ships a pretrained model after one million training iterations. The style interpolation in particular is neat — feed four paintings and weights, get a custom hybrid style back.

Key highlights

  • Single forward pass, no per-style training required
  • Pretrained decoder and normalized VGG available via GitHub releases
  • Supports batch processing entire directories (every content × style combination)
  • Adjustable stylization strength (--alpha 0.0–1.0) and color preservation
  • Trained model (iter_1000000.pth) provided; training script included

Caveats

  • Requires PyTorch 0.4+ — the dependency stack is dated by current standards
  • README has a copy-paste error: --style_size description repeats “content image” instead of “style image”
  • No mention of inference speed benchmarks or memory requirements

Verdict Grab this if you need a working, hackable baseline for arbitrary neural style transfer and don’t mind updating a few dependencies. Skip it if you want state-of-the-art quality or a maintained, production-ready package.

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