python - Pass Input to tensorflow lite model in Android
问题描述
I have created a neural network that take numerical data as input and saved it as tensorflow lite model using python. I am trying to pass input to the model in Android. Shape of ndarray is 1*3
Sample of the input in python is as follows
np.array([[-0.276786765 ,8.41897583008 ,-0.0222015380859]])
But i do not know to create the same input in java to pass it to model.
I tried using nd4j library. But still not able to write the proper code to create the input which is required by the model.
解决方案
假设您使用的是TensorFlow Lite,您可以使用以下方法提供 1x3 输入:
float[] innerInput = {-0.276786765 ,8.41897583008 ,-0.0222015380859
float[][] input = {innerInput};
interpreter.run(input, output);
推荐阅读
- python - 留一交叉验证支持向量机
- javascript - 为什么无法将应用程序渲染到屏幕并得到“无法将类调用为函数错误”
- node.js - 函数内返回值
- hive - 澄清 sortby 与 hive 中的 order by
- python - 一遍又一遍地执行代码的语句
- matlab - 如何将日期时间转换为一年中的天数?
- c++ - 使用在堆栈上创建的对象调用虚函数
- javascript - JQuery 函数问题。添加太多类
- visual-studio - Votive (Wix) 的 Visual Studio 扩展证书验证失败
- python - 在 Django 中,如何查询登录用户的 MYSQL 数据库?(即特定用户的结果,无需对用户 ID 进行硬编码)