Skip to content

Commit

Permalink
Merge pull request #535 from KleinYuan/kaiwen/docker
Browse files Browse the repository at this point in the history
Add Docker Support
  • Loading branch information
KaiyangZhou authored Feb 8, 2023
2 parents 9e589c6 + 34f6ce5 commit 566a56a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM nvidia/cuda:11.1.1-cudnn8-devel-ubuntu18.04

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y \
python3-opencv ca-certificates python3-dev git wget sudo ninja-build
RUN ln -sv /usr/bin/python3 /usr/bin/python

COPY . /home/appuser
WORKDIR /home/appuser

# https://github.com/facebookresearch/detectron2/issues/3933
ENV PATH="/home/appuser/.local/bin:${PATH}"
RUN wget https://bootstrap.pypa.io/pip/3.6/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 -r requirements.txt
RUN pip install torch==1.10 torchvision==0.11.1 -f https://download.pytorch.org/whl/cu111/torch_stable.html
RUN pip install setuptools==59.5.0
RUN python setup.py develop
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
clean:
docker rm -f $$(docker ps -qa)

build-image:
docker build -t=deeppreid:v0 .

run:
nvidia-docker run -v ${PWD}:/home/appuser --name=deeppreid --net=host --ipc=host -it deeppreid:v0
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ Make sure `conda <https://www.anaconda.com/distribution/>`_ is installed.
# install torchreid (don't need to re-build it if you modify the source code)
python setup.py develop
Another way to install is to run everything inside docker container:

- build: ``make build-image``
- run: ``make run``

Get started: 30 seconds to Torchreid
-------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ flake8
yapf
isort==4.3.21
imageio

chardet
# Export --------------------------------------
# onnx
# onnx-simplified
Expand Down

0 comments on commit 566a56a

Please sign in to comment.