Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Config Support]: Differences from threshold to min/max_score #6795

Closed
ostracizado opened this issue Jun 14, 2023 · 6 comments
Closed

[Config Support]: Differences from threshold to min/max_score #6795

ostracizado opened this issue Jun 14, 2023 · 6 comments

Comments

@ostracizado
Copy link

Describe the problem you are having

Hey,

I almost had it... Just recently I hardly had any false positives in any of the cameras but after trying to use the new storage network changes from HA and getting the error of corrupted database, I had to changed it all back to a clean state.

For some reason, and I only tried changing the fps in some of the cameras, now in camera "outside_front", "zone_0", I'm getting persons usually at 80% and a dog at 50%, 65% also as a person.


Could some one give an idea about the difference of threshold and min_score/max_score?
Honestly, even now I really don't get the difference exactly and when to apply one or the other... Should I just resolve the latter problem of identification by putting "min_score: 0.7" as a filter for person in that camera/zone?

Like in the question I had before; even when the dog is identified as person in the event: the yellow bounding box is at 50% but in the tab of the event it shows as Person(71%).

Version

0.12.1

Frigate config file

mqtt:
  host: ###.###2.100
  user: mqtt-user
  password: ########

#logger:
#  default: error

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

  
ffmpeg:
  hwaccel_args: preset-vaapi
  
  
detectors:
  coral:
    type: edgetpu
    device: usb

go2rtc:
  streams:
    hall:
      - rtsp://hallcamera:########@###.###2.209:554/stream1

    outside_front:
      - rtsp://outsidefront:########@###.###2.133:554/stream1
 #   outsidefront_sub:
 #     - rtsp://outsidefront:########@###.###2.133:554/stream2

    outside_back:
      - rtsp://outsideback:########@###.###2.249:554/stream1
 #   outsideback_sub:
 #     - rtsp://outsideback:########@###.###2.249:554/stream2

    outside_gate:
      - rtsp://outsidegate:########@###.###2.18:554/stream1
 #   outside_gate_sub:
 #     - rtsp://outsidegate:########@###.###2.18:554/stream2

#birdseye:
#  enabled: True
#  mode: objects

cameras:    
  hall:
    ffmpeg:
      inputs:
  #      - path: rtsp://127.0.0.1:8554/outside_front_sub #sd 640x360 - stream2
  #        input_args: preset-rtsp-restream
  #        roles:
  #          - detect
        - path: rtsp://127.0.0.1:8554/hall #hd 1920x1080 - stream1 2k 2304x1296
          input_args: preset-rtsp-restream
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 5
    snapshots:
      enabled: true
      timestamp: false
      bounding_box: true
