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/15 11:45] sravan [Conversion Scripts] |
products:sbc:vim3:npu:npu-sdk [2025/04/26 22:32] (current) 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:// |
| - | Get source: [[gh>khadas/aml_npu_sdk]] | + | 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 | ||
| ``` | ``` | ||
| Line 26: | Line 37: | ||
| $ cd aml_npu_sdk | $ cd aml_npu_sdk | ||
| $ ls | $ ls | ||
| - | acuity-toolkit | + | acuity-toolkit |
| ``` | ``` | ||
| Line 46: | Line 57: | ||
| ```shell | ```shell | ||
| - | $ cd aml_npu_sdk/ | + | $ ls acuity-toolkit |
| - | $ ls | + | |
| bin demo python | bin demo python | ||
| ``` | ``` | ||
| Line 63: | Line 73: | ||
| ``` | ``` | ||
| - | ==== 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 these scripts to convert Neural Network models into a format compatible with the VIM3 NPU. | + | |
| - | + | ||
| - | ```shell | + | |
| - | $ cd aml_npu_sdk/ | + | |
| - | $ bash 0_import_model.sh && bash 1_quantize_model.sh && bash 2_export_case_code.sh | + | |
| ``` | ``` | ||
| Line 117: | Line 102: | ||
| * '' | * '' | ||
| * '' | * '' | ||
| + | |||
| + | <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 | makefile.linux | ||
| Line 146: | Line 135: | ||
| For the conversion parameters and settings, please refer to: | For the conversion parameters and settings, please refer to: | ||
| * [[gh> | * [[gh> | ||
| - | * [[https:// | + | * [[gh>khadas/ |