uchar变量导致解释器-> typed_input_tensor问题

时间:2019-05-24 13:12:04

标签: c++ embedded-linux tensorflow-lite

我对tensorflow-lite模型的填充输入有疑问。

我的模型的第一阶段使用uchar变量,但是:

//seg falut
    interpreter_stage1->typed_input_tensor<uchar>(0)[i] = 0;

//works good
    interpreter_stage1->typed_input_tensor<float>(0)[i] = 0;

我不理解为什么我不能为什么在这种情况下uchar类型不能正常工作。

1 个答案:

答案 0 :(得分:0)

如果有人会遇到类似的问题,这就是答案。

当我打印interpretetState

tflite::PrintInterpreterState(interpreter.get());

我看到先前从Keras移到TFLite的模型具有与预期不同的输入类型。看起来它正在等待Float32不是uchar类型。

Interpreter has 26 tensors and 11 nodes
Inputs: 9
Outputs: 16

Tensor   0 conv2d_1/BiasAdd     kTfLiteFloat32  kTfLiteArenaRw    3154176 bytes ( 3.0 MB)  1 222 222 16
(...)