This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
products:sbc:vim3:npu:npu-sdk [2023/09/11 02:44] hyphop [SDK Structure] |
products:sbc:vim3:npu:npu-sdk [2025/04/26 22:32] (current) nick |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ~~tag> |
| - | ===== Introduction | + | ====== VIM3 NPU SDK Usage ====== |
| - | This document is an introduction | + | Basic information and examples about how to use Amlogic |
| + | ===== Build Docker Environment ===== | ||
| - | ===== Get SDK ===== | + | We provided a docker image which contains the required environment to convert the model. |
| - | Get source: [[gh>khadas/aml_npu_sdk]] | + | Follow Docker official docs to install Docker: [[https:// |
| + | |||
| + | Follow the command below to get Docker image: | ||
| + | |||
| + | ```shell | ||
| + | docker pull numbqq/ | ||
| + | ``` | ||
| + | |||
| + | ===== Get NPU SDK ===== | ||
| + | |||
| + | Get source: [[dl>products/ | ||
| ```shell | ```shell | ||
| $ mkdir workspace && cd workspace | $ mkdir workspace && cd workspace | ||
| - | $ git clone --recursive | + | $ wget https://dl.khadas.com/products/ |
| + | $ tar xvzf aml_npu_sdk-ddk-xxxx-xxxx.tgz | ||
| + | $ cd aml_npu_sdk-ddk-xxxx-xxxx | ||
| + | $ ls | ||
| + | Dockerfile | ||
| ``` | ``` | ||
| ===== SDK Structure ===== | ===== SDK Structure ===== | ||
| - | Enter the SDK directory, | + | Enter inside |
| ```shell | ```shell | ||
| $ cd aml_npu_sdk | $ cd aml_npu_sdk | ||
| $ ls | $ ls | ||
| - | acuity-toolkit | + | acuity-toolkit |
| ``` | ``` | ||
| - | The SDK contains the **Android SDK**, **conversion and compilation tools** , and **docs**. | + | The SDK contains the Android SDK, conversion and compilation tools, and manuals. |
| ``` | ``` | ||
| - | acuity-toolkit | + | acuity-toolkit |
| - | android_sdk | + | android_sdk |
| - | docs #Conversion related documents collection | + | docs # Conversion-related documents collection |
| ``` | ``` | ||
| - | < | + | < |
| - | Since all linux codes have been supports local compiled, host compilation is no longer supported. Therefore, the contents of '' | + | Since all linux code can now be locally |
| </ | </ | ||
| - | |||
| - | ===== Docs ===== | ||
| - | |||
| - | Enter the Docs directory, '' | ||
| ===== Conversion Tool ===== | ===== Conversion Tool ===== | ||
| - | '' | + | '' |
| ```shell | ```shell | ||
| - | $ cd aml_npu_sdk/ | + | $ ls acuity-toolkit |
| - | $ ls | + | |
| bin demo python | bin demo python | ||
| ``` | ``` | ||
| - | The main directory of interest is '' | + | '' |
| ``` | ``` | ||
| - | 1. bin # | + | bin # Conversion is a collection of various tools used, most of which are not open source. |
| - | 2. demo #Conversion script directory, convert AI model location | + | demo # Conversion script directory, convert AI model location |
| - | 3. demo_hybird | + | demo_hybird |
| - | 4. mulity_input_demo | + | mulity_input_demo |
| - | 5. python | + | python |
| - | 6. ReadMe.txt | + | ReadMe.txt |
| - | 7. requirements.txt | + | requirements.txt |
| ``` | ``` | ||
| - | ==== Dependencies Installation | + | ===== Convert Model ===== |
| - | The environment package dependencies required by the conversion tool can be installed directly on the PC or installed through the virtual environment '' | + | Convert |
| ```shell | ```shell | ||
| - | $ cd aml_npu_sdk/acuity-toolkit | + | ./convert-in-docker.sh |
| - | $ cat requirements.txt | + | |
| - | tensorflow==2.0.0 | + | |
| - | astor==0.8.0 | + | |
| - | numpy==1.18.0 | + | |
| - | scipy==1.1.0 | + | |
| - | Pillow==5.3.0 | + | |
| - | protobuf==3.11.2 | + | |
| - | networkx> | + | |
| - | image==1.5.5 | + | |
| - | lmdb==0.93 | + | |
| - | onnx==1.6.0 | + | |
| - | h5py==2.10.0 | + | |
| - | flatbuffers==1.10 | + | |
| - | matplotlib==2.1.0 | + | |
| - | dill==0.2.8.2 | + | |
| - | ruamel.yaml==0.15.81 | + | |
| - | ply==3.11 | + | |
| - | torch==1.2.0 | + | |
| ``` | ``` | ||
| - | Here, '' | + | The script |
| + | * acuity-toolkit/ | ||
| + | * acuity-toolkit/ | ||
| + | * acuity-toolkit/ | ||
| - | ==== Conversion Script ==== | ||
| - | The conversion script is in the '' | + | ==== Conversion Scripts ==== |
| - | ```shell | + | The conversion scripts are in the '' |
| - | $ cd aml_npu_sdk/ | + | |
| - | $ ls -1 | + | |
| - | data | + | |
| - | model | + | |
| - | 0_import_model.sh | + | |
| - | 1_quantize_model.sh | + | |
| - | 2_export_case_code.sh | + | |
| - | extractoutput.py | + | |
| - | inference.sh | + | |
| - | ``` | + | |
| - | + | ||
| - | Use scripts to convert AI models. | + | |
| ```shell | ```shell | ||
| - | $ cd aml_npu_sdk/ | + | $ ls acuity-toolkit/ |
| - | $ bash 0_import_model.sh | + | acuity-toolkit/ |
| + | acuity-toolkit/ | ||
| + | acuity-toolkit/ | ||
| + | acuity-toolkit/ | ||
| ``` | ``` | ||
| - | * '' | + | * '' |
| - | * '' | + | * '' |
| * '' | * '' | ||
| + | |||
| + | <WRAP tip > | ||
| + | If you want to convert your own model, just modify converion scripts '' | ||
| + | </ | ||
| + | |||
| After the conversion is completed, you can see the converted code in the '' | After the conversion is completed, you can see the converted code in the '' | ||
| ```shell | ```shell | ||
| - | $ cd aml_npu_sdk/ | + | $ ls acuity-toolkit/ |
| - | $ ls | + | BUILD |
| - | BUILD | + | makefile.linux |
| - | main.c | + | mobilenettf.vcxproj |
| + | main.c | ||
| + | mobilenet_tf.nb | ||
| + | nbg_meta.json | ||
| + | vnn_global.h | ||
| + | vnn_mobilenettf.h | ||
| + | vnn_post_process.h | ||
| + | vnn_pre_process.h | ||
| + | vnn_mobilenettf.c | ||
| + | vnn_post_process.c | ||
| + | vnn_pre_process.c | ||
| ``` | ``` | ||
| <WRAP important > | <WRAP important > | ||
| - | If your model' | + | If your model' |
| </ | </ | ||
| - | ===== See Also ===== | + | ==== Conversion Parameters |
| - | + | ||
| - | For the setting of conversion parameters, please refer to '' | + | |
| + | For the conversion parameters and settings, please refer to: | ||
| + | * [[gh> | ||
| + | * [[gh> | ||