Tune-an-Ellipse: CLIP Has Potential to Find what you Want

Jinheng Xie, Songhe Deng, Bing Li, Haozhe Liu, Yawen Huang, Yefeng Zheng, Jürgen Schmidhuber, Bernard Ghanem, Linlin Shen, Mike Zheng Shou

Abstract

Referring Expression Comprehension (REC) typically relies on pre-trained object detectors, which limits localization to a fixed set of categories. We present Tune-An-Ellipse, a "Differentiable Visual Prompting" framework that leverages CLIP's inherent open-world vocabulary for zero-shot object localization. By iteratively optimizing the parameters of a red ellipse—center, axes, and rotation—using a combination of CLIP similarity and Grad-CAM-based losses, our method "finds" objects described in natural language without any bounding box supervision.

Introduction

The task of Referring Expression Comprehension (REC) involves locating a specific object in an image based on a natural language description (e.g., "the cat looking at us"). Traditional approaches utilize a two-stage pipeline: a pre-trained detector (such as Faster R-CNN) generates object proposals, and a vision-language model like CLIP selects the best match. However, this creates a significant bottleneck: the system is blind to any object not present in the detector's training set.

While CLIP possesses a massive, open-world vocabulary, it is primarily a global image-text matcher rather than a localizer. Recent findings suggest that drawing a red circle around an object can bias CLIP's attention toward that region—a phenomenon likely learned from human-annotated images on the web. Tune-An-Ellipse automates this process, transforming visual prompting into a precise, differentiable optimization problem.

Methods

The core of our approach is Differentiable Visual Prompting, which represents a visual prompt as a rotated ellipse.

Differentiable Ellipse Representation

To enable gradient-based optimization, we approximate the ellipse's edge using a Gaussian distribution and its interior mask using a modulated inverse tangent function. This allows the model to compute how infinitesimal changes in the ellipse's shape (center $x, y$, axes $a, b$, and rotation $\theta$) affect the final CLIP similarity score.

Optimization Pipeline

  1. Initialization: A grid of "anchor ellipses" is scattered across the image. The best starting point is selected based on a combination of CLIP scores and Grad-CAM activation maps.
  2. Tuning Loop: A small MLP takes learnable tokens and predicts transformations for the ellipse parameters.
  3. Loss Functions: The optimization is guided by a three-part loss:
  4. Matching Loss ($L_{sim}$): Maximizes the CLIP similarity between the prompted image and the target text.
  5. Inflation Loss ($L_{inf}$): Uses Grad-CAM to encourage the ellipse to expand and cover relevant object regions.
  6. Squeezing Loss ($L_{sqz}$): Acts as a regularizer, preventing the ellipse from becoming excessively large by encouraging a compact fit around the activation area.
The model evaluates various ellipse prompts to find the one that maximizes the CLIP score for the query "the snail on the top".

Key Results and Insights

We evaluated Tune-An-Ellipse on standard REC benchmarks, including RefCOCO, RefCOCO+, and RefCOCOg.

Performance Gains

The impact of the tuning process is substantial. On the RefCOCO testA set, using raw, untuned anchor ellipses (P-Ellipses) resulted in a meager 6.56% accuracy. After applying the Tune-An-Ellipse optimization loop, accuracy increased significantly to 32.3%. While this zero-shot performance still trails behind supervised methods using high-quality detectors (which typically achieve 50-60%), it represents a major advancement for detector-free, open-vocabulary localization.

Comparison of different ellipse prompts for the expression "cat looking at us," showing how the model distinguishes between the actual cat and its reflection.

Qualitative Success

Visualizations demonstrate the model's ability to "shrink" or "stretch" a generic circle into a tight ellipse that encapsulates complex entities, such as specific people in a crowd or small objects like snails. The method successfully leverages CLIP's "highlighting" bias—the implicit understanding that a red circle denotes the primary subject of interest.

Discussion and Limitations

Despite its success, the method faces challenges inherent to CLIP's architecture:

  • Background Interference: Vague prompts (e.g., "the big one") can lead CLIP to assign high scores to red circles on empty backgrounds like sky or grass.
  • Partial Inclusion: CLIP is often satisfied by prompts covering only discriminative parts of an object (e.g., a giraffe's head), making it hard to get a perfect bounding box.
  • Sub-word Sensitivity: The model may focus on a single noun in a complex phrase (e.g., "hat" in "man with a hat") rather than the entire referred entity.

Conclusion

Tune-An-Ellipse demonstrates that CLIP's global matching capabilities can be repurposed for localizing objects through automated visual prompting. By making the prompt differentiable, we bypass the need for fixed-category detectors, opening the door for truly open-world spatial reasoning in vision-language models. Future work involving the explicit training of models on visual prompts could further enhance this spatial understanding.

Summary updated

BibTeX
@inproceedings{xie2024tune,
  author = {Jinheng Xie and Songhe Deng and Bing Li and Haozhe Liu and Yawen Huang and Yefeng Zheng and Jürgen Schmidhuber and Bernard Ghanem and Linlin Shen and Mike Zheng Shou},
  title = {{Tune-an-Ellipse: CLIP Has Potential to Find what you Want}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
  doi = {10.1109/cvpr52733.2024.01302},
}
Figure