This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
products:sbc:vim3:npu:npu-sdk [2023/07/04 06:09] louis |
products:sbc:vim3:npu:npu-sdk [2024/04/18 04:34] nick |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ~~tag> |
- | ===== Introduction | + | ====== VIM3 NPU SDK Usage ====== |
- | This document mainly introduces | + | 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. |
- | You can clone the SDK from our Github and Gitlab. | + | Follow Docker official docs to install Docker: [[https:// |
+ | |||
+ | Follow | ||
+ | |||
+ | ```shell | ||
+ | docker pull docker pull numbqq/ | ||
+ | ``` | ||
+ | |||
+ | ===== Get NPU SDK ===== | ||
+ | |||
+ | Get source: [[gh> | ||
```shell | ```shell | ||
- | $ mkdir workspace && cd workspace | + | mkdir workspace && cd workspace |
- | $ git clone --recursive https:// | + | git clone --recursive https:// |
``` | ``` | ||
===== SDK Structure ===== | ===== SDK Structure ===== | ||
- | Enter the SDK directory, | + | Enter inside |
```shell | ```shell | ||
- | $ cd {workspace}/ | + | $ cd aml_npu_sdk |
$ ls | $ ls | ||
- | acuity-toolkit | + | acuity-toolkit |
``` | ``` | ||
- | The SDK is mainly divided into several '' | + | The SDK contains the Android |
``` | ``` | ||
- | 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 {workspace}/ | + | $ 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 |
``` | ``` | ||
- | ==== Dependent Installation | + | ===== Convert Model ===== |
- | The environment dependency package required by the conversion tool can be installed directly on the PC or installed through the virtual environment '' | + | Convert |
```shell | ```shell | ||
- | $ cd {workspace}/aml_npu_sdk/ | + | ./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 | + | |
``` | ``` | ||
- | Among them, '' | + | The script |
+ | * acuity-toolkit/ | ||
+ | * acuity-toolkit/ | ||
+ | * acuity-toolkit/ | ||
- | ==== Conversion Script ==== | ||
- | The conversion script is in the `demo` directory, | + | ==== Conversion Scripts ==== |
- | ```shell | + | The conversion scripts are in the '' |
- | $ cd {workspace}/ | + | |
- | $ ls | + | |
- | 0_import_model.sh | + | |
- | ``` | + | |
- | + | ||
- | Use scripts to convert AI models. | + | |
```shell | ```shell | ||
- | $ cd {workspace}/aml_npu_sdk/ | + | $ ls acuity-toolkit/demo/*.sh -1 |
- | $ 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 {workspace}/ | + | $ 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> | ||