Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoreML conversion fails: "ValueError: Only channel and sequence concatenation are supported." #1

Open
galli-leo opened this issue Oct 4, 2017 · 4 comments

Comments

@galli-leo
Copy link

galli-leo commented Oct 4, 2017

Hi,

First of all, thanks for going through all the hassle of converting the model to keras so I don't have to :)

I tried to do the keras to coreml conversion, but it fails with the following error:

55 : activation_14, <keras.layers.core.Activation object at 0x12fc5a350>
56 : concatenate_1, <keras.layers.merge.Concatenate object at 0x12fbee610>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/coremltools/converters/keras/_keras_converter.py", line 504, in convert
    predicted_probabilities_output = predicted_probabilities_output)
  File "/Library/Python/2.7/site-packages/coremltools/converters/keras/_keras2_converter.py", line 278, in _convert
    converter_func(builder, layer, input_names, output_names, keras_layer)
  File "/Library/Python/2.7/site-packages/coremltools/converters/keras/_layers2.py", line 511, in convert_merge
    mode = _get_elementwise_name_from_keras_layer(keras_layer)
  File "/Library/Python/2.7/site-packages/coremltools/converters/keras/_layers2.py", line 79, in _get_elementwise_name_from_keras_layer
    raise ValueError('Only channel and sequence concatenation are supported.')
ValueError: Only channel and sequence concatenation are supported.

Do you have an idea what I could do to fix that? Or would it be possible to send me the converted coreml model directly?

After looking through the notebook again, it seems like you changed the keras / coremltools packge. Can you share those changes / include them in the source?

Additionally, how well does the core ml model work? Did it generate the correct embeddings for the lfw images?

@vsyw
Copy link
Owner

vsyw commented Oct 22, 2017

Hi @galli-leo,

Since Coremltools only supports channel-last model, and the model I uploaded is channel-first, I just pushed the channel-first model, you can try it again.
But there is another problem with Coremltools, it doesn't support Lamda Layer (form Keras), so I altered Coremltools source code a little bit to make it work. Per your request, I have included the CoreML Model.

CoreML model works very well on iOS devices, it generates exactly the same embeddings as Torch / Keras version, and it runs about 30FPS on iOS devices.

Let me know if you have any other questions.

Victor

@pkwete
Copy link

pkwete commented Oct 28, 2017

@iwantooxxoox @galli-leo Is the coreML model available in the repo? Let me know the location otherwise, kindly include it. Thanks.

@galli-leo
Copy link
Author

@iwantooxxoox That sounds very cool (cannot seem to find the model though :/). Could you also include the changes you made to the coreml source code? I want to try and convert a tenserflow version I found, since it seems to have better accuracy than the openface one. Thus your changes may be helpful :)

Anyways, I also tried my luck converting the torch version directly (see: prisma-ai/torch2coreml#9). Unfortunately the numbers are a bit off when comparing torch vs coreml. Just out of curiosity, do you happen to know why that might be?

@vsyw
Copy link
Owner

vsyw commented Nov 2, 2017

@pkwete, @galli-leo,
The CoreML model has been included in the model folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants