I have a code for convert tflite. it is the code:
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
''' but this code error. with message AttributeError: type object 'TFLiteConverter' has no attribute 'from_keras_model'
from_keras_model
is an API of Tensorflow 2.x
You could use from_keras_model_file
API
But I'd suggest to consider an upgrade to 2.x version
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.