我下载了一个.onnx
模型(https://github.com/onnx/models/blob/main/vision/classification/resnet/model/resnet50-v2-7.onnx)并尝试转换为CCD_ 2格式。我已将文件重命名为model.onnx
,并尝试使用库描述的Example部分中给出的命令行进行转换(https://pypi.org/project/nnoir-onnx/)。但是命令行有问题,所以我无法将模型转换为.nnoir
格式。日志以.txt
文件的形式附加,如下所示。onnx-noir.txt
user02@ubuntu:~/Downloads$ onnx2nnoir -o model.nnoir model.onnx
onnx2nnoir: command not found
user02@ubuntu:~/Downloads$ pip install nnoir-onnx
Requirement already satisfied: nnoir-onnx in /home/user02/.local/lib/python3.8/site-packages (1.0.15)
Requirement already satisfied: importlib-metadata<5,>=4 in /home/user02/.local/lib/python3.8/site-packages (from nnoir-onnx) (4.12.0)
Requirement already satisfied: msgpack<2,>=1 in /home/user02/.local/lib/python3.8/site-packages (from nnoir-onnx) (1.0.4)
Requirement already satisfied: onnx<1.12.0 in /home/user02/.local/lib/python3.8/site-packages (from nnoir-onnx) (1.11.0)
Requirement already satisfied: numpy<2,>=1 in /home/user02/.local/lib/python3.8/site-packages (from nnoir-onnx) (1.23.1)
Requirement already satisfied: nnoir<2.0.0,>=1.0.9 in /home/user02/.local/lib/python3.8/site-packages (from nnoir-onnx) (1.0.9)
Requirement already satisfied: protobuf<4.0,>=3.8 in /home/user02/.local/lib/python3.8/site-packages (from nnoir-onnx) (3.20.1)
Requirement already satisfied: onnxruntime<2.0.0,>=1.2.0 in /home/user02/.local/lib/python3.8/site-packages (from nnoir-onnx) (1.12.0)
Requirement already satisfied: zipp>=0.5 in /home/user02/.local/lib/python3.8/site-packages (from importlib-metadata<5,>=4->nnoir-onnx) (3.8.1)
Requirement already satisfied: typing-extensions>=3.6.2.1 in /home/user02/.local/lib/python3.8/site-packages (from onnx<1.12.0->nnoir-onnx) (4.3.0)
Requirement already satisfied: flatbuffers in /home/user02/.local/lib/python3.8/site-packages (from onnxruntime<2.0.0,>=1.2.0->nnoir-onnx) (2.0)
Requirement already satisfied: coloredlogs in /home/user02/.local/lib/python3.8/site-packages (from onnxruntime<2.0.0,>=1.2.0->nnoir-onnx) (15.0.1)
Requirement already satisfied: packaging in /home/user02/.local/lib/python3.8/site-packages (from onnxruntime<2.0.0,>=1.2.0->nnoir-onnx) (21.3)
Requirement already satisfied: sympy in /home/user02/.local/lib/python3.8/site-packages (from onnxruntime<2.0.0,>=1.2.0->nnoir-onnx) (1.10.1)
Requirement already satisfied: humanfriendly>=9.1 in /home/user02/.local/lib/python3.8/site-packages (from coloredlogs->onnxruntime<2.0.0,>=1.2.0->nnoir-onnx) (10.0)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /home/user02/.local/lib/python3.8/site-packages (from packaging->onnxruntime<2.0.0,>=1.2.0->nnoir-onnx) (3.0.9)
Requirement already satisfied: mpmath>=0.19 in /home/user02/.local/lib/python3.8/site-packages (from sympy->onnxruntime<2.0.0,>=1.2.0->nnoir-onnx) (1.2.1)
user02@ubuntu:~/Downloads$ onnx2nnoir -o model.nnoir model.onnx
onnx2nnoir: command not found
user02@ubuntu:~/Downloads$
我也尝试过onnigiri
,但显示了类似的错误。请让我知道如何解决这个问题。
这是因为在Linux中,pip install ...
命令会将库添加到.local/bin
文件夹中,而您的机器在PATH
中没有.local/bin
在转换之前执行此行
export PATH="$HOME/.local/bin:$PATH"
或者更好的方法是将上述行附加到机器中的~/.bashrc
文件中。并通过激活
source ~/.bashrc