blakeblackshear / frigate

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

[Support]: Stationary/Interval:0 not taken into effect? #2870

Closed MrSiO closed 2 years ago

MrSiO commented 2 years ago

Describe the problem you are having

Hi, With the deployment of 0.10.0-BFECEE9 and the introduction of stationary object traking, I tried disabling this tracking by adding the following settings:

stationary:
        interval: 0

Unfortunately this seems to have no effect as I keep receiving regular updates (MQTT) when a stationary detection is present. When a car is detected is goes to stationary true, I then keep getting MQTT updates every 60 seconds about that stationnary car even-if my interval was set to zero.

Version

0.10.0-BFECEE9

Frigate config file

cameras:                                                                          
  CAM-03:
    ffmpeg:
      inputs:
        - path: rtsp://xxxx:xxxx@198.10.20.8:554/cam/realmonitor?channel=1&subtype=0
          roles:
            - detect
    best_image_timeout: 20 
    rtmp:
      enabled: False    
    detect:
      width: 1280
      height: 720
      fps: 5      
      enabled: True                                                               
      max_disappeared: 25
      stationary:          #Optional: Configuration for stationary object tracking
        interval: 0
        threshold: 50
    snapshots:                                                                    
      enabled: True                                                               
      timestamp: True                                                             
      bounding_box: True                                                          
      retain:                                                                     
        default: 3 
    objects:                                                                      
      track:                                                                      
        - person                                                                  
        - dog
        - car
        - bicycle
        - truck  
      filters:
        person:      
          min_score: 0.5
          mask:
            - 0,241,754,61,1280,31,1280,0,0,0
            - 741,654,888,599,985,555,1026,502,1005,434,1008,382,1233,199,1280,65,1280,197,1280,351,1280,720,1037,720,823,720,824,720,674,720,674,720,573,720
            - 938,364,1003,206,921,126,836,267 
        dog:
          min_score: 0.7
          mask:
            - 0,241,754,61,1280,31,1280,0,0,0
        car:
          min_score: 0.5
          mask:
            - 0,241,754,61,1280,31,1280,0,0,0

        bicycle:
          min_score: 0.5
          mask:
            - 0,241,754,61,1280,31,1280,0,0,0

    zones:
      zone_rue:
        coordinates: 0,241,754,61,1280,31,1280,0,0,0
      zone_driveway:
        coordinates: 982,553,586,720,118,720,118,208,591,103

Relevant log output

The following is the MQTT payload received every 60 seconds when a stationary object is detected:
TOPIC: frigate/events

{
   "before":{
      "id":"1645724740.985654-03hg3k",
      "camera":"CAM-03",
      "frame_time":1645729413.647324,
      "snapshot_time":1645727308.7834,
      "label":"car",
      "top_score":0.8203125,
      "false_positive":false,
      "start_time":1645724740.985654,
      "end_time":null,
      "score":0.57421875,
      "box":[
         75,
         153,
         492,
         672
      ],
      "area":216423,
      "region":[
         0,
         0,
         940,
         940
      ],
      "stationary":true,
      "motionless_count":2468,
      "position_changes":4,
      "current_zones":[
         "zone_driveway"
      ],
      "entered_zones":[
         "zone_driveway"
      ],
      "has_clip":false,
      "has_snapshot":true
   },
   "after":{
      "id":"1645724740.985654-03hg3k",
      "camera":"CAM-03",
      "frame_time":1645729473.970466,
      "snapshot_time":1645727308.7834,
      "label":"car",
      "top_score":0.8203125,
      "false_positive":false,
      "start_time":1645724740.985654,
      "end_time":null,
      "score":0.734375,
      "box":[
         56,
         143,
         515,
         715
      ],
      "area":262548,
      "region":[
         0,
         16,
         704,
         720
      ],
      "stationary":true,
      "motionless_count":2771,
      "position_changes":4,
      "current_zones":[
         "zone_driveway"
      ],
      "entered_zones":[
         "zone_driveway"
      ],
      "has_clip":false,
      "has_snapshot":true
   },
   "type":"update"
}

FFprobe output from your camera

(see comments below)

Frigate stats

(See comments below)

Operating system

Other Linux

Install method

Docker Compose

Coral version

USB

Network connection

Wired

Camera make and model

amcrest

Any other information that may be helpful

FFprobe and Frigate stats will be provided shortly

NickM-27 commented 2 years ago

0 is the default and just means once an object is stationary it will not have any checks to confirm it is still there. If you want to disable stationary then you should use the max_frames option as described in the docs

MrSiO commented 2 years ago

What I'm looking to achieve is to stop the constant frigate/events when a stationary object has been labeled as such.

I'll read the documentation again and confirm.

NickM-27 commented 2 years ago

I don't believe there is currently a way to disable the Mqtt messages but keep stationary detection enabled. Just curious, why do you want to disable these messages? They should be able to be ignored along other updates to mqtt topic

MrSiO commented 2 years ago

Thx @NickM-27 for your guiding. I found the comment that I had over read:

` # Optional: Define a maximum number of frames for tracking a stationary object (default: not set, track forever)

This can help with false positives for objects that should only be stationary for a limited amount of time.

# It can also be used to disable stationary object tracking. For example, you may want to set a value for person, but leave
# car at the default.
# WARNING: Setting these values overrides default behavior and disables stationary object tracking.
#          There are very few situations where you would want it disabled. It is NOT recommended to  
#          copy these values from the example config into your config unless you know they are needed.
max_frames:
  # Optional: Default for all object types (default: not set, track forever)
  default: 3000
  # Optional: Object specific values
  objects:
    person: 1000`

The reason (at first) was because before the latest update, the only MQTT:frigate/events I was receiving were from actual detections (car, person and dog). These frigates/events were directly feeding my Node-Red automations.

Now with tracking of stationnary objects, I was getting the MQTT:frigate/events every 60 seconds when my car was parked and labeled as "stationary", sending me a PIX every 60 sec....

I have, in the mean time, modified my node-red to ignore messages containing : stationary: true That did fix my issue.

I have no use at the current time for updates about stationary objects, but might be better to keep em on and filter at node-red input.

Thx alot.