yinguobing / cnn-facial-landmark

Training code for facial landmark detection based on deep convolutional neural network.
MIT License
623 stars 183 forks source link

How did you convert the frozen inference model to tfcorml model? #76

Open abdou31 opened 4 years ago

abdou31 commented 4 years ago

Hello Yin, I tried to convert the frozen inference model to tfcoreml model. I have followed the tutorial mentioned here: https://github.com/tf-coreml/tf-coreml

But I really get some problems during the converting task,

ValueError: output name: input_to_float, was provided, but the Tensorflow graph does not contain a tensor with this name.

What did you use to convert your model to tfcoreml ( ios )?

+ Update:

I have successfully converted the model but I don't know if the model is valid or not:

I have got this output log:

Core ML input(s): [name: "input_to_float0" type { multiArrayType { shape: 3 shape: 112 shape: 112 dataType: DOUBLE } } ] Core ML output(s): [name: "logitsBiasAdd__0" type { multiArrayType { shape: 80 dataType: DOUBLE } } ]

Should I get :

shape:1
shape:112
shape:112
shape:3

instead of:

shape:3
shape:112
shape:112
yinguobing commented 4 years ago

I think the model is valid. Xcode could recognize a converted model if you specify the input data type as image like this:

Note the Xcode project is published a year ago and many things may have changed during this time. Please refer to the latest Apple development documentation for detailed instructions.

abdou31 commented 4 years ago

Ok, Thanks for your answer. I have tested your project with the model that you provided and it works fine, but when I integrate my model, I have got an exception. I understand this exception but I don't know really how can I solve it.

The exception says that the input should be type of an image, not Multiarray. Do you have any idea how can I set or change the type of input tensor before conversion?

abdou31 commented 4 years ago

I have solved my problem. The project "face marks" works fine in real time with good value of fps with integration of my model