深度学习环境搭建笔记(一):detectron2安装过程

第一步 安装python

cuda 10.2 环境下 
  • conda create -n detectron python=3.7

第二步 安装pycocotools

  • 下载对应的pycocotools-windows · PyPI根据python版本,然后pip安装
  • pip install pycocotools_windows-2.0.0.2-cp37-cp37m-win_amd64.whl

第三步 安装Torch和Torchvision

  • pip install “torch-1.10.1+cu102-cp37-cp37m-win_amd64.whl”
  • pip install “torchvision-0.11.2+cu102-cp37-cp37m-win_amd64.whl”

第四步 安装fvcore

下载链接:https://github.com/facebookresearch/fvcore 点击跳转.
然后cd到setup.py所在目录,用以下指令安装
python setup.py build --force develop
打开cmd输入 import fvcore 没报错即成功

第五步 安装detectron2

在安装detectron2前需要先修改detectron2与pytorch的代码以保证顺利安装。
下载地址:https://github.com/conansherry/detectron2 点击跳转.
1)根据官方文档对pytorch进行如下修改(觉得难找可以下载Everything)

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); }

第一个文件的位置有变动为:{your evn path}\Lib\site-packages\torch\include\torch\csrc\jit\runtime\argumenta_spec.h

<font color='red'>2)</font>将detectron2\detectron2\layers\csrc\deformable 文件夹下三个文件中全部的 AT_CHECK 全部替换为 TORCH_CHECK

第六步 开始安装

  • 进入解压后setup.py的路径
    cd detectron2
  • 安装
    python setup.py build --force develop

在这里插入图片描述

  • 验证
    在这里插入图片描述
  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ZZY_dl

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值