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

Is the blazeface_tflite_to_pb.py script supporting for converting quant TFLite model to pb #48

Closed
noticedollar opened this issue Nov 5, 2020 · 2 comments

Comments

@noticedollar
Copy link

I found that the blazeface_tflite_to_pb.py script works for some float TFLite model. How about the quant TFLite model to pb?
thanks

@PINTO0309
Copy link
Owner

A script for the Float16 quantization model has already been committed.

Simply add the following program to the end of the script.

        full_model = tf.function(lambda inputs: model(inputs))
        full_model = full_model.get_concrete_function(inputs=[tf.TensorSpec(model_input.shape, model_input.dtype) for model_input in model.inputs])
        frozen_func = convert_variables_to_constants_v2(full_model, lower_control_flow=False)
        frozen_func.graph.as_graph_def()
        tf.io.write_graph(graph_or_graph_def=frozen_func.graph,
                            logdir=".",
                            name='{}/model_float32.pb'.format(model_output_path),
                            as_text=False)

@noticedollar
Copy link
Author

Hi @PINTO0309 is it able to convert uint8 tflite model to pb?

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

2 participants