Jetson Nano 可以直接 pip 安装 cpu 版本的 onnxruntime
用 pypi 的源,直接安装 onnxruntime-gpu 或者 onnxruntime_gpu 都会报找不到对应的架构 aarch64

本来以为要用官方库编译一下 https://github.com/microsoft/onnxruntime

幸运的是,NVIDIA官方帮咱编译了,参考issue:
https://github.com/microsoft/onnxruntime/issues/6124

https://elinux.org/Jetson_Zoo#ONNX_Runtime 中:

根据 你的JetPack 版本以及 Python 版本,选择对应的 whl 包
在这里插入图片描述
以下是一个简单的安装 demo:

# 从以上提到的链接中下载 pip whl 包
$ wget https://nvidia.box.com/shared/static/jy7nqva7l88mq9i8bw3g3sklzf4kccn2.whl -O onnxruntime_gpu-1.10.0-cp36-cp36m-linux_aarch64.whl

# pip 安装 whl 包
$ pip3 install onnxruntime_gpu-1.10.0-cp36-cp36m-linux_aarch64.whl

这次偷了懒,哪天再遇到问题,一定要编译一下[捂脸笑哭]

若安装之后报了这个错:

AttributeError: module 'onnxruntime' has no attribute 'InferenceSession'

可能是因为同时安装了 gpu 版本和 cpu 版本,需要卸载掉 cpu 版本

python3 -m pip uninstall onnxruntime

同时可能需要重装 onnxruntime-gpu

Logo

分享最新的 NVIDIA AI Software 资源以及活动/会议信息,精选收录AI相关技术内容,欢迎大家加入社区并参与讨论。

更多推荐