[KL520DemoGenericInferencePostYolo][Error code] ApiReturnCode.KP_ERROR_USB_TIMEOUT_N7
My environment virtualbox + ubuntu 18.04
I run KL520DemoGenericInferencePostYolo.py but show
Error: upload model failed, error = 'Error raised in function: load_model_from_file. Error code: -7. Description: ApiReturnCode.KP_ERROR_USB_TIMEOUT_N7'
before run KL520DemoGenericInferencePostYolo.py, i was run List all devices & upgrade the selected KL520 devices using the port id as follows
(1) lsusb
Bus 001 Device 007: ID 3231:0100
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
(2) ./KneronDFUT.sh --list
===========================================
Index: 1
Port Id: 5
Kn Number: 0x9E0A225C
Device Type: KL520
FW Type: KDP2 Loader
Usb Speed: High-Speed
Connectable: true
===========================================
(3) sudo ./KneronDFUT --kl520-flash-boot --port 5 --scpu ../../kneron_plus_v1.3.0/kneron_plus/res/firmware/KL520/kdp2_fw_scpu.bin --ncpu ../../kneron_plus_v1.3.0/kneron_plus/res/firmware/KL520/kdp2_fw_ncpu.bin
This update do not accept Hostlib version firmware. Downgrade firmware to earlier version is not acceptable after update.
Do you want to proceed? (y/n)
y
Start Update Device with Port Id 5 to Flash Boot
Segmentation fault
i suppose can't downgrade firmware so before run KL520DemoGenericInferencePostYolo.py, I mark upload firmware to device
"""
try:
print('[Upload Firmware]')
kp.core.load_firmware_from_file(device_group=device_group,
scpu_fw_path=SCPU_FW_PATH,
ncpu_fw_path=NCPU_FW_PATH)
print(' - Success')
except kp.ApiKPException as exception:
print('Error: upload firmware failed, error = \'{}\''.format(str(exception)))
exit(0)
"""
python KL520DemoGenericInferencePostYolo.py
[Connect Device]
- Success
[Set Device Timeout]
- Success
[Upload Model]
Error: upload model failed, error = 'Error raised in function: load_model_from_file. Error code: -7. Description: ApiReturnCode.KP_ERROR_USB_TIMEOUT_N7'
Comments
Hello,
The issue could be caused by insufficient permission to access usb device.
Please following the steps to set config for Kneron's device.
Hi
之前環境是Virtual box + Ubuntu 18.04
現在環境改成 win10 + python3.6
(1) Run KL520DemoGenericInferencePostYolo.py -- OK
[Connect Device]
- Success
[Set Device Timeout]
- Success
[Upload Firmware]
- Success
[Upload Model]
- Success
[Read Image]
- Success
[Starting Inference Work]
- Starting inference loop 50 times
- ..................................................
[Retrieve Inference Node Output ]
- Success
[Tiny Yolo V3 Post-Processing]
- Success
[Result]
{
"class_count": 80,
.......
(2) Run KL520DemoCamGenericInferenceDropFrame.py -- 是可以成功, 但是偶爾3~5秒後, 出現 ApiReturnCode.KP_ERROR_USB_TIMEOUT_N7
[Connect Device]
- Success
[Set Device Timeout]
- Success
[Upload Firmware]
- Success
[Upload Model]
- Success
[Model NEF Information]
{
"crc": "0x6CBF1FF9",
"num_models": 1,
"models": {
"0": {
"id": 19,
"max_raw_out_size": 85752,
"width": 224,
"height": 224,
"channel": 3,
"img_format": "ImageFormat.KP_IMAGE_FORMAT_RGBA8888"
}
}
}
[Configure Inference Settings]
- Success
[Starting Inference Work]
- Starting inference
inference time: 0.04555344581604004
inference time: 0.030225038528442383
inference time: 0.031000137329101562
inference time: 0.03219795227050781
inference time: 0.04864621162414551
inference time: 0.027132511138916016
inference time: 0.029174327850341797
inference time: 0.031023740768432617
inference time: 0.03415870666503906
.......
- Error: inference failed, error = Error raised in function: generic_raw_inference_receive. Error code: -7. Description: ApiReturnCode.KP_ERROR_USB_TIMEOUT_N7
- Error: inference failed, error = Error raised in function: generic_raw_inference_send. Error code: -7. Description: ApiReturnCode.KP_ERROR_USB_TIMEOUT_N7
遇到這樣問題後,需要把USB dongle插拔後才會正常..
巫虹葦
Hi 巫虹葦,
想請您確認一下,您是使用 Kneron PLUS 的哪一個版本。
Hi
您好..
我是抓\kneron_plus_v1.3.0\ 這個版本 ..
巫虹葦
Hi 巫虹葦,
根據您貼上來的執行過程,您可能是有修改 python script,你可以先幫我試試看使用 "沒有修改的 python script" 是否會造成問題。
Hi
您好..
Sorry沒有敘述清楚,之前在Virtualbox+ubuntu18.04因為遇到一些問題,所以把uplaod Firmware的 code註解掉.
但是換到win10環境後,沒有特別再去修改example的code了 ..
@巫虹葦
Hi 巫虹葦,
不好意思,我也沒有講述清楚,
想請問您在兩個環境中
(1) Virtual box + Ubuntu 18.04
(2) win10 + python3.6
執行 kneron_plus_v1.3.0 內 原來的範例(沒有修改過的 python scripts) 是否就會出現問題。
python scripts eg. KL520DemoGenericInferencePostYolo.py,
KL520DemoCamGenericInferenceDropFrame.py
也想請您描述一下您在 Virtualbox+ubuntu18.04 是遇到那些問題呢,是你前面所描述的問題(下述的錯誤訊息)嗎?
"Error: upload model failed, error = 'Error raised in function: load_model_from_file. Error code: -7. Description: ApiReturnCode.KP_ERROR_USB_TIMEOUT_N7'"
然後提醒您 KL520 dongle 不用特別將 firmware 燒入到 Flash,您只要透過此 Kneron API (kp.core.load_firmware_from_file) upload firmware 到 Dongle 上就可以了,所以把 uplaod Firmware 的 code 註解掉是不行的。
Hi
原來的範例(沒有修改過的 python scripts) 下
(1) Virtual box + Ubuntu 18.04
python scripts eg. KL520DemoGenericInferencePostYolo.py,
出現
[connect device]
success
[set Device timeout]
success
[Upload Firmware]
Error code 10 ApiReturnCode.KP_DEVICE_NOT_EXIST_10
Segmentation fault (core dumped)
因為我一開始就遇到Upload Firmware失敗,所以我直接跳過Upload Firmware直接upload model,所以我一開始的問題才會是
[Upload Model]
Error: upload model failed, error = 'Error raised in function: load_model_from_file. Error code: -7. Description: ApiReturnCode.KP_ERROR_USB_TIMEOUT_N7'
因為環境是VirtualBox,排除環境的問題後,才改成在win10上嘗試,才有下一個問題.
在win10上使用時候,有發現[Upload Firmware]的階段,會出現USB dongle unplug-in -> plug-in 的現象,再猜想在Virtual box + Ubuntu 18.04環境[Upload Firmware]時候,unplug-in後沒有自動plug-in上來才會出現 Error code 10 ApiReturnCode.KP_DEVICE_NOT_EXIST_10, 因為出現這個error後lsusb就看不到這個裝置了,必須手動拔插一 次才認得到USB裝置, 因為有這些問題,所以就暫時不關注在環境上,改成用win10 + python3.6嘗試
(2) win10 + python3.6
python scripts eg. KL520DemoGenericInferencePostYolo.py, - 正常沒有問題
python KL520DemoCamGenericInferenceDropFrame.py - 是可以成功, 但是偶爾3~5秒後, 出現 ApiReturnCode.KP_ERROR_USB_TIMEOUT_N7
@巫虹葦
Hi 巫虹葦,
您在兩個環境中
(1) Virtual box + Ubuntu 18.04
(2) win10 + python3.6
執行 kneron_plus_v1.3.0
(1) 您在 Virtual box + Ubuntu 18.04 上可能得先確認 Virtual box 是否有偵測到您的 KL520 dongle,有時候 Virtual box 會突然找不到 device.
還有記得您的 KL520 不要使用以下指令去燒 firmware to flash,請以這個 API ( kp.core.load_firmware_from_file) upload KL520 firmware.
sudo ./KneronDFUT --kl520-flash-boot --port 5 --scpu ../../kneron_plus_v1.3.0/kneron_plus/res/firmware/KL520/kdp2_fw_scpu.bin --ncpu ../../kneron_plus_v1.3.0/kneron_plus/res/firmware/KL520/kdp2_fw_ncpu.bin
(2) 您在 win10 + python3.6 執行 python KL520DemoCamGenericInferenceDropFrame.py,偶爾出現 ApiReturnCode.KP_ERROR_USB_TIMEOUT_N7 的時候,你的 camera 是否有持續的開著,然後螢幕上是否有畫面呢?
Hello
您好.
(1) 您在 Virtual box + Ubuntu 18.04 上可能得先確認 Virtual box 是否有偵測到您的 KL520 dongle,有時候 Virtual box 會突然找不到 device.
還有記得您的 KL520 不要使用以下指令去燒 firmware to flash,請以這個 API ( kp.core.load_firmware_from_file) upload KL520 firmware.
sudo ./KneronDFUT --kl520-flash-boot --port 5 --scpu ../../kneron_plus_v1.3.0/kneron_plus/res/firmware/KL520/kdp2_fw_scpu.bin --ncpu ../../kneron_plus_v1.3.0/kneron_plus/res/firmware/KL520/kdp2_fw_ncpu.bin
了解.. 不過我在win環境也透過Tool直接做燒錄,並且在win環境下執行KL520DemoGenericInferencePostYolo.py,把upload firmware mark掉,也是可以正常的upload model以及predict,我想我應該燒錄有成功吧 ??
(2) 您在 win10 + python3.6 執行 python KL520DemoCamGenericInferenceDropFrame.py,偶爾出現 ApiReturnCode.KP_ERROR_USB_TIMEOUT_N7 的時候,你的 camera 是否有持續的開著,然後螢幕上是否有畫面呢?
發生這問題時候,python的程式就 crashed,camera畫面也關掉了.
@巫虹葦
Hi 巫虹葦,
非必要時,我們並不鼓勵使用者 KL520 dongle 自己燒 firmware to flash,您可以參考以下資料。
1. Introduction
3. Install Driver for Windows
3.1 Use GUI to Update AI Device
如果您需要順利成功執行範例,您的 dongle 插上,執行 DFUT GUI 可以看到如下圖