广义平均(Generalized Mean, GeM)

广义平均(Generalized Mean, GeM)

该操作来自图像检索方向的一篇文章,感兴趣的请移步:MultiGrain: a unified image embedding for classes and instances

文中采用了一个generalized mean pooling(GeM) layer,具体形式如下:
e = [ ( 1 ∣ Ω ∣ ∑ u ∈ Ω x c u p ) 1 p ] c = 1 … C e=\left[ \left( \frac{1}{|\Omega|} \sum_{u \in \Omega} { x_{cu}^p } \right)^{\frac{1}{p}} \right]_{c=1\dots C} e=(Ω1uΩxcup)p1c=1C
其中, x ∈ R C × H × W x\in \mathbb{R}^{C \times H \times W} xRC×H×W代表网络提取到的tensor, C C C代表特征通道数, u ∈ Ω = { 1 , … , H } × { 1 , … , W } u\in \Omega = \{1, \dots, H\} \times \{1, \dots, W\} uΩ={ 1,,H}×{ 1,,W}代表特征图中的一个"pixel"。

GeM计算了每个特征通道的广义平均,文中提到Setting this exponent as p > 1 increases the contrast of the pooled feature map and focuses on the salient features of the image

具体来说,我们可以从它的形式上进行理解,首先令 p = 1 p=1 p=1,得到
e = ( 1 ∣ Ω ∣ ∑ u ∈ Ω x c u ) c = 1 … C e=\left( \frac{1}{|\Omega|} \sum_{u \in \Omega} { x_{cu}} \right)_{c=1\dots C} e=(Ω1uΩxcu)c=1C
可以看到,此时变为平均池化操作。

再令 p = ∞ p=\infty p=得到
e = lim ⁡ p → ∞ [ ( 1 ∣ Ω ∣ ∑ u ∈ Ω x c u p ) 1 p ] c = 1 … C 这 里 令 t = max ⁡ [ x c ] c = 1 … C , 则 有 e = t lim ⁡ p → ∞ [ ( 1 ∣ Ω ∣ ∑ u ∈ Ω x c u p t p ) 1 p ] c = 1 … C = t \begin{aligned} e &= \lim_{p \to \infty} { \left[ \left(\frac{1}{|\Omega|} \sum_{u \in \Omega} { x_{cu}^p } \right)^{\frac{1}{p}}\right]_{c=1\dots C} } \\ 这里令 t = \max{ [x_c] }_{c=1 \dots C},则有 \\ e &=t \lim_{p \to \infty} { \left[ \left(\frac{1}{|\Omega|} \sum_{u \in \Omega} { \frac{x_{cu}^p }{t^p} }\right)^{\frac{1}{p}}\right]_{c=1\dots C} } \\ &=t \end{aligned} et=max[xc]c=1Ce=plim(Ω1uΩxcup)p1c=1C=tplim(Ω1uΩtpxcup)p1c=1C=t
此时变为最大池化操作。

由此可以看到,随着 p p p取值不断增加,特征图中的重要信息会被突出。

猜你喜欢

转载自blog.csdn.net/qq_45802280/article/details/128131943
今日推荐