Benchmark Simple
This simple example measures pipeline latency by connecting a BenchmarkOut node to a BenchmarkIn node.Since nodes only pass message pointers (no data copying), the latency is very low, typically in the order of microseconds.Demo
Command Line
1Benchmark $ python3.9 benchmark_simple.py
2[2025-03-21 14:44:42.051] [ThreadedNode] [trace] Frame latency: 5.041e-06 s
3[2025-03-21 14:44:42.086] [ThreadedNode] [trace] Frame latency: 1.0166e-05 s
4[2025-03-21 14:44:42.122] [ThreadedNode] [trace] Frame latency: 6.25e-06 s
5[2025-03-21 14:44:42.156] [ThreadedNode] [trace] Frame latency: 6.459e-06 s
6[2025-03-21 14:44:42.185] [ThreadedNode] [trace] Frame latency: 7.875e-06 s
7[2025-03-21 14:44:42.221] [ThreadedNode] [trace] Frame latency: 1.1542e-05 s
Setup
This example requires the DepthAI v3 API, see installation instructions.Pipeline
Source code
Python
C++
Python
PythonGitHub
1#!/usr/bin/env python3
2import depthai as dai
3import time
4
5# Create pipeline
6with dai.Pipeline() as pipeline:
7 # Create the nodes
8 cam = pipeline.create(dai.node.Camera).build()
9 benchmarkIn = pipeline.create(dai.node.BenchmarkIn)
10 # benchmarkIn.setRunOnHost(True) # The node can also run on host and include the transfer limitation, default is False
11 output = cam.requestFullResolutionOutput()
12 output.link(benchmarkIn.input)
13
14 pipeline.start()
15 while pipeline.isRunning():
16 time.sleep(1) # Let the logger print out the FPS
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.