Open c100rczyk opened 5 months ago
Important information from the work:
Using hard examples (hard positives and hard negatives) in model training is crucial for achieving better convergence and overall performance. Hard examples present the model with challenging cases, forcing it to learn subtle differences and improve its decision boundaries. This leads to faster learning and better generalization to unseen data.
Important to note: Hard negatives examples can lead to bad local minima of model. Model can collapsed. SO: it is important (especially on early phase of training) to choose such negatives that: distance_between(anchor, positive) < distance_between(anchor, negative)
Proposition: In each batch find some hard positives examples (for example):
And get most hard negatives to the triplets that meet the condition :
Train only on that examples in each batch
Based on this we have maybe the answer (why sometimes it happend that our model did not learn). The accuracy top1 was 50%. So at the beginning model could get some hard negatives which had a strong negative impact on further learning and the model became blocked.
Articles that i think will help with implementation: https://omoindrot.github.io/triplet-loss https://arxiv.org/abs/1703.07737 And repository: https://github.com/omoindrot/tensorflow-triplet-loss
https://arxiv.org/abs/1503.03832