tf2.2环境下将h5模型装换为tflite遇到问题。

在linux服务器端,安装了TF2.2,训练了一个模型mobilenet模型,保存为h5文件,现在需要将给模型转为tflite移动端,但是出现了一下问题:

tensorflow.lite.python.convert.ConverterError: Could not find toco_from_protos binary, make sure your virtualenv bin directory or pip local bin directory is in your path.

In particular, if you have installed TensorFlow with --user, make sure you add the install directory to your path.

For example:
Linux: export PATH=$PATH:~/.local/bin/
Mac: export PATH=$PATH:~/Library/Python//bin
Alternative, use virtualenv.

模型转换的代码如下所示:

model = load_model(h5path)
converter = tf.lite.TFLiteConverter.from_keras_model(model)
litemodel = converter.convert()
open(litepath,"wb").write(litemodel)

h5path和litepath是两个路径的变量,确定无误。

也试过模型不保存直接再训练后放到from_keras_model里面 但是遇到的问题还是一样

https://blog.csdn.net/liugan528/article/details/79770680

q请问这个问题后来解决了吗 可否告知如何解决