Main Content

yolov2ObjectDetector

Detect objects using YOLO v2 object detector

Description

The yolov2ObjectDetector object defines the trained YOLO v2 object detector. To detect objects in an image, pass the trained YOLO v2 object detector to the detect object function. The YOLO v2 object detector recognizes specific objects in images, based on the training images and ground truth data used with the trainYOLOv2ObjectDetector function. You can also use the yolov2ObjectDetector function to create the yolov2ObjectDetector object from a pretrained YOLO v2 network.

Creation

Create a yolov2ObjectDetector object by calling the trainYOLOv2ObjectDetector function with training data (requires Deep Learning Toolbox™).

detector = trainYOLOv2ObjectDetector(trainingData,____)

Description

detector = yolov2ObjectDetector(network) creates a YOLO v2 object detector by using the pretrained YOLO v2 network specified at the input.

The input network can also be an imported network from ONNX™ (Open Neural Network Exchange). For more information on how to create YOLO v2 object detector from an imported ONNX YOLO v2 network, see Import Pretrained ONNX YOLO v2 Object Detector.

detector = yolov2ObjectDetector(___,'TrainingImageSize',trainingSizes) specify image sizes used during training by using a name-value pair in addition to the input argument in the previous syntax.

Input Arguments

expand all

Pretrained YOLO v2 network, specified as a DAGNetwork object. The DAGNetwork must have an image input layer, YOLO v2 transform layer that is connected to a YOLO v2 output layer.

Set of image sizes used for training, specified as a comma-separated pair consisting of 'TrainingImageSize' and a M-by-2 matrix. Each row is of the form [height width]. The default value is the size of the image input layer of the network.

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

Properties

expand all

Name of the classification model, specified as a character vector or string scalar. By default, the name is set to the heading of the second column of the trainingData table specified in the trainYOLOv2ObjectDetector function. You can modify this name after creating the yolov2ObjectDetector object.

This property is read-only.

Trained YOLO v2 object detection network, specified as a DAGNetwork (Deep Learning Toolbox) object. This object stores the layers that define the YOLO v2 object detection network.

This property is read-only.

Names of object classes that the YOLO v2 object detector was trained to find, specified as a cell array of character vectors. This property is set by the trainingData input argument in the trainYOLOv2ObjectDetector function. Specify the class names as part of the trainingData table.

This property is read-only.

Set of anchor boxes, specified as an N-by-2 matrix defining the width and the height of N anchor boxes. This property is set by the AnchorBoxes property of the output layer in the YOLO v2 network.

The anchor boxes are defined when creating the YOLO v2 network by using the yolov2Layers function. Alternatively, if you create the YOLO v2 network layer-by-layer, the anchor boxes are defined by using the yolov2OutputLayer function.

This property is read-only.

Set of image sizes used for training, specified as an M-by-2 matrix, where each row is of the form [height width]. This property is set by the trainingSizes input argument.

If trainingSizes is not specified at the input, then this property is set by the trainingSizes argument in the trainYOLOv2ObjectDetector function. In this case, the yolov2ObjectDetector object is created by calling the trainYOLOv2ObjectDetector function.

Object Functions

detectDetect objects using YOLO v2 object detector

Extended Capabilities

Introduced in R2019a