PIN: Positional Insert Unlocks Object Localisation Abilities in VLMs

Michael Dorkenwald, Nimrod Barazani, Cees G. M. Snoek, Yuki M. AsanoCVPR 2024

Abstract

Vision-Language Models (VLMs), such as Flamingo and GPT-4V, have shown immense potential by integrating large language models with vision systems. Nevertheless, these models face challenges in the fundamental computer vision task of object localisation, due to their training on multimodal data containing mostly captions without explicit spatial grounding. While it is possible to construct custom, supervised training pipelines with bounding box annotations that integrate with VLMs, these result in specialized and hard-to-scale models. In this paper, we aim to explore the limits of caption-based VLMs and instead propose to tackle the challenge in a simpler manner by i) keeping the weights of a caption-based VLM frozen and ii) not using any supervised detection data. To this end, we introduce an input-agnostic Positional Insert (PIN), a learnable spatial prompt, containing a minimal set of parameters that are slid inside the frozen VLM, unlocking object localisation capabilities. Our PIN module is trained with a simple next-token prediction task on synthetic data without requiring the introduction of new output heads. Our experiments demonstrate strong zero-shot localisation performances on a variety of images, including Pascal VOC, COCO, LVIS, and diverse images like paintings or cartoons.

Introduction

While modern Vision-Language Models (VLMs) can describe the contents of an image with impressive fluency, they are often "spatially blind." This limitation arises because they are primarily trained on web-scale image-caption pairs, which describe what is in an image but rarely where those objects are located.

To grant these models the ability to output bounding boxes, researchers typically rely on heavy supervised fine-tuning on massive, human-annotated detection datasets. However, this process is computationally expensive and often results in specialized models that lose their general-purpose flexibility. The Positional Insert (PIN) approach addresses this by teaching a frozen VLM to locate objects without using any real-world supervised detection data.

The PIN Architecture

PIN is a tiny "plug-in" module designed to infuse spatial awareness directly into the model's vision encoder. The architecture is built on two main components:

  1. Spatial Prompting: PIN starts with fixed 1D sinusoidal positional embeddings, a standard method for representing coordinates in Transformers. These are passed through a shallow, two-layer Multi-Layer Perceptron (MLP), denoted as $\psi$.
  2. Integration: The resulting learned spatial prompt is added to the vision encoder's output features before they are processed by the rest of the VLM.

PIN is remarkably parameter-efficient. For a 3-billion parameter model like OpenFlamingo, PIN adds only 1.2 million parameters—roughly 0.04% of the total model size. By keeping the VLM weights frozen, the model retains its original reasoning and conversational abilities, preventing the "catastrophic forgetting" often seen in full fine-tuning.

Synthetic Training Strategy

Instead of using expensive human-labeled datasets like COCO, the authors developed a synthetic pipeline to teach the concept of localization:

  • Data Generation: Using Stable Diffusion, the authors generated object images from the LVIS category list and "pasted" them onto random background images from the BG-20k dataset.
  • Automatic Ground Truth: Because the system knows exactly where it placed the object, it generates perfect bounding box labels automatically.
  • Training Objective: The model is trained using a simple next-token prediction task. Given an image and a text prompt like "In the image is a [object] located at", the model learns to predict the text coordinates (e.g., [x_min, y_min, x_max, y_max]).

Experimental Results

The authors evaluated PIN's zero-shot performance on standard benchmarks including Pascal VOC (PVOC), COCO, LVIS, and RefCOCO.

  • Localization Gains: On the COCO dataset, the base OpenFlamingo model has 0 mIoU (it cannot output boxes). While 10-shot in-context learning only reaches 0.09 mIoU, PIN achieves 0.35 mIoU zero-shot.
  • Comparison to PEFT: PIN outperformed other Parameter-Efficient Fine-Tuning (PEFT) methods such as CoOp and Visual Prompt Tuning (VPT), suggesting that adding spatial information directly to vision features is more effective than adding learnable tokens to the language or vision inputs.
  • Referring Expression Grounding: On the RefCOCO "Test-A" split, PIN achieved a 26.4 [email protected] score, a significant improvement over the 3.7 score achieved by standard in-context learning.
  • Cross-Domain Robustness: Because it was not overfit to a specific photographic dataset, PIN performs well on diverse imagery, including paintings, sketches, and cartoons.

Discussion and Limitations

The results suggest that VLMs already possess latent spatial knowledge; PIN simply provides the "vocabulary" or coordinate system to express it. However, some challenges remain:

  • Instance Confusion: PIN struggles when multiple instances of the same object class appear (e.g., three different dogs), often drawing one large bounding box around all of them.
  • Resolution Constraints: The standard input resolution of 224x224 makes it difficult for the model to accurately locate tiny objects.
  • Complex Referrals: While PIN handles simple prompts well, it still struggles with complex spatial reasoning in text, such as "the lady in between the two players."

Future work may involve scaling the underlying Large Language Model (LLM) size or increasing input resolution to further refine these localization capabilities.

Summary updated

BibTeX
@inproceedings{dorkenwald2024pin,
  author = {Michael Dorkenwald and Nimrod Barazani and Cees G. M. Snoek and Yuki M. Asano},
  title = {{PIN: Positional Insert Unlocks Object Localisation Abilities in VLMs}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
  url = {https://openreview.net/forum?id=6oOb9uIip3},
}
Figure