Write Model To Flash
Note: KneronDFUT supports 3 platforms - Windows 10 (x86_64 64-bit), Ubuntu 18.04 (x86_64 64-bit), and Raspberry Pi OS - Buster (armv7l 32-bit)
Note: If you are not using the 3 platforms, you may use the DFUT_console provided in Kneron PLUS. Please refer Build with DFUT_console
Note: Please use the latest version of KneronDFUT to avoid problems caused by incompatibility.
1. Introduction
The inference model must be loaded into Kneron AI device before the inference process.
There are two ways to load models:
-
Upload Model via USB
-
The model file (.nef) can be uploaded to Kneron AI device using
kp_load_model_from_file()
, a KP API, before inference. -
For Python users, the model file (.nef) can be uploaded to Kneron AI device using
kp.core.load_model_from_file()
. -
For the usage, please refer examples related to inference.
-
In this method, the size of the model in device DDR memory (larger than NEF file size) must be below:
- 35 MB for KL520
- 60 MB for KL630
- 75 MB for KL720
- 350 MB for KL730 (KL730 SDK default setting: 350MB, and this size can be enlarged in the firmware device tree.)
-
-
Load Model from Flash
-
The model file (.nef) is written in flash, and it can be loaded using
kp_load_model_from_flash()
, a KP API, before inference. -
For Python users, the model file (.nef) is written in flash, and it can be loaded using
kp.core.load_model_from_flash()
. -
The GUI or command line of KneronDFUT can be used for writing the model file into flash.
-
For the usage, please refer the example kl520_demo_generic_image_inference_flash_model or kl720_demo_generic_image_inference_flash_model.
-
For Python users, please refer the example KL520DemoGenericImageInferenceFlashModel.py or KL720DemoGenericImageInferenceFlashModel.py.
-
In this method, the size of the model file must be below:
- 32 MB for KL520
- 55 MB for KL630
- 70 MB for KL720
- 55 MB for KL730
-
Note: Only one model file (.nef) can be loaded, no matter it was uploaded via USB or loaded from flash. If you want to change the model, please reboot the Kneron AI device.
Note: Upload model via USB can be directly used without writing model into flash.
2. Download Kneron DFUT
Download the KneronDFUT_ubuntu.zip into Ubuntu from https://www.kneron.com/tw/support/developers/. It is located at Kneron PLUS section.
$ unzip KneronDFUT_ubuntu.zip
$ cd Kneron_DFUT/
$ chmod +x bin/KneronDFUT # optional
Show help message
$ sudo sh KneronDFUT.sh --help
3. Write Model Into KL520
3.1 Use GUI to Write Model into AI Device
$ sudo sh KneronDFUT.sh
-
Select KL520 Tab.
-
Select the KL520 devices to write model into.
-
Select Update Model to Flash
-
Manually choose Model file.
-
Push Run button.
3.2 Use Command Line to Write Model into AI Device
-
List all devices
$ sudo sh KneronDFUT.sh --list
=========================================== Index: 1 Port Id: 133 Kn Number: 0x270A265C Device Type: KL520 FW Type: KDP Usb Speed: High-Speed Connectable: true ===========================================
-
Write model into the selected KL520 devices using the port id
$ sudo sh KneronDFUT.sh --model-to-flash ${MODEL_FILE_PATH} --port 133 -- type KL520
Start Update Model to Device with Port Id 133 ==== Update Model to Device with Port Id: 133 Succeeded ====
4. Write Model Into KL630
4.1 Use GUI to Write Model into AI Device
$ sudo sh KneronDFUT.sh
-
Select KL630 Tab.
-
Select the KL630 devices to write model into.
-
Select Update Model to Flash
-
Manually choose Model file.
-
Push Run button.
4.2 Use Command Line to Write Model into AI Device
-
List all devices
$ sudo sh KneronDFUT.sh --list
=========================================== Index: 1 Port Id: 13 Kn Number: 0x09011004 Device Type: KL630 FW Type: KDP2 Usb Speed: High-Speed Connectable: true ===========================================
-
Write model into the selected KL630 devices using the port id
$ sudo sh KneronDFUT.sh --model-to-flash ${MODEL_FILE_PATH} --port 13 -- type KL630
Start Update Model to Device with Port Id 13 ==== Update Model to Device with Port Id: 13 Succeeded ====
5. Write Model Into KL720
5.1 Use GUI to Write Model into AI Device
$ sudo sh KneronDFUT.sh
-
Select KL720 Tab.
-
Select the KL720 devices to write model into.
-
Select Update Model to Flash
-
Manually choose Model file.
-
Push Run button.
5.2 Use Command Line to Write Model into AI Device
-
List all devices
$ sudo sh KneronDFUT.sh --list
=========================================== Index: 1 Port Id: 262 Kn Number: 0x2004142C Device Type: KL720 FW Type: KDP Usb Speed: Super-Speed Connectable: true ===========================================
-
Write model into the selected KL720 devices using the port id
$ sudo sh KneronDFUT.sh --model-to-flash ${MODEL_FILE_PATH} --port 262 --type KL720
Start Update Model to Device with Port Id 262 ==== Update Model to Device with Port Id: 262 Succeeded ====
6. Write Model Into KL730
6.1 Use GUI to Write Model into AI Device
$ sudo sh KneronDFUT.sh
-
Select KL730 Tab.
-
Select the KL730 devices to write model into.
-
Select Update Model to Flash
-
Manually choose Model file.
-
Push Run button.
6.2 Use Command Line to Write Model into AI Device
-
List all devices
$ sudo sh KneronDFUT.sh --list
=========================================== Index: 1 Port Id: 13 Kn Number: 0x09011004 Device Type: KL730 FW Type: KDP2 Usb Speed: Super-Speed Connectable: true ===========================================
-
Write model into the selected KL730 devices using the port id
$ sudo sh KneronDFUT.sh --model-to-flash ${MODEL_FILE_PATH} --port 13 -- type KL730
Start Update Model to Device with Port Id 13 ==== Update Model to Device with Port Id: 13 Succeeded ====