AttributeError: 'module' 对象在将 Keras 转换为 Core ML 模型时没有属性 'SeparableConv1D'

艾莉

我正在学习使用 Keras 和 CoreML 进行机器学习教程,当我开始运行以下代码并将 Keras 模型转换为 CoreML 时。我得到:

AttributeError: 'module' 对象没有属性 'SeparableConv1D'

我应该在哪里更改以解决此问题?

这是我运行的代码:

output_labels = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']

coreml_mnist = coremltools.converters.keras.convert(
    'best_model.09-0.03.h5', input_names=['image'], output_names=['output'], 
    class_labels=output_labels, image_input_names='image')

这是我得到的详细信息:

AttributeError                            Traceback (most recent call last)
<ipython-input-73-8fa50f6bbeb9> in <module>()
     10 coreml_mnist = coremltools.converters.keras.convert(
     11     'best_model.08-0.03.h5', input_names=['image'], output_names=['output'],
---> 12     class_labels=output_labels, image_input_names='image')

/usr/local/lib/python2.7/dist-packages/coremltools/converters/keras/_keras_converter.pyc in convert(model, input_names, output_names, image_input_names, input_name_shape_dict, is_bgr, red_bias, green_bias, blue_bias, gray_bias, image_scale, class_labels, predicted_feature_name, model_precision, predicted_probabilities_output, add_custom_layers, custom_conversion_functions)
    758                       predicted_probabilities_output,
    759                       add_custom_layers,
--> 760                       custom_conversion_functions=custom_conversion_functions)
    761 
    762     return _MLModel(spec)

/usr/local/lib/python2.7/dist-packages/coremltools/converters/keras/_keras_converter.pyc in convertToSpec(model, input_names, output_names, image_input_names, input_name_shape_dict, is_bgr, red_bias, green_bias, blue_bias, gray_bias, image_scale, class_labels, predicted_feature_name, model_precision, predicted_probabilities_output, add_custom_layers, custom_conversion_functions, custom_objects)
    554                                            add_custom_layers=add_custom_layers,
    555                                            custom_conversion_functions=custom_conversion_functions,
--> 556                                            custom_objects=custom_objects)
    557     else:
    558         raise RuntimeError(

/usr/local/lib/python2.7/dist-packages/coremltools/converters/keras/_keras2_converter.pyc in _convert(model, input_names, output_names, image_input_names, input_name_shape_dict, is_bgr, red_bias, green_bias, blue_bias, gray_bias, image_scale, class_labels, predicted_feature_name, predicted_probabilities_output, add_custom_layers, custom_conversion_functions, custom_objects)
    207     # Build network graph to represent Keras model
    208     graph = _topology2.NetGraph(model)
--> 209     graph.build()
    210 
    211     # The graph should be finalized before executing this

/usr/local/lib/python2.7/dist-packages/coremltools/converters/keras/_topology2.pyc in build(self, is_top_level)
    748             self.insert_1d_permute_layers()
    749             self.insert_permute_for_spatial_bn()
--> 750             self.defuse_activation()
    751             self.remove_internal_input_layers()
    752 

/usr/local/lib/python2.7/dist-packages/coremltools/converters/keras/_topology2.pyc in defuse_activation(self)
    508                 isinstance(k_layer, _keras.layers.Conv1D) or
    509                 isinstance(k_layer, _keras.layers.SeparableConv2D) or
--> 510                 isinstance(k_layer, _keras.layers.SeparableConv1D) or
    511                 isinstance(k_layer, _keras.layers.Dense)):
    512 

AttributeError: 'module' object has no attribute 'SeparableConv1D'
史努比博士

好像你正在使用的版本keras是不支持通过coremltools,作为SeparableConv1D比keras 2.0.6以后添加,你应该升级keras到最新版本为这个工作。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

诅咒返回AttributeError:'module'对象没有属性'initscr'

来自分类Dev

每个调用的Scapy AttributeError:'module'对象没有属性'*'

来自分类Dev

Python RQ AttributeError:'dict'对象没有属性'__module__'

来自分类Dev

将Keras模型转换为C ++

来自分类Dev

Keras导入模型AttributeError的:“NoneType”对象有没有属性“运”

来自分类Dev

Keras:AttributeError:“ int”对象没有属性“ lower”

来自分类Dev

Keras:AttributeError:“ int”对象没有属性“ lower”

来自分类Dev

AttributeError:尝试使用keras进行转移学习时,“ tuple”对象没有属性“ layer”

来自分类Dev

AttributeError:使用Keras顺序模型时,“尺寸”对象没有属性“ log10”

来自分类Dev

将tflearn模型转换为keras

