 # 2D Average pooling

This block reduces the size of the data, the number of parameters, the amount of computation needed, and it also controls overfitting.
You can say that 2D Average pooling is similar to scaling down the size of an image.

The 2D Average pooling block represents an average pooling operation. This block outputs a smaller tensor than its input, which means downstream blocks will need fewer parameters and amount of computation; it also serves to control overfitting.

## How does average pooling work? Figure 1. 2D Average pooling block

The 2D Average pooling block moves a rectangle (window) over the incoming data, computing the average in each specific window. The size of the window is determined by the horizontal and vertical pooling factor and how big steps the window takes is determined by the horizontal and vertical stride.

Average pooling blocks are inserted after one or more convolutional blocks; they help inner convolutional block receive information from a bigger portion of the original image (a 3x3 filter after pooling is influenced by a 6x6 portion of the tensor before pooling). If we see convolutional blocks as detectors of a specific feature, average pooling finds the “mean” value of that feature inside the pooling rectangle. Each channel (hence each feature) is treated separately.

The output size is
(input width/horizontal pooling factor) x (input height/vertical pooling factor) x (input channels)

## Parameters

Horizontal pooling factor: The width of the rectangle within which the average is computed.

Vertical pooling factor: The height of the rectangle within which the average is computed.

Horizontal stride: Horizontal distance between the left edge of consecutive pooling windows.

Vertical stride: Vertical distance between the top edge of consecutive pooling windows.