Comments (12)
@lindsayshuo Pls advice.
from tensorrtx.
在win10下编译 tensorrtx-yolov8 出现如下错误: 【1】、 2>J:\tensorrtx\yolov8\plugin\yololayer.cu(262): error : expression must have a constant value 2>J:\tensorrtx\yolov8\plugin\yololayer.cu(262): note #2689-D: the value of variable "maxGrids" 2>(261): here cannot be used as a constant 【2】、 C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 11.7.targets(790,9): error MSB3721: 命令“"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin\nvcc.exe" --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include" -IJ:\tensorrtx\yolov8\include -I"I:\TensorRT-8.6.1.6\include" -I"I:\TensorRT-8.6.1.6\samples\common" -IJ:\tensorrtx\yolov8\plugin -II:\opencv\build\include -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include" --keep-dir myplugins\x64\Release -maxrregcount=0 --machine 64 --compile -cudart static -std=c++11 -Xcompiler="/EHsc -Ob2" -D_WINDOWS -DNDEBUG -DAPI_EXPORTS -D"CMAKE_INTDIR="Release"" -Dmyplugins_EXPORTS -D_WINDLL -D_MBCS -D"CMAKE_INTDIR="Release"" -Dmyplugins_EXPORTS -Xcompiler "/EHsc /W3 /nologo /O2 /Fdmyplugins.dir\Release\vc143.pdb /FS /MD /GR" -o myplugins.dir\Release\yololayer.obj "J:\tensorrtx\yolov8\plugin\yololayer.cu"”已退出,返回代码为 1。
我在ubuntu22里面编译不报错呢
from tensorrtx.
在win10下编译 tensorrtx-yolov8 出现如下错误: 【1】、 2>J:\tensorrtx\yolov8\plugin\yololayer.cu(262): error : expression must have a constant value 2>J:\tensorrtx\yolov8\plugin\yololayer.cu(262): note #2689-D: the value of variable "maxGrids" 2>(261): here cannot be used as a constant 【2】、 C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 11.7.targets(790,9): error MSB3721: 命令“"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin\nvcc.exe" --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include" -IJ:\tensorrtx\yolov8\include -I"I:\TensorRT-8.6.1.6\include" -I"I:\TensorRT-8.6.1.6\samples\common" -IJ:\tensorrtx\yolov8\plugin -II:\opencv\build\include -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include" --keep-dir myplugins\x64\Release -maxrregcount=0 --machine 64 --compile -cudart static -std=c++11 -Xcompiler="/EHsc -Ob2" -D_WINDOWS -DNDEBUG -DAPI_EXPORTS -D"CMAKE_INTDIR="Release"" -Dmyplugins_EXPORTS -D_WINDLL -D_MBCS -D"CMAKE_INTDIR="Release"" -Dmyplugins_EXPORTS -Xcompiler "/EHsc /W3 /nologo /O2 /Fdmyplugins.dir\Release\vc143.pdb /FS /MD /GR" -o myplugins.dir\Release\yololayer.obj "J:\tensorrtx\yolov8\plugin\yololayer.cu"”已退出,返回代码为 1。
我在ubuntu22里面编译不报错呢
你用的最新版本吗
from tensorrtx.
在win10下编译 tensorrtx-yolov8 出现如下错误: 【1】、 2>J:\tensorrtx\yolov8\plugin\yololayer.cu(262): error : expression must have a constant value 2>J:\tensorrtx\yolov8\plugin\yololayer.cu(262): note #2689-D: the value of variable "maxGrids" 2>(261): here cannot be used as a constant 【2】、 C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 11.7.targets(790,9): error MSB3721: 命令“"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin\nvcc.exe" --use-local-env -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include" -IJ:\tensorrtx\yolov8\include -I"I:\TensorRT-8.6.1.6\include" -I"I:\TensorRT-8.6.1.6\samples\common" -IJ:\tensorrtx\yolov8\plugin -II:\opencv\build\include -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include" --keep-dir myplugins\x64\Release -maxrregcount=0 --machine 64 --compile -cudart static -std=c++11 -Xcompiler="/EHsc -Ob2" -D_WINDOWS -DNDEBUG -DAPI_EXPORTS -D"CMAKE_INTDIR="Release"" -Dmyplugins_EXPORTS -D_WINDLL -D_MBCS -D"CMAKE_INTDIR="Release"" -Dmyplugins_EXPORTS -Xcompiler "/EHsc /W3 /nologo /O2 /Fdmyplugins.dir\Release\vc143.pdb /FS /MD /GR" -o myplugins.dir\Release\yololayer.obj "J:\tensorrtx\yolov8\plugin\yololayer.cu"”已退出,返回代码为 1。
确保你的 CUDA Toolkit 和对应的 Visual Studio 插件版本相兼容,有时候版本不匹配也会导致编译错误。如果你不确定,可以检查 NVIDIA 官方文档,了解你的 CUDA Toolkit 版本支持的 Visual Studio 版本。
from tensorrtx.
谢谢答复,我晚上再试验一下
from tensorrtx.
谢谢答复,我晚上再试验一下
请问你解决了吗,我遇到同样问题
from tensorrtx.
谢谢答复,我晚上再试验一下
请问你解决了吗,我遇到同样问题
好像是 mStridesLength 不能在编译时确定的问题
我对 yololayer.cu 做了如下修改后不报错了:
//const int maxGrids = mStridesLength;
//int grids[maxGrids][2];
//for (int i = 0; i < maxGrids; ++i) {
// grids[i][0] = mYoloV8netHeight / mStrides[i];
// grids[i][1] = mYoloV8NetWidth / mStrides[i];
//}
const int maxGrids = mStridesLength;
int** grids = new int*[maxGrids];
for (int i = 0; i < maxGrids; ++i) {
grids[i] = new int[2];
grids[i][0] = mYoloV8netHeight / mStrides[i];
grids[i][1] = mYoloV8NetWidth / mStrides[i];
}
for (unsigned int i = 0; i < maxGrids; i++) {
int grid_h = grids[i][0];
int grid_w = grids[i][1];
int stride = mStrides[i];
numElem = grid_h * grid_w * batchSize;
if (numElem < mThreadCount)
mThreadCount = numElem;
CalDetection<<<(numElem + mThreadCount - 1) / mThreadCount, mThreadCount, 0, stream>>>(
inputs[i], output, numElem, mMaxOutObject, grid_h, grid_w, stride, mClassCount, mNumberofpoints,
mConfthreshkeypoints, outputElem, is_segmentation_, is_pose_);
}
// 释放内存
for (int i = 0; i < maxGrids; ++i) {
delete[] grids[i];
}
delete[] grids;
from tensorrtx.
int maxGrids = mStridesLength;
int flatGridsLen = 2 * maxGrids;
int* flatGrids = new int[flatGridsLen];
for (int i = 0; i < maxGrids; ++i) {
flatGrids[2*i] = mYoloV8netHeight / mStrides[i];
flatGrids[2*i + 1] = mYoloV8NetWidth / mStrides[i];
}
for (unsigned int i = 0; i < maxGrids; i++) {
// Access the elements of the original 2D array from the flattened 1D array
int grid_h = flatGrids[2*i]; // Corresponds to the access of grids[i][0]
int grid_w = flatGrids[2*i + 1]; // Corresponds to the access of grids[i][1]
int stride = mStrides[i];
numElem = grid_h * grid_w * batchSize; // Calculate the total number of elements
if (numElem < mThreadCount) // Adjust the thread count if needed
mThreadCount = numElem;
// The CUDA kernel call remains unchanged
CalDetection<<<(numElem + mThreadCount - 1) / mThreadCount, mThreadCount, 0, stream>>>(
inputs[i], output, numElem, mMaxOutObject, grid_h, grid_w, stride, mClassCount, mNumberofpoints,
mConfthreshkeypoints, outputElem, is_segmentation_, is_pose_);
}
delete[] flatGrids;
可以这样改,一维数组简化开销,增大效率
from tensorrtx.
好的,感谢
from tensorrtx.
是的,已经测试,按照上面的方式
from tensorrtx.
https://github.com/wang-xinyu/tensorrtx/pull/1524,已经提交修复
from tensorrtx.
是的,已经测试,按照上面的方式
好的,感谢
from tensorrtx.
Related Issues (20)
- 自己数据集训练的yolov9模型tensorrt的输出结果与pytorch结果差别很大,精度完全没有对齐 HOT 10
- 虽然最终得到了engine模型,但是报了这个错误,我是否应该忽视 HOT 1
- yolov8 TRT问题 HOT 4
- There is an error in the reasoning process of yolov8
- Yolov5 v6.0 inference with FP16 HOT 1
- 关于yolov8静态库的问题:[E] [TRT] 3: getPluginCreator could not find plugin: YoloLayer_TRT version: 1 HOT 2
- Yolov8-pose gpu后处理【催更】 HOT 2
- yolov8cls 输出 HOT 2
- Yolov8 creating wts fails for newly trained models. HOT 3
- yolov8n-seg模型的int8转化报错 HOT 3
- Yolov8 segmentation mask are not good, no mask found in some bounding boxes. HOT 4
- Platform for converting to .wts file HOT 1
- Convert single class .pt custom model to .wts model error HOT 2
- TensorRT10.2.0.19生成.engine报错 HOT 3
- 当我试图将一张图片分割之后填入batch再进行推理时报错
- yolov8GPU
- 分享一个arcface trt python代码,亲测可用 HOT 1
- cuda11.8与tensorrt 8.6.1.6不适配?
- What is calib_table_name and input_blob_name? HOT 1
- Set specific Cuda stream ID in Cpp implimentation code. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tensorrtx.