Deploying YoloV3 to Jetson Nano
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ahmed Tamer
am 21 Nov. 2023
Beantwortet: Ahmed Tamer
am 24 Nov. 2023
function outImg = YoloOnJetson(cameraName,resolution)
% Copyright 2021-2022 The MathWorks, Inc.
hwobj = jetson;
camObj = camera(hwobj,cameraName,resolution);
dispObj = imageDisplay(hwobj);
configFilePath = "E:\JetsonWork\George Camer Object Detection\ssd_mobilenet_v2_coco.config";
persistent yolov3Obj;
if isempty(yolov3Obj)
yolov3Obj = coder.loadDeepLearningNetwork('darknet53-coco.mat');
end
% Read the contents of the configuration file as text
fid = fopen(configFilePath, 'r');
configText = fscanf(fid, '%c', inf);
fclose(fid);
% Load the pre-trained YOLOv3 object detector
detector = yolov3ObjectDetector('darknet53-coco');
while ishandle(1)
% Capture the image from the camera on hardware.
img = snapshot(camObj);
% Detect objects in the frame
[bboxes, scores, labels] = yolov3Obj.detect(detector, img);
% Annotate the image with bounding boxes and labels
img = insertObjectAnnotation(img, 'rectangle', bboxes, cellstr(labels));
% Display the annotated image
% Display the annotated image
image(dispObj,img);
end
I am trying to run this code in order to generate an .exe of this code to my Jetson Nano Developer Kit
>> inputArgs = {coder.Constant(camName),coder.Constant(camResolution)};
codegen('-config ',cfg,'-args',inputArgs,'YoloOnJetson','-report');
The 'yolov3ObjectDetector' class does not support code generation.
Error in ==> YoloOnJetson Line: 20 Column: 12
Code generation failed: View Error Report
Error using codegen
I usually get this error, I do have the darknet53-coco.mat file in my file directory, I did generate it somehow playing around.
It's werid because yolov3ObjectDetector shall be compatible with code generation, what can I do?
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Walter Roberson
am 22 Nov. 2023
if isempty(yolov3Obj)
yolov3Obj = coder.loadDeepLearningNetwork('darknet53-coco.mat');
end
That step looks good: you are loading a pre-trained detector that should be of the right class.
detector = yolov3ObjectDetector('darknet53-coco');
But there you are trying to create a new object of that class. Creating a new object of the class is not supported in deployed code: all you can do in deployed code is load an already-trained detector and use the detect() method of that pre-trained detector.
1 Kommentar
Siehe auch
Kategorien
Mehr zu Computer Vision Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!