-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
convert coreml to onnx error on apply_prelu??? #331
Comments
error on apply_prelu??? |
Can you provide the model for us to debug? |
I had the same issue. I was trying to convert Openpose to an ONNX model. I used their body_25 models. The below is my code. # Convert Caffe model to CoreML
coreml_model = coremltools.converters.caffe.convert((args.caffemodel, args.protofile))
# Convert the Core ML model into ONNX
onnx_model = onnxmltools.convert_coreml(coreml_model)
# Save as protobuf
onnxmltools.utils.save_model(onnx_model, args.output) And here is the error I got. Traceback (most recent call last):
File "caffe2onnx.py", line 27, in <module>
main(args)
File "caffe2onnx.py", line 21, in main
onnx_model = onnxmltools.convert_coreml(coreml_model)
File "[home]/.virtualenvs/caffe2pytorch/lib/python3.5/site-packages/onnxmltools/convert/main.py", line 18, in convert_coreml
custom_conversion_functions, custom_shape_calculators)
File "[home]/.virtualenvs/caffe2pytorch/lib/python3.5/site-packages/onnxmltools/convert/coreml/convert.py", line 80, in convert
onnx_model = convert_topology(topology, name, doc_string, target_opset, targeted_onnx)
File "[home]/.virtualenvs/caffe2pytorch/lib/python3.5/site-packages/onnxconverter_common/topology.py", line 729, in convert_topology
registration.get_converter(operator.type)(scope, operator, container)
File "[home]/.virtualenvs/caffe2pytorch/lib/python3.5/site-packages/onnxmltools/convert/coreml/operator_converters/neural_network/Activation.py", line 27, in convert_activation
apply_prelu(scope, inputs, outputs, container, operator_name=attrs['name'], slope=[params.PReLU.alpha])
File "[home]/.virtualenvs/caffe2pytorch/lib/python3.5/site-packages/onnxconverter_common/onnx_ops.py", line 522, in apply_prelu
s_shape = slope.shape
AttributeError: 'list' object has no attribute 'shape'
|
I just encounter the same issue here. |
Hello! I was trying to convert openpose model from Caffe to ONNX too and got the same error. SCRIPT:
ERROR:
MODEL: |
I have got exactly the same error. |
Encountered the same error. |
Also met the error. |
the list object [slope] which passed to the func apply_prelu in onnxconverter_common/onnx_ops.py do not have shape attribute cause it's a list, without dive in too much, I make a quick fix simply turn the list into a NumPy array # onnxconverter_common/onnx_ops.py
def apply_prelu(scope, input_name, output_name, container, operator_name=None, slope=None):
slope=np.array(slope[0].floatValue)
... |
@vuvalini thanks for your change. Generally please make changes on onnxmltools, not on onnxconverter_common. Because onnxconverter_common is shared by other converters. This will break other converters if the change is made. |
File "/usr/local/lib/python3.6/dist-packages/onnxmltools/convert/main.py", line 18, in convert_coreml
custom_conversion_functions, custom_shape_calculators)
File "/usr/local/lib/python3.6/dist-packages/onnxmltools/convert/coreml/convert.py", line 80, in convert
onnx_model = convert_topology(topology, name, doc_string, target_opset, targeted_onnx)
File "/usr/local/lib/python3.6/dist-packages/onnxconverter_common/topology.py", line 729, in convert_topology
registration.get_converter(operator.type)(scope, operator, container)
File "/usr/local/lib/python3.6/dist-packages/onnxmltools/convert/coreml/operator_converters/neural_network/Activation.py", line 27, in convert_activation
apply_prelu(scope, inputs, outputs, container, operator_name=attrs['name'], slope=[params.PReLU.alpha])
File "/usr/local/lib/python3.6/dist-packages/onnxconverter_common/onnx_ops.py", line 440, in apply_prelu
s_shape = slope.shape
AttributeError: 'list' object has no attribute 'shape'
The text was updated successfully, but these errors were encountered: