Detectron2 安装填坑通过-2020.05.14

参考了很多同学的blog,完成了Detectron2 安装填坑。

我的GPU是Nvidia RTX2080I,UBUNTU16.04,安装了对应的驱动,cuda10.1和cuDNN。

安装detectron2

python3.6,cuda10.1,

1 ) 方法1, 安装detectron2, 参考下面几个文档,

但出现RuntimeError:
Not compiled with GPU support,一直没解决(更改了detectron的clone方式和安装方式不再出现),

便新建conda环境,使用第二种方法ok

https://blog.csdn.net/sophia_xw/article/details/102561410

conda create -n d2p36 python=3.6

source activate d2p36
// use every reboot

pip install -U torch torchvision

conda install -c menpo opencv3

pip install -U
‘git+https://github.com/facebookresearch/fvcore’

pip install cython

pip install
‘git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI’

//git clone https://github.com/facebookresearch/detectron2
detectron2_repo 这个没有试过

//pip install -e detectron2_repo

https://blog.csdn.net/jgj123321/article/details/105475027

git clone https://github.com/facebookresearch/detectron2.git

cd detectron2

python -m pip install -e .

https://blog.csdn.net/m0_37709262/article/details/102732057 也不行

//pip install
‘git+https://github.com/facebookresearch/detectron2.git’ //linux找不到被clone到哪里了

//(add --user if you
don’t have permission)

// Or, to install it from a local clone:

git clone https://github.com/facebookresearch/detectron2.git

cd detectron2 && pip install -e .

https://github.com/facebookresearch/detectron2/blob/master/INSTALL.md

//python -m pip install detectron2 -f
https://dl.fbaipublicfiles.com/detectron2/wheels/cu101/index.html //linux找不到被clone到哪里了

运行后面的demo,结果如下
在这里插入图片描述
在这里插入图片描述

2) 方法2 安装参考这个,能正常运行demo,

conda create -n dt2p36 python=3.6

source activate dt2p36
// use every reboot

https://www.aiuai.cn/aifarm1288.html

依次参考安装依赖库

方式二:

git clone https://github.com/facebookresearch/detectron2.git

cd detectron2

python -m pip install -e .

出现一些错误或有些库使用的是python3.5的,用下面的命令更新解决

pip install -U torch torchvision

pip install -U torch pycocotools

pip install cython

运行demo结果如下
在这里插入图片描述
在这里插入图片描述

3) demo脚本 每次要重启激活环境source activate dt2p36 // use every reboot

原文链接:https://blog.csdn.net/sophia_xw/article/details/102561410

//python demo/demo.py --config-file
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml --input 001.jpg
–output results --opts MODEL.WEIGHTS models/model_final_f10217.pkl

注意点:

测试图片自己找,我的是000043.jpg,放在当前工程自己新建的文件夹images中;

当前工程下,新建results文件夹存储结果图片,我在服务器环境中,没有显示器,因此给个输出文件夹;

当前工程下,新建models文件夹用来放测试模型,当然,模型自己在model zoo链接中去下载;

其他参数:

在摄像头测试

用–webcam替代–input

视频文件测试

用–video-input替代–input

存储结果

给–output参数就行

https://blog.csdn.net/enwuone/article/details/104983976

python demo/demo.py --config-file
configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml --input 001.jpg
–output results --opts MODEL.WEIGHTS
detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl

参数解释

demo/demo.py :demo文件

–config-file :选择配置文件

–output :输出位置(如果想直接查看,删除这个参数即可)

MODEL.WEIGHTS:预先训练好的模型

pip install opencv-python --user // no module named cv2

4) others

RuntimeError: Not compiled with GPU support

//不生效,可以参考
begin

https://www.cnblogs.com/marsggbo/p/11916859.html

官方提供的检验代码查看
CUDA 路径:

python -c ‘import torch; from torch.utils.cpp_extension
import CUDA_HOME; print(torch.cuda.is_available(), CUDA_HOME)’

vim ~/.bashrc

export CUDA_HOME=/usr/local/cuda

source ~/.bashrc

Docker Runtime Error: Not Compiled with GPU support

https://github.com/facebookresearch/maskrcnn-benchmark/issues/167

https://blog.csdn.net/u011420347/article/details/85111815

https://ask.csdn.net/questions/769137

print(t.version.cuda)

print(t.cuda.device_count())

import torch as t

tensor=t.Tensor(3,4)

tensor.cuda(0)

google搜索,参考

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

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

//end

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值