张量流预测停留在50/50,损失开始很高

时间:2017-12-03 21:44:19

标签: python-3.x tensorflow

我的预测总是[0.5,0.5],我的体重在跳动,我的损失开始~30并且缓慢减少。

模型是conv-> pool-> conv-> pool-> fullrelu-> full(softmax,后面有logits)。

使用TFLearn,它可以正常工作。

我如何计算损失(我的意思是稀疏 _softmax,如果稀疏仅用于单个真值标签,它怎么能达到0.5 0.5):

def calcLoss(logits,train_labels_node,WFully,BFully):
   loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(
       labels=train_labels_node, logits=logits))
   return loss

我如何计算优化程序:

def calcOptimizer(learning_rate,loss):
    return tf.train.AdamOptimizer(learning_rate).minimize(loss) 

损失

enter image description here

编辑:玩完param并添加:

tf.train.create_global_step()

learningrate = tf.train.exponential_decay(
        0.01,                # Base learning rate.
        tf.train.get_global_step() * Constants.BATCH_SIZE,
        train_size,          # Decay step.
        0.95,                # Decay rate.
        staircase=True)

optimizer = tf.train.AdamOptimizer(..).minimize(loss, global_step= tf.train.get_global_step())

现在有效。

0 个答案:

没有答案
相关问题