Reputation: 870
I am really confused with the meaning of Instance Norm and whether I can use it with a batch size of 1. I am using PyTorch and nothing in the documentation says that batch size should be greater than 1.
I know that for BatchNorm the performance is adversely affected when batch size is less than 8 and hence it puts a sort of soft bound on the batch size. However, I did not see any such analysis on Instance Norm and am a bit confused now. Should I remove the norm layer if my batch size is 1 then?
Upvotes: 0
Views: 2657
Reputation: 32992
A good overview of the different norms is shown in the Group Normalization paper.
Instance normalisation is summarised as:
[...] IN computes µ and σ along the (H, W) axes for each sample and each channel.
The mean and standard deviation are computed on the spatial dimensions (H, W) only and are independent of the batch size and channels (there are N x C different norms). Hence, you can use it with a batch size of 1.
Upvotes: 3