SDVPT: Semantic-Driven Visual Prompt Tuning for Open-world Object Counting

Yiming Zhao, Guorong Li, Laiyun Qing, Amin Beheshti, Jian Yang, Quan Z. Sheng, Yuankai Qi, Qingming Huang

Abstract

Open-world object counting requires models to identify and count arbitrary objects based solely on a textual query. While pre-trained Vision-Language Models (VLMs) like CLIP provide a strong foundation for general text-image alignment, they often struggle with the dense spatial reasoning required for counting. Traditional fine-tuning improves accuracy on known categories but significantly degrades performance on "unseen" categories due to overfitting. We introduce Semantic-Driven Visual Prompt Tuning (SDVPT), a plug-and-play framework that preserves the VLM's generalization by aligning the topology of visual prompts with the semantic structure of text embeddings. SDVPT enables dynamic prompt synthesis for novel categories, achieving state-of-the-art results on the FSC-147 benchmark with only an 8% increase in tunable parameters.

Introduction: The Challenge of Open-World Counting

Object counting has transitioned from category-specific models (e.g., crowd or vehicle counters) to class-agnostic "few-shot" models. The current goal is open-world counting, where a user provides a text prompt (e.g., "tomatoes"), and the model locates and counts the instances.

However, a significant hurdle remains: the trade-off between specialization and generalization. As shown in Figure 2, naive fine-tuning strategies allow a model to perform exceptionally well on categories seen during training (like "tomato" or "fish"). Yet, when presented with an unseen category like "bird," the model's performance collapses, failing to leverage the broad knowledge inherent in the original VLM.

Naive fine-tuning strategies often lead to poor performance on unseen categories, as the model overfits to training data.

Methodology: Semantic-Driven Visual Prompt Tuning

To address this, SDVPT employs a two-stage visual prompt tuning strategy that bridges the gap between training and inference.

1. Category-Specific Prompt Initialization (CSPI)

In the learning phase, the model initializes a unique visual prompt—a set of learnable vectors—for each category in the training set. These prompts guide the frozen image encoder to focus on features relevant to counting specific object types.

2. Topology-Guided Prompt Refinement (TGPR)

The core innovation of SDVPT is TGPR. Rather than treating prompts as independent entities, TGPR ensures that the relationships (topology) between visual prompts mirror the relationships between their corresponding text embeddings. For instance, if the text embeddings for "orange" and "tangerine" are close in the semantic space, their visual prompts are constrained to be similarly related. This distills the structural knowledge of the VLM’s text encoder into the visual prompt space.

3. Dynamic Inference for Unseen Categories

During inference, when the model encounters a novel category (e.g., "birds"), it lacks a pre-trained prompt. SDVPT solves this by calculating the similarity between the unseen text embedding and the embeddings of known training categories. It then dynamically synthesizes a visual prompt by aggregating the learned prompts of the most semantically similar categories.

The SDVPT framework consists of Learning (CSPI and TGPR) and Inference stages to enable dynamic prompt synthesis.

Experimental Results

The researchers evaluated SDVPT across three major benchmarks: FSC-147, CARPK, and PUCPR+.

  • State-of-the-Art Performance: Integrated with the CountGD model, SDVPT achieved a 15.53% improvement in Mean Absolute Error (MAE) on the FSC-147 validation set and an 18.27% improvement on the test set.
  • Cross-Dataset Generalization: When trained on FSC-147 and tested on vehicle datasets (CARPK/PUCPR+), SDVPT showed an average MAE improvement of approximately 11%, demonstrating robust generalization.
  • Efficiency: SDVPT is highly efficient, requiring only a small set of tunable prompt vectors. This results in a minimal parameter increase (~8%) and negligible impact on inference speed (~5%).

Conclusion and Future Work

SDVPT demonstrates that aligning visual prompts with the semantic topology of VLMs is an effective way to maintain generalization in open-world tasks. While highly effective, the model can still face challenges when categories are semantically similar but visually distinct (e.g., "eggs" vs. "crab cakes"). Future research will explore tuning the text encoder to improve semantic separability, further enhancing the model's precision in complex, cluttered scenes.

Summary updated

BibTeX
@inproceedings{zhao2025sdvpt,
  author = {Yiming Zhao and Guorong Li and Laiyun Qing and Amin Beheshti and Jian Yang and Quan Z. Sheng and Yuankai Qi and Qingming Huang},
  title = {{SDVPT: Semantic-Driven Visual Prompt Tuning for Open-world Object Counting}},
  booktitle = {ACM Multimedia},
  year = {2025},
  doi = {10.1145/3746027.3754581},
}
Figure