This article mainly introduces how to convert neural network models of different platforms into model codes and data that can be run on the NPU.
The documentation is adapted to the NPU driver version 6.4.8.7. For drivers and demo repositories and SDKs lower than this version, the documentation is also applicable, but not completely consistent.
Get SDK
1 | $ mkdir workspace && cd workspace |
SDK Structure
Enter the SDK directory,
1 | cd {workspace}/aml_npu_sdk |
The SDK is mainly divided into several SDK
, conversion tools
and compilation tools
, and docs
.
1 | acuity-toolkit #Conversion tool , used to convert AI models |
NoteSince all linux codes have been supports local compiled, host compilation is no longer supported. Therefore, the contents of linux_sdk have been completely removed.
Docs
Enter the Docs directory, DDK_Application_Guide_0.7.pdf
describes each document. The document records a series of processes from conversion to integration, as well as some common problems
Conversion Tool
acuity-toolkit
is the conversion tool directory,
1 | cd {workspace}/aml_npu_sdk/acuity-toolkit |
The main directory of interest is demo
1 | 1. bin #Conversion is a collection of various tools used, most of which are not open source. |
Dependent Installation
The environment dependency package required by the conversion tool can be installed directly on the PC or installed through the virtual environment virtualenv
1 | cd {workspace}/aml_npu_sdk/acuity-toolkit |
Among them, tensorflow==2.0.0
can be replaced by tensorflow==2.0.0a0
Conversion Script
The conversion script is in the demo
directory,
1 | cd {workspace}/aml_npu_sdk/acuity-toolkit/demo |
Use scripts to convert AI models
1 | cd {workspace}/aml_npu_sdk/acuity-toolkit/demo |
After the conversion is completed, you can see the converted code in the xxxx_nbg_unify
directory, here is the built-in model as an example
1 | cd {workspace}/aml_npu_sdk/acuity-toolkit/demo/mobilenet_tf_nbg_unify |
For the setting of conversion parameters, please refer to ‘Model_Transcoding and Running User Guide Eng.pdf’ in Docs