我训练了一个目标探测模型。现在我正尝试使用Tensorflow Lite graph converter提供的量化来加速推理。但是当我调用tf.lite.TFLiteConverter.from_frozen_graph
方法,我遇到了一个错误。在
我还发现大约一年前有人问过similar, unanswered question,我想知道TFLite的支持现在是否有所改善。在
我的意思是:
converter = tf.lite.TFLiteConverter.from_frozen_graph(
model_path,
input_arrays = ['input_1'],
output_arrays = [
'filtered_detections/map/TensorArrayStack/TensorArrayGatherV3',
'filtered_detections/map/TensorArrayStack_1/TensorArrayGatherV3',
'filtered_detections/map/TensorArrayStack_2/TensorArrayGatherV3'
],
input_shapes = {
'input_1': [None, 300, 300, 3]
}
)
converter.post_training_quantize = True
tflite_quantized_model = converter.convert()
编辑:我也尝试过input_1
的不同参数值,比如[1, 300, 300, 3]
等。我甚至省略了input_shapes
参数,但是它抛出了另一个错误:None is allowed only in 1st dimension. Other dimensions can not be null
以下是错误日志:
^{pr2}$
问题出在tflite converter现有的不受支持的tensorflow操作中:
尝试找到一种方法来避免在原始的张量流图中使用这种操作。在
请参阅this link,其中提供有关TFLite支持的操作的信息。在
相关问题 更多 >
编程相关推荐