Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Adaptive average pooling and How does it work?

I recently came across a method in Pytorch when I try to implement AlexNet. I don't understand how it works. Please explain the idea behind it with some examples. And how it is different from Maxpooling or Average poling in terms of Neural Network functionality

nn.AdaptiveAvgPool2d((6, 6))

like image 686
XXD Avatar asked Nov 04 '19 11:11

XXD


People also ask

What is adaptive_avg_pool2d?

AdaptiveAvgPool2d (output_size)[source] Applies a 2D adaptive average pooling over an input signal composed of several input planes. The output is of size H x W, for any input size.

Why do we use average pooling?

Average pooling method smooths out the image and hence the sharp features may not be identified when this pooling method is used. Max pooling selects the brighter pixels from the image. It is useful when the background of the image is dark and we are interested in only the lighter pixels of the image.

What is difference between average pooling layer and Max pooling?

There are two types of Pooling: Max Pooling and Average Pooling . Max Pooling returns the maximum value from the portion of the image covered by the Kernel. On the other hand, Average Pooling returns the average of all the values from the portion of the image covered by the Kernel.


1 Answers

In average-pooling or max-pooling, you essentially set the stride and kernel-size by your own, setting them as hyper-parameters. You will have to re-configure them if you happen to change your input size.

In Adaptive Pooling on the other hand, we specify the output size instead. And the stride and kernel-size are automatically selected to adapt to the needs. The following equations are used to calculate the value in the source code.

Stride = (input_size//output_size)   Kernel size = input_size - (output_size-1)*stride   Padding = 0 
like image 162
Anant Mittal Avatar answered Sep 22 '22 03:09

Anant Mittal