TextRegion: Text-Aligned Region Tokens from Frozen Image-Text Models

Yao Xiao, Qiqian Fu, Heyi Tao, Yuqun Wu, Zhen Zhu, Derek Hoiem

TL;DR

TextRegion is a simple, training-free framework that bridges the gap between global image-text alignment and local spatial precision. By combining frozen foundation models (like CLIP or SigLIP2) with the precise masks of SAM2, it generates "region tokens" that enable state-of-the-art zero-shot performance in open-world segmentation, visual grounding, and referring expression comprehension.

What Problem Does This Paper Address?

Contrastive image-text models like CLIP have revolutionized computer vision by enabling "open-vocabulary" understanding—the ability to recognize concepts not seen during training. However, these models are typically trained on global image-level descriptions. Consequently, they excel at saying "there is a horse in this image" but struggle to precisely localize or segment that horse.

On the other hand, specialized segmentation models like SAM2 (Segment Anything Model 2) provide incredibly precise spatial boundaries for objects but are "class-agnostic"—they know where an object is, but not what it is. Existing attempts to merge these two strengths often involve expensive retraining or complex, multi-stage pipelines that lose the flexibility of the original frozen models. TextRegion tackles this by asking: Can we extract text-aligned features for specific regions directly from frozen models without any additional training?

Methods

The core of TextRegion is a "plug-and-play" modification to the final attention layer of a frozen vision transformer.

  1. Mask-based Attention Pooling: Instead of using the standard global [CLS] token to aggregate information from the entire image, TextRegion uses masks generated by SAM2. It performs a weighted pooling of the "value" features ($V$) from the final attention block, where the weights are determined by the downsampled SAM2 masks. This produces a region token that lives in the same embedding space as the text.
  2. Global Patch Removal: The authors observed that in large models, certain "global tokens" capture the overall scene context rather than local details, which can bias region classification (e.g., classifying a bed as a "cat" because a cat is on it). They introduce a consistency check to filter out these global patches by comparing intra-region and inter-region similarity.
  3. Multi-resolution Encoding: To better handle small objects, the framework uses a multi-resolution strategy. It encodes both the full image and high-resolution crops, then merges the features. This ensures that even tiny regions have sufficient feature representation.
The TextRegion framework: SAM2 provides masks, while frozen image-text models provide semantic features. These are combined via mask-based attention pooling to create region tokens for downstream tasks.

Datasets

The authors evaluated TextRegion across a wide array of benchmarks to prove its versatility:

  • Open-World Semantic Segmentation: PASCAL VOC 2012, PASCAL Context, COCO-Stuff, COCO-Object, Cityscapes, and ADE20K.
  • Referring Expression Comprehension (ReC): RefCOCO, RefCOCO+, and RefCOCOg.
  • Multi-Object Grounding: The Reasoning Segmentation dataset, which requires complex logical deduction to find objects (e.g., "What part of the car needs to be turned on when driving at night?").

Key Insights and Ideas

  • Value Features are Key: The authors found that the "value" projections in the final attention block are significantly richer in linguistic semantics than the raw input features. Transitioning from pooling input features to value features improved performance from near-zero to competitive levels.
  • Downsampling is Better than Upsampling: Instead of upscaling low-resolution feature maps to match high-resolution masks (which adds noise), TextRegion downsamples the SAM2 masks to the feature map resolution. This is more computationally efficient and robust.
  • The "Global Token" Sabotage: Large vision transformers often designate specific tokens to act as "registers" for global information. If these aren't filtered out during region pooling, they act as noise that degrades local accuracy.
  • Compatibility: Because it is training-free, TextRegion works out-of-the-box with various backbones, including CLIP, SigLIP2, and the recent Perception Encoder.
Visualizing the impact of global patch removal. Removing these patches prevents the model from incorrectly biasing a local region with global scene context.

Key Results

TextRegion consistently outperformed or matched state-of-the-art training-free methods:

  • Segmentation: On the OpenCLIP ViT-H/14 backbone, TextRegion achieved an average 49.5 mIoU across eight benchmarks, surpassing the previous best (Trident) at 48.6 mIoU.
  • Referring Expressions: On RefCOCO, it achieved 48.7% accuracy (Val set), outperforming complex baselines like FGVP (46.1%) without needing candidate bounding boxes.
  • Grounding: In multi-object grounding, using "interpreted queries" (LLM-simplified versions of complex prompts) led to massive performance jumps, showing that the bottleneck in visual reasoning is often the text encoder's language understanding, not the visual retrieval capability.

Limitations and Future Work

  • Dependency on SAM2: The quality of the region tokens is strictly capped by the accuracy of the initial segmentation masks. If SAM2 fails to find an object, TextRegion cannot classify it.
  • Text Encoder Bottleneck: While the visual features are strong, the frozen text encoders (like CLIP's) sometimes struggle with long, complex, or highly specific "reasoning" queries.
  • Intricate Edges: The authors noted slight pixel-level inaccuracies along very complex contours (e.g., the wheels of a train), suggesting room for improvement in how features are propagated back to the pixel level.

Future work could involve integrating more powerful LLMs to better interpret complex queries or exploring ways to refine the masks iteratively based on the generated region tokens.

Summary updated

Abstract

Image-text models excel at image-level tasks but struggle with detailed visual understanding. While these models provide strong visual-language alignment, segmentation models like SAM2 offer precise spatial boundaries for objects. To this end, we propose TextRegion, a simple, effective, and training-free framework that combines the strengths of image-text models and SAM2 to generate powerful text-aligned region tokens. These tokens enable detailed visual understanding while preserving open-vocabulary capabilities. They can be directly applied to various downstream tasks, including open-world semantic segmentation, referring expression comprehension, and grounding. We conduct extensive evaluations and consistently achieve superior or competitive performance compared to state-of-the-art training-free methods. Additionally, our framework is compatible with many image-text models, making it highly practical and easily extensible as stronger models emerge. Code is available at: https://github.com/avaxiao/TextRegion.
BibTeX
@article{xiao2025textregion,
  author = {Yao Xiao and Qiqian Fu and Heyi Tao and Yuqun Wu and Zhen Zhu and Derek Hoiem},
  title = {{TextRegion: Text-Aligned Region Tokens from Frozen Image-Text Models}},
  journal = {Accepted by TMLR},
  year = {2025},
  url = {https://openreview.net/forum?id=KZLmkL62M4},
}
Figure