The output of objectDetector in Simulink

1 Ansicht (letzte 30 Tage)
Jamie
Jamie am 7 Okt. 2023
Beantwortet: Debraj Maji am 9 Nov. 2023
I am now working with the example intelligent-bin-picking-example-with-simulink
After the installation and configuration, when i start to run in simulink, the following error occurred:
```
Error in 'IntelligentBinPicking/Object Detector/Draw Shapes': The Pts input must be an M-by-4 matrix. Each row specifies a different rectangle and is of the form [x y width height].
Error in port widths or dimensions. 'output 1' of 'IntelligentBinPicking/Object Detector/Data Type Conversion' is a matrix with a maximum size of [8x5].
```
at
function bboxes = objectDetector(image)
isSim = coder.target('sfun');
simSupported = false;
useExtrinsic = isSim && ~simSupported;
[bboxes] = deep.blocks.internal.objectDetector(image, 'C:\Users\jamie\Documents\MATLAB\intelligent-bin-picking-example-with-simulink\Perception\trainedYOLOv4DetectorSimGazebo_cuboid.mat', useExtrinsic, {'Threshold', 0.5, 'SelectStrongest', false}, {'NumStrongest', 8, 'RatioType', 'Union'}, 8, true, false, false);
end
It turns out the objectDetector output a Mx5 matrix instead of Mx4, I wonder if there is a way to control the output bboxes shape?

Antworten (1)

Debraj Maji
Debraj Maji am 9 Nov. 2023
Hi @Jamie,
I see that you are trying to detect objects using objectDetector method. The output provided by the detector is defined in spatial coordinates as an M-by-5 numeric matrix with rows of the form [xctr yctr xlen ylen yaw], where:
  • “M” is the number of rotated rectangles.
  • “xctr" and “yctr” specify the center of the rectangle.
  • “xlen” specifies the width of the rectangle, which is its length along the x-axis before rotation.
  • “ylen” specifies the height of the rectangle, which is its length along the y-axis before rotation.
  • yaw specifies the rotation angle in degrees. The rotation is clockwise-positive around the center of the bounding box.
One possible way to control the output matrix is by using the PredictedBoxType” function. When the PredictedBoxType” is "axis-aligned", the object detector will train and perform inference on only axis-aligned bounding boxes. If it is set to "rotated", the object detector will train and perform inference on only rotated bounding boxes. This property is to be set when the object is created.
You may go through the following MathWorks documentation link to learn more about the “objectDetector” function: https://in.mathworks.com/help/vision/ref/yolov4objectdetector.detect.html#mw_446f54db-f450-4d0f-81dc-6c596f2311ec_sep_mw_5b7ae991-f408-4485-abdf-84263e852aaf

Produkte


Version

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by