NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Dynamically adjust to configured attribute map for lpr (#20079)
Nicolas Mowen5f34a189055c
diff --git a/frigate/data_processing/common/license_plate/mixin.py b/frigate/data_processing/common/license_plate/mixin.pyindex eae0f20459..1d2199deaa 100644--- a/frigate/data_processing/common/license_plate/mixin.py+++ b/frigate/data_processing/common/license_plate/mixin.py@@ -50,6 +50,13 @@ class LicensePlateProcessingMixin:)self.batch_size = 6+ # Object config+ self.lp_objects: list[str] = []++ for obj, attributes in self.config.model.attributes_map.items():+ if "license_plate" in attributes:+ self.lp_objects.append(obj)+# Detection specific parametersself.min_size = 8self.max_size = 960@@ -1254,7 +1261,7 @@ class LicensePlateProcessingMixin:# don't run for non car/motorcycle or non license plate (dedicated lpr with frigate+) objectsif (- obj_data.get("label") not in ["car", "motorcycle"]+ obj_data.get("label") not in self.lp_objectsand obj_data.get("label") != "license_plate"):logger.debug(@@ -1346,7 +1353,7 @@ class LicensePlateProcessingMixin:logger.debug(f"{camera}: No attributes to parse.")return- if obj_data.get("label") in ["car", "motorcycle"]:+ if obj_data.get("label") in self.lp_objects:attributes: list[dict[str, Any]] = obj_data.get("current_attributes", [])diff --git a/frigate/util/image.py b/frigate/util/image.pyindex 58afe8b365..3406c092f5 100644--- a/frigate/util/image.py+++ b/frigate/util/image.py@@ -66,7 +66,12 @@ def has_better_attr(current_thumb, new_obj, attr_label) -> bool:return max_new_attr > max_current_attr-def is_better_thumbnail(label, current_thumb, new_obj, frame_shape) -> bool:+def is_better_thumbnail(+ label: str,+ current_thumb: dict[str, Any],+ new_obj: dict[str, Any],+ frame_shape: tuple[int, int],+) -> bool:# larger is better# cutoff images are less ideal, but they should also be smaller?# better scores are obviously better too