NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Multi-Label Image Classification with Contrastive Learning

Son Duy Dao, Ethan Zhao, Dinh Phung, Jianfei CaiarXiv 2021

Abstract

Contrastive learning has demonstrated significant success in single-label image classification by learning robust representations through instance-level similarity. However, its application to multi-label scenarios is hindered by the ambiguity of global image embeddings, which struggle to represent multiple distinct semantic objects simultaneously. This paper presents MulCon (Multi-label Classification with Contrastive Loss), a framework that decomposes images into label-specific embeddings using a multi-head attention mechanism. By applying supervised contrastive learning at the label level, MulCon effectively captures individual object characteristics while maintaining cross-label correlations through a novel two-step training strategy. Experimental results on MS-COCO and NUS-WIDE benchmarks demonstrate that MulCon achieves state-of-the-art performance, highlighting the efficacy of label-level contrastive representations.

Introduction

Contrastive Learning (CL) has become a cornerstone of modern computer vision, training models to pull similar (positive) samples together in an embedding space while pushing dissimilar (negative) samples apart. While highly effective for single-label tasks—where an image of a "dog" is clearly distinct from an image of a "cat"—applying CL to multi-label classification is notoriously difficult.

The primary challenge lies in the ambiguity of global image representations. If one image contains an apple and a person, and another contains an apple and a car, a global embedding approach faces a contradiction: should these images be pulled together due to the shared apple, or pushed apart due to the differing secondary objects? Forcing global representations to be identical based on a single shared label often destroys vital semantic information regarding other objects in the scene. Consequently, standard CL methods have historically failed to yield significant improvements in multi-label contexts.

Methodology: The MulCon Framework

To address the limitations of global embeddings, the authors propose MulCon, an end-to-end framework that abandons the single global image embedding in favor of multiple label-level embeddings.

Label-Level Embedding Network

The core of MulCon is a specialized network that decomposes an image into distinct semantic components. The model first processes an image through a standard backbone (e.g., ResNet-101) to extract high-level visual features. These features are then passed into a Multi-Head Attention block. In this block, learnable, class-specific embeddings serve as "queries" that attend to the visual feature map. This process generates a unique embedding for every potential label in the dataset, effectively isolating the visual characteristics of specific objects (e.g., the "apple-ness" or "person-ness" of a scene) into separate vectors.

The Label-level embedding network architecture, showing how visual features and class-specific embeddings are combined via a Multi-Head Attention block to produce label-level embeddings.

Contrastive Learning at the Label Level

Once these label-level embeddings are extracted, they are projected into a latent space where supervised contrastive learning is applied. Unlike traditional methods, the contrastive loss now operates on specific labels: the "apple" embedding from one image is pulled toward the "apple" embedding of another, regardless of what other objects are present in either image. This granular approach allows the model to learn highly discriminative features for each class without the interference of co-occurring objects.

Two-Step Training Strategy

Multi-label classification requires a delicate balance between object distinctiveness and label correlation (e.g., "cups" and "dining tables" often appear together). To prevent the contrastive loss from over-separating naturally correlated classes, the authors employ a two-step training process:

  1. Pre-training: The network is initially trained using standard Binary Cross-Entropy (BCE) loss to establish baseline semantic components and capture natural label correlations.
  2. Contrastive Fine-tuning: The contrastive loss is introduced alongside the BCE loss to refine the embeddings, enforcing distinctiveness between objects while preserving the correlations learned during pre-training.

Experimental Results

The authors evaluated MulCon on two major benchmarks: MS-COCO (80 categories) and NUS-WIDE (81 concepts).

Quantitative Performance

MulCon achieved state-of-the-art results on both datasets without the need for complex external graph neural networks often used to model label dependencies:

  • MS-COCO: Achieved 84.0 mAP (mean Average Precision), surpassing the previous best of 83.4 mAP.
  • NUS-WIDE: Achieved 62.5 mAP, outperforming the previous state-of-the-art of 62.0 mAP.

Ablation studies confirmed that the two-step training strategy is vital; training with both losses from scratch resulted in a significantly lower 81.1 mAP on MS-COCO, compared to the 84.0 mAP achieved with fine-tuning.

Qualitative Analysis

Visualizing the attention maps generated by the Multi-Head Attention block provides insight into the model's internal logic. The label-specific queries accurately highlight the relevant pixels for their corresponding objects. Notably, the model can distinguish between different categories and even isolate multiple instances of the same category (e.g., identifying four distinct people in a crowded scene).

Visualization of attention maps for different labels (cow, umbrella, person) and individual instances (person_1 to person_4), demonstrating the model's ability to localize specific objects.

Conclusion and Future Work

MulCon demonstrates that the key to successful contrastive learning in multi-label environments is shifting from image-level to label-level representations. By using attention to decompose complex scenes into manageable semantic units, the framework achieves superior classification accuracy and robust object localization.

While the current two-step training strategy effectively manages the trade-off between distinctiveness and correlation, future work may explore automated methods for balancing these losses to reduce hyperparameter tuning. Additionally, the success of label-level embeddings suggests potential applications in more complex tasks such as multi-label zero-shot learning and dense scene segmentation.

Summary updated

BibTeX
@misc{dao2021multi,
  author = {Son Duy Dao and Ethan Zhao and Dinh Phung and Jianfei Cai},
  title = {{Multi-Label Image Classification with Contrastive Learning}},
  year = {2021},
  eprint = {2107.11626},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2107.11626},
}
Figure