![]() |
---|
This example serves as a practical guide, illustrating the step-by-step procedure for installing the required dependencies and successfully building the demo from the source code。
.
├── CMakeLists.txt
├── README.md
├── build.bat
|—— lib #Dependencies lib
└── src
├── CMakeLists.txt
├── app #npu_multi_model app source code
├── models
├── onnx # Onnx dependencies
├── processing
└── util
- Visual Studio 2022 (with Desktop dev c++ )
- cmake (version >= 3.26)
- python (version = 3.10)
When you replace the NPU driver or 1x4.xclbin, you need to clear the cache of the old compiled model, they are located in C:\temp\rd\vaip\.cache, and delete everything under this folder.
About how to create conda env please refer to Demo Readme
clone Opencv and Glog
- opencv (version=4.6.0)
git clone https://github.com/opencv/opencv.git -b 4.6.0
cd opencv
mkdir mybuild
cd mybuild
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_CONFIGURATION_TYPES=Release -A x64 -T host=x64 -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX="C:\Program Files\opencv" -DCMAKE_PREFIX_PATH=".\opencv" -DCMAKE_BUILD_TYPE=Release -DBUILD_opencv_python2=OFF -DBUILD_opencv_python3=OFF -DBUILD_WITH_STATIC_CRT=OFF -B build -S ../
cmake --build build --config Release
cmake --install build --config Release
- build gflags & glog
git clone https://github.com/gflags/gflags.git
cd gflags
mkdir mybuild
cd mybuild
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_CONFIGURATION_TYPES=Release -A x64 -T host=x64 -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX="C:\Program Files\gflag" -B build -S ../
cmake --build build --config Release
cmake --install build --config Release
cd ../..
git clone https://github.com/google/glog.git
cd glog
mkdir mybuild
cd mybuild
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_CONFIGURATION_TYPES=Release -A x64 -T host=x64 -G "Visual Studio 17 2022" '-DCMAKE_INSTALL_PREFIX="C:\Program Files\glog" -B build -S ../
cmake --build build --config Release
cmake --install build --config Release
- opencv
python3 -m pip install opencv-python
- pillow
python3 -m pip install pillow
We provide an easy script for compiling and installing the application. After the compilation stage is complete, you will find the executable file generated at bin/ipu_multi_models.exe.
.\build.bat
Output:
-- Installing: ..../bin/npu_multi_models.exe
If you want to run the demo, please follow the instruction in the multi-model-exec directory.