S100 OpenExplorer

# #Prepare Floating-point Model

Before you read this section, we recommend that you read Toolchain Operator Support Constraint List section for an understanding of the operators and constraints supported by Horizon Robotics. Or, after you export your ONNX model, you can first refer to the Check the Model section to check that the model can be deployed with Horizon support for normal conversion.

A floating-point model trained on an open source DL framework is the input to the conversion tool, which currently supports the following DL frameworks:

FRAMEWORK | HORIZON'S TOOLCHAIN
--- | ---
Caffe | Supported
PyTorch | Supported (convert into ONNX)
TensorFlow | Supported (convert into ONNX)
TensorFlow Lite | Supported (convert into ONNX)
PaddlePaddle | Supported (convert into ONNX)
Others | Contact Horizon

As shown above, the caffemodel exported from Caffe framework can be supported directly, While the models trained from the rest frameworks must be first converted into ONNX before using the conversion tool. Presently Horizon supports ONNX opset10-19.

- For the Caffe model, you can first evaluate the floating-point model accuracy, confirm the correct model weights and structure.

- For the ONNX model, you need to preform the model inference using HBRuntime to verify the inference results are consistent between ONNX and the original DL framework model(i.e., make sure the model is legal).

There are standard solutions to convert models of different frameworks into ONNX, refer to the following:

- Pytorch2Onnx: PyTorch's official API can support exporting models into ONNX models.

  Click here to see more: https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html .

- Tensorflow2Onnx: Conversion based on the onnx/tensorflow-onnx of the ONNX community.

  Click here to see more: https://github.com/onnx/tensorflow-onnx .

- TensorflowLite2Onnx: Conversion based on the open-source tool `tflite2onnx`.

  Click here to see more: https://github.com/zhenhuaw-me/tflite2onnx .

- PaddlePaddle2Onnx: PaddlePaddle's official API can support exporting models into ONNX models.

  Click here to see more: https://www.paddlepaddle.org.cn/documentation/docs/en/api/paddle/onnx/export_en.html .

- More solutions to convert models of other frameworks into ONNX, you can click https://github.com/onnx/tutorials#converting-to-onnx-format .

Attention

Original model limitations: ir_version≤9, 10≤opset=≤19, for the correspondence between ir_version and onnx version, please refer to onnx official documentation.

On This Page