From f106e301774d2bb9c1c5e063d94301bba9f7e3d0 Mon Sep 17 00:00:00 2001 From: vivinousi <32997432+vivinousi@users.noreply.github.com> Date: Thu, 18 Aug 2022 12:17:46 +0300 Subject: [PATCH] DetectionDataset evaluation fix for empty detections (#285) --- src/opendr/perception/object_detection_2d/utils/eval_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/opendr/perception/object_detection_2d/utils/eval_utils.py b/src/opendr/perception/object_detection_2d/utils/eval_utils.py index ef4674ce3c..772a655b77 100644 --- a/src/opendr/perception/object_detection_2d/utils/eval_utils.py +++ b/src/opendr/perception/object_detection_2d/utils/eval_utils.py @@ -267,7 +267,8 @@ def update(self, det_boxes, det_labels, det_scores, gt_boxes, gt_labels, gt_diff if score < self.score_threshold: continue img_dets.append(np.asarray([image['id'], box[0], box[1], box[2] - box[0], box[3] - box[1], score, cls])) - self.detections.append(np.asarray(img_dets)) + if img_dets: + self.detections.append(np.asarray(img_dets)) for box_idx, box in enumerate(gt_boxes[idx, :, :]): cls = gt_labels[idx, box_idx]