我正在尝试将我训练过的模型(.h5)转换为coreml,但它失败了 .

coremltools(0.8)h5py(2.7.1)Keras(2.1.3)tensorflow(1.5.0)tensorflow-tensorboard(1.5.1)

错误信息:

/home/depam/Desktop/mlvirtualenv/pythonenv/local/lib/python2.7/site-packages/keras/engine/topology.py:1269:UserWarning:更新对Keras 2 API的InputLayer调用:InputLayer(dtype = “float32”,batch_input_shape = [None,416 ...,sparse = False,name =“input_1”)返回cls(** config)/home/depam/Desktop/mlvirtualenv/pythonenv/local/lib/python2.7/ site-packages / keras / engine / topology.py:1269:UserWarning:更新你对Keras 2 API的Conv2D调用:Conv2D(kernel_initializer =“glorot_uniform”,kernel_constraint = None,activity_regularizer = None,trainable = True,padding =“same “,strides = [1,1],filters = 32,use_bias = False,name =”convolution2d_1“,bias_regularizer = None,bias_constraint = None,data_format =”channels_last“,kernel_regularizer = {u'l2':0 ... . ,activation =“linear”,kernel_size =(3,3))return cls(** config)Traceback(最近一次调用last):文件“python.py”,第2行,coreml_model = coremltools.converters.keras . convert('/ home / depam / Downloads / Archive / keyboard.h5')文件“/ home / depam / Desktop / mlvirtualenv / pythonenv / local / lib / python2.7 / site-packages / coremltools / converters / keras / _keras_converter.py“,第745行,转换为custom_conversion_functions = custom_conversion_functions)文件”/ home / depam / Desktop / mlvirtualenv / pythonenv / local /lib/python2.7/site-packages/coremltools/converters/keras/_keras_converter.py“,第543行,在convertToSpec custom_objects = custom_objects中)文件”/ home / depam / Desktop / mlvirtualenv / pythonenv / local / lib / python2 . 7 / site-packages / coremltools / converters / keras / _keras2_converter.py“,第182行,在_convert model = _keras.models.load_model(model,custom_objects = custom_objects)文件”/ home / depam / Desktop / mlvirtualenv / pythonenv / local /lib/python2.7/site-packages/keras/models.py“,第243行,在load_model model = model_from_config(model_config,custom_objects = custom_objects)文件”/ home / depam / Desktop / mlvirtualenv / pythonenv / local / lib / python2.7 / site-packages / keras / models.py“,第317行,在model_from_config中返回layer_module.deserialize(config,custom_objects = custom_ob ()</ home / depam / Desktop home / depam / Desktop / mlvirtualenv / pythonenv / local / lib / python2.7 / site-packages / keras / utils / generic_utils.py“,第143行,在deserialize_keras_object列表中(custom_objects.items())))文件”/ home /depam/Desktop/mlvirtualenv/pythonenv/local/lib/python2.7/site-packages/keras/engine/topology.py“,第2507行,in_config process_layer(layer_data)文件”/ home / depam / Desktop / mlvirtualenv / pythonenv / local / lib / python2.7 / site-packages / keras / engine / topology.py“,第2493行,在process_layer中custom_objects = custom_objects)文件”/ home / depam / Desktop / mlvirtualenv / pythonenv / local / lib / python2 .7 / site-packages / keras / layers / init.py“,第55行,反序列化printable_module_name ='layer')文件”/home/depam/Desktop/mlvirtualenv/pythonenv/local/lib/python2.7/site- packages / keras / utils / generic_utils.py“,第145行,在deserialize_keras_object中返回n cls.from_config(config ['config'])文件“/home/depam/Desktop/mlvirtualenv/pythonenv/local/lib/python2.7/site-packages/keras/engine/topology.py”,第1269行, from_config返回cls(** config)文件“/home/depam/Desktop/mlvirtualenv/pythonenv/local/lib/python2.7/site-packages/keras/legacy/interfaces.py”,第91行,在包装返回函数中( * args,** kwargs)文件“/home/depam/Desktop/mlvirtualenv/pythonenv/local/lib/python2.7/site-packages/keras/layers/convolutional.py”,第462行,在init ** kwargs中)文件“/home/depam/Desktop/mlvirtualenv/pythonenv/local/lib/python2.7/site-packages/keras/layers/convolutional.py”,第116行,在init self.kernel_regularizer = regularizers.get(kernel_regularizer)文件中“/home/depam/Desktop/mlvirtualenv/pythonenv/local/lib/python2.7/site-packages/keras/regularizers.py”,第80行,在获取返回反序列化(标识符)文件“/ home / depam / Desktop / mlvirtualenv / pythonenv / local / lib / python2.7 / site-packages / keras / regularizers.py“,第73行,反序列化printable_module_name = 'regularrizer')文件“/home/depam/Desktop/mlvirtualenv/pythonenv/local/lib/python2.7/site-packages/keras/utils/generic_utils.py”,第126行,在deserialize_keras_object中引发ValueError('不正确的配置格式:'str(config))ValueError:不正确的配置格式:{u'l2':0.0005000000237487257,u'name':u'L1L2Regularizer',u'l1':0.0}