Main Content

roiMaxPooling2dLayer

Neural network layer used to output fixed-size feature maps for rectangular ROIs

Description

An ROI max pooling layer outputs fixed size feature maps for every rectangular ROI within the input feature map. Use this layer to create a Fast or Faster R-CNN object detection network.

Given an input feature map of size [HWCN], whereCis the number of channels andNis the number of observations, the output feature map size is [heightwidthCsum(M)], whereheightwidthare the output size.Mis a vector of lengthNM(i) is the number of ROIs associated with thei-th input feature map.

该层有两个输入:

  • 'in'— The input feature map that will be cropped

  • 'roi'— A list of ROIs to pool

Use the input names when connecting or disconnecting the ROI max pooling layer to other layers using连接器(Deep Learning Toolbox)或者disconnectLayers(Deep Learning Toolbox)(requires Deep Learning Toolbox™).

Creation

Description

layer = roimaxpooling2dlayer(outputsize)creates a max pooling layer for ROIs and sets theOutputSizeproperty.

example

layer = roiMaxPooling2dLayer(outputSize,'Name',Name)creates a max pooling layer for ROIs and sets the optionalNameproperty. To create a network containing an ROI max pooling layer, you must specify a layer name.

Properties

expand all

Pooled output size, specified as a two-element vector of positive integers of the form[heightwidth].

图层名称,指定为字符向量或字符串标量。为了Layerarray input, thetrainNetwork,汇编工作,layerGraph, anddlnetworkfunctions automatically assign names to layers with name''.

Data Types:char|string

Number of inputs of the layer. This layer has two inputs.

Data Types:double

Input names of the layer. This layer has two inputs, named'in''roi'.

Data Types:cell

This property is read-only.

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

Data Types:double

This property is read-only.

层的输出名称。该层仅具有单个输出。

Data Types:cell

Examples

collapse all

Create an ROI input layer.

roiInput = roiInputLayer('Name','roi_input');

Create an ROI max pooling layer with output size [4 4].

outputSize = [4 4]; roiPool = roiMaxPooling2dLayer(outputSize,'Name','roi_pool');

Add the layers to a LayerGraph.

lgraph = layerGraph; lgraph = addLayers(lgraph,roiInput); lgraph = addLayers(lgraph,roiPool);

Specify that the output of the ROI input layer is the'roi'input of the ROI max pooling layer.

lgraph = connectLayers(lgraph,'roi_input','roi_pool/roi'); plot(lgraph)

Figure contains an axes object. The axes object contains an object of type graphplot.

Version History

Introduced in R2018b