【问题标题】:How to predict input image with trained model in Keras?如何在 Keras 中使用经过训练的模型预测输入图像?
【发布时间】:2016-11-02 14:31:56
【问题描述】:

我正在使用 Keras 和 tensorflow 后端构建 CNN 模型。我已经对模型进行了 6 个小时的训练。现在,我想使用我的模型预测我的自定义外部图像。如何在 Keras 中做到这一点?谢谢

【问题讨论】:

    标签: python tensorflow deep-learning keras


    【解决方案1】:

    为了简化,您可以说使用模型时通常有 4 个主要步骤(不仅仅是在 Keras 中):

    • 构建模型并编译它:model.compile()
    • 使用您的训练数据训练模型:model.fit()
    • 使用您的测试数据评估模型:model.evaluate()
    • 使用目标数据进行预测:model.predict()

    根据您需要的输出,您必须使用 model.predict_proba() 或 model.predict_classes()。

    请参阅https://keras.io/models/sequential/#sequential-model-methods 了解完整的参考资料和论据。

    Keras 仓库也有很多例子:https://github.com/fchollet/keras/tree/master/examples

    【讨论】:

      猜你喜欢
      • 2020-08-05
      • 2020-02-27
      • 1970-01-01
      • 2017-03-13
      • 2018-10-12
      • 2019-12-30
      • 2017-05-11
      • 2018-03-24
      • 2020-07-04
      相关资源
      最近更新 更多