coremltools doesn't convert from keras to coreml

Hi,


I'm using coremltools 0.6.3, tensorflow 1.3.0, keras 2.0.8 and I keep running into this error:


coremlconverter.py


import coremltools

coreml_model = coremltools.converters.keras.convert('tinyYolov3.h5')

coreml_model.save('tankYOLO.mlmodel')



python ../coremlconverter.py

Using TensorFlow backend.

Traceback (most recent call last):

File "../coremlconverter.py", line 6, in <module> coreml_model = coremltools.converters.keras.convert('tinyYolov3.h5')

AttributeError: 'module' object has no attribute 'convert'


I've tried version 2.0.2, 2.0.4, 2.0.6, 2.0.7 of keras but nothing seems to work. There is very little information out there and I haven't been able to find anything in days of searching. I'm hoping someone here, or folks from Apple will be able to point me in the right direction.


Thank you!

Replies

That code should work. My guess is that your installation of coremltools is damaged somehow.

Hello sicyx ,


Me too facing the same issue, if you got the solution please help me out.

You must use virtualenv


Please see the solution here https://stackoverflow.com/questions/54166644/keras-mlmodel-coreml-object-has-no-attribute-convert/57816724#57816724