Open 1165048017 opened 3 years ago
I tried this conversion briefly as well but apparently some operation is not compatible with tflite. I'll keep this open for now.
I tried this conversion briefly as well but apparently some operation is not compatible with tflite. I'll keep this open for now.
With the new models version (TF2), the mentioned operations are still incompatible?
I'm new to this world and I don't understand much but I tried to convert like this:
converter = tf.lite.TFLiteConverter.from_saved_model("./models/metrabs_eff2l_y4")
and it raised an error:
ValueError: Only support at least one signature key.
It seems that there isn't any signature but I checked the code (src/models/metrabs.py) and I saw a signature( and it isn't t the only one).
I'm missing something or it is an intentional behavior?
Thanks for you hard work!
Can you let me know what your use case would be? The big model needs a powerful GPU anyway, so it's not like you can deploy it easily on some lightweight embedded device. I'll try looking into it though.
I'm writing an android app to evaluate pose differences for a university project. I posted the previous code as example but this error came out also with using the MobileNet model.
The code:
converter = tf.lite.TFLiteConverter.from_saved_model("./models/metrabs_mob3l_y4t")
the error:
ValueError: Only support at least one signature key.
@Nick22ll you could try to save the model with a different signature. I haven't tested this, but it might be a step in the right direction. lmk!
import tensorflow as tf
model_folder = 'models/metrabs_eff2s_y4/'
out_fold='models/eff2s_y4_short_sig'
model = tf.saved_model.load(model_folder)
@tf.function()
def my_predict(my_prediction_inputs, **kwargs):
prediction = model.detect_poses(my_prediction_inputs)
return {"prediction": prediction['poses3d']}
my_signatures = my_predict.get_concrete_function(
my_prediction_inputs=tf.TensorSpec([None,None, 3], dtype=tf.dtypes.uint8, name="image"))
tf.saved_model.save(model, out_fold, signatures=my_signatures)
@tobibaum thank you very much! In the end I changed my mind... I decided to develop a WebApp and run the models in a python server. Maybe in the future I'll try your idea: I have plenty of projects in mind!
Since this is still open I will confirm that the method that @tobibaum proposed is not working because of two operators that are not supported by tflite (Cross and ResizeArea) that would need to be implemented as custom operators.
I think that there is a way to overcome ResizeArea by fixing the input size of the signature and modifying the parameters used in the prediction, but I could not figure out a way to get around Cross, if you have any idea I am open to suggeestions :D
I downloaded the single person from here
And want to convert the saved model to tflite model by
tflite converter
:then it crashed and the log is
Did I miss something while converting? Thanks for you good job ~~~