question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Support]: High CPU Utilization and Motion Detection Too Sensitive

See original GitHub issue

Describe the problem you are having

After updating from 0.9.4 to 0.10 the cpu utilization increased significantly and the number of motion boxes appears to be the reasons. The increase in motion detection is happening on all four cameras. I’m using the default values for all motion parameters on both versions.

Looking for suggestions/settings to get the motion detection on version 0.10 closer to 0.9.4.

Motion boxes on version 0.9.4: Frigate 0  9 4 debug side cam Same view showing increased number of motion boxes on 0.10. It is very overcast today with no wind. When sunny there are 30 to 50 motion boxes in this view: Frigate 0 10 debug side cam On version 0.9.4 cpu utilization at 41%: cpu 0 9 4

On version 0.10 cpu utilization at 102% and goes much higher on sunny day: cpu 10

Version

0.10.0-BFECEE9

Frigate config file

mqtt:
  host: 192.168.0.217
  user: mqttadmin
  password: redacted

environment_vars:
  LIBVA_DRIVER_NAME: radeonsi

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

cameras:
  side_yard:
    ffmpeg:
      inputs:
        - path: rtsp://admin:redacted@192.168.50.226:554
          roles:
            - detect
    detect:
      width: 3840
      height: 2160
      fps: 5
    rtmp:
      enabled: false
    objects:
      track:
        - car
        - person
      filters:
        car:
          mask:
            - 2640,23,2558,514,3587,699,3714,0 #clock upper drive
            - 3217,0,3239,305,2640,594,2403,733,1625,1061,0,1696,0,0 #trees
            - 3498,1192,3639,351,3528,319,3314,806,3041,840,2756,981,2574,972,2435,1181,2384,1308,2057,1618,1764,1625,1723,1919,1402,2160,2884,2160 #bushes
        person:
          mask:
            - 2925,0,2947,435,3635,526,3714,0 #clock upper drive
            #- 3136,0,3746,0,3680,341,2909,325 #clock
            - 3217,0,3239,305,2640,594,2403,733,1625,1061,0,1696,0,0 #trees
            - 3498,1192,3639,351,3528,319,3403,624,3089,685,2830,924,2497,1074,2384,1308,2057,1618,1764,1625,1717,1825,1402,2160,2884,2160 #bushes
    record:
      enabled: True
      retain_days: 0
      events:
        retain:
          default: 5
    snapshots:
      enabled: True
      timestamp: True
      crop: True
      retain:
        default: 14
    motion:
      #threshold: 25
      mask: 
        - 3136,0,3746,0,3680,341,2909,325 #clock
        - 3217,0,3239,305,2640,594,2403,733,1625,1061,0,1696,0,0 #trees
        - 3498,1192,3639,351,3528,319,3403,624,3089,685,2756,981,2526,954,2413,1020,2384,1308,2057,1618,1764,1625,1717,1825,1402,2160,2884,2160 #bushes
        
  front_door:
    ffmpeg:
      inputs:
        - path: rtsp://admin:redacted@192.168.50.225:554
          roles:
            - detect
    detect:
      width: 3840
      height: 2160
      fps: 5
    rtmp:
      enabled: false
    objects:
      track:
        - person
        - car
      filters:
        person:
          # Optional: minimum score for the object to initiate tracking (default: shown below)
        #  min_score: 0.3
          # Optional: minimum decimal percentage for tracked object's computed score to be considered a true positive (default: shown below)
         # threshold: 0.5
          # Optional: mask to prevent this object type from being detected in certain areas (default: no mask)
          # Checks based on the bottom center of the bounding box of the object
          mask:
            - 2961,740,3057,1197,2595,1256,2458,1031,2713,733 #fountain
    record:
      enabled: True
      retain_days: 0
      events:
        retain:
          default: 5
    snapshots:
      enabled: True
      timestamp: True
      crop: True
      retain:
        default: 5
    motion:
      #threshold: 25
      mask:
        - 872,0,1425,107,3387,237,3840,296,3840,0,3138,0 #trees clock
        - 3840,353,3710,1236,3159,2160,2230,1773,2112,1368,2110,1029,2399,838,2672,737,2952,576,3246,503 #fountain area
        - 266,1072,587,1316,1548,744,1964,810,1577,1152,1511,1841,1033,2096,610,2160,0,1661,23,266 #left side of walk
        - 624,1172,717,981,615,906,203,933,378,1400
    zones:
      front_walk:
        coordinates: 995,2160,1331,1514,2335,1488,2668,2160 # 4K
  
  back_yard:
    ffmpeg:
      inputs:
        - path: rtsp://admin:redacted@192.168.50.227:554
          roles:
            - detect
    detect:   
       width: 3840
       height: 2160
       fps: 5
    rtmp:
      enabled: false
    objects:
      track:
        - person
      filters:
        person:
          mask:
            - 483,325,589,860,125,1163,0,801,0,489 # window
    record:
      enabled: True
      retain_days: 0
      events:
        retain:
          default: 5
    snapshots:
      enabled: True
      timestamp: True
      crop: True
      retain:
        default: 14
    motion:
      #threshold: 25  #for version .10
      mask:
        - 2810,365,3483,451,3638,547,3840,676,3840,0,3114,0,2857,0
        - 3840,1552,3840,2160,2727,2160,2749,1539
        - 483,325,589,860,125,1163,0,801,0,489 # window
        
  garage:
    ffmpeg:
      inputs:
        - path: rtsp://admin:redacted@192.168.50.228:554
          roles:
            - detect
    detect:    
      width: 3840
      height: 2160
      fps: 5
    rtmp:
      enabled: false
    record:
      enabled: True
      retain_days: 0
      events:
        retain:
          default: 5
    snapshots:
      enabled: True
      timestamp: True
      crop: True
      retain:
        default: 5
    motion:
      #threshold: 25
      mask:
        - 3840,774,1448,430,1486,0,3840,0
        - 469,314,528,523,503,621,191,751,93,380
        - 2540,976,3840,1473,3840,1311,2599,844
        #- 3762,2130,3769,1825,3007,1730,2444,1727,1691,1866,1163,2160 # bed by AC
        #- 3840,0,3840,2160,0,2160,0,0 # masks complete view
    zones:
      side_door:
        coordinates: 1193,2160,701,2160,464,1814,1058,1539,1557,1930   
