rtmdetObjectDetector - Detect objects using RTMDet object detector - MATLAB (original) (raw)
Detect objects using RTMDet object detector
Since R2024b
Description
The rtmdetObjectDetector
object creates an Real-Time Model for object Detection (RTMDet), which is a one-stage, real-time, anchor-free object detector, for detecting objects in an image of arbitrary size. Using this object, you can create a pretrained RTMDet object detector by using RTMDet deep learning networks trained on the COCO data set.
Creation
Syntax
Description
`detector` = rtmdetObjectDetector
creates a RTMDet object detector trained to detect 80 object classes from the COCO data set using a CSP-Darknet network.
`detector` = rtmdetObjectDetector([name](#mw%5F96661ee4-ed5b-45ca-9f3a-38b2da1e059b))
creates a pretrained RTMDet object detector by using the specified RTMDet deep learning network name trained on the COCO data set.
`detector` = rtmdetObjectDetector(___,`Name=Value`)
sets the [InputSize](rtmdetobjectdetector.html#mw%5F096532c7-d42c-4de9-921b-6b6a0b66fc2d)
, and [NormalizationStatistics](rtmdetobjectdetector.html#mw%5Ff175c3c1-9307-419e-999d-b2c6be9c9d2c)
properties of the detector using one or more name-value arguments in addition to any combination of arguments from previous syntaxes.
Note
This functionality requires Deep Learning Toolbox™ and the Computer Vision Toolbox™ Model for RTMDet Object Detection. You can install the Computer Vision Toolbox Model for RTMDet Object Detection from Add-On Explorer. For more information about installing add-ons, seeGet and Manage Add-Ons.
Input Arguments
Name of the pretrained RTMDet deep learning network, created using CSP-DarkNet as the base network and trained on the COCO data set, specified as one of these values.
"tiny-network-coco"
— Pretrained RTMDet-tiny deep learning network. This RTMDet network has the fewest filters and fewest convolutional layers. Use RTMDet-tiny when you have few available computational resources, and require the fastest performance in terms of speed and real-time inference."small-network-coco"
— Pretrained RTMDet-small deep learning network. Use RTMDet-small for a higher level of accuracy than RTMDet-tiny when moderate computational resources are available."medium-network-coco"
— Pretrained RTMDet-medium deep learning network. Use RTMDet-medium for a higher level of accuracy than RTMDet-small when more computational resources, such as GPU hardware are available."large-network-coco"
— Pretrained RTMDet-large deep learning network. This RTMDet network has the largest number of filters and convolutional layers. Use the RTMDet-large network for the highest level accuracy in object detection at the expense of computational cost and speed.
Tip
To improve accuracy and the performance of complex detection tasks, you can increase the pretrained model size at the expense of decreased inference speed, larger computation time, and greater memory requirements. Use RTMDet-tiny for real-time inference at the expense of detection accuracy. Use RTMDet-small for near-real-time applications due to fast inference. Use RTMDet-medium and RTMDet-large when sufficient computational resources are available for the largest accuracy, at the expense of lower computation speeds.
Data Types: char
| string
Properties
This property is read-only.
Name for the object detector, stored as a character vector. By default, this property value is set to the value of the name
input argument.
This property is read-only.
Names of 80 object classes in COCO data set stored as a cell array. The detector is pre-trained on the COCO data set.
This property is read-only.
Image size to be used for inference, stored as a three-element row vector of integers of the form [_H_ _W_ _C_]
, where H, W, and_C_ correspond to the height, width, and number of channels in the input image, respectively.
By default, the InputSize
property value is set to the network's input size [640 640 3]
, which is the size of the training images.
To set a custom value for this property, specify the property and its value as a name,value pair when creating the object. For example, InputSize=[224 224 3]
sets the InputSize
property to [224 224 3]
.
The detect
function resizes the test image to the dimensions specified by theInputSize
property before performing the detections.
_Z_-score normalization statistics, stored as a structure with the fields Mean
and StandardDeviation
, which contain the values from the COCO data set:
Field | Description | Default Value |
---|---|---|
Mean | 1-by-C vector of means per channel. | [123.6750 116.2800 103.5300] |
StandardDeviation | 1-by-C vector of standard deviations per channel. | [58.3950 57.1200 57.3750] |
The number of channels C must match the number of channels in the image dimensions specified by [InputSize](rtmdetobjectdetector.html#mw%5F096532c7-d42c-4de9-921b-6b6a0b66fc2d)
.
Object Functions
detect | Detect objects using RTMDet object detector |
---|
Examples
Specify the name of a pretrained RTMDet deep learning network.
modelname = "medium-network-coco";
Create an RTMDet object detector by using the pretrained RTMDet network.
detector = rtmdetObjectDetector(modelname);
Read a test image into the workspace, and detect objects in it by using the pretrained RTMDet object detector with a Threshold
value of 0.55.
img = imread("boats.png"); [bboxes,scores,labels] = detect(detector,img,Threshold=0.55);
Display the bounding boxes and predicted class labels of the detected objects.
detectedImg = insertObjectAnnotation(img,"rectangle",bboxes,labels); figure imshow(detectedImg)
Extended Capabilities
Version History
Introduced in R2024b