import tensorflow as tf
convert=tf.lite.TFLiteConverter.from_frozen_graph(
"frozen.pb",
input_arrays=["train_x"],
output_arrays=["output"])
convert.post_training_quantize=True
tflite_model=convert.convert()
open("model.tflite","wb").write(tflite_model)
#If you need to specify the shape of the input
import tensorflow as tf
path="./fullLayer/"
convert=tf.lite.TFLiteConverter.from_frozen_graph(
path+"frozen.pb",
input_arrays=["images"],output_arrays=["output"],
input_shapes={"images":[1,540,960,1]})
convert.post_training_quantize=True
tflite_model=convert.convert()
open(path+"quantized_model.tflite","wb").write(tflite_model)
print("finish!")
No comments:
Post a Comment