detectors: 
  #coral_pci:
   # type: edgetpu
    #device: pci
 # coral1:
  #  type: edgetpu
   # device: pci:0
  cpu1:
    type: cpu
  cpu2:
    type: cpu
  cpu3:
    type: cpu
  cpu4:
    type: cpu
  cpu5:
    type: cpu 
birdseye:
  enabled: True
  width: 3840 #1280
  height: 2160 #720
  quality: 18

Relevant log output

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[2022-02-22 15:58:59] frigate.app                    INFO    : Starting Frigate (0.10.0-bfecee9)
[2022-02-22 15:58:59] frigate.config                 WARNING : The 'retain_days' config option has been DEPRECATED and will be removed in a future version. Please use the 'days' setting under 'retain'
[2022-02-22 15:58:59] frigate.config                 WARNING : The 'retain_days' config option has been DEPRECATED and will be removed in a future version. Please use the 'days' setting under 'retain'
[2022-02-22 15:58:59] frigate.config                 WARNING : The 'retain_days' config option has been DEPRECATED and will be removed in a future version. Please use the 'days' setting under 'retain'
[2022-02-22 15:59:00] frigate.config                 WARNING : The 'retain_days' config option has been DEPRECATED and will be removed in a future version. Please use the 'days' setting under 'retain'
[2022-02-22 15:59:00] frigate.app                    INFO    : Creating directory: /tmp/cache
Starting migrations
[2022-02-22 15:59:00] peewee_migrate                 INFO    : Starting migrations
There is nothing to migrate
[2022-02-22 15:59:00] peewee_migrate                 INFO    : There is nothing to migrate
[2022-02-22 15:59:00] detector.cpu1                  INFO    : Starting detection process: 220
[2022-02-22 15:59:00] detector.cpu2                  INFO    : Starting detection process: 222
[2022-02-22 15:59:00] frigate.edgetpu                WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
[2022-02-22 15:59:00] detector.cpu5                  INFO    : Starting detection process: 228
[2022-02-22 15:59:00] frigate.edgetpu                WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
[2022-02-22 15:59:00] frigate.app                    INFO    : Output process started: 230
[2022-02-22 15:59:00] frigate.edgetpu                WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
[2022-02-22 15:59:00] frigate.app                    INFO    : Camera processor started for side_yard: 232
[2022-02-22 15:59:00] detector.cpu4                  INFO    : Starting detection process: 226
[2022-02-22 15:59:00] detector.cpu3                  INFO    : Starting detection process: 224
[2022-02-22 15:59:00] frigate.edgetpu                WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
[2022-02-22 15:59:00] frigate.edgetpu                WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
[2022-02-22 15:59:00] frigate.app                    INFO    : Camera processor started for front_door: 235
[2022-02-22 15:59:00] frigate.app                    INFO    : Camera processor started for back_yard: 236
[2022-02-22 15:59:00] frigate.app                    INFO    : Camera processor started for garage: 238
[2022-02-22 15:59:00] frigate.app                    INFO    : Capture process started for side_yard: 239
[2022-02-22 15:59:00] frigate.app                    INFO    : Capture process started for front_door: 243
[2022-02-22 15:59:00] frigate.app                    INFO    : Capture process started for back_yard: 245
[2022-02-22 15:59:00] frigate.app                    INFO    : Capture process started for garage: 249
[2022-02-22 15:59:00] ws4py                          INFO    : Using epoll
[2022-02-22 15:59:00] ws4py                          INFO    : Using epoll
[2022-02-22 16:00:52] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:36232]
[2022-02-22 16:03:10] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:36232]
[2022-02-22 16:10:39] ws4py                          INFO    : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:40648]
[2022-02-22 16:12:45] ws4py                          INFO    : Terminating websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:40648]

