TensorRT-5.1.5.0/samples/python/yolov3_onnx 裏面包含了基本的samples
pip 默認安裝的requirements.txt 裏面的環境 可能會有問題,所以還是自己搭建
我是在conda 環境下裝的
一, yolov3_to_onnx 模型
python yolov3_to_onnx.py
Traceback (most recent call last):
File "yolov3_to_onnx.py", line 812, in <module>
main()
File "yolov3_to_onnx.py", line 805, in main
onnx.checker.check_model(yolov3_model_def)
File "/home/amax/miniconda3/envs/tensorrt_py27/lib/python2.7/site-packages/onnx/checker.py", line 82, in check_model
C.check_model(model.SerializeToString())
onnx.onnx_cpp2py_export.checker.ValidationError: Input size 2 not in range [min=1, max=1].
==> Context: Bad node spec: input: "085_convolutional_lrelu" input: "086_upsample_scale" output: "086_upsample" name: "086_upsample" op_type: "Upsample" attribute { name: "mode" s: "nearest" type: STRING }
TensorRT-5.1.5.0/samples/python/yolov3_onnx的 轉換模型的例子需要在pip install onnx=1.4.1, 環境超過1.5.0錯錯錯!!爲啥官方的例子自己都不更新,這是有多麼不上心啊,用戶還要去論壇找answer ,unbelievable!
二,
TensorRT-5.1.5.0/python/ 安裝
pip install tensorrt-5.1.5.0-cp27-none-linux_x86_64.whl
pip install pycuda
conda install pillow
python onnx_to_tensorrt.py
Downloading from https://github.com/pjreddie/darknet/raw/f86901f6177dfc6116360a13cc06ab680e0c86b0/data/dog.jpg, this may take a while...
100% [............................................................................] 163759 / 163759
Loading ONNX file from path yolov3.onnx...
Beginning ONNX file parsing
Completed parsing of ONNX file
Building an engine from file yolov3.onnx; this may take a while...