Update object processing logic for when an event is created

This commit is contained in:
Nicolas Mowen 2024-08-26 07:00:38 -06:00
parent 20ba0a5142
commit c06cc79bad

View File

@ -1070,25 +1070,27 @@ class TrackedObjectProcessor(threading.Thread):
if obj.obj_data["position_changes"] == 0: if obj.obj_data["position_changes"] == 0:
return False 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 review_config = self.config.cameras[camera].review
required_zones = ( if not (
review_config.alerts.required_zones (
+ review_config.detections.required_zones obj.obj_data["label"] in review_config.alerts.labels
) and (
if len(required_zones) > 0 and not set(obj.entered_zones) & set(required_zones): not review_config.alerts.required_zones
logger.debug( or set(obj.entered_zones) & set(review_config.alerts.required_zones)
f"Not creating clip for {obj.obj_data['id']} because it did not enter 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( 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 return False