【问题标题】:Tensorflow - building a CNN model as described in the tutorialTensorflow - 按照教程中的描述构建 CNN 模型
【发布时间】:2017-05-13 15:56:53
【问题描述】:

我刚刚完成了 TF 层指南的实施:为 MNIST 数据集构建卷积神经网络。训练模型运行成功,准确率为97.3%。

但是,本教程没有提到如何使用这个新的训练模型来提供自己的图像并查看预测。有谁知道如何使用训练模型的输出进行预测?我在 tmp/mnist_convnet_model$ 文件夹中看到,有一些输出文件,如 .pbtxt 、元文件和索引文件。但我找不到使用它们对我自己的图像进行预测的说明。

【问题讨论】:

    标签: python-3.x tensorflow mnist


    【解决方案1】:
    y_pred = tf.nn.softmax(your_final_layer)
    y_pred_cls = tf.argmax(y_pred, dimension=1)
    

    用于预测

    feed_dict = {x: [your_image]}
    classification = tf.run(y_pred_cls, feed_dict)
    print classification
    

    这几乎适用于您创建的任何模型

    【讨论】:

      猜你喜欢
      • 2016-02-20
      • 1970-01-01
      • 2013-03-05
      • 2019-09-04
      • 1970-01-01
      • 2023-03-17
      • 2018-05-19
      • 2018-06-09
      • 2017-12-06
      相关资源
      最近更新 更多