Which Khadas SBC do you use?
VIM3
Which system do you use? Android, Ubuntu, OOWOW or others?
Ubuntu
Which version of system do you use? Khadas official images, self built images, or others?
Khadas official
vim3-ubuntu-20.04-gnome-linux-4.9-fenix-1.4-221229-emmc
Please describe your issue below:
I’m currently trying to convert a custom trained Mobilenetv2 onnx model using the python convert tool, however I’m running into an error that I’m not able to debug. The model was originally trained using pytorch and converted to onnx before conversion.
Command I used:
./convert --model-name mobilnet-v2-fall-simple \
--platform onnx \
--model ./mb2/mb2.onnx \
--mean-values '128 128 128 0.0078125' \
--quantized-dtype asymmetric_affine \
--source-files ./mb2/dataset.txt \
--kboard VIM3 --print-level 1
Post a console log of your issue below:
I build output layer attach_Slice_/features.16/Slice:out0
[34779] Failed to execute script pegasus
Traceback (most recent call last):
File "pegasus.py", line 131, in <module>
File "pegasus.py", line 112, in main
File "acuitylib/app/importer/commands.py", line 245, in execute
File "acuitylib/vsi_nn.py", line 171, in load_onnx
File "acuitylib/app/importer/import_onnx.py", line 127, in run
File "acuitylib/converter/onnx/convert_onnx.py", line 1239, in match_paragraph_and_param
ValueError: 'onnx' is not in list
I then tried to convert a pretrained ONNX mobilnetv2 model from the opencv model zoo, and ran into a different error. The command and error are shown below:
./convert --model-name mobilenet-opencv \
--platform onnx \
--model ./mb2-opencv/mb2.onnx \
--mean-values '128 128 128 0.0078125' \
--quantized-dtype asymmetric_affine \
--source-files ./mb2-opencv/dataset.txt \
--kboard VIM3 --print-level 1
W Unknown batch size of input input, set it to 1 to do shape inference, may cause errors.
[34682] Failed to execute script pegasus
Traceback (most recent call last):
File "pegasus.py", line 131, in <module>
File "pegasus.py", line 112, in main
File "acuitylib/app/importer/commands.py", line 245, in execute
File "acuitylib/vsi_nn.py", line 171, in load_onnx
File "acuitylib/app/importer/import_onnx.py", line 123, in run
File "acuitylib/converter/onnx/convert_onnx.py", line 61, in __init__
File "acuitylib/converter/onnx/convert_onnx.py", line 761, in _shape_inference
File "acuitylib/onnx_ir/onnx_numpy_backend/shape_inference.py", line 65, in infer_shape
File "acuitylib/onnx_ir/onnx_numpy_backend/smart_graph_engine.py", line 70, in smart_onnx_scanner
File "acuitylib/onnx_ir/onnx_numpy_backend/smart_node.py", line 48, in calc_and_assign_smart_info
File "acuitylib/onnx_ir/onnx_numpy_backend/smart_toolkit.py", line 1100, in reshape_shape
File "<__array_function__ internals>", line 6, in reshape
File "numpy/core/fromnumeric.py", line 301, in reshape
File "numpy/core/fromnumeric.py", line 61, in _wrapfunc
ValueError: cannot reshape array of size 0 into shape (0,newaxis)
I suspect it’s a onnx versioning issue, as I’m able to run the Caffe Mobilenetv2 conversion example.
Any help is greatly appreciated.