https://www.pyimagesearch.com/2016/11/07/intersection-over-union-iou-for-object-detection/
绿色代表ground truth box,红色代表predictive box.
ground truth box 需要手动标注,predictive box是你选用的模型计算出来的结果。
将两者放在一起用IOU来衡量我们的模型检测目标的有效性。
从下图你可以很直观的看到IoU的计算。
从python编程的角度实现
def
bb_intersection_over_union
(
boxA
,
boxB
)
:
# determine the (x, y)-coordinates of the intersection rectangle
xA
=
max
(
boxA
[
0
]
,
boxB
[
0
]