Main Content

maxUnpooling2dLayer

Max unpooling layer

Description

A 2-D max unpooling layer unpools the output of a 2-D max pooling layer.

Creation

Description

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.

example

Properties

expand all

Layer name, specified as a character vector or string scalar. For Layer array input, the trainnet and dlnetwork functions automatically assign names to layers with the name "".

The MaxUnpooling2DLayer object stores this property as a character vector.

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, respectively.

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, respectively.

Data Types: cell

This property is read-only.

Number of outputs from the layer, returned as 1. This layer has a single output only.

Data Types: double

This property is read-only.

Output names, returned as {'out'}. 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'    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

Version History

Introduced in R2017b