From 4ff0c8a8d1e63ef2860523ee7407b1e17826ba20 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 24 Oct 2024 16:00:39 -0600 Subject: [PATCH] Better review sub-labels (#14563) * Better review sub-labels * Handle init --- frigate/review/maintainer.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/frigate/review/maintainer.py b/frigate/review/maintainer.py index bdb749dc8..d87e1d33c 100644 --- a/frigate/review/maintainer.py +++ b/frigate/review/maintainer.py @@ -51,7 +51,7 @@ class PendingReviewSegment: frame_time: float, severity: SeverityEnum, detections: dict[str, str], - sub_labels: set[str], + sub_labels: dict[str, str], zones: list[str], audio: set[str], ): @@ -135,7 +135,7 @@ class PendingReviewSegment: ReviewSegment.data.name: { "detections": list(set(self.detections.keys())), "objects": list(set(self.detections.values())), - "sub_labels": list(self.sub_labels), + "sub_labels": list(self.sub_labels.values()), "zones": self.zones, "audio": list(self.audio), }, @@ -261,7 +261,7 @@ class ReviewSegmentMaintainer(threading.Thread): segment.detections[object["id"]] = object["sub_label"][0] else: segment.detections[object["id"]] = f'{object["label"]}-verified' - segment.sub_labels.add(object["sub_label"][0]) + segment.sub_labels[object["id"]] = object["sub_label"][0] # if object is alert label # and has entered required zones or required zones is not set @@ -347,7 +347,7 @@ class ReviewSegmentMaintainer(threading.Thread): if len(active_objects) > 0: detections: dict[str, str] = {} - sub_labels = set() + sub_labels = dict[str, str] = {} zones: list[str] = [] severity = None @@ -358,7 +358,7 @@ class ReviewSegmentMaintainer(threading.Thread): detections[object["id"]] = object["sub_label"][0] else: detections[object["id"]] = f'{object["label"]}-verified' - sub_labels.add(object["sub_label"][0]) + sub_labels[object["id"]] = object["sub_label"][0] # if object is alert label # and has entered required zones or required zones is not set @@ -566,7 +566,7 @@ class ReviewSegmentMaintainer(threading.Thread): frame_time, severity, {}, - set(), + {}, [], detections, ) @@ -576,7 +576,7 @@ class ReviewSegmentMaintainer(threading.Thread): frame_time, SeverityEnum.alert, {manual_info["event_id"]: manual_info["label"]}, - set(), + {}, [], set(), )