Advancing Deep Metric Learning Through Multiple Batch Norms And Multi-Targeted Adversarial Examples

Inderjeet Singh, Kazuya Kakizaki, Toshinori ArakiarXiv 2022

TL;DR

The proposed framework, MDProp, breaks the classic accuracy-robustness tradeoff in Deep Metric Learning (DML) by using multi-targeted adversarial examples to clean up crowded embedding spaces. By assigning dedicated batch normalization layers to different data distributions during training, MDProp simultaneously boosts clean image retrieval performance and significantly hardens models against adversarial attacks.

What Problem Does This Paper Address?

Deep Metric Learning (DML) is the engine behind visual similarity tasks like face recognition, image retrieval, and product recommendations. Instead of predicting a class label, DML models learn to map images into an embedding space where similar items sit close together and dissimilar items are pushed apart.

However, DML models are highly vulnerable to adversarial examples (AXs)—inputs with tiny, intentional perturbations designed to fool the network. While "adversarial training" can make models robust, it usually triggers an inevitable tradeoff: it degrades performance on clean, unperturbed data.

For standard classification networks, a method called AdvProp bypassed this tradeoff by using separate Batch Normalization (BN) layers for clean and adversarial data. But DML is a different beast; it operates on relative distances in an embedding space rather than absolute class probabilities. Furthermore, standard single-targeted adversarial attacks fail to address complex, multi-class overlapping regions in the embedding space where the model is most prone to false ranking predictions.

Methods

The authors introduce MDProp (Multi-Distribution Propagation), a framework tailored to regularize and disentangle the embedding spaces of DML models. It relies on two core innovations:

  1. Multi-Targeted Adversarial Examples (MTAXs): Instead of pushing an image toward a single incorrect class, MDProp crafts adversarial examples that mimic the deep representations of multiple target classes simultaneously. This forces the adversarial data directly into the ambiguous, overlapping zones of the embedding space.
  2. Disentangled Learning via Multiple BNs: Clean data, single-targeted attacks (STAXs), and MTAXs all exhibit distinct statistical distributions. To prevent these shifts from polluting the clean data representations, MDProp trains the model using separate BN layers for each distribution.

During inference, the auxiliary BN layers are discarded, leaving a streamlined model optimized purely via the clean BN pathway.

Figure 1. (a) An outline of MDProp framework. MDProp generalizes the generation and the use of the inputs following multiple distributions while using separate BN layers. In particular, MDProp uses multi-targeted AXs (MTAXs) along with single-targeted AXs (STAXs), enhancing both accuracy and robustness. (b) The resulting feature space of the DML models trained using only STAXs. Because single-targeted AXs are not designed to target these overlapped regions, they leave the overlap unresolved. (c) MDProp generates MTAXs during training to specifically regularize the feature space overlap (region ‘O’) in DML models, resulting in improved generalization in the trained DML models.

Datasets

The framework was thoroughly evaluated on three standard DML benchmarks:

  • CUB200-2011: 200 bird classes across 11,788 images.
  • CARS196: 196 car classes across 16,185 images.
  • Stanford Online Products (SOP): A larger dataset containing 22,634 product classes across 120,053 images.

Key Insights and Ideas

  • Targeting the Overlap: Standard adversarial training is a blunt instrument. By contrast, MTAXs act as a precision regularizer. Pushing data into multi-class overlap regions forces the model to shrink these zones during training, resulting in a cleaner, better-separated embedding space.
  • One Size Does Not Fit All BNs: The authors demonstrated that different types of adversarial attacks cannot share a single "adversarial" BN layer. As shown in the paper's layer-wise analysis, the learned parameters ($\beta$ and $\gamma$) for clean, STAX, and MTAX data vary significantly, proving that multiple auxiliary BN layers are required to truly handle the distribution shifts.
  • The Sweet Spot for Targets ($T$): Increasing the number of target classes ($T$) for MTAX generation improves clean data performance, but only up to a point (typically $T=3$ or $5$). Beyond this, the optimization problem becomes too complex for the attack generator, leading to diminishing returns.

Key Results

MDProp consistently outperformed standard training, traditional adversarial training, and a direct DML extension of AdvProp (AdvProp-D):

  • Clean Data Boost: MDProp achieved up to a 2.95% increase in clean data Recall@1 scores.
  • Substantial Robustness: The framework delivered up to 2.12 times increased robustness against powerful white-box attacks (like PGD-20) compared to conventional methods.
  • Denser Embedding Spaces: The models showed a marked reduction in $\pi_{ratio}$ scores, mathematically confirming that the trained embedding spaces feature tighter intra-class clusters and wider inter-class gaps.

Detailed quantitative breakdowns across different loss functions (Multisimilarity and ArcFace) can be seen in the experimental results:

Image retrieval performance comparison on CUB200 and CARS196 datasets.

Limitations and Future Work

While MDProp showed stellar performance on CUB200 and CARS196, its gains on the massive Stanford Online Products (SOP) dataset were relatively modest. The authors hypothesize that when a dataset contains tens of thousands of classes, randomly selecting targets for MTAX generation yields a higher probability of ineffective target selection.

Future work will likely focus on developing more intelligent, semantic-aware target selection strategies to scale multi-targeted regularization to massive, web-scale datasets.

Summary updated

BibTeX
@misc{singh2022advancing,
  author = {Inderjeet Singh and Kazuya Kakizaki and Toshinori Araki},
  title = {{Advancing Deep Metric Learning Through Multiple Batch Norms And Multi-Targeted Adversarial Examples}},
  year = {2022},
  eprint = {2211.16253},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2211.16253},
}
Figure