Text-Named Point Localization for Dense Microscopy

Counting objects in crowded images, such as heads in a stadium or cells under a microscope, has mostly been done by predicting a blurry "density map." The image is turned into a heat map whose total sums to the count. That gets the number right but erases where each object is, because touching blobs merge into one smear. Point-based methods fix this by predicting one coordinate per object and pairing predictions with annotated dots one-to-one. However, they are class-blind. They find "things," not "this kind of thing," and they must be retrained with thousands of hand-clicked dots for every new object type. This proposal asks whether a text description of the target, encoded by a language model pre-trained on biomedical literature, can tell a point-based localizer which objects to put points on. The aim is to keep exact coordinates while allowing transfer to cell types the localizer never saw labelled.

The practical opportunity is in scientific imaging. Labelling is expensive, the vocabulary of object types is open-ended, and a lab usually needs locations rather than only totals, for example to track cells or measure their spatial arrangement. If domain-pretrained text can stand in for most of the per-type dot annotation, a single localizer could serve many assays. If it cannot, and a learned class embedding does just as well, that negative result is itself worth knowing, because the field is currently moving toward vision-language counting without testing what the language contributes.

Core Claim

A point-based localizer can be conditioned on a text embedding of the target object type. Each candidate point's confidence is scored against that embedding, and training uses one-to-one matching to dot annotations. The claim has two parts, and the second is the important one. First, conditioning does not cost localization precision on objects the model was trained on. Second, when the text encoder comes from biomedical pre-training rather than general web text, the localizer transfers better to held-out cell types described only in words.

This differs from the closest existing work in specific ways. CrowdCLIP uses CLIP for annotation-free crowd counting through patch ranking, but it explicitly produces no coordinates and uses only general-domain text. CountGD lets text act as a filter over exemplars for open-world counting. It is built on a box detector with a ceiling of 900 queries, so congested scenes require tiling, and it never studies domain text. Our design replaces box queries with a dense grid of point proposals, which has no object ceiling, and makes the domain origin of the text encoder the experimental variable.

Research Program

The localizer reuses the structure of P2PNet. P2PNet places reference points on a grid over upsampled image features. A regression head predicts a coordinate offset from each reference point, a classification head predicts confidence, and Hungarian matching pairs predictions to ground-truth dots, so no Non-Maximum Suppression (the usual step of deleting overlapping duplicate detections) is needed. We change only the classification head. Instead of a fixed "object" logit, the confidence of a proposal at location $i$ is the scaled cosine similarity between a projected local visual feature $v_i$ and a projected text embedding $t$ of the prompt, such as "monocyte nucleus" or "adipocyte."

The matching cost combines this similarity with coordinate distance, as P2PNet does, so the optimizer is identical and only the source of the class signal differs. During training each image is paired with a prompt for its annotated type. Negative prompts naming other types in the training set teach the head to suppress points when the description does not match. The vision backbone stays the same across all conditions, and the text encoder is frozen. CrowdCLIP froze its text encoder for a similar reason, to avoid forgetting the pre-trained representations, and freezing also keeps the language contribution clean to measure.

The text encoders under comparison are three. One is a biomedical encoder pre-trained on PubMed and clinical notes, the BlueBERT-style model that BERTHop found gave a +6.46% AUC gain over general BERT for chest X-ray diagnosis. The second is a general BERT of the same size. The third is the CLIP text encoder. BERTHop motivates this work but does not settle the question, because it is pure classification and outputs no positions. It is possible that domain text helps the model recognize a diffuse texture and does nothing for placing points.

BioBART constrains the design in two ways. It kept the general tokenizer, which fragments compound technical terms, so we report results for both short canonical names and longer morphological descriptions such as "small round cell with a large dark nucleus." This lets us check whether the gain comes from vocabulary knowledge or from descriptive content. BioBART also found a performance gap between formal literature and informal text, which warns that literature-trained encoders may not align with how practitioners phrase prompts.

We also run a density variant. A text-conditioned density map is trained with the optimal-transport loss of DM-Count, which treats the predicted density and the dot annotations as two distributions and penalizes the work needed to move one onto the other. Points are then decoded with the training-free OT-M procedure, which repeatedly assigns density mass to points and moves each point to the centre of its assigned mass. This tests whether text conditioning is better placed in a direct point head or in a density head followed by decoding.

Baselines

The naive reference is a class-agnostic P2PNet trained on the pooled training cell types and applied to a held-out type with no prompt. It will count every cell-like blob. Language has to beat it on held-out-type localization F1, which is precision and recall of predicted points matched to dots within a fixed pixel radius, and on per-type MAE when images contain a distractor type. If text conditioning cannot beat a model that simply finds all cells, the language is not doing anything.

