tensorflow lite(tflite) 在调整输入维度后调用错误

问题描述:

我使用 mobilenet_ssd.tflite 作为来自官方 tensorflow github 的模式.代码如下:

I am using mobilenet_ssd.tflite as the mode from the official tensorflow github. Code below:

int input = interpreter->inputs()[0];
interpreter->ResizeInputTensor(input, sizes);

调用时会报错:

interpreter->AllocateTensors()

如果我注释掉解释器->ResizeInputTensor(input, size);那么一切都很好.

If I comment out the interpreter->ResizeInputTensor(input, sizes); Then every thing is fine.

有什么建议吗?

我问的另一个问题:使用 tensorflow 更改 mobilenet_ssd 的输入图像大小

ResizeInputTensor 受到神经网络架构的限制.它失败了,因为 MobileNet &MobileNet SSD 只能处理固定大小的输入.

ResizeInputTensor is restricted by the neural network architecture. It fails since MobileNet & MobileNet SSD can only handle fixed size input.

可能有效的是改变批量大小.例如,您可以尝试将大小从 (1, 244, 244, 3) 更改为 (4, 244, 244, 3) 并在一次 Invoke 调用中对 4 个图像运行推理.

The thing that may work is changing the batch size. For example, you can try to change the size from (1, 244, 244, 3) to (4, 244, 244, 3) and run inference on 4 images in one Invoke call.