In-Context Adaptation of VLMs for Few-Shot Cell Detection in Optical Microscopy

Shreyan Ganguly  ·  Angona Biswas  ·  Jaydeep Rade  ·  Md Hasibul Hasan Hasib  ·  Nabila Masud  ·  Nitish Singla  ·  Abhipsa Dash  ·  Ushashi Bhattacharjee  ·  Aditya Balu  ·  Anwesha Sarkar  ·  Adarsh Krishnamurthy  ·  Soumik Sarkar

Iowa State University, Ames, Iowa, USA

Abstract
Foundation vision–language models (VLMs) excel on natural images, but their utility for biomedical microscopy remains underexplored. In this paper, we investigate how in-context learning enables state-of-the-art VLMs to perform few-shot object detection when large annotated datasets are unavailable, as is often the case with microscopic images. We introduce the Micro-OD benchmark, a curated collection of 252 images specifically curated for in-context learning, with bounding-box annotations spanning 11 cell types across four sources, including two in-lab expert-annotated sets. We systematically evaluate eight VLMs under few-shot conditions and compare variants with and without implicit test-time reasoning tokens. We further implement a hybrid Few-Shot Object Detection (FSOD) pipeline that combines a detection head with a VLM-based few-shot classifier, which enhances the few-shot performance of recent VLMs on our benchmark. Across datasets, we observe that zero-shot performance is weak due to the domain gap; however, few-shot support consistently improves detection, with marginal gains achieved after six shots. We observe that some reasoning variant models show task-specific gains, but the effect varies across models and settings. Our results highlight in-context adaptation as a practical path for microscopy, and our benchmark provides a reproducible testbed for advancing open-vocabulary detection in biomedical imaging.
5×

Improvement in mF1 score over the best zero-shot baseline via the cascaded FSOD pipeline

8

State-of-the-art VLMs evaluated under zero-shot and few-shot (K=1,3,6) conditions

0.30

Top mF1 score achieved by the GPT-4o cascaded pipeline at K=6

5,551

Annotated cells across 11 types — a few-shot eval suite for microscopy VLMs

Method

Experimental Configurations

We evaluate four prompt configurations — from pure text zero-shot to a cascaded SAM + VLM classifier — across eight models on the Micro-OD benchmark.

Four experimental configurations: Zero-Shot-T, Few-Shot-V, Few-Shot-MMD, Few-Shot-MMC

Zero-Shot-T uses text only. Few-Shot-V adds visual crops. Few-Shot-MMD combines both for end-to-end detection. Few-Shot-MMC decouples localization (SAM) from classification (VLM) — the strongest overall configuration.

Benchmark

Micro-OD

A curated benchmark for few-shot object detection specifically designed for microscopy. Unlike prior benchmarks that sample broadly from dissimilar classes, Micro-OD targets fine-grained visual localization where cell types share high semantic and morphological similarity.

252 Total images
11 Cell types
5,551 Annotated cells

BCCD — Blood Cell Count

364 slides · Bright-field · 3 classes

Platelets, Red Blood Cells, and White Blood Cells. A well-established benchmark with bounding-box annotations for all three categories.

BBBC — Malaria (P. Vivax)

1,328 slides · Bright-field · 6 classes

Thin blood smears annotated across parasitic stages: Gametocyte, Ring, Schizont, Trophozoite, RBCs, and WBCs. Tests fine-grained class separation.

LIVECell — Rat C6 Glioma

456 slides · Phase-contrast · 3 classes

Re-annotated into morphological categories: Polygonal, Round, and Spindle cells. Irregular and heterogeneous morphologies test shape-based generalization.

NIH-3T3 — Fibroblast (In-Lab)

63 slides · Phase-contrast · 3 classes

Expert-annotated in-lab collection from Iowa State's BACM lab. Imaged via AFM-mounted cameras at 20× zoom with two resolutions.

Sample detections

BCCD detections
BCCD Bright-field · Platelets, RBC, WBC
BBBC detections
BBBC Bright-field · Malaria parasitic stages

Splits are generated via a two-phase Integer Linear Programme (ILP) over 1,000 shuffled seeds, optimizing for class diversity (CPC) and balance (CBE). Final split achieves an SSS of 0.74.

Results

Detection Performance

mF1 is averaged over IoU thresholds 0.05–0.70; Mean IoU is computed over true positives at IoU=0.5.

Zero-Shot Baselines

Model mF1 ↑ Mean IoU ↑
Grounding DINO0.040.53
OWL-ViT0.030.40
Gemini-2.5-Flash0.050.57
Gemini-2.5-Flash-Thinking0.060.59
Claude-3.7-Sonnet0.030.34
Claude-3.7-Sonnet-Thinking0.030.31

Few-Shot Results (mF1)

Model K=1 K=3 K=6 Mean IoU (K=6)
Few-Shot-V (Visual only)
OWL-ViT0.080.120.170.81
Few-Shot-MMD (Multi-modal detection)
GPT-4o0.050.060.070.53
GPT-50.070.080.090.57
Gemini-2.5-Flash0.050.070.070.55
Gemini-2.5-Flash-Thinking0.190.220.230.77
Claude-3.7-Sonnet0.040.040.050.44
Claude-3.7-Sonnet-Thinking0.050.060.070.47
Few-Shot-MMC (Cascaded: SAM + VLM classifier) ★ Best overall
GPT-4o0.240.270.290.82
GPT-50.260.270.280.78
Gemini-2.5-Flash0.210.210.220.79
Gemini-2.5-Flash-Thinking0.160.180.170.56
Claude-3.7-Sonnet0.100.140.130.79
Claude-3.7-Sonnet-Thinking0.090.150.160.79
◈

Cascaded pipeline is useful. Decoupling localization (SAM) from classification (VLM) substantially outperforms end-to-end detection across all models — peak mF1 of 0.30 vs 0.23 for the best end-to-end method.

◈

Zero-shot is insufficient. All models show weak zero-shot performance (mF1 ≤ 0.06) due to the significant domain gap between web-scale pretraining and microscopy imagery.

◈

"Thinking" tokens are task-dependent. Gemini-2.5-Flash-Thinking excels at end-to-end detection, but non-thinking models are often stronger for cascaded classification — reasoning helps complex localization, not fine-grained categorization.

Citation

BibTeX

If you find this work useful, please cite:

Ganguly S, Biswas A, Rade J, Hasib MHH, Masud N, Singla N, Dash A, Bhattacharjee U, Sarkar S, Balu A, Sarkar A and Krishnamurthy A (2026) In-context adaptation of VLMs for few-shot cell detection in optical microscopy. Front. Artif. Intell. 9:1761903. doi: 10.3389/frai.2026.1761903