Add at new repo again
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
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 \
|
||||
cmake ninja-build protobuf-compiler libprotobuf-dev && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
RUN ln -sv /usr/bin/python3 /usr/bin/python
|
||||
|
||||
# create a non-root user
|
||||
ARG USER_ID=1000
|
||||
RUN useradd -m --no-log-init --system --uid ${USER_ID} appuser -g sudo
|
||||
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||
USER appuser
|
||||
WORKDIR /home/appuser
|
||||
|
||||
ENV PATH="/home/appuser/.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 tensorboard cython
|
||||
RUN pip install --user torch==1.5+cu101 torchvision==0.6+cu101 -f https://download.pytorch.org/whl/torch_stable.html
|
||||
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
|
||||
# set FORCE_CUDA because during `docker build` cuda is not accessible
|
||||
ENV FORCE_CUDA="1"
|
||||
# This will by default build detectron2 for all common cuda architectures and take a lot more time,
|
||||
# because inside `docker build`, there is no way to tell which architecture will be used.
|
||||
ARG TORCH_CUDA_ARCH_LIST="Kepler;Kepler+Tesla;Maxwell;Maxwell+Tegra;Pascal;Volta;Turing"
|
||||
ENV TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST}"
|
||||
|
||||
RUN pip install --user -e detectron2_repo
|
||||
|
||||
# Set a fixed model cache directory.
|
||||
ENV FVCORE_CACHE="/tmp"
|
||||
WORKDIR /home/appuser/detectron2_repo
|
||||
|
||||
# run detectron2 under user "appuser":
|
||||
# wget http://images.cocodataset.org/val2017/000000439715.jpg -O input.jpg
|
||||
# python3 demo/demo.py \
|
||||
#--config-file configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml \
|
||||
#--input input.jpg --output outputs/ \
|
||||
#--opts MODEL.WEIGHTS detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl
|
@@ -0,0 +1,17 @@
|
||||
FROM nvidia/cuda:10.1-cudnn7-devel
|
||||
# This dockerfile only aims to provide an environment for unittest on CircleCI
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
RUN apt-get update && apt-get install -y \
|
||||
python3-opencv ca-certificates python3-dev git wget sudo ninja-build && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN wget -q https://bootstrap.pypa.io/get-pip.py && \
|
||||
python3 get-pip.py && \
|
||||
rm get-pip.py
|
||||
|
||||
# install dependencies
|
||||
# See https://pytorch.org/ for other options if you use a different version of CUDA
|
||||
RUN pip install tensorboard cython
|
||||
RUN pip install torch==1.5+cu101 torchvision==0.6+cu101 -f https://download.pytorch.org/whl/torch_stable.html
|
||||
RUN pip install 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'
|
@@ -0,0 +1,36 @@
|
||||
|
||||
## Use the container (with docker ≥ 19.03)
|
||||
|
||||
```
|
||||
cd docker/
|
||||
# Build:
|
||||
docker build --build-arg USER_ID=$UID -t detectron2:v0 .
|
||||
# Run:
|
||||
docker run --gpus all -it \
|
||||
--shm-size=8gb --env="DISPLAY" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
|
||||
--name=detectron2 detectron2:v0
|
||||
|
||||
# Grant docker access to host X server to show images
|
||||
xhost +local:`docker inspect --format='{{ .Config.Hostname }}' detectron2`
|
||||
```
|
||||
|
||||
## Use the container (with docker < 19.03)
|
||||
|
||||
Install docker-compose and nvidia-docker2, then run:
|
||||
```
|
||||
cd docker && USER_ID=$UID docker-compose run detectron2
|
||||
```
|
||||
|
||||
#### Using a persistent cache directory
|
||||
|
||||
You can prevent models from being re-downloaded on every run,
|
||||
by storing them in a cache directory.
|
||||
|
||||
To do this, add `--volume=$HOME/.torch/fvcore_cache:/tmp:rw` in the run command.
|
||||
|
||||
## Install new dependencies
|
||||
Add the following to `Dockerfile` to make persistent changes.
|
||||
```
|
||||
RUN sudo apt-get update && sudo apt-get install -y vim
|
||||
```
|
||||
Or run them in the container to make temporary changes.
|
@@ -0,0 +1,18 @@
|
||||
version: "2.3"
|
||||
services:
|
||||
detectron2:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
USER_ID: ${USER_ID:-1000}
|
||||
runtime: nvidia # TODO: Exchange with "gpu: all" in the future (see https://github.com/facebookresearch/detectron2/pull/197/commits/00545e1f376918db4a8ce264d427a07c1e896c5a).
|
||||
shm_size: "8gb"
|
||||
ulimits:
|
||||
memlock: -1
|
||||
stack: 67108864
|
||||
volumes:
|
||||
- /tmp/.X11-unix:/tmp/.X11-unix:ro
|
||||
environment:
|
||||
- DISPLAY=$DISPLAY
|
||||
- NVIDIA_VISIBLE_DEVICES=all
|
Reference in New Issue
Block a user