error: command ‘C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.2\\bin\\nvcc.exe‘ failed

我在windows10下安装detectron2(最新版maskRCNN)时,遇到了错误信息:detectron2 ImportError: cannot import name ‘_C‘ from ‘detectron2
解决办法:
切换到 setup.py 文件所在目录,然后在终端命令行中输入命令:python setup.py build develop

如果出现如下错误:
error: command ‘C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\nvcc.exe’ failed with exit status 1

解决办法:
找到如下文件
detectron2\layers\csrc\nms_rotated\nms_rotated_cuda.cudetectron2\layers\csrc\nms_rotated\nms_rotated_cuda.cu
修改一下部分内容(将部分代码注释掉):
其中原文件的内容如下所示:

// Copyright (c) Facebook, Inc. and its affiliates.
#include 
#include 
#include 
#include 
#ifdef WITH_CUDA
#include "../box_iou_rotated/box_iou_rotated_utils.h"
#endif
// TODO avoid this when pytorch supports "same directory" hipification
#ifdef WITH_HIP
#include "box_iou_rotated/box_iou_rotated_utils.h"
#endif

需要修改为:

// Copyright (c) Facebook, Inc. and its affiliates.
#include 
#include 
#include 
#include 
/*#ifdef WITH_CUDA
#include "../box_iou_rotated/box_iou_rotated_utils.h"
#endif
// TODO avoid this when pytorch supports "same directory" hipification
#ifdef WITH_HIP
#include "box_iou_rotated/box_iou_rotated_utils.h"
#endif*/
#include "box_iou_rotated/box_iou_rotated_utils.h"

然后再次在终端命令行中输入命令:python setup.py build develop
就可以了。

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