Table of Contents
Fetching ...

Maintaining Difficulty: A Margin Scheduler for Triplet Loss in Siamese Networks Training

Roberto Sprengel Minozzo Tomchak, Oge Marques, Lucas Garcia Pedroso, Luiz Eduardo Oliveira, Paulo Lisboa de Almeida

Abstract

The Triplet Margin Ranking Loss is one of the most widely used loss functions in Siamese Networks for solving Distance Metric Learning (DML) problems. This loss function depends on a margin parameter μ, which defines the minimum distance that should separate positive and negative pairs during training. In this work, we show that, during training, the effective margin of many triplets often exceeds the predefined value of μ, provided that a sufficient number of triplets violating this margin is observed. This behavior indicates that fixing the margin throughout training may limit the learning process. Based on this observation, we propose a margin scheduler that adjusts the value of μ according to the proportion of easy triplets observed at each epoch, with the goal of maintaining training difficulty over time. We show that the proposed strategy leads to improved performance when compared to both a constant margin and a monotonically increasing margin scheme. Experimental results on four different datasets show consistent gains in verification performance.

Maintaining Difficulty: A Margin Scheduler for Triplet Loss in Siamese Networks Training

Abstract

The Triplet Margin Ranking Loss is one of the most widely used loss functions in Siamese Networks for solving Distance Metric Learning (DML) problems. This loss function depends on a margin parameter μ, which defines the minimum distance that should separate positive and negative pairs during training. In this work, we show that, during training, the effective margin of many triplets often exceeds the predefined value of μ, provided that a sufficient number of triplets violating this margin is observed. This behavior indicates that fixing the margin throughout training may limit the learning process. Based on this observation, we propose a margin scheduler that adjusts the value of μ according to the proportion of easy triplets observed at each epoch, with the goal of maintaining training difficulty over time. We show that the proposed strategy leads to improved performance when compared to both a constant margin and a monotonically increasing margin scheme. Experimental results on four different datasets show consistent gains in verification performance.

Paper Structure

This paper contains 12 sections, 5 figures, 3 tables.

Figures (5)

  • Figure 1: To identify the person in the query image (left), the image is compared with all samples in a database, and the identity corresponding to the smallest distance is selected (right) as the answer. Images from LFW huang2008labeled.
  • Figure 2: Median effective margin of triplets at each training epoch on the LFW dataset.
  • Figure 3: Histogram of effective margins across training epochs using the LFW dataset. Values below $\mu = 0.3$ correspond to hard triplets (red), while values above correspond to easy triplets (green).
  • Figure 4: Proportion of easy triplets per epoch on the LFW dataset.
  • Figure 5: Margin evolution for each method across datasets.