regionProposalLayer

Region proposal layer for Faster R-CNN

Description

A region proposal layer outputs bounding boxes around potential objects in an image as part of the region proposal network (RPN) within Faster R-CNN. These outputs are further refined by additional layers within Faster R-CNN to produce the final object detection results.

There are two inputs to this layer:

  • 'scores' — The classification scores produced by the RPN classification branch

  • 'boxDeltas' — The bounding box deltas produced by the RPN regression branch

Use the input names when connecting or disconnecting the region proposal layer to other layers using connectLayers or disconnectLayers (requires Deep Learning Toolbox™).

Creation

Syntax

layer = regionProposalLayer(anchorBoxes)
layer = regionProposalLayer(anchorBoxes,'Name',Name)

Description

layer = regionProposalLayer(anchorBoxes) creates a region proposal layer for building Faster R-CNN object detection networks, and sets the AnchorBoxes property.

example

layer = regionProposalLayer(anchorBoxes,'Name',Name) creates a region proposal layer and sets the optional Name property.

Properties

expand all

Anchor boxes, specified as an M-by-2 matrix defining the [height width] of M anchor boxes.

Anchor boxes are predefined bounding box templates of fixed size. The size of each anchor box is typically determined based on a priori knowledge of the scale and aspect ratio of objects in the training dataset. An RPN network is trained to predict the translation and rescaling needed to align the anchor boxes with the ground truth bounding boxes. [1]

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. This layer has two inputs.

Data Types: double

Input names of the layer. This layer has two inputs, named 'scores' and 'boxDeltas'.

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

Define three square anchor boxes for the region proposal layer.

anchorBoxes = [
    16 16
    64 64
    128 128
    ];

Create a region proposal layer with the name 'region_proposal'.

regionProposal = regionProposalLayer(anchorBoxes,'Name','region_proposal');

References

[1] Ren, S., K. He, R. Girshick, and J. Sun. "Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks." Advances in Neural Information Processing Systems. Vol. 28, 2015.

Introduced in R2018b