Exclusivity-Guided Mask Learning for Semi-Supervised Crowd Instance Segmentation and Counting

Jiyang Huang, Hongru Chen, Wei Lin, Jia Wan, Antoni B. ChanarXiv 2026

TL;DR

This paper introduces a unified semi-supervised framework that bridges crowd counting and instance segmentation by leveraging structural shape information instead of sparse point cues. By introducing an exclusivity-guided mask learning method (XMask) and an automatic mask generation tool (EDP-SAM), the approach achieves state-of-the-art performance in both tasks while running up to 5.9× faster than foundation-model baselines.

What Problem Does This Paper Address?

Crowd scene analysis is vital for public safety and urban management, but it suffers from a severe data annotation bottleneck. Because pixel-level labeling is prohibitively expensive, standard datasets rely on point-based annotations (typically a single dot on each person's head). Consequently, models treat individuals as dimensionless points, completely ignoring spatial extent, shape, and occlusion.

While recent vision foundation models like the Segment Anything Model (SAM) show zero-shot promise, they struggle in dense, highly congested crowd regions and suffer from massive computational overhead. This paper addresses a key question: How can we learn fine-grained structural semantics and instance boundaries from sparse point annotations under a semi-supervised regime?

Methods

The authors propose a synergistic three-stage framework that allows segmentation and counting to mutually reinforce each other:

  1. EDP-SAM (Exclusion-Constrained Dual-Prompt SAM): To bootstrap mask supervision from point-only datasets, the authors combine point prompts with SLIC superpixels to guide SAM. Crucially, they introduce the Nearest Neighbor Exclusion Circle (NNEC)—an adaptive spatial constraint based on the distance to the closest neighboring point—to prevent masks from leaking into adjacent individuals.
  2. XMask (Exclusivity-Guided Mask Learning): This module treats instance segmentation as a local semantic segmentation problem within dynamically defined NNEC regions. It optimizes a discriminative mask objective using Depthwise Gaussian Smoothing to maintain feature coherence and a Differentiable Center Sampling strategy to ensure stable gradient propagation.
  3. Mask Constraint Counting: Finally, the generated instance masks serve as structured pseudo-labels to regularize the counting network. The model enforces instance-level consistency using Background Penalty and Foreground Constraint losses, creating a closed-loop feedback mechanism.
Fig. 2: Overview of the proposed framework. Our semi-supervised pipeline consists of three stages: (1) pretraining and mask preparation, (2) crowd segmentation training, and (3) mask-constrained crowd counting optimization. In Stage 1, mask annotations are generated from point labels via the proposed EDP-SAM (yellow region). Stage 2 presents the semi-supervised XMask training process, including discriminative super- vision and pseudo-mask generation. The trained segmentation model is then utilized in Stage 3 to produce pseudo-masks for unlabeled data, where newly designed loss functions are introduced to further enhance counting performance via mask constraint.

Datasets

The framework was evaluated using 5%, 10%, and 40% labeled data protocols on three major crowd counting benchmarks:

  • ShanghaiTech A (ShTech A)
  • UCF-QNRF
  • JHU++

The authors used EDP-SAM followed by light manual refinement to construct dense mask ground truths for these datasets, providing a standardized benchmark for future crowd instance segmentation research.

Key Insights and Ideas

  • Points can define boundaries: By calculating the distance to the nearest neighbor, a simple circle (NNEC) provides an excellent adaptive spatial prior. This constraint effectively guarantees first-order exclusivity, preventing segmentation models from bleeding across distinct individuals in highly congested scenes.
  • Segmentation regularizes counting: Instead of treating counting and segmentation as isolated tasks, using instance masks as structured pseudo-labels provides richer shape and spatial information than traditional point cues, significantly reducing counting errors and large estimation outliers (MSE).
  • Differentiability matters in embedding spaces: Moving from discrete feature extraction to differentiable grid sampling at sub-pixel positions yields smoother gradient propagation and more stable feature embeddings during training.
MaskHead Discriminative Loss mechanism

Key Results

  • Segmentation Accuracy: XMask consistently outperformed point-prompted FastSAM baselines across all datasets. For instance, on UCF-QNRF (with 5% labels), XMask achieved an [email protected] of 0.282 compared to FastSAM's 0.223.
  • Efficiency Boost: XMask delivers segmentation performance on par with large foundation models but at a fraction of the cost, averaging 0.17 seconds per image on ShanghaiTech A compared to 1.01 seconds for FastSAM (a 5.9× speedup).
  • Counting Performance: The mask-constrained framework achieved state-of-the-art semi-supervised counting results. On ShanghaiTech A (5% labels), it reduced the Mean Absolute Error (MAE) to 64.6, outperforming the previous best method (P2R at 69.9).

Limitations and Future Work

While the framework significantly improves performance and efficiency, the initial mask generation phase (EDP-SAM) still requires a light manual correction step to fix occasional artifacts, such as broken masks caused by missing items (e.g., sunglasses) or incomplete head coverage. The authors note that future work will focus on improving boundary precision and refining point-generation strategies to achieve even finer-grained segmentation quality without human intervention.

Summary updated

BibTeX
@misc{huang2026exclusivity,
  author = {Jiyang Huang and Hongru Chen and Wei Lin and Jia Wan and Antoni B. Chan},
  title = {{Exclusivity-Guided Mask Learning for Semi-Supervised Crowd Instance Segmentation and Counting}},
  year = {2026},
  eprint = {2603.16241},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.16241},
}
Figure