我在Windows10+Pytorch1.10.0+CUDA11.1环境下配置detectron2遇到如下问题:

E:/python/PycharmProject/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(15): error: name must be a namespace name

E:/python/PycharmProject/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(69): error: identifier "single_box_iou_rotated" is undefined
          detected during instantiation of "void nms_rotated_cuda_kernel(int, double, const T *, unsigned long long *) [with T=double]"
(105): here

E:/python/PycharmProject/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(69): error: type name is not allowed
          detected during instantiation of "void nms_rotated_cuda_kernel(int, double, const T *, unsigned long long *) [with T=double]"
(105): here

E:/python/PycharmProject/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(69): warning: expression has no effect
          detected during instantiation of "void nms_rotated_cuda_kernel(int, double, const T *, unsigned long long *) [with T=double]"
(105): here

E:/python/PycharmProject/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(59): warning: variable "cur_box" was set but never used
          detected during instantiation of "void nms_rotated_cuda_kernel(int, double, const T *, unsigned long long *) [with T=double]"
(105): here

E:/python/PycharmProject/detectron2-blendmask/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(69): error: identifier "single_box_iou_rotated" is undefined
          detected during instantiation of "void nms_rotated_cuda_kernel(int, double, const T *, unsigned long long *) [with T=float]"
(105): here

E:/python/PycharmProject/detectron2-blendmask/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(69): error: type name is not allowed
          detected during instantiation of "void nms_rotated_cuda_kernel(int, double, const T *, unsigned long long *) [with T=float]"
(105): here

E:/python/PycharmProject/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(69): warning: expression has no effect
          detected during instantiation of "void nms_rotated_cuda_kernel(int, double, const T *, unsigned long long *) [with T=float]"
(105): here

E:/python/PycharmProject/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu(59): warning: variable "cur_box" was set but never used
          detected during instantiation of "void nms_rotated_cuda_kernel(int, double, const T *, unsigned long long *) [with T=float]"
(105): here

5 errors detected in the compilation of "E:/python/PycharmProject/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu".
error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.1\\bin\\nvcc.exe' failed with exit code 1


解决办法:

打开E:/python/PycharmProject/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu文件,修改下列内容:
在这里插入图片描述
修改成:
在这里插入图片描述
重新运行即可。

报错2

 from adet import _C ImportError: DLL load failed while importing _C: 找不到指定的模块。

前边python setup.py build develop的时候有一个warning,没有安装ninja,装上就可以了

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