forked from open-mmlab/mmdeploy
-
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.
[Feautre] Add deploy dockerfile (open-mmlab#224)
* Add dockerfile for deploy * Fix * Update docker/Dockerfile_deployment Co-authored-by: HinGwenWoong <peterhuang0323@qq.com> * Update docker/Dockerfile_deployment Co-authored-by: HinGwenWoong <peterhuang0323@qq.com> * Add opencv old version * Add dockerfile and fix some typo * Remove repeat packages * Fix undefined symbol bug * Update docker/Dockerfile_deployment Co-authored-by: Haian Huang(深度眸) <1286304229@qq.com> * Update docker/Dockerfile_deployment Co-authored-by: HinGwenWoong <peterhuang0323@qq.com> * Add docs for deploy dockerfile * Fix typo * Update docs/zh_cn/advanced_guides/yolov5_deploy.md Co-authored-by: HinGwenWoong <peterhuang0323@qq.com> * Add profiler * Update docs/zh_cn/advanced_guides/yolov5_deploy.md Co-authored-by: HinGwenWoong <peterhuang0323@qq.com> * Update docker/Dockerfile_deployment Co-authored-by: Range King <RangeKingHZ@gmail.com> * Remove mmcv-full Co-authored-by: HinGwenWoong <peterhuang0323@qq.com> Co-authored-by: Haian Huang(深度眸) <1286304229@qq.com> Co-authored-by: Range King <RangeKingHZ@gmail.com>
- Loading branch information
1 parent
9c25057
commit 8e0f18b
Showing
4 changed files
with
182 additions
and
39 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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
FROM nvcr.io/nvidia/pytorch:22.04-py3 | ||
|
||
WORKDIR /openmmlab | ||
ARG ONNXRUNTIME_VERSION=1.8.1 | ||
ENV DEBIAN_FRONTEND=noninteractive \ | ||
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn \ | ||
FORCE_CUDA="1" | ||
|
||
RUN apt-key del 7fa2af80 \ | ||
&& apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub \ | ||
&& apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub | ||
|
||
# (Optional) | ||
# RUN sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu\//http:\/\/mirrors.aliyun.com\/ubuntu\//g' /etc/apt/sources.list \ | ||
# && pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y ffmpeg git libgl1-mesa-glx libopencv-dev \ | ||
libsm6 libspdlog-dev libssl-dev ninja-build libxext6 libxrender-dev \ | ||
libglib2.0-0 vim wget --no-install-recommends \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# get onnxruntime | ||
RUN wget -q https://github.com/microsoft/onnxruntime/releases/download/v${ONNXRUNTIME_VERSION}/onnxruntime-linux-x64-${ONNXRUNTIME_VERSION}.tgz \ | ||
&& tar -zxvf onnxruntime-linux-x64-${ONNXRUNTIME_VERSION}.tgz \ | ||
&& pip install --no-cache-dir onnxruntime-gpu==${ONNXRUNTIME_VERSION} \ | ||
&& pip install pycuda | ||
|
||
|
||
# Install OPENMIM MMENGINE MMCV MMDET | ||
RUN pip install --no-cache-dir openmim \ | ||
&& mim install --no-cache-dir "mmengine>=0.3.0" "mmcv>=2.0.0rc1,<2.1.0" "mmdet>=3.0.0rc2,<3.1.0" | ||
|
||
# Install MMYOLO | ||
RUN git clone https://github.com/open-mmlab/mmyolo.git -b dev mmyolo \ | ||
&& cd mmyolo \ | ||
&& mim install --no-cache-dir -e . \ | ||
&& cd .. | ||
|
||
# Install MMDEPLOY | ||
ENV ONNXRUNTIME_DIR=/openmmlab/onnxruntime-linux-x64-${ONNXRUNTIME_VERSION} \ | ||
TENSORRT_DIR=/usr/lib/x86_64-linux-gnu \ | ||
CUDNN_DIR=/usr/lib/x86_64-linux-gnu \ | ||
BACKUP_LD_LIBRARY_PATH=$LD_LIBRARY_PATH \ | ||
LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$TENSORRT_DIR/lib:$CUDNN_DIR/lib64:$BACKUP_LD_LIBRARY_PATH | ||
|
||
RUN git clone https://github.com/open-mmlab/mmdeploy -b dev-1.x mmdeploy \ | ||
&& cd mmdeploy \ | ||
&& git submodule update --init --recursive \ | ||
&& mkdir -p build \ | ||
&& cd build \ | ||
&& cmake -DMMDEPLOY_TARGET_BACKENDS="ort;trt" -DONNXRUNTIME_DIR=${ONNXRUNTIME_DIR} -DTENSORRT_DIR=${TENSORRT_DIR} -DCUDNN_DIR=${CUDNN_DIR} .. \ | ||
&& make -j$(nproc) \ | ||
&& make install \ | ||
&& cd .. \ | ||
&& mim install --no-cache-dir -e . | ||
|
||
# Fix undefined symbol bug | ||
RUN echo -e "\nldconfig" > /root/.bashrc |
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