mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-12-29 00:06:19 +01:00
Don't fail if deepstack detector times out (#8979)
This commit is contained in:
parent
e390533760
commit
c35c7da82a
@ -49,12 +49,18 @@ class DeepStack(DetectionApi):
|
|||||||
image.save(output, format="JPEG")
|
image.save(output, format="JPEG")
|
||||||
image_bytes = output.getvalue()
|
image_bytes = output.getvalue()
|
||||||
data = {"api_key": self.api_key}
|
data = {"api_key": self.api_key}
|
||||||
response = requests.post(
|
|
||||||
self.api_url,
|
try:
|
||||||
data=data,
|
response = requests.post(
|
||||||
files={"image": image_bytes},
|
self.api_url,
|
||||||
timeout=self.api_timeout,
|
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()
|
response_json = response.json()
|
||||||
detections = np.zeros((20, 6), np.float32)
|
detections = np.zeros((20, 6), np.float32)
|
||||||
if response_json.get("predictions") is None:
|
if response_json.get("predictions") is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user