CLIP is Also an Efficient Segmenter: A Text-Driven Approach for Weakly Supervised Semantic Segmentation

Yuqi Lin, Minghao Chen, Wenxiao Wang, Boxi Wu, Ke Li, Binbin Lin, Haifeng Liu, Xiaofei He

TL;DR

CLIP-ES leverages the zero-shot power of frozen CLIP models to perform high-quality semantic segmentation using only image-level labels. By introducing a "Softmax-GradCAM" and a real-time attention-based refinement module, it achieves state-of-the-art performance while being 10x faster and significantly more memory-efficient than previous multi-stage methods.

The Challenge of Weakly Supervised Segmentation

Semantic segmentation—the task of assigning a category label to every pixel in an image—is notoriously expensive because it usually requires labor-intensive pixel-level annotations. Weakly Supervised Semantic Segmentation (WSSS) attempts to solve this by using cheaper "weak" labels, such as image-level tags (e.g., "this image contains a boat").

However, traditional WSSS follows a cumbersome three-stage pipeline involving initial localization (CAMs), refinement via separate affinity networks, and final segmentation training. This process is slow, computationally heavy, and often suffers from "category confusion," where models struggle to distinguish objects from their typical backgrounds or co-occurring categories.

Comparison of CLIP-ES against standard GradCAM, showing reduced confusion with background and other categories.

Proposed Methodology: CLIP-ES

The authors introduce CLIP-ES, a framework that replaces the first two stages of WSSS with a training-free, text-driven approach using the CLIP (Contrastive Language-Image Pre-training) model.

1. Softmax-GradCAM

Standard GradCAM uses raw logits to compute gradients, which doesn't account for competition between classes. CLIP-ES computes gradients after the softmax function. This forces categories to be mutually exclusive, effectively suppressing background noise and confusion between similar objects.

2. Class-aware Attention-based Affinity (CAA)

Instead of training a new network to refine masks, CLIP-ES exploits the internal Multi-Head Self-Attention (MHSA) already present in CLIP’s Vision Transformer (ViT). This allows for real-time mask refinement during the initial pass, saving hours of training time and gigabytes of VRAM.

The CLIP-ES framework overview, illustrating CAM generation, CAA refinement, and the Confidence-guided Loss (CGL).

3. Text-Driven Strategies

  • Class-Related Background Suppression: By defining a "background set" of text prompts (e.g., "water," "ground," "sky"), the model learns to "push" object activations away from their typical surroundings.
  • Sharpness-based Prompt Selection: The researchers empirically discovered that a neutral prompt like "a clean origami {}" provides more complete object masks than more descriptive prompts.
  • Synonym Fusion: Multiple names for a class (e.g., "person, people, human") are combined into a single prompt to capture diverse visual features.

Key Results and Efficiency

The framework was evaluated on the PASCAL VOC 2012 and MS COCO 2014 benchmarks, yielding several significant findings:

  • State-of-the-Art Performance: CLIP-ES achieved 73.8% mIoU on the PASCAL VOC 2012 validation set, outperforming previous methods that used much more complex training pipelines.
  • Massive Speedup: Generating pseudo-masks took only 0.6 hours, compared to 9.1 hours for the previous best CLIP-based method (CLIMS) and 77.2 hours for AdvCAM.
  • Memory Efficiency: The method requires only 2GB of GPU memory for mask generation, whereas competing methods often require 18GB or more.

Limitations and Future Work

While highly efficient, the authors note some "bad cases" where the model struggles with very small objects or heavy occlusion. Additionally, the discovery of the "origami" prompt was empirical; future work could involve automated prompt discovery. As larger and higher-resolution vision-language models emerge, this framework is expected to scale accordingly, further improving the quality of zero-shot segmentation seeds.

Summary updated

BibTeX
@inproceedings{lin2022clip,
  author = {Yuqi Lin and Minghao Chen and Wenxiao Wang and Boxi Wu and Ke Li and Binbin Lin and Haifeng Liu and Xiaofei He},
  title = {{CLIP is Also an Efficient Segmenter: A Text-Driven Approach for Weakly Supervised Semantic Segmentation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
}
Figure