安装gtr-master需要编译依赖的子项目 detectron2,但官方不支持windows. 我编译了一下,有很多错误. 看第一个error, 想方法解决第一个错误.
nms_rotated_cuda.cu里有报错,我改后的开头代码如下:
#include <ATen/ATen.h>
#include <ATen/cuda/CUDAContext.h>
#include <c10/cuda/CUDAGuard.h>
#include <ATen/cuda/CUDAApplyUtils.cuh>
#ifdef WITH_CUDA
#endif
// TODO avoid this when pytorch supports "same directory" hipification
//#include "detectron2/detectron2/layers/csrc/box_iou_rotated.h"
#include "F:/00reidother/GTR-master/detectron2/detectron2/layers/csrc/box_iou_rotated/box_iou_rotated.h"
#include "F:/00reidother/GTR-master/detectron2/detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_utils.h"
//#include "box_iou_rotated/box_iou_rotated.h"
//F:\00reidother\GTR-master\detectron2\detectron2\layers\csrc\box_iou_rotated
using namespace detectron3;
using namespace detectron2;
namespace {
int const threadsPerBlock = sizeof(unsigned long long) * 8;
}
另外box_iou_rotated_utils.h里 我改名了命名空间,开头部分代码是:
#include <algorithm>
#define HOST_DEVICE
#define HOST_DEVICE_INLINE HOST_DEVICE inline
#endif
namespace detectron3 {
template <typename T>
struct RotatedBox {
T x_ctr, y_ctr, w, h, a;
};
另外:single_box_iou_rotated 把末尾的这个方法移动到detectron3 这个命名空间里. 编译就成功了.
我使用的vs2019