Data-Adaptive Metric Learning with Scale Alignment

Shuo Chen, Chen Gong, Jian Yang, Ying Tai, Le Hui, Jun Li

Introduction

Metric learning is a fundamental task in computer vision and pattern recognition, aimed at finding a distance function that accurately reflects the similarity between data points. Whether determining if two face images belong to the same person or classifying handwritten digits, the quality of the underlying metric often determines the success of the entire system. Traditionally, this is achieved by learning a single, global Mahalanobis distance—essentially a fixed projection matrix that transforms data into a space where Euclidean distances are meaningful.

The Problem: One Size Does Not Fit All

While global metric learning is robust, it often fails to capture the complexity of real-world data. A single projection rule might excel at distinguishing faces but fail to capture the nuances required for background texture recognition. While "local" metric learning methods have been proposed to address this by learning multiple metrics for different regions of the data space, they frequently suffer from high computational costs or severe overfitting due to the large number of parameters relative to the available training samples.

Data-Adaptive Metric Learning (DAML)

Presented at AAAI-19, this paper introduces Data-Adaptive Metric Learning (DAML), a framework that moves away from "one-size-fits-all" models. Instead of a single global projection matrix $P$, DAML learns a "menu" of projection matrices: a primitive matrix $P_0$ and a set of candidate matrices $P_1, \dots, P_c$.

For any specific pair of data points $(x, x')$, the model dynamically constructs a pair-specific projection matrix $P(w)$ by combining these candidates using a sparse weight vector $w$. This allows the model to adapt its distance calculation to the specific nuances of every individual data pair.

Comparison between the traditional metric learning framework and the proposed Data-Adaptive Metric Learning (DAML) framework.

To handle new, unseen data pairs during the inference phase, the model employs a linear regression heuristic to predict the optimal weights $w$ based on the sum of the data pair vectors, ensuring the system remains efficient and scalable.

Scale Alignment Regularization

A significant challenge in adaptive metric learning is the risk of overfitting. If the model is free to choose any combination of matrices, it may simply select matrices with massive scales to minimize loss, leading to poor generalization. The authors address this through a novel Scale Alignment regularizer.

By utilizing a Total Variation (TV) regularizer, the model aligns the "metric scales" of all candidate matrices. This ensures that the distance "units" produced by different candidates are geometrically consistent and comparable. Specifically, the regularizer forces the sum of squared distances of projected orthonormal bases to be similar across all candidate metrics, stabilizing the search space.

Illustration of the scale alignment process, where candidate projection matrices are regularized to ensure consistent geometric scales.

Kernelization and Optimization

To account for non-linear relationships in complex datasets, the authors extended the framework into Kernelized DAML (KDAML). By applying the kernel trick, the model can operate in high-dimensional Hilbert spaces without requiring explicit feature mapping.

The resulting optimization problem involves a combination of smooth loss functions and non-smooth regularizers (such as the $L_1$ norm used to enforce sparsity in the weight vector $w$). The authors solve this efficiently using the Iterative Shrinkage-Thresholding Algorithm (ISTA), which provides a robust path to convergence.

Experimental Results

The authors evaluated DAML and KDAML across a variety of benchmarks, including image retrieval (PubFig, OSR), classification (MNIST, UCI datasets), and face verification (LFW, MVS).

Key performance highlights include:

  • Image Retrieval: On the PubFig face dataset, KDAML achieved a classification error rate of 12.89%, outperforming the traditional ITML baseline (13.89%).
  • Classification: On the UCI 'Balance' dataset, KDAML reached an error rate of 6.15%, significantly lower than both ITML (9.31%) and the deep learning-based DDML (8.12%).
  • Verification: ROC curves for face verification on LFW and PubFig demonstrated that DAML/KDAML maintained higher True Positive Rates at lower False Positive Rates, achieving an AUC of 0.9242 on PubFig.

Conclusion

DAML represents a significant step forward in making metric learning more flexible and data-dependent. By combining sparse candidate selection with scale alignment, the framework achieves state-of-the-art performance while remaining resistant to the overfitting issues that plague traditional local metric learning. Future work may involve integrating this adaptive logic directly into deep neural network architectures for end-to-end representation learning.

Summary updated

BibTeX
@inproceedings{chen2019data,
  author = {Shuo Chen and Chen Gong and Jian Yang and Ying Tai and Le Hui and Jun Li},
  title = {{Data-Adaptive Metric Learning with Scale Alignment}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2019},
  doi = {10.1609/aaai.v33i01.33013347},
}
Figure