yolov3_tiny转onnx,转tensorrt的部署过程,以及中间碰到的bug

我是在github的zombie作者代码基础上部署的代码,碰到了一下bug,以及相关解决方案:
https://github.com/zombie0117/yolov3-tiny-onnx-TensorRT,感谢zombie。

ImportError: libnvinfer.so.6: cannot open shared object file: No such file or directory

sudo cp /home/lc/TensorRT-6.0.1.5/lib/.so. /usr/lib/x86_64-linux-gnu
https://blog.csdn.net/MD2017/article/details/82945565?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task

File “/home/lc/anaconda3/envs/onnx/lib/python3.7/site-packages/onnx/helper.py”, line 92, in make_graph
graph.input.extend(inputs)
TypeError: Not a cmessage
错误的原因是因为cfg文件没有被成功分离出来
改yolov3_to_onnx.py文件中的代码
while remainder is not None: #原版代码
改为:
while (len(remainder.split(’\n\n’, 1)) >= 2): # 修改后代码

onnx.onnx_cpp2py_export.checker.ValidationError: Op registered for Upsample is deprecated in domain_version of 11

解决方案:
换成python2.7
降级onnx到1.4.1
pip uninstall onnx
pip install onnx==1.4.1

https://blog.csdn.net/weixin_42279044/article/details/102819670

ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory

cuda版本不对,安装cuda10.0,重新安装tensorrt可解决。
多个cuda版本切换:
https://blog.csdn.net/askmaggie/article/details/102838961
https://blog.csdn.net/weixin_38009585/article/details/93240419

切换cuda版本:
sudo rm -rf /usr/local/cuda #删除之前创建的软链接
建立新版本的软链接
sudo ln -s /usr/local/cuda-10.0 /usr/local/cuda
5.
engine_file_path) as engine, engine.create_execution_context() as context: AttributeError: exit

解决方案:删掉之前生成的那个空的trt文件。
6.
Onnx_to_tensorrt.py文件出现bug:
ValueError: cannot reshape array of size 43095 into shape (1,18,13,13)
解决方案:
output_shapes_416 = [(batch_size, 18, 13, 13), (batch_size, 18, 26, 26)]
改成:
output_shapes_416 = [(batch_size, 255, 13, 13), (batch_size, 255, 26, 26)]

你可能感兴趣的:(算法落地)