Windows配置Facebook的detectron2

Detectron 是目标检测平台,包含了大量业内最具代表性的目标检测、图像分割、关键点检测算法,该框架主要基于 python 和 caffe2 实现。 官方只给出了基于linux和mac os平台的配置操作。在mac上按照官方教程配置环境很顺畅,接下来和师兄在Windows10上部署了两天的环境,采坑无数,最终安装成功,记录一下安装过程,有用的话路过的伙伴点个赞吧。
在这里插入图片描述
本方法创建了一个虚拟环境,在该虚拟环境下的配置如下:

  1. cuda 10.1(cudnn 7.6.2)
  2. pytorch 1.5.0
  3. python 3.7.0
  4. Visual studio 17

1.首先安装Anaconda

这里贴一个安装教程https://blog.csdn.net/ITLearnHall/article/details/81708148
另外,其他版本的Anaconda可以在这里获得 https://repo.anaconda.com/archive/
因为本人安装过程比较曲折,所以这里贴一个解决贴,以备其他同学遇到相同的情况
“安装Anaconda之后在电脑终端输入conda list 显示conda不是内部或外部命令之解决办法”

2.使用conda创建虚拟环境

conda create -n envDetectron2 python=3.7.0
因为本人安装过程比较曲折,所以这里贴一个解决贴,以备其他同学遇到相同的情况
简单解决[CondaHTTPError: HTTP 000 CONNECTION FAILED for url]

3.进入创建的虚拟环境

activate envDetectron2

(接下来步骤都在虚拟环境中进行安装操作)

4.安装cudatoolkit

(这里有个潜规则,先装cuda再装torch)
conda install cudatoolkit = 10.1

5.安装pytorch和torchvision

每次安装动态加清华源 :
pip3 install 安装包的名字 -i https://pypi.tuna.tsinghua.edu.cn/simple
设置为默认(一劳永逸):
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

pip install torch1.5.0+cu101 torchvision0.6.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html
使用国内镜像安装
pip install torch1.5.0+cu101 torchvision0.6.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html -i https://pypi.tuna.tsinghua.edu.cn/simple

6.安装fvcore

这里官网给出了几种安装方式,选择一种方式即可
参考如下:https://github.com/facebookresearch/fvcore

7.安装cython

pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple

8.安装pycocotools

pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI

9.VS版本问题

起初安装是VS 2019 但是提示如下错误
“error: – unsupported Microsoft Visual Studio version!Only the version between 2013 and 2017(inclusive) are supported! ”
所以就将VS2019卸载,安装了VS 2017

10.接下来

git clone git@github.com:facebookresearch/detectron2.git
然后进行编译
cd detectron2
python setup.py build develop
编译时的小插曲:
编译的时候,我们遇到了“command ‘…/…/bin/nvcc.exe’ failed with exit status 1”,修改策略
“…/…/detectron2/detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu” 文件中#include “…” 路径错误 ,然后编译成功。

11.运行demo.py 成功

我想吃KFC,嘻嘻嘻。
在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值