我正在研究CIFAR10,并使用其他数据集。由于丢失功能和标签数据,我遇到错误。我不知道将标签转换为1D或二进制文件的想法,以便可以解决此问题。任何类型的帮助将不胜感激。我已经检查了现有的帖子,但没有帮助我。
错误:
ngAfterViewInit () {
// this.canvasLayers works here
}
损失功能:
Expected binary or unicode string, got {'labels': <tf.Tensor 'tower_0/Reshape_1:0' shape=(5,) dtype=float16>}
我的标签是这样的Labels
培训代码link
def loss(logits, labels):
"""Add L2Loss to all the trainable variables.
Add summary for "Loss" and "Loss/avg".
Args:
logits: Logits from inference().
labels: Labels from distorted_inputs or inputs(). 1-D tensor
of shape [batch_size]
Returns:
Loss tensor of type float.
"""
# Calculate the average cross entropy loss across the batch.
labels = tf.cast(labels, tf.int64)
cross_entropy = tf.nn.sparse_softmax_cross_entropy_with_logits(
labels=labels, logits=logits, name='cross_entropy_per_example')
cross_entropy_mean = tf.reduce_mean(cross_entropy, name='cross_entropy')
tf.add_to_collection('losses', cross_entropy_mean)
# The total loss is defined as the cross entropy loss plus all of the weight
# decay terms (L2 loss).
return tf.add_n(tf.get_collection('losses'), name='total_loss')
N.B:这对您来说可能是一个非常愚蠢的帖子,但是对我来说这是一个非常严重的问题。请避免投票否定,而是鼓励提出此类愚蠢问题的人。