Questions tagged [triplet-loss]

Triplet losses are defined in terms of the contrast between three inputs. Each of the inputs has an associated class label, and the goal is to map all inputs of the same class to the same point, while all inputs from other classes are mapped to different points some distance away. It's called a triplet because the loss is computed using an anchor, a sample belonging to the same class as the anchor, and a sample belonging to a different class.

Filter by
Sorted by
Tagged with
3 votes
0 answers
125 views

Euclidean and geodesic distance have different gradients. Does mixing the two concepts impair triplet learning?

The triplet loss is defined by Florian Schroff, Dmitry Kalenichenko, James Philbin in "FaceNet: A Unified Embedding for Face Recognition and Clustering" as $$ \mathcal L = \sum_\mathcal T \...
Sycorax's user avatar
  • 91k
3 votes
1 answer
2k views

How to use cosine similarity within triplet loss

The triplet loss is defined as follows: $$ L(A, P, N) = \max(\Vert f(A) - f(P) \Vert^2- \Vert f(A) - f(N)\Vert^2 + \textrm{margin}, 0) $$ where $A$=anchor, $P$=positive, and $N$=negative are the data ...
Edv Beq's user avatar
  • 713
1 vote
0 answers
141 views

How to use a Siamese network at test time? [closed]

I am trying to understand Siamese networks, and understand how to train them. Once I have a trained network, I want to know if a new image is close or far to other images in the train set, and fail to ...
Gulzar's user avatar
  • 553
4 votes
1 answer
1k views

Why does contrastive loss and triplet loss have the margin element in them?

Trying to learn Siamese networks for ranking tasks from here, I find it hard to understand why triplet loss and contrastive losses have the "margin" element in them. The contrastive loss $L(...
Gulzar's user avatar
  • 553
1 vote
0 answers
254 views

Why does triplet loss outperform contrastive loss?

Trying to learn Siamese networks for ranking tasks from here, I find it hard to understand why triplet loss was ever introduced at all, theoretically. I understand it works better in practice, but ...
Gulzar's user avatar
  • 553
1 vote
0 answers
293 views

Resnet model does not train with triplet loss, while VGG16 is able to train, why?

I am trying to do a transfer learning with ResNet50V2 model using triplet loss function. I have kept Include_top = False, input shape = (160,160,3) with Imagenet weights. The last 3 layers of my model ...
Soma Sundaram's user avatar
1 vote
0 answers
281 views

Why are we interested in gradient with respect to input?

I am learning about sampling methods for Deep Embedding Learning. I was reading an article named: "Sampling Matters in Deep Embedding Learning" (https://arxiv.org/abs/1706.07567). In the ...
Mike's user avatar
  • 11
7 votes
1 answer
12k views

In training a triplet network, I first have a solid drop in loss, but eventually the loss slowly but consistently increases. What could cause this?

I haven't even finished 1 epoch, so I don't think it could any sort of overfitting. I am training on a very large amount of data (27 gb of text) so it'll still be a while before I even reach one epoch....
SantoshGupta7's user avatar
0 votes
0 answers
25 views

Is there any algorithms/models to generate embedings of sequential data (other than RNN)?

I know that RNN can be used for such task. For instance facenet used rnn with triplet loss. But maybe there are some less sophisticated alternatives to try first?
aiven's user avatar
  • 103
4 votes
1 answer
87 views

Learning useful semantic representations of data

Training a neural network on its final task (e.g. classification) right from the beginning is not always the best way to go. I'd like to make a short list of recognized methods of motivating a NN to ...
Xpector's user avatar
  • 215
0 votes
0 answers
293 views

Replacement for angular distance metric

I am looking for a distance metric that could be used instead of cosine/angular distance for high dimensional data. Metric that is limited the same way as cosine/angular distance is would be great. ...
Mous's user avatar
  • 1
2 votes
1 answer
130 views

Maximizing AUC based on point cloud distance

Let $V$ be an $n$ dimensional space with sets of positive class vectors $P$ and negative class vectors $N$. The task is to find a vector $x$ such that AUC is maximized, based on ranking generated by ...
Alex R.'s user avatar
  • 13.9k
2 votes
2 answers
1k views

Why the Triplet Loss function distincts anchor and positive?

I read the paper and I understand that anchoring one image and select corresponding semi-hard positives and negatives is an efficient way of generating samples. However, I don't understand why the ...
Uduse's user avatar
  • 121
3 votes
1 answer
768 views

Facenet: Using Ensembles of Face Embedding Sets

The Facenet is a deep learning model for facial recognition. It is trained for extracting features, that is to represent the image by a fixed length vector called embedding. After training, for each ...
Alireza Akhavan's user avatar
1 vote
2 answers
2k views

Does triplet loss help for document similarity search?

I build CNN network over documents with triplet loss. And compare documents with cosine similarity. It does really find similar docs and catches interesting dependencies. But simple tfidf model does ...
kkonevets's user avatar
  • 139
1 vote
1 answer
531 views

Overcome underfitting on train data using CNN architecture

I use 2 layer CNN network for NLP task with triplet loss with margin 0.2. The task is to learn document embeddings to find similar docs. My architecture is similar to this https://arxiv.org/abs/1406....
kkonevets's user avatar
  • 139
5 votes
0 answers
1k views

Triplet Deep Learning Embedding Loss Functions

Triplet embeddings consist of mapping a group of images to an embedding space, such that images deemed more similar to each other end up closer together. The "triplet" comes from training, ...
Alex R.'s user avatar
  • 13.9k
1 vote
0 answers
1k views

Architecture of the Triplet Neural Network

I want to implement face recognition neural network like in this topic(Step 3: Encoding Faces) using dlib library. I already conducted a some research and found out that it's triplet neural network ...
konstantin_doncov's user avatar
6 votes
1 answer
2k views

How does FaceNet (Google's facerecognition) handles a new image?

I am currently researching in the facerecognition field. And I can not understand how the facenet algorithm handels a new image They use an euclidean space for image representation. Which means that ...
Roman's user avatar
  • 163