TL;DR
This paper introduces YOLO-Count, a novel differentiable object counting model that significantly improves the control of object quantities in text-to-image generation. By proposing a new "cardinality map" and a hybrid training strategy, YOLO-Count achieves state-of-the-art counting accuracy and enables precise, fine-grained control over generated image content.
What Problem Does This Paper Address?
Generating high-fidelity images from text descriptions has seen remarkable progress. However, a persistent challenge is accurately controlling the number of objects specified in a text prompt. While existing methods excel at controlling attributes or layout, precisely dictating object counts, especially for larger numbers, remains difficult. This is partly because object counting is a global constraint, unlike localized attributes, and the inherent stochasticity of diffusion models can lead to inconsistent object differentiation. Prior approaches often rely on detection-based methods that are non-differentiable, or regression-based methods using density maps that struggle with object scale variations and ambiguities.
Methods
The core of YOLO-Count is a differentiable, regression-based object counting model built upon the YOLO-World architecture. Key innovations include:
- Cardinality Map: Instead of traditional density maps (which place kernels at object centers), YOLO-Count uses a "cardinality map." This map uniformly distributes a value of 1 across all pixels belonging to an object instance, derived from object masks. This approach provides a more robust and unambiguous representation, less sensitive to object size and shape variations.
- Hybrid Strong-Weak Training: To overcome data limitations for training, YOLO-Count employs a two-stage strategy:
- Strong-Supervision Pretraining: Uses large-scale instance segmentation datasets (like LVIS) to learn precise pixel-level supervision for both cardinality regression and category classification.
- Weak-Supervision Finetuning: Adapts the model to sparse point-level annotations from counting datasets (like FSC147). This stage incorporates total count consistency and uses a mixture of LVIS and FSC147 data to maintain open-vocabulary capabilities.
- Representation Alignment: A classification head, trained with contrastive supervision, aligns visual and textual representations. This helps the model effectively localize instances of the specified category, crucial for open-vocabulary counting.
- Differentiable Guidance for T2I: YOLO-Count is integrated into text-to-image pipelines (specifically SDXL-Turbo) as a differentiable guidance module. Gradient signals from the counting model are used to steer the generation process towards the desired object count, often by optimizing a special "count token" in the text embedding.
Datasets
- Training: LVIS v1.0 (for strong-supervision pretraining), FSC147 (for weak-supervision finetuning).
- Evaluation: FSC147 (seen and unseen categories), LVIS (seen categories), OpenImages V7, Objects365.
- New Benchmarks: OpenImg7-New and Obj365-New were constructed from OpenImages V7 and Objects365 by filtering for novel categories to specifically evaluate open-vocabulary generalization.
- T2I Control Benchmarks: LargeGen (using FSC147 categories) and LargeGen-New (using Obj365-New and OpenImg7-New) were created to evaluate quantity control for both seen and novel categories.
Key Insights and Ideas
- Cardinality Maps are Superior to Density Maps: The paper convincingly demonstrates that the proposed cardinality map offers a more stable and accurate representation for object counting, especially when dealing with diverse object sizes and shapes, by avoiding the ambiguities inherent in density map kernels.
- Hybrid Training is Crucial for Generalization: Combining strong supervision from instance segmentation datasets with weak supervision from counting datasets is essential for achieving both high accuracy and robust open-vocabulary generalization. This strategy effectively leverages available data while mitigating domain gaps.
- Differentiability is Key for T2I Control: The core contribution to T2I generation lies in YOLO-Count's differentiability. This allows for direct gradient-based feedback to guide the diffusion model, enabling precise control over object counts, a capability lacking in many previous methods.
- Open-Vocabulary Counting is Achievable and Necessary: The work highlights that achieving accurate counting across a wide range of unseen categories is feasible with the proposed methods, which is critical for practical text-to-image applications.
Key Results
- Object Counting Accuracy: YOLO-Count achieves state-of-the-art performance on various benchmarks, including FSC147 and LVIS. It outperforms existing non-differentiable and differentiable counting models, particularly in open-vocabulary settings. For example, on the challenging OImg7-New benchmark, it achieves an MAE of 3.53 and RMSE of 10.61.
- T2I Quantity Control: YOLO-Count significantly improves the accuracy of object quantity control in text-to-image generation. Compared to baselines like CountGD and CLIP-Count, YOLO-Count substantially reduces the discrepancy between requested and generated object counts, especially for larger quantities (e.g., 25, 50, 75, 100). Qualitative examples show much more accurate object counts in generated images.
- Robustness to Scale: Ablation studies and experiments (Fig. 8) show that YOLO-Count, using cardinality maps, is robust to variations in object scale, unlike density-based methods which exhibit significant size bias.
Limitations and Future Work
- Computational Overhead: While YOLO-Count is efficient, integrating it into T2I generation still involves iterative optimization steps, which can increase generation time. The paper mentions using single-step inference for SDXL-Turbo to balance quality and efficiency.
- Dataset Limitations: The paper notes that existing counting datasets can be limited in scale and category diversity, necessitating the creation of new benchmarks for robust evaluation.
- Future Work: The authors suggest that their framework can be extended to other controllable generation tasks beyond object counting. The success in achieving precise control over object quantities opens avenues for more nuanced and detailed control over generated content in multimodal AI systems.
Summary updated