Semantic Segmentation most commonly used are three indicators. For convenience of explanation, first need to introduce confusion matrix, as follows:
Confusion matrix |
actual value |
||
Positive |
Negative |
||
Predictive value
|
Positive |
True Positive (TP) true positive |
False Positive (FP) false positive |
Negative |
False Negative (FN) false negative |
True Negative (TN) true negative |
First, we assume there dataset class k + 1 (0 ... k), 0 usually represents a background.
Using P II expressed simultaneously originally predicted class i class i, i.e., true positive (TP) and true negative (TN).
P ij of expressed i originally predicted class is the class j, i.e., false positive (FP) and false negatives (FN).
If the class i is a positive type, when i! = J, the then P II represents TP, P JJ represents the TN, P ij of showing the FP, P JI denotes FN.
1) Pixel Accuracy, pixel accuracy is properly marked total percentage of pixels of the pixel. Formula is as follows:
2) Recall, recall rate is prediction value of the true value and a ratio of the sample 1 is also occupied in all samples of the real value of 1. Formula is as follows:
3) Mean IoU (mean intersection over union), and has been used both cross ratio as a standard measure of semantic segmentation people. IoU formula is as follows:
Mean IoU IOU is averaged over all categories. The formula is as follows:
In the classic paper "Fully Convolutional Networks for Semantic Segmentation" is also the definition of relevant indicators, but in general the same as defined above.
对一张需要预测的图来讲,图中有背景(0)和2类标签(1、2),共计46 + 34 + 20 = 100个像素点数。如下图所示:
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 2 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 2 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 2 |
0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 2 | 2 |
0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 2 | 2 |
0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 2 | 2 |
0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 2 | 2 |
0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 2 | 2 |
0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 2 | 2 |
0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 2 | 2 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 2 |
0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 2 | 2 |
1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 2 | 2 |
0 | 1 | 1 | 1 | 1 | 1 | 0 | 2 | 2 | 2 |
0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 2 | 2 |
0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 2 | 2 |
1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 2 |
1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 2 |
如上所示,第一幅图为GT所标注出来的真实类别情况,第二幅图为预测的类别情况。
则首先计算混淆函数:
混淆矩阵 |
真实值(46、34、20) |
|||
类别0 |
类别1 |
类别2 |
||
预测值 |
类别0 |
40 |
4 |
6 |
类别1 |
5 |
30 |
0 |
|
类别2 |
1 |
0 |
14 |
求法:
对角线上的值 / 对角线所在行、列其它值之和 + 对角线值
则:
类别0的IoU:40 /(40 + 4 + 6 + 5 + 1) = 0.714
类别1的IoU:30 /(5 + 30 + 0 + 4 + 0) = 0.769
类别1的IoU:14 /(1 + 0 + 14 + 6 + 0) = 0.667
Mean IoU:(1 / 3)*(0.714 + 0.769 + 0.667 ) = 0.717