def build_triple_score_network(distance_to_plus, distance_to_minus, model_params):
"""
Compute the hinge loss triple loss from (Wang, CVPR2014)
The hinge loss is a convex approximation to the 0-1 ranking error
loss, which measures the model's violation of the ranking order
specified in the triplet.
The score_gap parameter favors a gap between the distance of the two image pairs
"""
triple_score = tf.nn.relu(tf.add(
model_params['score_gap'],
tf.sub(distance_to_plus, distance_to_minus)),
name="triple_score")
return triple_score
评论列表
文章目录