我使用coremltools4.1将我的模型转换为coreml,由于某种原因,我得到了这个错误:TypeError: 'InputLayer' object is not iterable,并在线coreml_model =coremltools.converters.keras.convert(模型)。任何人都可以知道我在代码中做错了什么。谢谢你的帮助。这是我的代码片段。
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')发布于 2021-04-23 18:27:07
不要使用coremltools.convert(...),而要使用coremltools.converters.keras.convert。有关详情,请参阅文档:https://coremltools.readme.io/docs/introductory-quickstart
https://stackoverflow.com/questions/67222236
复制相似问题