tf.contrib.losses.metric_learning.lifted_struct_loss
Stay organized with collections
Save and categorize content based on your preferences.
Computes the lifted structured loss.
tf.contrib.losses.metric_learning.lifted_struct_loss(
labels, embeddings, margin=1.0
)
The loss encourages the positive distances (between a pair of embeddings
with the same labels) to be smaller than any negative distances (between a
pair of embeddings with different labels) in the mini-batch in a way
that is differentiable with respect to the embedding vectors.
See: https://arxiv.org/abs/1511.06452
Args |
labels
|
1-D tf.int32 Tensor with shape [batch_size] of
multiclass integer labels.
|
embeddings
|
2-D float Tensor of embedding vectors. Embeddings should not
be l2 normalized.
|
margin
|
Float, margin term in the loss definition.
|
Returns |
lifted_loss
|
tf.float32 scalar.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2020-10-01 UTC."],[],[]]