修改
utils/metrics.py
ConfusionMatrix
def process_batch(self, detections, gt_bboxes, gt_cls):
"""
Update confusion matrix for object detection task.
Args:
detections (Array[N, 6] | Array[N, 7]): Detected bounding boxes and their associated information.
Each row should contain (x1, y1, x2, y2, conf, class)
or with an additional element `angle` when it's obb.
gt_bboxes (Array[M, 4]| Array[N, 5]): Ground truth bounding boxes with xyxy/xyxyr format.
gt_cls (Array[M]): The class labels.
"""
if gt_cls.shape[0] == 0: # Check if labels is empty
if detections is not None:
detections = detections[detections[:, 4] > self.conf]
if detections.shape[0] == 0:
self.matrix[self.nc, self.nc] += 1 # true background
else:
detection_classes = detections[:, 5].int()
for dc in detection_clas

最低0.47元/天 解锁文章
702

被折叠的 条评论
为什么被折叠?



