work / zone-alert
Context-Aware Zone Alert
Alerts on a zone intrusion only when a person is present alongside the target, cutting the false alarms that animals and the environment cause.
Something I made in 2 hours for a school assignment.
An alert built on single-object detection fires easily on animals, lighting changes, and shadows. Watch a zone overnight and the alert goes off dozens of times, so eventually no one looks.
The judgment it needs is not “something entered the zone” but “a person is in a position to touch the object in this zone.”
How it works
The alert triggers only when a target (a phone, a bottle, a cup) and a person are detected in the same frame at the same time. Either one alone is ignored. The zone is drawn by dragging with the mouse while it runs, and an auto-latch (3 seconds by default) keeps the alert up if the target briefly leaves the frame. It uses CUDA when a GPU is present and falls back to CPU otherwise.
Adding a person class to a single-class baseline that had many night-time false positives, and gating the two detections with AND, cut the false positives noticeably. A privacy-blur mode and automatic GPU/CPU fallback are in as well.
Where it stands
The co-presence gate alone cut environmental false positives (animals, lighting, shadows) substantially. No quantitative benchmark was run. It runs in real time on a 1080p webcam and works without a GPU. Control while it runs is by keyboard: drag to set the zone, S to start, R to reset, P for privacy, Q to quit.