From c06cc79badef693a420101e12bfa28b116a2ff4a Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 26 Aug 2024 07:00:38 -0600 Subject: [PATCH] Update object processing logic for when an event is created --- frigate/object_processing.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/frigate/object_processing.py b/frigate/object_processing.py index dcf6014fc..d4e86889e 100644 --- a/frigate/object_processing.py +++ b/frigate/object_processing.py @@ -1070,25 +1070,27 @@ class TrackedObjectProcessor(threading.Thread): if obj.obj_data["position_changes"] == 0: return False - # If there are required zones and there is no overlap + # If the object is not considered an alert or detection review_config = self.config.cameras[camera].review - required_zones = ( - review_config.alerts.required_zones - + review_config.detections.required_zones - ) - if len(required_zones) > 0 and not set(obj.entered_zones) & set(required_zones): - logger.debug( - f"Not creating clip for {obj.obj_data['id']} because it did not enter required zones" + if not ( + ( + obj.obj_data["label"] in review_config.alerts.labels + and ( + not review_config.alerts.required_zones + or set(obj.entered_zones) & set(review_config.alerts.required_zones) + ) + ) + or ( + not review_config.detections.labels + or obj.obj_data["label"] in review_config.detections.labels + ) + and ( + not review_config.detections.required_zones + or set(obj.entered_zones) & set(review_config.alerts.required_zones) ) - return False - - # If the required objects are not present - if ( - record_config.events.objects is not None - and obj.obj_data["label"] not in record_config.events.objects ): logger.debug( - f"Not creating clip for {obj.obj_data['id']} because it did not contain required objects" + f"Not creating clip for {obj.obj_data['id']} because it did not qualify as an alert or detection" ) return False