From 4051cd1fecaac1c5df0b589c4602b01ed25fde55 Mon Sep 17 00:00:00 2001 From: Mateo Date: Tue, 31 Oct 2023 09:38:55 +0100 Subject: [PATCH] filter boxes with low score (#177) --- pyroengine/engine.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyroengine/engine.py b/pyroengine/engine.py index 1af22a08..9c53fd27 100644 --- a/pyroengine/engine.py +++ b/pyroengine/engine.py @@ -254,6 +254,9 @@ def _update_states(self, frame: Image.Image, preds: np.ndarray, cam_key: str) -> # 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 = output_predictions[ + output_predictions[:, 4] > self.conf_thresh + ] # send only boxes above conf self._states[cam_key]["last_predictions"].append( (frame, preds, output_predictions.tolist(), datetime.utcnow().isoformat(), False)