OTSeg: Multi-prompt Sinkhorn Attention for Zero-Shot Semantic Segmentation

Kwanyoung Kim, Yujin Oh, Jong Chul Ye

Abstract

The recent success of CLIP has demonstrated promising results in zero-shot semantic segmentation by transferring muiltimodal knowledge to pixel-level classification. However, leveraging pre-trained CLIP knowledge to closely align text embeddings with pixel embeddings still has limitations in existing approaches. To address this issue, we propose OTSeg, a novel multimodal attention mechanism aimed at enhancing the potential of multiple text prompts for matching associated pixel embeddings. We first propose Multi-Prompts Sinkhorn (MPS) based on the Optimal Transport (OT) algorithm, which leads multiple text prompts to selectively focus on various semantic features within image pixels. Moreover, inspired by the success of Sinkformers in unimodal settings, we introduce the extension of MPS, called Multi-Prompts Sinkhorn Attention (MPSA) , which effectively replaces cross-attention mechanisms within Transformer framework in multimodal settings. Through extensive experiments, we demonstrate that OTSeg achieves state-of-the-art (SOTA) performance with significant gains on Zero-Shot Semantic Segmentation (ZS3) tasks across three benchmark datasets.

Introduction: The Challenge of Pixel-Level Alignment

Zero-Shot Semantic Segmentation (ZS3) aims to segment objects in images without requiring pixel-level annotations for those specific classes during training. While Vision-Language Models (VLMs) like CLIP have revolutionized image-level classification, adapting them for dense, pixel-level tasks remains challenging.

A common strategy involves using multiple text prompts (e.g., "a photo of a [class]", "the foreground of a [class]") to capture diverse semantic information. However, standard attention mechanisms often lead to "prompt coherence," where all prompts focus on the same dominant features of an object, rendering the multi-prompt approach redundant. OTSeg addresses this by introducing a mechanism that forces prompts to differentiate and cover various semantic aspects of the target.

The OTSeg Framework

The core of OTSeg lies in its use of the Sinkhorn algorithm to solve an Optimal Transport (OT) problem for multimodal alignment.

Overview of the OTSeg training and inference framework

1. Multi-Prompts Sinkhorn (MPS)

Instead of the standard SoftMax normalization, MPS treats the alignment between $N$ text prompts and $M$ image pixels as a distribution problem. By applying the Sinkhorn algorithm, the model produces a doubly stochastic matrix where the sum of relevance scores for each prompt across all pixels is constrained. This "competition" for pixel attention forces different prompts to focus on distinct semantic features.

2. Multi-Prompts Sinkhorn Attention (MPSA)

To integrate this logic into the decoding process, the authors developed MPSA. This module replaces the standard cross-attention in the Transformer decoder. By enforcing optimal transport constraints within the attention layers, the model maintains diverse semantic matching throughout the feature refinement stages.

3. OTSeg+ Ensemble

The final architecture, OTSeg+, utilizes an ensemble approach. It combines the refined score maps from the MPS path with the output of the learnable image decoder to maximize performance.

Key Insights: The Power of Optimal Transport

The fundamental shift from "passive" SoftMax attention to "active" Optimal Transport is what sets OTSeg apart. In standard cross-attention, multiple prompts often collapse into a single focus point. In contrast, the Sinkhorn-based approach ensures that if one prompt is already attending to a specific region (e.g., the body of a sheep), other prompts are incentivized to find other relevant features (e.g., the head or the background).

Comparison between standard cross-attention (left) and OTSeg's Optimal Transport approach (right)

As shown in the visualization, OTSeg's score maps ($S^1$ to $S^4$) demonstrate much higher diversity compared to the baseline, where all maps look nearly identical. This diversity allows the final aggregated score map to be more robust and accurate.

Experimental Results

OTSeg was evaluated on three major benchmarks: VOC 2012, PASCAL Context, and COCO-Stuff164K.

  • State-of-the-Art Performance: OTSeg+ achieved significant gains. On VOC 2012 (transductive), it reached a harmonic mean IoU (hIoU) of 94.4, surpassing previous methods by over 3 points. On the massive COCO-Stuff164K dataset, it achieved an hIoU of 49.8.
  • Efficiency: Remarkably, OTSeg achieves these results without increasing the number of learnable parameters compared to baselines like ZegCLIP. It also maintains a high inference speed of approximately 23 FPS on a single GPU.
  • Generalization: The model demonstrated strong cross-dataset generalization, performing well on ADE20K even when trained only on COCO-Stuff.

Conclusion

OTSeg demonstrates that the redundancy in multi-prompt vision-language models can be effectively mitigated using Optimal Transport. By replacing standard attention with Sinkhorn-based mechanisms, OTSeg forces semantic diversity, leading to superior zero-shot segmentation performance. Future work may extend this principle to instance and panoptic segmentation, as well as exploring automated prompt generation.

Summary updated

Abstract

The recent success of CLIP has demonstrated promising results in zero-shot semantic segmentation by transferring muiltimodal knowledge to pixel-level classification. However, leveraging pre-trained CLIP knowledge to closely align text embeddings with pixel embeddings still has limitations in existing approaches. To address this issue, we propose OTSeg, a novel multimodal attention mechanism aimed at enhancing the potential of multiple text prompts for matching associated pixel embeddings. We first propose Multi-Prompts Sinkhorn (MPS) based on the Optimal Transport (OT) algorithm, which leads multiple text prompts to selectively focus on various semantic features within image pixels. Moreover, inspired by the success of Sinkformers in unimodal settings, we introduce the extension of MPS, called Multi-Prompts Sinkhorn Attention (MPSA) , which effectively replaces cross-attention mechanisms within Transformer framework in multimodal settings. Through extensive experiments, we demonstrate that OTSeg achieves state-of-the-art (SOTA) performance with significant gains on Zero-Shot Semantic Segmentation (ZS3) tasks across three benchmark datasets.
BibTeX
@inproceedings{kim2024otseg,
  author = {Kwanyoung Kim and Yujin Oh and Jong Chul Ye},
  title = {{OTSeg: Multi-prompt Sinkhorn Attention for Zero-Shot Semantic Segmentation}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  url = {https://openreview.net/forum?id=aRJDHCesUY},
}
Figure