【发布时间】:2020-09-07 04:53:43
【问题描述】:
[2] frozen_graph_file = # path to frozen graph (.pb file)
[3] input_arrays = ["normalized_input_image_tensor"]
[4] output_arrays = ['TFLite_Detection_PostProcess',
[5] 'TFLite_Detection_PostProcess:1',
[6] 'TFLite_Detection_PostProcess:2',
[7] 'TFLite_Detection_PostProcess:3']
[8] input_shapes = {"normalized_input_image_tensor" : [1, 300, 300, 3]}
[9]
[10] converter = tf.lite.TFLiteConverter.from_frozen_graph(frozen_graph_file,
[11] input_arrays=input_arrays,
[12] output_arrays=output_arrays,
[13] input_shapes=input_shapes)
[14] converter.allow_custom_ops = True
[15] converter.optimizations = [tf.lite.Optimize.DEFAULT]
[16] tflite_quant_model = converter.convert()
[17] with open(tflite_model_quant_file, "wb") as tflite_file:
[18] tflite_file.write(tflite_model_quant)
在量化模型时,我们通常为模型提供一些校准数据以识别激活范围,从而定义尺度和零点。这是为张量量化完成的。物体检测边界框坐标的量化值是如何获得的?它是否遵循相同的时尚? 在 Tensorflow 中,它们为无法以常规方式量化的操作提供自定义操作。我在哪里可以获得它们的详细实现,尤其是 TFLite_Detection_PostProcess?
【问题讨论】:
标签: tensorflow object-detection tensorflow-lite quantization