Computer Vision Toolbox Feature Enhancement Request?

6 ビュー (過去 30 日間)
xingxingcui
xingxingcui 2021 年 7 月 30 日
編集済み: Jayanti 2025 年 5 月 15 日
1、The third input parameter "labels" in the "selectStrongestBboxMulticlass" function should accept multiple types, such as string array, character cell vector, not just categorical array and numerical array
% official example in "selectStrongestBboxMulticlass" function
detectorInria = peopleDetectorACF('inria-100x41');
detectorCaltech = peopleDetectorACF('caltech-50x21');
I = imread('visionteam1.jpg');
[bboxesInria,scoresInria] = detect(detectorInria,I,'SelectStrongest',false);
[bboxesCaltech,scoresCaltech] = detect(detectorCaltech,I,'SelectStrongest',false);
labelsInria = repelem("inria",numel(scoresInria),1);
labelsInria = categorical(labelsInria,{'inria','caltech'});
labelsCaltech = repelem("caltech",numel(scoresCaltech),1);
labelsCaltech = categorical(labelsCaltech,{'inria','caltech'});
allBBoxes = [bboxesInria;bboxesCaltech];
allScores = [scoresInria;scoresCaltech];
allLabels = string([labelsInria;labelsCaltech]);% if it is string array, don't support???
[bboxes,scores,labels] = selectStrongestBboxMulticlass(allBBoxes,allScores,allLabels,...
'RatioType','Min','OverlapThreshold',0.65);
Error using selectStrongestBboxMulticlass
Expected input number 3, label, to be one of these types:

uint8, int8, uint16, int16, uint32, int32, double, single

Instead its type was string.

Error in selectStrongestBboxMulticlass>iCheckLabel (line 229)
validateattributes(value,{'uint8', 'int8', 'uint16', 'int16', 'uint32', ...

Error in selectStrongestBboxMulticlass>iCheckInputBboxScoreAndLabel (line 216)
iCheckLabel(label)

Error in selectStrongestBboxMulticlass>iParseInputs (line 244)
iCheckInputBboxScoreAndLabel(bbox, score, label);

Error in selectStrongestBboxMulticlass (line 115)
[ratioType, overlapThreshold, numStrongest] = iParseInputs(bbox,score,label,varargin{:});
annotations = string(labels) + ": " + string(scores);
I = insertObjectAnnotation(I,'rectangle',bboxes,cellstr(annotations));
imshow(I)
title('Detected People, Scores, and Labels')
2,The first input parameter "bboxA" in the "bboxresize" function should accept a type based on the supported float type, not the current positive integer type
bboxA = rand(1,4)
bboxB = bboxresize(bboxA,2)
Error using bboxresize>iParseInputs (line 115)
The value of 'bboxA' is invalid. Expected input number 1, bboxA, to be integer-valued.
Error in bboxresize (line 48)
params = iParseInputs(bboxA,scale);

採用された回答

Jayanti
Jayanti 2025 年 5 月 15 日
編集済み: Jayanti 2025 年 5 月 15 日
Hi,
If your labels are in the form of a string array or a character cell array, you can convert them to a categorical vector before passing them to the “selectStrongestBboxMulticlass” function. For example, if you have a string array named “strArray”, you can use:
labels = categorical(strArray);
And regarding your second query, in MATLAB R2021a “bboxresize” function required integer-valued bounding boxes. However, starting from R2022a, MATLAB updated the behaviour of “bboxresize” to fully support spatial coordinates.
You can refer to below documentation link for more details:
Hope this will be helpful!

その他の回答 (0 件)

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by