Skip to content

NVR with realtime local object detection for IP cameras

Don't fail if deepstack detector times out (#8979)

Nicolas Mowenc35c7da82a23
diff --git a/frigate/detectors/plugins/deepstack.py b/frigate/detectors/plugins/deepstack.py
index fd79e27d0c..311972393f 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: