Error using bboxresize>iParesInputs (line 115) The value of 'bboxA' is invalid. Expected input number 1, bboxA, to be positive.
Show older comments
How to solve this error, I am using YOLOv3 as an object detector to detect 6 classes. Each class has around 1000 images. I trained the network and I did not get any error. However when I tried to evaluate the network by using the average precision metric, I got this error, as shown in the next code:
confidenceThreshold = 0.5;
overlapThreshold = 0.5;
% Create the test datastore.
preprocessedTestData = transform(testData,@(data)preprocessData(data,networkInputSize));
% Create a table to hold the bounding boxes, scores, and labels returned by
% the detector.
numImages = size(testDataTbl,1);
results = table('Size',[numImages 3],...
'VariableTypes',{'cell','cell','cell'},...
'VariableNames',{'Boxes','Scores','Labels'});
% Run detector on each image in the test set and collect results.
for i = 1:numImages
% Read the datastore and get the image.
data = read(preprocessedTestData);
I = data{1}; (error is in this line)
% Convert to dlarray. If GPU is available, then convert data to gpuArray.
XTest = dlarray(I,'SSCB');
if (executionEnvironment == "auto" && canUseGPU) || executionEnvironment == "gpu"
XTest = gpuArray(XTest);
end
% Run the detector.
[bboxes, scores, labels] = yolov3Detect(net, XTest, networkOutputs, anchorBoxes, anchorBoxMasks, confidenceThreshold, overlapThreshold, classNames);
% Collect the results.
results.Boxes{i} = bboxes;
results.Scores{i} = scores;
results.Labels{i} = labels;
end
Hint: when I tried the same code for each class alone, I did not get any error.
Please I need your help!
Thank you in advance.
1 Comment
Raymond Norris
on 6 Jan 2021
Just a quick comment: I think you probably meant to reference the Products "Computer Vision Toolbox" (bboxresize) and "Parallel Computing Toolbox" (GPUs). This doesn't appear to involve "MATLAB Production Server". Not sure if this will help broaden the scope of responders.
Answers (1)
Asvin Kumar
on 8 Jan 2021
Edited: Asvin Kumar
on 11 Jan 2021
0 votes
I’m unable to reproduce the mentioned error since there’s no attached ‘testdata’ or an error stack.
Nevertheless, it looks like what you’re encountering is similar to this question: https://www.mathworks.com/matlabcentral/answers/515461-must-i-have-dataset-with-multiple-classes-in-a-single-image-to-train-a-faster-r-cnn-detection-networ#answer_425546
The error occurs in the bboxresize function which is called when transformations are applied to the imageDataStore. The transform function works by creating a TransformedDatastore object with a list of the Transforms applied to the input datastore. These are then applied when you try to read an image from it. If not in the mentioned line, this error would’ve been encountered when the yolov3Detect function is called.
As the error reads, it looks like the bbox values in the first argument to the bboxwrap function are not positive. It is possible that they are 0 or negative. That’s what you will have to fix. I’d suggest checking which transformation in your custom preprocessData function is causing this error.
1 Comment
Mai Ibraheam
on 10 Jan 2021
Categories
Find more on Object Detection 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!