来自分类Dev

AttributeError:在具有自定义生成器的Keras模型上调用fit时,“ tuple”对象没有属性“ rank”

来自分类Dev

使用PySpark将rdd转换为数据帧:AttributeError:'RDD'对象没有属性'toDF'

来自分类Dev

Keras AttributeError:“功能”对象没有属性“形状”

来自分类Dev

AttributeError:将模型连接到管理员时,“列表”对象没有属性“全部”

来自分类Dev

诅咒返回AttributeError:'module'对象没有属性'initscr'

来自分类Dev

Pyspark ml无法拟合模型,并且总是“ AttributeError:'PipelinedRDD'对象没有属性'_jdf'

来自分类Dev

AttributeError: 'module' 对象没有属性 'MutableSet'

来自分类Dev

AttributeError: 'module' 对象没有属性 'InitFont'

来自分类Dev

AttributeError: 'module' 对象在 Pandas 中没有属性 'to_numeric'

来自分类Dev

Google Dataflow 显示 AttributeError: 'module' 对象没有属性 'Read'

来自分类Dev

AttributeError: 'module' 对象在 Maven 项目中没有属性 '_keydown'

来自分类Dev

AttributeError: 'module' 对象没有属性 'Bussiness'

来自分类Dev

attributeerror 'module' 对象没有属性 'openfile'

来自分类Dev

Tensorflow 导入错误 AttributeError: 'module' 对象没有属性 'Exporter'

来自分类Dev

AttributeError: 'Tensor' 对象在使用后端 random_uniform 时没有属性 '_keras_history'

来自分类Dev

AttributeError: 'numpy.ufunc' 对象没有属性 '__module__'

来自分类Dev

AttributeError: 'module' 对象没有属性 'home'

来自分类Dev

AttributeError 'module' 对象没有属性 'decodebytes'

来自分类Dev

无法将 Keras 模型转换为 Coreml

Related 相关文章

  1. 1

    诅咒返回AttributeError:'module'对象没有属性'initscr'

  2. 2

    每个调用的Scapy AttributeError:'module'对象没有属性'*'

  3. 3

    Python RQ AttributeError:'dict'对象没有属性'__module__'

  4. 4

    将Keras模型转换为C ++

  5. 5

    Keras导入模型AttributeError的:“NoneType”对象有没有属性“运”

  6. 6

    Keras:AttributeError:“ int”对象没有属性“ lower”

  7. 7

    Keras:AttributeError:“ int”对象没有属性“ lower”

  8. 8

    AttributeError:尝试使用keras进行转移学习时,“ tuple”对象没有属性“ layer”

  9. 9

    AttributeError:使用Keras顺序模型时,“尺寸”对象没有属性“ log10”

  10. 10

    将tflearn模型转换为keras

  11. 11

    AttributeError:在具有自定义生成器的Keras模型上调用fit时,“ tuple”对象没有属性“ rank”

  12. 12

    使用PySpark将rdd转换为数据帧:AttributeError:'RDD'对象没有属性'toDF'

  13. 13

    Keras AttributeError:“功能”对象没有属性“形状”

  14. 14

    AttributeError:将模型连接到管理员时,“列表”对象没有属性“全部”

  15. 15

    诅咒返回AttributeError:'module'对象没有属性'initscr'

  16. 16

    Pyspark ml无法拟合模型,并且总是“ AttributeError:'PipelinedRDD'对象没有属性'_jdf'

  17. 17

    AttributeError: 'module' 对象没有属性 'MutableSet'

  18. 18

    AttributeError: 'module' 对象没有属性 'InitFont'

  19. 19

    AttributeError: 'module' 对象在 Pandas 中没有属性 'to_numeric'

  20. 20

    Google Dataflow 显示 AttributeError: 'module' 对象没有属性 'Read'

  21. 21

    AttributeError: 'module' 对象在 Maven 项目中没有属性 '_keydown'

  22. 22

    AttributeError: 'module' 对象没有属性 'Bussiness'

  23. 23

    attributeerror 'module' 对象没有属性 'openfile'

  24. 24

    Tensorflow 导入错误 AttributeError: 'module' 对象没有属性 'Exporter'

  25. 25

    AttributeError: 'Tensor' 对象在使用后端 random_uniform 时没有属性 '_keras_history'

  26. 26

    AttributeError: 'numpy.ufunc' 对象没有属性 '__module__'

  27. 27

    AttributeError: 'module' 对象没有属性 'home'

  28. 28

    AttributeError 'module' 对象没有属性 'decodebytes'

  29. 29

    无法将 Keras 模型转换为 Coreml

热门标签

归档