atveit / keras2ios

Run Keras Deep Learning Models (basic case) with CoreMLTools for iOS 11
49 stars 10 forks source link

Error exporting on coremltools 0.6.3 : 'module' object has no attribute 'mobilenet' #1

Open JacopoMangiavacchi opened 7 years ago

JacopoMangiavacchi commented 7 years ago

Hi Amund,

I'm trying your sample using Keras 2.0.4 (TensorFlow 1.1.0 backend) and coremltools (0.6.3) on Python 2.7

I successfully created and saved the h5 model but I'm getting this error converting the model with coremltools:

AttributeError Traceback (most recent call last)

in () 1 import coremltools ----> 2 coreml_model = coremltools.converters.keras.convert(model) 3 coreml_model.save("keras_model.mlmodel") /Users/Jacopo/anaconda/envs/KerasTensorFlowCoreML/lib/python2.7/site-packages/coremltools/converters/keras/_keras_converter.pyc in convert(model, input_names, output_names, image_input_names, is_bgr, red_bias, green_bias, blue_bias, gray_bias, image_scale, class_labels, predicted_feature_name, predicted_probabilities_output) 489 predicted_probabilities_output = predicted_probabilities_output) 490 elif _HAS_KERAS2_TF: --> 491 from . import _keras2_converter 492 return _keras2_converter._convert(model = model, 493 input_names = input_names, /Users/Jacopo/anaconda/envs/KerasTensorFlowCoreML/lib/python2.7/site-packages/coremltools/converters/keras/_keras2_converter.py in () 66 _keras.layers.wrappers.TimeDistributed:_layers2.default_skip, 67 ---> 68 _keras.applications.mobilenet.DepthwiseConv2D:_layers2.convert_convolution, 69 70 } AttributeError: 'module' object has no attribute 'mobilenet' Can you please give me any hint ? Thanks, Jacopo
dariuxmx commented 6 years ago

Hi Jacopo, I have a similar error and was able to solve it using keras 1.2.2.