安装指定版本的detectron2-Linux版

我们想要复现的代码往往不是在最新的detectron2上复现,需要我们使用先前版本的detectron2才能复现网络,因此需要重新下载detectron2并配置环境。

1、来到detectron2官网

地址:https://github.com/facebookresearch/detectron2
寻找需要的版本,并下载,这里我们以v0.3为例:
在这里插入图片描述

2、创建虚拟环境detectron2-v0.3

conda create -n detectron2-v0.3 python=3.7

在这里插入图片描述创建成功:
在这里插入图片描述

3、激活虚拟环境

在这里插入图片描述

4、安装合适的torch和torchvision版本

可在INSTALL.MD中查阅到:
在这里插入图片描述
此处我们安装torch1.7及其对应的torchvision版本(可在pytorch官网查阅:https://pytorch.org/get-started/previous-versions/)

pip install torch==1.7.0 torchvision==0.8.0

在这里插入图片描述
pytorch安装完成。

5、安装COCOapi

方法一:pip安装(可能会失败)

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

在这里插入图片描述
在这里插入图片描述
方法二:离线安装
地址:https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI’

6、安装一些依赖包

pip install fvcore==0.1.5.post20210415

pip install omegaconf==2.1.0.

pip install importlib

7、安装并编译detectron2

python setup.py build develop

安装编译完成:
在这里插入图片描述

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>