> For the complete documentation index, see [llms.txt](https://json007.gitbook.io/deeplearning/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://json007.gitbook.io/deeplearning/cnn/pooling.md).

# pooling

## max pooling##\#

作用： 1. 减少计算量 2. 保证了平移不变性：因为取一片区域的最大值，所以这个最大值在该区域内无论在哪，max-pooling之后都是它，相当于对微小位移的不变性

![](https://352802547-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M7DcNFZmOW8qzXTiAei%2Fsync%2Fb51d7651092223c6905e1cacd5266ff61206ec21.JPG?generation=1589383552352042\&alt=media)\
[图像分类中的max pooling和average pooling是对特征的什么来操作的](https://www.zhihu.com/question/23437871)

## stochastic pooling##\#

![](https://352802547-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M7DcNFZmOW8qzXTiAei%2Fsync%2Fad707b766d305446f9ba96ebbef26b90441ce38c.jpg?generation=1589383540501559\&alt=media)

对feature map中的元素按照其概率值大小随机选择，即元素值大的被选中的概率也大。每个元素的概率值，用元素值归一化得到。

使用stochastic pooling时(即test过程)，其推理过程也很简单，对矩阵区域求加权平均即可。？

得到每个元素的概率值后如何随机选择？ 方法是：将其看作是9个变量的多项式分布，然后对该多项式分布采样即可，theano中有直接的multinomial()来函数完成。\
当然也可以自己用01均匀分布来采样，将单位长度1按照那9个概率值分成9个区间（概率越大，覆盖的区域越长，每个区间对应一个位置），然随机生成一个数后看它落在哪个区间。

在反向传播求导时，只需保留前向传播已经记录被选中节点的位置的值，其它值都为0,这和max-pooling的反向传播非常类似。

### 参考佳文###\#

[UFLDL Tutorial-Pooling](http://ufldl.stanford.edu/tutorial/supervised/Pooling/)\
[stochastic pooling](http://www.cnblogs.com/tornadomeet/p/3432093.html)
