This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

yolov2OutputLayer

Create output layer for YOLO v2 object detection network

Description

The yolov2OutputLayer function creates a YOLOv2OutputLayer object, which represents the output layer for you look only once version 2 (YOLO v2) object detection network. The output layer provides the refined bounding box locations of the target objects.

Creation

Syntax

layer = yolov2OutputLayer(anchorBoxes)
layer = yolov2OutputLayer(anchorBoxes,Name,Value)

Description

example

layer = yolov2OutputLayer(anchorBoxes) creates a YOLOv2OutputLayer object, layer, which represents the output layer for YOLO v2 object detection network. The layer outputs the refined bounding box locations that are predicted using a predefined set of anchor boxes specified at the input.

example

layer = yolov2OutputLayer(anchorBoxes,Name,Value) sets the Name and LossFactors properties using name-value pairs and the input from the preceding syntax. Enclose each property name in single quotes. For example, yolov2OutputLayer('Name','yolo_Out') creates an output layer with the name 'yolo_Out'.

Input Arguments

expand all

Set of anchor boxes, specified as an M-by-2 matrix, where each row is of the form [height width]. The matrix defines the height and the width of M number of anchor boxes. This input sets the AnchorBoxes property of the output layer. You can use the clustering approach for estimating anchor boxes from the training data. For more information, see Estimate Anchor Boxes Using Clustering.

Properties

expand all

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

Loss function, specified as 'mean-squared-error'. For more information about the loss function, see Loss Function for Bounding Box Refinement.

This property is read-only.

Set of anchor boxes used for training, specified as a M-by-2 matrix defining the height and the width of M number of anchor boxes. This property is set by the input anchorBoxes.

This property is read-only.

Weights in the loss function, specified as a 1-by-4 vector of form [K1 K2 K3 K4]. Weights increase the stability of the network model by penalizing incorrect bounding box predictions and false classifications. For more information about the weights in loss the function, see Loss Function for Bounding Box Refinement.

Number of inputs of the layer. This layer accepts a single input only.

Data Types: double

Input names of the layer. This layer accepts a single input only.

Data Types: cell

Examples

collapse all

Create a YOLO v2 output layer with two anchor boxes.

Define the height and the width of the anchor boxes.

anchorBoxes = [16 16;32 32];

Generate a YOLO v2 output layer with the name "yolo_Out".

layer = yolov2OutputLayer(anchorBoxes,'Name','yolo_Out');

Inspect the properties of the YOLO v2 output layer.

layer
layer = 
  YOLOv2OutputLayer with properties:

            Name: 'yolo_Out'

   Hyperparameters
    LossFunction: 'mean-squared-error'
     AnchorBoxes: [2×2 double]
     LossFactors: [5 1 1 1]

More About

expand all

References

[1] Joseph. R, S. K. Divvala, R. B. Girshick, and F. Ali. "You Only Look Once: Unified, Real-Time Object Detection." In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 779–788. Las Vegas, NV: CVPR, 2016.

[2] Joseph. R and F. Ali. "YOLO 9000: Better, Faster, Stronger." In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 6517–6525. Honolulu, HI: CVPR, 2017.

Introduced in R2019a