我有一个转换tflite的代码。它是代码:
from tensorflow import lite
from tensorflow.keras
import models
# Parameters
keras_model_filename =
'wake_word_stop_model.h5'
tflite_filename = 'wake_word_stop_lite.tflite'
# Convert model to TF Lite
model
model = models.load_model(keras_model_ filename)
converter
=lite.TFLiteConverter.from_keras_model(model)
tflite_model =
converter.convert()
open(tflite_filename,
'wb').write(tflite_model
''' 但是此代码错误。带有消息AttributeError:类型对象'TFLiteConverter'没有属性'from_keras_model'
答案 0 :(得分:0)
from_keras_model
是Tensorflow 2.x的API
您可以使用from_keras_model_file
API
但是我建议考虑升级到2.x版本