globalAveragePooling3dLayer
3-D global average pooling layer
Description
A 3-D global average pooling layer performs downsampling by computing the mean of the height, width, and depth dimensions of the input.
The dimensions that the layer pools over depends on the layer input:
For 3-D image input (data with five dimensions corresponding to pixels in three spatial dimensions, the channels, and the observations), the layer pools over the spatial dimensions.
For 3-D image sequence input (data with six dimensions corresponding to the pixels in three spatial dimensions, the channels, the observations, and the time steps), the layer pools over the spatial dimensions.
For 2-D image sequence input (data with five dimensions corresponding to the pixels in two spatial dimensions, the channels, the observations, and the time steps), the layer pools over the spatial and time dimensions.
Creation
Properties
Examples
Tips
In an image classification network, you can use a
globalAveragePooling3dLayer
before the final fully connected layer to reduce the size of the activations without sacrificing performance. The reduced size of the activations means that the downstream fully connected layers will have fewer weights, reducing the size of your network.You can use a
globalAveragePooling3dLayer
towards the end of a classification network instead of afullyConnectedLayer
. Since global pooling layers have no learnable parameters, they can be less prone to overfitting and can reduce the size of the network. These networks can also be more robust to spatial translations of input data. You can also replace a fully connected layer with aglobalMaxPooling3dLayer
instead. Whether aglobalMaxPooling3dLayer
or aglobalAveragePooling3dLayer
is more appropriate depends on your data set.To use a global average pooling layer instead of a fully connected layer, the number of channels in the input of the global average pooling layer must match the number of classes in the classification task.