Sure, simply follow the next steps (please note that the below was tested on Renesas Whitehawk SDK 3.18)
- add onnxruntime-meta under the OpenEmbedded meta-layer
git clone https://github.com/tkfu/meta-onnx.git
- add the onnxruntime-meta layer under conf/bblayers.conf
${TOPDIR}/../meta-openembedded/meta-onnx \
- add the onnxruntime recipe under conf/local.conf
IMAGE_INSTALL_append = " onnxruntime "
-
replace the onnxruntime recipe onnxruntime_0.4.0.bb and the onnxruntime_0.4.0 directory with onnxruntime_1.8.0.bb and onnxruntime_1.8.0 directory from meta-renesas-ai/recipes-mathematics/onnxruntime at v5.1.0 · renesas-rz/meta-renesas-ai · GitHub
-
the onnxruntime 1.8 recipe requires protobuf 3.16.0 while the protobuf directory include version 3.6.1, copy all recipes and files directory from meta-renesas-ai/recipes-devtools/protobuf at v5.1.0 · renesas-rz/meta-renesas-ai · GitHub and add them under meta-openembedded/meta-onnx/recipes-support/protobuf/, and remove the protobuf 3.6.1 recipes.
-
under meta-onnx/conf/layer.conf add:
LAYERSERIES_COMPAT_onnxruntime = "dunfell"
- bitbake the onnxruntime recipe to make sure it is built properly
bitbake onnxruntime
- build an updated yocto image.
bitbake rcar-image-adas
The Onnxruntime can be verified by the onnx_test_runner, a program which loads a set of test cases and runs a self tests.
The onnx_test_runner is installed under /usr/bin/onnxruntime/examples/unitest.
In order to run it apply the following commands:
cd /usr/bin/onnxruntime/examples/unitest/
./onnx_test_runner ./squeezenet
the expected output should be:
root@v4x:/usr/bin/onnxruntime/examples/unittest# ./onnx_test_runner ./squeezenet/
result:
Models: 1
Total test cases: 12
Succeeded: 12
Not implemented: 0
Failed: 0
Stats by Operator type:
Not implemented(0):
Failed:
Failed Test Cases: