【发布时间】:2021-06-09 09:04:39
【问题描述】:
我在 Tensorflow 中训练了一个模型,因此可以产生的最大输出值为 1.0。然后我将它转换为 Tensorflow Lite 以安装在 android 上,现在 Tensorflow Lite 模型产生的值远大于 1.0。我该怎么做才能解决这个问题?
我正在使用 TensorFlow 2.5
tf 模型 -> tflite 模型脚本
converter = tf.lite.TFLiteConverter.from_saved_model("/content/drive/MyDrive/savedmodel")
converter.optimizations = [tf.lite.Optimize.DEFAULT]
tflite_quant_model = converter.convert()
ite_models_dir = pathlib.Path("/content/drive/MyDrive/tflite_models/")
tflite_models_dir.mkdir(exist_ok=True, parents=True)
tflite_model_quant_file = tflite_models_dir/"model_temp_quant.tflite"
tflite_model_quant_file.write_bytes(tflite_quant_model)
【问题讨论】:
标签: android tensorflow tensorflow-lite