tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

convert onnx model to coreml model error?

Open lxj0276 opened this issue 6 years ago • 2 comments

when I run the demo utorials/examples/CoreML/ONNXLive/,step by step,I convert onnx model to coreml model, python onnx_to_coreml.py ./saved_models/candy.onnx ./saved_models/candy.mlmodel

I shows the error message like 51/64: Converting Node Type InstanceNormalization 52/64: Converting Node Type Add 53/64: Converting Node Type Upsample Traceback (most recent call last): File "onnx_to_coreml.py", line 22, in <module> coreml_model = convert(model_proto, image_input_names=['0'], image_output_names=['186']) File "/Users/lixianjie/anaconda2/envs/cpp/lib/python3.6/site-packages/onnx_coreml/converter.py", line 458, in convert _convert_node(builder, node, graph, err) File "/Users/lixianjie/anaconda2/envs/cpp/lib/python3.6/site-packages/onnx_coreml/_operators.py", line 1755, in _convert_node return converter_fn(builder, node, graph, err) File "/Users/lixianjie/anaconda2/envs/cpp/lib/python3.6/site-packages/onnx_coreml/_operators.py", line 1440, in _convert_upsample scales = node.attrs["scales"] KeyError: 'scales' can anybody tell me what's wrong with my code?

lxj0276 avatar Jan 31 '19 09:01 lxj0276

just same error with yours. by the way, I use the Netron to see the model structure and the final ID is 128, not the 186 which the example mentioned.

below is my error log:WARNING:root:TensorFlow version 1.8.0 detected. Last version known to be fully compatible is 1.5.0 . 1/64: Converting Node Type Pad 2/64: Converting Node Type Conv 3/64: Converting Node Type InstanceNormalization 4/64: Converting Node Type Relu 5/64: Converting Node Type Pad 6/64: Converting Node Type Conv 7/64: Converting Node Type InstanceNormalization 8/64: Converting Node Type Relu 9/64: Converting Node Type Pad 10/64: Converting Node Type Conv 11/64: Converting Node Type InstanceNormalization 12/64: Converting Node Type Relu 13/64: Converting Node Type Pad 14/64: Converting Node Type Conv 15/64: Converting Node Type InstanceNormalization 16/64: Converting Node Type Relu 17/64: Converting Node Type Pad 18/64: Converting Node Type Conv 19/64: Converting Node Type InstanceNormalization 20/64: Converting Node Type Add 21/64: Converting Node Type Pad 22/64: Converting Node Type Conv 23/64: Converting Node Type InstanceNormalization 24/64: Converting Node Type Relu 25/64: Converting Node Type Pad 26/64: Converting Node Type Conv 27/64: Converting Node Type InstanceNormalization 28/64: Converting Node Type Add 29/64: Converting Node Type Pad 30/64: Converting Node Type Conv 31/64: Converting Node Type InstanceNormalization 32/64: Converting Node Type Relu 33/64: Converting Node Type Pad 34/64: Converting Node Type Conv 35/64: Converting Node Type InstanceNormalization 36/64: Converting Node Type Add 37/64: Converting Node Type Pad 38/64: Converting Node Type Conv 39/64: Converting Node Type InstanceNormalization 40/64: Converting Node Type Relu 41/64: Converting Node Type Pad 42/64: Converting Node Type Conv 43/64: Converting Node Type InstanceNormalization 44/64: Converting Node Type Add 45/64: Converting Node Type Pad 46/64: Converting Node Type Conv 47/64: Converting Node Type InstanceNormalization 48/64: Converting Node Type Relu 49/64: Converting Node Type Pad 50/64: Converting Node Type Conv 51/64: Converting Node Type InstanceNormalization 52/64: Converting Node Type Add 53/64: Converting Node Type Upsample Traceback (most recent call last): File "onnx_to_coreml.py", line 35, in coreml_model = convert(model_proto, image_input_names=['0'], image_output_names=['186']) File "/Applications/anaconda/lib/python3.6/site-packages/onnx_coreml/converter.py", line 458, in convert _convert_node(builder, node, graph, err) File "/Applications/anaconda/lib/python3.6/site-packages/onnx_coreml/_operators.py", line 1755, in _convert_node return converter_fn(builder, node, graph, err) File "/Applications/anaconda/lib/python3.6/site-packages/onnx_coreml/_operators.py", line 1440, in _convert_upsample scales = node.attrs["scales"] KeyError: 'scales'

perry0418 avatar Feb 02 '19 06:02 perry0418

problem has been solved by this link: https://github.com/onnx/onnx-coreml/issues/365#issuecomment-459389469

perry0418 avatar Feb 08 '19 10:02 perry0418