diff --git a/.github/workflows/prebuild.yml b/.github/workflows/prebuild.yml index b85fbc786e..bd113d0e6f 100644 --- a/.github/workflows/prebuild.yml +++ b/.github/workflows/prebuild.yml @@ -29,6 +29,7 @@ jobs: export MMDEPLOY_VERSION=$(python3 -c "import sys; sys.path.append('mmdeploy');from version import __version__;print(__version__)") echo $MMDEPLOY_VERSION echo "MMDEPLOY_VERSION=$MMDEPLOY_VERSION" >> $GITHUB_ENV + echo "OUTPUT_DIR=$MMDEPLOY_VERSION-$GITHUB_RUN_ID" >> $GITHUB_ENV - name: Build MMDeploy run: | source activate mmdeploy-3.6 @@ -51,17 +52,55 @@ jobs: cd pack python ../tools/package_tools/generate_build_config.py --backend 'ort;trt' \ --system linux --output config.yml --device cuda --build-sdk --build-sdk-monolithic \ - --build-sdk-python --sdk-dynamic-net + --build-sdk-python --sdk-dynamic-net --onnxruntime-dir=$ONNXRUNTIME_GPU_DIR + python ../tools/package_tools/mmdeploy_builder.py --config config.yml + - name: Move artifact + run: | + mkdir -p /__w/mmdeploy/prebuild/$OUTPUT_DIR + cp -r pack/* /__w/mmdeploy/prebuild/$OUTPUT_DIR + + linux_build_cxx11abi: + runs-on: [self-hosted, linux-3090] + container: + image: openmmlab/mmdeploy:build-ubuntu16.04-cuda11.3 + options: "--gpus=all --ipc=host" + volumes: + - /data2/actions-runner/prebuild:/__w/mmdeploy/prebuild + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Get mmdeploy version + run: | + export MMDEPLOY_VERSION=$(python3 -c "import sys; sys.path.append('mmdeploy');from version import __version__;print(__version__)") + echo $MMDEPLOY_VERSION + echo "MMDEPLOY_VERSION=$MMDEPLOY_VERSION" >> $GITHUB_ENV + echo "OUTPUT_DIR=$MMDEPLOY_VERSION-$GITHUB_RUN_ID" >> $GITHUB_ENV + - name: Build sdk cpu backend + run: | + mkdir pack; cd pack + python ../tools/package_tools/generate_build_config.py --backend 'ort' \ + --system linux --output config.yml --device cpu --build-sdk --build-sdk-monolithic \ + --sdk-dynamic-net --cxx11abi + python ../tools/package_tools/mmdeploy_builder.py --config config.yml + - name: Build sdk cuda backend + run: | + cd pack + python ../tools/package_tools/generate_build_config.py --backend 'ort;trt' \ + --system linux --output config.yml --device cuda --build-sdk --build-sdk-monolithic \ + --sdk-dynamic-net --cxx11abi --onnxruntime-dir=$ONNXRUNTIME_GPU_DIR --cudnn-dir /usr python ../tools/package_tools/mmdeploy_builder.py --config config.yml - name: Move artifact run: | - mkdir -p /__w/mmdeploy/prebuild/$MMDEPLOY_VERSION - rm -rf /__w/mmdeploy/prebuild/$MMDEPLOY_VERSION/* - mv pack/* /__w/mmdeploy/prebuild/$MMDEPLOY_VERSION + mkdir -p /__w/mmdeploy/prebuild/$OUTPUT_DIR + cp -r pack/* /__w/mmdeploy/prebuild/$OUTPUT_DIR linux_test: runs-on: [self-hosted, linux-3090] - needs: linux_build + needs: + - linux_build + - linux_build_cxx11abi container: image: openmmlab/mmdeploy:ubuntu20.04-cuda11.3 options: "--gpus=all --ipc=host" @@ -76,13 +115,14 @@ jobs: export MMDEPLOY_VERSION=$(python3 -c "import sys; sys.path.append('mmdeploy');from version import __version__;print(__version__)") echo $MMDEPLOY_VERSION echo "MMDEPLOY_VERSION=$MMDEPLOY_VERSION" >> $GITHUB_ENV + echo "OUTPUT_DIR=$MMDEPLOY_VERSION-$GITHUB_RUN_ID" >> $GITHUB_ENV - name: Test python run: | - cd /__w/mmdeploy/prebuild/$MMDEPLOY_VERSION + cd /__w/mmdeploy/prebuild/$OUTPUT_DIR bash $GITHUB_WORKSPACE/tools/package_tools/test/test_sdk_python.sh - name: Test c/cpp run: | - cd /__w/mmdeploy/prebuild/$MMDEPLOY_VERSION + cd /__w/mmdeploy/prebuild/$OUTPUT_DIR bash $GITHUB_WORKSPACE/tools/package_tools/test/test_sdk.sh linux_upload: @@ -100,20 +140,21 @@ jobs: export MMDEPLOY_VERSION=$(python3 -c "import sys; sys.path.append('mmdeploy');from version import __version__;print(__version__)") echo $MMDEPLOY_VERSION echo "MMDEPLOY_VERSION=$MMDEPLOY_VERSION" >> $GITHUB_ENV + echo "OUTPUT_DIR=$MMDEPLOY_VERSION-$GITHUB_RUN_ID" >> $GITHUB_ENV - name: Upload mmdeploy run: | - cd $PREBUILD_DIR/$MMDEPLOY_VERSION/mmdeploy + cd $PREBUILD_DIR/$OUTPUT_DIR/mmdeploy pip install twine # twine upload * --repository testpypi -u __token__ -p ${{ secrets.test_pypi_password }} twine upload * -u __token__ -p ${{ secrets.pypi_password }} - name: Upload mmdeploy_runtime run: | - cd $PREBUILD_DIR/$MMDEPLOY_VERSION/mmdeploy_runtime + cd $PREBUILD_DIR/$OUTPUT_DIR/mmdeploy_runtime # twine upload * --repository testpypi -u __token__ -p ${{ secrets.test_pypi_password }} twine upload * -u __token__ -p ${{ secrets.pypi_password }} - name: Zip mmdeploy sdk run: | - cd $PREBUILD_DIR/$MMDEPLOY_VERSION/sdk + cd $PREBUILD_DIR/$OUTPUT_DIR/sdk for folder in * do tar czf $folder.tar.gz $folder @@ -122,7 +163,7 @@ jobs: uses: softprops/action-gh-release@v1 with: files: | - $PREBUILD_DIR/$MMDEPLOY_VERSION/sdk/*.tar.gz + $PREBUILD_DIR/$OUTPUT_DIR/sdk/*.tar.gz windows_build: @@ -138,6 +179,7 @@ jobs: $env:MMDEPLOY_VERSION=(python -c "import sys; sys.path.append('mmdeploy');from version import __version__;print(__version__)") echo $env:MMDEPLOY_VERSION echo "MMDEPLOY_VERSION=$env:MMDEPLOY_VERSION" >> $env:GITHUB_ENV + echo "OUTPUT_DIR=$env:MMDEPLOY_VERSION-$env:GITHUB_RUN_ID" >> $env:GITHUB_ENV - name: Build MMDeploy run: | . D:\DEPS\cienv\prebuild_gpu_env.ps1 @@ -166,9 +208,8 @@ jobs: python ../tools/package_tools/mmdeploy_builder.py --config config.yml - name: Move artifact run: | - New-Item "D:/DEPS/ciartifact/$env:MMDEPLOY_VERSION" -ItemType Directory -Force - Remove-Item "D:/DEPS/ciartifact/$env:MMDEPLOY_VERSION/*" -Force -Recurse - Move-Item pack/* "D:/DEPS/ciartifact/$env:MMDEPLOY_VERSION" + New-Item "D:/DEPS/ciartifact/$env:OUTPUT_DIR" -ItemType Directory -Force + Move-Item pack/* "D:/DEPS/ciartifact/$env:OUTPUT_DIR" windows_test: runs-on: [self-hosted, win10-3080] @@ -182,15 +223,16 @@ jobs: $env:MMDEPLOY_VERSION=(python -c "import sys; sys.path.append('mmdeploy');from version import __version__;print(__version__)") echo $env:MMDEPLOY_VERSION echo "MMDEPLOY_VERSION=$env:MMDEPLOY_VERSION" >> $env:GITHUB_ENV + echo "OUTPUT_DIR=$env:MMDEPLOY_VERSION-$env:GITHUB_RUN_ID" >> $env:GITHUB_ENV - name: Test python run: | - cd "D:/DEPS/ciartifact/$env:MMDEPLOY_VERSION" + cd "D:/DEPS/ciartifact/$env:OUTPUT_DIR" . D:\DEPS\cienv\prebuild_cpu_env.ps1 conda activate ci-test & "$env:GITHUB_WORKSPACE/tools/package_tools/test/test_sdk_python.ps1" - name: Test c/cpp run: | - cd "D:/DEPS/ciartifact/$env:MMDEPLOY_VERSION" + cd "D:/DEPS/ciartifact/$env:OUTPUT_DIR" . D:\DEPS\cienv\prebuild_cpu_env.ps1 & "$env:GITHUB_WORKSPACE/tools/package_tools/test/test_sdk.ps1" @@ -208,21 +250,22 @@ jobs: $env:MMDEPLOY_VERSION=(python -c "import sys; sys.path.append('mmdeploy');from version import __version__;print(__version__)") echo $env:MMDEPLOY_VERSION echo "MMDEPLOY_VERSION=$env:MMDEPLOY_VERSION" >> $env:GITHUB_ENV + echo "OUTPUT_DIR=$env:MMDEPLOY_VERSION-$env:GITHUB_RUN_ID" >> $env:GITHUB_ENV - name: Upload mmdeploy run: | - cd "D:/DEPS/ciartifact/$env:MMDEPLOY_VERSION/mmdeploy" + cd "D:/DEPS/ciartifact/$env:OUTPUT_DIR/mmdeploy" conda activate mmdeploy-3.8 # twine upload * --repository testpypi -u __token__ -p ${{ secrets.test_pypi_password }} twine upload * -u __token__ -p ${{ secrets.pypi_password }} - name: Upload mmdeploy_runtime run: | - cd "D:/DEPS/ciartifact/$env:MMDEPLOY_VERSION/mmdeploy_runtime" + cd "D:/DEPS/ciartifact/$env:OUTPUT_DIR/mmdeploy_runtime" conda activate mmdeploy-3.8 # twine upload * --repository testpypi -u __token__ -p ${{ secrets.test_pypi_password }} twine upload * -u __token__ -p ${{ secrets.pypi_password }} - name: Zip mmdeploy sdk run: | - cd "D:/DEPS/ciartifact/$env:MMDEPLOY_VERSION/sdk" + cd "D:/DEPS/ciartifact/$env:OUTPUT_DIR/sdk" $folders = $(ls).Name foreach ($folder in $folders) { Compress-Archive -Path $folder -DestinationPath "$folder.zip" @@ -231,4 +274,4 @@ jobs: uses: softprops/action-gh-release@v1 with: files: | - D:/DEPS/ciartifact/$env:MMDEPLOY_VERSION/sdk/*.zip + D:/DEPS/ciartifact/$env:OUTPUT_DIR/sdk/*.zip diff --git a/docs/en/02-how-to-run/prebuilt_package_windows.md b/docs/en/02-how-to-run/prebuilt_package_windows.md index c7913fa217..143232fb65 100644 --- a/docs/en/02-how-to-run/prebuilt_package_windows.md +++ b/docs/en/02-how-to-run/prebuilt_package_windows.md @@ -21,26 +21,27 @@ ______________________________________________________________________ -This tutorial takes `mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1.zip` and `mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0.zip` as examples to show how to use the prebuilt packages. +This tutorial takes `mmdeploy-0.13.0-windows-amd64.zip` and `mmdeploy-0.13.0-windows-amd64-cuda11.3.zip` as examples to show how to use the prebuilt packages. The former supports onnxruntime cpu inference, the latter supports onnxruntime-gpu and tensorrt inference. The directory structure of the prebuilt package is as follows, where the `dist` folder is about model converter, and the `sdk` folder is related to model inference. ``` . -|-- dist -`-- sdk - |-- bin - |-- example - |-- include - |-- lib - `-- python +├── build_sdk.ps1 +├── example +├── include +├── install_opencv.ps1 +├── lib +├── README.md +├── set_env.ps1 +└── thirdparty ``` ## Prerequisite In order to use the prebuilt package, you need to install some third-party dependent libraries. -1. Follow the [get_started](../get_started.md) documentation to create a virtual python environment and install pytorch, torchvision and mmcv-full. To use the C interface of the SDK, you need to install [vs2019+](https://visualstudio.microsoft.com/), [OpenCV](https://github.com/opencv/opencv/releases). +1. Follow the [get_started](../get_started.md) documentation to create a virtual python environment and install pytorch, torchvision and mmcv. To use the C interface of the SDK, you need to install [vs2019+](https://visualstudio.microsoft.com/), [OpenCV](https://github.com/opencv/opencv/releases). :point_right: It is recommended to use `pip` instead of `conda` to install pytorch and torchvision @@ -80,9 +81,8 @@ In order to use `ONNX Runtime` backend, you should also do the following steps. 5. Install `mmdeploy` (Model Converter) and `mmdeploy_runtime` (SDK Python API). ```bash - # download mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1.zip - pip install .\mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1\dist\mmdeploy-0.13.0-py38-none-win_amd64.whl - pip install .\mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1\sdk\python\mmdeploy_runtime-0.13.0-cp38-none-win_amd64.whl + pip install mmdeploy==0.13.0 + pip install mmdeploy-runtime==0.13.0 ``` :point_right: If you have installed it before, please uninstall it first. @@ -100,6 +100,8 @@ In order to use `ONNX Runtime` backend, you should also do the following steps. ![sys-path](https://user-images.githubusercontent.com/16019484/181463801-1d7814a8-b256-46e9-86f2-c08de0bc150b.png) :exclamation: Restart powershell to make the environment variables setting take effect. You can check whether the settings are in effect by `echo $env:PATH`. +8. Download SDK C/cpp Library mmdeploy-0.13.0-windows-amd64.zip + ### TensorRT In order to use `TensorRT` backend, you should also do the following steps. @@ -107,9 +109,8 @@ In order to use `TensorRT` backend, you should also do the following steps. 5. Install `mmdeploy` (Model Converter) and `mmdeploy_runtime` (SDK Python API). ```bash - # download mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0.zip - pip install .\mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0\dist\mmdeploy-0.13.0-py38-none-win_amd64.whl - pip install .\mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0\sdk\python\mmdeploy_runtime-0.13.0-cp38-none-win_amd64.whl + pip install mmdeploy==0.13.0 + pip install mmdeploy-runtime-gpu==0.13.0 ``` :point_right: If you have installed it before, please uninstall it first. @@ -128,6 +129,8 @@ In order to use `TensorRT` backend, you should also do the following steps. 7. Install pycuda by `pip install pycuda` +8. Download SDK C/cpp Library mmdeploy-0.13.0-windows-amd64-cuda11.3.zip + ## Model Convert ### ONNX Runtime Example @@ -138,7 +141,7 @@ After preparation work, the structure of the current working directory should be ``` .. -|-- mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1 +|-- mmdeploy-0.13.0-windows-amd64 |-- mmclassification |-- mmdeploy `-- resnet18_8xb32_in1k_20210831-fbbb1da6.pth @@ -186,7 +189,7 @@ After installation of mmdeploy-tensorrt prebuilt package, the structure of the c ``` .. -|-- mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0 +|-- mmdeploy-0.13.0-windows-amd64-cuda11.3 |-- mmclassification |-- mmdeploy `-- resnet18_8xb32_in1k_20210831-fbbb1da6.pth @@ -299,7 +302,7 @@ python .\mmdeploy\demo\python\image_classification.py cpu .\work_dir\onnx\resnet #### TensorRT -``` +```bash python .\mmdeploy\demo\python\image_classification.py cuda .\work_dir\trt\resnet\ .\mmclassification\demo\demo.JPEG ``` @@ -309,35 +312,19 @@ The following describes how to use the SDK's C API for inference #### ONNXRuntime -1. Build examples - - Under `mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1\sdk\example` directory - - ``` - // Path should be modified according to the actual location - mkdir build - cd build - cmake ..\cpp -A x64 -T v142 ` - -DOpenCV_DIR=C:\Deps\opencv\build\x64\vc15\lib ` - -DMMDeploy_DIR=C:\workspace\mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1\sdk\lib\cmake\MMDeploy ` - -DONNXRUNTIME_DIR=C:\Deps\onnxruntime\onnxruntime-win-gpu-x64-1.8.1 - - cmake --build . --config Release - ``` +1. Add environment variables -2. Add environment variables or copy the runtime libraries to the same level directory of exe + Refer to the README.md in sdk folder - :point_right: The purpose is to make the exe find the relevant dll +2. Build examples - If choose to add environment variables, add the runtime libraries path of `mmdeploy` (`mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1\sdk\bin`) to the `PATH`. - - If choose to copy the dynamic libraries, copy the dll in the bin directory to the same level directory of the just compiled exe (build/Release). + Refer to the README.md in sdk folder 3. Inference: It is recommended to use `CMD` here. - Under `mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1\\sdk\\example\\build\\Release` directory: + Under `mmdeploy-0.13.0-windows-amd64\\example\\cpp\\build\\Release` directory: ``` .\image_classification.exe cpu C:\workspace\work_dir\onnx\resnet\ C:\workspace\mmclassification\demo\demo.JPEG @@ -345,35 +332,19 @@ The following describes how to use the SDK's C API for inference #### TensorRT -1. Build examples - - Under `mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0\\sdk\\example` directory - - ``` - // Path should be modified according to the actual location - mkdir build - cd build - cmake ..\cpp -A x64 -T v142 ` - -DOpenCV_DIR=C:\Deps\opencv\build\x64\vc15\lib ` - -DMMDeploy_DIR=C:\workspace\mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8 2.3.0\sdk\lib\cmake\MMDeploy ` - -DTENSORRT_DIR=C:\Deps\tensorrt\TensorRT-8.2.3.0 ` - -DCUDNN_DIR=C:\Deps\cudnn\8.2.1 - cmake --build . --config Release - ``` - -2. Add environment variables or copy the runtime libraries to the same level directory of exe +1. Add environment variables - :point_right: The purpose is to make the exe find the relevant dll + Refer to the README.md in sdk folder - If choose to add environment variables, add the runtime libraries path of `mmdeploy` (`mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0\sdk\bin`) to the `PATH`. +2. Build examples - If choose to copy the dynamic libraries, copy the dll in the bin directory to the same level directory of the just compiled exe (build/Release). + Refer to the README.md in sdk folder 3. Inference It is recommended to use `CMD` here. - Under `mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0\\sdk\\example\\build\\Release` directory + Under `mmdeploy-0.13.0-windows-amd64-cuda11.3\\example\\cpp\\build\\Release` directory ``` .\image_classification.exe cuda C:\workspace\work_dir\trt\resnet C:\workspace\mmclassification\demo\demo.JPEG diff --git a/docs/en/get_started.md b/docs/en/get_started.md index efdec195e6..a8b3601eea 100644 --- a/docs/en/get_started.md +++ b/docs/en/get_started.md @@ -69,8 +69,7 @@ mim install mmcv-full **Step 1.** Install MMDeploy and inference engine -We recommend using MMDeploy precompiled package as our best practice. -You can download them from [here](https://github.com/open-mmlab/mmdeploy/releases) according to your target platform and device. +We recommend using MMDeploy precompiled package as our best practice. Currently, we support model converter and sdk inference pypi package, and the sdk c/cpp library is provided [here](https://github.com/open-mmlab/mmdeploy/releases). You can download them according to your target platform and device. The supported platform and device matrix is presented as following: @@ -92,7 +91,7 @@ The supported platform and device matrix is presented as following: CUDA - N + Y Y @@ -103,7 +102,7 @@ The supported platform and device matrix is presented as following: CUDA - N + Y Y @@ -114,46 +113,44 @@ The supported platform and device matrix is presented as following: Take the latest precompiled package as example, you can install it as follows:
-Linux-x86_64, CPU, ONNX Runtime 1.8.1 +Linux-x86_64 ```shell -# install MMDeploy -wget https://github.com/open-mmlab/mmdeploy/releases/download/v0.13.0/mmdeploy-0.13.0-linux-x86_64-onnxruntime1.8.1.tar.gz -tar -zxvf mmdeploy-0.13.0-linux-x86_64-onnxruntime1.8.1.tar.gz -cd mmdeploy-0.13.0-linux-x86_64-onnxruntime1.8.1 -pip install dist/mmdeploy-0.13.0-py3-none-linux_x86_64.whl -pip install sdk/python/mmdeploy_runtime-0.13.0-cp38-none-linux_x86_64.whl -cd .. -# install inference engine: ONNX Runtime -pip install onnxruntime==1.8.1 -wget https://github.com/microsoft/onnxruntime/releases/download/v1.8.1/onnxruntime-linux-x64-1.8.1.tgz -tar -zxvf onnxruntime-linux-x64-1.8.1.tgz -export ONNXRUNTIME_DIR=$(pwd)/onnxruntime-linux-x64-1.8.1 -export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$LD_LIBRARY_PATH -``` - -
- -
-Linux-x86_64, CUDA 11.x, TensorRT 8.2.3.0 - -```shell -# install MMDeploy -wget https://github.com/open-mmlab/mmdeploy/releases/download/v0.13.0/mmdeploy-0.13.0-linux-x86_64-cuda11.1-tensorrt8.2.3.0.tar.gz -tar -zxvf mmdeploy-0.13.0-linux-x86_64-cuda11.1-tensorrt8.2.3.0.tar.gz -cd mmdeploy-0.13.0-linux-x86_64-cuda11.1-tensorrt8.2.3.0 -pip install dist/mmdeploy-0.13.0-py3-none-linux_x86_64.whl -pip install sdk/python/mmdeploy_runtime-0.13.0-cp38-none-linux_x86_64.whl -cd .. -# install inference engine: TensorRT -# !!! Download TensorRT-8.2.3.0 CUDA 11.x tar package from NVIDIA, and extract it to the current directory +# 1. install MMDeploy model converter +pip install mmdeploy==0.13.0 + +# 2. install MMDeploy sdk inference +# you can install one to install according whether you need gpu inference +# 2.1 support onnxruntime +pip install mmdeploy-runtime==0.13.0 +# 2.2 support onnxruntime-gpu, tensorrt +pip install mmdeploy-runtime-gpu==0.13.0 + +# 3. install inference engine +# 3.1 install TensorRT +# !!! If you want to convert a tensorrt model or inference with tensorrt, +# download TensorRT-8.2.3.0 CUDA 11.x tar package from NVIDIA, and extract it to the current directory pip install TensorRT-8.2.3.0/python/tensorrt-8.2.3.0-cp38-none-linux_x86_64.whl pip install pycuda export TENSORRT_DIR=$(pwd)/TensorRT-8.2.3.0 export LD_LIBRARY_PATH=${TENSORRT_DIR}/lib:$LD_LIBRARY_PATH -# !!! Download cuDNN 8.2.1 CUDA 11.x tar package from NVIDIA, and extract it to the current directory +# !!! Moreover, download cuDNN 8.2.1 CUDA 11.x tar package from NVIDIA, and extract it to the current directory export CUDNN_DIR=$(pwd)/cuda export LD_LIBRARY_PATH=$CUDNN_DIR/lib64:$LD_LIBRARY_PATH + +# 3.2 install ONNX Runtime +# you can install one to install according whether you need gpu inference +# 3.2.1 onnxruntime +wget https://github.com/microsoft/onnxruntime/releases/download/v1.8.1/onnxruntime-linux-x64-1.8.1.tgz +tar -zxvf onnxruntime-linux-x64-1.8.1.tgz +export ONNXRUNTIME_DIR=$(pwd)/onnxruntime-linux-x64-1.8.1 +export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$LD_LIBRARY_PATH +# 3.2.2 onnxruntime-gpu +pip install onnxruntime-gpu==1.8.1 +wget https://github.com/microsoft/onnxruntime/releases/download/v1.8.1/onnxruntime-linux-x64-gpu-1.8.1.tgz +tar -zxvf onnxruntime-linux-x64-gpu-1.8.1.tgz +export ONNXRUNTIME_DIR=$(pwd)/onnxruntime-linux-x64-gpu-1.8.1 +export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$LD_LIBRARY_PATH ```
@@ -200,8 +197,8 @@ And they make up of MMDeploy Model that can be fed to MMDeploy SDK to do model i For more details about model conversion, you can read [how_to_convert_model](02-how-to-run/convert_model.md). If you want to customize the conversion pipeline, you can edit the config file by following [this](02-how-to-run/write_config.md) tutorial. ```{tip} -If MMDeploy-ONNXRuntime prebuilt package is installed, you can convert the above model to onnx model and perform ONNX Runtime inference -just by 'changing detection_tensorrt_dynamic-320x320-1344x1344.py' to 'detection_onnxruntime_dynamic.py' and making '--device' as 'cpu'. +You can convert the above model to onnx model and perform ONNX Runtime inference +just by changing 'detection_tensorrt_dynamic-320x320-1344x1344.py' to 'detection_onnxruntime_dynamic.py' and making '--device' as 'cpu'. ``` ## Inference Model @@ -232,12 +229,14 @@ result = inference_model( You can directly run MMDeploy demo programs in the precompiled package to get inference results. ```shell -cd mmdeploy-0.13.0-linux-x86_64-cuda11.1-tensorrt8.2.3.0 +wget https://github.com/open-mmlab/mmdeploy/releases/download/v0.13.0/mmdeploy-0.13.0-linux-x86_64-cuda11.3.tar.gz +tar xf mmdeploy-0.13.0-linux-x86_64-cuda11.3 +cd mmdeploy-0.13.0-linux-x86_64-cuda11.3 # run python demo -python sdk/example/python/object_detection.py cuda ../mmdeploy_model/faster-rcnn ../mmdetection/demo/demo.jpg +python example/python/object_detection.py cuda ../mmdeploy_model/faster-rcnn ../mmdetection/demo/demo.jpg # run C/C++ demo -export LD_LIBRARY_PATH=$(pwd)/sdk/lib:$LD_LIBRARY_PATH -./sdk/bin/object_detection cuda ../mmdeploy_model/faster-rcnn ../mmdetection/demo/demo.jpg +# build the demo according to the README.md in the folder. +./bin/object_detection cuda ../mmdeploy_model/faster-rcnn ../mmdetection/demo/demo.jpg ``` ```{note} diff --git a/docs/zh_cn/02-how-to-run/prebuilt_package_windows.md b/docs/zh_cn/02-how-to-run/prebuilt_package_windows.md index 735a19ad97..c01f412300 100644 --- a/docs/zh_cn/02-how-to-run/prebuilt_package_windows.md +++ b/docs/zh_cn/02-how-to-run/prebuilt_package_windows.md @@ -21,23 +21,24 @@ ______________________________________________________________________ -目前,`MMDeploy`在`Windows`平台下提供`TensorRT`以及`ONNX Runtime`两种预编译包,可以从[Releases](https://github.com/open-mmlab/mmdeploy/releases)获取。 +目前,`MMDeploy`在`Windows`平台下提供`cpu`以及`cuda`两种Device的预编译包,其中`cpu`版支持使用onnxruntime cpu进行推理,`cuda`版支持使用onnxruntime-gpu以及tensorrt进行推理,可以从[Releases](https://github.com/open-mmlab/mmdeploy/releases)获取。。 -本篇教程以`mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1.zip`和`mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0.zip`为例,展示预编译包的使用方法。 +本篇教程以`mmdeploy-0.13.0-windows-amd64.zip`和`mmdeploy-0.13.0-windows-amd64-cuda11.3.zip`为例,展示预编译包的使用方法。 为了方便使用者快速上手,本教程以分类模型(mmclassification)为例,展示两种预编译包的使用方法。 -预编译包的目录结构如下,其中`dist`文件夹为模型转换相关内容,`sdk`文件夹为模型推理相关内容。 +预编译包的目录结构如下。 ``` . -|-- dist -`-- sdk - |-- bin - |-- example - |-- include - |-- lib - `-- python +├── build_sdk.ps1 +├── example +├── include +├── install_opencv.ps1 +├── lib +├── README.md +├── set_env.ps1 +└── thirdparty ``` ## 准备工作 @@ -48,7 +49,7 @@ ______________________________________________________________________ 首先新建一个工作目录workspace -1. 请按照[get_started](../get_started.md)文档,准备虚拟环境,安装pytorch、torchvision、mmcv-full。若要使用SDK的C接口,需要安装vs2019+, OpenCV。 +1. 请按照[get_started](../get_started.md)文档,准备虚拟环境,安装pytorch、torchvision、mmcv。若要使用SDK的C接口,需要安装vs2019+, OpenCV。 :point_right: 这里建议使用`pip`而不是`conda`安装pytorch、torchvision @@ -88,9 +89,8 @@ ______________________________________________________________________ 5. 安装`mmdeploy`(模型转换)以及`mmdeploy_runtime`(模型推理Python API)的预编译包 ```bash - # 先下载 mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1.zip - pip install .\mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1\dist\mmdeploy-0.13.0-py38-none-win_amd64.whl - pip install .\mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1\sdk\python\mmdeploy_runtime-0.13.0-cp38-none-win_amd64.whl + pip install mmdeploy==0.13.0 + pip install mmdeploy-runtime==0.13.0 ``` :point_right: 如果之前安装过,需要先卸载后再安装。 @@ -108,6 +108,8 @@ ______________________________________________________________________ ![sys-path](https://user-images.githubusercontent.com/16019484/181463801-1d7814a8-b256-46e9-86f2-c08de0bc150b.png) :exclamation: 重启powershell让环境变量生效,可以通过 echo $env:PATH 来检查是否设置成功。 +8. 下载 SDK C/cpp Library mmdeploy-0.13.0-windows-amd64.zip + ### TensorRT 本节介绍`mmdeploy`使用`TensorRT`推理所特有的环境准备工作 @@ -115,9 +117,8 @@ ______________________________________________________________________ 5. 安装`mmdeploy`(模型转换)以及`mmdeploy_runtime`(模型推理Python API)的预编译包 ```bash - # 先下载 mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0.zip - pip install .\mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0\dist\mmdeploy-0.13.0-py38-none-win_amd64.whl - pip install .\mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0\sdk\python\mmdeploy_runtime-0.13.0-cp38-none-win_amd64.whl + pip install mmdeploy==0.13.0 + pip install mmdeploy-runtime-gpu==0.13.0 ``` :point_right: 如果之前安装过,需要先卸载后再安装 @@ -136,6 +137,8 @@ ______________________________________________________________________ 7. 安装pycuda `pip install pycuda` +8. 下载 SDK C/cpp Library mmdeploy-0.13.0-windows-amd64-cuda11.3.zip + ## 模型转换 ### ONNX Runtime Example @@ -146,7 +149,7 @@ ______________________________________________________________________ ``` .. -|-- mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1 +|-- mmdeploy-0.13.0-windows-amd64 |-- mmclassification |-- mmdeploy `-- resnet18_8xb32_in1k_20210831-fbbb1da6.pth @@ -194,7 +197,7 @@ export2SDK(deploy_cfg, model_cfg, work_dir, pth=model_checkpoint, device=device) ``` .. -|-- mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0 +|-- mmdeploy-0.13.0-windows-amd64-cuda11.3 |-- mmclassification |-- mmdeploy `-- resnet18_8xb32_in1k_20210831-fbbb1da6.pth @@ -315,7 +318,7 @@ python .\mmdeploy\demo\python\image_classification.py cpu .\work_dir\onnx\resnet 推理代码 -``` +```bash python .\mmdeploy\demo\python\image_classification.py cuda .\work_dir\trt\resnet\ .\mmclassification\demo\demo.JPEG ``` @@ -325,35 +328,19 @@ python .\mmdeploy\demo\python\image_classification.py cpu .\work_dir\onnx\resnet #### ONNXRuntime -1. 编译 examples - - 在`mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1\sdk\example`目录下 - - ``` - // 部分路径根据实际位置进行修改 - mkdir build - cd build - cmake ..\cpp -A x64 -T v142 ` - -DOpenCV_DIR=C:\Deps\opencv\build\x64\vc15\lib ` - -DMMDeploy_DIR=C:\workspace\mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1\sdk\lib\cmake\MMDeploy ` - -DONNXRUNTIME_DIR=C:\Deps\onnxruntime\onnxruntime-win-gpu-x64-1.8.1 - - cmake --build . --config Release - ``` +1. 添加环境变量 -2. 添加环境变量或拷贝动态库到exe同级目录 + 可根据 SDK 文件夹内的 README.md 使用脚本添加环境变量 - :point_right: 目的是使exe运行时可以正确找到相关dll +2. 编译 examples - 若选择添加环境变量,则将`mmdeploy`的运行时库路径(`mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1\sdk\bin`)添加到PATH,可参考onnxruntime的添加过程。 - - 若选择拷贝动态库,而将bin目录中的dll拷贝到刚才编译出的exe(build/Release)的同级目录下。 + 可根据 SDK 文件夹内的 README.md 使用脚本进行编译 3. 推理: 这里建议使用cmd,这样如果exe运行时如果找不到相关的dll的话会有弹窗 - 在mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1\\sdk\\example\\build\\Release目录下: + 在mmdeploy-0.13.0-windows-amd64-onnxruntime1.8.1\\example\\cpp\\build\\Release目录下: ``` .\image_classification.exe cpu C:\workspace\work_dir\onnx\resnet\ C:\workspace\mmclassification\demo\demo.JPEG @@ -361,35 +348,19 @@ python .\mmdeploy\demo\python\image_classification.py cpu .\work_dir\onnx\resnet #### TensorRT -1. 编译 examples - - 在mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0\\sdk\\example目录下 - - ``` - // 部分路径根据所在硬盘的位置进行修改 - mkdir build - cd build - cmake ..\cpp -A x64 -T v142 ` - -DOpenCV_DIR=C:\Deps\opencv\build\x64\vc15\lib ` - -DMMDeploy_DIR=C:\workspace\mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8 2.3.0\sdk\lib\cmake\MMDeploy ` - -DTENSORRT_DIR=C:\Deps\tensorrt\TensorRT-8.2.3.0 ` - -DCUDNN_DIR=C:\Deps\cudnn\8.2.1 - cmake --build . --config Release - ``` - -2. 添加环境变量或拷贝动态库到exe同级目录 +1. 添加环境变量 - :point_right: 目的是使exe运行时可以正确找到相关dll + 可根据 SDK 文件夹内的 README.md 使用脚本添加环境变量 - 若选择添加环境变量,则将`mmdeploy`的运行时库路径(`mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0\sdk\bin`)添加到PATH,可参考onnxruntime的添加过程。 +2. 编译 examples - 若选择拷贝动态库,而将bin目录中的dll拷贝到刚才编译出的exe(build/Release)的同级目录下。 + 可根据 SDK 文件夹内的 README.md 使用脚本进行编译 3. 推理 这里建议使用cmd,这样如果exe运行时如果找不到相关的dll的话会有弹窗 - 在mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0\\sdk\\example\\build\\Release目录下: + 在mmdeploy-0.13.0-windows-amd64-cuda11.1-tensorrt8.2.3.0\\example\\cpp\\build\\Release目录下: ``` .\image_classification.exe cuda C:\workspace\work_dir\trt\resnet C:\workspace\mmclassification\demo\demo.JPEG diff --git a/docs/zh_cn/get_started.md b/docs/zh_cn/get_started.md index 8a02f6c66f..aa3151cf34 100644 --- a/docs/zh_cn/get_started.md +++ b/docs/zh_cn/get_started.md @@ -65,7 +65,7 @@ mim install mmcv-full **第二步**: 安装 MMDeploy 和 推理引擎 -我们推荐用户使用预编译包安装和体验 MMDeploy 功能。请根据目标软硬件平台,从[这里](https://github.com/open-mmlab/mmdeploy/releases) 选择最新版本下载并安装。 +我们推荐用户使用预编译包安装和体验 MMDeploy 功能。目前提供模型转换(trt/ort)以及 SDK 推理的 pypi 预编译包,SDK 的 c/cpp 库可从[这里](https://github.com/open-mmlab/mmdeploy/releases) 选择最新版本下载并安装。 目前,MMDeploy 的预编译包支持的平台和设备矩阵如下: @@ -87,7 +87,7 @@ mim install mmcv-full CUDA - N + Y Y @@ -98,7 +98,7 @@ mim install mmcv-full CUDA - N + Y Y @@ -109,46 +109,43 @@ mim install mmcv-full 以最新的预编译包为例,你可以参考以下命令安装:
-Linux-x86_64, CPU, ONNX Runtime 1.8.1 - -```shell -# 安装 MMDeploy ONNX Runtime 自定义算子库和推理 SDK -wget https://github.com/open-mmlab/mmdeploy/releases/download/v0.13.0/mmdeploy-0.13.0-linux-x86_64-onnxruntime1.8.1.tar.gz -tar -zxvf mmdeploy-0.13.0-linux-x86_64-onnxruntime1.8.1.tar.gz -cd mmdeploy-0.13.0-linux-x86_64-onnxruntime1.8.1 -pip install dist/mmdeploy-0.13.0-py3-none-linux_x86_64.whl -pip install sdk/python/mmdeploy_runtime-0.13.0-cp38-none-linux_x86_64.whl -cd .. -# 安装推理引擎 ONNX Runtime -pip install onnxruntime==1.8.1 -wget https://github.com/microsoft/onnxruntime/releases/download/v1.8.1/onnxruntime-linux-x64-1.8.1.tgz -tar -zxvf onnxruntime-linux-x64-1.8.1.tgz -export ONNXRUNTIME_DIR=$(pwd)/onnxruntime-linux-x64-1.8.1 -export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$LD_LIBRARY_PATH -``` - -
- -
-Linux-x86_64, CUDA 11.x, TensorRT 8.2.3.0 +Linux-x86_64 ```shell -# 安装 MMDeploy TensorRT 自定义算子库和推理 SDK -wget https://github.com/open-mmlab/mmdeploy/releases/download/v0.13.0/mmdeploy-0.13.0-linux-x86_64-cuda11.1-tensorrt8.2.3.0.tar.gz -tar -zxvf mmdeploy-0.13.0-linux-x86_64-cuda11.1-tensorrt8.2.3.0.tar.gz -cd mmdeploy-0.13.0-linux-x86_64-cuda11.1-tensorrt8.2.3.0 -pip install dist/mmdeploy-0.13.0-py3-none-linux_x86_64.whl -pip install sdk/python/mmdeploy_runtime-0.13.0-cp38-none-linux_x86_64.whl -cd .. -# 安装推理引擎 TensorRT -# !!! 从 NVIDIA 官网下载 TensorRT-8.2.3.0 CUDA 11.x 安装包并解压到当前目录 +# 1. 安装 MMDeploy 模型转换工具(含trt/ort自定义算子) +pip install mmdeploy==0.13.0 + +# 2. 安装 MMDeploy SDK推理工具 +# 根据是否需要GPU推理可任选其一进行下载安装 +# 2.1 支持 onnxruntime 推理 +pip install mmdeploy-runtime==0.13.0 +# 2.2 支持 onnxruntime-gpu tensorrt 推理 +pip install mmdeploy-runtime-gpu==0.13.0 + +# 3. 安装推理引擎 +# 3.1 安装推理引擎 TensorRT +# !!! 若要进行 TensorRT 模型的转换以及推理,从 NVIDIA 官网下载 TensorRT-8.2.3.0 CUDA 11.x 安装包并解压到当前目录。 pip install TensorRT-8.2.3.0/python/tensorrt-8.2.3.0-cp38-none-linux_x86_64.whl pip install pycuda export TENSORRT_DIR=$(pwd)/TensorRT-8.2.3.0 export LD_LIBRARY_PATH=${TENSORRT_DIR}/lib:$LD_LIBRARY_PATH -# !!! 从 NVIDIA 官网下载 cuDNN 8.2.1 CUDA 11.x 安装包并解压到当前目录 +# !!! 另外还需要从 NVIDIA 官网下载 cuDNN 8.2.1 CUDA 11.x 安装包并解压到当前目录 export CUDNN_DIR=$(pwd)/cuda export LD_LIBRARY_PATH=$CUDNN_DIR/lib64:$LD_LIBRARY_PATH + +# 3.2 安装推理引擎 ONNX Runtime +# 根据是否需要GPU推理可任选其一进行下载安装 +# 3.2.1 onnxruntime +wget https://github.com/microsoft/onnxruntime/releases/download/v1.8.1/onnxruntime-linux-x64-1.8.1.tgz +tar -zxvf onnxruntime-linux-x64-1.8.1.tgz +export ONNXRUNTIME_DIR=$(pwd)/onnxruntime-linux-x64-1.8.1 +export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$LD_LIBRARY_PATH +# 3.2.2 onnxruntime-gpu +pip install onnxruntime-gpu==1.8.1 +wget https://github.com/microsoft/onnxruntime/releases/download/v1.8.1/onnxruntime-linux-x64-gpu-1.8.1.tgz +tar -zxvf onnxruntime-linux-x64-gpu-1.8.1.tgz +export ONNXRUNTIME_DIR=$(pwd)/onnxruntime-linux-x64-gpu-1.8.1 +export LD_LIBRARY_PATH=$ONNXRUNTIME_DIR/lib:$LD_LIBRARY_PATH ```
@@ -193,7 +190,7 @@ python mmdeploy/tools/deploy.py \ 转换结果被保存在 `--work-dir` 指向的文件夹中。**该文件夹中不仅包含推理后端模型,还包括推理元信息。这些内容的整体被定义为 SDK Model。推理 SDK 将用它进行模型推理。** ```{tip} -在安装了 MMDeploy-ONNXRuntime 预编译包后,把上述转换命令中的detection_tensorrt_dynamic-320x320-1344x1344.py 换成 detection_onnxruntime_dynamic.py,并修改 --device 为 cpu, +把上述转换命令中的detection_tensorrt_dynamic-320x320-1344x1344.py 换成 detection_onnxruntime_dynamic.py,并修改 --device 为 cpu, 即可以转出 onnx 模型,并用 ONNXRuntime 进行推理 ``` @@ -226,12 +223,15 @@ result = inference_model( 你可以直接运行预编译包中的 demo 程序,输入 SDK Model 和图像,进行推理,并查看推理结果。 ```shell -cd mmdeploy-0.13.0-linux-x86_64-cuda11.1-tensorrt8.2.3.0 +wget https://github.com/open-mmlab/mmdeploy/releases/download/v0.13.0/mmdeploy-0.13.0-linux-x86_64-cuda11.3.tar.gz +tar xf mmdeploy-0.13.0-linux-x86_64-cuda11.3 + +cd mmdeploy-0.13.0-linux-x86_64-cuda11.3 # 运行 python demo -python sdk/example/python/object_detection.py cuda ../mmdeploy_model/faster-rcnn ../mmdetection/demo/demo.jpg +python example/python/object_detection.py cuda ../mmdeploy_model/faster-rcnn ../mmdetection/demo/demo.jpg # 运行 C/C++ demo -export LD_LIBRARY_PATH=$(pwd)/sdk/lib:$LD_LIBRARY_PATH -./sdk/bin/object_detection cuda ../mmdeploy_model/faster-rcnn ../mmdetection/demo/demo.jpg +# 根据文件夹内的 README.md 进行编译 +./bin/object_detection cuda ../mmdeploy_model/faster-rcnn ../mmdetection/demo/demo.jpg ``` ```{note} diff --git a/tools/package_tools/generate_build_config.py b/tools/package_tools/generate_build_config.py index a7c7139568..1040bb73fd 100644 --- a/tools/package_tools/generate_build_config.py +++ b/tools/package_tools/generate_build_config.py @@ -63,6 +63,7 @@ def parse_arguments(): '--cudnn-dir', type=str, help='cudnn root dir, default use $ENV{CUDNN_DIR}') + parser.add_argument('--cxx11abi', action='store_true', help='new cxxabi') parser.add_argument( '--output', required=True, type=str, help='output config file path') @@ -139,8 +140,10 @@ def generate_config(args): # sdk package template if args.system in ['windows', 'linux']: name = 'mmdeploy-{mmdeploy_v}-{system}-{machine}' + if args.cxx11abi: + name = name + '-cxx11abi' if args.device == 'cpu': - name = '{}-cpu'.format(name) + pass elif args.device == 'cuda': name = '{}-cuda'.format(name) + '{cuda_v}' else: diff --git a/tools/package_tools/scripts/linux/README.md b/tools/package_tools/scripts/linux/README.md index 85d65b3cd8..4e44b47cf9 100644 --- a/tools/package_tools/scripts/linux/README.md +++ b/tools/package_tools/scripts/linux/README.md @@ -8,8 +8,11 @@ 2. set environment variable and path in sdk folder: - `source ./set_env.sh` \ - (**you have to additionally install cuda and cudnn if you use sdk cuda version**) + `source ./set_env.sh` + + (**you have to additionally install cuda and cudnn if use sdk cuda version**) + + (**may need to set CUDNN environment variable point to cudnn root folder if use sdk cuda version**) 3. build sdk in sdk folder: diff --git a/tools/package_tools/scripts/windows/README.md b/tools/package_tools/scripts/windows/README.md index e11d269a9b..7d6cdf05f0 100644 --- a/tools/package_tools/scripts/windows/README.md +++ b/tools/package_tools/scripts/windows/README.md @@ -12,7 +12,12 @@ in sdk folder: `. .\set_env.ps1` - (you have to additionally install cuda and cudnn if you use sdk cuda version) + + if you use sdk cuda version: + + (**you have to additionally install cuda and cudnn if use sdk cuda version**) + + (**may need to set CUDNN environment variable point to cudnn root folder if use sdk cuda version**) 4. build sdk in sdk folder: diff --git a/tools/package_tools/test/test_sdk.sh b/tools/package_tools/test/test_sdk.sh index ec87596ffa..472a8d5b4c 100755 --- a/tools/package_tools/test/test_sdk.sh +++ b/tools/package_tools/test/test_sdk.sh @@ -11,14 +11,14 @@ fi pushd $WORKSPACE pushd $SDK_DIR -test_pkg=$(ls | grep *cpu*) +test_pkg=$(find "." -type d -iname "*-x86_64") work_dir=/tmp/_test cp -r $test_pkg $work_dir pushd $work_dir # opencv -if [[ ! -d $OpenCV_DIR ]]; then +if [ ! -d "$OpenCV_DIR" ]; then ./install_opencv.sh fi