【发布时间】:2019-10-03 10:46:10
【问题描述】:
我正在尝试使用 tflite 模型对批次进行推理。我使用以下代码:
interpreter = tf.lite.Interpreter(model_path=model_path)
input_details = interpreter.get_input_details()
interpreter.resize_tensor_input(input_details[0]["index"], [batch_size, 513, 513, 3])
interpreter.allocate_tensors()
代码崩溃并给出以下错误:
RuntimeError: tensorflow/lite/kernels/reshape.cc:58 num_input_elements != num_output_elements (1579014 != 789507)Node number 0 (RESHAPE) failed to prepare.
查看输出详细信息时,它仍然具有 [1, 513, 513, output_channels] 的形状,而不是我希望的 [batch_size, 513, 513, output_channels]。
有什么想法吗?
【问题讨论】:
-
嗨。看起来问题不在 resize_tensor_input 中。您总是可以通过查看interpreter.get_input_details() 来检查resize_tensor_input 是否正常工作。或者您的帖子中有错字,您的意思是在最后一句中输入详细信息?
-
您好,问题解决了吗?
标签: python tensorflow tensorflow-lite