win10 手把手教你安装 detectron2

全新的detectron2

  1. 基于pytorch重写
  2. 加入了新的功能如:panoptic segmentation, densepose, Cascade R-CNN, rotated bounding boxes
  3. 为轮子而生、为开源而生
  4. 训练更快

作为一只新入门的菜鸟一直奉行:复现,复现,复现,自我发挥=自找麻烦

  • 开始
  • 安装VS2019(可以不卸载VS2017\VS2015)
  • 安装CUDA10.1及与之配套的cudnn(可以不卸载CUDA10.0),安装完成后可以使用一下命令检验:
nvidia-smi
  • 安装Anaconda
  • 创建一个虚拟环境  
conda create -n detectron2py36 python=3.6.5
  • 进入虚拟环境
activate detectron2py36
  • 安装pytorch,可前往pytorch官网,或者直接使用以下命令,建议使用国内镜像
pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html

 并作如下修改:

file1:

  {your evn path}\Lib\site-packages\torch\include\torch\csrc\jit\argument_spec.h

  example:

  {C:\Miniconda3\envs\py36}\Lib\site-packages\torch\include\torch\csrc\jit\argument_spec.h(190)

    static constexpr size_t DEPTH_LIMIT = 128;

      change to -->

    static const size_t DEPTH_LIMIT = 128;

file2:

  {your evn path}\Lib\site-packages\torch\include\pybind11\cast.h

  example:

  {C:\Miniconda3\envs\py36}\Lib\site-packages\torch\include\pybind11\cast.h(1449)

    explicit operator type&() { return *(this->value); }

      change to -->

    explicit operator type&() { return *((type*)this->value); }

 

  • 安装fvcore:
pip install 'git+https://github.com/facebookresearch/fvcore'
git clone git@github.com:facebookresearch/detectron2.git

做如下修改:

for the "detectron2/layers/csrc/ROIAlign/ROIAlign_cuda.cu" and "detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.cu",
change from each

dim3 grid(std::min(at::cuda::ATenCeilDiv(output_size, 512L), 4096L));
~
~
dim3 grid(std::min(at::cuda::ATenCeilDiv(grad.numel(), 512L), 4096L));
to

dim3 grid(std::min(at::cuda::ATenCeilDiv(static_cast<int64_t>(output_size), static_cast<int64_t>(512)), static_cast<int64_t>(4096)));
 ~
~
dim3 grid(std::min(at::cuda::ATenCeilDiv(static_cast<int64_t>(grad.numel()), static_cast<int64_t>(512)), static_cast<int64_t>(4096)));

 

编译:

cd detectron2
python setup.py build develop
  • 完成,侵删

Inference :

https://github.com/facebookresearch/detectron2

https://github.com/facebookresearch/detectron2/issues/9

https://github.com/philferriere/cocoapi

https://github.com/facebookresearch/detectron2/issues/9#issuecomment-546226799

  • 0
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 9
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值