From 5ec0bcfdfa669ee4a9b4a5caf4eb2e8d427c8370 Mon Sep 17 00:00:00 2001 From: "Kwabena W. Agyeman" Date: Thu, 15 May 2025 15:29:45 -0700 Subject: [PATCH] scripts/libraries: Fix axis used for gathering bounding box results. len(bb) returns the row count but bb.shape[0] is better to use. --- scripts/libraries/ml/ml/postprocessing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/libraries/ml/ml/postprocessing.py b/scripts/libraries/ml/ml/postprocessing.py index ba8fcffde..bc36a4dc2 100644 --- a/scripts/libraries/ml/ml/postprocessing.py +++ b/scripts/libraries/ml/ml/postprocessing.py @@ -140,7 +140,7 @@ class yolo_v2_postprocess: h_rel = h_rel * ih nms = NMS(iw, ih, inputs[0].roi) - for i in range(len(bb)): + for i in range(bb.shape[0]): nms.add_bounding_box(x_center[i] - (w_rel[i] / 2), y_center[i] - (h_rel[i] / 2), x_center[i] + (w_rel[i] / 2), @@ -198,7 +198,7 @@ class yolo_v5_postprocess: ymax = (y_center + h_rel) * ih nms = NMS(iw, ih, inputs[0].roi) - for i in range(len(bb)): + for i in range(bb.shape[0]): nms.add_bounding_box(xmin[i], ymin[i], xmax[i], ymax[i], bb_scores[i], bb_classes[i]) return nms.get_bounding_boxes(threshold=self.nms_threshold, sigma=self.nms_sigma)