在TensorFlow-slim源代码中,在创建其损失函数时指出了一个端点:
def clone_fn(batch_queue):
"""Allows data parallelism by creating multiple clones of network_fn."""
images, labels = batch_queue.dequeue()
logits, end_points = network_fn(images)
#############################
# Specify the loss function #
#############################
if 'AuxLogits' in end_points:
slim.losses.softmax_cross_entropy(
end_points['AuxLogits'], labels,
label_smoothing=FLAGS.label_smoothing, weight=0.4, scope='aux_loss')
slim.losses.softmax_cross_entropy(
logits, labels, label_smoothing=FLAGS.label_smoothing, weight=1.0)
return end_points来源:https://github.com/tensorflow/models/blob/master/slim/train_image_classifier.py#L471-L477
我的想法是,有多个相同的网络在不同的机器上训练,最后将变量和参数平均出来合并到一个网络中(这是正确的吗?)。但是我不太明白在这种情况下端点的用途是什么,因为我认为network_fn应该只生成用于预测的logits。end_points有什么用?
发布于 2017-03-09 06:36:40
本例中的endpoints只跟踪模型的不同输出。例如,AuxLogits one就有这样的日志。
https://stackoverflow.com/questions/41543687
复制相似问题