NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Adjust loitering behavior based on object type (#19433)
Nicolas Mowen6ecc63148636
diff --git a/docs/docs/configuration/zones.md b/docs/docs/configuration/zones.mdindex d2a1083e65..025384a8bb 100644--- a/docs/docs/configuration/zones.md+++ b/docs/docs/configuration/zones.md@@ -88,7 +88,9 @@ Sometimes objects are expected to be passing through a zone, but an object loite:::note-When using loitering zones, a review item will remain active until the object leaves. Loitering zones are only meant to be used in areas where loitering is not expected behavior.+When using loitering zones, a review item will behave in the following way:+- When a person is in a loitering zone, the review item will remain active until the person leaves the loitering zone, regardless of if they are stationary.+- When any other object is in a loitering zone, the review item will remain active until the loitering time is met. Then if the object is stationary the review item will end.:::diff --git a/frigate/track/tracked_object.py b/frigate/track/tracked_object.pyindex 2cb028a9af..afe85228e8 100644--- a/frigate/track/tracked_object.py+++ b/frigate/track/tracked_object.py@@ -32,6 +32,14 @@ from frigate.util.velocity import calculate_real_world_speedlogger = logging.getLogger(__name__)+# In most cases objects that loiter in a loitering zone should alert,+# but can still be expected to stay stationary for extended periods of time+# (ex: car loitering on the street vs when a known person parks on the street)+# person is the main object that should keep alerts going as long as they loiter+# even if they are stationary.+EXTENDED_LOITERING_OBJECTS = ["person"]++class TrackedObject:def __init__(self,@@ -247,8 +255,12 @@ class TrackedObject:if zone.distances and not in_speed_zone:continue # Skip zone entry for speed zones until speed threshold met- # if the zone has loitering time, update loitering status- if zone.loitering_time > 0:+ # if the zone has loitering time, and the object is an extended loiter object+ # always mark it as loitering actively+ if (+ self.obj_data["label"] in EXTENDED_LOITERING_OBJECTS+ and zone.loitering_time > 0+ ):in_loitering_zone = Trueloitering_score = self.zone_loitering.get(name, 0) + 1@@ -264,6 +276,10 @@ class TrackedObject:self.entered_zones.append(name)else:self.zone_loitering[name] = loitering_score++ # this object is pending loitering but has not entered the zone yet+ if zone.loitering_time > 0:+ in_loitering_zone = Trueelse:self.zone_presence[name] = zone_scoreelse: