Skip to content

Commit 656c2f3

Browse files
authored
Merge pull request #769 from luxonis/docs_update
Docs update
2 parents 7ef3f6f + 766c728 commit 656c2f3

File tree

7 files changed

+96
-10
lines changed

7 files changed

+96
-10
lines changed
-3.94 KB
Loading
-34.6 KB
Binary file not shown.

docs/source/components/messages/image_manip_config.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ ImageManipConfig
22
================
33

44
This message can is used for cropping, warping, rotating, resizing, etc. an image in runtime.
5-
It is sent either from the host to :ref:`ColorCamera` or :ref:`ImageManip`.
5+
It can be sent from host/:ref:`Script` node to either :ref:`ColorCamera` or :ref:`ImageManip`.
66

7-
..
8-
It is sent either from the host or from the :ref:`Script` node to :ref:`ColorCamera` or :ref:`ImageManip`.
7+
.. note:: This message will reconfigure the whole config of the node, meaning you need to set all settings, not just the setting you want to change.
98

109
Examples of functionality
1110
#########################

docs/source/components/nodes/video_encoder.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ VideoEncoder
22
============
33

44
VideoEncoder node is used to encode :ref:`ImgFrame` into either H264, H265, or MJPEG streams. Only NV12 or GRAY8 (which gets converted to NV12) format is
5-
supported as an input.
5+
supported as an input. All codecs are lossy (except lossless MJPEG), for more information please see `encoding quality docs <https://github.com/luxonis/depthai-experiments/tree/master/gen2-record-replay/encoding_quality>`__.
66

77
.. include:: /includes/container-encoding.rst
88

docs/source/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Follow the steps below to just install depthai api library dependencies for your
3131

3232
.. code-block:: bash
3333
34-
sudo wget -qO- https://docs.luxonis.com/install_depthai.sh | bash
34+
sudo wget -qO- https://docs.luxonis.com/install_dependencies.sh | bash
3535
3636
Please refer to :ref:`Supported Platforms` if any issues occur.
3737

docs/source/samples/StereoDepth/rgb_depth_aligned.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ By default, the depth map will get scaled to match the resolution of the camera
1212
depth is aligned to the 1080P color sensor, StereoDepth will upscale depth to 1080P as well.
1313
Depth scaling can be avoided by configuring :ref:`StereoDepth`'s ``stereo.setOutputSize(width, height)``.
1414

15+
To align depth with **higher resolution color stream** (eg. 12MP), you need to limit the resolution of the depth map. You can
16+
do that with ``stereo.setOutputSize(w,h)``. Code `example here <https://gist.github.com/Erol444/25f374fa18efa7939ec9bb848b39249a>`__.
17+
1518

1619
Demo
1720
####

docs/source/tutorials/low-latency.rst

Lines changed: 89 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,98 @@ On PoE, the latency can vary quite a bit due to a number of factors:
128128
* 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.
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

131+
Bandwidth
132+
#########
133+
134+
With large, unencoded frames, one can quickly saturate the bandwidth even at 30FPS, especially on PoE devices (1gbps link):
135+
136+
.. code-block::bash
137+
138+
4K NV12/YUV420 frames: 3840 * 2160 * 1.5 * 30fps * 8bits = 3 gbps
139+
1080P NV12/YUV420 frames: 1920 * 1080 * 1.5 * 30fps * 8bits = 747 mbps
140+
720P NV12/YUV420 frames: 1280 * 720 * 1.5 * 30fps * 8bits = 331 mbps
141+
142+
1080P RGB frames: 1920 * 1080 * 3 * 30fps * 8bits = 1.5 gbps
143+
144+
800P depth frames: 1280 * 800 * 2 * 30fps * 8bits = 492 mbps
145+
400P depth frames: 640 * 400 * 2 * 30fps * 8bits = 123 mbps
146+
147+
800P mono frames: 1280 * 800 * 1 * 30fps * 8bits = 246 mbps
148+
400P mono frames: 640 * 400 * 1 * 30fps * 8bits = 62 mbps
149+
150+
The third value in the formula is byte/pixel, which is 1.5 for NV12/YUV420, 3 for RGB, and 2 for depth frames, and 1
151+
for mono (grayscale) frames. It's either 1 (normal) or 2 (subpixel mode) for disparity frames.
152+
153+
A few options to reduce bandwidth:
154+
155+
- Encode frames (H.264, H.265, MJPEG) on-device using :ref:`VideoEncoder node <VideoEncoder>`
156+
- Reduce FPS/resolution/number of streams
157+
131158
Reducing latency when running NN
132159
################################
133160

134161
In the examples above we were only streaming frames, without doing anything else on the OAK camera. This section will focus
135162
on how to reduce latency when also running NN model on the OAK.
136163

137-
Lowering camera FPS to match NN FPS
138-
-----------------------------------
164+
1. Increasing NN resources
165+
--------------------------
166+
167+
One option to reduce latency is to increase the NN resources. This can be done by changing the number of allocated NCEs and SHAVES (see HW accelerator `docs here <https://docs.luxonis.com/projects/hardware/en/latest/pages/rvc/rvc2.html#hardware-blocks-and-accelerators>`__).
168+
`Compile Tool <https://docs.luxonis.com/en/latest/pages/model_conversion/#compile-tool>`__ can compile a model for more SHAVE cores. To allocate more NCEs, you can use API below:
169+
170+
.. code-block:: python
171+
172+
import depthai as dai
173+
174+
pipeline = dai.Pipeline()
175+
# nn = pipeline.createNeuralNetwork()
176+
# nn = pipeline.create(dai.node.MobileNetDetectionNetwork)
177+
nn = pipeline.create(dai.node.YoloDetectionNetwork)
178+
nn.setNumInferenceThreads(1) # By default 2 threads are used
179+
nn.setNumNCEPerInferenceThread(2) # By default, 1 NCE is used per thread
180+
181+
Models usually run at **max FPS** when using 2 threads (1 NCE/Thread), and compiling model for ``AVAILABLE_SHAVES / 2``.
182+
183+
Example of FPS & latency comparison for YoloV7-tiny:
184+
185+
.. list-table::
186+
:header-rows: 1
187+
188+
* - NN resources
189+
- Camera FPS
190+
- Latency
191+
- NN FPS
192+
* - **6 SHAVEs, 2x Threads (1NCE/Thread)**
193+
- 15
194+
- 155 ms
195+
- 15
196+
* - 6 SHAVEs, 2x Threads (1NCE/Thread)
197+
- 14
198+
- 149 ms
199+
- 14
200+
* - 6 SHAVEs, 2x Threads (1NCE/Thread)
201+
- 13
202+
- 146 ms
203+
- 13
204+
* - 6 SHAVEs, 2x Threads (1NCE/Thread)
205+
- 10
206+
- 141 ms
207+
- 10
208+
* - **13 SHAVEs, 1x Thread (2NCE/Thread)**
209+
- 30
210+
- 145 ms
211+
- 11.6
212+
* - 13 SHAVEs, 1x Thread (2NCE/Thread)
213+
- 12
214+
- 128 ms
215+
- 12
216+
* - 13 SHAVEs, 1x Thread (2NCE/Thread)
217+
- 10
218+
- 118 ms
219+
- 10
220+
221+
2. Lowering camera FPS to match NN FPS
222+
--------------------------------------
139223

140224
Lowering FPS to not exceed NN capabilities typically provides the best latency performance, since the NN is able to
141225
start the inference as soon as a new frame is available.
@@ -153,11 +237,11 @@ This time includes the following:
153237
- And finally, eventual extra latency until it reaches the app
154238

155239
Note: if the FPS is increased slightly more, towards 19..21 FPS, an extra latency of about 10ms appears, that we believe
156-
is related to firmware. We are activaly looking for improvements for lower latencies.
240+
is related to firmware. We are actively looking for improvements for lower latencies.
157241

158242

159-
NN input queue size and blocking behaviour
160-
------------------------------------------
243+
3. NN input queue size and blocking behavior
244+
--------------------------------------------
161245

162246
If the app has ``detNetwork.input.setBlocking(False)``, but the queue size doesn't change, the following adjustment
163247
may help improve latency performance:

0 commit comments

Comments
 (0)