Filter löschen
Filter löschen

How to import a trained object detector to Simulink?

3 Ansichten (letzte 30 Tage)
Chandni S Vijay
Chandni S Vijay am 28 Nov. 2022
Bearbeitet: Ashu am 25 Jan. 2023
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?

Akzeptierte Antwort

Ashu
Ashu am 24 Jan. 2023
Bearbeitet: Ashu am 25 Jan. 2023
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

Weitere Antworten (0)

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by