* Fix ROCm input name

* Fix incorrect parsing of None
This commit is contained in:
Nicolas Mowen 2024-09-26 11:42:21 -06:00 committed by GitHub
parent a5595189ed
commit a65aaab849
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 17 deletions

View File

@ -125,8 +125,9 @@ class ROCmDetector(DetectionApi):
def detect_raw(self, tensor_input): def detect_raw(self, tensor_input):
model_input_name = self.model.get_parameter_names()[0] model_input_name = self.model.get_parameter_names()[0]
model_input_name = self.model.get_inputs()[0].name model_input_shape = tuple(
model_input_shape = self.model.get_inputs()[0].shape self.model.get_parameter_shapes()[model_input_name].lens()
)
tensor_input = cv2.dnn.blobFromImage( tensor_input = cv2.dnn.blobFromImage(
tensor_input[0], tensor_input[0],

View File

@ -163,22 +163,27 @@ class EventProcessor(threading.Thread):
) )
) )
attributes = [ try:
( attributes = [
None (
if event_data["snapshot"] is None None
else { if event_data["snapshot"] is None
"box": to_relative_box( else {
width, "box": to_relative_box(
height, width,
a["box"], height,
), a["box"],
"label": a["label"], ),
"score": a["score"], "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 # keep these from being set back to false because the event
# may have started while recordings and snapshots were enabled # may have started while recordings and snapshots were enabled