BenchmarkOut
The BenchmarkOut node listens for the first incoming message and then repeatedly sends out copies of that message at a specified frame rate (FPS). This is useful when you need to simulate a continuous stream from an input, which allows you to test the performance of your pipeline.How to place it
Python
C++
Python
Python
1import depthai as dai
2
3pipeline = dai.Pipeline()
4benchmarkOut = pipeline.create(dai.node.BenchmarkOut)
5
6# Choose whether the node runs on the host or on the device
7benchmarkOut.setRunOnHost(False)
8# Set the desired output frame rate (FPS)
9benchmarkOut.setFps(30)
10
11# To initialize, send a single input message (e.g., an ImgFrame)
12inputQueue = benchmarkOut.input.createInputQueue()
13# Create and configure your initial frame as needed
14initialFrame = dai.ImgFrame()
15inputQueue.send(initialFrame)
Inputs and Outputs
Usage
Python
C++
Python
Python
1pipeline = dai.Pipeline()
2benchmarkOut = pipeline.create(dai.node.BenchmarkOut)
3benchmarkOut.setRunOnHost(True)
4benchmarkOut.setFps(30)
5
6# Send a single frame to initialize the output stream.
7inputQueue = benchmarkOut.input.createInputQueue()
8initialFrame = dai.ImgFrame()
9# (Initialize initialFrame as needed)
10inputQueue.send(initialFrame)
11
12# Example: Link BenchmarkOut's output to a BenchmarkIn node for performance measurement.
13benchmarkIn = pipeline.create(dai.node.BenchmarkIn)
14benchmarkOut.out.link(benchmarkIn.input)
15
16outputQueue = benchmarkIn.report.createOutputQueue()
17while pipeline.isRunning():
18 benchmarkReport = outputQueue.get()
19 print(f"FPS is {benchmarkReport.fps}")
Examples of functionality
Reference
class
dai::node::BenchmarkOut
variable
Output out
Send messages out as fast as possible
variable
Input input
Message that will be sent repeatedly
function
void setNumMessagesToSend(int num)
Sets number of messages to send, by default send messages indefinitely
Parameters
- num: number of messages to send
function
void setFps(float fps)
Set FPS at which the node is sending out messages. 0 means as fast as possible
function
void setRunOnHost(bool runOnHost)
Specify whether to run on host or device By default, the node will run on device.
function
bool runOnHost()
Check if the node is set to run on host
function
void run()
inline function
DeviceNodeCRTP()
inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device)
inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props)
inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props, bool confMode)
inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device, std::unique_ptr< Properties > props, bool confMode)
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.