Abstract
We introduce FlexCap, a vision-language model that generates region-specific descriptions of varying lengths. FlexCap is trained to produce length-conditioned captions for input boxes, enabling control over information density, with descriptions ranging from concise object labels to detailed captions. To achieve this, we create large-scale training datasets of image region descriptions with varying lengths from captioned web images. We demonstrate FlexCap's effectiveness in several applications: first, it achieves strong performance in dense captioning tasks on the Visual Genome dataset. Second, we show how FlexCap's localized descriptions can serve as input to a large language model to create a visual question answering (VQA) system, achieving state-of-the-art zero-shot performance on multiple VQA benchmarks. Our experiments illustrate FlexCap's utility for tasks including image labeling, object attribute recognition, and visual dialog.
Introduction
Traditional computer vision models often force a choice between holistic image captioning and sparse object detection. While the former provides a broad summary, it frequently misses fine-grained details. Conversely, object detectors provide localization but lack the descriptive depth to capture complex attributes or interactions. This "granularity gap" limits the utility of vision models in scenarios requiring specific levels of information density.
FlexCap addresses this challenge by introducing a vision-language model capable of generating region-specific descriptions with user-defined lengths. By making caption length a controllable input parameter, FlexCap can produce anything from a single-word object label to a detailed multi-sentence description for any given bounding box.
Methods and Architecture
The FlexCap architecture is designed for simplicity and scalability. It consists of three primary components:
- Image Encoder: A pre-trained SOViT-400M model extracts high-level visual features from the input image.
- Bounding Box Projection: The coordinates of the target region are passed through a linear layer to provide the model with spatial context.
- Length-Conditioned Text Decoder: A Transformer-based decoder generates the caption. Crucially, the model is conditioned on a "length token" (e.g.,
LENGTH-5) during both training and inference. This forces the decoder to pack the most relevant information into a specific word count.
This length conditioning acts as a powerful regularizer, preventing "prefix matching" issues where a model might confuse a short label with the start of a longer sentence. It allows for precise control over the output's verbosity.
Large-Scale Data Generation
Training such a flexible model requires a dataset of image regions paired with descriptions of varying lengths—a resource that does not exist at scale in human-annotated form. To overcome this, the authors developed an automated pipeline to extract 32 billion image-box-caption triplets from web-scale data (WebLI and YFCC100M).
The pipeline uses an n-gram extractor on existing web captions and an open-vocabulary detector (OWL-ViT) to associate specific text fragments with corresponding image regions. This massive, diverse dataset enables FlexCap to learn a wide-ranging vocabulary and complex descriptive capabilities.
Results and Applications
FlexCap demonstrates state-of-the-art performance across multiple benchmarks. In dense captioning tasks on the Visual Genome dataset, it outperforms previous models like GRiT, particularly for small and medium-sized objects.
Beyond direct captioning, FlexCap serves as a powerful "visual-to-text" bridge for Large Language Models (LLMs). By describing various regions of an image in detail, FlexCap creates a "textual scene graph" that a text-only LLM can use to reason about complex visual questions. This "Localize-then-Describe" pipeline achieved state-of-the-art zero-shot performance on the OKVQA benchmark (52.1%), surpassing much larger multimodal models.
Conclusion
FlexCap represents a significant advancement in controllable image understanding. By providing a "dial" for descriptive detail, it enables more nuanced interaction with visual data. While the multi-stage VQA pipeline introduces some latency compared to end-to-end models, the ability to leverage the reasoning power of pure-text LLMs through high-quality localized descriptions offers a robust path forward for complex visual reasoning tasks. Future work may involve more explicit training on specific object attributes to further enhance the model's utility in specialized domains.
Summary updated