语义分割metric

Precision, Recall Rate, and F-score

一般用来评估图像分割中的边缘检测问题。准确度是检测出的像素中是边缘的比例,召回率是检测出的正确边缘占所有边缘的比例,F-score是两者的调和平均数。

precision=detectedtrueboundarypixelsdetectedboundarypixels

recall=detectedtrueboundarypixelsalltrueboundarypixels

Fscore=2precicionrecallpresicion+recall

Pixel error

评估图像分割问题最简单的方法。比较预测的label和实际的label,错误的点除以总数,就是像素误差。对于二值掩膜来说,欧式距离和汉明距离的结果相同。

优点是简单,但是对于位置的偏移过分敏感,肉眼不可见的偏移都会产生大量的像素误差。

Rand error

兰德指数是两个数据聚类的相似性评价方法,改造之后用来衡量分割性能,因为分割可以看作是聚成类的像素。

给定一张图片S,有n个像素点,同时有两个分割X和Y(实际和预测?)

  • a:两个分割中同属于一个聚类的像素点数量
  • b:两个分割中都不属于一个聚类的像素点数量

Rand指数:

Rand index=RI=a+bC2n

RI是用来衡量相似度的,越高越好,和误差相反,因此兰德误差如下:
RE=1RI

兰德误差作为不一致的度量,是两个分割对一对像素是否属于或者不属于同一个聚类的频率。

Warping error

当大致检测出来一个目标,用Pixel error会发现误差很大,但实际上这个分割可能看着很好。在这种情况中,pixel error和rand error不是一个好的选择。

warping error主要来衡量分割目标的拓扑形状效果。给定 L 的pixel error,候选标注T(预测值)和参考标注 L (实际值)的warping error可以认为是 L 和对于T最好的 L 的汉明距离。

D(T||L)=minLL||TL||2

目标检测评价函数intersection-over-union ( IOU )

模型产生的目标窗口和原来标记窗口的交叠率。具体我们可以简单的理解为: 即检测结果(DetectionResult)与 Ground Truth 的交集比上它们的并集,即为检测的准确率 IoU :

IOU=DetectionResultGroundTruthDetectionResultGroundTruth

如下图所示,GT = GroundTruth; DR = DetectionResult

  • 黄色框框起来的是 GTDR
  • 绿色框框起来的是 GTDR
  • 最理想的情况是刚好重合,那么这个值为1

可以使用矩形来框面积,使用图像分割中的掩膜。

程序如下:

# -*- coding: utf-8 -*-
"""
Created on Sun Aug 07 14:26:51 2016

@author: Eddy_zheng
"""

def IOU(Reframe,GTframe):
    """
    自定义函数,计算两矩形 IOU,传入为均为矩形对角线,(x,y)  坐标。·
    """
    x1 = Reframe[0];
    y1 = Reframe[1];
    width1 = Reframe[2]-Reframe[0];
    height1 = Reframe[3]-Reframe[1];

    x2 = GTframe[0];
    y2 = GTframe[1];
    width2 = GTframe[2]-GTframe[0];
    height2 = GTframe[3]-GTframe[1];

    endx = max(x1+width1,x2+width2);
    startx = min(x1,x2);
    width = width1+width2-(endx-startx);

    endy = max(y1+height1,y2+height2);
    starty = min(y1,y2);
    height = height1+height2-(endy-starty);

    if width <=0 or height <= 0:
        ratio = 0 # 重叠率为 0 
    else:
        Area = width*height; # 两矩形相交面积
        Area1 = width1*height1; 
        Area2 = width2*height2;
        ratio = Area*1./(Area1+Area2-Area);
    # return IOU
    return ratio,Reframe,GTframe

参考资料

https://imagej.net/Topology_preserving_warping_error
Zhu F, Liu Q, Fu Y, et al. Segmentation of Neuronal Structures Using SARSA (λ)-Based Boundary Amendment with Reinforced Gradient-Descent Curve Shape Fitting[J]. Plos One, 2014, 9(3):e90873.
http://blog.csdn.net/eddy_zheng/article/details/52126641

猜你喜欢

转载自blog.csdn.net/Asun0204/article/details/79002875