---
kind: concept
slug: adaptive-instance-normalization
title: Adaptive instance normalization
summary: >-
  AdaIN re-scales each channel to the mean and standard deviation of a reference, with no learned parameters. Three cards use it or its scale-and-shift form: ArtFlow applies it to reversible latent features, at about 6.4 times the author-reported time of plain AdaIN; StarGAN v2 injects a per-domain style code; Drive-OccWorld conditions a layer-normalised memory. No card covers the original paper.
tags: [style-transfer, normalization, feature-transfer, generative-adversarial-network, conditioning, latency]
papers: ["1912.01865", "2103.16877", "2408.14197"]
related: [image-to-image-translation, neural-style-transfer, normalizing-flows, generative-adversarial-network, conditional-batch-normalization, world-model, bev-representation]
status: draft
updated_at: 2026-10-24
---

## Overview

Adaptive instance normalization (AdaIN) is a feature step. For each channel
it removes the channel's own mean and standard deviation, then applies the
mean and standard deviation of a reference. The step has no learned
parameters of its own [arxiv:2103.16877 app. B].

Three cards on this wiki use AdaIN or the same scale-and-shift form, in three
different ways:

- **Feature transfer.** ArtFlow takes the statistics from a style image's
  features and moves the content features to them [arxiv:2103.16877 §4.1]
  [arxiv:2103.16877 app. B].
