How to show labels names?
3 次查看(过去 30 天)
显示 更早的评论
Hello everyone, I am running object detector in Matlab ... after running detector on test image the result looks like this :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1387984/image.png)
But I want my program to show also names for each class ... for example if there is an airplane i want to see the confidence and name airplane also...
Here is my code which runs detector on one of the images :
I = imread(testDataTbl.imageFilename{94});
I = imresize(I,inputSize(1:2));
[bboxes,scores] = detect(detector,I);
I = insertObjectAnnotation(I,'rectangle',bboxes,scores);
figure
imshow(I)
0 个评论
回答(2 个)
Walter Roberson
2023-5-19
FIrst (somehow) convert each score into its corresponding class name.
Then when you call insertObjectAnnotation pass the class name as the fourth parameter (where you are passing scores now)
Birju Patel
2023-5-25
Any object detector that supports detection multple classes will return the labels as a third output argument:
[bboxes,scores,labels] = detect(detector,I);
You can create a string with the label and score:
str = string(labels) + ": " + scores;
I = insertObjectAnnotation(I,'rectangle',bboxes,str);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image and Video Ground Truth Labeling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!