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
Layer name, specified as a character vector or a string scalar.
For Layer
array input, the trainNetwork
, assembleNetwork
, layerGraph
, and
dlnetwork
functions automatically assign
names to layers with the name ''
.
Data Types: char
| string
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 of the layer. This layer has a single output only.
Data Types: double
OutputNames
— Output names
{'out'}
(default)
This property is read-only.
Output names of the layer. 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
Sequentially connect layers by adding them to a layerGraph
. This step connects the 'out'
output of the max pooling layer to the 'in'
input of the max unpooling layer.
lgraph = layerGraph(layers)
lgraph = LayerGraph with properties: InputNames: {1x0 cell} OutputNames: {1x0 cell} Layers: [2x1 nnet.cnn.layer.Layer] Connections: [1x2 table]
Unpool the output of the max pooling layer, by connecting the max pooling layer outputs to the max unpooling layer inputs.
lgraph = connectLayers(lgraph,'mpool/indices','unpool/indices'); lgraph = connectLayers(lgraph,'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
Apri esempio
Si dispone di una versione modificata di questo esempio. Desideri aprire questo esempio con le tue modifiche?
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
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)