【问题标题】:how to use Keras LSTM model to android?如何将 Keras LSTM 模型用于 android?
【发布时间】:2019-10-03 04:12:15
【问题描述】:

我使用 keras 创建了 LSTM 模型,并且我已经训练了存储为 models.h5 文件的模型。

我想知道如何在 Android studio 中预测模型。

我该如何解决这个问题?

【问题讨论】:

  • 请查看 Tensorflow Lite 并将您的 keras 模型转换为 tensorflow lite 关注 this。我不确定 LSTM 模型,但你可以研究一下。
  • ^ 这家伙是对的。可以使用 tensorflow lite 将 Keras 模型部署到 android。
  • 不要尝试使用 Tensorflow Lite 在 Android 上运行 LSTM Keras 模型。转换器不支持 Keras 的 LSTM 格式。有一些建议的变通方法,但它们很难找到和实施,并且容易受到版本之间的兼容性问题的影响。

标签: android python keras lstm


【解决方案1】:

您可以使用deeplearning4j 执行此操作。您可以按照here 的说明在 Android Studio 中设置 deeplearning4j。

可以使用here 中描述的 Keras 模型导入功能将经过训练的 Keras 模型直接导入 deeplearning4j。然后,您可以使用 Java 中的训练模型执行预测。

【讨论】:

    猜你喜欢
    • 2020-05-25
    • 2019-04-15
    • 1970-01-01
    • 2019-05-09
    • 1970-01-01
    • 1970-01-01
    • 2020-02-09
    • 2021-09-30
    • 1970-01-01
    相关资源
    最近更新 更多