From c0a47962f734d767d9b2ee8c25e4033a04c7f75b Mon Sep 17 00:00:00 2001 From: hukang hwx963878 <252664817@qq.com> Date: Tue, 16 Mar 2021 17:08:18 +0800 Subject: [PATCH] update mindspore lite 1.1.0 to 1.1.1 --- .../lite/image_classification/README.en.md | 13 +++++----- .../lite/image_classification/README.md | 14 +++++------ .../image_classification/app/CMakeLists.txt | 24 +++---------------- .../image_classification/app/build.gradle | 2 +- .../image_classification/app/download.gradle | 4 ++-- .../app/src/main/cpp/MindSporeNetnative.cpp | 4 ++-- 6 files changed, 20 insertions(+), 41 deletions(-) diff --git a/model_zoo/official/lite/image_classification/README.en.md b/model_zoo/official/lite/image_classification/README.en.md index fcc3615e7c..bea31bbd6f 100644 --- a/model_zoo/official/lite/image_classification/README.en.md +++ b/model_zoo/official/lite/image_classification/README.en.md @@ -77,6 +77,7 @@ app │ | │ ├── cpp # main logic encapsulation classes for model loading and prediction | | | +| | ├── mindspore_lite_x.x.x-runtime-arm64-cpu #MindSpore Lite Version | | ├── MindSporeNetnative.cpp # JNI methods related to MindSpore calling │ | └── MindSporeNetnative.h # header file │ | @@ -105,7 +106,7 @@ In this example, the build process automatically downloads the `mindspore-lite-1 Note: if the automatic download fails, please manually download the relevant library files and put them in the corresponding location. -mindspore-lite-1.1.0-inference-android.tar.gz [Download link](https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.1.0/MindSpore/lite/release/android/mindspore-lite-1.1.0-inference-android.tar.gz) +mindspore-lite-1.1.1-runtime-arm64-cpu.tar.gz [Download link](https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.1.1/MindSpore/lite/release_0220/android/mindspore-lite-1.1.1-runtime-arm64-cpu.tar.gz) ```text android{ @@ -113,6 +114,7 @@ android{ externalNativeBuild{ cmake{ arguments "-DANDROID_STL=c++_shared" + cppFlags "-std=c++17 -fexceptions -frtti" } } @@ -128,19 +130,16 @@ Create a link to the `.so` library file in the `app/CMakeLists.txt` file: ```text # ============== Set MindSpore Dependencies. ============= include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp) -include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/third_party/flatbuffers/include) include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}) include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/include) -include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/include/ir/dtype) -include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/include/schema) -add_library(mindspore-lite SHARED IMPORTED ) -add_library(minddata-lite SHARED IMPORTED ) +add_library(mindspore-lite SHARED IMPORTED) +add_library(minddata-lite SHARED IMPORTED) set_target_properties(mindspore-lite PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/lib/libmindspore-lite.so) set_target_properties(minddata-lite PROPERTIES IMPORTED_LOCATION - ${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/lib/libminddata-lite.so) + ${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/minddata/lib/libminddata-lite.so) # --------------- MindSpore Lite set End. -------------------- # Link target library. diff --git a/model_zoo/official/lite/image_classification/README.md b/model_zoo/official/lite/image_classification/README.md index 4300bcded5..dfa92b2d64 100644 --- a/model_zoo/official/lite/image_classification/README.md +++ b/model_zoo/official/lite/image_classification/README.md @@ -83,7 +83,7 @@ app │ | │ ├── cpp # 模型加载和预测主要逻辑封装类 | | ├── .. -| | ├── mindspore_lite_x.x.x-minddata-arm64-cpu #MindSpore Lite版本 +| | ├── mindspore_lite_x.x.x-runtime-arm64-cpu #MindSpore Lite版本 | | ├── MindSporeNetnative.cpp # MindSpore调用相关的JNI方法 │ | └── MindSporeNetnative.h # 头文件 | | └── MsNetWork.cpp # MindSpre接口封装 @@ -119,7 +119,7 @@ Android JNI层调用MindSpore C++ API时,需要相关库文件支持。可通 > 若自动下载失败,请手动下载相关库文件,解压并放在对应位置: - mindspore-lite-1.1.0-inference-android.tar.gz [下载链接](https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.1.0/MindSpore/lite/release/android/mindspore-lite-1.1.0-inference-android.tar.gz) + mindspore-lite-1.1.1-runtime-arm64-cpu.tar.gz [下载链接](https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.1.1/MindSpore/lite/release_0220/android/mindspore-lite-1.1.1-runtime-arm64-cpu.tar.gz) 在app的`build.gradle`文件中配置CMake编译支持,以及`arm64-v8a`的编译支持,如下所示: @@ -129,6 +129,7 @@ android{ externalNativeBuild{ cmake{ arguments "-DANDROID_STL=c++_shared" + cppFlags "-std=c++17 -fexceptions -frtti" } } @@ -144,19 +145,16 @@ android{ ```text # ============== Set MindSpore Dependencies. ============= include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp) -include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/third_party/flatbuffers/include) include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}) include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/include) -include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/include/ir/dtype) -include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/include/schema) -add_library(mindspore-lite SHARED IMPORTED ) -add_library(minddata-lite SHARED IMPORTED ) +add_library(mindspore-lite SHARED IMPORTED) +add_library(minddata-lite SHARED IMPORTED) set_target_properties(mindspore-lite PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/lib/libmindspore-lite.so) set_target_properties(minddata-lite PROPERTIES IMPORTED_LOCATION - ${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/lib/libminddata-lite.so) + ${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/minddata/lib/libminddata-lite.so) # --------------- MindSpore Lite set End. -------------------- # Link target library. diff --git a/model_zoo/official/lite/image_classification/app/CMakeLists.txt b/model_zoo/official/lite/image_classification/app/CMakeLists.txt index c51c684b29..175b1f24c3 100644 --- a/model_zoo/official/lite/image_classification/app/CMakeLists.txt +++ b/model_zoo/official/lite/image_classification/app/CMakeLists.txt @@ -8,34 +8,20 @@ cmake_minimum_required(VERSION 3.4.1) set(CMAKE_VERBOSE_MAKEFILE on) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}) -set(MINDSPORELITE_VERSION mindspore-lite-1.1.0-inference-android) +set(MINDSPORELITE_VERSION mindspore-lite-1.1.1-runtime-arm64-cpu) # ============== Set MindSpore Dependencies. ============= include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp) -include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/third_party/flatbuffers/include) -include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/third_party/hiai_ddk/lib/aarch64) include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}) include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/include) -include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/include/ir/dtype) -include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/include/schema) -include_directories(${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/minddata/include) add_library(mindspore-lite SHARED IMPORTED) add_library(minddata-lite SHARED IMPORTED) -add_library(hiai SHARED IMPORTED) -add_library(hiai_ir SHARED IMPORTED) -add_library(hiai_ir_build SHARED IMPORTED) set_target_properties(mindspore-lite PROPERTIES IMPORTED_LOCATION - ${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/lib/aarch64/libmindspore-lite.so) + ${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/lib/libmindspore-lite.so) set_target_properties(minddata-lite PROPERTIES IMPORTED_LOCATION - ${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/minddata/lib/aarch64/libminddata-lite.so) -set_target_properties(hiai PROPERTIES IMPORTED_LOCATION - ${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/third_party/hiai_ddk/lib/aarch64/libhiai.so) -set_target_properties(hiai_ir PROPERTIES IMPORTED_LOCATION - ${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/third_party/hiai_ddk/lib/aarch64/libhiai_ir.so) -set_target_properties(hiai_ir_build PROPERTIES IMPORTED_LOCATION - ${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/third_party/hiai_ddk/lib/aarch64/libhiai_ir_build.so) + ${CMAKE_SOURCE_DIR}/src/main/cpp/${MINDSPORELITE_VERSION}/minddata/lib/libminddata-lite.so) # --------------- MindSpore Lite set End. -------------------- @@ -83,10 +69,6 @@ target_link_libraries( # Specifies the target library. # --- mindspore --- minddata-lite mindspore-lite - hiai - hiai_ir - hiai_ir_build - # libmindspore-lite-fp16 # --- other dependencies.--- -ljnigraphics diff --git a/model_zoo/official/lite/image_classification/app/build.gradle b/model_zoo/official/lite/image_classification/app/build.gradle index 7e4b0e8b2c..db3f6d37af 100644 --- a/model_zoo/official/lite/image_classification/app/build.gradle +++ b/model_zoo/official/lite/image_classification/app/build.gradle @@ -15,7 +15,7 @@ android { externalNativeBuild { cmake { arguments "-DANDROID_STL=c++_shared" - cppFlags "" + cppFlags "-std=c++17 -fexceptions -frtti" } } ndk { diff --git a/model_zoo/official/lite/image_classification/app/download.gradle b/model_zoo/official/lite/image_classification/app/download.gradle index 62e558a887..9b32e9b611 100644 --- a/model_zoo/official/lite/image_classification/app/download.gradle +++ b/model_zoo/official/lite/image_classification/app/download.gradle @@ -4,13 +4,13 @@ * The libraries can be downloaded manually. */ def targetMindSporeInclude = "src/main/cpp/" -def mindsporeLite_Version = "mindspore-lite-1.1.0-inference-android" +def mindsporeLite_Version = "mindspore-lite-1.1.1-runtime-arm64-cpu" def targetModelFile = "src/main/assets/model/mobilenetv2.ms" def mindSporeLibrary_arm64 = "src/main/cpp/${mindsporeLite_Version}.tar.gz" def modelDownloadUrl = "https://download.mindspore.cn/model_zoo/official/lite/mobilenetv2_openimage_lite/mobilenetv2.ms" -def mindsporeLiteDownloadUrl = "https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.1.0/MindSpore/lite/release/android/${mindsporeLite_Version}.tar.gz" +def mindsporeLiteDownloadUrl = "https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.1.1/MindSpore/lite/release_0220/android/${mindsporeLite_Version}.tar.gz" def cleantargetMindSporeInclude = "src/main/cpp" diff --git a/model_zoo/official/lite/image_classification/app/src/main/cpp/MindSporeNetnative.cpp b/model_zoo/official/lite/image_classification/app/src/main/cpp/MindSporeNetnative.cpp index 796aae398e..6a684b5905 100644 --- a/model_zoo/official/lite/image_classification/app/src/main/cpp/MindSporeNetnative.cpp +++ b/model_zoo/official/lite/image_classification/app/src/main/cpp/MindSporeNetnative.cpp @@ -27,8 +27,8 @@ #include "include/ms_tensor.h" #include "MindSporeNetnative.h" #include "MSNetWork.h" -#include "lite_cv/lite_mat.h" -#include "lite_cv/image_process.h" +#include "minddata/include/lite_cv/lite_mat.h" +#include "minddata/include/lite_cv/image_process.h" using mindspore::dataset::LiteMat; using mindspore::dataset::LPixelType;