Local realtime person detection for RTSP cameras

I would limit cpu and memory use for all your containers.
It rare but I’ve had some containers that get excessive and take all memory causing crash or system lag. To prevent this always best to limit use

EDIT
And 8GB is a lot so you need to look into that

1 Like

Hi everyone,

I have setup my cameras with motion masks and zones, but I still get notifications triggered by events outside the zone even though I specifically specified it. Using the blueprint for notifications BTW.
But also I get lots of events triggered by shadows from trees, lights on the road…
Is there a way to overcome those false positive? Otherwise the notifications are pretty much useless

Regards,
Didi

are shadows,lights on the road identified as person?

alias: NOTIFY_FrigateEntryGateMotionInOut
description: ''
trigger:
  - platform: mqtt
    topic: frigate/events
condition:
  - condition: or
    conditions:
      - condition: template
        value_template: '{{ trigger.payload_json["after"]["current_zones"] == ["outside"] }}'
      - condition: template
        value_template: '{{ trigger.payload_json["after"]["entered_zones"] == ["outside"] }}'
      - condition: template
        value_template: '{{ trigger.payload_json["after"]["current_zones"] == ["inside"] }}'
      - condition: template
        value_template: '{{ trigger.payload_json["after"]["entered_zones"] == ["inside"] }}'
  - condition: template
    value_template: '{{ trigger.payload_json["after"]["camera"] == "Frigate_Gate02"}}'
action:
  - service: notify.mobile_app_terrences_iphone
    data:
      message: >-
        A {{trigger.payload_json["after"]["label"]}} is {{
        trigger.payload_json["after"]["current_zones"] }} the
        Gate.{{trigger.payload_json["after"]["top_score"]}}
      data:
        tag: NOTIFY_EntryGateMotionInOut
        image: >-
          https://haweb.com/api/frigate/notifications/{{
          trigger.payload_json["after"]["id"] }}/snapshot.jpg
        actions:
          - action: OPEN_ENTRY_GATE
            title: Open Gate
            destructive: true
          - action: URI
            title: APP
            uri: /lovelace/3
  - delay:
      hours: 0
      minutes: 0
      seconds: 40
      milliseconds: 0
mode: single

Thank you very much @tmjpugh ! I’ll try it later (hopefully today) and share the outcome.

@ukro no, they are on the car, so it detects it as the car but the car was standing / stationary. The shadows / reflected lights from the roard5by other cars are casted on the car’s side and then consider to be a movement, but it is a small portion of the whole vehicle. Is there a way to ignore those movements? The issue with the motion masks is that if I’ll try to block all of those shadows it will practically block the whole detection area, and also I can’t really predict exactly where the shadow or the reflecting lights will appear. My question is if there would be a motion but on the car, can it determine that the car was there already and this wasn’t an event for a “car”?
Or are there any other methods to troubleshoot this?

wuf that’s hard one. i have no idea, i think you need to show some screenshots and ask @blakeblackshear

@tmjpugh I’m trying to configure it right now, I noticed that you set up two zones and the automation is based on that. For my setup I don’t use zones for my frontdoor cam, should I divide it into two separate as well? (sorry if it sounds like a dumb questions, I don’t have much experience with Frigate)

Thanks!
Didi

For the past couple of days Frigate has decided to stop deleting the clips which don’t have events in them, my conifig is setup ‘retain_days=0’.

It’s been working as expected for weeks/months but just suddenly started doing it a couple of days ago. As far as I can remember I’ve made no changes to Frigate or HA. This is resulting in my disk becoming full and me needing to manually delete clips, you can see the spikes in the screenshot below:

I’m running:
Frigate: 2.3
Installed as an add-on to HA core-2022.2.0 on Home Assistant OS 7.2, I was running 2021.12.x just upgraded today to Feb release to see if it would fix it.

This has happened to me once in the past, however after a few days it went back to deleting the clips so I never got to the bottom off it. Nothing in the Frigate or HA logs to indicate an issue. Any suggestions?

