Instance and group normalization

Normalization · node type · InstanceNormalization, GroupNormalization

Normalizes each image’s channels by their own statistics, removing per-image contrast and brightness.

Also called InstanceNorm, GroupNorm

Figure 1. Instance and group normalization inside Turn a photo into a mosaic, a real model in WeightSpace. The 15 outlined nodes are Instance and group normalization; select any node for its shapes and parameters.

What it does

Instance normalization computes the mean and variance of every channel of every image separately, over its height and width, and normalizes with them. This strips out global contrast and color casts of a particular image, which is why fast style transfer networks use it: the output style no longer depends on the lighting of the content photo. Group normalization pools channels into groups before computing statistics; it sits between instance norm (one channel per group) and layer norm (one group for all channels) and does not depend on batch size.

Formula

μnc = (1/HW) Σy,x xncyx, σnc2 = (1/HW) Σy,x (xncyx − μnc)2yncyx = γc · (xncyx − μnc) / √(σnc2 + ε) + βc

Shapes and parameters

Shapes
Input [N, C, H, W]; γ and β are [C]; output [N, C, H, W].
Parameters
2 × C. A 128-channel layer has 256.
Used for
Fast neural style transfer, image generators, diffusion and segmentation networks trained with small batches.

Figure 2. The typed ports of Instance and group normalization, in the same format as every model drawing. Letters such as N or C stand for any size.

In WeightSpace

Read-only in WeightSpace today. The mosaic style model is edited at the bias of its final convolution, after its instance-normalized layers.