Log-Sum-Exp Pooling

Log-Sum-Exp Pooling

Papers

  1. From Image-level to Pixel-level Labeling with Convolutional Networks
  2. ChestX-ray8: Hospital-scale Chest X-ray Database and Benchmarks on Weakly-Supervised Classification and Localization of Common Thorax Diseases

LSE Pooling

在閱讀這兩篇文章之前,我印象中常用的 Pooling 有 Max Pooling 和 Average Pooling,而這兩篇文章中用到了 Log-Sum-Exp Pooling,其定義爲:

xp=1rlog[1S(i,j)Sexp(rxij)] x_p=\frac{1}{r}\cdot log[\frac{1}{S}\cdot \sum_{(i,j)\in\mathbf{S}}exp(r\cdot x_{ij})]

其中,xijx_{ij} 表示在(i,j)(i,j)的激活值,(i,j)(i,j) 是池化區域 S\mathbf{S} 的一點並且 S=s×sS=s\times s 是池化區域 S\mathbf{S} 總點數,rr 是超參數。

在第一篇文章中,作者提到 LSE Pooling 的作用爲:

The hyper-parameter r controls how smooth one wants the approximation to be: high r values implies having an effect similar to the max, very low values will have an effect similar to the score averaging. The advantage of this aggregation is that pixels having similar scores will have a similar weight in the training procedure, r controlling this notion of “similarity”.

在第二篇文章中,作者提到 LSE Pooling 的作用爲:

By controlling the hyper-parameter, r, the pooled value ranges from the maximum in S (when rr\to\infin) to average (r0r\to0).

一個直觀的理解可以看下圖:

在這裏插入圖片描述

數學證明

作爲一個嚴謹的大學僧,肯定不會止步於直觀理解啦,數學證明走起!

在證明前,不妨把式子簡化一點:

xp=1rlog[1ni=1nexp(rxi)] x_p=\frac{1}{r}\cdot log[\frac{1}{n}\cdot \sum_{i=1}^{n}exp(r\cdot x_i)]

證明 r0r\to0 相當於 Average Pooling

首先,我們需要藉助均值不等式:

a1+a2+...+anna1a2...ann \frac{a_1+a_2+...+a_n}{n}\ge\sqrt[n]{a_1\cdot a_2...a_n}

當且僅當 a1=a2=...=ana_1=a_2=...=a_n 時取等號。
xp=1rlog[1ni=1nexp(rxi)]=log(1ni=1nerxi)1r \begin{aligned} x_p &= \frac{1}{r}\cdot log[\frac{1}{n}\cdot \sum_{i=1}^{n}exp(r\cdot x_i)] \\ &= log(\frac{1}{n}\cdot\sum_{i=1}^{n}e^{r\cdot x_i})^{\frac{1}{r}} \end{aligned}

應用均值不等式:

(1ni=1nerxi)1r(i=1nerxi)1n1r=(i=1nexi)1n \begin{aligned} (\frac{1}{n}\cdot \sum_{i=1}^{n}e^{r\cdot x_i})^{\frac{1}{r}} &\ge (\prod_{i=1}^{n} e^{r\cdot x_i})^{\frac{1}{n}\cdot\frac{1}{r}} \\ &= (\prod_{i=1}^{n} e^{x_i})^{\frac{1}{n}} \end{aligned}
r=0r = 0 時,可取等號。代入整個式子:

xp=log(1ni=1nerxi)1rlog(i=1nexi)1n=1ni=1nxi \begin{aligned} x_p &= log(\frac{1}{n}\cdot\sum_{i=1}^{n}e^{r\cdot x_i})^{\frac{1}{r}} \\ &\ge log(\prod_{i=1}^{n} e^{x_i})^{\frac{1}{n}} \\ &= \frac{1}{n}\sum_{i=1}^{n}x_i \end{aligned}
於是 r0r\to0 相當於 Average Pooling 得證。

證明 rr\to \infin 相當於 Max Pooling

xp=1rlog[1ni=1nexp(rxi)]=log(i=1nerxi)1r1rlog(n) \begin{aligned} x_p &= \frac{1}{r}\cdot log[\frac{1}{n}\cdot \sum_{i=1}^{n}exp(r\cdot x_i)] \\ &= log(\sum_{i=1}^{n}e^{r\cdot x_i})^{\frac{1}{r}} - \frac{1}{r}\cdot log(n) \end{aligned}

因爲 r>0r > 0,我們有:

max(erxi)1r(i=1nerxi)1r[nmax(erxi)]1r \begin{aligned} max(e^{r\cdot x_i})^{\frac{1}{r}} \le (\sum_{i=1}^{n}e^{r\cdot x_i})^{\frac{1}{r}} \le [n\cdot max(e^{r\cdot x_i})]^{\frac{1}{r}} \end{aligned}
代入整個式子,得:

max(xi)log(i=1nerxi)1r1rlog(n)+max(xi) max(x_i)\le log(\sum_{i=1}^{n}e^{r\cdot x_i})^{\frac{1}{r}} \le \frac{1}{r}\cdot log(n)+max(x_i)
rr\to\infin 時有:1rlog(n)0\frac{1}{r}\cdot log(n)\to0,故 rr \to\infin 相當於 Max Pooling 得證

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章