首页 > 解决方案 > 在 Android 设备上加载基于 tflite 的估计器模型的问题

问题描述

我在结构化数据上生成了一个 Boosted Trees Estimator,并尝试使用该估计器在移动设备上进行预测。但我面临的问题是,当我启动应用程序时,该应用程序会在 Android Studio 中生成以下错误。

2020-09-30 12:26:34.892 8966-8966/com.example.tflitetest W/System.err: java.lang.IllegalStateException: Internal error: Unexpected failure when preparing tensor allocations: Encountered unresolved custom op: ParseExampleV2.
2020-09-30 12:26:34.892 8966-8966/com.example.tflitetest W/System.err: Node number 0 (ParseExampleV2) failed to prepare.

我按照本指南进行了估算器培训,下面突出显示的代码:

  tf.feature_column.make_parse_example_spec([input_column]))

estimator_base_path = os.path.join(tmpdir, 'from_estimator')
estimator_path = estimator.export_saved_model(estimator_base_path, serving_input_fn)

(如果我做错了什么,请告诉我。)

所有数据文件(训练/测试数据、示例 Android 应用程序和 .tflite 模型)都可以在 Google Drive 的以下链接上找到: https ://drive.google.com/drive/folders/1-qDhCJGNZyqu_-XoMyW0kvimyiDdMndO?usp=sharing

编辑1:解析示例的用法包含在问题中。

标签: androidtensorflow

解决方案


推荐阅读