End-to-End Supervised Multilabel Contrastive Learning

Ahmad Sajedi, Samir Khaki, Konstantinos N. Plataniotis, Mahdi S. HosseiniarXiv 2023

Abstract

Multilabel representation learning is recognized as a challenging problem that can be associated with either label dependencies between object categories or data-related issues such as the inherent imbalance of positive/negative samples. Recent advances address these challenges from model- and data-centric viewpoints. In model-centric, the label correlation is obtained by an external model designs (e.g., graph CNN) to incorporate an inductive bias for training. However, they fail to design an end-to-end training framework, leading to high computational complexity. On the contrary, in data-centric, the realistic nature of the dataset is considered for improving the classification while ignoring the label dependencies. In this paper, we propose a new end-to-end training framework -- dubbed KMCL (Kernel-based Mutlilabel Contrastive Learning) -- to address the shortcomings of both model- and data-centric designs. The KMCL first transforms the embedded features into a mixture of exponential kernels in Gaussian RKHS. It is then followed by encoding an objective loss that is comprised of (a) reconstruction loss to reconstruct kernel representation, (b) asymmetric classification loss to address the inherent imbalance problem, and (c) contrastive loss to capture label correlation. The KMCL models the uncertainty of the feature encoder while maintaining a low computational footprint. Extensive experiments are conducted on image classification tasks to showcase the consistent improvements of KMCL over the SOTA methods.

Introduction

Multilabel image classification—where an image may contain multiple distinct objects—is a fundamental yet challenging task in computer vision. Unlike single-label classification, it must account for complex label dependencies (e.g., "chairs" and "tables" often co-occur) and a significant imbalance between positive and negative samples. Existing research typically follows either a data-centric approach, focusing on loss functions to handle sample imbalance, or a model-centric approach, using complex architectures like Graph Convolutional Networks (GCNs) to model label relationships.

However, these approaches have significant drawbacks: model-centric designs are often computationally expensive and require multi-stage training, while data-centric methods frequently ignore semantic correlations. Furthermore, most models are deterministic and fail to account for the epistemic uncertainty of the feature encoder. We introduce KMCL (Kernel-based Multilabel Contrastive Learning), an end-to-end framework that bridges these gaps by mapping features into a probabilistic space.

The KMCL Framework

KMCL integrates label correlation modeling and uncertainty estimation into a single, efficient pipeline. The architecture's core is the Kernel Mixture Module (KMM). Instead of producing a static feature vector, the KMM outputs parameters—mixing coefficients ($\pi$), means ($\mu$), and covariances ($\Sigma$)—for a mixture of exponential kernels in a Gaussian Reproducing Kernel Hilbert Space (RKHS).

The KMCL end-to-end architecture, illustrating the flow from input images through the Kernel Mixture Module (KMM) to the three-part objective function.

By representing each class as a distribution rather than a point, the model explicitly accounts for the uncertainty of the feature encoder. If the model is "unsure" about a specific feature, the resulting high variance naturally influences the subsequent similarity calculations.

Distributional Similarity and Contrastive Learning

Standard contrastive learning typically relies on cosine similarity between fixed vectors. KMCL instead utilizes the Bhattacharyya coefficient to measure similarity between the distributions (kernels) of different images. This metric is superior in this context because it considers both the "position" (mean) and the "spread" (variance/uncertainty) of the features.

Comparison of similarity metrics: The Bhattacharyya coefficient (a) provides a more nuanced measure of similarity between distributions compared to standard kernels, as further illustrated by the contour plots (b-d) showing varying degrees of overlap and uncertainty.

The training is guided by a three-part objective function:

  1. Reconstruction Loss ($\mathcal{L}_{REC}$): Ensures the kernel representation accurately reflects the input data.
  2. Asymmetric Loss ($\mathcal{L}_{ASL}$): A data-centric term that handles the inherent imbalance of positive and negative samples.
  3. Contrastive Loss ($\mathcal{L}_{KMCL}$): Pulls together images sharing labels (weighted by a Jaccard index to prioritize high label overlap) while pushing apart dissimilar ones.

Experimental Results and Insights

KMCL was evaluated on diverse benchmarks, including PASCAL-VOC, MS-COCO, and medical datasets like ChestX-ray14. The framework achieved state-of-the-art results, such as 96.2% mAP on PASCAL-VOC in under 30 epochs. In medical imaging, where high recall is critical, KMCL improved recall by 11.6% on ChestX-ray14 compared to previous methods.

Beyond numerical performance, KMCL is highly efficient, outperforming heavy GCN-based models with a significantly lower computational footprint (GMACs). Qualitative Grad-CAM analysis also shows that KMCL produces more precise object localizations, focusing accurately on target objects with minimal activation "bleeding" into the background.

Conclusion

KMCL provides a robust, end-to-end solution for multilabel classification by treating features as distributions in an RKHS. This approach effectively captures label correlations and model uncertainty while maintaining high computational efficiency. Future work will explore extending this distributional contrastive learning framework to other tasks like object detection and segmentation.

Summary updated

BibTeX
@misc{sajedi2023end,
  author = {Ahmad Sajedi and Samir Khaki and Konstantinos N. Plataniotis and Mahdi S. Hosseini},
  title = {{End-to-End Supervised Multilabel Contrastive Learning}},
  year = {2023},
  eprint = {2307.03967},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2307.03967},
}
Figure