How to import a trained object detector to Simulink?
1 次查看(过去 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?
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!