PerSense: Personalized Instance Segmentation in Dense Images

Muhammad Ibraheem Siddiqui, Muhammad Umer Sheikh, Hassan Abid, Muhammad Haris Khan · Submission to ICLR 2025 · Rejected

TL;DR

PerSense is a training-free, model-agnostic framework designed for one-shot personalized instance segmentation in crowded scenes. By bridging density estimation models with the Segment Anything Model (SAM), PerSense automatically transforms continuous density maps into precise, instance-level point prompts. On the newly introduced PerSense-D benchmark, it achieves 71.61% mIoU, outperforming methods like Grounded-SAM and PerSAM by substantial margins while running in just 2.7 seconds per image.

What Problem Does This Paper Address?

Vision foundation models like SAM have transformed interactive segmentation, but they lack semantic awareness: SAM either segments everything indiscriminately ("everything mode") or relies on manual user clicks/boxes. In industrial and biological settings (e.g., automated sorting of agricultural produce, counting cargo, or segmenting dense cells), users need personalized instance segmentation—automatically delineating every instance of a specific target class given only a single reference image (one-shot).

Existing automated workarounds fail in dense environments:

  • Bounding box detectors (e.g., Grounded-SAM): Suffer from severe overlap, anchor alignment limits, and Non-Maximum Suppression (NMS) merging multiple adjacent instances into one box.
  • Iterative point prompters (e.g., PerSAM): Segment objects sequentially, which causes inference times to explode in dense images (scaling linearly with instance count) and leads to premature stopping as confidence maps degrade.
  • Feature matching (e.g., Matcher): Struggles with clustering and fine-grained correspondence under severe occlusions.

Methods

PerSense is a training-free, one-shot pipeline connecting open-source vision-language models, visual density estimators, and SAM.

Support Image + Mask
       │
       ▼
[Class-Label Extractor (CLE)]  ──► Extracts object noun (e.g., "all potatoes")
       │
       ▼
[GroundingDINO + SAM Prior]    ──► Selects best initial exemplar bounding box
       │
       ▼
[Density Map Generator (DMG)]  ──► Generates continuous spatial density map
       │
       ▼
[Instance Detection Module]     ──► Binarizes DM, decomposes composite blobs via
                                    distance transform, and extracts centroids
       │
       ▼
[Point Prompt Selection]        ──► Filters false positives via density-adaptive threshold
       │
       ▼
[SAM Decoder Segmentation]      ──► Generates instance masks
       │
       ▼
[Feedback Mechanism (1 pass)]  ──► Selects top-4 high-confidence masks as refined
                                    exemplars, re-running DMG once for final output

Key technical components include:

  1. Exemplar Initialization via CLE: A multimodal LLM (VIP-LLaVA) inspects the masked support object to infer the semantic label. GroundingDINO detects potential candidates, and the candidate with highest feature cosine similarity to the support token is segmented to create a clean visual exemplar.
  2. Density Map Generation (DMG): Instead of relying on discrete bounding boxes, an off-the-shelf few-shot counting model (CounTR or DSALVANet) generates a continuous density map of the target class.
  3. Instance Detection Module (IDM): To convert density heatmaps into discrete point prompts:
  4. The map is binarized and eroded to remove background noise.
  5. For clumped/merged instances, IDM flags "composite contours" exceeding $\mu + 2\sigma$ in contour area distribution.
  6. A distance transform is applied to composite contours to expose internal local maxima ("child contours").
  7. Spatial centroids are computed for each isolated component.
  8. Point Prompt Selection Module (PPSM): Filters false-positive point prompts using an adaptive similarity threshold: $$\text{Threshold} = \frac{S_{\max} \cdot \sqrt{2}}{C}$$ where $S_{\max}$ is the peak cosine similarity and $C$ is the estimated object count. As density increases, the threshold automatically relaxes to account for wider intra-class appearance variances. Prompts must also fall within coarse grounding detector boundaries.

  9. One-Pass Feedback Loop: The top-4 initial instance masks (ranked by SAM confidence score) are fed back into the DMG as improved exemplars, producing a sharpened density map and final segmentation.

Datasets

  • PerSense-D (New Benchmark): The authors introduce the first benchmark explicitly dedicated to personalized segmentation in dense environments. It contains 717 images (689 query images, 28 dedicated support exemplars) spanning 28 object categories (e.g., durians, walnuts, kiwi, potatoes, birds). It includes 28,395 annotated instances, averaging 39 instances per image (range: 7 to 218) with substantial occlusion and clutter.
  • Generalization Datasets: Evaluated on COCO-$20^i$ and LVIS-$92^i$ for sparse image comparisons, and Tiny-DOTA for comparison with interactive tiny-object detector C3Det.

Key Insights and Ideas

  • Density Maps as Discrete Prompters: Density maps are universally used for global counting, not instance localization. PerSense shows that combining statistical morphology (area distributions and distance transforms) can reliably "invert" density maps into accurate, per-instance single-point coordinates.
  • Points Beat Boxes in Crowds: Point prompts avoid the geometric constraints of axis-aligned bounding boxes and bypass NMS failures, making them naturally superior for dense, tightly packed objects.
  • Density-Adaptive Gating: Fixed feature-similarity thresholds fail across scenes of varying densities. Dynamically scaling the threshold inversely with object count ($\propto 1/C$) preserves high recall for subtle instances in crowded scenes without sacrificing precision in sparse ones.
  • Diminishing Returns of Multi-Pass Feedback: Ablations show that feedback saturation occurs after just one iteration with 4 exemplars ($k=4$). Additional feedback iterations increase latency without improving mIoU.

Key Results

  • Benchmark Performance (PerSense-D):
  • PerSense (CounTR): 71.61% mIoU
  • PerSense (DSALVANet): 70.96% mIoU
  • Outperforms Grounded-SAM (65.92%, +5.69%), Matcher (62.78%, +8.83%), PerSAM-F (29.34%, +42.27%), PerSAM (24.45%, +47.16%), and C3Det (48.60%, +23.01%).
  • Runtime Efficiency:
  • PerSense averages 2.7s per image on a single RTX 4090 (2,988 MB VRAM).
  • Significantly faster than PerSAM (~39.8s) and Matcher (10.2s), adding only a marginal 0.9s overhead over Grounded-SAM (1.8s) while yielding vastly better delineations in crowded regions.

Limitations and Future Work

  • Irrecoverable False Negatives: PerSense depends fundamentally on the quality of the density map. If the DMG misses an object entirely during initial density estimation, IDM and PPSM cannot recover it.
  • Tightly Packed Objects with Flush Boundaries: When instances share completely flat, continuous boundaries without surface demarcation (e.g., a tightly packed bookshelf), density estimation blurs together, causing Grounded-SAM to occasionally outperform PerSense.
  • High Intra-Class Variation: Extreme shape or color shifts within a single image (e.g., sliced vs. whole vegetables) remain difficult to capture fully from a single support example.
  • Sparse Scene Overhead: For images with very few objects, generating density maps is less effective and less necessary; standard box-based open-vocabulary detectors remain better suited for sparse scenarios.

Summary updated

BibTeX
@misc{siddiqui2024persense,
  author = {Muhammad Ibraheem Siddiqui and Muhammad Umer Sheikh and Hassan Abid and Muhammad Haris Khan},
  title = {{PerSense: Personalized Instance Segmentation in Dense Images}},
  year = {2024},
  eprint = {2405.13518},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.13518},
}
Figure