Config below, 11 cameras so it’s quite noisy:

mqtt:
  host: 192.168.1.166
  port: 1883
  user: mqttuser
  password: mqttPassw0rd
  topic_prefix: frigate
  client_id: frigate

detectors:
  coral:
    type: edgetpu
    device: usb

ffmpeg:
  hwaccel_args:
    - -hwaccel
    - qsv
    - -qsv_device
    - /dev/dri/renderD128 

birdseye:
  enabled: False
  width: 1280
  height: 720
  quality: 4
  mode: objects

snapshots:
  enabled: True
  bounding_box: true
  retain:
    default: 5

record:
  enabled: True
  retain_days: 0
  events:
    retain:
      default: 5

objects:
  track:
    - person
    - cat
    - mouse
    - dog
    - bird

cameras:
  front_door:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.1:7447/4E0jPd2vPAlxvTxd
          roles:
            - detect
            - record
    detect:
      width: 1024
      height: 576
      fps: 5
    motion:
      mask: 
        - 1024,482,934,431,963,287,1024,238
        - 423,0,429,153,237,214,87,206,0,150,0,0,174,0
    rtmp:
      enabled: false        
    mqtt:
      timestamp: False
      bounding_box: true
      crop: False
      height: 500  

  deck:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.1:7447/x84oJyVPCbJkM6K3
          roles:
            - detect
            - record
    detect:
      width: 1280
      height: 720
      fps: 5
    motion:
      mask: 
        - 925,0,831,71,681,106,432,275,0,375,0,0
    rtmp:
      enabled: false   
    mqtt:
      timestamp: False
      bounding_box: False
      crop: False
      height: 500    

  front_bins:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.1:7447/1D7DHGoMfMtuiRPA
          roles:
            - detect
            - record
    detect:
      width: 1280
      height: 720
      fps: 5
    motion:
      mask: 
        - 1280,385,387,172,0,138,0,0,1280,0
    zones:
      front_of_house:
        coordinates: 1280,720,0,720,0,93,114,131,250,149,725,224,1280,353
    rtmp:
      enabled: false   
    mqtt:
      timestamp: False
      bounding_box: False
      crop: False
      height: 500 

  pool2:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.1:7447/H6yu5EC02nug8e8a
          roles:
            - detect
            - record
    detect:
      width: 1280
      height: 720
      fps: 5
    motion:
      mask: 
        - 241,48,403,142,537,269,569,720,0,720,0,487,0,88
    rtmp:
      enabled: false   
    mqtt:
      timestamp: False
      bounding_box: False
      crop: False
      height: 500   

  front_bbq:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.1:7447/0vRR1mnUZGIYbmFc
          roles:
            - detect
            - record
    detect:
      width: 1280
      height: 720
      fps: 5
    motion:
      mask: 
        - 1280,0,1280,180,1191,182,1182,238,701,308,0,487,0,0
    zones:
      front_of_house:
        coordinates: 474,358,1171,222,1186,176,1280,180,1280,720,0,720,0,480
    rtmp:
      enabled: false   
    mqtt:
      timestamp: False
      bounding_box: False
      crop: False
      height: 500  
  back_garden:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.1:7447/Mc4bF1KgSdwbWRov
          roles:
            - detect
            - record
    detect:
      width: 1280
      height: 720
      fps: 5
    motion:
      mask: 
        - 816,720,766,474,775,383,984,159,1120,138,1280,320,1280,720
        - 0,0,1280,0,1079,259,731,259,602,252,244,359,186,468,0,588
    rtmp:
      enabled: false   
    mqtt:
      timestamp: False
      bounding_box: False
      crop: False
      height: 500   

  garage:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.1:7447/ywNuWiY0nfzantkr
          roles:
            - detect
            - record
    detect:
      width: 1024
      height: 576
      fps: 5  
    rtmp:
      enabled: false  
    mqtt:
      timestamp: False
      bounding_box: False
      crop: False
      height: 500  

  door_bell:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.1:7447/r1Fil4PuD5xYntVv
          roles:
            - detect
            - record
    detect:
      width: 960
      height: 720
      fps: 5
    motion:
      mask: 
        - 0,60,960,59,960,361,849,380,854,408,553,435,347,446,120,459,118,431,0,421
    zones:
      front_of_house:
        coordinates: 960,720,0,720,0,425,148,441,152,483,960,371
    rtmp:
      enabled: false  
    mqtt:
      timestamp: False
      bounding_box: False
      crop: False
      height: 500  

  livingroom:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.1:7447/Lncnic1vxoDvlvkw
          roles:
    detect:
      width: 1024
      height: 576
      fps: 5  
    rtmp:
      enabled: false  
    mqtt:
      timestamp: False
      bounding_box: False
      crop: False
      height: 500  

  office:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.1:7447/ihBjWrdkIC4LqEAg
          roles:
    detect:
      width: 1024
      height: 576
      fps: 5  
    rtmp:
      enabled: false  
    mqtt:
      timestamp: False
      bounding_box: False
      crop: False
      height: 500  

  kitchen:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.1:7447/127xhqW0hRMAlRsG
          roles:
    detect:
      width: 1024
      height: 576
      fps: 5  
    rtmp:
      enabled: false  
    mqtt:
      timestamp: False
      bounding_box: False
      crop: False
      height: 500  

