本文主要是介绍交并比及非最大值抑制,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、交并比IOU(Intersection-over-Union,IoU)
- 交并比
交并比越大,两个包围盒(bounding boxes)的重叠程度越高 - python实现(可参考Intersection over Union (IoU) for object detection)
def iou(box1, box2):"""Implement the intersection over union (IoU) between box1 and box2Arguments:box1 -- first box, list object with coordinates (x1, y1, x2, y2)box2 -- second box, list object with coordinates (x1, y1, x2, y2)"""# Calculate the (y1, x1, y2, x2) coordinates of the intersection of box1 and box2. Calculate its Areaxi1 = max(box1[0], box2[0])yi1 = max(box1[1], box2[1])xi2 = min(box1[2], box2[2])yi2 = min(box1[3], box2[3]
这篇关于交并比及非最大值抑制的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!