Main Content


ROI input layer for Fast R-CNN

Since R2018b


An ROI input layer inputs images to a Fast R-CNN object detection network.



layer = roiInputLayer creates an ROI input layer.


layer = roiInputLayer('Name',Name) creates an ROI input layer and sets the optional Name property.


expand all

Layer name, specified as a character vector or a string scalar. For Layer array input, the trainNetwork (Deep Learning Toolbox), assembleNetwork (Deep Learning Toolbox), layerGraph (Deep Learning Toolbox), and dlnetwork (Deep Learning Toolbox) functions automatically assign names to layers with the name ''.

Data Types: char | string

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.

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

Data Types: cell


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');

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

Version History

Introduced in R2018b