Learning a Metric Embedding for Face Recognition using the Multibatch Method

Oren Tadmor, Tal Rosenwein, Shai Shalev-Shwartz, Yonatan Wexler, Amnon Shashua

TL;DR

Face recognition on embedded systems requires high accuracy combined with a minimal computing budget. This paper introduces the "Multibatch Method," a novel training technique for similarity learning that allows models to learn from all possible pairs within a mini-batch. By proving the multibatch gradient estimate is unbiased and has significantly lower variance than standard methods, the authors achieve near state-of-the-art results (98.2% on LFW) with highly efficient training and inference times.

The Problem: Metric Learning on a Budget

In metric learning, the goal is to train a neural network so that images of the same person are close together in vector space, while images of different people are far apart. Standard training methods often rely on "hard-negative mining"—searching for the most difficult examples to provide a strong gradient.

However, mining is computationally expensive and can lead to high-variance gradients if not done carefully. The core challenge is finding a way to utilize available batch information efficiently without introducing bias or overwhelming the learning process with noise, particularly when targeting resource-constrained embedded systems.

The Multibatch Method

To maximize efficiency, the authors propose the Multibatch Method. Instead of sampling a small subset of pairs, this method generates signatures for a mini-batch of $k$ face images and constructs an unbiased estimate of the full gradient by relying on all $k^2-k$ pairs from the mini-batch. This avoids the computational overhead of traditional mining while extracting the maximum possible signal from the data.

Mathematical Foundations

While many practitioners use "all-pairs" losses heuristically because they seem to work well, this paper provides the formal proof that the approach is statistically sound.

Unbiased Estimation

The authors mathematically prove that the multibatch loss $L_\pi(z)$ is an unbiased estimator of the true loss $L(z)$. This means that, on average, the gradients calculated from a mini-batch point in the exact correct direction of the global loss surface ($E_\pi [\nabla L_\pi(z)] = \nabla L(z)$).

Variance Decomposition and the "Free Lunch"

To analyze the stability of the gradients, the authors partition the set of all possible index combinations into three categories:

  1. $I_1$: Identical pairs (the same pair compared against itself).
  2. $I_2$: Completely disjoint pairs (four different images).
  3. $I_3$: Partially overlapping pairs (three different images, where one image is shared between two pairs).

One of the most interesting insights in the proof is the treatment of the $I_2$ set. Through a key mathematical contribution (Lemma 1), the authors prove that for any vector with a mean of zero, the sum of its off-diagonal products is non-positive.

In simpler terms, the "cross-talk" between completely different pairs ($I_2$) actually reduces or maintains the stability of the gradient rather than adding noise. Adding more unrelated pairs to your batch doesn't just give you more data; it actively helps stabilize the gradient.

Controlled Variance

By analyzing the $I_3$ set, the authors show that the variance of the Multibatch estimator is bounded by $O(1/k^2)$, under mild conditions. In contrast, a standard gradient estimator relying on a random $k/2$ pairs has a variance of order $O(1/k)$. As the batch size ($k$) increases, the relative variance of the gradient estimate decreases much faster, leading to highly stable training and significantly speeding up the convergence rate of stochastic gradient descent (SGD).

Key Empirical Results

By leveraging the theoretical stability and efficiency of the Multibatch method, the authors demonstrate strong practical performance:

  • High Accuracy: The trained deep convolutional neural network achieves an accuracy of 98.2% on the Labeled Faces in the Wild (LFW) benchmark.
  • Inference Efficiency: Prediction runtime takes only 30 milliseconds on a single ARM Cortex A9 core, making it highly viable for embedded systems.
  • Training Speed: Thanks to the accelerated convergence rate provided by the reduced gradient variance, the entire training process took only 12 hours on a single Titan X GPU.

Summary updated

BibTeX
@inproceedings{tadmor2016learning,
  author = {Oren Tadmor and Tal Rosenwein and Shai Shalev-Shwartz and Yonatan Wexler and Amnon Shashua},
  title = {{Learning a Metric Embedding for Face Recognition using the Multibatch Method}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2016},
  url = {https://openreview.net/forum?id=j1vUbmHCecV},
}
Figure