From 4f5f629e06a58a799aa38817f82f56921152e7a2 Mon Sep 17 00:00:00 2001 From: Mateo Date: Mon, 31 Jul 2023 20:41:22 +0200 Subject: [PATCH 1/2] limit bbox size --- pyroengine/engine.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyroengine/engine.py b/pyroengine/engine.py index 32c424c1..f6d9bb0e 100644 --- a/pyroengine/engine.py +++ b/pyroengine/engine.py @@ -251,6 +251,10 @@ def _update_states(self, frame: Image.Image, preds: np.array, cam_key: str) -> b else: output_predictions = combine_predictions + # Limit bbox size in api + output_predictions = np.round(output_predictions, 3) # max 3 digit + output_predictions = output_predictions[:5, :] # max 5 bbox + self._states[cam_key]["last_predictions"].append( (frame, preds, str(json.dumps(output_predictions.tolist())), datetime.utcnow().isoformat(), False) ) From 16df071b41cf14bce2faa118ade8ac0c94af0b5b Mon Sep 17 00:00:00 2001 From: Mateo Date: Mon, 31 Jul 2023 20:44:23 +0200 Subject: [PATCH 2/2] style --- pyroengine/engine.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyroengine/engine.py b/pyroengine/engine.py index f6d9bb0e..4ab06fbd 100644 --- a/pyroengine/engine.py +++ b/pyroengine/engine.py @@ -252,8 +252,8 @@ def _update_states(self, frame: Image.Image, preds: np.array, cam_key: str) -> b output_predictions = combine_predictions # Limit bbox size in api - output_predictions = np.round(output_predictions, 3) # max 3 digit - output_predictions = output_predictions[:5, :] # max 5 bbox + output_predictions = np.round(output_predictions, 3) # max 3 digit + output_predictions = output_predictions[:5, :] # max 5 bbox self._states[cam_key]["last_predictions"].append( (frame, preds, str(json.dumps(output_predictions.tolist())), datetime.utcnow().isoformat(), False)