#      crop: True
      required_zones:
        - zone_0
    objects:
      track:
        - person
    #    - dog
    #  filters:
    #    person:
    #      min_score: 0.7
    #      threshold: 0.8
    #      min_area: 10000
    record:
      enabled: True
      retain: 
        days: 2
      events:
        required_zones:
          - zone_0
        retain:
          default: 3
          mode: motion 
        pre_capture: 5
        post_capture: 15  
    zones:
      zone_0:
        coordinates: 1608,1080,1388,218,1304,0,896,0,965,1080
        objects:
          - person
        #  - dog
        filters:
          person:
            mask:
              - 1920,0,1279,0,1618,1080,1920,1080
          #dog:
          #  mask:
          #    - 1920,0,1279,0,1618,1080,1920,1080
 #       filters:
 #         person:
 #           min_area: 2000
 #         cat:
 #           max_area: 10000
 #     zone_1:
 #       coordinates: 0,930,0,517,188,527,175,923
 #       objects:
 #         - person
 #         - dog
 #       filters:
 #         person:
 #           min_area: 8000
 #           threshold: 0.7
    motion:
      improve_contrast: true
      mask:
        - 1920,0,1282,0,1618,1080,1920,1080
        - 1004,483,896,0,893,0,0,0,0,1080,967,1080

  outside_front:
    ffmpeg:
      inputs:
  #      - path: rtsp://127.0.0.1:8554/outside_front_sub #sd 640x360 - stream2
  #        input_args: preset-rtsp-restream
  #        roles:
  #          - detect
        - path: rtsp://127.0.0.1:8554/outside_front #hd 1920x1080 - stream1 2k 2304x1296
          input_args: preset-rtsp-restream
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 10
    snapshots:
      enabled: true
      timestamp: false
      bounding_box: true
      crop: False
      required_zones:
        - zone_0
        - zone_1
    objects:
      track:
        - person
        - dog
        - cat
    #  filters:
    #    person:
    #      min_score: 0.7
    #      threshold: 0.8
    #      min_area: 10000
    record:
      enabled: True
      retain: 
        days: 2
      events:
        required_zones:
          - zone_0
          - zone_1
        retain:
          default: 3
          mode: motion 
        pre_capture: 5
        post_capture: 15  
    zones:
      zone_0:
        coordinates: 886,634,918,1080,0,1080,0,604
        objects:
          - person
          - dog
        filters:
          person:
            min_area: 8000
            min_score: 0.7
          #cat:
          #  max_area: 10000
      zone_1:
        coordinates: 0,930,0,517,188,527,175,923
        objects:
          - person
          - dog
        filters:
          person:
            min_area: 8000
            threshold: 0.7
    motion:
      improve_contrast: true
      mask:
        - 0,69,616,63,612,0,0,0
        - 878,569,1073,557,1114,817,1182,1080,1019,1080
        - 925,697,1920,797,1920,0,919,0,707,0,228,0
        - 1920,1080,1920,770,1007,686,1047,1080

  outside_back:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/outside_back?video=copy&audio=aac #hd 1920x1080 - stream1 2k 2304x1296
          input_args: preset-rtsp-restream
          roles:
            - detect
            - record
    detect:
      width: 1920
      height: 1080
      fps: 10
    snapshots:
      enabled: true
      timestamp: false
      bounding_box: true
      required_zones:
        - zone_0
        - zone_1
    objects:
      track:
        - person
        - dog
        - cat
      filters:
        person:
          mask:
            - 478,624,520,619,508,539,486,539
            - 88,527,78,633,112,627,118,527
            - 1410,755,1621,785,1675,537,1394,521
          min_score: 0.7
      #    threshold: 0.8
          #min_area: 700
    record:
      enabled: True
      retain: 
        days: 2
      events:
        required_zones:
          - zone_0
          - zone_1
        retain:
          default: 3
          mode: motion 
        pre_capture: 5
        post_capture: 15
    zones:
      zone_0:
        coordinates: 1079,1080,1315,868,1406,766,1500,890,1552,896,1557,777,1321,577,1040,640,0,740,0,1080 
        objects:
          - person
          - dog   
          - cat
        filters:
          dog:
            min_area: 8000
          cat:
            max_area: 7500         
      zone_1:
        coordinates: 1315,583,429,471,0,478,0,583,0,748
        objects:
          - person
          - dog
          - cat    
    motion:
      improve_contrast: true
      mask:
        - 0,69,616,63,612,0,0,0
        - 1920,0,677,0,293,0,0,0,0,483,851,492,1133,549,1217,566,1343,592,1506,701,1920,734
        - 1920,673,1920,1005,1653,999,1497,691

        
  outside_gate:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/outside_gate #hd 1920x1080 - stream1 2k 2304x1296
          input_args: preset-rtsp-restream
          roles:
            - detect
            - record
    detect:
    #  stationary:
    #    interval: 10
      width: 1920
      height: 1080
      fps: 10
    snapshots:
      enabled: true
      timestamp: false
      bounding_box: true
      required_zones:
        - zone_0
        - zone_1
        - zone_2
      #crop: True
      retain:
        default: 3
    record:
      enabled: True
      retain:
        days: 2 
      events:
        retain:
          default: 4
          mode: active_objects 
        required_zones:
         - zone_0
         - zone_1
         - zone_2
        pre_capture: 3
        post_capture: 10 
    objects:
      track:
        - person
        - dog
        - cat
        - car
      filters:
        person:
          mask:
            - 964,181,1116,193,1099,0,979,0
            - 1454,299,1532,299,1577,130,1536,119
            - 40,814,999,770,994,0,170,201
      #    min_score: 0.7
      #    threshold: 0.8
          #min_area: 700
    motion:
      improve_contrast: true 
      mask:
        - 0,69,616,63,612,0,0,0
        - 201,408,369,252,99,74,0,57
    zones:
      zone_0:
        coordinates: 0,784,795,784,1073,471,1920,465,1920,1080,0,1080
        objects:
          - person
          - dog
          - cat
        filters:
          dog:
            min_area: 5000
          cat:
            max_area: 4000 
      zone_1:
        coordinates: 1920,498,1026,443,902,431,1103,130,1920,146,1920,486
        objects:
          - person
          - dog
          - cat
        filters:
          dog:
            min_area: 5000
          cat:
            max_area: 4000 
          person:
            mask: 
              - 1622,0,1530,282,1488,270,1530,22
            min_score: 0.4
            max_area: 6000
      zone_2:
        coordinates: 1445,0,1075,0,1067,158,1453,134
        objects:
          - person
          - dog
          - cat
          - car
        filters:
          person:
            min_area: 2000

