From d29a21d9af2c71ae4d42408cda9858a07d4edae4 Mon Sep 17 00:00:00 2001 From: "Kwabena W. Agyeman" Date: Sun, 2 Nov 2025 23:02:45 -0800 Subject: [PATCH 1/2] models/ulab: Update ULAB to 6.11.0. --- modules/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ulab b/modules/ulab index 20f7259a4..a8b25eff3 160000 --- a/modules/ulab +++ b/modules/ulab @@ -1 +1 @@ -Subproject commit 20f7259a471fe180ad64279a6970eb991537cffb +Subproject commit a8b25eff3eea742b949012e512de7c69886e7794 From f03a84483696dc56cff2bf7fadf0eca2c5bd2e11 Mon Sep 17 00:00:00 2001 From: "Kwabena W. Agyeman" Date: Sun, 2 Nov 2025 23:03:04 -0800 Subject: [PATCH 2/2] scripts/libraries: Use new mod operator in ulab. --- scripts/libraries/ml/ml-core/ml/utils.py | 4 ---- scripts/libraries/ml/ml-darknet/ml/postprocessing/darknet.py | 4 ++-- .../ml/ml-edgeimpulse/ml/postprocessing/edgeimpulse.py | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/libraries/ml/ml-core/ml/utils.py b/scripts/libraries/ml/ml-core/ml/utils.py index 19e17bd41..fb2621360 100644 --- a/scripts/libraries/ml/ml-core/ml/utils.py +++ b/scripts/libraries/ml/ml-core/ml/utils.py @@ -38,10 +38,6 @@ def sigmoid(x): return 1.0 / (1.0 + np.exp(-x)) -def mod(a, b): - return a - (b * (a // b)) - - def threshold(scores, threshold, scale, find_max=False, find_max_axis=1): if scale > 0: if find_max: diff --git a/scripts/libraries/ml/ml-darknet/ml/postprocessing/darknet.py b/scripts/libraries/ml/ml-darknet/ml/postprocessing/darknet.py index f9d21e3c2..f81ee42df 100644 --- a/scripts/libraries/ml/ml-darknet/ml/postprocessing/darknet.py +++ b/scripts/libraries/ml/ml-darknet/ml/postprocessing/darknet.py @@ -85,8 +85,8 @@ class YoloV2: # Extract rows, columns, and anchor indices bb_rows = score_indices // (ow * self.anchors_len) - bb_cols = mod(score_indices // self.anchors_len, ow) - bb_anchors = mod(score_indices, self.anchors_len) + bb_cols = (score_indices // self.anchors_len) % ow + bb_anchors = score_indices % self.anchors_len # Get the anchor box information bb_a_array = np.take(self.anchors, bb_anchors, axis=0) diff --git a/scripts/libraries/ml/ml-edgeimpulse/ml/postprocessing/edgeimpulse.py b/scripts/libraries/ml/ml-edgeimpulse/ml/postprocessing/edgeimpulse.py index d2d139b78..612b3222c 100644 --- a/scripts/libraries/ml/ml-edgeimpulse/ml/postprocessing/edgeimpulse.py +++ b/scripts/libraries/ml/ml-edgeimpulse/ml/postprocessing/edgeimpulse.py @@ -64,7 +64,7 @@ class Fomo: # Extract rows and columns bb_rows = score_indices // ow - bb_cols = mod(score_indices, ow) + bb_cols = score_indices % ow # Get the score information bb_scores = np.max(bb[:, _FOMO_CLASSES:], axis=1)