matlab - 当我尝试计算图像分割结果的准确性时,为什么输出为 0?
问题描述
bboxPrecisionRecall
我使用Matlab 版本 '9.4.0.857798 (R2018a) Update 2' 中的函数和使用IESK-ArDB数据集的算法测试结果检查了分割方法的准确性。该数据库可在此处免费获得。数据库图像和. 尝试计算准确性时,我得到 0 作为输出。我该怎么做才能获得分段算法的真实结果?
代码如下:
%% clean Workspace
clear;
clc;
%% my segmented bounding box cell
propied = {[48.5,84.5,102,59];[169.5,71.5,96,77];[251.5,114.5,47,51]}
%% Read Image
im = imread('t_A01_010.bmp');
imshow(im)
hold on
%% Ground truth standerd boxes.
%[GTruth,txt,raw] = xlsread('demo.xlsx');
groundTruthBoxes = [235 102 301 170;164 66 267 153 ;43 80 153 148]
%Convert bounding boxes from struct to cell.
boundingBoxes = propied;
% Convert cell to Matrix
bb = cell2mat(boundingBoxes(:));
% Move rows up down and fix matrix numbers
bb1 = fix(flipud(bb))
% Draw rectangle boxes for segmented Algorithm
for i=1:3
rectangle('Position',bb1(i,:),'EdgeColor','y');
end
% Draw rectangle boxes for Standerd Ground Truth
for i=1:3
rectangle('Position',groundTruthBoxes(i,:),'EdgeColor','g');
end
%Evaluate the overlap accuracy against the ground truth data.
[precision,recall] = bboxPrecisionRecall(bb1,groundTruthBoxes)
解决方案
这是因为检测率treshold
。
函数的第三个输入(默认 0.5)指定 2 个框之间的最小重叠,以将它们视为“匹配”。您的盒子的大小如此不同,以至于该方法假定它们根本不匹配,即看的不是同一个东西。您可以更改此值以改变输出。
例如:
[precision,recall] = bboxPrecisionRecall(bb1,groundTruthBoxes,0)
precision =
1
recall =
1
或者
[precision,recall] = bboxPrecisionRecall(bb1,groundTruthBoxes,0.1)
precision =
0.6667
recall =
0.6667
推荐阅读
- string - 访问查询表达式:在其他两个词之间提取词
- javascript - 根据输入的数字是否大于、小于或等于动态生成 if-else
- php - 人口统计报告设置已启用,但未捕获年龄和性别信息
- python - Django查询集在使用选择相关时没有属性
- visual-studio-code - 样式属性在 .vue 文件中没有建议
- python-3.x - 是否可以在 HTML 表中移动并使用 BeautifulSoup4 获取数据?
- java - Java(FX) 在播放一种声音时,播放另一种声音
- reactjs - 如何使用 Reactjs 将输入附加到 axios 调用端点
- python - Django REST Framework:如何向使用直通表的 M2M 序列化程序添加外主键?
- c# - C#继承:如何将父对象分配给子实例