MPolaris / onnx2tflite

Tool for onnx->keras or onnx->tflite. Hope this tool can help you.
Apache License 2.0
526 stars 42 forks source link

ValueError #39

Closed SuyueLiu closed 1 year ago

SuyueLiu commented 1 year ago

Traceback (most recent call last): File "converter.py", line 108, in run() File "converter.py", line 92, in run onnx_converter( File "converter.py", line 21, in onnx_converter keras_model = keras_builder(model_proto, native_groupconv) File "/home/liusuyue/3080ti/face/onnx2tflite/utils/builder.py", line 82, in keras_builder tf_tensor[node_outputs[index]] = tf_operator(tf_tensor, onnx_weights, node_inputs, op_attr, index=index)(_inputs) File "/home/liusuyue/3080ti/face/onnx2tflite/layers/activations_layers.py", line 78, in call return self.PRelu(inputs) File "/home/liusuyue/anaconda3/envs/dev/lib/python3.8/site-packages/keras/engine/base_layer.py", line 976, in call return self._functional_construction_call(inputs, args, kwargs, File "/home/liusuyue/anaconda3/envs/dev/lib/python3.8/site-packages/keras/engine/base_layer.py", line 1114, in _functional_construction_call outputs = self._keras_tensor_symbolic_call( File "/home/liusuyue/anaconda3/envs/dev/lib/python3.8/site-packages/keras/engine/base_layer.py", line 848, in _keras_tensor_symbolic_call return self._infer_output_signature(inputs, args, kwargs, input_masks) File "/home/liusuyue/anaconda3/envs/dev/lib/python3.8/site-packages/keras/engine/base_layer.py", line 886, in _infer_output_signature self._maybe_build(inputs) File "/home/liusuyue/anaconda3/envs/dev/lib/python3.8/site-packages/keras/engine/base_layer.py", line 2670, in _maybe_build self.set_weights(self._initial_weights) File "/home/liusuyue/anaconda3/envs/dev/lib/python3.8/site-packages/keras/engine/base_layer.py", line 1799, in set_weights raise ValueError( ValueError: Layer weight shape (1, 1, 128) not compatible with provided weight shape (128, 1, 1)

I got this error when converting onnx model to tflite, any idea to solve this?

MPolaris commented 1 year ago

Can you share onnx to me, it's seems sequence of weight's channel is mismatch.