kendryte / k230_sdk

Kendryte K230 SDK
BSD 2-Clause "Simplified" License
167 stars 36 forks source link

nncase/example内yolov5s.onnx无法转为相应的kmodel,但mbv2.tflite可以 #2

Closed roingbu closed 1 year ago

roingbu commented 1 year ago

我是使用docker的,包括本地build的,和线上pull的都试过。 其中,nncase都试过print(_nncase.version) 在./build_model.sh后 yolov5s.onnx无法转为相应的kmodel,但mbv2.tflite可以

curioyang commented 1 year ago

@roingbu 请提供一下报错信息 如果出现killed,可能是内存不足,可以增加虚拟内存再次进行尝试

roingbu commented 1 year ago

warn: Nncase.Hosting.PluginLoader[0] NNCASE_PLUGIN_PATH is not set. Nncase.IR.Call -> slice: 1, layer: 69 dim2-> start: 0, end: 1, dim3-> start: 0, end: 1 warn: Nncase.Hosting.PluginLoader[0] NNCASE_PLUGIN_PATH is not set. munmap_chunk(): invalid pointer ./build_model.sh: line 7: 563 Aborted (core dumped) python3 ./scripts/yolov5s_onnx.py --target k230 --model models/yolov5s.onnx --dataset calibration_dataset warn: Nncase.Hosting.PluginLoader[0] NNCASE_PLUGIN_PATH is not set. ./build_model.sh: line 13: 602 Segmentation fault (core dumped) python3 scripts/yolov5s_onnx_simu.py --model models/yolov5s.onnx --model_input object_detect/data/input_fp32.bin --kmodel tmp/yolov5s_onnx/test.kmodel --kmodel_input object_detect/data/input_uint8.bin

roingbu commented 1 year ago

我今天不适用docker生成文件了,不过也有了一下输出信息,有报错

warn: Nncase.Hosting.PluginLoader[0] NNCASE_PLUGIN_PATH is not set. warn: Nncase.Hosting.PluginLoader[0] NNCASE_PLUGIN_PATH is not set. ./scripts/yolov5s_onnx.py:23: DeprecationWarning: mapping.TENSOR_TYPE_TO_NP_TYPE is now deprecated and will be removed in a future release.To silence this warning, please use helper.tensor_dtype_to_np_dtype instead. input_dict['dtype'] = onnx.mapping.TENSOR_TYPE_TO_NP_TYPE[onnx_type.elem_type] WARNING: The argument input_shapes is deprecated. Please use overwrite_input_shapes and/or test_input_shapes instead. An error will be raised in the future. warn: Nncase.Hosting.PluginLoader[0] NNCASE_PLUGIN_PATH is not set. sh: 1: nncase.simulator.k230.sc: not found Failed to run k230 scmodel(32512). [..runtime_function.cpp:176 (invoke)] Input/output error [..runtime_function.cpp:176 (invoke)] Input/output error Traceback (most recent call last): File "scripts/yolov5s_onnx_simu.py", line 69, in main() File "scripts/yolov5s_onnx_simu.py", line 58, in main sim.run() RuntimeError: Input/output error

roingbu commented 1 year ago

修改相关warn之后,kmodel正常build 了,根据报错信息,可能是check simu部分出错

warn: Nncase.Hosting.PluginLoader[0] NNCASE_PLUGIN_PATH is not set. warn: Nncase.Hosting.PluginLoader[0] NNCASE_PLUGIN_PATH is not set. warn: Nncase.Hosting.PluginLoader[0] NNCASE_PLUGIN_PATH is not set. sh: 1: nncase.simulator.k230.sc: not found Failed to run k230 scmodel(32512). [..runtime_function.cpp:176 (invoke)] Input/output error [..runtime_function.cpp:176 (invoke)] Input/output error Traceback (most recent call last): File "scripts/yolov5s_onnx_simu.py", line 69, in main() File "scripts/yolov5s_onnx_simu.py", line 58, in main sim.run() RuntimeError: Input/output error

curioyang commented 1 year ago

@roingbu 请把安装nncase-kpu的路径加入PATH

export PATH=$PATH:/python安装包的路径/site_packge
roingbu commented 1 year ago

感谢,已解决