detectron2编译错误: error: identifier “single_box_iou_rotated“ is undefined

Python:3.10
CUDA:11.3
detectron2:0.6
torch:1.11.0+cu113

git clone detectron2的源码之后执行python setup.py build_ext进行编译,出现以下错误:

D:/Applications/WPy64-31040/python-3.10.4.amd64/lib/site-packages/torch/include\c10/macros/Macros.h(142): warning C4067: 预处理器指令后有意外标记 - 应输入换行符
D:\DeepLearning\detectron2\detectron2\layers\csrc\nms_rotated\nms_rotated_cuda.cu(14): error: name must be a namespace name

D:\DeepLearning\detectron2\detectron2\layers\csrc\nms_rotated\nms_rotated_cuda.cu(68): 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

D:\DeepLearning\detectron2\detectron2\layers\csrc\nms_rotated\nms_rotated_cuda.cu(68): 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

D:\DeepLearning\detectron2\detectron2\layers\csrc\nms_rotated\nms_rotated_cuda.cu(68): 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

D:\DeepLearning\detectron2\detectron2\layers\csrc\nms_rotated\nms_rotated_cuda.cu(58): 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

D:\DeepLearning\detectron2\detectron2\layers\csrc\nms_rotated\nms_rotated_cuda.cu(68): 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

D:\DeepLearning\detectron2\detectron2\layers\csrc\nms_rotated\nms_rotated_cuda.cu(68): 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

D:\DeepLearning\detectron2\detectron2\layers\csrc\nms_rotated\nms_rotated_cuda.cu(68): 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

D:\DeepLearning\detectron2\detectron2\layers\csrc\nms_rotated\nms_rotated_cuda.cu(58): 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 "D:/DeepLearning/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu".
error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.3\\bin\\nvcc.exe' failed with exit code 1

解决办法

根据https://github.com/facebookresearch/detectron2/issues/1601 的方法,修改源码"detectron2\layers\csrc\nms_rotated\nms_rotated_cuda.cu":
detectron2编译错误: error: identifier “single_box_iou_rotated“ is undefined_第1张图片

你可能感兴趣的:(深度学习,Python,目标检测,深度学习,人工智能)