Group Normalization
Group normalization (GroupNorm) splits the channels of a convolutional layer into groups of channels. For each example and each group, it computes the mean and standard deviation over the group’s channels and all positions:
Each activation in the group is standardized with these statistics. It is then rescaled with the learned scale and offset of its own channel :
The two extreme settings of give other layers:
- puts all channels in one group, which is layer normalization.
- makes each channel its own group, which is instance normalization (InstanceNorm). It standardizes each channel of each example using statistics over spatial positions alone.
Like LayerNorm, GroupNorm does not depend on the batch, so it computes the same function during training and at test time. It is used in vision models that must train with small batches, where batch normalization has unreliable statistics.
Intuition
LayerNorm pools every channel of an example, so channels with very different typical scales share one mean and one spread. InstanceNorm pools a single channel, so every feature map is standardized on its own and its overall level is lost. GroupNorm sits between them. Channels in a group are standardized together, so their scales relative to one another survive, while different groups can live at different scales. Because it never looks across examples, its accuracy does not change with the batch size.
Properties
(Instance Normalization Removes Per-Image Contrast) InstanceNorm erases each feature map’s mean and spread within each image.
Not Taught in Lecture
Lecture described InstanceNorm only as normalizing each channel separately. The link to style transfer is standard background.
After InstanceNorm, every channel of every image has mean and spread over its positions. The brightness and contrast of each feature map, which differ from image to image, are gone. In style transfer, these per-channel statistics carry much of an image’s style, so InstanceNorm lets a network separate an image’s content from its style. A channel that is constant over the image has . Its standardized values are then , and the output is everywhere.
(Choosing the Number of Groups) The number of groups trades the shared scale of LayerNorm against the per-channel independence of InstanceNorm.
Not Taught in Lecture
Lecture did not discuss how to choose . The default comes from the paper that introduced GroupNorm (Wu & He, 2018).
Few groups pool many values, which gives stable statistics but forces unrelated channels onto one scale. Many groups let each channel keep its own scale, but each mean then rests on fewer values, and per-channel level information is lost. The usual default is . Each mean always pools values, a number that does not depend on the batch.
Examples
(Medium) Three Normalizations of One Example
One example of a layer has channels with two positions each: , , and . All scales are , all offsets are , and is tiny.
Normalize the example with GroupNorm using , with LayerNorm, and with InstanceNorm. With the groups are and . The first group holds , with mean and standard deviation , which gives and . The second group holds , with mean and standard deviation , which gives and .
LayerNorm pools all eight values, with mean and standard deviation . It gives , , and .
InstanceNorm standardizes each channel alone. The first three each become . The constant channel has zero spread, so it becomes . InstanceNorm erased the fact that was larger than and that was a bright constant. GroupNorm kept both facts within each group but lost how the levels of the two groups compare. LayerNorm kept all of them.
See Also
- 4.5. Neural Network Normalization, which compares the normalization layers.
- 4.5.2. Layer Normalization, the case .
- 8.2. Neural Style Transfer, where per-channel statistics describe style.