-
Notifications
You must be signed in to change notification settings - Fork 648
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tools/deploy.py): support snpe (#789)
* fix(tools/deploy.py): support snpe * improvement(backend/snpe): review advices * docs(backend/snpe): update build * docs(backend/snpe): server support specify port * docs(backend/snpe): update path * fix(backend/snpe): time counter missing argument * docs(backend/snpe): add missing argument * docs(backend/snpe): update download and using * improvement(snpe_net.cpp): load model with modeldata
- Loading branch information
1 parent
f54854e
commit 2968a18
Showing
64 changed files
with
3,238 additions
and
54 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 @@ | ||
name: backend-snpe | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- "demo/**" | ||
- "tools/**" | ||
|
||
pull_request: | ||
paths-ignore: | ||
- "demo/**" | ||
- "tools/**" | ||
- "docs/**" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build_sdk_demo: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: 'recursive' | ||
- name: update | ||
run: sudo apt update | ||
- name: Install dependencies | ||
run: | | ||
sudo apt install wget libprotobuf-dev protobuf-compiler | ||
sudo apt update | ||
sudo apt install -y ffmpeg libsm6 libxext6 git ninja-build libglib2.0-0 libxrender-dev libc++1-9 libc++abi1-9 | ||
sudo add-apt-repository ppa:ignaciovizzo/opencv3-nonfree | ||
sudo apt install libopencv-dev | ||
pkg-config --libs opencv | ||
- name: Install snpe | ||
run: | | ||
wget https://media.githubusercontent.com/media/tpoisonooo/mmdeploy_snpe_testdata/main/snpe-1.59.tar.gz | ||
tar xf snpe-1.59.tar.gz | ||
pushd snpe-1.59.0.3230 | ||
pwd | ||
popd | ||
- name: Build SDK Demo with SNPE backend | ||
run: | | ||
mkdir -p build && pushd build | ||
export SNPE_ROOT=/home/runner/work/mmdeploy/mmdeploy/snpe-1.59.0.3230 | ||
export LD_LIBRARY_PATH=${SNPE_ROOT}/lib/x86_64-linux-clang:${LD_LIBRARY_PATH} | ||
export MMDEPLOY_SNPE_X86_CI=1 | ||
cmake .. -DCMAKE_CXX_COMPILER=g++-7 -DMMDEPLOY_SHARED_LIBS=ON -DMMDEPLOY_BUILD_SDK=ON -DMMDEPLOY_BUILD_SDK_PYTHON_API=OFF -DMMDEPLOY_TARGET_DEVICES=cpu -DMMDEPLOY_TARGET_BACKENDS=snpe -DMMDEPLOY_CODEBASES=all | ||
make -j2 | ||
make install | ||
pushd install/example | ||
mkdir build && pushd build | ||
cmake .. -DMMDeploy_DIR=${PWD}/../../lib/cmake/MMDeploy | ||
make -j2 | ||
ls ./* | ||
popd | ||
popd | ||
popd |
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 |
---|---|---|
|
@@ -152,3 +152,7 @@ bin/ | |
mmdeploy/backend/ncnn/onnx2ncnn | ||
|
||
/mmdeploy-* | ||
|
||
# snpe | ||
grpc-cpp-plugin | ||
service/snpe/grpc_cpp_plugin |
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 @@ | ||
backend_config = dict(type='snpe') |
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,3 @@ | ||
_base_ = ['./classification_static.py', '../_base_/backends/snpe.py'] | ||
|
||
onnx_config = dict(input_shape=None) |
2 changes: 2 additions & 0 deletions
2
configs/mmedit/super-resolution/super-resolution_snpe_static-256x256.py
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,2 @@ | ||
_base_ = ['./super-resolution_static.py', '../../_base_/backends/snpe.py'] | ||
onnx_config = dict(input_shape=[256, 256]) |
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,3 @@ | ||
_base_ = ['./text-detection_static.py', '../../_base_/backends/snpe.py'] | ||
|
||
onnx_config = dict(input_shape=None) |
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,3 @@ | ||
_base_ = ['./pose-detection_static.py', '../_base_/backends/snpe.py'] | ||
|
||
onnx_config = dict(input_shape=[256, 256]) |
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,3 @@ | ||
_base_ = ['./segmentation_static.py', '../_base_/backends/snpe.py'] | ||
|
||
onnx_config = dict(input_shape=[1024, 512]) |
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,25 @@ | ||
# Copyright (c) OpenMMLab. All rights reserved. | ||
|
||
project(mmdeploy_snpe_net) | ||
|
||
add_library(snpe SHARED IMPORTED) | ||
|
||
if(NOT DEFINED ENV{MMDEPLOY_SNPE_X86_CI}) | ||
set(sub_dir "aarch64-android-clang6.0") | ||
else() | ||
set(sub_dir "x86_64-linux-clang") | ||
endif() | ||
|
||
if (NOT EXISTS $ENV{SNPE_ROOT}/lib/${sub_dir}/) | ||
message(ERROR "SNPE_ROOT directory not exist: $ENV{SNPE_ROOT}/lib/${sub_dir}/") | ||
endif() | ||
message(STATUS "SNPE lib directory $ENV{SNPE_ROOT}/lib/${sub_dir}/") | ||
|
||
set_target_properties(snpe PROPERTIES | ||
IMPORTED_LOCATION "$ENV{SNPE_ROOT}/lib/${sub_dir}/libSNPE.so" | ||
INTERFACE_INCLUDE_DIRECTORIES "$ENV{SNPE_ROOT}/include/zdl" | ||
) | ||
|
||
mmdeploy_add_module(${PROJECT_NAME} snpe_net.cpp) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE snpe) | ||
add_library(mmdeploy::snpe_net ALIAS ${PROJECT_NAME}) |
Oops, something went wrong.