ON THIS PAGE

  • Overview
  • Quick Start
  • Python API
  • General Parameters
  • YOLO Parameters
  • RVC2 Parameters
  • RVC4 Parameters
  • CLI Reference
  • Migration from BlobConverter
  • Simple Conversion
  • Conversion from OpenVINO IR
  • Conversion from TFLite
  • Advanced Parameters
  • Migration from tools.luxonis.com

HubAI

Overview

HubAI is the recommended online conversion workflow for Luxonis devices. It runs ModelConverter in the cloud and produces deployment artifacts without local converter setup.This page focuses on online conversion usage and migration from legacy tools. For the managed Model Registry workflow and platform-specific conversion settings, see the HubAI Conversion guide. For SDK installation, authentication, and model, variant, and instance APIs, see the HubAI SDK documentation.

Quick Start

Install hubai-sdk and configure HUBAI_API_KEY as described in the HubAI SDK page, then run a conversion:
Python
1import os
2
3from hubai_sdk import HubAIClient
4
5client = HubAIClient(api_key=os.getenv("HUBAI_API_KEY"))
6
7response = client.convert.RVC2(
8    path="path/to/model.onnx",
9    name="my-converted-model",
10)
11
12print(response.downloaded_path)
The returned response downloads the converted artifact locally and also exposes the created Hub AI instance metadata.

Python API

The online conversion API lives under the HubAIClient.convert namespace. Use target-specific helpers such as convert.RVC2 and convert.RVC4 when the target is fixed.There is also a generic conversion entrypoint if you want to choose the target programmatically:
Python
1from hubai_sdk.utils.types import Target
2
3response = client.convert.convert(
4    Target.RVC2,
5    path="path/to/model.onnx",
6    name="my-converted-model",
7)
The conversion function takes a number of parameters to specify the model and the conversion options. Here we list the main ones to get you started, but for the exact current parameter set, refer to the full API documentation.

General Parameters

General parameters applicable to all conversion functions.
argumenttypedescription
pathstrThe path to the model file.
tool_versionstr | NoneThe version of the conversion tool.
quantization_modeLiteral["INT8_STANDARD", "INT8_ACCURACY_FOCUSED", "INT8_INT16_MIXED", "INT8_INT16_MIXED_ACCURACY_FOCUSED", "FP16_STANDARD", "FP32_STANDARD"]Quantization or precision preset used by targets that support it, for example INT8_STANDARD or FP16_STANDARD.
output_dirstr | NoneThe directory to save the converted model. If not specified, the model will be saved in the current working directory.

YOLO Parameters

These parameters are only relevant if you're converting a YOLO model.
argumenttypedescription
yolo_input_shapelist[int] | NoneThe input shape of the YOLO model.
yolo_versionstr | NoneOptional YOLO version override, for example "yolov8". If omitted, the backend attempts to detect the version automatically from the PyTorch model file.
yolo_class_nameslist[str] | NoneThe class names of the model.
You do not need to set yolo_version explicitly for YOLO conversions. If it is omitted, the backend attempts to detect the version automatically. The PyTorch model file still needs to come from one of the supported YOLO versions.

RVC2 Parameters

Parameters specific to the RVC2 conversion.
argumenttypedescription
mo_argslist[str] | NoneThe arguments to pass to the model optimizer.
compile_tool_argslist[str] | NoneThe arguments to pass to the BLOB compiler.
compress_to_fp16boolWhether to compress the model's weights to FP16 precision. Defaults to True.
number_of_shavesintThe number of shaves to use. Defaults to 8.
superblobboolWhether to create a superblob. Defaults to True. Use False if you want legacy RVC2 blob conversion.

RVC4 Parameters

Parameters specific to the RVC4 conversion.
argumenttypedescription
snpe_onnx_to_dlc_argslist[str] | NoneThe arguments to pass to the snpe-onnx-to-dlc tool.
snpe_dlc_quant_argslist[str] | NoneThe arguments to pass to the snpe-dlc-quant tool.
snpe_dlc_graph_prepare_argslist[str] | NoneThe arguments to pass to the snpe-dlc-graph-prepare tool.
use_per_channel_quantizationboolWhether to use per-channel quantization. Defaults to True.
use_per_row_quantizationboolWhether to use per-row quantization. Defaults to False.
htp_socslist[str] | NoneThe list of HTP SoCs to use.
Conversion calls can also create or attach Hub AI resources through arguments such as name, model_id, variant_id, variant_version, and input_shape. For those workflows and the broader SDK surface, see the HubAI SDK page.

CLI Reference

The conversion can also be done using the command line interface. Start with:
Command Line
1hubai login
2hubai convert RVC2 --path /path/to/model.onnx --name "my-model"
See hubai convert --help for the full list of options.

