[Support]: Using Edge TPU (pcie) but CPU usage is still high
See original GitHub issueDescribe the problem you are having
Hi, currently configured full resolution detection for all my cameras. Are there any other settings that I need configure to lower the cpu usage?
Version
0.9.1
Frigate config file
mqtt:
host: 192.168.2.199
user: mqtt-user
password: pass
ffmpeg:
hwaccel_args:
- -hwaccel
- qsv
- -qsv_device
- /dev/dri/renderD128
output_args:
# Optional: output args for detect streams (default: shown below)
detect: -f rawvideo -pix_fmt yuv420p
# Optional: output args for record streams (default: shown below)
record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -codec:a aac
# Optional: output args for rtmp streams (default: shown below)
rtmp: -c copy -f flv
detectors:
coral1:
type: edgetpu
device: pci:0
birdseye:
enabled: True
width: 1280
height: 720
# Optional: Encoding quality of the mpeg1 feed (default: shown below)
# 1 is the highest quality, and 31 is the lowest. Lower quality feeds utilize less CPU resources.
quality: 8
# Optional: Mode of the view. Available options are: objects, motion, and continuous
# objects - cameras are included if they have had a tracked object within the last 30 seconds
# motion - cameras are included if motion was detected in the last 30 seconds
# continuous - all cameras are included always
mode: objects
objects:
# Optional: list of objects to track from labelmap.txt (default: shown below)
track:
- person
- cat
- chicken
record:
enabled: False
retain_days: 0
events:
max_seconds: 300
pre_capture: 5
post_capture: 5
objects:
- person
- cat
- chicken
required_zones: []
retain:
default: 10
objects:
person: 25
snapshots:
enabled: True
timestamp: False
bounding_box: True
crop: False
# Optional: height to resize the snapshot to (default: original size)
# height: 175
required_zones: []
retain:
# Required: Default retention days (default: shown below)
default: 10
# Optional: Per object retention days
objects:
person: 25
cameras:
Frontporch:
ffmpeg:
inputs:
- path: rtsp://192.168.2.148:554/ch0.h264
roles:
- detect
- rtmp
- record
detect:
width: 1280
height: 720
fps: 5
Backdoor:
ffmpeg:
inputs:
- path: rtsp://admin:pass@192.168.2.223/Streaming/Channels/101
roles:
- detect
- rtmp
- record
detect:
width: 2560
height: 1440
fps: 5
Backyard:
ffmpeg:
inputs:
- path: rtsp://admin:pass@192.168.2.224/Streaming/Channels/101
roles:
- detect
- rtmp
- record
detect:
width: 2560
height: 1440
fps: 5
Front Lawn:
ffmpeg:
inputs:
- path: rtsp://admin:pass@192.168.2.225/Streaming/Channels/101
roles:
- detect
- rtmp
- record
detect:
width: 2560
height: 1440
fps: 5
Carporch:
ffmpeg:
inputs:
- path: rtsp://admin:pass@192.168.2.228/Streaming/Channels/101
roles:
- detect
- rtmp
- record
detect:
width: 2560
height: 1440
fps: 5
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.
[2021-10-14 20:09:25] frigate.app INFO : Starting Frigate (0.9.1-800f33e)
[2021-10-14 20:09:25] frigate.app INFO : Creating directory: /tmp/cache
[2021-10-14 20:09:25] frigate.app WARNING : Camera Frontporch has record assigned to an input, but record is not enabled.
[2021-10-14 20:09:25] frigate.app WARNING : Camera Backdoor has record assigned to an input, but record is not enabled.
[2021-10-14 20:09:25] frigate.app WARNING : Camera Backyard has record assigned to an input, but record is not enabled.
[2021-10-14 20:09:25] frigate.app WARNING : Camera Front Lawn has record assigned to an input, but record is not enabled.
[2021-10-14 20:09:25] frigate.app WARNING : Camera Carporch has record assigned to an input, but record is not enabled.
Starting migrations
[2021-10-14 20:09:25] peewee_migrate INFO : Starting migrations
There is nothing to migrate
[2021-10-14 20:09:25] peewee_migrate INFO : There is nothing to migrate
[2021-10-14 20:09:25] frigate.mqtt INFO : MQTT connected
[2021-10-14 20:09:25] frigate.app INFO : Output process started: 214
[2021-10-14 20:09:25] frigate.app INFO : Camera processor started for Frontporch: 217
[2021-10-14 20:09:25] frigate.app INFO : Camera processor started for Backdoor: 219
[2021-10-14 20:09:25] frigate.app INFO : Camera processor started for Backyard: 221
[2021-10-14 20:09:25] ws4py INFO : Using epoll
[2021-10-14 20:09:25] frigate.app INFO : Camera processor started for Front Lawn: 225
[2021-10-14 20:09:25] frigate.app INFO : Camera processor started for Carporch: 241
[2021-10-14 20:09:25] detector.coral1 INFO : Starting detection process: 213
[2021-10-14 20:09:25] frigate.edgetpu INFO : Attempting to load TPU as pci:0
[2021-10-14 20:09:25] frigate.edgetpu INFO : TPU found
[2021-10-14 20:09:25] frigate.app INFO : Capture process started for Frontporch: 246
[2021-10-14 20:09:25] frigate.app INFO : Capture process started for Backdoor: 250
[2021-10-14 20:09:25] frigate.app INFO : Capture process started for Backyard: 257
[2021-10-14 20:09:25] frigate.app INFO : Capture process started for Front Lawn: 265
[2021-10-14 20:09:25] frigate.app INFO : Capture process started for Carporch: 272
[2021-10-14 20:09:25] ws4py INFO : Using epoll
[2021-10-14 20:09:31] frigate.video INFO : Backyard: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
[2021-10-14 20:09:31] frigate.video INFO : Backyard: ffmpeg process is not running. exiting capture thread...
[2021-10-14 20:09:45] watchdog.Backyard ERROR : FFMPEG process crashed unexpectedly for Backyard.
[2021-10-14 20:09:45] watchdog.Backyard ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
[2021-10-14 20:09:45] watchdog.Backyard ERROR : You may have invalid args defined for this camera.
[2021-10-14 20:09:45] ffmpeg.Backyard.detect ERROR : rtsp://admin:pass@192.168.2.224/Streaming/Channels/101: Operation not permitted
[2021-10-14 20:09:55] frigate.video INFO : Backyard: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
[2021-10-14 20:09:55] frigate.video INFO : Backyard: ffmpeg process is not running. exiting capture thread...
[2021-10-14 20:09:55] watchdog.Backyard ERROR : FFMPEG process crashed unexpectedly for Backyard.
[2021-10-14 20:09:55] watchdog.Backyard ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
[2021-10-14 20:09:55] watchdog.Backyard ERROR : You may have invalid args defined for this camera.
[2021-10-14 20:09:55] ffmpeg.Backyard.detect ERROR : rtsp://admin:pass@192.168.2.224/Streaming/Channels/101: Operation not permitted
[2021-10-14 20:09:57] ws4py INFO : Managing websocket [Local => 127.0.0.1:5002 | Remote => 127.0.0.1:56382]
[2021-10-14 20:10:27] frigate.video INFO : Backyard: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
[2021-10-14 20:10:27] frigate.video INFO : Backyard: ffmpeg process is not running. exiting capture thread...
[2021-10-14 20:10:35] watchdog.Backyard ERROR : FFMPEG process crashed unexpectedly for Backyard.
[2021-10-14 20:10:35] watchdog.Backyard ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
[2021-10-14 20:10:35] watchdog.Backyard ERROR : You may have invalid args defined for this camera.
[2021-10-14 20:10:35] ffmpeg.Backyard.detect ERROR : Guessed Channel Layout for Input Stream #0.1 : mono
[2021-10-14 20:10:35] ffmpeg.Backyard.detect ERROR : [flv @ 0x55b8f1664140] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[2021-10-14 20:10:35] ffmpeg.Backyard.detect ERROR : [swscaler @ 0x55b8f1a434c0] deprecated pixel format used, make sure you did set range correctly
[2021-10-14 20:10:35] ffmpeg.Backyard.detect ERROR : [h264 @ 0x55b8f175d600] Increasing reorder buffer to 5
[2021-10-14 20:10:35] ffmpeg.Backyard.detect ERROR : rtsp://admin:pass@192.168.2.224/Streaming/Channels/101: corrupt decoded frame in stream 0
[2021-10-14 20:10:35] ffmpeg.Backyard.detect ERROR : [h264 @ 0x55b8f175d600] error while decoding MB 21 53, bytestream -5
[2021-10-14 20:10:35] ffmpeg.Backyard.detect ERROR : rtsp://admin:pass@192.168.2.224/Streaming/Channels/101: corrupt decoded frame in stream 0
[2021-10-14 20:10:35] ffmpeg.Backyard.detect ERROR : [flv @ 0x55b8f1664140] Failed to update header with correct duration.
[2021-10-14 20:10:35] ffmpeg.Backyard.detect ERROR : [flv @ 0x55b8f1664140] Failed to update header with correct filesize.
FFprobe output from your camera
ffprobe rtsp://admin:pass@192.168.2.224/Streaming/Channe ls/101
ffprobe version 4.1.6-1~deb10u1 Copyright (c) 2007-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch =amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=res ample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable -libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio -- enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype - -enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-lib mp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-lib opus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable- libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-li bvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --en able-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable -openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enabl e-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-sha red
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, rtsp, from 'rtsp://admin:pass@192.168.2.224/Streaming/Channels/101':
Metadata:
title : Media Presentation
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 2560x1440, 25.08 tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: pcm_alaw, 8000 Hz, 1 channels, s16, 64 kb/s
Frigate stats
No response
Operating system
Debian
Install method
HassOS Addon
Coral version
M.2
Network connection
Wired
Camera make and model
hikvision, yicamera
Any other information that may be helpful
Using hp t530
Issue Analytics
- State:
- Created 2 years ago
- Comments:19 (9 by maintainers)
Top Results From Across the Web
What Edge TPU Works with What Hardware/Software #256
Hi,. Does anyone managed to use M.2 Accelerator on Raspberry Pi 4? I tried to buy USB Accelerator but it is out of...
Read more >Frequently asked questions - Coral.ai
How is the Edge TPU different from Cloud TPUs? What machine learning frameworks does the Edge TPU support? What type of neural networks...
Read more >What Is the Difference Between CPU vs. GPU vs. TPU ...
Fundamentally, what differentiates between a CPU, GPU, and TPU is that the CPU works as the brains of a computer designed for ...
Read more >Accelerating Applications using Edge Tensor Processing Units
Unlike conventional processors, TPUs do not contain on-chip instruction caches but simply use a CISC-style instruction-set architecture and rely ...
Read more >CPU vs. GPU vs. TPU | 智愛科技股份有限公司
CPUs, GPUs, and TPUs are the core hardware technologies involved in ... When to use CPU, GPU, or TPU to run your Machine...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@billimek sorry this took so long to get back to you on.
Here would have been your motion detection settings in 0.8.4:
In 0.9.4, you will have the following
It’s a significant difference in motion detection sensitivity. If it was working well before, you should be able to get the same result with these settings in 0.9.4 (i see you have 1 camera with a height of 352):
Adding to this issue instead of creating a new one, but I have noticed a distinct change in overall CPU usage by Frigate after upgrading from the
0.8.4-amd64
image to the0.9.2-amd64
image:It basically doubled (from an average of about half a core to a whole core), with what I think is the same configuration, after adjusting the syntax to match the changed layout. Config is: https://github.com/billimek/k8s-gitops/blob/master/default/frigate/frigate.yaml#L28-L263
I’m trying to figure out if the change is expected, or can possibly be mitigated to operate close to the 0.8.x levels?