Max-margin Class Imbalanced Learning with Gaussian Affinity

Munawar Hayat, Salman H. Khan, Waqas Zamir, Jianbing Shen, Ling ShaoarXiv 2019

TL;DR

This paper introduces "Affinity Loss," a novel hybrid loss function that simultaneously handles classification and clustering for imbalanced datasets. By leveraging a Gaussian affinity measure in Euclidean space, it enforces maximum margin constraints and learns balanced classification regions, significantly improving performance on tasks like face recognition and image classification where data distribution is uneven.

What Problem Does This Paper Address?

Deep learning models thrive on large, balanced datasets. However, real-world data is often imbalanced, meaning some classes have far more examples than others. This imbalance causes classifiers to become biased towards the majority classes, leading to poor performance (low recall) on minority classes, which are often the most critical (e.g., detecting rare diseases). Traditional softmax loss, while popular, struggles with this imbalance because it doesn't explicitly enforce margins between classes or control intra-class variations and inter-class separation effectively. This paper aims to bridge this gap by proposing a new loss function that directly addresses these limitations.

Methods

The core contribution is the Affinity Loss function, which combines classification and clustering into a single objective. Key aspects include:

  • Gaussian Affinity Measure: Instead of relying on dot products (as in softmax), it uses a Gaussian similarity measure in Euclidean space, defined by a Bergman divergence (squared L2 distance). This measure is more flexible for enforcing margin constraints.
  • Max-Margin Learning: The loss function directly enforces maximum margin constraints between classes. This is achieved by maximizing the similarity to the correct class prototype while minimizing similarity to incorrect ones, with a defined margin ($\lambda$).
  • Joint Classification and Clustering: The framework inherently performs clustering by learning "class prototypes" (centers) in the feature space. Samples are mapped to these prototypes.
  • Uniformly Spaced and Equidistant Prototypes: The method aims to ensure that class prototypes are evenly distributed in the feature space, preventing majority classes from dominating the space.
  • Multi-Centered Learning: For complex data distributions, the approach allows learning multiple prototypes per class, enabling better representation of diverse samples within a single class.
  • Diversity Regularizer: A regularization term is introduced to encourage uniform spacing of class prototypes, further balancing the learning process.

The proposed loss is a differentiable module that can be easily integrated into existing deep learning architectures.

Datasets

The paper evaluates the proposed Affinity Loss on several datasets exhibiting natural imbalance:

  • Dermofit Image Library (DIL): A dataset for skin lesion classification with 1300 images across 10 categories, showing significant imbalance. Experiments were conducted with 5 and 10 class splits.
  • VGG2: A large-scale dataset for face recognition containing 3.31 million images of 8,631 identities, with inherent class imbalance due to web-crawling.
  • Labelled Faces in the Wild (LFW): A standard benchmark for face verification.
  • YouTube Faces (YTF): Another standard benchmark for face verification using video sequences.
  • Celebrities in Frontal Profile (CFP): A dataset for face recognition with frontal and profile views.
  • Age Database (AgeDB): A dataset with images of varying ages, introducing another form of imbalance.
  • Imbalanced MNIST: The standard MNIST dataset was artificially imbalanced by retaining only 10% or 25% of samples for specific digits to study robustness.

Key Insights and Ideas

  • Euclidean Space is More Tractable for Max-Margin: Unlike angular margins in softmax-based methods, enforcing max-margin constraints in Euclidean space using an affinity measure is more direct and less prone to approximations.
  • Clustering as a Natural Fit for Imbalance: By jointly learning to classify and cluster, the model can create more balanced and discriminative representations, effectively mitigating the bias towards majority classes.
  • Uniformity is Key to Generalization: The proposed method's ability to learn uniformly spaced and shaped clusters in the feature space is crucial for improving generalization, especially on imbalanced data.
  • Multi-Prototypes for Diversity: Allowing multiple prototypes per class is a significant advantage for handling complex intra-class variations, which are common in real-world datasets.
  • Robustness to Noise and Imbalance: The Affinity Loss demonstrates remarkable robustness against varying levels of data imbalance and noisy labels, a critical property for practical applications.

Key Results

  • Significant Performance Gains: The Affinity Loss achieved substantial improvements over existing state-of-the-art methods on the DIL dataset, with an absolute gain of 10.9% for 5-class classification and 7.7% for 10-class classification.
  • Competitive Face Verification: The method achieved competitive results on LFW and YTF datasets, demonstrating its effectiveness in large-scale face verification tasks. It also reported high accuracies on AgeDB30, CFP-FF, and CFP-FP.
  • Robustness Demonstrated: Experiments on imbalanced MNIST showed consistently superior performance compared to standard softmax loss, especially at higher imbalance ratios. The loss also exhibited greater robustness to noisy labels, with less performance degradation than softmax.
  • Ablation Studies: Multi-centered learning (using more than one prototype per class) showed significant benefits, with optimal performance achieved for m > 5 prototypes. The parameter $\sigma$ controlling cluster spread was found to be optimal between 5 and 20.

Limitations and Future Work

  • Parameter Tuning: While the paper explores the effect of $\sigma$, finding the optimal value for parameters like $\sigma$ and the margin $\lambda$ might require careful tuning for different datasets.
  • Computational Cost: Although the authors state the loss is easily pluggable and doesn't require additional compute, the multi-centered approach with many prototypes could potentially increase computational complexity for very large numbers of prototypes.
  • Future Work: The authors suggest that the proposed framework complements existing regularization techniques and can be incorporated into various architectures. Future work could explore its application to other domains beyond image classification and verification, and further investigate the theoretical underpinnings of the affinity measure.

Summary updated

BibTeX
@misc{hayat2019max,
  author = {Munawar Hayat and Salman H. Khan and Waqas Zamir and Jianbing Shen and Ling Shao},
  title = {{Max-margin Class Imbalanced Learning with Gaussian Affinity}},
  year = {2019},
  eprint = {1901.07711},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1901.07711},
}
Figure