Why Dice Coefficient and not IOU for segmentation tasks?

柔情痞子 提交于 2021-02-08 08:47:14

问题


I have seen people using IOU as the metric for detection tasks and Dice Coeff for segmentation tasks. The two metrics looks very much similar in terms of equation except that dice gives twice the weightage to the intersection part. If I am correct, then

Dice: (2 x (A*B) / (A + B))
IOU : (A * B) / (A + B) 

Is there any particular reason for preferring dice for segmentation and IOU for detection?


回答1:


This is not exactly right.

The Dice coefficient (also known as the Sørensen–Dice coefficient and F1 score) is defined as two times the area of the intersection of A and B, divided by the sum of the areas of A and B:

Dice = 2 |A∩B| / (|A|+|B|) = 2 TP / (2 TP + FP + FN)

(TP=True Positives, FP=False Positives, FN=False Negatives)

The IOU (Intersection Over Union, also known as the Jaccard Index) is defined as the area of the intersection divided by the area of the union:

Jaccard = |A∩B| / |A∪B| = TP / (TP + FP + FN)

Note that the sum of the areas of A and B is not the same as the area of the union of A and B. In particular, if there is 100% overlap, then the one is twice the other. This is the reason of the "two times" in the Dice coefficent: they are both defined such that, with 100% overlap, the values are 1, and with 0% overlap the values are 0.

Which one to use depends on personal preference and customs in each field. That you see one used more in one field is related more to chance than anything else. Someone started using the Dice coefficient for segmentation, and other people just followed along. Someone started using IOU for detection, and other people just followed along.



来源:https://stackoverflow.com/questions/60268728/why-dice-coefficient-and-not-iou-for-segmentation-tasks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!