Skip to content

Commit

Permalink
Merge pull request #1 from facebookresearch/master
Browse files Browse the repository at this point in the history
Add dockerfile (fix facebookresearch#14)
  • Loading branch information
sxhxliang authored Oct 12, 2019
2 parents 8170509 + f0a08a0 commit 7f7b487
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# output dir
output
instant_test_output
inference_test_output


*.jpg
*.png
*.txt

# compilation and distribution
__pycache__
Expand Down
36 changes: 36 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM nvidia/cuda:10.1-cudnn7-devel
# To use this Dockerfile:
# 1. `nvidia-docker build -t detectron2:v0 .`
# 2. `nvidia-docker run -it --name detectron2 detectron2:v0`


ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y \
libpng-dev libjpeg-dev python3-opencv ca-certificates \
python3-dev build-essential pkg-config git curl wget automake libtool && \
rm -rf /var/lib/apt/lists/*

RUN curl -fSsL -O 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 torch torchvision cython \
'git+https://github.com/facebookresearch/fvcore'
RUN pip install 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'

# install detectron2
RUN git clone https://github.com/facebookresearch/detectron2 /detectron2_repo
ENV FORCE_CUDA="1"
RUN pip install -e /detectron2_repo

WORKDIR /detectron2_repo

# run it, for example:
# 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 \
#--opts MODEL.WEIGHTS detectron2://COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x/137849600/model_final_f10217.pkl

1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"pycocotools",
"pycocotools.mask",
"pycocotools.coco",
"pycocotools.cocoeval",
]:
sys.modules[m] = mock.Mock(name=m)
sys.modules["cv2"].__version__ = "3.4"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_extensions():
extra_compile_args = {"cxx": []}
define_macros = []

if torch.cuda.is_available() and CUDA_HOME is not None:
if (torch.cuda.is_available() and CUDA_HOME is not None) or os.getenv("FORCE_CUDA", "0") == "1":
extension = CUDAExtension
sources += source_cuda
define_macros += [("WITH_CUDA", None)]
Expand Down

0 comments on commit 7f7b487

Please sign in to comment.