FFprobe output from your camera

NA

Frigate stats

No response

Operating system

Windows

Install method

HassOS Addon

Coral version

CPU (no coral)

Network connection

Wired

Camera make and model

Amcrest 4k ip8m-2496e

Any other information that may be helpful

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
greg520820commented, Apr 3, 2022

The problem I was having restoring the 0.9.4 backup was resolved by updating to Supervisor version 9.3. This is troubling since I hadn’t made any changes to anything on HA except switching back and forth between Frigate versions. So the backup stopped working due to some change that was made external to my system. I’ve started making image backups.

Frigate version 10.1 certainly has solved the increased motion sensitivity issues that I was having. I have been able to use the motion parameters from version 0.9.4 with excellent results. I’m having some problems with stationary object detection, but will open another issue to address those.

1reaction
blakeblackshearcommented, Feb 22, 2022

Assuming the resolutions are the same, with 0.9.4 your previous motion settings would have been calculated as:

frame_height: 360
contour_area: 400

However, reverting to these values won’t match the same behavior due to the new dynamic contrast.

I would recommend the following:

  1. Try increasing your contour_area. If you find that small objects are not being detected as motion, reduce that number back to the default.
  2. Try increasing your threshold. If you start missing motion, that means the difference in the pixel values isn’t enough to cross the threshold.
  3. You could also see if your cameras support Wide Dynamic Range (WDR) and enable that. It should increase the contrast on the camera dynamically which would reduce the amount Frigate dynamically adjusts contrast.
  4. As a last resort, try increasing the frame_height and contour_area together while keeping the contour_area roughly the same % of the total pixels of the frame resolution.

Also, thanks a ton for the well crafted issue. Much appreciated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

3.0.8 High cpu utilization with motion recording.
8 from 3.0. 7 my CPU utilization has skyrocked. When I turn off motion recording on the 2 cameras the Utilization goes back...
Read more >
High CPU - at 100% - Milestone forum
One of my recording servers have constant 100% CPU usage. Process utilizing this CPU time name is "Milestone xProtect recording".
Read more >
Very high CPU usage in Frigate : r/homeassistant - Reddit
Hi All. I'm running a frigate 0.8.4-5043040 with 8 cameras, 5 of which I have object detection on. If it matters, I am...
Read more >
High CPU Utilization - IP Cam Talk
It doesn't seem to matter which cameras I disable/enable. Any thoughts as to why the CPU jumps up so wildly for the last...
Read more >
Motion detection CPU -usage - Ideas - Bluecherry
This is by far the best way to reduce CPU load when doing server side motion detection and because I have many cameras...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found