Help with frigate required zones

hey all, i have been using frigate for a bt now and have been dealing with unwanted detections and found out i can set frigate to only detect people in specific zones using the “reqquired_zone” line but i am unsure on where to place this in my config

  driveway:
    ffmpeg:
      inputs:
               
        - path: rtsp://[email protected]:554/h264Preview_01_sub
          roles:
            - detect
            - record
      output_args:
        record: preset-record-generic-audio-copy
    zones:
     reolink_zone:
       coordinates: 0,720,470,720,1061,720,1087,666,1146,553,1165,458,844,487,564,503,316,497,0,571    
    motion:
     mask:
      - 0,360,177,340,243,328,311,385,259,411,223,454,240,506,0,555

any help is appreciated

Here is an example from my config for one camera:

cameras:
  garden:
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-copy
#      hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
      inputs:
        - path: rtsp://192.168.2.150:8554/garden_cam_sd
          input_args: preset-rtsp-restream
          roles:
            - detect
        - path: rtsp://192.168.2.150:8554/garden_cam_hd
          input_args: preset-rtsp-restream
          roles:
            - record
    detect:
      width: 640
      height: 360

    motion:
      mask:
        - 640,130,0,132,0,0,640,0
        - 464,77,476,27,541,0,640,0,640,218,306,108
        - 0,0,0,165,0,360,140,360,165,161
    objects:
      filters:
        person:
          threshold: 0.65
          min_score: 0.50
          mask:
            - 151,142,171,360,0,360,0,0
            - 608,0,640,0,640,265,308,173,306,150,304,104,456,79,480,0
        dog:
          mask:
            - 151,142,171,360,0,360,0,0
            - 608,0,640,0,640,265,308,173,306,150,304,104,456,79,480,0
    
    zones:
      garden_patio:
        coordinates: 323,360,420,360,469,360,516,360,551,360,593,132,298,121,258,252
        filters:
          person:
            threshold: 0.65
      garden_steps:
        coordinates: 280,360,236,256,162,253,171,360
      gas_tank:
        coordinates: 120,0,192,0,179,84,113,75
      seating_area:
        coordinates: 159,153,153,71,256,66,281,151
        filters:
          person:
            threshold: 0.6

If I was adding required_zones I would probably add it here:

    detect:
      width: 640
      height: 360
   
    record:
      events:
        required_zones:
          - garden_steps
          - gas_tank
1 Like

something like this perhaps?

driveway:
    ffmpeg:
      inputs:
               
        - path: rtsp://[email protected]:554/h264Preview_01_sub
          roles:
            - detect
            - record
      output_args:
        record: preset-record-generic-audio-copy
    zones:
     reolink_zone:
       coordinates: 0,720,470,720,1061,720,1087,666,1146,553,1165,458,844,487,564,503,316,497,0,571    
    motion:
     mask:
      - 0,360,177,340,243,328,311,385,259,411,223,454,240,506,0,555

    record:
      events:
        required_zones:
          - reolink zone

Yup that looks like it is the correct indentation.
I didn’t even know it was a thing to be honest.

I use the next option mentioned in the documentation, I restrict to object detection in specific zones.
And because of the object masks - objects can only be detected in specific areas - ie I’m not expecting to find a person or a dog in the sky, so there is no point monitoring it.

1 Like

would this like actually RECORD though? i dont want it to record like a clip, only set off “detected person” automations when the person is in the zone?

im not actually recording anything so i think it may be of use to remove the record line from in roles? but i am unsure if that means record clips or like record detecytions or what i do have another part of the config bellow the camera if its more reccomended to link the required zones to that?

  doorbell:
    ffmpeg:
      inputs:
     
        - path: rtsp://adTrr/h264Preview_01_sub
          roles:
            - detect
      output_args:
        record: preset-record-generic-audio-copy
    zones:
     doorbell_drive:
       coordinates: 0,720,470,720,1061,720,1087,666,1146,553,1165,458,844,487,564,503,316,497,0,571    
    motion:
     mask:
      - 0,360,177,340,243,328,311,385,259,411,223,454,240,506,0,555



objects:
  track:
    - person
  filters:
    person:
      threshold: 0.7


If you don’t have a detect section, then I suspect you can just change record, to detect.

    detect:
      events:
        required_zones:
          - reolink zone

Having record in there probably wouldn’t do anything for you - because you don’t have a record role assigned to the camera.

1 Like

i seeee thanks a lot andd having it outside the specific device applies it to every device right i cuttently have 2 and if i was to add anyu more in future woult instantly register it correct?

follow up question any idea whats happening here?

image

I guess the required zones can only used be for snapshot and record.

1 Like

Did you get anywhere with this? I was hoping to do the same, have a zone for where ‘detection’ occurs on a particular camera. I still want the camera to record and detect elsewhere in the frame, just to provide a separate entity for the zone detection…

2 Likes

unfortunately not