Skip to content

Commit da2b14f

Browse files
authored
Merge pull request #823 from luxonis/3a_fps_limit
Added 3A FPS limiting to debugging docs (debugging CPU usage)
2 parents 9f11020 + ae74102 commit da2b14f

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

docs/source/tutorials/debugging.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,45 @@ specifically SHAVE core and CMX memory usage:
121121
122122
In total, this pipeline consumes 15 SHAVE cores and 16 CMX slices. The pipeline is running an object detection model compiled for 6 SHAVE cores.
123123

124+
CPU usage
125+
=========
126+
127+
When setting the :ref:`DepthAI debugging level` to debug (or lower), depthai will also print our CPU usage for LeonOS and LeonRT. CPU usage
128+
at 100% (or close to it) can cause many undesirable effects, such as higher frame latency, lower FPS, and in some cases even firmware crash.
129+
130+
Compared to OAK USB cameras, OAK PoE cameras will have increased CPU consumption, as the networking stack is running on the LeonOS core. Besides
131+
reducing pipeline (doing less processing), a good alternative is to reduce 3A FPS (ISP). This means that 3A algorithms (auto exposure, auto white balance
132+
and auto focus) won't be run every frame, but every N frames. When updating DepthAI SDK's `camera_preview.py <https://github.com/luxonis/depthai/blob/main/depthai_sdk/examples/CameraComponent/camera_preview.py>`__
133+
example (code change below), the LeonOS CPU usage decreased from 100% to ~46%:
134+
135+
.. code-block:: bash
136+
137+
# Without 3A FPS limit on OAK PoE camera:
138+
Cpu Usage - LeonOS 99.99%, LeonRT: 6.91%
139+
140+
# Limiting 3A to 15 FPS on OAK PoE camera:
141+
Cpu Usage - LeonOS 46.24%, LeonRT: 3.90%
142+
143+
Not having 100% CPU usage also drastically decreased frame latency, in the example for the script below it went from ~710 ms to ~110ms:
144+
145+
.. image:: https://github.com/luxonis/depthai-python/assets/18037362/84ec8de8-58ce-49c7-b882-048141d284e0
146+
147+
.. code-block:: diff
148+
149+
from depthai_sdk import OakCamera
150+
151+
with OakCamera() as oak:
152+
color = oak.create_camera('color')
153+
left = oak.create_camera('left')
154+
right = oak.create_camera('right')
155+
156+
+ # Limiting 3A to 15 FPS
157+
+ for node in [color.node, left.node, right.node]:
158+
+ node.setIsp3aFps(15)
159+
160+
oak.visualize([color, left, right], fps=True, scale=2/3)
161+
oak.start(blocking=True)
162+
163+
Limiting 3A FPS can be achieved by calling :code:`setIsp3aFps()` function on the camera node (either :ref:`ColorCamera` or :ref:`MonoCamera`).
164+
124165
.. include:: /includes/footer-short.rst

docs/source/tutorials/low-latency.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ On PoE, the latency can vary quite a bit due to a number of factors:
125125
* Network/computer is saturated with other traffic. You can test the actual bandwidth with `OAK bandwidth test <https://github.com/luxonis/depthai-experiments/tree/master/random-scripts#oak-bandwidth-test>`__ script. With direct link I got ~800mbps downlink and ~210mbps uplink.
126126

127127
* Computer's **Network Interface Card settings**, `documentation here <https://docs.luxonis.com/projects/hardware/en/latest/pages/guides/getting-started-with-poe.html#network-interface-controller-settings>`__
128-
* 100% OAK Leon CSS (CPU) usage. The Leon CSS core handles the POE communication (`see docs here <https://docs.luxonis.com/projects/hardware/en/latest/pages/rvc/rvc2.html#hardware-blocks-and-accelerators>`__), and if the CPU is 100% used, it will not be able to handle the communication as fast as it should.
128+
* 100% OAK Leon CSS (CPU) usage. The Leon CSS core handles the POE communication (`see docs here <https://docs.luxonis.com/projects/hardware/en/latest/pages/rvc/rvc2.html#hardware-blocks-and-accelerators>`__), and if the CPU is 100% used, it will not be able to handle the communication as fast as it should. **Workaround:** See :ref:`CPU usage` docs.
129129
* Another potential way to improve PoE latency would be to fine-tune network settings, like MTU, TCP window size, etc. (see `here <https://docs.luxonis.com/projects/hardware/en/latest/pages/guides/getting-started-with-poe.html#advance-network-settings>`__ for more info)
130130

131131
Bandwidth

0 commit comments

Comments
 (0)