From 1da821a871515bfade3f78728336b799bbaa5882 Mon Sep 17 00:00:00 2001 From: yeliang2258 <30516196+yeliang2258@users.noreply.github.com> Date: Wed, 28 Dec 2022 10:46:55 +0800 Subject: [PATCH] [Other]Add FlyCV for RV1126 (#985) * add FlyCV for RV1126 * update CMake --- cmake/flycv.cmake | 2 ++ docs/cn/build_and_install/rv1126.md | 1 + docs/en/build_and_install/rv1126.md | 1 + .../paddleclas/rv1126/cpp/CMakeLists.txt | 16 ++++------------ .../paddleclas/rv1126/cpp/infer.cc | 2 +- .../paddledetection/rv1126/cpp/CMakeLists.txt | 16 ++++------------ .../paddledetection/rv1126/cpp/infer_ppyoloe.cc | 2 +- .../detection/yolov5/rv1126/cpp/CMakeLists.txt | 15 ++++----------- .../vision/detection/yolov5/rv1126/cpp/infer.cc | 2 +- .../paddleseg/rv1126/cpp/CMakeLists.txt | 16 ++++------------ .../segmentation/paddleseg/rv1126/cpp/infer.cc | 2 +- 11 files changed, 24 insertions(+), 51 deletions(-) diff --git a/cmake/flycv.cmake b/cmake/flycv.cmake index 0836aba547..d1e63d1049 100755 --- a/cmake/flycv.cmake +++ b/cmake/flycv.cmake @@ -84,6 +84,8 @@ else() else() if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") set(FLYCV_FILE "flycv-linux-aarch64-${FLYCV_VERSION}.tgz") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm") + set(FLYCV_FILE "flycv-linux-armhf-${FLYCV_VERSION}.tgz") else() set(FLYCV_FILE "flycv-linux-x64-${FLYCV_VERSION}.tgz") endif() diff --git a/docs/cn/build_and_install/rv1126.md b/docs/cn/build_and_install/rv1126.md index 95627045d9..159ac00e4d 100755 --- a/docs/cn/build_and_install/rv1126.md +++ b/docs/cn/build_and_install/rv1126.md @@ -61,6 +61,7 @@ mkdir build && cd build cmake -DCMAKE_TOOLCHAIN_FILE=./../cmake/toolchain.cmake \ -DWITH_TIMVX=ON \ -DTARGET_ABI=armhf \ + -DENABLE_FLYCV=ON \ # 是否开启 FlyCV 优化前后处理,可以选择开启 -DCMAKE_INSTALL_PREFIX=fastdeploy-timvx \ -DENABLE_VISION=ON \ # 是否编译集成视觉模型的部署模块,可选择开启 -Wno-dev .. diff --git a/docs/en/build_and_install/rv1126.md b/docs/en/build_and_install/rv1126.md index 91f4edf799..de9c563ab5 100755 --- a/docs/en/build_and_install/rv1126.md +++ b/docs/en/build_and_install/rv1126.md @@ -60,6 +60,7 @@ mkdir build && cd build cmake -DCMAKE_TOOLCHAIN_FILE=./../cmake/toolchain.cmake \ -DWITH_TIMVX=ON \ -DTARGET_ABI=armhf \ + -DENABLE_FLYCV=ON \ # Whether to enable FlyCV optimization -DCMAKE_INSTALL_PREFIX=fastdeploy-timvx \ -DENABLE_VISION=ON \ # Whether to compile the vision module -Wno-dev .. diff --git a/examples/vision/classification/paddleclas/rv1126/cpp/CMakeLists.txt b/examples/vision/classification/paddleclas/rv1126/cpp/CMakeLists.txt index baaf8331f1..64b7a64661 100755 --- a/examples/vision/classification/paddleclas/rv1126/cpp/CMakeLists.txt +++ b/examples/vision/classification/paddleclas/rv1126/cpp/CMakeLists.txt @@ -20,19 +20,11 @@ install(TARGETS infer_demo DESTINATION ./) install(DIRECTORY models DESTINATION ./) install(DIRECTORY images DESTINATION ./) -# install(DIRECTORY run_with_adb.sh DESTINATION ./) -file(GLOB FASTDEPLOY_LIBS ${FASTDEPLOY_INSTALL_DIR}/lib/*) -install(PROGRAMS ${FASTDEPLOY_LIBS} DESTINATION lib) - -file(GLOB OPENCV_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/opencv/lib/lib*) -install(PROGRAMS ${OPENCV_LIBS} DESTINATION lib) - -file(GLOB PADDLELITE_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/paddlelite/lib/lib*) -install(PROGRAMS ${PADDLELITE_LIBS} DESTINATION lib) - -file(GLOB TIMVX_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/paddlelite/lib/verisilicon_timvx/*) -install(PROGRAMS ${TIMVX_LIBS} DESTINATION lib) +file(GLOB_RECURSE FASTDEPLOY_LIBS ${FASTDEPLOY_INSTALL_DIR}/lib/lib*.so*) +file(GLOB_RECURSE ALL_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/lib*.so*) +list(APPEND ALL_LIBS ${FASTDEPLOY_LIBS}) +install(PROGRAMS ${ALL_LIBS} DESTINATION lib) file(GLOB ADB_TOOLS run_with_adb.sh) install(PROGRAMS ${ADB_TOOLS} DESTINATION ./) diff --git a/examples/vision/classification/paddleclas/rv1126/cpp/infer.cc b/examples/vision/classification/paddleclas/rv1126/cpp/infer.cc index 140311eec5..b1b6f435b5 100755 --- a/examples/vision/classification/paddleclas/rv1126/cpp/infer.cc +++ b/examples/vision/classification/paddleclas/rv1126/cpp/infer.cc @@ -23,7 +23,7 @@ void InitAndInfer(const std::string& model_dir, const std::string& image_file) { auto model_file = model_dir + sep + "inference.pdmodel"; auto params_file = model_dir + sep + "inference.pdiparams"; auto config_file = model_dir + sep + "inference_cls.yaml"; - + fastdeploy::vision::EnableFlyCV(); fastdeploy::RuntimeOption option; option.UseTimVX(); diff --git a/examples/vision/detection/paddledetection/rv1126/cpp/CMakeLists.txt b/examples/vision/detection/paddledetection/rv1126/cpp/CMakeLists.txt index 7a145177ee..d5627b4e79 100755 --- a/examples/vision/detection/paddledetection/rv1126/cpp/CMakeLists.txt +++ b/examples/vision/detection/paddledetection/rv1126/cpp/CMakeLists.txt @@ -20,19 +20,11 @@ install(TARGETS infer_demo DESTINATION ./) install(DIRECTORY models DESTINATION ./) install(DIRECTORY images DESTINATION ./) -# install(DIRECTORY run_with_adb.sh DESTINATION ./) -file(GLOB FASTDEPLOY_LIBS ${FASTDEPLOY_INSTALL_DIR}/lib/*) -install(PROGRAMS ${FASTDEPLOY_LIBS} DESTINATION lib) - -file(GLOB OPENCV_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/opencv/lib/lib*) -install(PROGRAMS ${OPENCV_LIBS} DESTINATION lib) - -file(GLOB PADDLELITE_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/paddlelite/lib/lib*) -install(PROGRAMS ${PADDLELITE_LIBS} DESTINATION lib) - -file(GLOB TIMVX_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/paddlelite/lib/verisilicon_timvx/*) -install(PROGRAMS ${TIMVX_LIBS} DESTINATION lib) +file(GLOB_RECURSE FASTDEPLOY_LIBS ${FASTDEPLOY_INSTALL_DIR}/lib/lib*.so*) +file(GLOB_RECURSE ALL_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/lib*.so*) +list(APPEND ALL_LIBS ${FASTDEPLOY_LIBS}) +install(PROGRAMS ${ALL_LIBS} DESTINATION lib) file(GLOB ADB_TOOLS run_with_adb.sh) install(PROGRAMS ${ADB_TOOLS} DESTINATION ./) diff --git a/examples/vision/detection/paddledetection/rv1126/cpp/infer_ppyoloe.cc b/examples/vision/detection/paddledetection/rv1126/cpp/infer_ppyoloe.cc index 609a41d4ba..c7b81f9f98 100755 --- a/examples/vision/detection/paddledetection/rv1126/cpp/infer_ppyoloe.cc +++ b/examples/vision/detection/paddledetection/rv1126/cpp/infer_ppyoloe.cc @@ -24,7 +24,7 @@ void InitAndInfer(const std::string& model_dir, const std::string& image_file) { auto params_file = model_dir + sep + "model.pdiparams"; auto config_file = model_dir + sep + "infer_cfg.yml"; auto subgraph_file = model_dir + sep + "subgraph.txt"; - + fastdeploy::vision::EnableFlyCV(); fastdeploy::RuntimeOption option; option.UseTimVX(); option.SetLiteSubgraphPartitionPath(subgraph_file); diff --git a/examples/vision/detection/yolov5/rv1126/cpp/CMakeLists.txt b/examples/vision/detection/yolov5/rv1126/cpp/CMakeLists.txt index 3c9eee38a2..64b7a64661 100755 --- a/examples/vision/detection/yolov5/rv1126/cpp/CMakeLists.txt +++ b/examples/vision/detection/yolov5/rv1126/cpp/CMakeLists.txt @@ -21,17 +21,10 @@ install(TARGETS infer_demo DESTINATION ./) install(DIRECTORY models DESTINATION ./) install(DIRECTORY images DESTINATION ./) -file(GLOB FASTDEPLOY_LIBS ${FASTDEPLOY_INSTALL_DIR}/lib/*) -install(PROGRAMS ${FASTDEPLOY_LIBS} DESTINATION lib) - -file(GLOB OPENCV_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/opencv/lib/lib*) -install(PROGRAMS ${OPENCV_LIBS} DESTINATION lib) - -file(GLOB PADDLELITE_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/paddlelite/lib/lib*) -install(PROGRAMS ${PADDLELITE_LIBS} DESTINATION lib) - -file(GLOB TIMVX_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/paddlelite/lib/verisilicon_timvx/*) -install(PROGRAMS ${TIMVX_LIBS} DESTINATION lib) +file(GLOB_RECURSE FASTDEPLOY_LIBS ${FASTDEPLOY_INSTALL_DIR}/lib/lib*.so*) +file(GLOB_RECURSE ALL_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/lib*.so*) +list(APPEND ALL_LIBS ${FASTDEPLOY_LIBS}) +install(PROGRAMS ${ALL_LIBS} DESTINATION lib) file(GLOB ADB_TOOLS run_with_adb.sh) install(PROGRAMS ${ADB_TOOLS} DESTINATION ./) diff --git a/examples/vision/detection/yolov5/rv1126/cpp/infer.cc b/examples/vision/detection/yolov5/rv1126/cpp/infer.cc index f1cf9e8dc3..3e57ee4d8a 100755 --- a/examples/vision/detection/yolov5/rv1126/cpp/infer.cc +++ b/examples/vision/detection/yolov5/rv1126/cpp/infer.cc @@ -23,7 +23,7 @@ void InitAndInfer(const std::string& model_dir, const std::string& image_file) { auto model_file = model_dir + sep + "model.pdmodel"; auto params_file = model_dir + sep + "model.pdiparams"; auto subgraph_file = model_dir + sep + "subgraph.txt"; - + fastdeploy::vision::EnableFlyCV(); fastdeploy::RuntimeOption option; option.UseTimVX(); option.SetLiteSubgraphPartitionPath(subgraph_file); diff --git a/examples/vision/segmentation/paddleseg/rv1126/cpp/CMakeLists.txt b/examples/vision/segmentation/paddleseg/rv1126/cpp/CMakeLists.txt index baaf8331f1..64b7a64661 100755 --- a/examples/vision/segmentation/paddleseg/rv1126/cpp/CMakeLists.txt +++ b/examples/vision/segmentation/paddleseg/rv1126/cpp/CMakeLists.txt @@ -20,19 +20,11 @@ install(TARGETS infer_demo DESTINATION ./) install(DIRECTORY models DESTINATION ./) install(DIRECTORY images DESTINATION ./) -# install(DIRECTORY run_with_adb.sh DESTINATION ./) -file(GLOB FASTDEPLOY_LIBS ${FASTDEPLOY_INSTALL_DIR}/lib/*) -install(PROGRAMS ${FASTDEPLOY_LIBS} DESTINATION lib) - -file(GLOB OPENCV_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/opencv/lib/lib*) -install(PROGRAMS ${OPENCV_LIBS} DESTINATION lib) - -file(GLOB PADDLELITE_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/paddlelite/lib/lib*) -install(PROGRAMS ${PADDLELITE_LIBS} DESTINATION lib) - -file(GLOB TIMVX_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/paddlelite/lib/verisilicon_timvx/*) -install(PROGRAMS ${TIMVX_LIBS} DESTINATION lib) +file(GLOB_RECURSE FASTDEPLOY_LIBS ${FASTDEPLOY_INSTALL_DIR}/lib/lib*.so*) +file(GLOB_RECURSE ALL_LIBS ${FASTDEPLOY_INSTALL_DIR}/third_libs/install/lib*.so*) +list(APPEND ALL_LIBS ${FASTDEPLOY_LIBS}) +install(PROGRAMS ${ALL_LIBS} DESTINATION lib) file(GLOB ADB_TOOLS run_with_adb.sh) install(PROGRAMS ${ADB_TOOLS} DESTINATION ./) diff --git a/examples/vision/segmentation/paddleseg/rv1126/cpp/infer.cc b/examples/vision/segmentation/paddleseg/rv1126/cpp/infer.cc index f084e6719b..d9f7c33119 100755 --- a/examples/vision/segmentation/paddleseg/rv1126/cpp/infer.cc +++ b/examples/vision/segmentation/paddleseg/rv1126/cpp/infer.cc @@ -24,7 +24,7 @@ void InitAndInfer(const std::string& model_dir, const std::string& image_file) { auto params_file = model_dir + sep + "model.pdiparams"; auto config_file = model_dir + sep + "deploy.yaml"; auto subgraph_file = model_dir + sep + "subgraph.txt"; - + fastdeploy::vision::EnableFlyCV(); fastdeploy::RuntimeOption option; option.UseTimVX(); option.SetLiteSubgraphPartitionPath(subgraph_file);