maxUnpooling2dLayer
Max unpooling layer
Description
A 2-D max unpooling layer unpools the output of a 2-D max pooling layer.
Creation
Properties
Name
— Layer name
""
(default) | character vector | string scalar
NumInputs
— Number of inputs
3 (default)
Number of inputs of the layer.
There are three inputs to this layer:
'in'
— Input feature map to unpool.'indices'
— Indices of the maximum value in each pooled region. This is output by the max pooling layer.'size'
— Output size of unpooled feature map. This is output by the max pooling layer.
Use the input names when connecting or disconnecting the max unpooling layer to other layers
using connectLayers
or disconnectLayers
, respectively.
Data Types: double
InputNames
— Input names
{'in','indices','size'}
(default)
Input names of the layer.
There are three inputs to this layer:
'in'
— Input feature map to unpool.'indices'
— Indices of the maximum value in each pooled region. This is output by the max pooling layer.'size'
— Output size of unpooled feature map. This is output by the max pooling layer.
Use the input names when connecting or disconnecting the max unpooling layer to other layers
using connectLayers
or disconnectLayers
, respectively.
Data Types: cell
NumOutputs
— Number of outputs
1
(default)
This property is read-only.
Number of outputs from the layer, returned as 1
. This layer has a
single output only.
Data Types: double
OutputNames
— Output names
{'out'}
(default)
This property is read-only.
Output names, returned as {'out'}
. This layer has a single output
only.
Data Types: cell
Examples
Create Max Unpooling Layer
Create a max unpooling layer that unpools the output of a max pooling layer.
layer = maxUnpooling2dLayer
layer = MaxUnpooling2DLayer with properties: Name: '' NumInputs: 3 InputNames: {'in' 'indices' 'size'}
Unpool Max Pooling Layer
Create a max pooling layer, and set the 'HasUnpoolingOutputs'
property as true
. This property gives the max pooling layer two additional outputs,'indices'
and 'size'
, which enables unpooling the layer. Also create a max unpooling layer.
layers = [ maxPooling2dLayer(2,'Stride',2,'Name','mpool','HasUnpoolingOutputs',true) maxUnpooling2dLayer('Name','unpool')]
layers = 2x1 Layer array with layers: 1 'mpool' 2-D Max Pooling 2x2 max pooling with stride [2 2] and padding [0 0 0 0] 2 'unpool' 2-D Max Unpooling 2-D Max Unpooling
Add the layers to a dlnetwork
object.
net = dlnetwork; net = addLayers(net,layers)
net = dlnetwork with properties: Layers: [2x1 nnet.cnn.layer.Layer] Connections: [1x2 table] Learnables: [0x3 table] State: [0x3 table] InputNames: {'mpool' 'unpool/indices' 'unpool/size'} OutputNames: {'mpool/indices' 'mpool/size' 'unpool'} Initialized: 0 View summary with summary.
Unpool the output of the max pooling layer, by connecting the max pooling layer outputs to the max unpooling layer inputs.
net = connectLayers(net,'mpool/indices','unpool/indices'); net = connectLayers(net,'mpool/size','unpool/size');
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
If equal max values exists along the off-diagonal in a kernel window,
implementation differences for the maxPooling2dLayer
might cause
minor numerical mismatch between MATLAB® and the generated code. This issue also causes mismatch in the indices
of the maximum value in each pooled region.
For example, consider the following input to maxPooling2dLayer
.
The output from MATLAB is shown.
For the same input, the output from the generated code is shown.
GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.
Usage notes and limitations:
If equal max values exists along the off-diagonal in a kernel window,
implementation differences for the maxPooling2dLayer
might cause
minor numerical mismatch between MATLAB and the generated code. This issue also causes mismatch in the indices
of the maximum value in each pooled region.
For example, consider the following input to maxPooling2dLayer
.
The output from MATLAB is shown.
For the same input, the output from the generated code is shown.
Version History
Introduced in R2017b
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)