PromptCAL: Contrastive Affinity Learning via Auxiliary Prompts for Generalized Category Discovery

Sheng Zhang, Salman Khan, Zhiqiang Shen, Muzammal Naseer, Guangyi Chen, Fahad KhanOpenReview 2022

TL;DR

This paper introduces PromptCAL, a novel method for Generalized Category Discovery (GCD) that tackles the challenge of identifying both known and entirely new object categories in unlabeled data. By combining learnable visual prompts with an iterative affinity learning process, PromptCAL significantly improves the discovery of novel classes, outperforming existing state-of-the-art methods on several benchmarks.

What Problem Does This Paper Address?

Traditional semi-supervised learning (SSL) methods often assume that all data, labeled or unlabeled, belongs to a predefined set of classes (the "closed-set" assumption). This assumption breaks down in real-world scenarios where new, unseen categories can emerge. Generalized Category Discovery (GCD) addresses this by aiming to categorize unlabeled data that may contain both known and novel classes, using only a limited set of labeled examples. The core challenge in GCD is to effectively discover and cluster these novel classes without prior knowledge of their existence, while also correctly classifying known classes. Existing methods often struggle to adapt pre-trained models to this task without overfitting to known classes or failing to capture the nuances of novel ones.

Methods

PromptCAL employs a two-stage approach:

  1. Warm-up with Multi-Prompt Clustering (MPC):
    • The method starts by adapting a pre-trained Vision Transformer (ViT) backbone.
  2. Crucially, it introduces learnable visual prompts that are embedded into the ViT. These prompts are supervised by an auxiliary clustering loss.
  3. This stage aims to reinforce semantic discriminativeness and learn generalizable affinity relationships, preventing overfitting to known classes and improving adaptability to new datasets.
  4. Contrastive Affinity Learning (CAL):
    • This stage focuses on refining the learned representations.
  5. It uses a Semi-Supervised Affinity Generation (SemiAG) process. This involves constructing a consensus KNN graph, followed by affinity propagation to capture higher-order structural information. A key aspect is incorporating prior knowledge from labeled data to constrain this graph.
  6. The generated affinities are then used to mine reliable pseudo-positive pairs from unlabeled data.
  7. An affinity-based contrastive loss is applied, leveraging these pseudo-positives to further enhance the discovery of novel classes and improve clustering quality. This process is iterative, refining representations and pseudo-labels over time.

Datasets

PromptCAL was evaluated on six benchmark datasets:

  • CIFAR-10
  • CIFAR-100
  • ImageNet-100
  • CUB-200
  • StanfordCars
  • Aircraft

These datasets represent a mix of generic and fine-grained visual recognition tasks, allowing for a comprehensive evaluation of the method's performance across different levels of visual complexity and class granularity.

Key Insights and Ideas

  • Visual Prompts for Discovery: Embedding learnable visual prompts into a pre-trained ViT, and supervising them with a clustering loss, is key to improving semantic discriminativeness and adaptability for novel class discovery.
  • Affinity Propagation for Reliable Positives: Iteratively propagating affinities through a graph, informed by both unlabeled data structure and labeled data priors, is crucial for mining high-quality pseudo-positive pairs. This is more effective than naive KNN-based approaches.
  • Two-Stage Synergy: The warm-up stage with MPC and the subsequent CAL stage work synergistically. The prompts learned in the first stage benefit from the refined affinities in the second, and vice-versa, leading to significant performance gains.
  • Open-Set is Harder: Fine-grained datasets are significantly more challenging for category discovery than generic ones, highlighting the difficulty of distinguishing subtle differences in novel classes.

Key Results

  • State-of-the-Art Performance: PromptCAL achieved state-of-the-art results on six benchmark datasets for Generalized Category Discovery.
  • Significant Gains: The method demonstrated substantial improvements, including over 10% accuracy gains on CUB-200 and StanfordCars, and a significant margin on ImageNet-100 for "All" and "New" classes.
  • Robustness: PromptCAL showed robustness to variations in neighborhood size (K) and quantile threshold (q) in its SemiAG process.
  • Prompt Effectiveness: Ablation studies confirmed that both the visual prompts and the contrastive affinity learning stages contribute significantly to the overall performance, with the second CAL stage providing the largest boost.

Limitations and Future Work

  • Prompt Tuning Sensitivity: While visual prompts are beneficial, their effectiveness can be sensitive to the supervision signal. The paper suggests that while prompts themselves don't inherently guarantee better performance, their interaction with discriminative supervision (like MPC and CAL) is critical.
  • Computational Cost: While the method is designed to be efficient, the iterative nature of affinity propagation and contrastive learning can still be computationally intensive.
  • Future Directions: The authors suggest exploring more advanced prompt learning strategies and further refining the affinity propagation mechanism for even better discovery of novel classes. The paper also hints at the potential for PromptCAL in other open-set learning scenarios.

Summary updated

Abstract

Recent advances in semi-supervised learning (SSL) have achieved remarkable success in learning with partially labeled in-distribution data. However, many existing SSL models fail to learn on unlabeled data sampled from novel semantic classes and thus rely on the closed-set assumption. In this work, we adopt the open-set SSL setting and target a pragmatic but under-explored generalized category discovery (GCD) setting. The GCD setting aims to categorize unlabeled training data coming from known or unknown novel classes by leveraging the information in the labeled data. We propose a two-stage contrastive affinity learning method with auxiliary visual prompts, dubbed PromptCAL, to address this challenging problem, which can discover reliable affinities between labeled and unlabelled samples to further learn better clusters for both known and novel classes. Specifically, we first embed learnable visual prompts into a pre-trained visual transformer (ViT) backbone and supervise these prompts with an auxiliary loss to reinforce semantic discriminativeness and learn generalizable affinity relationships. Secondly, we propose an affinity-based contrastive loss based on an iterative semi-supervised affinity propagation process which can further enhance the benefits of prompt supervision. Extensive experimental evaluation on six benchmarks demonstrates that our method is effective in discovering novel classes even with limited annotations and surpasses the current state-of-the-art on six benchmark dataset (with more than 10% on CUB and StanfordCars, and significant margin on ImageNet-100). Our code and models will be publicly released.
BibTeX
@misc{zhang2022promptcal,
  author = {Sheng Zhang and Salman Khan and Zhiqiang Shen and Muzammal Naseer and Guangyi Chen and Fahad Khan},
  title = {{PromptCAL: Contrastive Affinity Learning via Auxiliary Prompts for Generalized Category Discovery}},
  year = {2022},
  url = {https://openreview.net/forum?id=yVcLmMW5ySI},
  howpublished = {OpenReview},
}
Figure