Relevant log output

s6-rc: info: service s6rc-fdholder: starting
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service s6rc-fdholder successfully started
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service log-prepare: starting
s6-rc: info: service log-prepare successfully started
s6-rc: info: service nginx-log: starting
s6-rc: info: service go2rtc-log: starting
s6-rc: info: service frigate-log: starting
s6-rc: info: service nginx-log successfully started
s6-rc: info: service go2rtc-log successfully started
s6-rc: info: service go2rtc: starting
s6-rc: info: service frigate-log successfully started
s6-rc: info: service go2rtc successfully started
s6-rc: info: service go2rtc-healthcheck: starting
s6-rc: info: service frigate: starting
s6-rc: info: service go2rtc-healthcheck successfully started
s6-rc: info: service frigate successfully started
s6-rc: info: service nginx: starting
s6-rc: info: service nginx successfully started
s6-rc: info: service legacy-services: starting
2023-06-14 10:25:51.841594155  [INFO] Preparing go2rtc config...
2023-06-14 10:25:51.841980030  [INFO] Starting Frigate...
2023-06-14 10:25:51.842495594  [INFO] Starting NGINX...
s6-rc: info: service legacy-services successfully started
2023-06-14 10:25:51.864644973  [INFO] Got IP address from supervisor: ###.###.2.100
2023-06-14 10:25:51.886516011  [INFO] Got WebRTC port from supervisor: 8555
2023-06-14 10:25:52.127445134  [INFO] Starting go2rtc...
2023-06-14 10:25:52.182410299  11:25:52.182 INF go2rtc version 1.2.0 linux/amd64
2023-06-14 10:25:52.182569862  11:25:52.182 INF [api] listen addr=:1984
2023-06-14 10:25:52.182716643  11:25:52.182 INF [rtsp] listen addr=:8554
2023-06-14 10:25:52.182861136  11:25:52.182 INF [srtp] listen addr=:8443
2023-06-14 10:25:52.182962182  11:25:52.182 INF [webrtc] listen addr=:8555
2023-06-14 10:25:52.593593659  [2023-06-14 11:25:52] frigate.app                    INFO    : Starting Frigate (0.12.1-367d724)
2023-06-14 10:25:52.632757361  [2023-06-14 11:25:52] frigate.app                    INFO    : Creating directory: /tmp/cache
2023-06-14 10:25:52.634022172  [2023-06-14 11:25:52] peewee_migrate                 INFO    : Starting migrations
2023-06-14 10:25:52.637033671  [2023-06-14 11:25:52] peewee_migrate                 INFO    : There is nothing to migrate
2023-06-14 10:25:52.649722288  [2023-06-14 11:25:52] detector.coral                 INFO    : Starting detection process: 442
2023-06-14 10:25:55.269990396  [2023-06-14 11:25:52] frigate.app                    INFO    : Output process started: 444
2023-06-14 10:25:55.274673525  [2023-06-14 11:25:52] frigate.detectors.plugins.edgetpu_tfl INFO    : Attempting to load TPU as usb
2023-06-14 10:25:55.274753021  [2023-06-14 11:25:52] frigate.app                    INFO    : Camera processor started for hall: 450
2023-06-14 10:25:55.274784648  [2023-06-14 11:25:55] frigate.detectors.plugins.edgetpu_tfl INFO    : TPU found
2023-06-14 10:25:55.274827087  [2023-06-14 11:25:52] frigate.app                    INFO    : Camera processor started for outside_front: 451
2023-06-14 10:25:55.274870076  [2023-06-14 11:25:52] frigate.app                    INFO    : Camera processor started for outside_back: 452
2023-06-14 10:25:55.274915043  [2023-06-14 11:25:52] frigate.app                    INFO    : Camera processor started for outside_gate: 454
2023-06-14 10:25:55.274953840  [2023-06-14 11:25:52] frigate.app                    INFO    : Capture process started for hall: 456
2023-06-14 10:25:55.274986419  [2023-06-14 11:25:52] frigate.app                    INFO    : Capture process started for outside_front: 459
2023-06-14 10:25:55.275026574  [2023-06-14 11:25:52] frigate.app                    INFO    : Capture process started for outside_back: 464
2023-06-14 10:25:55.275060525  [2023-06-14 11:25:52] frigate.app                    INFO    : Capture process started for outside_gate: 466
2023-06-14 10:26:01.842377783  [INFO] Starting go2rtc healthcheck service...
2023-06-14 10:26:01.870593461  172.30.32.1 - - [14/Jun/2023:11:26:01 +0100] "GET /api/stats HTTP/1.1" 200 3163 "-" "HomeAssistant/2023.6.1 aiohttp/3.8.4 Python/3.11" "-"
2023-06-14 10:26:09.884792369  172.30.32.1 - - [14/Jun/2023:11:26:09 +0100] "GET /api/stats HTTP/1.1" 200 3123 "-" "HomeAssistant/2023.6.1 aiohttp/3.8.4 Python/3.11" "-"
2023-06-14 10:26:17.869518413  172.30.32.1 - - [14/Jun/2023:11:26:17 +0100] "GET /api/stats HTTP/1.1" 200 3126 "-" "HomeAssistant/2023.6.1 aiohttp/3.8.4 Python/3.11" "-"
2023-06-14 10:26:25.868553114  172.30.32.1 - - [14/Jun/2023:11:26:25 +0100] "GET /api/stats HTTP/1.1" 200 3124 "-" "HomeAssistant/2023.6.1 aiohttp/3.8.4 Python/3.11" "-"

