I'm trying to convert Keras to a Core ML model but I'm stuck when converting the Python file into a mlmodel.
I'm getting errors when importing submodules of 'coremltools'.
The error that I'm getting is: "python recog.py Traceback (most recent call last): File "recog.py", line 3, in from coremltools import convert ImportError: cannot import name 'convert' "
I tried to import the submodules in a different way but nothing worked for me.
I hope anyone can help me!
You can see the Python code, in the sample below:
import coremltools
from coremltools import converters
from coremltools import convert
coreml_model = coremltools.converters.keras.convert('model.h5', input_names='data', image_input_names='data', is_bgr=True, output_names='species')
coreml_model.save('model.mlmodel')
convertmodule, package or name in thecoremltoolspackage (See github.com/apple/coremltools/tree/v0.8/coremltools) For importing thekerasconverter, write this to import thekeraspackage:from coremltools.converters import keras. Then use askeras.convert(...)- Oluwafemi Sule