Closed lc82111 closed 6 years ago
I think below line is some misleading. https://github.com/omoindrot/tensorflow-triplet-loss/blob/master/model/triplet_loss.py#L29 Instead of distances = tf.expand_dims(square_norm, 0) - 2.0 * dot_product + tf.expand_dims(square_norm, 1) , I prefer distances = tf.expand_dims(square_norm, 1) - 2.0 * dot_product + tf.expand_dims(square_norm, 0) , which is more consisten with ||a - b||^2 = ||a||^2 - 2 <a, b> + ||b||^2.
distances = tf.expand_dims(square_norm, 0) - 2.0 * dot_product + tf.expand_dims(square_norm, 1)
distances = tf.expand_dims(square_norm, 1) - 2.0 * dot_product + tf.expand_dims(square_norm, 0)
Done :)
Well done :)
I think below line is some misleading. https://github.com/omoindrot/tensorflow-triplet-loss/blob/master/model/triplet_loss.py#L29 Instead of
distances = tf.expand_dims(square_norm, 0) - 2.0 * dot_product + tf.expand_dims(square_norm, 1)
, I preferdistances = tf.expand_dims(square_norm, 1) - 2.0 * dot_product + tf.expand_dims(square_norm, 0)
, which is more consisten with ||a - b||^2 = ||a||^2 - 2 <a, b> + ||b||^2.