Semantic Prompt Learning for Weakly-Supervised Semantic Segmentation

Ci-Siang Lin, Chien-Yi Wang, Yu-Chiang Frank Wang, Min-Hung Chen

Abstract

Weakly-supervised semantic segmentation (WSSS) aims to train segmentation models using only image-level labels, significantly reducing annotation costs. However, standard approaches like Class Activation Maps (CAMs) often suffer from contextual confusion, where background elements that frequently co-occur with objects (e.g., rails with trains) are incorrectly identified as part of the object. We introduce SemPLeS, a novel framework that leverages the CLIP latent space to automatically learn class-associated background prompts. By replacing manual prompt engineering with learnable vectors, SemPLeS identifies and suppresses specific background noise, leading to more accurate object masks. Our method achieves state-of-the-art results on PASCAL VOC 2012 (78.4% mIoU) and MS COCO 2014 (56.1% mIoU) while remaining compatible with various underlying architectures.

Introduction

Semantic segmentation is a cornerstone of computer vision, yet its reliance on pixel-level annotations makes it prohibitively expensive for large-scale applications. WSSS offers a cost-effective alternative by using image-level tags. The primary challenge in WSSS is the "bleeding" effect of CAMs: models often fail to distinguish between an object and its typical context. While recent efforts have integrated CLIP (Contrastive Language-Image Pretraining) to guide segmentation, they typically rely on manual, heuristic prompts that cannot capture the full complexity of class-specific backgrounds.

The SemPLeS Framework

SemPLeS addresses these limitations through a three-stage refinement process that operates within the frozen CLIP latent space. Unlike previous methods that require human-engineered descriptions for backgrounds, SemPLeS learns these representations automatically.

The SemPLeS pipeline: (a) Segment-Label Matching, (b) Contrastive Prompt Learning for background identification, and (c) Prompt-guided Semantic Refinement.
  1. Segment-Label Matching: An initial mask generator produces coarse foreground and background regions. A contrastive loss ensures the foreground aligns with the class label (e.g., "a photo of a train").
  2. Contrastive Prompt Learning: This core innovation introduces learnable prompt vectors ($p_k$) for each class. These vectors are optimized to represent the specific background features associated with a class—such as "rails" for "train" or "water" for "boat"—without requiring natural language strings.
  3. Prompt-guided Semantic Refinement: The learned background prompts are used to refine the mask generator. A refinement loss penalizes the model if predicted foreground regions match the learned background prompts, effectively "cleaning" the object boundaries.

Experimental Evaluation

We evaluated SemPLeS on the PASCAL VOC 2012 and MS COCO 2014 benchmarks. The framework demonstrated significant improvements over existing CLIP-based methods, such as CLIMS and CLIP-ES.

On PASCAL VOC 2012, SemPLeS achieved a 78.4% mIoU for pseudo masks, a substantial leap from the 72.8% achieved by CLIMS. On the more complex MS COCO dataset, it reached 56.1% mIoU, setting a new performance benchmark for the field.

Qualitative comparison of activation maps. SemPLeS produces tighter, more accurate heatmaps by successfully ignoring co-occurring backgrounds like the rails under the train.

Key Insights

  • Class-Specific Backgrounds: Generic background prompts are insufficient for high-quality segmentation. SemPLeS automatically learns that the background for a "tvmonitor" is semantically distinct from that of a "dog."
  • Latent Space Advantages: By using learnable vectors instead of natural language, the model captures subtle semantic features that are difficult for humans to describe manually.
  • Architecture Agnosticism: SemPLeS is a training strategy rather than a fixed architecture. It consistently improves performance when integrated with CNNs, Transformers, or foundation models like Segment Anything (SAM).

Conclusion

SemPLeS represents a significant advancement in weakly-supervised semantic segmentation by automating the discovery of class-associated background knowledge. By leveraging learnable prompts in the CLIP space, it effectively resolves the long-standing issue of contextual confusion in WSSS. Future research may extend this learnable prompt approach to other weakly-supervised domains, such as video segmentation and open-vocabulary object detection.

Summary updated

BibTeX
@inproceedings{lin2025semantic,
  author = {Ci-Siang Lin and Chien-Yi Wang and Yu-Chiang Frank Wang and Min-Hung Chen},
  title = {{Semantic Prompt Learning for Weakly-Supervised Semantic Segmentation}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2025},
  doi = {10.1109/wacv61041.2025.00849},
}
Figure