如何在ubuntu下安装detectron2_Docker 安装 detectron2

本文详细介绍了在Ubuntu 16.04.4系统中使用Docker安装Detectron2的步骤,包括拉取CUDA镜像、创建Dockerfile、构建镜像和测试环境。在Docker容器中安装了必要的依赖,并成功运行了Detectron2的测试,验证了环境的正确搭建。同时,还提到了常见的错误及解决方法。
摘要由CSDN通过智能技术生成

系统环境:Ubuntu 16.04.4

安装流程

从 Docker 容器官网 pull 容器镜像文件:nvidia/cuda:10.1-cudnn7-devel $ docker pull nvidia/cuda:10.1-cudnn7-devel

10.1-cudnn7-devel: Pulling from nvidia/cuda

7ddbc47eeb70: Already exists

c1bbdc448b72: Already exists

8c3b70e39044: Already exists

45d437916d57: Already exists

d8f1569ddae6: Pull complete

85386706b020: Pull complete

ee9b457b77d0: Pull complete

be4f3343ecd3: Pull complete

30b4effda4fd: Pull complete

b398e882f414: Pull complete

Digest: sha256:557de4ba2cb674029ffb602bed8f748d44d59bb7db9daa746ea72a102406d3ec

Status: Downloaded newer image for nvidia/cuda:10.1-cudnn7-devel

docker.io/nvidia/cuda:10.1-cudnn7-devel

# 新建 Dockerfile 配置文件

$ vi Dockerfile

新建 Dockerfile 配置文件, 内容如下: FROM nvidia/cuda:10.1-cudnn7-devel

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get install -y \

python3-opencv ca-certificates python3-dev git wget sudo && \

rm -rf /var/lib/apt/lists/*

# create a non-root user

ARG USER_ID=1000

RUN useradd -m --no-log-init --system --uid ${USER_ID} leaf -g sudo

RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

USER leaf

WORKDIR /home/leaf

ENV PATH="/home/leaf/.local/bin:${PATH}"

RUN wget https://bootstrap.pypa.io/get-pip.py && \

python3 get-pip.py --user && \

rm get-pip.py

# install dependencies

# See https://pytorch.org/ for other options if you use a different version of CUDA

RUN pip install --user torch torchvision tensorboard cython -i https://pypi.tuna.tsinghua.edu.cn/simple

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

RUN pip install --user 'git+https://github.com/facebookresearch/fvcore'

# install detectron2

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

ENV FORCE_CUDA="1"

# This will build detectron2 for all common cuda architectures and take a lot more time,

# because inside `docker build`

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值