Ubuntu系统Detectron2框架安装

1、opencv

pip install opencv-python

2、fvcore

fvcore 是 FAIR 开源的 一个轻量级的核心库,它提供了在各种计算机视觉框架(如 Detectron2)中共享的最常见和最基本的功能。该库需要 >=Python 3.6 的 Python 环境。

pip3 install fvcore

遇到问题:
ERROR: Cannot uninstall ‘PyYAML’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
PyYAML库旧版本依赖多,不能清晰的删除,此时应该忽略旧版本升级
解决:

pip install --ignore-installed fvcore    

pip install --ignore-installed ${fvcore}

也可以单独升级该库,再重新安装

pip install --upgrade PyYAML

3、pycocotools

pip3 install -U Cython
pip3 install -U pycocotools

-U是–upgrade,如果已安装就升级到最新版,不带也行。之前我已经装过了

4.其它包依赖

GCC 编译器版本 >= 4.9

5、安装 detectron2

安装git

sudo apt install git

方案一:使用pip安装detectron2

pip3 install 'git+https://github.com/facebookresearch/detectron2.git'

方案二:Git 到本地安装

git clone https://github.com/facebookresearch/detectron2.git
cd detectron2 && pip install -e .

遇到问题:fatal: 无法访问 ‘https://github.com/facebookresearch/detectron2.git/’:GnuTLS recv error (-110): The TLS connection was non-properly terminated.

解决:检查环境变量(可能不行)

env|grep -i proxy  

反正网不好的话,就多试几次吧

6.框架测试

在Detectron2文件夹下,新建images,models,results文件夹,其中images用于存放待测试的图片,models用于存放下载的训练好的模型,results用于存放结果图片。
在images中存放图像1.jpg
训练好的模型下载地址:
https://dl.fbaipublicfiles.com/detectron2/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl
放到models文件夹中
在Detectron2文件夹下进入终端,输入命令

python demo/demo.py --config-file configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml --input images/1.jpg --output results --opts MODEL.WEIGHTS models/model_final_c10459.pkl

模型下载网址见Detectron2文件夹下的MODEL_ZOO.md文档

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值