Main Content

anchorBoxLayer

(To be removed) Create anchor box layer for object detection

Since R2020a

anchorBoxLayer function will be removed in a future release. Use the ssdObjectDetector object to specify the anchor boxes for training a SSD object detection network, instead.

Description

An anchor box layer stores anchor boxes for a feature map used in object detection networks.

Creation

Description

layer = anchorBoxLayer(anchorBoxes) creates an anchor box layer, specifying the size of the anchor boxes by using anchorBoxes. The anchorBoxes input sets the AnchorBoxes property.

example

layer = anchorBoxLayer(anchorBoxes,Name,Value) set properties of the anchor box layer by using one or more name-value pair arguments. Enclose each property name in quotes.

For example, anchorBoxLayer(anchorBoxes,'Name','anchorboxlayer') creates an anchor box layer with the name "anchorboxlayer" from anchor boxes specified by anchorBoxes.

Properties

expand all

Size of anchor boxes, specified as an M-by-2 matrix of M anchor boxes. Each row of the matrix is of the form [height width].

Layer name, specified as a character vector or a string scalar. For Layer array input, the trainnet (Deep Learning Toolbox), 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 "".

The AnchorBoxLayer object stores this property as a character vector.

Data Types: char | string

Examples

collapse all

Specify the size of four anchor boxes.

anchorBoxes = [50 50; 100 100; 50 100; 100 50];

Create an anchor box layer named "anchorboxlayer" and display the results.

layer = anchorBoxLayer(anchorBoxes,'Name','anchorboxlayer')
Warning: anchorBoxLayer will be removed in a future release. Use the ssdObjectDetector function to create a SSD object detection network, instead.
layer = 
  AnchorBoxLayer with properties:

           Name: 'anchorboxlayer'

   Hyperparameters
    AnchorBoxes: [4x2 double]

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2020a

expand all

R2023b: anchorBoxLayer function will be removed

anchorBoxLayer function will be removed in a future release. You can use the ssdObjectDetector object to specify the anchor boxes for training a SSD object detection network, instead.