Abstract
Deep Metric Learning (DML) typically relies on global feature vectors, discarding critical spatial information. We present Deep Interpretable Metric Learning (DIML), which utilizes Optimal Transport to explicitly match spatial structures between images. By aligning local feature maps, DIML enhances retrieval performance and provides human-interpretable explanations for similarity scores.
Introduction
Deep Metric Learning is fundamental to computer vision tasks such as image retrieval and face recognition. Standard approaches employ Global Average Pooling (GAP) to compress 3D feature maps into 1D vectors. While computationally efficient, this process destroys spatial relationships, leading to two primary issues: a lack of interpretability and a failure to account for structural variations like viewpoint changes.
Methods: Structural Matching via Optimal Transport
DIML introduces Structural Matching, treating image similarity as an Optimal Transport (OT) problem. Instead of comparing global vectors, the model compares dense feature maps.
The framework consists of three key components:
- Structural Similarity (SS): The Sinkhorn algorithm identifies the "optimal matching flow," calculating the minimum cost to transform parts of one image into another.
- Spatial Cross-Correlation (CC): To focus on objects rather than backgrounds, cross-correlation initializes the "mass" in the OT problem, weighting discriminative regions more heavily.
- Multi-scale Matching (MM): To maintain efficiency, a two-stage retrieval process is used: fast cosine similarity identifies top-$K$ candidates, followed by precise structural matching on these hard examples.
Experimental Results
DIML was evaluated on CUB200-2011, Cars196, and Stanford Online Products (SOP). The method consistently outperformed baselines across all metrics. Notably, DIML provides a "free" performance boost when applied to pre-trained models without further training.
On the Cars196 dataset, adding DIML to a standard Contrastive loss model improved Precision@1 from 67.45% to 73.35%. Similarly, on CUB200-2011, P@1 rose from 62.47% to 65.16% when applied to Margin Loss.
Discussion and Interpretability
A core advantage of DIML is its inherent interpretability. Because similarity is calculated as the sum of part-wise correspondences, the model can generate heatmaps and matching vectors. This allows users to see exactly which features—such as a bird's beak or a car's wheel—contribute to the similarity score.
While DIML shows significant gains, its performance on the SOP dataset was more modest due to extreme viewpoint variances. Future work will focus on optimizing the OT solver for larger scales and exploring more complex structural priors.
Summary updated