DreamCount: Imagine Before You Count

HaoYuan Ma, Shuai Deng, Taolue Meng, Li Zhang, Daizong Liu, Jianjun Li, Jie Gao, Zhiyuan MaarXiv 2026

TL;DR

Ask an AI to count "sunglasses," and it might mistakenly count individual lenses; ask it to count camouflaged owls, and it might miss them entirely. DreamCount is a plug-and-play framework that solves this by teaching counting models to first imagine what the requested target should look like in the context of the scene, and then refine that mental prototype using local visual clues from the image itself. Without needing manual example bounding boxes at test time, it substantially slashes counting errors across existing models, especially in tricky visual domains.

What Problem Does This Paper Address?

Text-guided open-vocabulary object counting aims to count anything you can type into a text prompt—from "cashew nuts" to "cars"—without requiring human-drawn example boxes at inference time. While current models do well on clean, standard benchmarks, they suffer from a hidden flaw: a static text embedding doesn't always capture the target state needed for a specific image.

This mismatch breaks down along two dimensions:

  1. Target content (granularity ambiguity): Knowing a category isn't enough to know the intended counting unit. Ask a baseline model for "sunglasses," and it might count 143 lenses instead of 90 frames; ask for "traffic light lamps," and it might count 4 whole housings instead of 17 individual bulbs.
  2. Image-specific appearance: Generic text prompts don't tell a model what an object looks like under murky underwater lighting, heavy shadow, or natural camouflage.
Figure 1. Open in vocabulary, closed in state. (a) CountGD overcounts sunglasses (143 vs. 90) and undercounts traffic lamps (4 vs. 17), illustrating whole–part ambiguity. (b) DREAMCOUNT first generates a target state, then adapts it using localized visual evidence. (c) Diagnostic evaluation of DAVE [25] on FSC-147: refining the class-fixed exemplar reduces test MAE by 39.0%.

Methods

DreamCount is a model-agnostic "imagine-then-refine" pipeline that replaces the generic text embedding inside a host counting model (whether detection-, point-, or density-based). It works in two stages:

  • Latent Dream (Target-State Imagination): Instead of relying directly on raw text features, DreamCount generates three latent target prototypes starting from Gaussian noise. It uses conditional flow matching—a generative technique that learns to transport noise along a straight path toward real instance features (supervised during training using ground-truth boxes, which are never needed at test time). It conditions this flow on pooled text and global image features. Crucially, a technique called Lucid Guidance amplifies the text prompt's influence: similar to classifier-free guidance in diffusion models, it contrasts the text-conditioned flow velocity against a "null-text" velocity while keeping the global image context fixed in both branches.
  • Refine (Observe–Pool–Fuse): Global imagination still lacks fine, local instance details. In a training-free second step, the model runs a preliminary pass using the imagined prototypes to locate high-confidence candidate regions in the image (Observe). It extracts visual features from those regions (Pool) and matches them to the imagined slots via cosine similarity. Finally, it blends matched prototypes with actual local visual evidence—weighting 20% prior imagination and 80% observed image features (Fuse)—before making the final count prediction.
Overview of the DreamCount pipeline: Latent Dream generates prototypes via flow matching, and Refine updates them with local image features.

Datasets

All main plug-in models are trained exclusively on FSC-147 (a standard 147-category counting dataset) and evaluated zero-shot on CARPK (drone-view parking lots) and REC-8K (referring expression counting).

To stress-test target-state mismatches, the authors also introduce three new human-verified benchmarks (combining real photographs with synthetic images generated via GPT-Image2 for underrepresented cases):

  • PolyCount: 691 images with 1,382 paired whole–part queries on the exact same visual scene (e.g., "chocolate bars" vs. "pieces", "bicycles" vs. "wheels") to isolate granularity switching.
  • WaterCount: 1,007 image–query pairs across 10 underwater categories featuring turbidity, backscatter, and color attenuation.
  • CamoCount: 538 scenes across 81 categories where targets blend seamlessly into their backgrounds.
