NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Use different consolidation requirement depending on label (#8249)
Nicolas Mowene80b6d9e5bca
diff --git a/frigate/const.py b/frigate/const.pyindex 56d0f4517b..f96665ce2e 100644--- a/frigate/const.py+++ b/frigate/const.py@@ -12,7 +12,7 @@ FRIGATE_LOCALHOST = "http://127.0.0.1:5000"PLUS_ENV_VAR = "PLUS_API_KEY"PLUS_API_HOST = "https://api.frigate.video"-# Attributes+# Attribute & Object ConstsATTRIBUTE_LABEL_MAP = {"person": ["face", "amazon"],@@ -21,6 +21,11 @@ ATTRIBUTE_LABEL_MAP = {ALL_ATTRIBUTE_LABELS = [item for sublist in ATTRIBUTE_LABEL_MAP.values() for item in sublist]+LABEL_CONSOLIDATION_MAP = {+ "car": 0.8,+ "face": 0.5,+}+LABEL_CONSOLIDATION_DEFAULT = 0.9# Audio Constsdiff --git a/frigate/util/object.py b/frigate/util/object.pyindex 3fa98df595..6c7c8f9b9e 100644--- a/frigate/util/object.py+++ b/frigate/util/object.py@@ -9,6 +9,7 @@ import numpy as npfrom peewee import DoesNotExistfrom frigate.config import DetectConfig, ModelConfig+from frigate.const import LABEL_CONSOLIDATION_DEFAULT, LABEL_CONSOLIDATION_MAPfrom frigate.detectors.detector_config import PixelFormatEnumfrom frigate.models import Event, Regions, Timelinefrom frigate.util.image import (@@ -426,18 +427,21 @@ def get_consolidated_object_detections(detected_object_groups):sorted_by_area = sorted(group, key=lambda g: g[3])for current_detection_idx in range(0, len(sorted_by_area)):- current_detection = sorted_by_area[current_detection_idx][2]+ current_detection = sorted_by_area[current_detection_idx]+ current_label = current_detection[0]+ current_box = current_detection[2]overlap = 0for to_check_idx in range(min(current_detection_idx + 1, len(sorted_by_area)),len(sorted_by_area),):to_check = sorted_by_area[to_check_idx][2]- intersect_box = intersection(current_detection, to_check)+ intersect_box = intersection(current_box, to_check)# if 90% of smaller detection is inside of another detection, consolidate- if (- intersect_box is not None- and area(intersect_box) / area(current_detection) > 0.9+ if intersect_box is not None and area(intersect_box) / area(+ current_box+ ) > LABEL_CONSOLIDATION_MAP.get(+ current_label, LABEL_CONSOLIDATION_DEFAULT):overlap = 1break