如何编写一个tensorflow lite解释器来读取csv文件的输入?

bjg7j2ky  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(245)

当我用python运行下面显示的解释器代码时,我得到了这些结果。基本上,我转换成tensorflow lite的模型将信号作为输入(csv文件)读取。

import tensorflow as tf

interpreter = tf.lite.Interpreter(model_path="/tmp/arousal_saved_model/arousal_model.tflite")
interpreter.allocate_tensors()

# Print input shape and type

inputs = interpreter.get_input_details()
print('{} input(s):'.format(len(inputs)))
for i in range(0, len(inputs)):
print('{} {}'.format(inputs[i]['shape'], inputs[i]['dtype']))

# Print output shape and type

outputs = interpreter.get_output_details()
print('\n{} output(s):'.format(len(outputs)))
for i in range(0, len(outputs)):
print('{} {}'.format(outputs[i]['shape'], outputs[i]['dtype']))

其输出如下:

1 input(s): [ 1 1 14 129] <class 'numpy.float32'> 1 output(s): [1 2] <class 'numpy.float32'>

我对tensor flow和android是个新手,我想在android studio中编写一个从csv文件输入读取的解释器,非常感谢您的帮助。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题