globalMaxPooling2dLayer
Description
A 2-D global max pooling layer performs downsampling by computing the maximum of the height and width dimensions of the input.
Creation
Properties
Object Functions
Examples
Tips
In an image classification network, you can use a
globalMaxPooling2dLayer
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
globalMaxPooling2dLayer
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 aglobalAveragePooling2dLayer
instead. Whether aglobalAveragePooling2dLayer
or aglobalMaxPooling2dLayer
is more appropriate depends on your data set.To use a global average pooling layer instead of a fully connected layer, the size of the input to
globalMaxPooling2dLayer
must match the number of classes in the classification problem
Algorithms
Extended Capabilities
Version History
Introduced in R2020a