F量度表示为:(2 * Precision * Recall /(Precision + Recall)。
我在Matlab中将其称为:
clc;
clear all;
close all;
% images = uigetdir('F:\images ..','Select Image Folder');
images = uigetdir('F:\images ..','Select Image Folder');
fnames=dir(images);
f=filesep;
groundtruth= uigetdir('F:\groundtruth...','Select GroundTruth Folder');
names=dir(groundtruth);
A={'.jpg','.bmp','.png','.tif'};
tic;
for k = 1:length(fnames)
[pathstr,name,ext] = fileparts(fnames(k).name);
if strcmpi(ext,'.jpg')==1;
rgb=imread([images,filesep,...
fnames(k).name]);
if(size(rgb,3) > 1)
f=rgb2gray(rgb);
else
f=rgb;
end
sprintf('%d',k)
t1=imread([groundtruth,filesep,...
names(k).name]);
sprintf('%d',k)
c = edge(f,'canny', 0.1);
idx = (t1()==1);
pc = length(t1(idx));
nc = length(t1(~idx));
Nc = pc+nc;
tpc = sum(t1(idx)==c(idx));
tnc = sum(t1(~idx)==c(~idx));
fpc = nc-tnc;
fnc = pc-tpc;
tp_ratec = tpc/pc;
tn_ratec = tnc/nc;
accuracyc = (tpc+tnc)/Nc;
sensitivityc = tp_ratec;
specificityc = tn_ratec;
precisionc = tpc/(tpc+fpc);
recallc = sensitivityc;
f_measurec = 2*((precisionc*recallc)/(precisionc + recallc));
gmeanc = sqrt(tp_ratec*tn_ratec);
当我计算它时,我得到的F值太小。
怎么了?
此F度量的资源(图像和免费)在这里: https://www2.eecs.berkeley.edu/Research/Projects/CS/vision/bsds/ https://www2.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/papers/amfm_pami2010.pdf