主要内容

bfscore

图像分段的轮廓匹配分数

描述

example

score= bfscore(预言,地面)computes the BF (Boundary F1) contour matching score between the predicted segmentation in预言以及真正的细分地面.预言地面can be a pair of logical arrays for binary segmentation, or a pair of label or categorical arrays for multiclass segmentation.

[score,精确,记起] = bfscore(预言,地面)还返回预言image compared to the地面图片。

[___] = bfscore(预言,地面,临界点)computes the BF score using a specified threshold as the distance error tolerance, to decide whether a boundary point has a match or not.

例子

collapse all

Read an image with an object to segment. Convert the image to grayscale, and display the result.

一个= imread('hands.jpg');i = im2gray(a);图IMShow(i)标题('Original Image')

图包含一个轴对象。The axes object with title Original Image contains an object of type image.

Use the active contours (snakes) method to segment the hand.

mask = false(size(i));蒙版(25:End-25,25:End-25)= true;bw = activeContour(i,mask,300);

阅读地面真理细分。

bw_groundTruth = imread('hands1 mask.png');

Compute the BF score of the active contours segmentation against the ground truth.

相似性= bfscore(bw,bw_groundTruth);

Display the masks on top of each other. Colors indicate differences in the masks.

figure imshowpair(BW, BW_groundTruth) title(['BF Score = 'num2str(相似性)])

图包含一个轴对象。标题BF分数= 0.76266的轴对象包含一个类型图像的对象。

此示例显示了如何将图像分割为多个区域。然后,该示例计算每个区域的BF分数。

Read an image with several regions to segment.

rgb = imread('yellowlily.jpg');

为区分其典型颜色特征的三个区域创建涂鸦。第一个区域将黄花分类。第二区将绿色的茎和叶子分类。最后一个区域将棕色污垢分为图像的两个单独的斑块。区域由4个元素向量指定,其元素表示ROI左上角的X和Y坐标,ROI的宽度和ROI的高度。

区域1 = [350 700 425 120];% [x y w h] formatbw1 = false(size(rgb,1),大小(RGB,2));BW1(区域1(2):区域1(2)+区域1(4),区域1(1):区域1(1)+区域1(3))= true;区域2 = [800 1124 120 230];bw2 = false(size(rgb,1),大小(RGB,2));BW2(区域2(2):区域2(2)+区域2(4),区域2(1):region2(1)+reignes2(3))= true;区域3 = [20 1320 480 200;1010 290 180 240];bw3 = false(size(rgb,1),大小(RGB,2));BW3(区域3(1,2):区域3(1,2)+区域3(1,4),区域3(1,1):区域3(1,1)+区域3(1,3))= true;BW3(区域3(2,2):区域3(2,2)+区域3(2,4),区域3(2,1):区域3(2,1)+区域3(2,3))= true;

Display the seed regions on top of the image.

图IMShow(RGB)保持visboundaries(BW1,'颜色','r');visboundaries(BW2,'颜色','g');visboundaries(BW3,'颜色','b');标题(“种子地区”)

图包含一个轴对象。带有标题种子区域的轴对象包含7个类型线的对象,图像。

使用基于测量距离的颜色分割,将图像分为三个区域。

L = imseggeodesic(RGB,BW1,BW2,BW3,'AdaptiveChannelWeighting',true);

Load a ground truth segmentation of the image.

l_groundTruth = double(imread(imread)('yellowlily-segmented.png'));

Visually compare the segmentation results with the ground truth.

figure imshowpair(label2rgb(L),label2rgb(L_groundTruth),'montage') 标题('Comparison of Segmentation Results (Left) and Ground Truth (Right)')

图包含一个轴对象。轴对象具有标题比较分割结果(左)和地面真实(右)的对象,其中包含一个类型图像的对象。

Compute the BF score for each segmented region.

similarity = bfscore(L, L_groundTruth)
similarity =3×10.7992 0.5333 0.7466

The BF score is noticeably smaller for the second region. This result is consistent with the visual comparison of the segmentation results, which erroneously classifies the dirt in the lower right corner of the image as leaves.

Input Arguments

collapse all

预测分割,指定为2-D或3-D逻辑,数字或分类array. If预言is a numeric array, then it represents a label array and must contain nonnegative integers of data typedouble.

Data Types:logical|double|分类

Ground truth segmentation, specified as a 2-D or 3-D logical, numeric, or分类大小和数据类型的数组与预言. If地面is a numeric array, then it represents a label array and must contain nonnegative integers of data typedouble.

Data Types:logical|double|分类

像素中的距离误差公差阈值,指定为正标量。阈值确定边界点是否具有匹配。如果临界点未指定,那么默认值是图像对角线长度的0.75%。

例子:3

Data Types:double

Output Arguments

collapse all

BF分数,作为数字标量或向量返回,值在[0,1]中。一个score1表示相应类中对象的轮廓预言地面are a perfect match. If the input arrays are:

  • logical arrays,scoreis a scalar and represents the BF score of the foreground.

  • label or categorical arrays,scoreis a vector. The first coefficient inscoreis the BF score for the first foreground class, the second coefficient is the score for the second foreground class, and so on.

精度,作为数字标量或数字向量返回,其值在[0,1]中。每个元素表示相应前景类中对象轮廓的精度。

精确是预测分割边界上的点数的比率,该点足够接近地面真理分割的边界与预测边界的长度。换句话说,精度是真实阳性而不是误报的检测部分。

召回,作为数字标量或数字向量返回,其值[0,1]。每个元素表示相应前景类中对象轮廓的回忆。

Recall是地面真相分割边界上的点数的比率足够接近预测分割的边界与地面真相边界的长度。换句话说,回忆是检测到而不是错过的真实阳性的一部分。

More About

collapse all

BF (Boundary F1) Score

The BF score measures how close the predicted boundary of an object matches the ground truth boundary.

BF分数定义为谐波平均值(F1量)精确记起具有距离误差的值,以决定预测边界上的点是否在地面真相边界上具有匹配。

score= 2 *精确*记起/ (记起+精确)

参考

[1] Csurka, G., D. Larlus, and F. Perronnin. "What is a good evaluation measure for semantic segmentation?"Proceedings of the British Machine Vision Conference,2013年,第32.1-32.11页。

Version History

Introduced in R2017b

See Also

|