onnx / onnxmltools

ONNXMLTools enables conversion of models to ONNX
https://onnx.ai
Apache License 2.0
1k stars 181 forks source link

Unsupported shape calculation for operator None, When convert Yolo to Onnx #479

Open ngthquocminh opened 3 years ago

ngthquocminh commented 3 years ago

I follow the instruction but got the error below:

C:\ProgramData\Anaconda3\lib\site-packages\coremltools\models\utils.py:111: RuntimeWarning: Unexpected end-group tag: Not all data was converted spec.ParseFromString(contents) Traceback (most recent call last): File "yolo2onnx.py", line 13, in onnx_model = onnxmltools.convert_coreml(coreml_model, 'Streetname Dedection') File "C:\ProgramData\Anaconda3\lib\site-packages\onnxmltools\convert\main.py", line 18, in convert_coreml return convert(model, name, initial_types, doc_string, target_opset, targeted_onnx, File "C:\ProgramData\Anaconda3\lib\site-packages\onnxmltools\convert\coreml\convert.py", line 61, in convert topology = parse_coreml(spec, initial_types, target_opset, custom_conversion_functions, custom_shape_calculators) File "C:\ProgramData\Anaconda3\lib\site-packages\onnxmltools\convert\coreml_parse.py", line 467, in parse_coreml topology.compile() File "C:\ProgramData\Anaconda3\lib\site-packages\onnxconverter_common\topology.py", line 678, in compile self._infer_all_types() File "C:\ProgramData\Anaconda3\lib\site-packages\onnxconverter_common\topology.py", line 553, in _infer_all_types operator.infer_types() File "C:\ProgramData\Anaconda3\lib\site-packages\onnxconverter_common\topology.py", line 107, in infer_types get_shape_calculator(self.type)(self) File "C:\ProgramData\Anaconda3\lib\site-packages\onnxconverter_common\registration.py", line 67, in get_shape_calculator raise ValueError('Unsupported shape calculation for operator %s' % operator_name) ValueError: Unsupported shape calculation for operator None

I use the collab project to train yolov2 model: https://colab.research.google.com/drive/1wtIQMypZQiIsDaX9aF_cC6pd3aVw6vzA?usp=drive_open&authuser=2#scrollTo=wyJS211YRSjY Does anyone have ideas? Please help me!

xadupre commented 3 years ago

Converters for coremltools models are not updated. You should use a yolo model from tensorflow or pytorch and use the associated converter library (tensorflow-onnx, pytorch).