mmdetection-安装篇

Linux环境下安装mmdetection

环境准备:

  • Linux系统
  • Python 3.5+
  • PyTorch 1.1 或更高
  • CUDA9.0 或更高
  • NCCL2
  • GCC 4.9 或更高
  • mmcv

安装 mmdetection

a. 创建 conda 虚拟环境并激活。

conda create -n open-mmlab python=3.7 -y
conda activate open-mmlab

b. 安装 PyTorch and torchvision, 可参考官方教程

conda install pytorch torchvision -c pytorch

c. 克隆 mmdetection 代码.

git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection

d. 安装依赖环境

pip install -r requirements/build.txt
pip install "git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI"

e. 安装mmdetection

pip install -v -e .  # or "python setup.py develop"

使用这个命令,mmdetetion以dev模式安装,本地修改不用重新install,如果代码提交了commit或者pull更新了代码,则需要再次执行上面语句。
另外在requirements/下还有其他依赖环境可以安装。

构建mmdetection的Docker镜像

环境准备

  • docker
  • nvidia-docker(如果是19.03及以后,不需要安装nvidia-docker)
  • nvidia-driver(建议是最新版)

基于Dockerfile构建镜像

根据官方提供的Dockerfile 构建。

# build an image with PyTorch 1.3, CUDA 10.1 and CUDNN 7
docker build -t mmdetection docker/

Dockerfile内容如下:

ARG PYTORCH="1.3"
ARG CUDA="10.1"
ARG CUDNN="7"

FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel

ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0+PTX"
ENV TORCH_NVCC_FLAGS="-Xfatbin -compress-all"
ENV CMAKE_PREFIX_PATH="$(dirname $(which conda))/../"

RUN apt-get update && apt-get install -y libglib2.0-0 libsm6 libxrender-dev libxext6 \
 && apt-get clean \
 && rm -rf /var/lib/apt/lists/*

# Install mmdetection
RUN conda clean --all
RUN git clone https://github.com/open-mmlab/mmdetection.git /mmdetection
WORKDIR /mmdetection
ENV FORCE_CUDA="1"
RUN pip install --no-cache-dir -e .

Windows环境下安装mmdetection

参考:mmdetection在windows10系统环境中搭建

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Challovactor

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值