尝试在Union上交叉
联合上的交集是一种评估指标,用于测量特定数据集上对象检测器的准确性。
更正式地讲,为了将“相交于联合”应用于评估(任意)对象检测器,我们需要:
- 真实边界框(即来自测试集中的标有标签的边界框,用于指定对象在图像中的位置)。
- 我们模型的预测边界框。
下面,我提供了一个真实的边界框与预测的边界框的可视示例:
预测边界框用红色绘制,而地面真相(即,手工标记)边界框用绿色绘制。
在上图中,我们可以看到我们的物体检测器已经检测到图像中存在停车标志。
因此,可以通过以下方式确定联合上的计算交叉口:
只要我们有这两套边界框,就可以将“相交”应用于“联合”。
这是Python代码
# import the necessary packages
from collections import namedtuple
import numpy as np
import cv2
# define the `Detection` object
Detection = namedtuple("Detection", ["image_path", "gt", "pred"])
def bb_intersection_over_union(boxA, boxB):
# determine the (x, y)-coordinates of the intersection rectangle
xA = max(boxA[0], boxB[0])
yA = max(boxA[1], boxB[1])
xB = min(boxA[2], boxB[2])
yB = min(boxA[3], boxB[3])
# compute the area of intersection rectangle
interArea = (xB - xA) * (yB - yA)
# compute the area of both the prediction and ground-truth
# rectangles
boxAArea = (boxA[2] - boxA[0]) * (boxA[3] - boxA[1])
boxBArea = (boxB[2] - boxB[0]) * (boxB[3] - boxB[1])
# compute the intersection over union by taking the intersection
# area and dividing it by the sum of prediction + ground-truth
# areas - the interesection area
iou = interArea / float(boxAArea + boxBArea - interArea)
# return the intersection over union value
return iou
gt
和pred
是
-
gt
:真实边界框。 -
pred
:模型预测的边界框。
有关更多信息,您可以单击此帖子
0
我正在读报纸: 法拉利(Ferrari)等。在“亲和力度量”部分中。我了解法拉利等人。尝试通过以下方式获取亲和力:
但是,我有两个主要问题:
对上述问题有任何建议或解决方案吗?谢谢,非常感谢您的帮助。