Detect Zone Transition icon

Detect Zone Transition

1 SürümDetect

Per-tracked-id zone transition classifier. Each input is a {{type:[(UInt64, Bool)]}} list of (id, in_zone) pairs for the current tick; the worker updates per-id rolling history of length {{param:history_size}} and emits {{type:[UInt64]}} carrying a transition code per object: 0 no change, 1 entered, 2 exited. Ids unseen for {{param:forget_threshold}} ticks are forgotten.

How it fits

{{type:[(UInt64, Bool)]}} -> {{component:detect_zone_transition}} -> {{type:[UInt64]}}   (codes per object, aligned with input order)
                          |
                          +-- per-id rolling history of size {{param:history_size}} drives the transition decision
                          +-- ids unseen for more than {{param:forget_threshold}} ticks are evicted

Pick this when per-object containment is already computed and downstream needs to know who just crossed the boundary. Pair upstream with {{component:check_geometry_within_roi}} or {{component:detect_object_containment}} for the boolean per-object stream, and with {{component:track_bounding_boxes_hungarian_algorithm}} or {{component:track_objects_ultralytics_yolo}} for stable ids.

Typical backends

  • Restricted-zone alarm: {{component:track_bounding_boxes_hungarian_algorithm}} -> {{component:check_geometry_within_roi}} -> {{component:detect_zone_transition}} -> {{component:filter}} -> {{component:output_json_http}}.
  • Footfall counter: {{component:track_bounding_boxes_hungarian_algorithm}} -> {{component:detect_object_containment}} -> {{component:detect_zone_transition}} -> {{component:send_object_counts_mqtt}}.
  • Visualised review: {{component:track_bounding_boxes_hungarian_algorithm}} -> {{component:check_geometry_within_roi}} -> {{component:detect_zone_transition}} -> {{component:visualize_zone_transitions}}.

Caveats

  • Output is the CURRENT classification per object on the current tick, NOT an edge. After an entered code (1), every subsequent in-zone tick keeps emitting 1. Compute the diff against the previous tick downstream if one-shot alerts are needed.
  • The initial location state per id is captured on the FIRST sighting and never updated until the id is forgotten. A temporary exit followed by a re-entry without crossing the {{param:forget_threshold}} gap therefore emits no_change (0), not a fresh entered. The only way to trigger re-entry is to stop seeing the id for more than {{param:forget_threshold}} ticks.
  • The decision uses a majority vote over the last {{param:history_size}} ticks of the id's location history. Transitions can land up to {{param:history_size}} - 1 ticks late; lower {{param:history_size}} for faster reaction at the cost of stability.
  • A tie in the majority vote returns no_change; this happens on even {{param:history_size}} values when the history is exactly split.
  • Tracking-id stability matters. If the upstream tracker re-uses ids across different objects, the worker emits ghost transitions. Use a tracker with stable ids.
  • Empty input lists produce empty outputs. The component is stateful per id across calls but stateless across ids — only the supplied id state changes per tick.
  • {{param:forget_threshold}} and {{param:history_size}} are captured ONCE at startup; runtime changes have NO effect and require a redeploy.
  • Pure CPU; per-tick cost grows linearly with the number of active ids and the rolling history length.

Sürümler

  • 31b5caf6defaultlatestlinux/amd64

    live-test prerelease 2026-05-24T22:07:50Z