gpt4 book ai didi

c++ - 将 Keras 模型转换为 TensorFlow protobuf

转载 作者:IT老高 更新时间:2023-10-28 21:53:05 24 4
gpt4 key购买 nike

我们目前正在使用 Keras 训练各种神经网络,这是非常理想的,因为它具有良好的界面并且相对易于使用,但我们希望能够将它们应用到我们的生产环境中。

可惜生产环境是C++,所以我们的计划是:

  • 使用 TensorFlow 后端将模型保存到 protobuf
  • 将我们的生产代码链接到 TensorFlow,然后加载到 protobuf

不幸的是,我不知道如何从 Keras 访问 TensorFlow 保存实用程序,这些实用程序通常保存为 HDF5 和 JSON。如何保存到 protobuf?

最佳答案

如果您不需要在要部署的环境中使用 GPU,您也可以使用我的库,称为 frugally-deep。它在 GitHub 上可用,并在 MIT 许可证下发布:https://github.com/Dobiasd/frugally-deep

简洁的深度允许直接在 C++ 中对已经训练好的 Keras 模型运行前向传递,而无需链接到 TensorFlow 或任何其他后端。

关于c++ - 将 Keras 模型转换为 TensorFlow protobuf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36412098/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com