You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was able to successfully save the MobileNet NIMA model as a coreML model however the input is not what I was expecting. It shows the input as MultiArray instead of an Image
base_model = MobileNet((None, None, 3), alpha=1, include_top=False, pooling='avg', weights=None)
x = Dropout(0.75)(base_model.output)
x = Dense(10, activation='softmax')(x)
model = Model(base_model.input, x)
model.load_weights('weights/mobilenet_weights.h5')
coreml_model = coremltools.converters.keras.convert(model)
coreml_model.save("mobilenet_nima2.mlmodel")
CoreML metaData
Ideally what the input and output should resemble:
I also tried converting the model by passing in an image_input_names parameter
but I received an unpack error from the coreML builder tools
/coremltools/models/neural_network/builder.py", line 2547, in set_pre_processing_parameters
channels, height, width = array_shape
ValueError: need more than 1 value to unpack
# Add image inputs
for input_ in spec.description.input:
if input_.name in image_input_names:
if input_.type.WhichOneof('Type') == 'multiArrayType':
array_shape = tuple(input_.type.multiArrayType.shape)
channels, height, width = array_shape
Any idea why the keras model is converting to a CoreML model with input MultiArray type instead of an image?
I was able to successfully save the MobileNet NIMA model as a coreML model however the input is not what I was expecting. It shows the input as MultiArray instead of an Image
CoreML metaData
Ideally what the input and output should resemble:
I also tried converting the model by passing in an image_input_names parameter
but I received an unpack error from the coreML builder tools
Code where the error originates
https://github.com/apple/coremltools/blob/master/coremltools/models/neural_network.py
Any idea why the keras model is converting to a CoreML model with input MultiArray type instead of an image?
There have been MobileNet models that have been successfully converted to a CoreML model with image as an input e.g. https://github.com/hollance/MobileNet-CoreML
The text was updated successfully, but these errors were encountered: