*-v-*detectron2和mmdetection安装

安装detectron2

安装依赖库
  • 使用 Python ≥ 3.6 的 Linux 或 macOS

  • PyTorch≥1.6和torchvision的PyTorch安装相匹配。将它们一起安装在pytorch.org以确保这一点

  • OpenCV 是可选的,但演示和可视化需要

pip install cython pycocotools 
从源代码构建 Detectron2

需要 gcc & g++ ≥ 5.4。ninja是可选的,但推荐用于更快的构建。拥有它们后,运行:

python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
# (add --user if you don't have permission)

# Or, to install it from a local clone:
git clone https://github.com/facebookresearch/detectron2.git
python -m pip install -e detectron2

重建从本地克隆构建的detectron2,请先使用清理旧构建。重新安装 PyTorch 后,您经常需要重建detectron2。rm -rf build/ **/*.so

安装预构建的 Detectron2(仅限 Linux)

从此表中选择安装v0.4(2021 年 3 月)

CUDApytorch 1.8pytorch 1.7pytorch 1.6
11.1 安装    
11.0   安装  
10.2 安装 安装
python -m pip install detectron2 -f 
  https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.7/index.html
安装
10.1 安装 安装 安装
9.2   安装 安装
CPU 安装 安装 安装

注意:

  1. 预建包必须与相应版本的 CUDA 和 PyTorch 的官方包配合使用。否则,请从源代码构建detectron2。

  2. 新软件包每隔几个月发布一次。因此,程序包在master分支中可能不包含最新功能,并且可能与使用detectron2的研究项目的master分支(例如,项目中的那些不兼容


 

安装mmdetection

安装依赖库

pip install numpy cython

安装mmcv-full

pip直接安装
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html
源码编译安装
git clone https://github.com/open-mmlab/mmcv.git
cd mmcv
MMCV_WITH_OPS=1 pip install -e .  # package mmcv-full will be installed after this step
cd ..

安装mmdetection

git clone https://github.com/open-mmlab/mmdetection.git
# or download this repo to local

cd mmdetection
python setup.py develop

everything is OK!!

原文地址:https://www.cnblogs.com/nanmi/p/14830507.html