test=develop

revert-16045-imperative_remove_desc
ceci3 6 years ago committed by GitHub
parent 6bce986107
commit f6d186782a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10567,17 +10567,17 @@ def npair_loss(anchor, positive, labels, l2_reg=0.002):
'''
**Npair Loss Layer**
see http://www.nec-labs.com/uploads/images/Department-Images/MediaAnalytics/papers/nips16_npairmetriclearning.pdf
Npair loss requires paired data. Npair loss has two parts, the first part is L2
regularizer on the embedding vector, the second part is cross entropy loss which
Read `Improved Deep Metric Learning with Multi class N pair Loss Objective <http://www.nec-labs.com/uploads/images/Department-Images/MediaAnalytics/papers/nips16_npairmetriclearning.pdf>`_ .
Npair loss requires paired data. Npair loss has two parts: the first part is L2
regularizer on the embedding vector; the second part is cross entropy loss which
takes the similarity matrix of anchor and positive as logits.
Args:
anchor(Variable): embedding vector for the anchor image. shape=[batch_size, embedding_dims]
positive(Variable): embedding vector for the positive image. shape=[batch_size, embedding_dims]
labels(Varieble): 1-D tensor. shape=[batch_size]
l2_res(float32): L2 regularization term on embedding vector, default: 0.02
labels(Variable): 1-D tensor. shape=[batch_size]
l2_reg(float32): L2 regularization term on embedding vector, default: 0.002
Returns:
npair loss(Variable): return npair loss, shape=[1]

Loading…
Cancel
Save