yolov8分割法 C++部署

 

使用的命令:

conda list

 

参考资料 https://github.com/triple-Mu/YOLOv8-TensorRT/blob/main/docs/Segment.md

1.

python3 export-seg.py --weight ./0.0.0/yolov8s-seg.pt --opset 11 --sim --input-shape 1 3 640 640 --device cuda:0

报错:ModuleNotFoundError: No module named 'tensorrt'

解决:

pip install nvidia-tensorrt

 

2.

python3 export-seg.py --weight ./0.0.0/yolov8s-seg.pt --opset 11 --sim --input-shape 1 3 640 640 --device cuda:0

报错:The NVIDIA driver on your system is too old

解决:

将520版本的驱动更换为535的驱动

3.

python3 build.py --weights yolov8s-seg.onnx --fp16  --device cuda:0 --seg
报错:
AttributeError: 'tensorrt_bindings.tensorrt.IBuilderConfig' object has no attribute 'max_workspace_size'
原因:tensorrt8.0以上删除了max_workspace_size属性。

解决方案:(1)将tensorRT降低为7.x版本(不推荐)

(2)使用如下命令替换:
# builder.max_workspace_size = 1 << 20
config = builder.create_builder_config()
config.max_workspace_size = 1 << 20


4.trtexec --onnx=yolov8n-seg.onnx --saveEngine=yolov8n-seg.trt
报错:
[8] Assertion failed: inputs.at(0).isInt32() && "For range operator with dynamic inputs, this version of TensorRT only supports INT32!"
解决:
3060比较特殊,不要用trtexec 编译onnx,应该使用代码编译
https://github.com/FeiYull/TensorRT-Alpha/blob/main/tools/onnx2trt.cpp

5.Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.
解决:
pip install onnxruntime==1.17.3



posted @ 2024-06-12 11:56  dsfsadfdgd  阅读(244)  评论(0编辑  收藏  举报