Skip to content

Issue with converting Keras .h5 files to .tflite files #20878

@bennyooo

Description

@bennyooo

There seems to be an issue with the above mentioned conversion.
According to this documentation (https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/toco/g3doc/cmdline_examples.md#keras) it should be possible to convert a Keras model into a .tflite file. However, when I try to convert the file, the following output is given:

tflite_convert: error: one of the arguments --graph_def_file --saved_model_dir is required.

I made sure that the .h5 contains both the model and the weights. Other conversions like .pb files have worked with this file as well. Also in the help section of the commad there is no reference to --keras_model_file.

Update
I was using the wrong TF version so I got the error message above. However, using the nightly build results in other error messages:

ValueError: Unknown activation function:relu6

This error normally occurs when using load_model but there is the possibility to specify custom_objects (like relu6) to avoid it.

How can this be done with tflite_convert?

Metadata

Metadata

Assignees

Labels

comp:liteTF Lite related issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions