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!
https://devtalk.nvidia.com/default/topic/1052153/jetson-nano/tensorrt-backend-for-onnx-on-jetson-nano/1
二,
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...