Skip to content

Commit

Permalink
Fix error in parsing DeepStack response JSON and handle cases where p…
Browse files Browse the repository at this point in the history
…redictions field is missing (#6463)
  • Loading branch information
skrashevich committed May 15, 2023
1 parent e3b9998 commit 181b53a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frigate/detectors/plugins/deepstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ def detect_raw(self, tensor_input):
)
response_json = response.json()
detections = np.zeros((20, 6), np.float32)
if response_json.get("predictions") is None:
logger.debug(f"Error in parsing response json: {response_json}")
return detections

for i, detection in enumerate(response_json["predictions"]):
for i, detection in enumerate(response_json.get("predictions")):
logger.debug(f"Response: {detection}")
if detection["confidence"] < 0.4:
logger.debug(f"Break due to confidence < 0.4")
Expand Down

0 comments on commit 181b53a

Please sign in to comment.