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

おすすめ

転載: blog.csdn.net/Stone_Wang_MZ/article/details/116492441