From 32103a915fdcf5ff6c7a5afc2e0d46cb36820005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=A6=E6=99=93=E7=8E=B2?= <3174348550@qq.com> Date: Mon, 22 Sep 2025 16:25:31 +0800 Subject: [PATCH] modify contents --- .../source_en/advanced/image_processing.md | 2 +- docs/lite/docs/source_en/advanced/micro.md | 12 +++++----- .../docs/source_en/advanced/quantization.md | 22 +++++++++--------- docs/lite/docs/source_en/build/build.md | 10 ++++---- .../source_en/converter/converter_tool.md | 23 +++++++++---------- .../source_en/infer/image_segmentation.md | 4 ++-- .../docs/source_en/tools/benchmark_tool.md | 6 ++--- .../docs/source_en/train/converter_train.md | 2 +- docs/lite/docs/source_zh_cn/advanced/micro.md | 10 ++++---- .../source_zh_cn/converter/converter_tool.md | 11 ++++----- 10 files changed, 50 insertions(+), 52 deletions(-) diff --git a/docs/lite/docs/source_en/advanced/image_processing.md b/docs/lite/docs/source_en/advanced/image_processing.md index bb883ea833..4eae5c7ce0 100644 --- a/docs/lite/docs/source_en/advanced/image_processing.md +++ b/docs/lite/docs/source_en/advanced/image_processing.md @@ -38,7 +38,7 @@ The image processing operations here can be used in any combination according to ### Resizing Image -Here we use the [ResizeBilinear](https://www.mindspore.cn/lite/api/en/r2.7.0/generate/function_mindspore_dataset_ResizeBilinear-1.html) function in `image_process.h` to resize the image through a bilinear algorithm. Currently, the supported data type is unit8, and the supported channels are 3 and 1. +Here we use the [ResizeBilinear](https://www.mindspore.cn/lite/api/en/r2.7.0/generate/function_mindspore_dataset_ResizeBilinear-1.html) function in `image_process.h` to resize the image through a bilinear algorithm. Currently, the supported data type is uint8, and the supported channels are 3 and 1. ```cpp bool ResizeBilinear(const LiteMat &src, LiteMat &dst, int dst_w, int dst_h) diff --git a/docs/lite/docs/source_en/advanced/micro.md b/docs/lite/docs/source_en/advanced/micro.md index cd0fc726ab..3c304d1d85 100644 --- a/docs/lite/docs/source_en/advanced/micro.md +++ b/docs/lite/docs/source_en/advanced/micro.md @@ -73,7 +73,7 @@ The following describes how to prepare the environment for using the conversion enable_micro=true - # specify HW target, support x86,Cortex-M, AMR32A, ARM64 only. + # specify HW target, support x86, Cortex-M, AMR32A, ARM64 only. target=x86 @@ -170,7 +170,7 @@ Table 1: micro_param Parameter Definition enable_micro=true - # specify HW target, support x86,Cortex-M, AMR32A, ARM64 only. + # specify HW target, support x86, Cortex-M, AMR32A, ARM64 only. target=x86 @@ -312,7 +312,7 @@ An example of a `x86` multithreaded code generation configuration file is as fol enable_micro=true -# specify HW target, support x86,Cortex-M, AMR32A, ARM64 only. +# specify HW target, support x86, Cortex-M, AMR32A, ARM64 only. target=x86 @@ -363,7 +363,7 @@ An example of Int8 quantitative inference code generation configuration file for # enable code-generation for MCU HW enable_micro=true -# specify HW target, support x86,Cortex-M, ARM32, ARM64 only. +# specify HW target, support x86, Cortex-M, ARM32, ARM64 only. target=Cortex-M # code generation for Inference or Train @@ -436,7 +436,7 @@ For preparing environment section, refer to the [above](#preparing-environment), enable_micro=true - # specify HW target, support x86,Cortex-M, AMR32A, ARM64 only. + # specify HW target, support x86, Cortex-M, AMR32A, ARM64 only. target=x86 @@ -1196,7 +1196,7 @@ Except for MCU, micro inference is a inference model that separates model struct - Export the weights of the inference model based on device-side training, then overwrite the original weight file, and verify it - Next, we will provide a detailed introduction to eace step and its precautions + Next, we will provide a detailed introduction to each step and its precautions ### Exporting Inference Model diff --git a/docs/lite/docs/source_en/advanced/quantization.md b/docs/lite/docs/source_en/advanced/quantization.md index 2cb17df981..099581014d 100644 --- a/docs/lite/docs/source_en/advanced/quantization.md +++ b/docs/lite/docs/source_en/advanced/quantization.md @@ -12,11 +12,11 @@ There are two kinds of quantization algorithms: quantization-aware training and MindSpore Lite post-training quantization currently supports three specific algorithms with the following specifications: -| Algorithm Types | Quantification of Weights | Quantification of Activation | Compression Effect of Model Size | Inference Acceleration Effect | Precision Loss Effect | +| Algorithm Types | Quantization of Weights | Quantization of Activation | Compression Effect of Model Size | Inference Acceleration Effect | Precision Loss Effect | | -------- | ---------- | ---------- | ---------------- | ------------ | ------------ | -| weight quantification | Y | N | Excellent | Average | Excellent | +| weight quantization | Y | N | Excellent | Average | Excellent | | full quantization | Y | Y | Excellent | Good | Average | -| dynamic quantification | Y | Y | Excellent | Good | Good | +| dynamic quantization | Y | Y | Excellent | Good | Good | ### Weight Quantization @@ -118,7 +118,7 @@ For image data, it currently supports the functions of channel adjustment, norma User configuration of full quantization requires at least `[common_quant_param]`, `[data_preprocess_param]`, and `[full_quant_param]`. -> The model calibration data must be co-distributed with the training data, and the Format of the calibration data and that of the inputs of the exported floating-point model need to be consistent. +> The model calibration data must be co-distributed with the training data, and the format of the calibration data and that of the inputs of the exported floating-point model need to be consistent. The general form of the full quantization conversion command is: @@ -138,7 +138,7 @@ bit_num=8 [data_preprocess_param] # Calibration dataset path, the format is input_name_1:input_1_dir,input_name_2:input_2_dir -# Full quantification must provide correction dataset +# Full quantization must provide correction dataset calibrate_path=input_name_1:/mnt/image/input_1_dir,input_name_2:input_2_dir # Calibration data size calibrate_size=100 @@ -253,7 +253,7 @@ Ascend quantization needs to configure Ascend-related configuration at [offline ./converter_lite --fmk=ModelType --modelFile=ModelFilePath --outputFile=ConvertedModelPath --configFile=/mindspore-lite/tools/converter/quantizer/config/full_quant.cfg --optimize=ascend_oriented --inputShape="inTensorName_1:1,32,32,4" ``` -- Ascend fully quantized parameter dynamic shape scenarios also needs to add new `[ascend_context]` related configurations. +- Ascend fully quantized parameter dynamic shape scenarios also need to add new `[ascend_context]` related configurations. ```ini [full_quant_param] @@ -312,7 +312,7 @@ Post training quantization can be enabled by configuring `configFile` through [C ### Common Quantization Parameter -common quantization parameters are the basic settings for post training quantization. The detailed description of the parameters is as follows: +Common quantization parameters are the basic settings for post training quantization. The detailed description of the parameters is as follows: | Parameter | Attribute | Function Description | Parameter Type | Default Value | Value Range | | -------------------------- | --------- | ------------------------------------------------------------ | -------------- | ------------- | ------------------------------------------- | @@ -391,7 +391,7 @@ The detailed description of the ON_THE_FLY quantization parameters is as follows | Parameter | Attribute | Function Description | Parameter Type | Default Value | Value Range | | ----------------------- | --------- | --------------------------------------------------- | -------------- | ------------- | ------------------------------------------------------------ | -| dequant_strategy | optional | Weight quantification model | String | - | ON_THE_FLY. If it is enabled, the Ascend online inverse quantization mode is enabled. | +| dequant_strategy | optional | Weight quantization model | String | - | ON_THE_FLY. If it is enabled, the Ascend online inverse quantization mode is enabled. | The ON_THE_FLY quantization parameter is configured as shown below: @@ -457,7 +457,7 @@ The data preprocessing parameter configuration is as follows: ```ini [data_preprocess_param] # Calibration dataset path, the format is input_name_1:input_1_dir,input_name_2:input_2_dir -# Full quantification must provide correction dataset +# Full quantization must provide correction dataset calibrate_path=input_name_1:/mnt/image/input_1_dir,input_name_2:input_2_dir # Calibration data size calibrate_size=100 @@ -488,7 +488,7 @@ The detailed description of the dynamic quantization parameter is as follows: | Parameter | Attribute | Function Description | Parameter Type | Default Value | Value Range | | ---------- | --------- | ------------------------------------------------------------ | -------------- | ------------- | ----------- | -| quant_strategy | Optional | the dynamic quantizaiton strategy | String | ALWC | ALWC: Enable activation perlayer and weight perchannel quantization;
ACWL: Enable activation perchannel and weight perlayer quantization. | +| quant_strategy | Optional | the dynamic quantization strategy | String | ALWC | ALWC: Enable activation perlayer and weight perchannel quantization;
ACWL: Enable activation perchannel and weight perlayer quantization. | The dynamic quantization parameter configuration is as follows: @@ -557,7 +557,7 @@ The quantization parameter report `quant_param.csv` contains information about t ### Partial Operators Skip Quantization -Quantization is to convert float32 operator to int8 operator. The current quantization strategy is the Node contained in a certain class of supportable operators will be quantized, but there is a part of the Node sensitivity is high, the quantization will trigger a large error, while some layers of quantization after the inference speed is much lower than the inference speed of float16. Supporting the specified layer without quantization can effectively improve the accuracy and inference speed. +Quantization is to convert float32 operator to int8 operator. The current quantization strategy is the Node contained in a certain class of supportable operators will be quantized, but some Nodes have high sensitivity, the quantization will trigger a large error, while some layers of quantization after the inference speed is much lower than the inference speed of float16. Supporting the specified layer without quantization can effectively improve the accuracy and inference speed. The following is an example of `conv2d_1`, `add_8` and `concat_1` Node without quantization: diff --git a/docs/lite/docs/source_en/build/build.md b/docs/lite/docs/source_en/build/build.md index 55ab7bd6f0..3ec2e78468 100644 --- a/docs/lite/docs/source_en/build/build.md +++ b/docs/lite/docs/source_en/build/build.md @@ -9,7 +9,7 @@ Modules in MindSpore Lite: | Module | Support Platform | Description | | --- | ---- | ---- | | converter | Linux, Windows | Model Conversion Tool | -| runtime(cpp, java) | Linux, Windows, Android, iOS, OpenHarmony(OHOS) | Model Inference Framework(Windows platform does not support java version runtime) | +| runtime(cpp, java) | Linux, Windows, Android, iOS, OpenHarmony(OHOS) | Model Inference Framework (Windows platform does not support java version runtime) | | benchmark | Linux, Windows, Android, OpenHarmony(OHOS) | Benchmarking Tool | | benchmark_train | Linux, Android | Performance and Accuracy Validation | | cropper | Linux | Static library crop tool for libmindspore-lite.a | @@ -42,7 +42,7 @@ Modules in MindSpore Lite: - Configure environment variables: `export JAVA_HOME=JDK path`. - Add the bin directory to the PATH: `export PATH=${JAVA_HOME}/bin:$PATH`. - [Android SDK](https://developer.android.com/studio?hl=zh-cn#cmdline-tools) - - Create a new directory, configure environment variables`export ANDROID_SDK_ROOT=new directory`. + - Create a new directory, configure environment variables `export ANDROID_SDK_ROOT=new directory`. - Download `SDK Tools`, uncompress and go to directory `cmdline-tools/bin`, create SDK through `sdkmanager`: `./sdkmanager --sdk_root=${ANDROID_SDK_ROOT} "cmdline-tools;latest"`. - Accept the license through `sdkmanager` under the `${ANDROID_SDK_ROOT}` directory: `yes | ./sdkmanager --licenses`. - Compilation dependency of the Python API module (optional). If Python3 or NumPy is not installed, this module will not be compiled: @@ -97,7 +97,7 @@ The construction of modules is controlled by environment variables. Users can co > - When the AVX instruction set is enabled, the CPU of the running environment needs to support both AVX and FMA features. > - The compilation time of the model conversion tool is long. If it is not necessary, it is recommended to use `MSLITE_ENABLE_CONVERTER` to turn off the compilation of the conversion tool to speed up the compilation. > - The version supported by the OpenSSL encryption library is 1.1.1k, which needs to be downloaded and compiled by the user. For the compilation, please refer to: . In addition, the path of libcrypto.so.1.1 should be added to LD_LIBRARY_PATH. - > - When pre-inference during model compilation is enabled, for the non-encrypted model, the inference framework will create a child process for pre-inference when Build interface is called. After the child process returns successfully, the main precess will formally execute the process of graph compilation. + > - When pre-inference during model compilation is enabled, for the non-encrypted model, the inference framework will create a child process for pre-inference when Build interface is called. After the child process returns successfully, the main process will formally execute the process of graph compilation. > - At present, OpenHarmony only supports CPU reasoning, not GPU reasoning. - Runtime feature compilation options @@ -194,7 +194,7 @@ After installation, you can use the following command to check whether the insta python -c "import mindspore_lite" ``` -After successful installation, you can use the command of `pip show mindspore_lite` to check the installation location of the Python module of MindSpot Lite. +After successful installation, you can use the command of `pip show mindspore_lite` to check the installation location of the Python module of MindSpore Lite. ### Directory Structure @@ -258,7 +258,7 @@ After successful installation, you can use the command of `pip show mindspore_li └── mindspore-lite-{version}.aar # MindSpore Lite runtime aar ``` -- When the compilation option is `-I arm64` or `-I arm32`, and specifies`TOOLCHAIN_NAME=ohos`: +- When the compilation option is `-I arm64` or `-I arm32`, and specifies `TOOLCHAIN_NAME=ohos`: ```text mindspore-lite-{version}-ohos-{arch} diff --git a/docs/lite/docs/source_en/converter/converter_tool.md b/docs/lite/docs/source_en/converter/converter_tool.md index c417a99a9e..527b2934ba 100644 --- a/docs/lite/docs/source_en/converter/converter_tool.md +++ b/docs/lite/docs/source_en/converter/converter_tool.md @@ -28,10 +28,10 @@ To use the MindSpore Lite model conversion tool, you need to prepare the environ - If you use Python 3.11 when compiling the MindSpore Lite package, you need to add the Python dynamic link library to the environment variable LD_LIBRARY_PATH when using the conversion tools and the runtime tools. ```bash - export LD_LIBRARY_PATH=${PATHON_ROOT_PATH}/lib:${LD_LIBRARY_PATH} + export LD_LIBRARY_PATH=${PYTHON_ROOT_PATH}/lib:${LD_LIBRARY_PATH} ``` - ${PATHON_ROOT_PATH} is the path of the Python environment used. After decoupling the Python dependency, the environment variable does not need to be set. + ${PYTHON_ROOT_PATH} is the path of the Python environment used. After decoupling the Python dependency, the environment variable does not need to be set. ### Directory Structure @@ -68,8 +68,8 @@ The following describes the parameters in detail. | `--configFile=` | No | 1. Configure quantization parameter; 2. Profile path for extension. | - | - | - | | `--fp16=` | No | Serialize const tensor in float16 data type, only effective for const tensor in float32 data type. | on or off | off | - | | `--inputShape=` | No | Set the dimension of the model input, the order of input dimensions is consistent with the original model. For some models, the model structure can be further optimized, but the transformed model may lose the characteristics of dynamic shape. Multiple inputs are separated by `;`, and surround with `""` | e.g. "inTensorName_1: 1,32,32,4;inTensorName_2:1,64,64,4;" | - | - | -| `--saveType=` | No | Set the exported model as `mindir` model or `ms` model. | MINDIR, MINDIR_LITE | MINDIR_LITE | This device-side version can only be reasoned with models turned out by setting to MINDIR_LITE | - | - | -| `--optimize=` | No | Set the optimization accomplished in the process of converting model. | none, general, gpu_oriented, ascend_oriented | general | - | - | +| `--saveType=` | No | Set the exported model as `mindir` model or `ms` model. | MINDIR, MINDIR_LITE | MINDIR_LITE | This device-side version can only be reasoned with models turned out by setting to MINDIR_LITE | +| `--optimize=` | No | Set the optimization accomplished in the process of converting model. | none, general, gpu_oriented, ascend_oriented | general | - | | `--inputDataFormat=` | No | Set the input format of exported model. Only valid for 4-dimensional inputs. | NHWC, NCHW | NHWC | - | | `--decryptKey=` | No | The key used to decrypt the MindIR file, expressed in hexadecimal characters. Only valid when fmkIn is 'MINDIR'. | - | - | - | | `--decryptMode=` | No | Decryption mode for the MindIR file. Only valid when dec_key is set. | AES-GCM, AES-CBC | AES-GCM | - | @@ -81,24 +81,23 @@ The following describes the parameters in detail. | `--infer=` | No | Set whether to pre-inference when conversion is complete. | true, false | false | - | > - The parameter name and parameter value are separated by an equal sign (=) and no space is allowed between them. -> - Because the compilation option that supports the conversion of PyTorch models is turned off by default, the downloaded installation package does not support the conversion of PyTorch models. You need to open the specified compilation option to compile locally. The following preconditions must be met for converting PyTorch models:`export MSLITE_ENABLE_CONVERT_PYTORCH_MODEL=on && export LIB_TORCH_PATH="/home/user/libtorch"` before compiling. Users can download [CPU version libtorch](https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-2.0.1%2Bcpu.zip). Then unzip it to the directory `/home/user/libtorch`. Add the environment variable of libtorch before conversion: `export LD_LIBRARY_PATH="/home/user/libtorch/lib:${LD_LIBRARY_PATH}"`. +> - Because the compilation option that supports the conversion of PyTorch models is turned off by default, the downloaded installation package does not support the conversion of PyTorch models. You need to open the specified compilation option to compile locally. The following preconditions must be met for converting PyTorch models: `export MSLITE_ENABLE_CONVERT_PYTORCH_MODEL=on && export LIB_TORCH_PATH="/home/user/libtorch"` before compiling. Users can download [CPU version libtorch](https://download.pytorch.org/libtorch/cpu/libtorch-shared-with-deps-2.0.1%2Bcpu.zip). Then unzip it to the directory `/home/user/libtorch`. Add the environment variable of libtorch before conversion: `export LD_LIBRARY_PATH="/home/user/libtorch/lib:${LD_LIBRARY_PATH}"`. > - The Caffe model is divided into two files: model structure `*.prototxt`, corresponding to the `--modelFile` parameter; model weight `*.caffemodel`, corresponding to the `--weightFile` parameter. > - The priority of `--fp16` option is very low. For example, if quantization is enabled, `--fp16` will no longer take effect on const tensors that have been quantized. All in all, this option only takes effect on const tensors of float32 when serializing model. > - `inputDataFormat`: generally, in the scenario of integrating third-party hardware of NCHW specification, designated as NCHW will have a significant performance improvement over NHWC. In other scenarios, users can also set as needed. > - The `configFile` configuration files uses the `key=value` mode to define related parameters. For the configuration parameters related to quantization, please refer to [quantization](https://www.mindspore.cn/lite/docs/en/r2.7.0/advanced/quantization.html). For the configuration parameters related to extension, please refer to [Extension Configuration](https://www.mindspore.cn/lite/docs/en/r2.7.0/advanced/third_party/converter_register.html#extension-configuration). > - `--optimize` parameter is used to set the mode of optimization during the offline conversion. If this parameter is set to none, no relevant graph optimization operations will be performed during the offline conversion phase of the model, and the relevant graph optimization operations will be done during the execution of the inference phase. The advantage of this parameter is that the converted model can be deployed directly to any CPU/GPU/Ascend hardware backend since it is not optimized in a specific way, while the disadvantage is that the initialization time of the model increases during inference execution. If this parameter is set to general, general optimization will be performed, such as constant folding and operator fusion (the converted model only supports CPU/GPU hardware backend, not Ascend backend). If this parameter is set to gpu_oriented, the general optimization and extra optimization for GPU hardware will be performed (the converted model only supports GPU hardware backend). If this parameter is set to ascend_oriented, the optimization for Ascend hardware will be performed (the converted model only supports Ascend hardware backend). -> - The encryption and decryption function only takes effect when `MSLITE_ENABLE_MODEL_ENCRYPTION=on` is set at [compile](https://www.mindspore.cn/lite/docs/en/r2.7.0/build/build.html) time and only supports Linux x86 platforms, and the key is a string represented by hexadecimal. Users on the Linux platform can use the `xxd` tool to convert the key represented by the bytes to a hexadecimal representation. -It should be noted that the encryption and decryption algorithm has been updated in version 1.7. As a result, the new version of the converter tool does not support the conversion of the encrypted model exported by MindSpore Lite in version 1.6 and earlier. +> - The encryption and decryption function only takes effect when `MSLITE_ENABLE_MODEL_ENCRYPTION=on` is set at [compile](https://www.mindspore.cn/lite/docs/en/r2.7.0/build/build.html) time and only supports Linux x86 platforms, and the key is a string represented by hexadecimal. Users on the Linux platform can use the `xxd` tool to convert the key represented by the bytes to a hexadecimal representation. It should be noted that the encryption and decryption algorithm has been updated in version 1.7. As a result, the new version of the converter tool does not support the conversion of the encrypted model exported by MindSpore Lite in version 1.6 and earlier. > - Parameters `--input_shape` and dynamicDims are stored in the model during conversion. Call model.get_model_info("input_shape") and model.get_model_info("dynamic_dims") to get it when using the model. ### CPU Model Optimization -If the converted ms model is running on android cpu backend, and hope the model compile with lower latency. Try to turn on this optimization. Add the configuration item `[cpu_option_cfg_param]` in the `configFile` to get a lower compile latency model. At present, the optimization is only available when the model include Matmul operator and its data type is `float32` or dynamic quantization is enabled. +If the converted ms model uses the Android CPU backend for inference and has stringent requirements for model compilation latency, you may consider enabling this optimization. Add the configuration item `[cpu_option_cfg_param]` in the `configFile` to get a lower compile latency model. At present, the optimization is only available when the model include Matmul operator and its data type is `float32` or dynamic quantization is enabled. | Parameter | Attribute | Function Description | Value Range | |--------|--------|--------|--------| | `architecture` | Mandatory | target cpu architecture, only support ARM64 | ARM64 | -| `instruction` | Mandatory | target instruction set, only support SMID_DOT | SIMD_DOT | +| `instruction` | Mandatory | target instruction set, only support SIMD_DOT | SIMD_DOT | ### Example @@ -186,7 +185,7 @@ To use the MindSpore Lite model conversion tool, the following environment prepa ```bash set PATH=%PACKAGE_ROOT_PATH%\tools\converter\lib;%PATH% - ```` + ``` ${PACKAGE_ROOT_PATH} is the decompressed package path obtained by compiling or downloading. @@ -250,7 +249,7 @@ Several common examples are selected below to illustrate the use of conversion c > The `MindIR` model exported by version earlier than MindSpore v1.1.1 is recommended to be converted to the `ms` model using the converter tool of the corresponding version. In MindSpore v1.1.1 and later versions, the converter tool will be forward compatible. - - TensorFlow Lite model`model.tflite` + - TensorFlow Lite model `model.tflite` ```bat call converter_lite --fmk=TFLITE --modelFile=model.tflite --outputFile=model @@ -262,7 +261,7 @@ Several common examples are selected below to illustrate the use of conversion c call converter_lite --fmk=TF --modelFile=model.pb --outputFile=model ``` - - ONNX model`model.onnx` + - ONNX model `model.onnx` ```bat call converter_lite --fmk=ONNX --modelFile=model.onnx --outputFile=model diff --git a/docs/lite/docs/source_en/infer/image_segmentation.md b/docs/lite/docs/source_en/infer/image_segmentation.md index 90f248323c..e3ad8241c4 100644 --- a/docs/lite/docs/source_en/infer/image_segmentation.md +++ b/docs/lite/docs/source_en/infer/image_segmentation.md @@ -34,11 +34,11 @@ The following describes how to build and execute an on-device image segmentation ### Building and Running -1. Load the [sample source code](https://gitee.com/mindspore/models/tree/master/official/lite/image_segmentation) to Android Studio and install the corresponding SDK. (After the SDK version is specified, Android Studio automatically installs the SDK.) +1. Load the [sample source code](https://gitee.com/mindspore/models/tree/master/official/lite/image_segmentation) into Android Studio and install the corresponding SDK. (After the SDK version is specified, Android Studio automatically installs the SDK.) ![start_home](../images/lite_quick_start_home.png) -2. Connect to an Android device and runs the image segmentation application. +2. Connect to an Android device and run the image segmentation application. Connect to the Android device through a USB cable for debugging. Click `Run 'app'` to run the demo on your device. diff --git a/docs/lite/docs/source_en/tools/benchmark_tool.md b/docs/lite/docs/source_en/tools/benchmark_tool.md index 013b711bbf..60e602f836 100644 --- a/docs/lite/docs/source_en/tools/benchmark_tool.md +++ b/docs/lite/docs/source_en/tools/benchmark_tool.md @@ -20,7 +20,7 @@ To use the Benchmark tool, you need to prepare the environment as follows: ```bash export LD_LIBRARY_PATH=${PACKAGE_ROOT_PATH}/runtime/lib:${LD_LIBRARY_PATH} - ```` + ``` ${PACKAGE_ROOT_PATH} is the compiled inference package path after decompressing. @@ -309,9 +309,9 @@ To use the Benchmark tool, you need to prepare the environment as follows: - Compilation: Install build dependencies and perform build. The code of the Benchmark tool is stored in the `mindspore-lite/tools/benchmark` directory of the MindSpore Lite source code. For details about the build operations, see the [Environment Requirements](https://www.mindspore.cn/lite/docs/en/r2.7.0/build/build.html#environment-requirements) and [Compilation Example](https://www.mindspore.cn/lite/docs/en/r2.7.0/build/build.html#compilation-example) in the build document. - Add the path of dynamic library required by the benchmark to the environment variables PATH. - ````bash + ```bash set PATH=%PACKAGE_ROOT_PATH%\runtime\lib;%PATH% - ```` + ``` %PACKAGE_ROOT_PATH% is the decompressed package path obtained by compiling. diff --git a/docs/lite/docs/source_en/train/converter_train.md b/docs/lite/docs/source_en/train/converter_train.md index 996ca42270..0e6f0861ef 100644 --- a/docs/lite/docs/source_en/train/converter_train.md +++ b/docs/lite/docs/source_en/train/converter_train.md @@ -20,7 +20,7 @@ MindSpore Lite model transfer tool (only suppot Linux OS) has provided multiple ```bash export LD_LIBRARY_PATH=${PACKAGE_ROOT_PATH}/tools/converter/lib:${LD_LIBRARY_PATH} - ```` + ``` ${PACKAGE_ROOT_PATH} is the decompressed package path obtained by compiling or downloading. diff --git a/docs/lite/docs/source_zh_cn/advanced/micro.md b/docs/lite/docs/source_zh_cn/advanced/micro.md index be3b2384e9..4871abbe20 100644 --- a/docs/lite/docs/source_zh_cn/advanced/micro.md +++ b/docs/lite/docs/source_zh_cn/advanced/micro.md @@ -73,7 +73,7 @@ MindSpore Lite针对MCUs部署硬件后端,提供了一种超轻量Micro AI部 enable_micro=true - # specify HW target, support x86,Cortex-M, AMR32A, ARM64 only. + # specify HW target, support x86, Cortex-M, AMR32A, ARM64 only. target=x86 @@ -170,7 +170,7 @@ MindSpore Lite针对MCUs部署硬件后端,提供了一种超轻量Micro AI部 enable_micro=true - # specify HW target, support x86,Cortex-M, AMR32A, ARM64 only. + # specify HW target, support x86, Cortex-M, AMR32A, ARM64 only. target=x86 @@ -312,7 +312,7 @@ dynamic_dim_params=d0:[1,3];d1:[1~8] enable_micro=true -# specify HW target, support x86,Cortex-M, AMR32A, ARM64 only. +# specify HW target, support x86, Cortex-M, AMR32A, ARM64 only. target=x86 @@ -361,7 +361,7 @@ support_parallel=true # enable code-generation for MCU HW enable_micro=true -# specify HW target, support x86,Cortex-M, ARM32, ARM64 only. +# specify HW target, support x86, Cortex-M, ARM32, ARM64 only. target=Cortex-M # code generation for Inference or Train @@ -434,7 +434,7 @@ target_device=DSP enable_micro=true - # specify HW target, support x86,Cortex-M, AMR32A, ARM64 only. + # specify HW target, support x86, Cortex-M, AMR32A, ARM64 only. target=x86 diff --git a/docs/lite/docs/source_zh_cn/converter/converter_tool.md b/docs/lite/docs/source_zh_cn/converter/converter_tool.md index 015166ace6..0beba0d386 100644 --- a/docs/lite/docs/source_zh_cn/converter/converter_tool.md +++ b/docs/lite/docs/source_zh_cn/converter/converter_tool.md @@ -27,10 +27,10 @@ MindSpore Lite提供离线转换模型功能的工具,支持多种类型的模 - 编译MindSpore Lite包时若使用的是Python3.11,则使用转换工具以及推理工具时需要将使用的Python动态链接库加入环境变量LD_LIBRARY_PATH。 ```bash - export LD_LIBRARY_PATH=${PATHON_ROOT_PATH}/lib:${LD_LIBRARY_PATH} + export LD_LIBRARY_PATH=${PYTHON_ROOT_PATH}/lib:${LD_LIBRARY_PATH} ``` - ${PATHON_ROOT_PATH}为使用的Python环境所在路径。待解耦Python依赖后该环境变量无需设置。 + ${PYTHON_ROOT_PATH}为使用的Python环境所在路径。待解耦Python依赖后该环境变量无需设置。 ### 目录结构 @@ -85,18 +85,17 @@ MindSpore Lite模型转换工具提供了多种参数设置,用户可根据需 > - `inputDataFormat`:一般在集成NCHW规格的三方硬件场景下,设为NCHW比NHWC会有较明显的性能提升。在其他场景下,用户也可按需设置。 > - `configFile`配置文件采用`key=value`的方式定义相关参数,量化相关的配置参数详见[量化](https://www.mindspore.cn/lite/docs/zh-CN/r2.7.0/advanced/quantization.html),扩展功能相关的配置参数详见[扩展配置](https://www.mindspore.cn/lite/docs/zh-CN/r2.7.0/advanced/third_party/converter_register.html#扩展配置)。 > - `--optimize`该参数是用来设定在离线转换的过程中需要完成哪些特定的优化。如果该参数设置为none,那么在模型的离线转换阶段将不进行相关的图优化操作,相关的图优化操作将会在执行推理阶段完成。该参数的优点在于转换出来的模型由于没有经过特定的优化,可以直接部署到CPU/GPU/Ascend任意硬件后端;而带来的缺点是推理执行时模型的初始化时间增长。如果设置成general,表示离线转换过程会完成通用优化,包括常量折叠,算子融合等(转换出的模型只支持CPU/GPU后端,不支持Ascend后端)。如果设置成gpu_oriented,表示转换过程中会完成通用优化和针对GPU后端的额外优化(转换出来的模型只支持GPU后端)。如果设置成ascend_oriented,表示转换过程中只完成针对Ascend后端的优化(转换出来的模型只支持Ascend后端)。 -> - 加解密功能仅在[编译](https://www.mindspore.cn/lite/docs/zh-CN/r2.7.0/build/build.html)时设置为`MSLITE_ENABLE_MODEL_ENCRYPTION=on`时生效,并且仅支持Linux x86平台。其中密钥为十六进制表示的字符串,Linux平台用户可以使用`xxd`工具对字节表示的密钥进行十六进制表达转换。 - 需要注意的是,加解密算法在1.7版本进行了更新,导致新版的converter工具不支持对1.6及其之前版本的MindSpore Lite加密导出的模型进行转换。 +> - 加解密功能仅在[编译](https://www.mindspore.cn/lite/docs/zh-CN/r2.7.0/build/build.html)时设置为`MSLITE_ENABLE_MODEL_ENCRYPTION=on`时生效,并且仅支持Linux x86平台。其中密钥为十六进制表示的字符串,Linux平台用户可以使用`xxd`工具对字节表示的密钥进行十六进制表达转换。需要注意的是,加解密算法在1.7版本进行了更新,导致新版的converter工具不支持对1.6及其之前版本的MindSpore Lite加密导出的模型进行转换。 > - `--input_shape`参数以及dynamicDims参数在转换时会被存入模型中,在使用模型时可以调用model.get_model_info("input_shape")以及model.get_model_info("dynamic_dims")来获取。 ### CPU模型编译优化 -如果转换后的ms模型使用Android CPU后端进行推理,并且对模型编译阶段时延要求较高。可以尝试开启此优化,在`configFile`配置文件中增加配置项`[cpu_option_cfg_param]`,得到编译更高效的模型。目前仅对模型中含有Matmul算子并且数据类型为`float32`或开启动态量化时有优化效果。 +如果转换后的ms模型使用Android CPU后端进行推理,并且对模型编译阶段时延要求较高,可以尝试开启此优化。在`configFile`配置文件中增加配置项`[cpu_option_cfg_param]`,得到编译更高效的模型。目前仅对模型中含有Matmul算子并且数据类型为`float32`或开启动态量化时有优化效果。 | 参数 | 属性 | 功能描述 | 取值范围 | |--------|--------|--------|--------| | `architecture` | 必选 | 目标架构,当前仅支持ARM64 | ARM64 | -| `instruction` | 必选 | 目标指令集,当前仅支持SMID_DOT | SIMD_DOT | +| `instruction` | 必选 | 目标指令集,当前仅支持SIMD_DOT | SIMD_DOT | ### 使用示例 -- Gitee