【发布时间】:2019-08-22 12:26:06
【问题描述】:
我使用 tf.lite.TFLiteConverter 将经过训练的 Keras 模型转换为 tflite_model。转换后的 tflite_model 是量化的吗?这是进行转换的sn-p。
import tensorflow as tf
keras_model = "./Trained_Models/h_vs_o_a_V1.h5"
converter = tf.lite.TFLiteConverter.from_keras_model_file(keras_model)
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
【问题讨论】:
-
要启用模型量化,我们需要添加以下标志~>
converter.post_training_quantize = True -
在哪里插入代码?是在 tflite_model = converter.convert() 之前吗?