g
y
7
7
7
7

Detectron2环境配置+Ubantu+CUDA10.1+pytorch1.7.0

Detectron2环境配置

1.创建detectron2 conda环境

conda create -n detectron2 python=3.7

2.激活detectron2 conda环境

conda activate detectron2

3.安装 pytorch1.7.0 cuda10.1(根据自己情况选择版本安装)pytorch旧版本安装

conda install pytorch==1.7.0 torchvision ==0.8.0 torchaudio==0.7.0 cudatoolkit=10.1 -c pytorch

4.安装detectron2 所需要的包

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

在这个网址里,https://github.com/facebookresearch/detectron2/blob/master/INSTALL.md
选择对应的pytorch和cuda版本,安装detectron2所需要的包。

5.安装detectron2

python -m pip install -e .

从GitHub把项目下载下来,或者是git clone下来,然后到主目录下,运行上边的命令

6.运行demo,我是去网址下载的C4_3x的model,下载后放到detectron2-master/demo/路径下,然后在此目录下,执行下面命令。model下载网址:https://github.com/facebookresearch/detectron2/blob/master/MODEL_ZOO.md

python demo.py --config-file ../configs/COCO-InstanceSegmentation/mask_rcnn_R_50_C4_3x.yaml --input input1.jpg --opts MODEL.WEIGHTS model_final_4ce675.pkl

删除detectron2 conda环境

conda remove detectron2

如果报错缺少cv2包了,就安装cv2 包

pip install opencv-python

posted @ 2021-03-22 17:41  gy77  阅读(396)  评论(0编辑  收藏  举报