vlfeat / matconvnet

MatConvNet: CNNs for MATLAB
Other
1.4k stars 753 forks source link

Support for triplet loss? #125

Open dbbert opened 9 years ago

dbbert commented 9 years ago

Is there an implementation available of the triplet loss layer in the FaceNet paper?

Thanks for your work on making this a great toolbox!

vedaldi commented 9 years ago

Amazingly, that may come soon :-)

On 28 Apr 2015, at 17:43, Bert notifications@github.com wrote:

Is there an implementation available of the triplet loss layer in the FaceNet paper http://arxiv.org/abs/1503.03832?

Thanks for your work on making this a great toolbox!

— Reply to this email directly or view it on GitHub https://github.com/vlfeat/matconvnet/issues/125.

dbbert commented 9 years ago

That's great news. Looking forward to it :-)

dbbert commented 9 years ago

Any updates on this feature?

vedaldi commented 9 years ago

Hi, it is being tested internally on a few very large scale problem. We are still not satisfied with the accuracies we are observing, but we hope to fix it soon.

On 10 Jun 2015, at 05:54, Bert notifications@github.com wrote:

Any updates on this feature?

— Reply to this email directly or view it on GitHub https://github.com/vlfeat/matconvnet/issues/125#issuecomment-110677242.

sasacluar commented 9 years ago

Will you be releasing a trained net or just the building block functions? Do you have an approximate date for your next release?

Thank you for all the work - this is a great tool.

dbbert commented 8 years ago

Hi, Is it possible to release the triplet loss function, even though it is not fully tested yet? I would like to compare the implementation with my own.

GilLevi commented 8 years ago

Hi,

I'm also interested in triplets loss, can't wait to test it:)

Thanks! Gil

cheer37 commented 8 years ago

Triplet loss is not implemented yet?

finlay-liu commented 8 years ago

can't wait to use it.

:)

AlexeyV11 commented 7 years ago

hi, are there any updated on this issue?

thanks

caokaibin commented 7 years ago

Any update on this issue. Can't wait to use it!

barisgecer commented 7 years ago

Hi @vedaldi

Did you solve the problem with Triplet loss? It seem you have done experiments in Deep Face Recognition paper. Is it possible to share the triplet code before making it ready for the library?

Regards,

cirograciapons commented 6 years ago

Here you have a simple but working modification to implement triplet learning , i tried it with mnist and worked like a charm TripletBasic.zip

pabloapast commented 6 years ago

Hi @cirograciapons Have you test it on face datasets like LFW? Which protocol for mining triplets do you use?

Best!

cirograciapons commented 6 years ago

Hello i havent tested it on face datasets, i am sorry, i work on Speech recognition field. I tested it in several other datasets and i tryed different mining triplets protocols but mostly the ones described in this article "In Defense of the Triplet Loss for Person Re-Identification" (Alexander Hermans). However i only included in this sample the most generic and good working of all of them. it simply takes each class of the batch ( batches should be done by sampling classes and getBatch()function would sample N items from each batch class ) , makes the Intra class distance matrix ( pdist2 , euclidean ) and generates all the possible pairs ( upper triangular matrix triu(Mat,1) ), so i am taking all the combinations ( without order counting nor repetition) between positives. I used to take 1 pair for each class sample but found that using all the combinations makes much more triplets and gets much better and robust convergence. So after sampling the [Positive , anchor] pairs i go to sample the negatives: i take a pair , compute the condition function : d(Anchor,positive) - allNonClassBatch + alpha , ensuring a minimum value of 1e-3 ( its requiered to be positive for randsample ) , and use randsample to sample 1 element using this function as a probability density, and thats it.

Overall i think i did the same proposed in openFaceBlog and forum. So instead of complex dag networks i wrote a simple network unit type that during forward makes the triplet sampling from the batch and in backward collapses the triplets derivatives into a batch size derivative block by integration.