blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
19.26k stars 1.76k forks source link

[Support]: Detect "loitering" behavior in a zone #2397

Closed gururise closed 8 months ago

gururise commented 2 years ago

Describe the problem you are having

I have a sidewalk right in the front of my store. I currently have this STOREFRONT zone set to detect people. What I want to do is determine if someone is "loitering" in the storefront zone after midnight. Now people can walk through the STOREFRONT zone, but if a person remains within the sidewalk zone for more than 15 seconds I would like to know.

This is a bit different than stationary objects, as the person could be moving within the sidewalk zone. But if one person stays too long in the sidewalk zone, i would like to be able to determine this via the EVENTS that are passed to MQTT.

Version

0.10.0-C1155AF

Frigate config file

n/a

Relevant log output

n/a

FFprobe output from your camera

n/a

Frigate stats

No response

Operating system

Debian

Install method

Docker Compose

Coral version

USB

Network connection

Wired

Camera make and model

hikvision

Any other information that may be helpful

No response

blakeblackshear commented 2 years ago

The only way to do this at the moment would be to track event ids and when they enter a zone.

blakeblackshear commented 2 years ago

Only way to do it right now is by monitoring how long a zone binary sensor is on, but that won't work if you have people continuously walking by.

gururise commented 2 years ago

@blakeblackshear Thanks for the response. Considering I am only interested in 'loitering' in the early morning hours, there is very little sidewalk traffic at that time. There might be between 1-3 people walking through the storefront zone overnight. Every break-in I've had has occurred when someone loiters for more than 15 seconds, as it takes time to break through the lock.

Since I'm not expecting much foot traffic overnight, which method would you think would work better?

  1. tracking event id's when they enter the storefront zone and checking to see if they exceed the "loitering" timeout or
  2. just checking the storefront zone when it triggers and seeing how long the trigger stays active. (check if storefront is in after.current_zones and compare current time to after.start_time?)
blakeblackshear commented 2 years ago

The latest beta includes a new motionless_count which will provide a count of the number of frames where the object has not changed position. The current beta stops counting at 10, but I just committed a change that will keep counting. You should be able to specify whatever threshold you want to define "loitering" here.

k1n6b0b commented 2 years ago

+1 for this -- my use case is detecting parked cars along a street (vs cars passing through) so I dont think monitoring the zone binary sensor will work for me: https://github.com/blakeblackshear/frigate/issues/4226

NickM-27 commented 1 year ago

This should be possible with https://github.com/blakeblackshear/frigate/pull/6680