Error, Detector in YOLO V4

조회 수: 14 (최근 30일)
weam
weam 2023년 3월 4일
댓글: Walter Roberson 2023년 3월 12일
Hello everyone, can you help me? I am using the example "Object Detection Using YOLO v4 Deep Learning" in the document Matlab help, but with a change in the dataset (customs data). when I reach to detector appear the error.
this code :-
detector = yolov4ObjectDetector("csp-darknet53-coco",className1,className2,anchorBoxes,InputSize=inputSize);
this error appear:-
Error using yolov4ObjectDetector/parsePretrainedDetectorInputs
Expected a string scalar or character vector for the parameter name.
Error in yolov4ObjectDetector (line 218)
params = yolov4ObjectDetector.parsePretrainedDetectorInputs(varargin{:});
Error in recognitionThree (line 113)
detector = yolov4ObjectDetector("csp-darknet53-coco",className1,className2,anchorBoxes,InputSize=inputSize);

답변 (2개)

Walter Roberson
Walter Roberson 2023년 3월 6일
detector = yolov4ObjectDetector("csp-darknet53-coco",className1,className2,anchorBoxes,InputSize=inputSize);
So in your call, the name parameter is being passed as "csp-darknet53-coco" . The classes parameter is being passed as className1 . The aboxes parameter is being passed as className2 . Then you get to the anchorBoxes parameter in your call, and since the positional parameter locations have been filled, the code has to match the contents of anchorBoxes to one of the option names. But your anchorBoxes variable is not a character vector or a string array, so you get an error message.
The classes has to be passed as a single parameter, such as {className1, className2}
  댓글 수: 7
weam
weam 2023년 3월 12일
편집: weam 2023년 3월 12일
function data = augmentData(A);
data = cell(size(A)); for ii = 1:size(A,1) I = A{ii,1}; bboxes = A{ii,2}; labels = A{ii,3}; sz = size(I);
if numel(sz) == 3 && sz(3) == 3
I = jitterColorHSV(I,...
contrast=0.0,...
Hue=0.1,...
Saturation=0.2,...
Brightness=0.2);
end
% Randomly flip image.
tform = randomAffine2d(XReflection=true,Scale=[1 1.1]);
rout = affineOutputView(sz,tform,BoundsStyle="centerOutput");
I = imwarp(I,tform,OutputView=rout);
% Apply same transform to boxes.
[bboxes,indices] = bboxwarp(bboxes,tform,rout,OverlapThreshold=0.25);
labels = labels(indices);
% Return original data only when all boxes are removed by warping.
if isempty(indices)
data(ii,:) = A(ii,:);
else
data(ii,:) = {I,bboxes,labels};
end
end
end
Walter Roberson
Walter Roberson 2023년 3월 12일
the error message says
Error in recognitionThree>augmentData (line 231)
bboxes = A{ii,{1,1}};
but that line does not exist in the augmentData function that you posted.

댓글을 달려면 로그인하십시오.


Pritesh Shah
Pritesh Shah 2023년 3월 5일
Check input command of this function.

Community Treasure Hunt

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

Start Hunting!

Translated by