win10安装detectron2,亲测有效

时间:2021.5.7

环境:win10、detectron2(0.4)、python3.6.13、pytorch1.7.1、torchvision0.8.2、cuda10.1、cudnn7.6、vs2019

1、安装cuda及cudnn;结果以nvcc -V结果为准,与nvidia-smi的区别

2、安装vs2019;

 

3、安装Anaconda,打开Anaconda Prompt

conda create -n detectron2 python==3.6.13

conda activate detectron2

4、安装pytorch,找到pytorch1.7.1,先确保安装正确;

conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=10.1 -c pytorch

5、安装cocoapi;

下载:https://github.com/philferriere/cocoapi

cd到cocoapi/PythonAPI,输入python setup.py build_ext install

安装Cython后重新输入python setup.py build_ext install

6、下载fvcore;

下载:https://github.com/facebookresearch/fvcore

cd到vcore,输入python setup.py build --force develop

7、下载detectron2(0.4);

下载:https://github.com/facebookresearch/detectron2/tree/v0.4

cd 到detectron2,执行python setup.py build --force develop,一堆错误;

8、修改代码,包括如下这四个文件,如果下载有多个版本时不要选错了;

1:cpp_extension.py中大约280行,

match = re.search(r'(\d+)\.(\d+)\.(\d+)', compiler_info.decode().strip())修改为

match = re.search(r'(\d+)\.(\d+)\.(\d+)', compiler_info.decode(' gbk').strip())

2:找到ROIAlignRotated_cuda.cu、deform_conv_cuda_kernel.cu,把里面的ceil改为ceilf、floor改为floorf

3:ir.h的1347行,static constexpr Symbol Kind = ::c10::prim::profile_optional,注释掉

重新执行python setup.py build --force develop

9、成功;

参考链接:

https://zhuanlan.zhihu.com/p/363295722

https://blog.csdn.net/iamleifeng/article/details/103877581

https://blog.csdn.net/tanmx219/article/details/100829920

  • 0
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值