Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:vim3:npu:ksnn:ksnn-convert

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
products:sbc:vim3:npu:ksnn:ksnn-convert [2023/09/15 11:54]
sravan [Introduction]
products:sbc:vim3:npu:ksnn:ksnn-convert [2024/05/08 02:16]
louis
Line 3: Line 3:
 Introduction and guide on how to use the KSNN conversion tool. Introduction and guide on how to use the KSNN conversion tool.
  
-===== Get convert tool =====+===== Get the conversion tool =====
  
-The tool is integrated in the NPU conversion tool warehouse of VIM3.+The conversion tool is integrated in the NPU SDK.
  
 ```shell ```shell
Line 17: Line 17:
 ``` ```
  
-===== Example for Convert =====+===== Conversion example =====
  
-Choose tensorflow Inception V3 as a exmple.+Choose tensorflow MobileNet SSD as an example.
  
-1. Get forzen model,+1. Get the frozen model,
  
 ```shell ```shell
 $ cd aml_npu_sdk/acuity-toolkit/python $ cd aml_npu_sdk/acuity-toolkit/python
-$ wget https://github.com/yan-wyb/models-zoo/raw/master/tensonrflow/inception/inception_v3_2016_08_28_frozen.pb+$ wget https://github.com/yan-wyb/models-zoo/raw/master/tensorflow/mobilenet_ssd/ssd_mobilenet_v1_coco_2017_11_17.pb
 ``` ```
  
Line 31: Line 31:
  
 ```shell ```shell
-$ ./convert --model-name inception \+# uint8 
 +$ ./convert --model-name mobilenet_ssd \
 >           --platform tensorflow \ >           --platform tensorflow \
->           --model /home/yan/yan/Yan/models-zoo/tensorflow/inception/inception_v3_2016_08_28_frozen.pb \ +>           --model /home/yan/yan/Yan/models-zoo/tensorflow/mobilenet_ssd/ssd_mobilenet_v1_coco_2017_11_17.pb \ 
->           --input-size-list '299,299,3' \ +>           --input-size-list '300,300,3' \ 
->           --inputs input +>           --inputs FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_0/BatchNorm/batchnorm/mul_1 
->           --outputs InceptionV3/Predictions/Reshape_1 +>           --outputs "'concat concat_1'" 
->           --mean-values '128 128 128 0.0078125' \+>           --mean-values '127.5 127.5 127.5 0.007843137' \
 >           --quantized-dtype asymmetric_affine \ >           --quantized-dtype asymmetric_affine \
 +>           --source-files ./data/dataset/dataset0.txt \
 +>           --kboard VIM3 --print-level 0
 +
 +# int8
 +$ ./convert --model-name mobilenet_ssd \
 +>           --platform tensorflow \
 +>           --model /home/yan/yan/Yan/models-zoo/tensorflow/mobilenet_ssd/ssd_mobilenet_v1_coco_2017_11_17.pb \
 +>           --input-size-list '300,300,3' \
 +>           --inputs FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_0/BatchNorm/batchnorm/mul_1 \
 +>           --outputs "'concat concat_1'" \
 +>           --mean-values '127.5 127.5 127.5 0.007843137' \
 +>           --quantized-dtype dynamic_fixed_point \
 +>           --qtype int8 \
 +>           --source-files ./data/dataset/dataset0.txt \
 +>           --kboard VIM3 --print-level 0
 +
 +# int16
 +$ ./convert --model-name mobilenet_ssd \
 +>           --platform tensorflow \
 +>           --model /home/yan/yan/Yan/models-zoo/tensorflow/mobilenet_ssd/ssd_mobilenet_v1_coco_2017_11_17.pb \
 +>           --input-size-list '300,300,3' \
 +>           --inputs FeatureExtractor/MobilenetV1/MobilenetV1/Conv2d_0/BatchNorm/batchnorm/mul_1 \
 +>           --outputs "'concat concat_1'" \
 +>           --mean-values '127.5 127.5 127.5 0.007843137' \
 +>           --quantized-dtype dynamic_fixed_point \
 +>           --qtype int16 \
 >           --source-files ./data/dataset/dataset0.txt \ >           --source-files ./data/dataset/dataset0.txt \
 >           --kboard VIM3 --print-level 0 >           --kboard VIM3 --print-level 0
Line 45: Line 72:
 During conversion, if you need to view detailed information, you can modify ''--print-level 0'' to ''--print-level 1''. During conversion, if you need to view detailed information, you can modify ''--print-level 0'' to ''--print-level 1''.
  
-3. File generated after conversion.+3. Model file generated after conversion.
  
 ```shell ```shell
 $ cd aml_npu_sdk/acuity-toolkit/python $ cd aml_npu_sdk/acuity-toolkit/python
-$ ls outputs/inception+$ ls outputs/mobilenet_ssd
-inception.nb  libnn_inception.so+mobilenet_ssd.nb  libnn_mobilenet_ssd.so
 ``` ```
  
Last modified: 2024/05/27 22:15 by louis