forked from facebookresearch/detectron2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Pull Request resolved: fairinternal/detectron2#402 Reviewed By: rbgirshick Differential Revision: D21245938 Pulled By: ppwwyyxx fbshipit-source-id: 3c0972929431a5fa70870c39ae18cf38fa0fa6ad
- Loading branch information
1 parent
6640501
commit 0d3face
Showing
13 changed files
with
94 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,36 @@ | ||
## Run the container | ||
Change to the *docker* directory of this repository: | ||
|
||
## 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 | ||
cd docker && USER_ID=$UID docker-compose run detectron2 | ||
``` | ||
|
||
#### Using a persistent cache directory | ||
Prevents models to be re-downloaded on every run, by storing them in a cache directory. | ||
|
||
`docker-compose run --volume=/path/to/cache:/tmp:rw detectron2` | ||
You can prevent models from being re-downloaded on every run, | ||
by storing them in a cache directory. | ||
|
||
## Rebuild the container | ||
Rebuild the container by `USER_ID=$UID docker-compose build detectron2`. | ||
This is only necessary when `Dockerfile` has been changed. The initial build is done automatically. | ||
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 \ | ||
nano vim emacs | ||
RUN pip install --user pandas | ||
RUN sudo apt-get update && sudo apt-get install -y vim | ||
``` | ||
Or run them in the container to make temporary changes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
# See https://pytorch.org/tutorials/advanced/cpp_frontend.html | ||
cmake_minimum_required(VERSION 3.0 FATAL_ERROR) | ||
project(caffe2_mask_rcnn) | ||
|
||
find_package(Torch REQUIRED) | ||
find_package(gflags REQUIRED) | ||
find_package(OpenCV REQUIRED) | ||
|
||
add_executable(caffe2_mask_rcnn caffe2_mask_rcnn.cpp) | ||
target_link_libraries( | ||
caffe2_mask_rcnn | ||
"${TORCH_LIBRARIES}" gflags glog ${OpenCV_LIBS}) | ||
set_property(TARGET caffe2_mask_rcnn PROPERTY CXX_STANDARD 14) |