QueryDet项目实战应用

刚刚接触detectron2框架,总的来讲该框架由Facebook开源,质量还是非常不错的,值得学习。今天就对安装和测试遇到的一些问题进行整理和总结。后期会持续更新。

Detectron2安装
Detectron2项目链接:https://github.com/facebookresearch/detectron2
官方安装教程:https://github.com/facebookresearch/detectron2/blob/main/INSTALL.md

Requirements
Python ≥ 3.7 (本实验在Ubuntu16.04下进行,使用Python3.7)
Pytorch ≥ 1.8 对应版本的 torchvision(本实验安装Pytorch 1.6,torchvision 0.7)
CUDA 11.3 (请选择与Pytorch匹配的cudatoolkit版本,以便成功安装框架)
GCC >= 4.9(这个是C/C++编译环境的要求,如果不对,在编译过程基本就会失败)

环境安装
anaconda创建环境
conda create -n detectron2 python=3.7
conda activate detectron2
安装pytorch cuda11.3
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch

#测试一下
import torch, torchvision
print(torch.version, torch.cuda.is_available())
安装其他依赖项
pip install cython pyyaml5.1
pip install opencv-python
3.4.2
pip install cython

fvcore 本实验安装的是下面版本,也可以参考官方安装教程安装其他版本:https://github.com/facebookresearch/fvcore/

pip install fvcore==0.1.1.post20200716

安装pycocotools,如果下面代码运行报错,可以参考链接进行安装:https://blog.csdn.net/xiongzai2016/article/details/106855544

pip install -U ‘git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI’
安装detectron2

从本地克隆安装

git clone https://github.com/facebookresearch/detectron2.git
python -m pip install -e detectron2
这样下载的detectron2是最新版本,由于官方安装文档中要求PyTorch ≥ 1.8 ,所以安装的时候会报错。可以访问detectron2的历史版本链接:https://github.com/facebookresearch/detectron2/releases
根据安装的PyTorch和cuda版本来安装对应版本的detectron2,下面是PyTorch1.6对应的安装命令行:

python -m pip install detectron2==0.4 -f
https://dl.fbaipublicfiles.com/detectron2/wheels/cu101/torch1.6/index.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值