Matlab 如何找到分割图像的精度和召回率?

Matlab 如何找到分割图像的精度和召回率?,matlab,image-segmentation,Matlab,Image Segmentation,我试过这个: 我的测试图像是 我的参考图像是 但我得到的结果是NaN。这有什么问题?附加的函数,compareBinaryImages,需要二进制输入,即只包含0和1的输入图像。对图像进行二值化,并将此函数应用于二值图像,结果为多个数字输出,其中非Nan: testingImg = imread('testing.png'); referenceImg = imread('reference.png'); % grayscale testingGray = rgb2gray(testingImg

我试过这个:

我的测试图像是

我的参考图像是


但我得到的结果是NaN。这有什么问题?

附加的函数,
compareBinaryImages
,需要二进制输入,即只包含0和1的输入图像。对图像进行二值化,并将此函数应用于二值图像,结果为多个数字输出,其中非Nan:

testingImg = imread('testing.png');
referenceImg = imread('reference.png');
% grayscale
testingGray = rgb2gray(testingImg);
referenceGray = rgb2gray(referenceImg);
% binarize
testingBw = testingGray == 255;
referenceBw = referenceGray == 255;
% compare *binary* images
[Fvalue,precision,recall,accuracy,JaccardIndex,TP,FP,TN,FN,FPrate,TPrate,MCC] = ...
    compareBinaryImages(referenceBw, testingBw);

NaNs的结果是什么?链接中的函数有多个输出。你试过调试代码吗?是的。我使用了rgb2gray(参考)和rgb2gray(图腾测试),然后比较了naryImages(参考,图腾测试)ans=NaN,但为什么值大呢?TP=7117 FP=1990 TN=368716 FN=2866您应该仔细阅读这些值的定义,您会理解的
TP(真阳性)例如,是测试图像和参考图像中均为1的像素数。
testingImg = imread('testing.png');
referenceImg = imread('reference.png');
% grayscale
testingGray = rgb2gray(testingImg);
referenceGray = rgb2gray(referenceImg);
% binarize
testingBw = testingGray == 255;
referenceBw = referenceGray == 255;
% compare *binary* images
[Fvalue,precision,recall,accuracy,JaccardIndex,TP,FP,TN,FN,FPrate,TPrate,MCC] = ...
    compareBinaryImages(referenceBw, testingBw);