Trying to convert model to coreml with coremltools 4.1 NOT WORKING

531 Views Asked by At

I am converting my model to coreml using coremltools 4.1 and for some reason I am getting this error: TypeError: 'InputLayer' object is not iterable and on line coreml_model = coremltools.converters.keras.convert(model). can anyone what I have done wrong in my code. thanks for the help. here is my snippet.

import coremltools


coreml_model = coremltools.converters.keras.convert(model)

# setup the meta datas foor our coreml modal
coreml_model.author = 'Author'
coreml_model.license = 'MIT'
coreml_model.short_description = 'Predicts the character passed in as a number between 1-9.'
coreml_model.input_description['image'] = 'A 28x28 pixel grayscale image.'
coreml_model.output_description['output1'] = 'A Multiarray where the index with the greatest float value between 0 and 1 is the recognized number.'
coreml_model.save('NumberRecognition.mlmodel')
print('model converted')
1

There are 1 best solutions below

1
On BEST ANSWER

Don't use coremltools.converters.keras.convert but coremltools.convert(...). See the docs for details: https://coremltools.readme.io/docs/introductory-quickstart