Abstract
The computer vision field has long grappled with a trade-off between localization and recognition. While models like the Segment Anything Model (SAM) excel at finding object boundaries, they lack semantic understanding. Conversely, models like CLIP possess vast conceptual knowledge but struggle with precise spatial localization. This paper introduces Tokenize Anything via Prompting (TAP), a unified foundation model designed to bridge this gap. By upgrading the SAM architecture with a novel "semantic token" and training on the massive SemanticSA-1B dataset, TAP enables simultaneous segmentation, recognition, and captioning of any image region based on flexible visual prompts.
Introduction
Current visual perception models typically specialize in one of two domains: localization ("where is it?") or recognition ("what is it?"). SAM represents the state-of-the-art in localization, yet it is class-agnostic, treating objects as generic masks. CLIP, the standard for recognition, understands millions of concepts but operates primarily at the image level, making region-specific analysis computationally expensive and architecturally awkward.
TAP addresses these limitations by integrating semantic intelligence directly into a promptable segmentation framework. It allows users to define regions of interest using points, boxes, or sketches and receive high-fidelity masks, category labels, and descriptive captions in return.
Methodology: The Promptable Tokenizer
The core innovation of TAP lies in its architecture, which treats image regions as discrete tokens that can be processed similarly to words in natural language processing.
The Semantic Token [S]
In the standard SAM decoder, mask tokens are used to predict object geometry. TAP introduces a dedicated semantic token [S] for every predicted mask. This token is tasked with capturing the semantic essence of the region, effectively "tokenizing" the visual content.
Concept Alignment and Captioning
To imbue these tokens with meaning without requiring impossible amounts of human-labeled data, the researchers employed Knowledge Distillation. They used a 5-billion parameter EVA-CLIP model as a teacher to predict concept distributions for over a billion image regions. TAP is trained to match these distributions using a KL-divergence loss.
For text generation, the model utilizes a lightweight 38M-parameter causal text decoder. Because the semantic tokens are already highly informative, this small decoder can generate sophisticated captions, often outperforming much larger multi-modal models in region-specific tasks.
Data: SemanticSA-1B
The model's performance is underpinned by SemanticSA-1B, a newly curated dataset. It builds upon the 1.1 billion masks of the original SA-1B dataset by augmenting each mask with a concept distribution derived from EVA-CLIP. This distribution covers 2,560 distinct categories, encompassing both objects ("things") and background elements ("stuff").
Key Results and Performance
TAP demonstrates that semantic enrichment does not come at the cost of spatial precision. Key benchmarks include:
- Region Captioning: On the Visual Genome benchmark, TAP achieved a record CIDEr score of 164.7, surpassing larger models like Grit and ASM.
- Zero-Shot Classification: On the LVIS dataset, the TAP-L variant reached 59.1 AP, significantly outperforming previous region-level models such as RegionCLIP (50.7 AP).
- Segmentation Precision: TAP maintains SAM-level performance, achieving approximately 43 AP on COCO, proving that the addition of semantic tasks does not degrade localization accuracy.
Conclusion
Tokenize Anything via Prompting (TAP) represents a significant step toward a generalist visual perception system. By treating regions as tokens and leveraging large-scale distillation, TAP provides a scalable, efficient framework for understanding the "what" and "where" of visual data simultaneously. Future work will focus on refining mask selection heuristics and expanding the model's open-world vocabulary beyond the current concept list.
Summary updated