ok, so now the Raspberry Pi 4 is unveiled with USB3, I would expect it to be the new base level for Frigate builds. What are the memory demands on running Frigate? Would there be real benefits to go for 2 GB or even 4 GB? Do you have a good view of where the bottlenecks are in these kinds of cheap platforms?
I agree that looks promising. I have been testing the Odroid-XU4, but the USB3 bus speeds seem to be limiting me to about 20ms for inference times. Next on my list is the Atomic Pi. Memory demands are low at the moment because I am only storing 1 or 2 frames from each camera at a time. They could go up when I start outputting video clips. I am specifically trying to optimize for these kinds of low power SBCs.
Finally trying to get the Coral version up and running and getting this, any ideas what it means? Iād assume the 401 is authentication error logging into the cameras but Iām using same URL and uname/pw which worked on the old frigate version and in VLCā¦ Unless I somehow defined it wrong with the new config format.
Starting frigate ... done
Attaching to frigate
frigate | On connect called
frigate | [rtsp @ 0x3446b60] method DESCRIBE failed: 401 Unauthorized
frigate | Traceback (most recent call last):
frigate | File "detect_objects.py", line 99, in <module>
frigate | main()
frigate | File "detect_objects.py", line 53, in main
frigate | cameras[name] = Camera(name, config, prepped_frame_queue, client, MQTT_TOPIC_PREFIX)
frigate | File "/opt/frigate/frigate/video.py", line 137, in __init__
frigate | self.frame_shape = get_frame_shape(self.rtsp_url)
frigate | File "/opt/frigate/frigate/video.py", line 102, in get_frame_shape
frigate | frame_shape = frame.shape
frigate | AttributeError: 'NoneType' object has no attribute 'shape'
Streaming media ingestion is a topic I am currently researching. There are research models that are trained directly on video, which Iām looking at. The popular ones who are trained on images might be also possible to reuse with transfer learning, but thatās just theory at this point. I donāt have answers yet, just wanted to ask the question before looking further.
As you pointed out, under 1 second detection is quite good. Have you had a chance to push further and benchmark performance for face detection (visitor identification)?
You mention that h264 decoding is hardware accelerated. Could you please share which Raspberry Pi add on you used for that? Sorry if I missed this info in your earlier notes.
Thanks again for sharing your great work on Frigate.
I havenāt looked into face detection yet. The Coral can only load a single model at a time, so it is best to have a second Coral if you are going to have multiple models. I would assume adding face recognition would take an additional 10-15ms, and I would only do it for frames where a person was detected.
For hardware accelerated h264 decoding, I am just using ffmpeg directly within frigate. The flags you pass to ffmpeg vary depending on your hardware, but -c:v h264_mmal should work on an RPi. I am not running frigate on an Raspberry Pi because you really need USB 3.0 speeds for the Coral. I have a RPi 4 on order, so we will see if that is feasible.
Both of those errors look like you requested a path that isnāt linked to a camera. I see /favicon.ico and /back. Make sure you have x_offset, y_offset, and size defined correctly for each region. It looks like something is missing or has a typo.
The URL Iām trying to access is http://frigate_ip:5000/back
The browser gives me back
# Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
Hereās my config (I actually have 4 cameras, but Iāve commented out 3 of them for testing). As you can see, the camera is called back same as in the failing URL. I can access this stream with VLC in the format
So, itās working okay for 1 or maximum 2 cameras, but when I turn on more than about that (36-48fps at 1080p), I get something like the below. What do you think, it just canāt pull it off? Itās an i7 with usb 3.0 and on the old version it was able to run the same 8 regions without problem off the cpuā¦
Attaching to frigate
frigate | On connect called
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Creating a new capture process...
frigate | Starting a new capture process...
frigate | W third_party/darwinn/driver/package_registry.cc:65] Minimum runtime version required by package (5) is lower than expected (10).
frigate | Capture process for back: 56
frigate | Creating a new capture process...
frigate | Starting a new capture process...
frigate | Capture process for front: 60
frigate | Creating a new capture process...
frigate | Starting a new capture process...
frigate | Capture process for right: 64
frigate | Creating a new capture process...
frigate | Starting a new capture process...
frigate | Capture process for left: 68
frigate | * Serving Flask app "detect_objects" (lazy loading)
frigate | * Environment: production
frigate | WARNING: This is a development server. Do not use it in a production deployment.
frigate | Use a production WSGI server instead.
frigate | * Debug mode: off
frigate | * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Opening the RTSP Url...
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Opening the RTSP Url...
frigate | Invalid UE golomb code
frigate | Opening the RTSP Url...
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Opening the RTSP Url...
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | [h264 @ 0x30c7740] left block unavailable for requested intra4x4 mode -1 at 0 40
frigate | [h264 @ 0x30c7740] error while decoding MB 0 40, bytestream 39810
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | [h264 @ 0x2ce2ae0] cabac decode of qscale diff failed at 118 15
frigate | [h264 @ 0x2ce2ae0] error while decoding MB 118 15, bytestream 97830
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | queue full. moving on
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | [h264 @ 0x2ecc8c0] error while decoding MB 37 76, bytestream -30
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | Unable to grab a frame
frigate | [h264 @ 0x2d1a2c0] error while decoding MB 96 54, bytestream -10
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | [h264 @ 0x2d1e520] left block unavailable for requested intra mode at 0 17
frigate | [h264 @ 0x2d1e520] error while decoding MB 0 17, bytestream 858
frigate | Invalid UE golomb code
frigate | Invalid UE golomb code
frigate | [h264 @ 0x2ce2ae0] error while decoding MB 86 44, bytestream -12
How many regions per camera? It should be able to look at about 100 regions per second. Also, the CPU version just dropped frames silently if it wasnāt able to process them in time. I would suggest lowering the frame rate of the feed Frigate is looking at. 5-10 fps is plenty from my testing. I donāt think anyone is going to get by in 0.2 seconds.
Itās 6fps per camera, 2 zones per camera, 4 camerasā¦ So 48 regions per secondā¦ I thought it would make short work of it. Iām starting to fear that the USB pass-through on VMware isnāt up to the task. I could theoretically move it to my synology but Iām not sure I want to use that much of the bus bandwidth on thisā¦
So I tried bumping them down to 1fps (so 8fps with all 8 zones total), and was able to get it to show the camera feeds (slowly), but no bounding boxesā¦ Log is still full of āUnable to grab a frameā. Interesting, because I was successfully running 12FPS on a single camera using 2 zones of 6fps each.
I will wait for your results on the Pi4ā¦ Iām cautiously optimistic that that will be the final solution.
Finally got some time to run a benchmark on the Atomic Pi, and it is coming in at about 16ms. Bummer. Really hoping the RPi4 us under 10ms, but I am not holding my breath.
Here are the devices I have tested so far:
Raspberry Pi 3b+ - 50ms (10-20fps)
Odroid-XU4 - 20ms (25-50fps)
Atomic Pi - 16ms
NUC/Laptop - 5ms (100-200fps)
Does 16ms on the Atomic equate to 40-50fps? If so, Iām guessing a Pi4 will be adequate for my needs and I will just order it.
On a side note, is there any reason why frigate might choke on a camera feed thatās in portrait rather than landscape orientation (ie 1080x1920 rather than 1920x1080)? I tried starting it on one of my portrait orientation cameras and it is just freezingā¦