yolov3 detect image

1 view (last 30 days)
sam ho
sam ho on 14 Nov 2020
Answered: Isee You on 10 May 2021
I am useing the yolov3 detect sample
i want to detect my image but have some problem
it seems not match the yolov3Detect Xtest type
please helpe me
aaaa=imread('vehicleImage.jpg');
% Convert to dlarray.
aaaa=single(aaaa);
XTest = dlarray(aaaa, 'SSCB');
executionEnvironment = "auto";
[bboxes, scores, labels] = yolov3Detect(net, XTest, networkOutputs, anchorBoxes, anchorBoxMasks, confidenceThreshold, overlapThreshold, classNames);
clear yolov3Detect
if ~isempty(scores{1})
I = insertObjectAnnotation(aaaa, 'rectangle', bboxes{1}, scores{1});
end
figure('Name','detect')
imshow(I)

Answers (1)

Isee You
Isee You on 10 May 2021
i = imread(fullFileName);
confidenceThreshold = 0.7;
overlapThreshold = 0.5;
i=imresize(i,networkInputSize(1:2));
i=im2single(i);
XTest = dlarray(i,'SSCB');
if (executionEnvironment == "auto" && canUseGPU) || executionEnvironment == "gpu"
XTest = gpuArray(XTest);
end
[bboxes, scores, labels] = yolov3Detect(net, XTest, networkOutputs, anchorBoxes,anchorBoxMasks, confidenceThreshold, overlapThreshold, classNames);

Categories

Find more on Image Data Workflows in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!