windows 10编译安装detectron2(0.2.1)

基础环境

anaconda3 pytorch1.6 python 3.6 cuda10.2 vs2019

1、下载detectron2(0.2.1)

https://github.com/facebookresearch/detectron2/tree/v0.2.1

2、创建anaconda虚拟环境

conda create -n detectron2 python==3.6

conda activate detectron2

conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch

测试pytorch正确安装

import torch

torch.__version__
'1.6.0'
torch.cuda.is_available()
True

在这里插入图片描述

3、call VS2019的编译环境

call "D:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"

在这里插入图片描述

cd 到detectron2目录中

set DISTUTILS_USE_SDK=1

python setup.py build develop

4、安装其他包

pip install opencv-python tqdm matplotlib fvcore cython cloudpickle mock tensorboard

装完之后测试

在这里插入图片描述

测试demo, 到detectron2 MODEL ZOO下载Faster R-CNN X101-FPN模型权重, 假设放在目录xxx下

python demo/demo.py ^
–config-file configs/COCO-Detection/faster_rcnn_X_101_32x8d_FPN_3x.yaml ^
–input demo/coco_val2017_000000002153.jpg ^
–opts MODEL.WEIGHTS xxx/faster_rcnn_X_101_32x8d_FPN_3x.pkl

参考链接https://blog.csdn.net/ying86615791/article/details/109157249

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