Example
This page provides a concrete example detailing every aspect that needs to be present in conversion toolchain as discussed in the specification page.
In this example, we'll be using Python to create a function that's fed an ONNX file and that produces an ONNX-like file that will be consumed by the Hailo runtime. The Python code mainly contains a core function responsible for the model conversion in the toolchain, and other files useful to Dockerize it.
The convert_to_hailo_onnx
function is the one responsible for parsing, transpiling, optimizing and compiling the input model to build a Hailo-ONNX compatible with the runtime.
The Dockerfile below is used to build a docker image that exposes that function.
It installs the required Linux and Python dependencies along with the Hailo's Dataflow Compiler toolchain. Finally, in the last line, we expose the toolchain-run-block
shell script that will call our conversion function.
For this example to run, you'll need to download Hailo Dataflow Compiler and HailoRT from Hailo's Developer Zone.
Namely:
hailort-4.16.0-cp38-cp38-linux_x86_64.whl
hailo_dataflow_compiler-3.26.0-py3-none-linux_x86_64.whl
hailort_4.16.0_amd64.deb
Those files need to be included in the hailo-deps
directory of the full example folder.
The full example of the conversion block can be found here.
Results
The conversion block will generate a couple of artifacts:
the Hailo-ONNX file,
and a logs file resembling this one:
Last updated