The strongest specialized baseline on the cell benchmarks is the decoupled counter-plus-localizer of Rethinking Cell Counting Methods. It reports relative MAE reductions of 63.6% on DCC and 36.4% on MBM over earlier methods. No absolute MAE and no localization F1 for these datasets were found on Lacuna, so we will rerun it ourselves. We train it with full supervision on each type, including the held-out one, which makes it an upper reference rather than a competitor in the transfer setting. Beating it is not required. The test is how much of the gap between the no-prompt baseline and this upper reference the text-conditioned model closes with zero or few labels for the new type.

On the open-world benchmarks the strongest method is CountGD. It reports a text-only MAE of 12.98 and a multimodal MAE of 5.74 on FSC-147, against 10.79 for LOCA, and a zero-shot MAE of 3.68 on CARPK. We compare against its text-only setting, since our model takes no box exemplars. Beating it means lower text-only MAE on the densest FSC-147 images, where its query ceiling forces tiling, without regressing on the full split.

For crowd localization the sanity references are P2PNet's reported MAE of 52.74 on ShanghaiTech Part A and F1 of 0.712 on NWPU-Crowd, and CAAPN's F1 of 82.8 on ShanghaiTech Part A. With a single fixed prompt, our model should match P2PNet within noise.

The ablation that isolates the key ingredient replaces the text embedding with alternatives of the same dimension. One is a learned per-class embedding, which cannot transfer to held-out classes and so bounds the in-distribution benefit. The second is a random fixed embedding. The third uses the three text encoders above. All variants share one backbone, data split, augmentation, schedule, and a matched hyperparameter search of equal trial count.

Why not just…?

Why not just train a multi-class P2PNet with one output head per cell type? On fixed classes it will likely match or beat text conditioning, and we expect it to. The learned-embedding ablation is effectively this model. The argument for language holds only for types absent from training. If the held-out-type F1 of the domain text model is no better than that of a class-agnostic detector, the proposal fails, and we will report it that way.

Why not just use CountGD or GroundingDINO with tiling? Tiling works around the 900-object ceiling but introduces double counting at tile borders, and the model still reasons over boxes. Dense, round, touching cells have poorly defined boxes, while dot annotations are what these datasets provide. The FSC-147 density-stratified comparison shows directly whether this matters. If CountGD with tiling matches us on the dense tail, the point-grid design adds little and the contribution reduces to the domain-text finding.

Why not just use the CLIP text encoder, which was trained to align with images? This is a real threat. CLIP's text space is already tied to visual features, while a PubMed encoder has never seen an image, so the domain encoder might know more about cells and still map worse onto them. BERTHop's evidence favours domain text but comes from classification. The three-way encoder comparison under a frozen encoder and an identical projection layer decides the question. A plausible outcome is that the CLIP text encoder wins on short names and the domain encoder wins on long morphological descriptions, and the prompt-style split is designed to detect exactly that.

Why not just fine-tune the text encoder with low-rank adapters instead of relying on domain pre-training? A Comparative Study of PEFT Methods for Python Code Generation found that domain pre-training predicted downstream performance more strongly than the choice of fine-tuning method, but that was code generation, not localization. We add an arm with a general BERT plus low-rank adapters, trained on the same prompts and labels. If this arm matches the domain encoder on held-out types, domain pre-training is unnecessary here.

Proposed Experiments

The decisive experiment is leave-one-type-out evaluation on the Dublin Cell Counting dataset. This dataset contains embryonic stem cells, lung adenocarcinoma cells, and monocytes. We train on all types but one and test on the held-out type with only its text prompt, then with 1%, 5%, and 10% of its labelled images. For each condition we report localization F1 at fixed pixel radii and MAE.

Because each DCC image contains a single type, the held-out test alone cannot show selective localization. We therefore also build composite test images by splicing tiles of two types and scoring per-prompt F1. This setup is artificial, and we label it as a probe of selectivity, not as a deployment benchmark.

MBM, ADI, and the synthetic fluorescence (VGG) set test in-distribution precision against the decoupled model. FSC-147 and CARPK test open-world counting against CountGD, with FSC-147 stratified by object count. ShanghaiTech Part A, UCF-QNRF, and NWPU-Crowd check that text conditioning costs nothing on crowds. Across these settings we compare the direct point head with the DM-Count-plus-OT-M density route, to learn where conditioning should sit.

The proposal succeeds only if two results hold together. The domain text encoder must beat both the random-embedding and general-text arms on held-out-type F1 by more than the spread across random seeds, and in-distribution localization must stay within noise of P2PNet. If only the CLIP arm transfers, the honest conclusion is that image-aligned text matters for localization and literature knowledge does not, and we will report that.