blakeblackshear / frigate

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

[Support]: Unable to get mqtt messages when min_score is less than 0.7 #2352

Closed bm55 closed 2 years ago

bm55 commented 2 years ago

Describe the problem you are having

Unable to get mqtt messages when min_score is less than 0.7. My config has 2 zones called "frontRoad" and "backRoad" with min_score 0.4 and 0.2 but the "frigate/events" never shows any messages unless the min_score is over the default 0.7

Is this by design or something wrong with my config? I am hoping to trigger exterior lights when the 2 zones I mentioned detects person with low score even if it's a false detection.

I use NodeRed to view the score "payload.after.top_score" Screenshot 2021-11-30 133321

Version

0.10.0-C1155AF

Frigate config file

# https://github.com/blakeblackshear/frigate/blob/release-0.9.0/docs/docs/configuration/index.md
mqtt:
  #host: mqtt.server.com
  host: 192.168.0.60
  topic_prefix: frigate
  user: username # Optional
  password: password # Optional

detectors:
  coral:
    type: edgetpu
    device: usb

database:
  path: /media/frigate/database/frigate.db

logger:
  default: info
  logs: 
    frigate.event: debug

ffmpeg:
  input_args:
    - -avoid_negative_ts
    - make_zero
    - -fflags
    - nobuffer+genpts+discardcorrupt
    - -flags
    - low_delay
    - -strict
    - experimental
    - -analyzeduration
    - 1000M
    - -probesize
    - 1000M
    - -rw_timeout
    - "5000000"
  output_args:
    record: -f segment -segment_time 10 -segment_format ts -reset_timestamps 1 -strftime 1 -c copy
  hwaccel_args:
    - -hwaccel
    - vaapi
    - -hwaccel_device
    - /dev/dri/renderD128
    - -hwaccel_output_format
    - yuv420p 

detect:
  width: 2048
  height: 1536
  fps: 6 #5
  max_disappeared: 25

objects:
  track:
    - person
    - dog
    - cat
    - motorcycle
    - bicycle
    #- car

motion:
  contour_area: 23 #30
  #frame_height: 60 #50

timestamp_style:
  position: "tr"
  thickness: 2

cameras:
  garage:
    ffmpeg:
      inputs:
        - path: http://192.168.0.139/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password=password
          roles:
            - detect
            - rtmp 
        - path: http://192.168.0.139/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=password
          roles:
            - record
    detect: # Camera level detect option 
      width: 896
      height: 672
    record:
      enabled: True
      retain_days: 30
    snapshots:
      enabled: True
      timestamp: True
      bounding_box: True
      crop: False
    motion:
      mask:
        - 0,234,36,220,23,174,113,104,184,43,271,0,0,0 
    zones:
      drivewayA:
        coordinates: 707,672,385,241,167,274,226,672
        filters:
          person:
            #min_area: 5000
            #max_area: 100000
            min_score: 0.6
            threshold: 0.8        
      drivewayB:
        coordinates: 0,672,0,320,174,272,234,672
        filters:
          person:
            min_score: 0.5
            threshold: 0.7
      drivewayC: 
        coordinates: 534,238,652,271,796,207,830,261,874,188,896,166,896,672,708,672,381,245
        filters:
          person:
            min_score: 0.5
            threshold: 0.7       
      frontRoad:
        coordinates: 0,0,830,0,775,187,602,155,483,195,0,271
        filters:
          person:
            min_score: 0.4
            threshold: 0.5

  back:
    ffmpeg:
      inputs:
        - path: rtmp://192.168.0.138:1935/bcs/channel0_sub.bcs?channel=0&stream=0&user=admin&password={FRIGATE_CAM_PASSWORD}
          roles:
            - detect
            - rtmp 
        - path: rtmp://192.168.0.138:1935/bcs/channel0_main.bcs?channel=0&stream=0&user=admin&password={FRIGATE_CAM_PASSWORD}
          roles:
            - record

    detect:
      width: 640
      height: 480 
    record:
      enabled: True
      retain_days: 30
    snapshots:
      enabled: True
      timestamp: True
      bounding_box: True
      crop: False
    motion:
      mask:
        - 558,230,509,245,488,256,486,300,512,331,509,366,543,408,640,367,640,321,607,239
        - 218,368,346,287,346,189,315,0,193,246
        - 640,120,619,102,584,125,609,163,640,190
    zones:
      frontDoorA:
        coordinates: 640,480,527,426,512,254,395,256,258,413,132,269,0,274,0,480
        filters:
          person:
            min_score: 0.5
            threshold: 0.7
      frontDoorB:
        coordinates: 373,41,484,42,510,83,568,162,640,220,388,282
        filters:
          person:
            min_score: 0.5
            threshold: 0.7
      backRoad:
        coordinates: 599,121,544,54,484,31,348,28,349,0,640,0,640,143
        filters:
          person:
            min_score: 0.2
            threshold: 0.3

Relevant log output

see the screenshot

FFprobe output from your camera

N/A

Frigate stats

{"back":{"camera_fps":6.0,"capture_pid":241,"detection_fps":6.2,"pid":235,"process_fps":6.0,"skipped_fps":0.0},"detection_fps":9.3,"detectors":{"coral":{"detection_start":0.0,"inference_speed":12.3,"pid":225}},"garage":{"camera_fps":6.1,"capture_pid":237,"detection_fps":3.1,"pid":232,"process_fps":6.1,"skipped_fps":0.0},"service":{"storage":{"/dev/shm":{"free":131.9,"mount_type":"tmpfs","total":134.2,"used":2.4},"/media/frigate/clips":{"free":2139660.1,"mount_type":"ext4","total":2952432.7,"used":662726.3},"/media/frigate/recordings":{"free":2139660.1,"mount_type":"ext4","total":2952432.7,"used":662726.3},"/tmp/cache":{"free":1986.6,"mount_type":"tmpfs","total":2000.0,"used":13.4}},"uptime":1970,"version":"0.10.0-c1155af"}}

Operating system

Other Linux

Install method

Docker Compose

Coral version

USB

Network connection

Wired

Camera make and model

Reolink

Any other information that may be helpful

No response

blakeblackshear commented 2 years ago

The default threshold at the camera level is 0.7. Camera level filters are applied before the zone filters, so you need to lower the threshold in the objects config to 0.5.

Also worth noting that zone filters do not remove false positives.

bm55 commented 2 years ago

Thanks @blakeblackshear and also for this example https://deploy-preview-1927--frigate-docs.netlify.app/configuration/zones#restricting-zones-to-specific-objects