介绍图像分割常用的评价指标
前置内容
判定/事实 |
正 |
负 |
正 |
TP |
FP |
负 |
FN |
TN |
Dice相似系数
-
Dice Similariy Coefficient, DSC
-
集合相似度度量指标,计算两个样本的相似度,范围0(最坏)~1(最好)
-
Dice=FP+2TP+FN2TP
-
pytorch代码:
1 2 3 4 5 6 7 8 9
| def dice_coef(output, target): smooth = 1e-5 if torch.is_tensor(output): output = torch.sigmoid(output).data.cpu().numpy() if torch.is_tensor(target): target = target.data.cpu().numpy() intersection = (output * target).sum() return (2. * intersection + smooth) / \ (output.sum() + target.sum() + smooth)
|
IOU
1 2 3 4 5 6 7 8 9 10 11
| def iou_score(output, target): smooth = 1e-5 if torch.is_tensor(output): output = torch.sigmoid(output).data.cpu().numpy() if torch.is_tensor(target): target = target.data.cpu().numpy() output_ = output > 0.5 target_ = target > 0.5 intersection = (output_ & target_).sum() union = (output_ | target_).sum() return (intersection + smooth) / (union + smooth)
|
参考文章
分割常用评价指标Dice、Hausdorff_95、IOU、PPV等(打马)