Benchmarking
Overview
Installation
Command Line
1pip install modelconv[bench]Usage
Command Line
1modelconverter benchmark <target> --model-path <path_or_slug>--save, it also writes the results to a CSV file in the current working directory.Basic Example
Command Line
1modelconverter benchmark rvc4 --model-path yolov6-nano:r2-coco-512x288 --saveyolov6-nano_benchmark_results.csv.For more advanced examples and options, see the Advanced Examples section.Supported Targets
<target> argument:RVC2: DepthAI (DAI) pipeline benchmarking.RVC4: DepthAI (DAI) pipeline benchmarking (default) or SNPE-based benchmarking via ADB connection to the RVC4 device.
Model Sources
--model-path argument is required and accepts the following model sources:- Local model artifacts:
.blobfiles (for RVC2) or.dlcfiles (for RVC4) - Local NN Archives: Luxonis NN Archives (
.tar.xzfiles containing model executables and configuration) - HubAI Model Slugs: Model slugs from HubAI's Model Zoo, such as
yolov6-nano:r2-coco-512x288
HUBAI_API_KEY environment variable is configured with valid credentials.Output Results
--save is provided, results are written to a CSV file. The file name is derived from the model name and follows the pattern: <model_name>_benchmark_results.csv.CLI Options
| Parameter | Description | Default | Platforms |
|---|---|---|---|
full | Run full benchmark with all configurations. | False | RVC2, RVC4 |
save | Save benchmark results to CSV file. | False | RVC2, RVC4 |
repetitions | Number of repetitions for DAI benchmark. | 10 | RVC2, RVC4 |
benchmark-time | Benchmark duration in seconds. | 20 | RVC2, RVC4 |
num-threads | Number of threads for inference (DAI only). | 2 | RVC2, RVC4 |
num-messages | Messages to send per inference run (DAI only). | 50 | RVC2, RVC4 |
profile | SNPE performance profile to use. | balanced | RVC4 |
runtime | SNPE runtime to use for inference. | dsp | RVC4 |
num-images | Number of images for SNPE inference. | 1000 | RVC4 |
device-ip | IP address of target device. | None | RVC4 |
device-id | Unique ID of target device. | None | RVC4 |
dai-benchmark | Use DAI benchmark instead of SNPE tools. | True | RVC4 |
power-benchmark | Measure power consumption (requires ADB). | False | RVC4 |
dsp-benchmark | Measure DSP utilization (requires ADB). | False | RVC4 |
Controlling Benchmark Duration
- Time-based (recommended for stable averages):
--benchmark-time <seconds> - Fixed repetitions:
--repetitions <N>
--benchmark-time 20) and takes precedence over --repetitions both for RVC2 and RVC4 targets.To run a fixed number of repetitions instead, disable time-based benchmarking:Command Line
1modelconverter benchmark rvc4 \
2 --model-path <path_or_slug> \
3 --benchmark-time -1 \
4 --repetitions 50RVC4 Related Options
Selecting the Device
--device-ip <ip>. Specifies the IP address of the target RVC4 device.--device-id <id>. Specifies the unique ID of the target RVC4 device.
device-id takes precedence.Power and DSP Monitoring
--power-benchmark: When enabled, the benchmark collects power readings from device hwmon nodes (when available) and reports the average power consumption statistics for the system and the processor during the benchmark run.--dsp-benchmark: When enabled, the benchmark collects DSP utilization data from the device and reports the average DSP utilization during the benchmark run.
DAI vs SNPE Benchmarking
- DAI benchmark (default): Enabled with
--dai-benchmark. - SNPE tools over ADB: Enabled with
--no-dai-benchmark.
- Use the default DAI benchmark for most use cases.
- Use the SNPE path when you need manual SNPE-style benchmarking or want to benchmark
.dlcfiles directly.
snpe-parallel-run internally with the following behavior:- Prepares and sends a set of images to the device for inference (configured via
--num-images). - Supports runtime and performance customization via
--runtimeand--profileoptions. - Runs on two threads by default (to match DAI defaults).
Manual SNPE benchmarking
modelconverter benchmark. This approach is useful when:- Building custom benchmarking scripts or automation
- Integrating with existing SNPE pipelines
- Requiring fine-grained control over benchmarking parameters
Workflow
- Inspect the DLC model Extract input tensor metadata including tensor names, shapes, and data types. Use
snpe-dlc-infoto retrieve this information. - Prepare input data
- Create input
.rawfiles matching the expected tensor shapes and types. - Generate an
input_list.txtfile that lists all input files for processing.
- Create input
- Run SNPE benchmarking tools Choose the appropriate tool based on your benchmarking goals:
Advanced Examples
NN Archive with Custom Duration
Command Line
1modelconverter benchmark rvc2 \
2 --model-path path/to/model_archive.tar.xz \
3 --benchmark-time 60 \
4 --save- Runs a 60-second time-based benchmark for more stable results
- Prints results to console and saves to CSV for comparison
HubAI Model with Power Monitoring
Command Line
1modelconverter benchmark rvc4 \
2 --model-path yolov6-nano:r2-coco-512x288 \
3 --device-ip 192.168.1.50 \
4 --power-benchmark \
5 --dsp-benchmark- Use
--device-id <id>as an alternative to--device-ip <ip> - Power and DSP monitoring require ADB access and device support
Local DLC via SNPE
.dlc file using SNPE tools with a controlled workload size.Command Line
1modelconverter benchmark rvc4 \
2 --model-path path/to/model.dlc \
3 --no-dai-benchmark \
4 --device-ip 192.168.1.50 \
5 --num-images 500- Uses SNPE benchmarking path instead of DAI (via
--no-dai-benchmark) - Processes 500 generated input images
- Targets a specific device by IP address