Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #34 from timmh/master
Browse files Browse the repository at this point in the history
implement docker support
  • Loading branch information
ranftlr authored Jul 15, 2020
2 parents bf9061d + 0c8dede commit 4da36e8
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# enables cuda support in docker
FROM nvidia/cuda:10.2-cudnn7-runtime-ubuntu18.04

# install python 3.6, pip and requirements for opencv-python
# (see https://github.com/NVIDIA/nvidia-docker/issues/864)
RUN apt-get update && apt-get -y install \
python3 \
python3-pip \
libsm6 \
libxext6 \
libxrender-dev \
&& rm -rf /var/lib/apt/lists/*

# install python dependencies
RUN pip3 install torch~=1.2 torchvision opencv-python~=3.4

# copy inference code
WORKDIR /opt/MiDaS
COPY ./midas ./midas
COPY ./*.py ./

# download model weights so the docker image can be used offline
RUN curl -OL https://github.com/intel-isl/MiDaS/releases/download/v2/model-f46da743.pt
RUN python3 run.py; exit 0

# entrypoint (dont forget to mount input and output directories)
CMD python3 run.py
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,25 @@ file in the root folder.

3) The resulting inverse depth maps are written to the `output` folder.

#### via Docker

1) Make sure you have installed Docker and the
[NVIDIA Docker runtime](https://github.com/NVIDIA/nvidia-docker/wiki/Installation-\(Native-GPU-Support\)).

2) Build the Docker image:

```shell
docker build -t midas .
```

3) Run inference:

```shell
docker run --rm --gpus all -v $PWD/input:/opt/MiDaS/input -v $PWD/output:/opt/MiDaS/output midas
```

This command passes through all of your NVIDIA GPUs to the container, mounts the
`input` and `output` directories and then runs the inference.

### Citation

Expand Down

0 comments on commit 4da36e8

Please sign in to comment.