From c35c7da82a23520478ca56dd469fc28dcf1e1e5a Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Fri, 15 Dec 2023 16:25:21 -0700 Subject: [PATCH] Don't fail if deepstack detector times out (#8979) --- frigate/detectors/plugins/deepstack.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/frigate/detectors/plugins/deepstack.py b/frigate/detectors/plugins/deepstack.py index fd79e27d0..311972393 100644 --- a/frigate/detectors/plugins/deepstack.py +++ b/frigate/detectors/plugins/deepstack.py @@ -49,12 +49,18 @@ class DeepStack(DetectionApi): image.save(output, format="JPEG") image_bytes = output.getvalue() data = {"api_key": self.api_key} - response = requests.post( - self.api_url, - data=data, - files={"image": image_bytes}, - timeout=self.api_timeout, - ) + + try: + response = requests.post( + self.api_url, + data=data, + files={"image": image_bytes}, + timeout=self.api_timeout, + ) + except requests.exceptions.RequestException: + logger.error("Error calling deepstack API") + return np.zeros((20, 6), np.float32) + response_json = response.json() detections = np.zeros((20, 6), np.float32) if response_json.get("predictions") is None: