Closed mdelecate closed 2 years ago
Running motion detection on 4K is very expensive, are you looking to run object detection on objects that small that a sub stream with lower resolution won't work?
This docs section explains the how in many cases 4K detect doesn't help except with smaller objects https://docs.frigate.video/guides/camera_setup#choosing-a-detect-resolution
Also this section explaining why resolution affects it so much even with a coral: https://docs.frigate.video/configuration/masks#further-clarification
Hi, thanks for the response. Yes, for some of the higher mounted cameras, the subjects in my frame are often a bit smaller than the 320x320 dimension of the models currently in use by Frigate.
Despite this, the detection is often not quite accurate due to the top down perspective, so people are being detected as dogs or cats. Apart from using a different set of models, lowering the resolution would probably make recognition accuracy worse.
Here is an example frame from one of the cameras, with a purple box (320x320) on the subjects:
I've got Blue Iris running as well, so decided to do a comparison. Blue Iris is running on a Windows PC with an older 4-core i7-6700K, 16GB RAM, SSD, no GPU (a bit less powerful than my NUC).
I activated motion detection for all cameras and enabled the "high definition" option to increase motion detection resolution to an estimated 188x94 px.
Since Blue Iris uses the lower resolution substreams for motion detection by default, I also disabled all substreams for a fair comparison.
While displaying 6 live streams: 640x320 substream at 12 FPS: CPU at 11% usage 3840x2160 stream at 12 FPS: CPU at 48% usage
Running in background as a service: 640x320 substream at 12 FPS: CPU at 6% usage 3840x2160 stream at 12 FPS: CPU at 31% usage
So even with a 33% lower FPS (not even taking into account the lower default frame_height of 50px) and a slightly more powerful CPU, Frigate has roughly double the CPU consumption in %.
Despite the base frequency of the newer Gen i7 being lower at 2.8GHz, it scores a bit higher in all benchmarks:
I'm not sure what motion detection algo Blue Iris is using, but it appears to be extremely efficient.
Yeah, I'm less knowledgeable on that side of things. I believe adding motion masks for parts of the images that don't have important motion could help but not 100%.
@blakeblackshear will know a lot more on this and may have suggestions.
This is something that I think Frigate+ trained models could help with as you may not need the higher res streams if you're running a model that is optimized for cameras at that height.
Yes, I tried adding a lot of motion masks so roughly 50% of the areas (which include a lot of moving trees) are masked, but this didn't seem to have much of an effect, so maybe the motion detection runs before the motion mask is evaluated?
And yes, I'm looking forward to Frigate+!
There are a lot of different things happening, so it would be helpful if you can track down where that CPU usage is coming from. It's not really fair to compare Frigate to Blue Iris with object detection enabled since it isn't doing any of that work.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Describe the problem you are having
Hi,
I'm surprised that CPU usage rises to 90% - 100% when I increase the detect FPS and am therefore limited to 7 FPS.
Some of my cameras are 10m high which leads the Coral to frequently recognise humans as cats (looking forward to Frigate+ !). I noticed that I can achieve a higher chance of an accurate detection by increasing the FPS, especially for faster moving people.
Default setting: 5 FPS: -Total CPU use: 85% -Frigate NVR Add-on CPU Usage: 70.2%
Unfortunately, I nearly hit a limit when I set all 6 cams to 7 FPS: 7 FPS: -Total CPU use: 94% -Frigate NVR Add-on CPU Usage: 77.4%
8 FPS: -Total CPU use: 100% -Frigate NVR Add-on CPU Usage: 85.5%
The cameras themselves are set to 12 FPS for recording to another NVR. There is no substream available in the native 4K resolution. Retaining the 4K resolution is useful as the cams are located 10-20m away from the further edges of the configured zones.
I have tried reducing frame_height to 20, but this does not make much of a difference to CPU usage.
I have: 6x 4K cameras 3x Google Coral USB
I'm running Home Assistant OS on an 2021 Intel NUC11PAHi7 with 11th Gen 4-core i7 (up to 4.7 Ghz), 16GB RAM, SSD. I thought this CPU would easily be able to to motion detection for six 4K cams?
Version
0.10.0-BFECEE9
Frigate config file
Relevant log output
FFprobe output from your camera
Frigate stats
Operating system
HassOS
Install method
HassOS Addon
Coral version
USB
Network connection
Wired
Camera make and model
Hikvision DS-2CD3T87WD
Any other information that may be helpful
No response