- **Style injection.** StarGAN v2 takes the scale and shift of each
  normalisation from a style code. The code comes from a mapping network
  or a style encoder, not from a style image's statistics [arxiv:1912.01865 §2.1]
  [code: core/model.py#L77].
- **Conditional scale and shift.** Drive-OccWorld layer-normalises each
  memory embedding, then scales and shifts it with values derived from a
  condition [arxiv:2408.14197 §3.2] [arxiv:2408.14197 eq. 5]. It uses layer
  normalisation over the embedding, not per-channel reference statistics, so
  it is not AdaIN in the strict sense. It is included because the
  scale-and-shift form is the same.

The paper that introduced AdaIN has no card here. This page describes AdaIN
as the cards use it and assumes nothing else about the original method.

In the feature-transfer use, the output keeps the content's spatial layout
and takes the style's channel statistics. ArtFlow's proof of "unbiasedness"
uses a bilinear model of content and style factors, and the authors show
AdaIN satisfies it [arxiv:2103.16877 §4.3] [arxiv:2103.16877 app. B]. For a
decoder-based pipeline, the authors attribute AdaIN's content leak to
reconstruction error and to decoder training, not to the AdaIN arithmetic
[arxiv:2103.16877 §3.2].

## Variants

### AdaIN between a learned encoder and decoder (the baseline)

In the universal methods that ArtFlow compares against, AdaIN sits between a
fixed VGG19 encoder and a trained decoder that maps the transferred features
back to pixels [arxiv:2103.16877 §3.1]. The decoder is trained with a content
term and a style term, the latter matching channel means and standard
deviations of VGG features [arxiv:2103.16877 eq. 2] [arxiv:2103.16877 §3.2].

The authors attribute content leak in this setup to reconstruction error and
to the style term biasing the decoder. They show it by feeding each output
back in as the next content image for 20 rounds [arxiv:2103.16877 §3.1]
[arxiv:2103.16877 §3.2]. Author-reported at 512×512: SSIM 0.29, content loss
3.10 and 0.064 s per image [arxiv:2103.16877 tab. 1].

### AdaIN inside a reversible flow (ArtFlow)

ArtFlow keeps the same AdaIN step but changes the path around it. Content and
style images go through the forward pass of an invertible network, AdaIN runs
on the resulting latent features, and the reverse pass returns an image
[arxiv:2103.16877 §4.1]. The forward pass is lossless by design, so the
network has no reconstruction error to accumulate [arxiv:2103.16877 §4.1]
[arxiv:2103.16877 §4.2].

The invertible network is a Glow-style stack with two blocks of eight flows.
Each flow is an activation normalization, a learned channel-mixing 1×1
convolution and an additive coupling step [arxiv:2103.16877 §4.2]
[arxiv:2103.16877 §5.1]. The authors attribute its higher cost to the network
having no pooling layers [arxiv:2103.16877 §5.2].

Author-reported at 512×512: SSIM 0.45, content loss 2.58 and 0.408 s per image
[arxiv:2103.16877 tab. 1]. With 20 rounds of repeated transfer, the authors
report no visible content leak [arxiv:2103.16877 §5.3]. This is a qualitative
result; the paper gives no metric for it.

Card: [ArtFlow: Unbiased Image Style Transfer via Reversible Neural Flows](/papers/2103.16877).

### AdaIN as style injection in a multi-domain generator (StarGAN v2)

StarGAN v2 uses one generator for all domains. Its decoder blocks are
normalised with AdaIN, and the style code sets the scale and shift of each
block [arxiv:1912.01865 §2.1] [arxiv:1912.01865 app. E]. Down-sampling blocks
use instance normalization instead [arxiv:1912.01865 §2.1]. The official code
computes the scale as one plus a learned gamma, and adds a learned beta
[code: core/model.py#L77]. The paper says the scale biases are set to one
[arxiv:1912.01865 app. B]; the two forms agree in effect at initialisation
[code: core/utils.py#L41-L49].

The style code comes from a mapping network that takes a random latent and a
domain, or from a style encoder that takes a reference image and its domain
[arxiv:1912.01865 §2.1]. Each domain has its own output head, so each domain
has its own style space [arxiv:1912.01865 app. E]. The style code then drives
the generator through a diversity term, a style-reconstruction term and a
cycle-consistency term [arxiv:1912.01865 §2.2] [arxiv:1912.01865 eq. 5].

Author-reported latent-guided FID is 13.7 on CelebA-HQ and 16.2 on AFHQ
[arxiv:1912.01865 tab. 2]. Reference-guided FID is 23.8 and 19.8
[arxiv:1912.01865 tab. 3]. These are image-quality and diversity metrics for
multi-domain translation, not the SSIM and content-loss measures used for the
ArtFlow comparison, so the two sets of numbers are not comparable.

Card: [StarGAN v2: Diverse Image Synthesis for Multiple Domains](/papers/1912.01865).

### Conditional layer normalisation in a driving world model (Drive-OccWorld)

Drive-OccWorld keeps a memory queue of past BEV embeddings. Each entry is
layer-normalised with no learned affine parameters, then scaled and shifted
by values derived from a condition [arxiv:2408.14197 §3.2]
[arxiv:2408.14197 eq. 5]. The paper describes three conditions: semantic
labels, ego motion and agent motion. Each one is encoded into its own pair of
scale and shift values [arxiv:2408.14197 §3.2]. For ego motion, the 3×4 ego
transform between two timestamps is flattened and passed through an MLP
[arxiv:2408.14197 §3.2].

The paper's ablation is run without action conditions and reports 1 s
future mIoU. Author-reported: 26.4 with no condition, 26.6 with semantic
labels only, 27.1 with agent motion only, and 28.3 with ego motion, alone or
together with the other two [arxiv:2408.14197 tab. 6]. The ablation covers
all three conditions, so it does not describe the released configuration
(see Contradictions).

Card: [Driving in the Occupancy World: Vision-Centric 4D Occupancy Forecasting and Planning via World Models for Autonomous Driving](/papers/2408.14197).

## When to use which

| Situation | Use | Why |
|---|---|---|
| One pass per image, latency or simplicity matter most | Plain AdaIN with a trained decoder | Author-reported 0.064 s vs 0.408 s at 512×512 [arxiv:2103.16877 tab. 1]. Content loss is higher (3.10 vs 2.58) [arxiv:2103.16877 tab. 1] |
| The output is fed back through the transfer, or content must survive it | ArtFlow + AdaIN | Author-reported: no visible leak after 20 rounds [arxiv:2103.16877 §5.3]; SSIM 0.45 vs 0.29 [arxiv:2103.16877 tab. 1] |
| The stylized latent must be mapped back to the exact original content | ArtFlow + AdaIN | The authors claim only ArtFlow can do reverse style transfer and show it recovers the original content [arxiv:2103.16877 app. E.1] |
| Best Gram-style match is the goal | Neither AdaIN variant | ArtFlow is not best on Gram loss; OptimalWCT is best in the paper's table [arxiv:2103.16877 tab. 1] |
| Little time or GPU budget for training | Plain AdaIN, if an existing decoder fits | ArtFlow training is about 12 h on one RTX 2080Ti [arxiv:2103.16877 §5.1]. The card gives no training time for plain AdaIN, so no comparison is possible |
| Many domains, one model, several outputs per input | AdaIN style injection (StarGAN v2) | One generator covers all domains, and a random latent gives diverse outputs [arxiv:1912.01865 §2.1] [arxiv:1912.01865 §1]. Author-reported latent-guided FID 13.7 on CelebA-HQ, against MSGAN's 33.1 [arxiv:1912.01865 tab. 2] |
| A stream of features must follow a known transform, such as ego motion | Conditional layer normalisation (Drive-OccWorld) | Author-reported: ego-motion conditioning raises 1 s mIoU from 26.4 to 28.3 without action conditions [arxiv:2408.14197 tab. 6]. The released configs enable only this part [code: projects/configs/inflated/action_condition_GMO.py#L164-L175] |
| Commercial product built from the official StarGAN v2 code | Re-implement from the paper, do not reuse the code | The official StarGAN v2 code is CC BY-NC 4.0, which rules out commercial use [code: LICENSE]. Re-implementing from the paper avoids that restriction |

The feature-transfer rows, the StarGAN row and the Drive-OccWorld row answer
different questions. Choose by the constraints above, not by a single ranking.
The ArtFlow user study gives it 314 votes as one method, without splitting the
AdaIN and WCT variants, and it has no stated exclusion rule for the 799
effective votes [arxiv:2103.16877 §6] [arxiv:2103.16877 tab. 2]. StarGAN v2
needs labelled domains and takes about 3 days on one V100 for 100K iterations
at batch size 8 [arxiv:1912.01865 app. B].

## Implementation sketch

The transfer step itself is short. Everything else depends on the variant
above. The small epsilon in the variance is not in the paper; it is a
numerical guard that the released code adds.

```pseudocode
# AdaIN on one content and one style feature map, shape (C, H, W)  [app. B]
# Statistics are per channel, over the spatial positions
def adain(content, style):
    # Per-channel mean and standard deviation of each input  [app. B]
    mu_c = mean(content, over=(H, W))
    sigma_c = std(content, over=(H, W))
    mu_s = mean(style, over=(H, W))
    sigma_s = std(style, over=(H, W))
    # Remove the content statistics, then apply the style statistics  [app. B]
    # The epsilon guards against zero variance (code only, not in the paper)
    return sigma_s * (content - mu_c) / (sigma_c + 1e-5) + mu_s
```

In ArtFlow the same function runs on the latent features, between the forward
and reverse passes of the flow [arxiv:2103.16877 §4.1]. The training objective
that matches style statistics uses the same mean and standard deviation
terms [arxiv:2103.16877 eq. 2].

In StarGAN v2 the statistics are not taken from a style image. The normalised
input is scaled and shifted by parameters that a learned layer produces from
the style code [arxiv:1912.01865 §2.1] [code: core/model.py#L77]. The code
form is one plus a learned gamma, times the normalised input, plus a learned
beta.

In Drive-OccWorld the normalisation is layer normalisation without affine
parameters. The scale and shift come from the condition, and the result
replaces the memory embedding [arxiv:2408.14197 §3.2] [arxiv:2408.14197 eq. 5].

## Contradictions

No disagreement between the cards. Their numbers measure different things
(SSIM and content loss for ArtFlow, FID for StarGAN v2, mIoU for
Drive-OccWorld), so they cannot be ranked against each other.

Within each card, the paper and the released code differ in the places below.
These are paper-vs-code differences, not disagreements between papers. Check
the cited notes before implementing.

- **ArtFlow content target.** Eq. 1 uses the AdaIN output as the target. The
  code compares the stylized image's relu4_1 features with those of the
  original content image [arxiv:2103.16877 eq. 1] [code: net.py#L141]
  [code: train.py#L191]. The distance is L2 in the paper and mean squared
  error in the code [arxiv:2103.16877 eq. 1] [code: net.py#L126].
- **StarGAN v2 AdaIN bias.** The paper sets the scale bias to one. The code
  uses one plus a learned gamma [arxiv:1912.01865 app. B] [code: core/model.py#L77].
- **Drive-OccWorld conditions.** The paper describes three conditions. The
  released configs turn on only the ego-motion one; the semantic and
  agent-motion normalisation are switched off in the configs and their losses
  are commented out in the forward pass [arxiv:2408.14197 §3.2]
  [code: projects/configs/inflated/action_condition_GMO.py#L164-L175]
  [code: projects/mmdet3d_plugin/bevformer/detectors/drive_occworld.py#L721-L729].

## Papers

- [ArtFlow: Unbiased Image Style Transfer via Reversible Neural Flows](/papers/2103.16877): applies AdaIN and WCT to the latent features of a reversible flow, and reports less content leak than plain AdaIN with a decoder.
- [StarGAN v2: Diverse Image Synthesis for Multiple Domains](/papers/1912.01865): uses AdaIN to inject a per-domain style code into one generator for many domains, with diverse outputs from random latents.
- [Driving in the Occupancy World: Vision-Centric 4D Occupancy Forecasting and Planning via World Models for Autonomous Driving](/papers/2408.14197): layer-normalises each memory embedding and scales and shifts it with values from ego-motion, semantic or agent-motion conditions.