Figure 2. Examples from the three proposed benchmarks. POLY- COUNT (left) pairs targets at two granularities within the same scene (e.g., whole bikes vs. wheels, chocolate bars vs. pieces); WATERCOUNT (middle) covers underwater optical degradation, in- cluding turbidity, backscatter, and color attenuation; CAMOCOUNT (right) contains targets that blend into their surroundings.

Key Insights and Ideas

  • Open in vocabulary, closed in state: The authors run a clever diagnostic showing that giving a model a random, fixed visual exemplar from the right category yields a high error (30.17 MAE on FSC-147), whereas adapting that exemplar to the specific test image drops error by 39% (to 18.39 MAE). Recognizing what an object is doesn't automatically calibrate how it appears in a scene.
  • Imagination and refinement are complementary: Ablation studies reveal a neat division of labor. Latent Dream does the heavy lifting on unit selection—shifting feature activations from lenses to whole sunglasses—while Refine anchors the prototypes to local textures, reversing outlier errors (RMSE) that pure imagination can introduce.
  • Keep the image in the null branch: In standard classifier-free guidance, you drop all conditioning. Lucid Guidance keeps the image context active in the null branch and only drops the text, cleanly isolating the exact counting unit requested by the user's words.
Feature activations shifting from individual lenses to whole sunglasses, alongside an LDA projection showing refined states landing right next to ground-truth targets.

Key Results

Tested across five open-vocabulary hosts (CountSE, CLIP-Count, CounTX, RT-Counter, and CountGD), DreamCount lowers Mean Absolute Error (MAE) across the board:

  • Standard & Zero-Shot Benchmarks: On FSC-147 Test, CountGD's MAE drops by 19.8% (12.63 to 10.13). In zero-shot transfer to CARPK, replacing CountSE's soft-exemplar module with DreamCount slashes MAE by 72.0% (from a reproduced baseline of 10.30 down to 2.88).
  • Granularity Shifts (PolyCount): Baseline models struggle mightily when asked to count "whole" objects rather than parts, scoring just 15.2%–28.4% on Granularity Switch Accuracy (GSA). DreamCount rockets GSA up to 76.8%–88.6% and cuts whole-query MAE by 55.7%–63.7% across all five hosts.
  • Camouflage & Underwater: On CamoCount, MAE drops by 53.9% for RT-Counter and 42.6% for CountSE. WaterCount sees consistent, though smaller, MAE reductions (0.9%–9.3%). On REC-8K, test MAE drops by 5.0% and 4.0% for GroundingREC and CAD-GD, respectively.

Limitations and Future Work

  • High absolute error on "whole" queries: Despite massive relative improvements on PolyCount Whole, absolute MAE remains high (11.85–18.30, whereas simply predicting zero every time would yield an MAE equal to the mean count of 3.76). Pinpointing whether this stems from persistent overcounting or outlier failures requires deeper per-prediction analysis.
  • Modest underwater gains & metric variance: Improvements on WaterCount are noticeably smaller than on granularity benchmarks, and non-flow generator baselines (like an MLP or multi-head network) occasionally beat flow matching on specific PolyCount metrics.
  • Reproduction gap: Due to environment/protocol differences, the authors' reproduced baseline for CountSE had higher error than CountSE's originally published numbers, preventing a direct leaderboard comparison. Future work will focus on more reliable unit adaptation and analyzing individual failure modes.

Summary updated

BibTeX
@misc{ma2026dreamcount,
  author = {HaoYuan Ma and Shuai Deng and Taolue Meng and Li Zhang and Daizong Liu and Jianjun Li and Jie Gao and Zhiyuan Ma},
  title = {{DreamCount: Imagine Before You Count}},
  year = {2026},
  eprint = {2611.39427},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.39427},
}
Figure