如何放置
Python
Python
1import depthai as dai
2
3pipeline = dai.Pipeline()
4benchmarkIn = pipeline.create(dai.node.BenchmarkIn)
5
6# 配置为每100条消息发送一次性能报告,并选择是否将报告作为警告记录。
7benchmarkIn.sendReportEveryNMessages(100)
8benchmarkIn.logReportsAsWarnings(False)
9
10# 例如,将 NeuralNetwork 的输出连接到 BenchmarkIn:
11neuralNetwork = pipeline.create(dai.node.NeuralNetwork)
12neuralNetwork.out.link(benchmarkIn.input)输入和输出
使用方法
Python
Python
1pipeline = dai.Pipeline()
2
3# 创建 BenchmarkIn 节点并进行配置:
4benchmarkIn = pipeline.create(dai.node.BenchmarkIn)
5benchmarkIn.sendReportEveryNMessages(100)
6benchmarkIn.logReportsAsWarnings(False)
7
8# 示例:将 BenchmarkIn 连接到 NeuralNetwork 节点
9neuralNetwork = pipeline.create(dai.node.NeuralNetwork)
10neuralNetwork.out.link(benchmarkIn.input)
11
12# 创建用于接收基准测试报告的输出队列
13outputQueue = benchmarkIn.report.createOutputQueue()
14
15while pipeline.isRunning():
16 benchmarkReport = outputQueue.get()
17 print(f"FPS 是 {benchmarkReport.fps}")功能示例
参考
class
dai::node::BenchmarkIn
variable
Input input
Receive messages as fast as possible
variable
Output passthrough
Passthrough for input messages (so the node can be placed between other nodes)
variable
Output report
Send a benchmark report when the set number of messages are received
function
void sendReportEveryNMessages(uint32_t n)Specify how many messages to measure for each report
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 logReportsAsWarnings(bool logReportsAsWarnings)Log the reports as warnings
function
void measureIndividualLatencies(bool attachLatencies)Attach latencies to the report
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)需要帮助?
请前往 OAKChina 官网 获取技术支持或解答您的任何疑问。