Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Compare segmentation result to ground truth

I have some contours which represent certain objects found with cv2.findContours() in a segmentation result. On the other hand, I also have the ground truth data in the same format (polygon points in [x, y]). I'm now looking for the best way to measure the intersection/overlap of both polygons to measure how well the segmentation performed.

Thank you in advance!

Compare segmentation result to ground truth

I have some contours which represent certain objects found with cv2.findContours() in a segmentation result. On the other hand, I also have the ground truth data in the same format (polygon points in [x, y]). I'm now looking for the best way to measure the intersection/overlap of both polygons to measure how well the segmentation performed.

Thank you in advance!

-- Update --

To add in some context, here's for example the data from one contour found with cv2.findContours():

[[[1086  603]],[[1085  605]],[[1078  605]],[[1076  606]],[[1073  606]],[[1071  608]],[[1068  608]],[[1066  610]],[[1065  610]],[[1061  6,3]],[[1060  613]],[[1060  615]],[[1058  616]],[[1058  625]],[[1060  626]],[[1060  636]],[[1061  638]],[[1061  650]],[[1063  651]],[[1063  658]],[[1061  660]],[[1063  661]],[[1063  671]],[[1065  673]],[[1065  676]],[[1066  678]],[[1066  681]],[[1068  683]],[[1068  701]],[[1070  703]],[[1070  713]],[[1075  718]],[[1078  718]],[[1080  720]],[[1101  720]],[[1103  718]],[[1106  718]],[[1110  715]],[[1111  715]],[[1115  711]],[[1116  711]],[[1118  710]],[[1118  708]],[[1120  706]],[[1120  703]],[[1121  701]],[[1121  683]],[[1123  681]],[[1123  670]],[[1121  668]],[[1121  615]],[[1120  613]],[[1120  611]],[[1118  610]],[[1113  610]],[[1111  608]],[[1108  608]],[[1106  606]],[[1103  606]],[[1101  605]],[[1088  605]]]

And this is the ground truth data:

[[1054, 625], [1070, 719], [1084, 726], [1112, 724], [1125, 716], [1126, 631], [1128, 619], [1132, 610], [1127, 603], [1118, 602], [1107, 600], [1090, 600], [1074, 603], [1059, 607], [1049, 614], [1051, 620]]

Compare segmentation result to ground truth

I have some contours which represent certain objects found with cv2.findContours() in a segmentation result. On the other hand, I also have the ground truth data in the same format (polygon points in [x, y]). I'm now looking for the best way to measure the intersection/overlap of both polygons to measure how well the segmentation performed.

Thank you in advance!

-- Update --

To add in some context, here's for example the data from one contour found with cv2.findContours():

[[[1086  603]],[[1085  605]],[[1078  605]],[[1076  606]],[[1073  606]],[[1071  608]],[[1068  608]],[[1066  610]],[[1065  610]],[[1061  6,3]],[[1060  613]],[[1060  615]],[[1058  616]],[[1058  625]],[[1060  626]],[[1060  636]],[[1061  638]],[[1061  650]],[[1063  651]],[[1063  658]],[[1061  660]],[[1063  661]],[[1063  671]],[[1065  673]],[[1065  676]],[[1066  678]],[[1066  681]],[[1068  683]],[[1068  701]],[[1070  703]],[[1070  713]],[[1075  718]],[[1078  718]],[[1080  720]],[[1101  720]],[[1103  718]],[[1106  718]],[[1110  715]],[[1111  715]],[[1115  711]],[[1116  711]],[[1118  710]],[[1118  708]],[[1120  706]],[[1120  703]],[[1121  701]],[[1121  683]],[[1123  681]],[[1123  670]],[[1121  668]],[[1121  615]],[[1120  613]],[[1120  611]],[[1118  610]],[[1113  610]],[[1111  608]],[[1108  608]],[[1106  606]],[[1103  606]],[[1101  605]],[[1088  605]]]

And this is the ground truth data:

[[1054, 625], [1070, 719], [1084, 726], [1112, 724], [1125, 716], [1126, 631], [1128, 619], [1132, 610], [1127, 603], [1118, 602], [1107, 600], [1090, 600], [1074, 603], [1059, 607], [1049, 614], [1051, 620]]

(Ignore the extra array, this is just to give an example)

Compare segmentation result to ground truth

I have some contours which represent certain objects found with cv2.findContours() in a segmentation result. On the other hand, I also have the ground truth data in the same format (polygon points in [x, y]). I'm now looking for the best way to measure the intersection/overlap of both polygons to measure how well the segmentation performed.

Thank you in advance!

-- Update --

To add in some context, here's for example the data from one contour found with cv2.findContours():

[[[1086  603]],[[1085  605]],[[1078  605]],[[1076  606]],[[1073  606]],[[1071  608]],[[1068  608]],[[1066  610]],[[1065  610]],[[1061  6,3]],[[1060  613]],[[1060  615]],[[1058  616]],[[1058  625]],[[1060  626]],[[1060  636]],[[1061  638]],[[1061  650]],[[1063  651]],[[1063  658]],[[1061  660]],[[1063  661]],[[1063  671]],[[1065  673]],[[1065  676]],[[1066  678]],[[1066  681]],[[1068  683]],[[1068  701]],[[1070  703]],[[1070  713]],[[1075  718]],[[1078  718]],[[1080  720]],[[1101  720]],[[1103  718]],[[1106  718]],[[1110  715]],[[1111  715]],[[1115  711]],[[1116  711]],[[1118  710]],[[1118  708]],[[1120  706]],[[1120  703]],[[1121  701]],[[1121  683]],[[1123  681]],[[1123  670]],[[1121  668]],[[1121  615]],[[1120  613]],[[1120  611]],[[1118  610]],[[1113  610]],[[1111  608]],[[1108  608]],[[1106  606]],[[1103  606]],[[1101  605]],[[1088  605]]]

And this is the ground truth data:

[[1054, 625], [1070, 719], [1084, 726], [1112, 724], [1125, 716], [1126, 631], [1128, 619], [1132, 610], [1127, 603], [1118, 602], [1107, 600], [1090, 600], [1074, 603], [1059, 607], [1049, 614], [1051, 620]]

(Ignore the extra array, mismatch of arrays between the contours data and ground truth, this is just to give an example)example.)