我正在尝试在 Android 上运行车牌检测。
可以找到wpod-net.h5
所以我尝试使用以下命令将其转换为 TensorFlow lite:
import tensorflow as tf
model = tf.keras.models.load_model('wpod-net.h5')
converter = tf.lite.TFLiteConverter.from_keras_model(model)
converter.post_training_quantize = True
tflite_model = converter.convert()
open("wpod-net.tflite", "wb").write(tflite_model)
但是当我运行这个时,我遇到了这个错误:
File "converter.py", line 3, in <module>
model = tf.keras.models.load_model('License_character_recognition.h5')
File "/home/.local/lib/python3.8/site-packages/tensorflow/python/keras/saving/save.py", line 184, in load_model
return hdf5_format.load_model_from_hdf5(filepath, custom_objects,
File "/home/.local/lib/python3.8/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 175, in load_model_from_hdf5
raise ValueError('No model found in config file.')
ValueError: No model found in config file.
我也尝试过使用 API tflite_convert --keras_model_file=License_character_recognition.h5 --output_file=test.tflite ,但它给了我同样的错误。
这是否意味着如果我自己没有训练模型,我无法将其转换为 tflite ?或者还有其他方法来转换 .h5 吗?
HUWWW
相关分类