From 9236898a9d65e8de415b3b96cd6fbd7ed26dbd98 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 29 Jan 2025 10:52:21 -0700 Subject: [PATCH] Sub label sensors (#16218) * Support mqtt sensors for logo attributes * Expose in api --- frigate/api/app.py | 1 + frigate/camera/activity_manager.py | 2 +- frigate/detectors/detector_config.py | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/frigate/api/app.py b/frigate/api/app.py index a4b1267af..f8a5a912d 100644 --- a/frigate/api/app.py +++ b/frigate/api/app.py @@ -157,6 +157,7 @@ def config(request: Request): config["plus"] = {"enabled": request.app.frigate_config.plus_api.is_active()} config["model"]["colormap"] = config_obj.model.colormap config["model"]["all_attributes"] = config_obj.model.all_attributes + config["model"]["non_logo_attributes"] = config_obj.model.non_logo_attributes # use merged labelamp for detector_config in config["detectors"].values(): diff --git a/frigate/camera/activity_manager.py b/frigate/camera/activity_manager.py index 381e295b9..9c06cf6f9 100644 --- a/frigate/camera/activity_manager.py +++ b/frigate/camera/activity_manager.py @@ -103,7 +103,7 @@ class CameraActivityManager: # run through each object and check what topics need to be updated for label in self.config.cameras[camera].objects.track: - if label in self.config.model.all_attributes: + if label in self.config.model.non_logo_attributes: continue new_count = all_objects[label] diff --git a/frigate/detectors/detector_config.py b/frigate/detectors/detector_config.py index 452f1feed..1d096a648 100644 --- a/frigate/detectors/detector_config.py +++ b/frigate/detectors/detector_config.py @@ -78,6 +78,10 @@ class ModelConfig(BaseModel): def colormap(self) -> Dict[int, Tuple[int, int, int]]: return self._colormap + @property + def non_logo_attributes(self) -> list[str]: + return ["face", "license_plate"] + @property def all_attributes(self) -> list[str]: return self._all_attributes @@ -107,7 +111,7 @@ class ModelConfig(BaseModel): self._all_attributes = list(unique_attributes) self._all_attribute_logos = list( - unique_attributes - set(["face", "license_plate"]) + unique_attributes - set(self.non_logo_attributes) ) def check_and_load_plus_model(