深度学习中常见的Normalization总结
对于一个给定的Batch: x ∈ R N ⋅ C ⋅ H ⋅ W x \in R^{N \cdot C \cdot H \cdot W} x∈RN⋅C⋅H⋅W, 其中N, C, H, W,分别表示:batchsize, num_channel, Height, Width, 下面的定义都给予这个设定。
Batch Normalization
BN[1]标准化每个feature channel的均值和标准差, 换句话说, BN是在每个chanel上独立进行的, 在每个channel上进行BN时, mean和std的计算依赖于各自的feature map,即mean和std是channel-dependent, 是batch & height, width-dependent
, 计算公式如下:
其中,
γ
,
β
∈
R
C
\gamma, \beta \in R^{C}
γ,β∈RC, 从数据中学习,
μ
,
σ
∈
R
C
\mu, \sigma \in R^{C}
μ,σ∈RC, 对于第c个channel,
μ
,
σ
\mu, \sigma
μ,σ的计算如下:
Instance Normalization
正如字面意思, IN [2]标准化每个Sample的每个feature channel的均值和标准差, 与BN的区别在于: mean和std的计算依赖于每个sample各自的feature map,即mean和std是(batch)sample & channel-dependent, 是height, width-dependent
, 计算如下:
其中,
γ
,
β
∈
R
N
⋅
C
\gamma, \beta \in R^{N \cdot C}
γ,β∈RN⋅C,
μ
,
σ
∈
R
N
⋅
C
\mu, \sigma \in R^{N \cdot C}
μ,σ∈RN⋅C, 对于batch中第n个样本的第c个channel,
μ
,
σ
\mu, \sigma
μ,σ的计算如下:
References
1.Batch normalization: Accelerating deep network training by reducing internal covariate shift. In JMLR, 2015
2.Tex- ture networks: Feed-forward synthesis of textures and styl- ized images. In ICML, 2016