win10 編譯安裝detectron2

影像處理大大大大大牛啊發表於2020-11-27

本次安裝環境
cuda 10.1 下載地址
pytorch 1.5.1 命令: pip install torch1.5.1+cu101 torchvision0.6.1+cu101 -f https://download.pytorch.org/whl/torch_stable.html 更多安裝方式
vs 2017 下載地址
fvcore 0.1.2

下載原始碼

修改 detectron2\layers\csrc\nms_rotated\nms_rotated_cuda.cu
1.註釋塊/* #ifdef WITH_CUDA…#endif*/
2.在後面新增一句 #include “box_iou_rotated/box_iou_rotated_utils.h”

// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#include <ATen/ATen.h>
#include <ATen/cuda/CUDAContext.h>
#include <c10/cuda/CUDAGuard.h>
#include <ATen/cuda/CUDAApplyUtils.cuh>
//NOTE: replace relative import
/*#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"

編譯

進入下載程式碼的目錄執行

""" 
@author: qq群686070107
""" 
python -m pip install -e detectron2(或者detectron2-master)

相關文章