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/09/11 04:07] hyphop |
products:sbc:vim3:npu:npu-sdk [2024/04/18 04:34] nick |
||
---|---|---|---|
Line 1: | Line 1: | ||
~~tag> | ~~tag> | ||
- | ====== NPU SDK Usage ====== | + | ====== |
- | Basic information and examples about how to use Amlogic NPU SDK for VIM3 | + | Basic information and examples about how to use Amlogic NPU SDK for VIM3. |
- | /*===== Introduction | + | ===== Build Docker Environment |
- | This document is an introduction to the structure of the NPU SDK. | + | We provided a docker image which contains |
- | */ | + | |
- | ===== Get SDK ===== | + | Follow Docker official docs to install Docker: [[https:// |
+ | |||
+ | Follow the command below to get Docker image: | ||
+ | |||
+ | ```shell | ||
+ | docker pull docker pull numbqq/ | ||
+ | ``` | ||
+ | |||
+ | ===== Get NPU SDK ===== | ||
Get source: [[gh> | 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 aml_npu_sdk | $ cd aml_npu_sdk | ||
$ ls | $ ls | ||
- | acuity-toolkit | + | acuity-toolkit |
``` | ``` | ||
Line 37: | Line 44: | ||
``` | ``` | ||
- | < | + | < |
- | 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 |
</ | </ | ||
Line 46: | Line 53: | ||
```shell | ```shell | ||
- | $ cd aml_npu_sdk/ | + | $ ls acuity-toolkit |
- | $ ls | + | |
bin demo python | bin demo python | ||
``` | ``` | ||
Line 63: | Line 69: | ||
``` | ``` | ||
- | ==== Dependencies Installation | + | ===== Convert Model ===== |
- | The environment package dependencies required by the conversion tool can be installed directly on the PC or installed through the [[https:// | + | 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 Scripts ==== | ==== Conversion Scripts ==== | ||
- | The conversion | + | The conversion |
```shell | ```shell | ||
- | $ cd aml_npu_sdk/ | + | $ ls acuity-toolkit/ |
- | $ ls -1 | + | acuity-toolkit/ |
- | data | + | acuity-toolkit/ |
- | model | + | acuity-toolkit/ |
- | 0_import_model.sh | + | acuity-toolkit/ |
- | 1_quantize_model.sh | + | |
- | 2_export_case_code.sh | + | |
- | extractoutput.py | + | |
- | inference.sh | + | |
``` | ``` | ||
- | Use scripts to convert AI models. | + | * '' |
+ | * '' | ||
+ | * '' | ||
- | ```shell | + | <WRAP tip > |
- | $ cd aml_npu_sdk/ | + | If you want to convert your own model, just modify converion scripts '' |
- | $ bash 0_import_model.sh | + | </ |
- | ``` | + | |
- | * '' | ||
- | * '' | ||
- | * '' | ||
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 | makefile.linux | ||
Line 146: | Line 131: | ||
For the conversion parameters and settings, please refer to: | For the conversion parameters and settings, please refer to: | ||
* [[gh> | * [[gh> | ||
- | * [[https:// | + | * [[gh>khadas/ |