Main Content

yolov2TransformLayer

Create transform layer for YOLO v2 object detection network

Since R2019a

Description

The yolov2TransformLayer function creates a YOLOv2TransformLayer object, which represents the transform layer for you only look once version 2 (YOLO v2) object detection network. The transform layer in YOLO v2 object detection network improves the stability of the network by constraining the location predictions. The transform layer extracts activations of the last convolutional layer and transforms the bounding box predictions to fall within the bounds of the ground truth.

Creation

Description

example

layer = yolov2TransformLayer(numAnchorBoxes) creates the transform layer for YOLO v2 object detection network.

example

layer = yolov2TransformLayer(numAnchorBoxes,Name,Value) sets the Name property using a name-value pair. Enclose the property name in single quotes. For example, yolov2TransformLayer('Name','yolo_Transform') creates a transform layer with the name 'yolo_Transform'.

Input Arguments

expand all

Number of anchor boxes used for training, specified as a positive integer. This input sets the NumAnchorBoxes property of the transform layer.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Properties

expand all

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 yolov2TransformLayer object stores this property as a character vector.

Data Types: char | string

This property is read-only.

Number of anchor boxes used for training, specified as a positive integer. This property is set by the input numAnchorBoxes.

This property is read-only.

Number of inputs to the layer, returned as 1. This layer accepts a single input only.

Data Types: double

This property is read-only.

Input names, returned as {'in'}. This layer accepts a single input only.

Data Types: cell

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

Specify the number of anchor boxes.

numAnchorBoxes = 5;

Create a YOLO v2 transform layer with the name "yolo_Transform".

layer = yolov2TransformLayer(numAnchorBoxes,'Name','yolo_Transform');

Inspect the properties of the YOLO v2 transform layer.

layer
layer = 
  YOLOv2TransformLayer with properties:

              Name: 'yolo_Transform'

   Hyperparameters
    NumAnchorBoxes: 5

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.

Extended Capabilities

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

Version History

Introduced in R2019a