TensorRT-Alpha icon indicating copy to clipboard operation
TensorRT-Alpha copied to clipboard

Cuda12.1+tensorrt10.0 运行C++yolov8工程报错,提示getBindingDimensions 不是 nvinfer1::IExecutionContext成员 代码C2039

Open yyyyyycui opened this issue 1 year ago • 4 comments
trafficstars

感谢作者的工程分享,我这边使用Cuda12.1+tensorrt10.0+pytroch2.2的配置。来尝试在win10环境下,运行yolov8 C++推理。 出现报错“getBindingDimensions 不是 nvinfer1::IExecutionContext成员 代码C2039”。 这是否是因为tensorrt版本不是教程中的8.x导致的呢?

此外我这边在编译ONNX的时候也提示没有buildOnly这个参数,去掉后编译成功, tensorrt10.0也没有nvparsers.lib 这个文件 ../../../../TensorRT-10.0/bin/trtexec.exe --onnx=yolov8s.onnx --saveEngine=yolov8s.trt --buildOnly --minShapes=images:1x3x640x640 --optShapes=images:4x3x640x640 --maxShapes=images:8x3x640x640

yyyyyycui avatar Apr 06 '24 10:04 yyyyyycui

解决了,是版本的问题,修改为tensorrt8.6.1.6.版本就解决了

yyyyyycui avatar Apr 06 '24 11:04 yyyyyycui

解决了,是版本的问题,修改为tensorrt8.6.1.6.版本就解决了

想问下你是修改了哪个文件

Yi-hash1 avatar Apr 09 '24 06:04 Yi-hash1

我是把tensorrt10.0卸载了,安装了安装教程中的tensorrt8.6.1.6版本,希望能对你有所帮助

------------------ 原始邮件 ------------------ 发件人: Yi-hash1 @.> 发送时间: 2024年4月9日 14:47 收件人: FeiYull/TensorRT-Alpha @.> 抄送: yyyyyycui @.>, Author @.> 主题: Re: [FeiYull/TensorRT-Alpha] Cuda12.1+tensorrt10.0 运行C++yolov8工程报错,提示getBindingDimensions 不是 nvinfer1::IExecutionContext成员 代码C2039 (Issue #108)

解决了,是版本的问题,修改为tensorrt8.6.1.6.版本就解决了

想问下你是修改了哪个文件

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

yyyyyycui avatar Apr 19 '24 09:04 yyyyyycui

const char* input_name = engine->getIOTensorName(0);
const char* output_name = engine->getIOTensorName(1);

// 获取输入输出维度(使用getTensorShape替代getBindingDimensions)
nvinfer1::Dims input_dims = engine->getTensorShape(input_name);
nvinfer1::Dims output_dims = engine->getTensorShape(output_name);

1020261566 avatar Apr 03 '25 01:04 1020261566