Zones are not required

This camera points at busy highway. Zones detect my driveway (inside and outside). I use frigate as doorbell to detect waiting vehicle, delivery person and mail car.

This automation send image of event and include actionable notification button (app and open gate)
Open gate trigger separate automation that open gate. App opens app on phone so I may check live video.

Zone limit detection to prevent false alert in my case but you can remove if not needed.

Long press notification will show low res image zoomed larger. Single press notification opens app. There is delay at end to prevent new notification send for 40 seconds since the tag will allow new notification to overwrite old vs create new seperate notification

1 Like

Can I use required_zones for a specific object? for example, I want the snapshots with required_zones but for one zone it would trigger an event for “person” and another required_zone would be for “car”?
I think that would solve my false positive, if I would divide my detection area into 3 zones, only when a car appears in all 3 I would consider it as a true event (so the shadows/reflections won’t appear in all 3 at the same time). and for a person, it could be in the whole area of the detection. maybe I’m not looking at this as it is supposed to behave, correct me if this is not possible, or there is a better approach.

Thanks!

I noticed a couple of other people reporting the same issue: [Support]: Retention not working - recording all the time instead · Issue #2723 · blakeblackshear/frigate (github.com)

No idea why but after several Frigate, HA and HAOS restarts clips started deleting again as expected.

Can I update to the beta 10.x from 0.9.4-26ae608 or will I hit a breaing change (again)

I don’t remember there being a breaking change but….I can’t remember😊

Hi,

Can anyone help me to understand how to move the cache on an external SSD? (Samsung_T5)
I moved the media (clips, record, db, etc) but I don’t understand how to do the same for the cache

    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./config:/config
      - /media/pi/Samsung_T5:/media
      - type: tmpfs
#        target: /tmp/cache
        target: /media/cache
        tmpfs:
          size: 1000000000

regards

Does anyone know if there is a way to monitor the coral stats ?
utilization
tps
temp
etc

Got Frigate running as a container , awesome piece of software.
It’s doing person detection on my doorbell and pushing it to my HA.
Only there’s a 45 secs lag between person detect and my HA notifying me there’s a person in the yard.
believe this is thanks to my I5 3,2 ghz inference speed to high i guess…? around 60ms
got 2 cores set in config, would it make a difference if i add all 4 cores ?
and would a Google Coral , make the detect → notify more realtime ?

I was using command line sensor

I believe frigate added this in latest beta release
This does Not work for usb coral

Thanks
Do you know where to find it in the latest beta ? I’m running that

Does Frigate itself see the event quickly ?
Is it a notification to your phone ?

I have person detection’s very quick to my phone, even before switching to a coral, maybe 2 or 3 seconds