Closed WizBangCrash closed 2 years ago
So the main point of concern with the detect resolution is CPU utilization
detect -> width
and detect -> height
are different than the camerain this case, frigate will resize the camera feed that is used for detection to the width
and height
specified which of course requires CPU usage (continuously) and can increase overall CPU use.
detect -> width
and detect -> height
match that of your camerain this case, frigate will not need to use CPU to resize the camera feed, however feeds that are high resolution (especially as high as yours) will add a considerable amount of additional CPU load when running motion detection (as there are more pixels to compare).
It's all about balance. The ideal solution is to have a camera with multiple streams that have a configurable resolution, so you can have a full resolution stream for recording and a smaller feed for detection which you can match frigate config to.
If that option is not available then the main thing to consider is the size of objects you are expecting to detect. As the docs discuss, the default models have a region size of 320 x 320
so if you look at that size compared to the resolution of the camera feed, that is pretty close to the smallest object you want to detect. If you are looking to detect cats or other smaller objects then a higher resolution is optimal. Then, also considering how much CPU headroom you have, can choose a resolution.
Personally, since I am running a very capable computer and my cameras substream is too low resolution (and not configurable) I have 2560x1440
for the record and then I take that stream and cut it in half to 1080x720
which has worked well for me. Frigate is usually around 5-8% CPU (with a coral) so I have no issues with that.
@NickM-27 Thanks for the detailed explanation. That makes it a lot clearer. I have the same issue with the Reolink cameras. The sub stream is too low quality so I have to use the main hires stream. I will do some experimentation and watch the CPU overhead. :-) I'm using an old iMac, so I have plenty of CPU to play with. I'm stuck with using the CPU as the USB Corals are out of stock everywhere at the moment and eBay prices are $200+
@WizBangCrash Saw on reddit that rs-online UK have them in stock for around £50.
@obj Thanks for that. It definitely looks like supply is easing for that product. UK Farnell have them in stock now too. I shall be placing my order soon :-)
So the main point of concern with the detect resolution is
CPU utilization
if
detect -> width
anddetect -> height
are different than the camerain this case, frigate will resize the camera feed that is used for detection to the
width
andheight
specified which of course requires CPU usage (continuously) and can increase overall CPU use.if
detect -> width
anddetect -> height
match that of your camerain this case, frigate will not need to use CPU to resize the camera feed, however feeds that are high resolution (especially as high as yours) will add a considerable amount of additional CPU load when running motion detection (as there are more pixels to compare).
So, what to do?
It's all about balance. The ideal solution is to have a camera with multiple streams that have a configurable resolution, so you can have a full resolution stream for recording and a smaller feed for detection which you can match frigate config to.
If that option is not available then the main thing to consider is the size of objects you are expecting to detect. As the docs discuss, the default models have a region size of
320 x 320
so if you look at that size compared to the resolution of the camera feed, that is pretty close to the smallest object you want to detect. If you are looking to detect cats or other smaller objects then a higher resolution is optimal. Then, also considering how much CPU headroom you have, can choose a resolution.Personally, since I am running a very capable computer and my cameras substream is too low resolution (and not configurable) I have
2560x1440
for the record and then I take that stream and cut it in half to1080x720
which has worked well for me. Frigate is usually around 5-8% CPU (with a coral) so I have no issues with that.
I just wanted to say thank you for explaining this. I am offered extremely low-resolution sub-stream options, so I wanted to use my main stream.. but as you did, cut its detect resolution in half. Hopefully this will help with detection at longer ranges & keep CPU tamed. I will be purchasing a Coral to supplement my setup running on Docker on an ODROID-H2. I am a Shinobi migrant. Thank you again!
My Reolink substream is 640x360. It does detect cats every so often but I definitely don't think it is happening most of the time. From reading this thread it seems that the small size of the stream is probably an issue. So best to take my main stream (2304x1296) and cut that in half to 1152x648?
If you have hwaccel then that's not a problem to do, I'd suggest a standard 1280x720 for 16:9
Describe the problem you are having
Firstly, thanks for such a great application. After spending two weeks evaluating both Shinobi and ZoneMinder and getting more and more frustrated with them. I came across frigate and haven't looked back :-)
I've a question about the values to use the in the
detect
element of the camera configuration. Should these be set to the actual values of the camera video feed i.e. 3840x2160 in my case? Or should they be set to the width and height that you want the detect engine to use e.g. 1280x720It's not clear in the documentation and I may be overthinking it, but when I read the page on detect resolution I wondered if I am supposed to set lower numbers here to help fit the 320x320 model.
Any light someone can shed here would be really useful.
Version
0.11.0 Beta 4
Frigate config file
Relevant log output
FFprobe output from your camera
Frigate stats
No response
Operating system
Debian
Install method
Docker Compose
Coral version
CPU (no coral)
Network connection
Wired
Camera make and model
Reolink RLC-810A and RLC-811A
Any other information that may be helpful
Also, for reference to anyone else out there, I have three Reolink cameras (2 x RLC-810A + RLC-811A) and I have had no issues using the default settings for ffmpeg input_args. I have the latest firmware on all of them (v3.1.0), I think this section does not apply to the newer models.