Commit c6622682 authored by mibaumgartner's avatar mibaumgartner
Browse files

improve robustness

parent 537a3032
......@@ -96,7 +96,8 @@ class DetectionEvaluator(AbstractEvaluator):
dict: empty dict... detection metrics can only be evaluated at the end
"""
if gt_ignore is None:
gt_ignore = [np.zeros(gt_boxes_img.shape[0]).reshape(-1) for gt_boxes_img in gt_boxes]
n = [0 if gt_boxes_img.size == 0 else gt_boxes_img.shape[0] for gt_boxes_img in gt_boxes]
gt_ignore = [np.zeros(_n).reshape(-1) for _n in n]
self.results_list.extend(matching_batch(
self.iou_fn, self.iou_thresholds, pred_boxes=pred_boxes, pred_classes=pred_classes,
......
......@@ -197,7 +197,8 @@ def _matching_no_pred(
dt_match = np.array([[]] * len(iou_thresholds))
dt_ignore = np.array([[]] * len(iou_thresholds))
gt_match = np.zeros((len(iou_thresholds), len(gt_ignore)))
n_gt = 0 if gt_ignore.size == 0 else gt_ignore.shape[0]
gt_match = np.zeros((len(iou_thresholds), n_gt))
return {
'dtMatches': dt_match, # [T, D], where T = number of thresholds, D = number of detections
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment