Dynamic attributes config (#14035)

* Add config for attribute map and generate all labels from the map

* Update docs

* Formatting

* Use the dynamic label map

* Fix check

* Fix docs typo
This commit is contained in:
Nicolas Mowen
2024-09-28 07:49:04 -06:00
committed by GitHub
parent 7da44115d3
commit 38d398c967
7 changed files with 57 additions and 18 deletions
+4 -3
View File
@@ -20,7 +20,6 @@ from frigate.comms.detections_updater import DetectionSubscriber, DetectionTypeE
from frigate.comms.inter_process import InterProcessRequestor
from frigate.config import CameraConfig, FrigateConfig
from frigate.const import (
ALL_ATTRIBUTE_LABELS,
CLEAR_ONGOING_REVIEW_SEGMENTS,
CLIPS_DIR,
UPSERT_REVIEW_SEGMENT,
@@ -153,6 +152,8 @@ class ReviewSegmentMaintainer(threading.Thread):
self.active_review_segments: dict[str, Optional[PendingReviewSegment]] = {}
self.frame_manager = SharedMemoryFrameManager()
logger.error(f"All attributes are {config.model.all_attributes}")
# create communication for review segments
self.requestor = InterProcessRequestor()
self.config_subscriber = ConfigSubscriber("config/record/")
@@ -253,7 +254,7 @@ class ReviewSegmentMaintainer(threading.Thread):
for object in active_objects:
if not object["sub_label"]:
segment.detections[object["id"]] = object["label"]
elif object["sub_label"][0] in ALL_ATTRIBUTE_LABELS:
elif object["sub_label"][0] in self.config.model.all_attributes:
segment.detections[object["id"]] = object["sub_label"][0]
else:
segment.detections[object["id"]] = f'{object["label"]}-verified'
@@ -347,7 +348,7 @@ class ReviewSegmentMaintainer(threading.Thread):
for object in active_objects:
if not object["sub_label"]:
detections[object["id"]] = object["label"]
elif object["sub_label"][0] in ALL_ATTRIBUTE_LABELS:
elif object["sub_label"][0] in self.config.model.all_attributes:
detections[object["id"]] = object["sub_label"][0]
else:
detections[object["id"]] = f'{object["label"]}-verified'