Main Content

roiInputLayer

ROI input layer for Fast R-CNN

Description

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

Creation

Description

layer = roiInputLayer creates an ROI input layer.

example

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

Properties

expand all

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

The ROIInputLayer object stores this property as a character vector.

Data Types: char | string

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 dlnetwork object.

net = dlnetwork;

Create an array of layers that includes an ROI input layer and an ROI max pooling layer with output size [4 4]. Add the layers to the network.

outputSize = [4 4];
layers = [
    roiInputLayer(Name="roi_input")
    roiMaxPooling2dLayer(outputSize,Name="roi_pool")]
layers = 
  2x1 Layer array with layers:

     1   'roi_input'   ROI Input         M-by-4 rectangular ROIs
     2   'roi_pool'    ROI Max Pooling   ROI Max Pooling with pooled output size [4 4]
net = addLayers(net,layers);

Connect the output of the ROI input layer with the "roi" input of the ROI max pooling layer. Remove the connection between the ROI input layer and the "in" input of the ROI max pooling layer.

net = connectLayers(net,"roi_input","roi_pool/roi");
net = disconnectLayers(net,"roi_input","roi_pool/in");
plot(net)

Version History

Introduced in R2018b