AxisCommunications / onnx-to-keras

Convert onnx models exported from pytorch to tensorflow keras models with focus on performace and highleve compatibility.
MIT License
25 stars 13 forks source link

Getting "NotImplementedError" when trying to convert YOLOv5s ONNX model to Keras model. #39

Open MeenalNarkhede opened 2 years ago

MeenalNarkhede commented 2 years ago

Trying to convert YOLOv5s tag2 model (https://github.com/ultralytics/yolov5/tree/v2.0) from ONNX to Keras and getting the following error.

onnx2keras.py:52: OptimizationMissingWarning: Transpose inserted. Please report at https://github.com/AxisCommunications/onnx-to-keras/issues warnings.warn("Transpose inserted. Please report at https://github.com/AxisCommunications/onnx-to-keras/issues", OptimizationMissingWarning) Traceback (most recent call last): File "onnx2keras.py", line 707, in Fire(main) File "/home/user/anaconda3/envs/onnx2keras/lib/python3.8/site-packages/fire/core.py", line 141, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "/home/user/anaconda3/envs/onnx2keras/lib/python3.8/site-packages/fire/core.py", line 466, in _Fire component, remaining_args = _CallAndUpdateTrace( File "/home/user/anaconda3/envs/onnx2keras/lib/python3.8/site-packages/fire/core.py", line 681, in _CallAndUpdateTrace component = fn(*varargs, *kwargs) File "onnx2keras.py", line 695, in main model = onnx2keras(onnx.load(infile)) File "onnx2keras.py", line 642, in onnx2keras output_tensors = ops.make_op(node.op_type, inputs, attrs) File "onnx2keras.py", line 18, in makeop return getattr(self, 'op' + op_type.lower())(inputs, **attrs) File "onnx2keras.py", line 574, in op_transpose x = ensure_data_format(x, OnnxConstant) File "onnx2keras.py", line 56, in ensure_data_format raise NotImplementedError NotImplementedError

95hali74 commented 2 years ago

Hi!

What I can see from the stack trace, your model probably contains tensor types that are not yet supported. If you want you can share the model and I could take a quick look. You can also fix it yourself and open a PR.