How to import a trained object detector to Simulink?

3 次查看(过去 30 天)
Hi. I have trained an object detector using trainYOLOv4ObjectDetector() function and now I want to add this detector to my Simulink model to detect the objects from the images I pass through in the Simulink model. Is there any way to import it? I tried using Deep learning object detector block but its not working. Could someone guide me through this?

采纳的回答

Ashu
Ashu 2023-1-24
编辑:Ashu 2023-1-25
Hi Chandni,
You can use a MATLAB Function block in simulink to load the trained object detector .
To work with MATLAB Function block you can refer :
Inside the function you can have your custom code and make predictions like this
% Assuming trainedDetector.mat is the saved object detector
trainedDetector = load('trainedDetector.mat', 'trainedDetector')
I = imread('highway.png');
[bboxes, scores, labels] = detect(trainedDetector,I,Threshold=0.05);
detectedImg = insertObjectAnnotation(I,"Rectangle",bboxes,labels);
To read more about loading different types of variables, you can refer
To learn more about YoloV4ObjectDetector, you can refer

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Computer Vision with Simulink 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by