Introduction and guide on how to use the KSNN conversion tool.
The conversion tool is integrated in the NPU SDK.
$ git clone --recursive https://github.com/khadas/aml_npu_sdk.git
The KSNN conversion tool is under acuity-toolkit/python
,
$ cd aml_npu_sdk/acuity-toolkit/python && ls $ convert data outputs
Choose tensorflow Inception V3 as an example.
1. Get the frozen model,
$ cd aml_npu_sdk/acuity-toolkit/python $ wget https://github.com/yan-wyb/models-zoo/raw/master/tensorflow/inception/inception_v3_2016_08_28_frozen.pb
2. Convert,
$ ./convert --model-name inception \
> --platform tensorflow \
> --model /home/yan/yan/Yan/models-zoo/tensorflow/inception/inception_v3_2016_08_28_frozen.pb \
> --input-size-list '299,299,3' \
> --inputs input \
> --outputs InceptionV3/Predictions/Reshape_1 \
> --mean-values '128 128 128 0.0078125' \
> --quantized-dtype asymmetric_affine \
> --source-files ./data/dataset/dataset0.txt \
> --kboard VIM3 --print-level 0
During conversion, if you need to view detailed information, you can modify –print-level 0
to –print-level 1
.
3. Model file generated after conversion.
$ cd aml_npu_sdk/acuity-toolkit/python $ ls outputs/inception/ inception.nb libnn_inception.so