From a65aaab8496bb614785b406bfad07d6d9b83e47e Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 26 Sep 2024 11:42:21 -0600 Subject: [PATCH] Fixes (#13990) * Fix ROCm input name * Fix incorrect parsing of None --- frigate/detectors/plugins/rocm.py | 5 +++-- frigate/events/maintainer.py | 35 ++++++++++++++++++------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/frigate/detectors/plugins/rocm.py b/frigate/detectors/plugins/rocm.py index 5203934e90..655973dfd2 100644 --- a/frigate/detectors/plugins/rocm.py +++ b/frigate/detectors/plugins/rocm.py @@ -125,8 +125,9 @@ def __init__(self, detector_config: ROCmDetectorConfig): def detect_raw(self, tensor_input): model_input_name = self.model.get_parameter_names()[0] - model_input_name = self.model.get_inputs()[0].name - model_input_shape = self.model.get_inputs()[0].shape + model_input_shape = tuple( + self.model.get_parameter_shapes()[model_input_name].lens() + ) tensor_input = cv2.dnn.blobFromImage( tensor_input[0], diff --git a/frigate/events/maintainer.py b/frigate/events/maintainer.py index 6707bfb41a..10cdb6b435 100644 --- a/frigate/events/maintainer.py +++ b/frigate/events/maintainer.py @@ -163,22 +163,27 @@ def handle_object_detection( ) ) - attributes = [ - ( - None - if event_data["snapshot"] is None - else { - "box": to_relative_box( - width, - height, - a["box"], - ), - "label": a["label"], - "score": a["score"], - } + try: + attributes = [ + ( + None + if event_data["snapshot"] is None + else { + "box": to_relative_box( + width, + height, + a["box"], + ), + "label": a["label"], + "score": a["score"], + } + ) + for a in event_data["snapshot"]["attributes"] + ] + except TypeError: + logger.warning( + f"Failed to parse attributes of event data, event data is {event_data}" ) - for a in event_data["snapshot"]["attributes"] - ] # keep these from being set back to false because the event # may have started while recordings and snapshots were enabled