简体   繁体   English

使用Keras 2保存CoreML负载模型

[英]CoreML load model saved with Keras 2

Apple's new CoreML can work with models trained on popular framework. Apple的新CoreML可以与受欢迎框架培训的模型配合使用。 At least they say so at 18" in the WWDC video . But in the docs it seems that concerning neural nets they only support Caffe and Keras 1.2.2 ( see code ), while Keras it on it 2.0 version and Tensorflow and Theano are quite popular in their own rights. 至少他们在WWDC视频中的18英寸处这么说。但是在文档中看来,关于神经网络它们只支持Caffe和Keras 1.2.2( 见代码 ),而Keras它支持2.0版本,Tensorflow和Theano相当在他们自己的权利中流行。

To get the conversion running with Keras 2, is there a better way than implementing the conversion myself? 要使用Keras 2运行转换,有没有比自己实现转换更好的方法? The Keras conversion code in the coremltools package is ~2000 lines longs and I don't have a deep knowledge of all Keras model representation so I really don't want to go that route. coremltools包中的Keras转换代码长约 2000行,我对所有Keras模型表示都不是很了解,所以我真的不想走这条路。

I've tried converting a model saved with Keras 2 directly, but that doesn't work and fails with 我已经尝试直接转换与Keras 2一起保存的模型,但这不起作用并且失败了

TypeError: ('Keyword argument not understood:', u'gamma_initializer')

from site-packages/keras/engine/topology.py", line 326 来自site-packages/keras/engine/topology.py", line 326

They also don't have a github for coremltools so it's hard to discuss this package in more details. 他们也没有coremltools的github,因此很难更详细地讨论这个包。 I've uploaded a copy of the package: https://github.com/gsabran/coremltools 我上传了该软件包的副本: https//github.com/gsabran/coremltools

Keras 2.0 support is already there (released yesterday), with coremltools v.0.4.0 Keras 2.0支持已经存在(昨天发布),其中包含coremltools v.0.4.0

Also, refer to newest comments on Apple Developer Forums 另外,请参阅Apple Developer论坛上的最新评论

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM