blakeblackshear / frigate

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

[Config Support]: person detection only in zone #9390

Closed ViezeVisNL closed 10 months ago

ViezeVisNL commented 10 months ago

Describe the problem you are having

Hey!

My Reolink Doorbell POE is running fluently on Frigate now. But what I noticed is that the person detection happens even outside of the zone. And if I make a motion mask in the middle of the screen I am afraid the camera might not be detecting persons quick. I am using the entity 'camera.reolink_person'.

Can I set my config so only person detection happens in the zone only, instead of outside the zone? See the example here.

You can see a person here: image

You can see the motion- and zone masks here. image

I thought with my config setting snapshots enabled only to the 'zone_voortuin' it should not trigger snapshots outside of this area. But I might misinterpreted that. See my config. I removed go2rtc, model, detector, mqtt part.

If you see any other strange things just let me know. Thnx !

Version

0.12.1-367D724

Frigate config file

#Cameras
cameras:
  reolink:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/reolink
          input_args: preset-rtsp-restream
          roles:
            - record
#            - detect
        - path: rtsp://127.0.0.1:8554/reolink_sub
          input_args: preset-rtsp-restream
          roles:
            - detect
      output_args:
        record: preset-record-generic-audio-copy
    mqtt:
      enabled: true
      timestamp: false
      bounding_box: true
      crop: false
    motion:
      mask:
        - 347,445,351,0,0,0,0,544
        - 1280,565,1280,0,942,87,958,454
        - 347,233,944,224,939,160,349,175
    zones:
      zone_voortuin:
        coordinates: 1280,720,1280,571,967,465,709,474,381,463,0,570,0,720
#default camera conf
objects:
  track:
    - person
  filters:
    person:
      threshold: 0.7

snapshots:
  enabled: True
  required_zones:
    - zone_voortuin
  retain:
    default: 14
    objects:
      person: 14

#record
record:
  enabled: True
  retain:
    days: 0
    mode: motion
  events:
    retain:
      default: 14
      mode: active_objects
      objects:
        person: 14

Relevant log output

//

Frigate stats

No response

Operating system

HassOS

Install method

HassOS Addon

Coral version

CPU (no coral)

Any other information that may be helpful

No response

NickM-27 commented 10 months ago

you need to make the zone required for snapshots and recordings https://docs.frigate.video/configuration/zones#restricting-events-to-specific-zones

also using motion masks like that is discouraged and not how they are supposed to be used

ViezeVisNL commented 10 months ago

@NickM-27 I miscopied my config. It is listed. The Motion Masks should only be used for the false-positive regions such as plants etc?

#Cameras
cameras:
  reolink:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/reolink
          input_args: preset-rtsp-restream
          roles:
            - record
#            - detect
        - path: rtsp://127.0.0.1:8554/reolink_sub
          input_args: preset-rtsp-restream
          roles:
            - detect
      output_args:
        record: preset-record-generic-audio-copy
    mqtt:
      enabled: true
      timestamp: false
      bounding_box: true
      crop: false
    motion:
      mask:
        - 347,445,351,0,0,0,0,544
        - 1280,565,1280,0,942,87,958,454
        - 347,233,944,224,939,160,349,175
    zones:
      zone_voortuin:
        coordinates: 1280,720,1280,571,967,465,709,474,381,463,0,570,0,720

#default camera conf
objects:
  track:
    - person
  filters:
    person:
      threshold: 0.7

snapshots:
  enabled: True
  required_zones:
    - zone_voortuin
  retain:
    default: 14
    objects:
      person: 14

#record
record:
  enabled: True
  retain:
    days: 0
    mode: motion
  events:
    retain:
      default: 14
      mode: active_objects
      objects:
        person: 14
    required_zones:
      - zone_voortuin
NickM-27 commented 10 months ago

The Motion Masks should only be used for the false-positive regions such as plants etc?

motion masks are not used for stopping objects from being detected, they are used for blocking out areas of motion that are not going to have objects. For example the sky, timestamps, tops of trees, etc.

ViezeVisNL commented 10 months ago

@NickM-27 Check. Will dive into that later. But based on the config above you'll see the required zones are listed under record & snapshots. Is that what it should be?

NickM-27 commented 10 months ago

Yes, so frigate thought that object entered the zone. In frigate 0.13 there have been many changes and improvement to the zone behavior as well as the ability to see the moment that the object entered the zone.

ViezeVisNL commented 10 months ago

Ok, thanks. Ill update once available. But before that I'll connect a Coral. Currently running on CPU but managed to get a USB Coral :-)

Thanks!

ViezeVisNL commented 10 months ago

And Ill have a look at the motion masks. Are motion masks related to performance or not specific?

NickM-27 commented 10 months ago

Generally they are to reduce wasted cpu usage in motion that won't be related to objects.

ViezeVisNL commented 10 months ago

Thanks. You may close this case.