Frigate stats

No response

Operating system

HassOS

Install method

HassOS Addon

Coral version

USB

Any other information that may be helpful

No response

@blakeblackshear
Copy link
Owner

@ostracizado
Copy link
Author

I did read that same page countless time; and honestly I still lack a click inside my head.
At least related with the GUI question.

Is that value in the event tab, where you can pick between Clip and Snapshot, for instance "Person(71%)", a media of the Score History?

@NickM-27
Copy link
Sponsor Collaborator

min_score is the score required for frigate to start tracking the object. Basically, to stop ignoring it.

threshold is the score required for frigate to consider the object a true positive, create an event, etc.

the score on the event page next to the label is the highest median score that the object received throughout the process. The score in the snapshot is the score of that object in that exact moment

@ostracizado
Copy link
Author

ostracizado commented Jun 14, 2023

Thanks a lot Nick, that gives me a better perspective of those functions!
Is there a way to tweak how long it takes for one detection to become a positive?

Or with both those options there's no need? Case scenario: if one detection that's being tracked (min_score: 0.6 / threshold: 0.7) reaches 70%, it instantly becomes an event?

I'm trying to balance the false positives with the possible lack of detection.

@NickM-27
Copy link
Sponsor Collaborator

The values are always set to something, they have default values and you can configure them differently.

"How long it takes" depends entirely on the score and the threshold

@ostracizado
Copy link
Author

Ok, thanks a lot for your time and help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants