From 46f06c8dd9c5231e5cb27910d4e1fcbdcf1be8f0 Mon Sep 17 00:00:00 2001 From: usmank13 <44714651+usmank13@users.noreply.github.com> Date: Fri, 1 Mar 2024 06:54:25 -0800 Subject: [PATCH] Fix an IndexError edge case (#84) There was an index error that occurs sometimes when running a custom edge tpu model. Disagreement between count and len(scores). Confirmed that this resolves the bug --- pycoral/adapters/detect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pycoral/adapters/detect.py b/pycoral/adapters/detect.py index f7b63cd..e1db1ee 100644 --- a/pycoral/adapters/detect.py +++ b/pycoral/adapters/detect.py @@ -234,4 +234,4 @@ def make(i): bbox=BBox(xmin=xmin, ymin=ymin, xmax=xmax, ymax=ymax).scale(sx, sy).map(int)) - return [make(i) for i in range(count) if scores[i] >= score_threshold] + return [make(i) for i in range(len(scores)) if scores[i] >= score_threshold]