【问题标题】:Need hint for the Exercise posed in the Tensorflow Convolution Neural Networks TutorialTensorflow 卷积神经网络教程中的练习需要提示
【发布时间】:2016-01-31 07:59:06
【问题描述】:

以下是本页提出的练习题https://www.tensorflow.org/versions/0.6.0/tutorials/deep_cnn/index.html

EXERCISE:推理的输出是非标准化的 logits。尝试 编辑网络架构以返回标准化预测 使用 tf.softmax()。

本着练习的精神,我想知道我是否走在正确的轨道上(而不是寻找编码的答案)。

这是我提出的解决方案。

第 1 步:示例中(推理的)最后一层是“softmax_linear”,即它只是进行非标准化 WX+b 变换。按照规定,我们以softmax_linear 作为输入应用tf.nn.softmax 操作。这将输出标准化为范围 [0, 1] 上的概率。

第 2 步: 下一步是修改损失函数中的交叉熵计算。由于我们已经有标准化的输出,我们需要用一个普通的cross_entropy(normalized_softmax, labels) 函数替换tf.nn.softmax_cross_entropy_with_logits 操作(在计算损失之前不会进一步标准化输出)。我相信这个函数在 tensorflow 库中可用;它需要写出来。

就是这样。欢迎提供反馈。

【问题讨论】:

    标签: deep-learning tensorflow


    【解决方案1】:

    如果您将tf.nn.softmax() 插入cifar10_eval.py(而不是cifar10.py),则第1 步就足够了。例如:

    logits = cifar10.inference(images)
    normalized_logits = tf.nn.softmax(logits)
    top_k_op = tf.nn.in_top_k(normalized_logits, labels, 1)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-05-01
      • 1970-01-01
      • 2023-03-14
      • 2019-01-14
      • 1970-01-01
      • 1970-01-01
      • 2019-08-18
      相关资源
      最近更新 更多