-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a18f4a
commit 72e57b8
Showing
6 changed files
with
51 additions
and
113 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,43 @@ | ||
FROM nvcr.io/nvidia/cuda:11.0.3-cudnn8-devel-ubuntu18.04 | ||
|
||
#installation settings | ||
ARG APT_INSTALL="apt-get install -y --no-install-recommends" | ||
ARG PIP_INSTALL="python3 -m pip --no-cache-dir install --upgrade --user" | ||
ARG GIT_CLONE="git clone --depth 10" | ||
|
||
#user settings | ||
ARG USER=docker | ||
ARG UID=1000 | ||
ARG GID=1000 | ||
ARG PW=user | ||
|
||
# Add user and his password | ||
RUN useradd -m ${USER} --uid=${UID} \ | ||
&& echo "${USER}:${PW}" | chpasswd \ | ||
&& usermod -s /bin/bash ${USER} | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get install -y \ | ||
git wget sudo build-essential \ | ||
python3 python3-setuptools python3-pip python3-dev python3-tk \ | ||
ffmpeg libsm6 libxext6 | ||
RUN ln -svf /usr/bin/python3 /usr/bin/python | ||
RUN python -m pip install --upgrade --force pip | ||
|
||
# TensorRT | ||
ARG version="8.0.5.39-1+cuda11.0" | ||
RUN apt-get update && apt-get install -y libcudnn8=${version} libcudnn8-dev=${version} && apt-mark hold libcudnn8 libcudnn8-dev | ||
ARG version="7.2.3-1+cuda11.0" | ||
RUN apt-get update && \ | ||
apt-get install -y libnvinfer7=${version} libnvonnxparsers7=${version} libnvparsers7=${version} libnvinfer-plugin7=${version} libnvinfer-dev=${version} libnvonnxparsers-dev=${version} libnvparsers-dev=${version} libnvinfer-plugin-dev=${version} python3-libnvinfer=${version} && \ | ||
apt-mark hold libnvinfer7 libnvonnxparsers7 libnvparsers7 libnvinfer-plugin7 libnvinfer-dev libnvonnxparsers-dev libnvparsers-dev libnvinfer-plugin-dev python3-libnvinfer | ||
|
||
# create a non-root user | ||
ARG USER_ID=1000 | ||
ARG USER=appuser | ||
RUN useradd -m --no-log-init --system --uid ${USER_ID} ${USER} -g sudo | ||
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
USER ${USER} | ||
WORKDIR /home/${USER} | ||
ENV PATH="/home/${USER}/.local/bin:${PATH}" | ||
|
||
#tools | ||
RUN apt-get update && $APT_INSTALL \ | ||
nano \ | ||
git \ | ||
python3 \ | ||
python3-setuptools \ | ||
python3-pip \ | ||
python3-dev \ | ||
build-essential \ | ||
ffmpeg \ | ||
libsm6 \ | ||
libxext6 && \ | ||
pip3 install --upgrade pip | ||
|
||
RUN $PIP_INSTALL \ | ||
cython \ | ||
opencv-python \ | ||
pillow \ | ||
matplotlib \ | ||
GitPython \ | ||
termcolor \ | ||
tensorboard | ||
|
||
RUN $PIP_INSTALL git+https://github.com/haotian-liu/cocoapi.git#"egg=pycocotools&subdirectory=PythonAPI" | ||
|
||
#pytorch | ||
RUN $PIP_INSTALL torch==1.7.1+cu110 \ | ||
torchvision==0.8.2+cu110 \ | ||
-f https://download.pytorch.org/whl/torch_stable.html | ||
|
||
#install TensorRT packages | ||
ENV version="8.0.5.39-1+cuda11.0" | ||
RUN apt-get update && $APT_INSTALL \ | ||
libcudnn8=${version} \ | ||
libcudnn8-dev=${version} && \ | ||
apt-mark hold libcudnn8 libcudnn8-dev | ||
|
||
ENV version="7.2.3-1+cuda11.0" | ||
RUN apt-get update && $APT_INSTALL \ | ||
libnvinfer7=${version} \ | ||
libnvonnxparsers7=${version} \ | ||
libnvparsers7=${version} \ | ||
libnvinfer-plugin7=${version} \ | ||
libnvinfer-dev=${version} \ | ||
libnvonnxparsers-dev=${version} \ | ||
libnvparsers-dev=${version} \ | ||
libnvinfer-plugin-dev=${version} \ | ||
python-libnvinfer=${version} \ | ||
python3-libnvinfer=${version} && \ | ||
apt-mark hold libnvinfer7 \ | ||
libnvonnxparsers7 \ | ||
libnvparsers7 \ | ||
libnvinfer-plugin7 \ | ||
libnvinfer-dev \ | ||
libnvonnxparsers-dev \ | ||
libnvparsers-dev \ | ||
libnvinfer-plugin-dev \ | ||
python-libnvinfer \ | ||
python3-libnvinfer | ||
|
||
#clone and compile torch2trt | ||
RUN $GIT_CLONE https://github.com/NVIDIA-AI-IOT/torch2trt | ||
# # Install dependencies | ||
RUN pip install --user cython opencv-python pillow matplotlib GitPython termcolor tensorboard | ||
RUN pip install --user git+https://github.com/haotian-liu/cocoapi.git#"egg=pycocotools&subdirectory=PythonAPI" | ||
RUN pip install --user torch==1.7.1+cu110 torchvision==0.8.2+cu110 -f https://download.pytorch.org/whl/torch_stable.html | ||
|
||
# torch2trt | ||
RUN git clone https://github.com/NVIDIA-AI-IOT/torch2trt | ||
WORKDIR /home/${USER}/torch2trt | ||
RUN python3 setup.py install --plugins | ||
|
||
#cleaning | ||
RUN apt-get clean && \ | ||
apt-get autoremove && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* | ||
RUN python setup.py install --plugins --user | ||
|
||
#start path | ||
WORKDIR /home/${USER} | ||
RUN ln -s /yolact_edge | ||
RUN ln -s /datasets | ||
WORKDIR /home/${USER}/yolact_edge | ||
|
||
ENV LANG C.UTF-8 |
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,14 +1,11 @@ | ||
Each step starts from the `yolact_edge` folder: | ||
- Build: | ||
## Use the container | ||
|
||
`cd docker` | ||
```Shell | ||
cd docker/ | ||
|
||
`./build.sh` | ||
- Start work: | ||
``./docker/start.sh `pwd` <path to dataset on your computer>`` (dataset will be available inside the container in a /datasets folder) | ||
# Build: | ||
docker build --build-arg USER_ID=$UID -t yolact_edge_image . | ||
|
||
|
||
Connect to runnig container (if you need more than one terminal to the container): | ||
`./docker/into.sh` | ||
|
||
Container uses `yolact_edge` folder as docker volume, so all your modifications will be save after closing session. | ||
# Launch (with GPUs): | ||
./start.sh /path/to/yolact_edge /path/to/datasets | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,13 +1,10 @@ | ||
#!/bin/bash | ||
|
||
SOURCE=$1 | ||
SOURCE_CODE=$1 | ||
DATASETS=$2 | ||
#for example from yolact_edge folder ./docker/start.sh `pwd` <path_to_datasets> | ||
|
||
docker run --rm \ | ||
-ti \ | ||
--name yolact_edge \ | ||
--gpus all \ | ||
-v $SOURCE:/home/docker/yolact_edge/:rw \ | ||
-v $DATASETS:/datasets/:ro \ | ||
yolact_edge_image | ||
docker run --gpus all -it --name=yolact_edge \ | ||
--shm-size=8gb --env="DISPLAY" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ | ||
-v $SOURCE_CODE:/yolact_edge/:rw \ | ||
-v $DATASETS:/datasets/:ro \ | ||
yolact_edge_image |