Potential Field Based Deep Metric Learning

Shubhang Bhatnagar, Narendra Ahuja

TL;DR

Deep metric learning teaches neural networks to map similar images close together and dissimilar ones far apart, usually by comparing small groups (tuples) of images or using learned class "proxies." This paper borrows an idea from physics: treat every image embedding as an electric charge that creates a continuous, decaying potential field—pulling nearby same-class images together and pushing different-class images apart. By letting influence weaken with distance rather than grow, the model becomes remarkably resistant to mislabeled data and beats state-of-the-art methods on standard image retrieval benchmarks.

What Problem Does This Paper Address?

Imagine organizing a massive photo library so that any two pictures of the same bird species sit near each other in a mathematical space, while pictures of different species stay far apart. That is the goal of deep metric learning (DML).

Traditionally, DML methods do this in one of two ways, both with annoying trade-offs:

  1. Tuplet-based methods (like triplet loss) sample pairs or triplets of images and push/pull them based on their relative distances. Because checking every possible triplet in a batch scales cubically ($O(n^3)$), these methods rely on "mining" only the most informative triplets. Throwing away the rest wastes supervision, makes training sensitive to label noise, and can hurt generalization.
  2. Proxy-based methods replace sample-to-sample comparisons with comparisons between samples and a few learned class representatives ("proxies"). This avoids the sampling headache, but ignoring direct sample-to-sample interactions often leads to less generalizable intra-class features—especially if the proxies drift far away from the actual data they are supposed to represent.

Methods

The authors propose Potential Field based Deep Metric Learning (PFML), which models interactions across all samples in a batch simultaneously without mining tuplets.

Figure 1. Overview of our Potential-field based DML pipeline. The process includes (1) Computing attraction and repulsion fields generated by each embedding and proxy, (2) Computing the class potential fields by superposition of individual fields (3) Evaluating total potential energy by summing up the potentials of embeddings and proxies under the class potential field and (4) Updating lo- cations of sample embeddings (through network parameters) and proxies to minimize total potential energy through backprop.

Here is how it works:

  • Embeddings as charges: Each image embedding $\mathbf{z}_i$ generates two continuous potential fields: an attractive field ($\psi_{att}$) for embeddings of the same class, and a repulsive field ($\psi_{rep}$) for embeddings of other classes.
  • Superposition: For each class $j$, the individual fields of all samples in the batch (plus a set of $M$ learnable proxies per class that stand in for out-of-batch samples) are summed together to form a global class potential field $\Psi_j$.
  • Training via energy minimization: During training, the network parameters and proxies are updated via gradient descent to minimize the total potential energy $\mathcal{U}$—essentially letting embeddings and proxies slide "downhill" along the field's gradient.
Figure 2. An example of the class potential fields Ψ1 and Ψ2 (Sec. 3.2.3), created by superposing the fields of individual embeddings (Sec 3.2.1) belonging to Classes 1 and 2. Arrows denote the gradient of the respective potentials representing the net force on them. (a) Ψ1 draws samples/proxies of class 1 towards nearby samples/ proxies of class 1 while keeping them at least δ distance away from embeddings of class 2. Proxies at starred locations are drawn towards the nearest Class 1 embeddings which are potential minima, helping them better model the data distribution (Sec 3.4). (b) Ψ2 draws embeddings of class 2 towards other nearby embeddings of class 2 instead of distant class 2 embeddings, which might be a significantly different variant of the class (or potentially a mislabeled data point), helping better feature learning (or improving noise robustness if mislabeled). Ψ2 also keeps class 2 embeddings δ distance them away from embeddings of class 1.

What's new here? Two design choices set PFML apart:

  1. The Decay Property: In most existing DML methods, the pull or push between two points grows stronger (or stays constant) as they get farther apart. PFML flips this: interaction strength decays with distance ($\propto 1/\|\mathbf{r} - \mathbf{z}_i\|_2^\alpha$).
  2. A $\delta$-radius deadzone: Inside a small radius $\delta$, attraction becomes constant (zero force) so same-class embeddings don't collapse to a single point, and repulsion is capped outside $\delta$ so different classes aren't pushed unnecessarily far apart.

Datasets

The authors evaluate PFML on three standard zero-shot image retrieval benchmarks (where the first half of classes are used for training and the second half for testing):

  • Cars-196: 16,185 images across 196 car model categories.
  • CUB-200-2011: 11,788 images across 200 bird species.
  • Stanford Online Products (SOP): 120,053 images across 22,634 online product categories.

No new benchmarks were introduced.

Key Insights and Ideas

  • Why decaying fields beat growing ones: When influence decays with distance, a sample is primarily guided by its local neighborhood. If a dataset has large intra-class variation (e.g., a bird in flight vs. perched), distant variants won't tug on each other too hard. Better yet, if a sample is mislabeled (and thus sitting far away from its supposed class), its bad influence naturally fades out.
  • Better proxy alignment: The authors prove theoretically (and verify empirically) that decaying fields create local potential minima right around actual sample embeddings. As a result, learnable proxies settle much closer to the true data distribution than in methods where forces grow with distance.
  • No excessive separation: Capping repulsion at radius $\delta$ prevents the model from wasting capacity pushing already-separated classes even farther apart, preserving finer intra-class structure.

Key Results

PFML outperforms state-of-the-art baselines across all three datasets and four different network backbones (ResNet-50, BN Inception, DINO, and ViT):

  • Standard retrieval (ResNet-50, Recall@1): PFML achieves 73.4% on CUB-200-2011, 92.7% on Cars-196, and 82.9% on SOP—beating strong baselines like Proxy Anchor and HIST by 1.5% to 5%+.
  • Robustness to label noise: When 20% of training labels are randomly corrupted, all methods drop, but PFML holds up best. On ResNet-50, it beats the second-best method (Proxy Anchor) by 6.0% R@1 on CUB-200-2011 (66.7% vs. 60.7%) and 7.6% R@1 on Cars-196 (84.5% vs. 76.9%).
  • Closer proxies: Measured by Wasserstein distance ($W_2$) on CUB-200-2011, PFML's proxies sit 33.3% closer to the data they represent ($0.16$) than the next-best multi-proxy method, SoftTriplet ($0.24$).

Limitations and Future Work

Because PFML still uses class proxies to augment the batch's potential field, it shares the main limitation of proxy-based methods: training cost scales linearly with the number of classes. However, the authors note that proxies are only used during training (not inference), and their computational footprint is small compared to the forward and backward passes of the neural network itself. No specific future directions are outlined beyond this scaling observation.

Summary updated

BibTeX
@inproceedings{bhatnagar2025potential,
  author = {Shubhang Bhatnagar and Narendra Ahuja},
  title = {{Potential Field Based Deep Metric Learning}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.02379},
}
Figure