maxUnpooling2dLayer

Max unpooling layer

Description

A max unpooling layer unpools the output of a max pooling layer.

Creation

Description

example

layer = maxUnpooling2dLayer creates a max unpooling layer.

example

layer = maxUnpooling2dLayer('Name',name) sets the Name property. To create a network containing a max unpooling layer you must specify a layer name.

Properties

expand all

Layer name, specified as a character vector or a string scalar. To include a layer in a layer graph, you must specify a nonempty unique layer name. If you train a series network with the layer and Name is set to '', then the software automatically assigns a name to the layer at training time.

Data Types: char | string

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.

Data Types: double

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.

Data Types: cell

Number of outputs of the layer. This layer has a single output only.

Data Types: double

Output names of the layer. This layer has a single output only.

Data Types: cell

Examples

collapse all

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'}

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'    Max Pooling     2x2 max pooling with stride [2  2] and padding [0  0  0  0]
     2   'unpool'   Max Unpooling   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:

         Layers: [2x1 nnet.cnn.layer.Layer]
    Connections: [1x2 table]
     InputNames: {1x0 cell}
    OutputNames: {1x0 cell}

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™.

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

Introduced in R2017b