Migration from BlobConverter

BlobConverter is our previous library for converting models to the BLOB format for earlier OAK workflows. It is being replaced by ModelConverter and HubAI SDK, which are the supported paths going forward.blobconverter is still available and can be used for conversion, but we recommend HubAI SDK for new projects. The API is similar, but there are differences in parameter names and in how conversion is executed.blobconverter offers several functions for converting models from different frameworks, such as from_onnx, from_openvino, and from_tf. These functions are replaced by convert.RVC2 in HubAI SDK, which takes a single path argument pointing to the model input.The following table shows the mapping between the parameters of blobconverter and HubAI SDK.
blobconverterHubAI SDKNotes
modelpathThe model file path.
xmlpathThe XML file path. Only for conversion from OpenVINO IR.
binopts["input_bin"]The BIN file path. Only for conversion from OpenVINO IR.
versiontool_versionThe version of the conversion tool.
data_typecompress_to_fp16Use True for FP16-compressed weights and False otherwise. RVC2 does not use quantization_mode.
shavesnumber_of_shavesThe number of shaves to use.
optimizer_paramsmo_argsThe arguments to pass to the model optimizer.
compile_paramscompile_tool_argsThe arguments to pass to the BLOB compiler.
By default, HubAI SDK enables superblob, which is only supported on DepthAI v3. If you want to convert a model to the legacy RVC2 blob format, pass superblob=False to convert.RVC2.

Simple Conversion

Simple ONNX conversion using blobconverter
Python
1import blobconverter
2
3blob = blobconverter.from_onnx(
4    model="resnet18.onnx",
5)
Equivalent code using HubAI SDK
Python
1response = client.convert.RVC2(
2    path="resnet18.onnx",
3)
4
5blob = response.downloaded_path

Conversion from OpenVINO IR

blobconverter example
Python
1import blobconverter
2
3blob = blobconverter.from_openvino(
4    xml="resnet18.xml",
5    bin="resnet18.bin",
6)
HubAI SDK example
Python
1# When the XML and BIN files are at the same location,
2# only the XML needs to be specified.
3response = client.convert.RVC2(path="resnet18.xml")
4blob = response.downloaded_path
5
6# Otherwise, the BIN file can be specified using
7# the `opts` parameter.
8response = client.convert.RVC2(
9    path="resnet18.xml",
10    opts={
11        "input_bin": "resnet18.bin",
12    },
13)
14blob = response.downloaded_path

Conversion from TFLite

blobconverter example
Python
1import blobconverter
2
3blob = blobconverter.from_tf(
4    frozen_pb="resnet18.tflite",
5)
Equivalent code using HubAI SDK
Python
1response = client.convert.RVC2(
2    path="resnet18.tflite",
3)
4
5blob = response.downloaded_path

Advanced Parameters

blobconverter.from_onnx with advanced parameters
Python
1import blobconverter
2
3blob = blobconverter.from_onnx(
4    model="resnet18.onnx",
5    data_type="FP16",
6    version="2021.4",
7    shaves=6,
8    optimizer_params=[
9        "--mean_values=[127.5,127.5,127.5]",
10        "--scale_values=[255,255,255]",
11    ],
12    compile_params=["-ip U8"],
13)
Equivalent code using HubAI SDK
Python
1response = client.convert.RVC2(
2    path="resnet18.onnx",
3    tool_version="2021.4.0",
4    number_of_shaves=6,
5    mo_args=[
6        "mean_values=[127.5,127.5,127.5]",
7        "scale_values=[255,255,255]",
8    ],
9    compile_tool_args=["-ip", "U8"],
10)
11
12blob = response.downloaded_path

Caffe Conversion

Conversion from the Caffe framework is not supported.

Migration from tools.luxonis.com

The web app hosted on tools.luxonis.com is our legacy application for converting YOLO object detection models. It is being replaced by HubAI online conversion.Compared to the web application, HubAI online conversion also supports instance segmentation, pose, oriented detection, and classification YOLO models. For the current conversion capabilities, refer to the HubAI Conversion documentation.Here is an example of converting an existing .pt file to an RVC2-compatible .superblob:
Python
1import os
2
3from hubai_sdk import HubAIClient
4
5client = HubAIClient(api_key=os.getenv("HUBAI_API_KEY"))
6
7converted_model = client.convert.RVC2(
8    path="yolov6n.pt",
9    yolo_version="yolov6r4",
10)
This uses our Hub cloud service to perform the conversion and downloads a .tar.xz bundle when the job finishes. For additional YOLO-specific flags, see the YOLO parameters section.