我正在读报纸:费拉里等人在“亲和力测量”一节。我了解法拉利等人。试图通过以下方式获得亲和力:
然而,我有两个主要问题:
对上述问题有何建议或解决办法?非常感谢您的帮助。
发布于 2015-02-25 18:25:34
1)有两个重叠的边框。计算框的交集,这是重叠的区域。计算重叠框的总和,即整个框的面积之和减去重叠区域的面积。然后你把交叉口除以工会。计算机视觉系统工具箱中有一个名为bboxOverlapRatio的函数。
2)一般来说,你不想连接彩色通道。相反,你需要的是一个三维直方图,其中的维数是H、S和V。
发布于 2017-01-15 11:41:04
试着在联合路口交叉路口
在Union上的交集是一种评估指标,用于测量特定数据集上的对象检测器的精度。
更正式地说,为了在Union上应用交集来评估(任意)对象检测器,我们需要:
下面我包含了一个地面真相包围框和预测边界框的视觉示例:

预测的包围框用红色绘制,而地面真值(即用手标记的)包围框用绿色绘制。
在上面的图中,我们可以看到我们的目标检测器已经在图像中检测到一个停止标志的存在。
因此,可以通过以下方法确定Union上的计算交叉口:

只要我们有这两组包围框,我们就可以在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 iougt和pred是
gt:地面-真相包围盒.pred:从我们的模型中预测的包围盒。有关更多信息,请单击这个职位
发布于 2019-04-26 19:14:31
目前的答案已经清楚地解释了这个问题。因此,在这里,我提供了一个更好的IoU版本,当两个边界框不相交时,它不会中断。
import numpy as np
def IoU(box1: np.ndarray, box2: np.ndarray):
"""
calculate intersection over union cover percent
:param box1: box1 with shape (N,4) or (N,2,2) or (2,2) or (4,). first shape is preferred
:param box2: box2 with shape (N,4) or (N,2,2) or (2,2) or (4,). first shape is preferred
:return: IoU ratio if intersect, else 0
"""
# first unify all boxes to shape (N,4)
if box1.shape[-1] == 2 or len(box1.shape) == 1:
box1 = box1.reshape(1, 4) if len(box1.shape) <= 2 else box1.reshape(box1.shape[0], 4)
if box2.shape[-1] == 2 or len(box2.shape) == 1:
box2 = box2.reshape(1, 4) if len(box2.shape) <= 2 else box2.reshape(box2.shape[0], 4)
point_num = max(box1.shape[0], box2.shape[0])
b1p1, b1p2, b2p1, b2p2 = box1[:, :2], box1[:, 2:], box2[:, :2], box2[:, 2:]
# mask that eliminates non-intersecting matrices
base_mat = np.ones(shape=(point_num,))
base_mat *= np.all(np.greater(b1p2 - b2p1, 0), axis=1)
base_mat *= np.all(np.greater(b2p2 - b1p1, 0), axis=1)
# I area
intersect_area = np.prod(np.minimum(b2p2, b1p2) - np.maximum(b1p1, b2p1), axis=1)
# U area
union_area = np.prod(b1p2 - b1p1, axis=1) + np.prod(b2p2 - b2p1, axis=1) - intersect_area
# IoU
intersect_ratio = intersect_area / union_area
return base_mat * intersect_ratiohttps://stackoverflow.com/questions/28723670
复制相似问题