Model Inference API Overview

This section mainly introduces the API, data, structures, layout, and alignment rules of model inference. By reading this section, you can use APIs to complete operations such as model loading and releasing, model information obtaining, and model inference on dev boards provided by Horizon Robotics.

Data Type and Data Structure

NameDescription
HB_DNN_TENSOR_MAX_DIMENSIONSMaximum dimension of the tensor
hbDNNPackedHandle_tDNN handle, pointing to the packed multiple models
hbDNNHandle_tDNN handle, pointing to the single model
hbDNNDataTypeTensor type
hbDNNTensorShapeTensor shape
hbDNNQuantiShiftQuantization/dequantization shift data
hbDNNQuantiScaleQuantization/dequantization scale data
hbDNNQuantiTypeFixed-point to floating-point conversion quantization/dequantization type
hbDNNTensorPropertiesTensor information
hbDNNTensorTensor
hbDNNRoiRectangular region of interest

API Interface

NameDescription
hbDNNGetVersionGet version info of DNN prediction library
hbDNNInitializeFromFilesComplete the creation and initialization of dnnPackedHandle from the file
hbDNNInitializeFromDDRComplete the creation and initialization of dnnPackedHandle from the memory
hbDNNReleaseRelease the model that dnnPackedHandle points to
hbDNNGetModelNameListGet the name list and number of the models that dnnPackedHandle points to
hbDNNGetModelHandleGet the handle of a model from the model list that dnnPackedHandle points to
hbDNNGetInputCountGet the number of the input tensors of the model that dnnHandle points to
hbDNNGetInputNameGet the names of the input tensors of the model that dnnHandle points to
hbDNNGetInputTensorPropertiesGet the property of the specific input tensor of the model that dnnHandle points to
hbDNNGetOutputCountGet the number of the output tensors of the model that dnnHandle points to
hbDNNGetOutputNameGet the names of the output tensors of the model that dnnHandle points to
hbDNNGetOutputTensorPropertiesGet the property of the specific output tensor of the model that dnnHandle points to
hbDNNInferV2 Create synchronous/asynchronous inference tasks based on input parameters
hbDNNRoiInferV2Create ROI synchronous/asynchronous inference tasks based on input parameters
hbDNNGetErrorDescTranslate the error codes into natural language