Manuscript Offprint

arXiv:2610.20073

GDBA-Net: A Gated Dual-Branch Adaptation of SAM2 for Robust Cross-Domain Nuclei Segmentation

Biplab Poudel, Betserai Albert Magarire, Anish Kumar Shah, Jiacheng Xie, Dong Xu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Biplab Poudel 1,2,3^{1,2,3}, Betserai Albert Magarire 3^{3}, Anish Kumar Shah 4^{4}, Jiacheng Xie 1,2,5^{1,2,5}, Dong Xu 1,2,5,∗^{1,2,5,*}

1^{1}Department of Electrical Engineering and Computer Science, University of Missouri, Columbia, MO 65211, USA

2^{2}Bond Life Sciences Center, University of Missouri, Columbia, MO 65211, USA

3^{3}Department of Applied Computing, Lander University, Greenwood, SC 29649, USA

4^{4}Department of Electronics and Computer Engineering, Sagarmatha Engineering College, Tribhuvan University, Nepal

5^{5}Health Informatics Institute, Morsani College of Medicine, University of South Florida, Tampa, FL 33612, USA

∗^{*}Corresponding author. Email: dxul@usf.edu

Abstract—Accurate nuclei segmentation underpins quantitative computational pathology, yet remains challenging due to morphological variability, weak boundaries, nuclear crowding, and pronounced domain shifts arising from differences in tissue preparation, staining, and acquisition. While deep learning and recent foundation models have improved segmentation performance under matched distributions with the original training data, their generalization across heterogeneous histopathology domains remains limited. We introduce GDBA-Net, a parameter-efficient nuclei segmentation framework built around the proposed Gated Dual-Branch Adapter (GDBA). GDBA-Net adapts a frozen SAM2 encoder by integrating pretrained semantic representations with explicit frequency-derived structural priors. The complementary representations are independently transformed through Grid MLP branches and dynamically integrated using sample-adaptive channel-wise gating, selectively emphasizing structural cues relevant to nuclear delineation. Despite using only 4.3 million trainable parameters, GDBA-Net achieves state-of-the-art in-dataset performance and consistently superior cross-dataset generalization across six diverse nuclei segmentation benchmarks under fully supervised, cross-dataset, and five-shot adaptation protocols, outperforming competing CNN-, transformer-, and foundation model-based methods. Comprehensive ablations confirm that these gains arise from the coordinated design of semantic-frequency complementarity and adaptive gating rather than increased model capacity. By uniting transferable semantic representations with explicit structural priors, GDBA-Net provides a robust, annotation-efficient solution to domain variability in nuclei segmentation. https://github.com/biplabpoudel25/GDBA_Net

Index Terms—Nuclei segmentation, Computational pathology, Foundation models, SAM2, Parameter-efficient fine-tuning, Domain generalization

I. INTRODUCTION

ACCURATE segmentation of cell nuclei from histopathological images constitutes a fundamental analytical step in computational pathology, serving as the gateway to downstream quantitative tasks, including cell counting, cell profiling, spatial transcriptomics mapping, and diagnostic decision support [1]–[3]. The proliferation of digital pathology and whole-slide imaging (WSI) in modern clinical workflows has intensified the demand for automated, robust nuclei segmentation pipelines that alleviate the substantial annotation burden on pathologists and enable high-throughput, reproducible morphological analysis [4]. However, reliable nuclei delineation remains challenging because nuclei exhibit substantial variations in size, shape, appearance, and spatial organization, while weak boundaries, densely clustered cells, staining variability, and imaging artifacts further complicate segmentation [5]. More importantly, differences in tissue preparation, staining protocols, scanners, and acquisition conditions introduce pronounced domain shifts, causing models trained on one dataset to deteriorate when applied to unseen histopathological data.

Traditional image processing methods, including watershed segmentation, adaptive thresholding, and handcrafted morphological descriptors, provided initial promise in controlled, homogeneous tissue settings [6] but were highly sensitive to staining variability, noise, and nuclear crowding, often requiring extensive parameter tuning and failing in complex tissue environments [7]. Deep learning substantially advanced the field, beginning with U-Net [8] and subsequently incorporating attention, multi-scale representations, instance-aware modeling, and transformer-based architectures [5], [9]–[13]. Although these methods have achieved strong performance under matched training and testing distributions, robust generalization across heterogeneous datasets remains difficult. Their learned representations are largely driven by the source-domain appearance, making segmentation particularly vulnerable when staining characteristics, tissue morphology, or acquisition conditions differ from those encountered during training.

Vision foundation models provide a promising alternative by transferring representations learned from large and diverse image corpora. Segment Anything Model (SAM) [14] and its successor SAM2 [15] have demonstrated strong general-purpose segmentation capabilities, yet their direct transfer to fine-grained biomedical structures remains limited by the substantial gap between natural and histopathological images [16], [17]. Medical fine-tuning approaches like MedSAM [18], and MedSAM2 [19], and parameter-efficient adaptation methods like SAMed [20], SAM-Adapter [21], SAM2-Adapter [22], and the Medical SAM Adapter [23], have improved their applicability while reducing the need to train task-specific models from scratch. Nevertheless, efficient adaptation alone does not fully address the representational requirements of nuclei segmentation.

High-level semantic features provide valuable contextual information, whereas accurate separation of densely packed nuclei also depends on fine structural cues associated with boundaries and local morphological transitions. Frequency-domain representations can emphasize such information [24], but high-frequency components may simultaneously amplify staining irregularities, texture variations, and acquisition noise. Thus, a central challenge is not simply introducing structural information, but determining how structural and semantic representations should be selectively balanced during adaptation. Existing adapter methods have explored task-specific information, including high-frequency components [22], but the adaptive integration of separately transformed structural and semantic representations remains insufficiently explored to achieve robust nuclei segmentation across heterogeneous domains.

In this work, we present GDBA-Net, a SAM2-based framework for robust multi-domain nuclei segmentation. The framework is motivated by the complementary strengths of pretrained deep representations for semantic abstraction and frequency-derived representations for capturing fine structural information. Its central component is the proposed Gated Dual-Branch Adapter (GDBA), which uses branch-specific Grid MLP adapters to independently process semantic and frequency-derived structural features before integrating them through sample-adaptive channel-wise gating. This design selectively emphasizes structural cues relevant to nuclear delineation while preserving the pretrained knowledge of the frozen encoder. We evaluate GDBA-Net across six morphologically diverse benchmarks - Kumar [25], MoNuSeg [26], CryoNuSeg [27], CPM [28], TNBC [29], and CoNSeP [5], under both in-dataset and rigorous cross-dataset generalization protocols.

The principal contributions of this paper are as follows:

  1. We introduce GDBA-Net, a parameter-efficient dual-branch adaptation framework for SAM2 that jointly leverages pretrained semantic representations and frequency-derived structural information for robust nuclei segmentation.

  2. We develop a sample-adaptive channel-wise gating mechanism that dynamically balances semantic and structural information during adaptation. This design enables the model to selectively exploit fine structural cues while preserving transferable semantic knowledge, rather than relying on fixed or direct feature fusion.

  3. We demonstrate state-of-the-art performance and strong cross-domain generalization across six heterogeneous nuclei segmentation benchmarks under in-dataset, cross-dataset, and few-shot settings outperforming eleven competing CNN-, transformer-, and foundation model-based methods.

  4. We establish the effectiveness and efficiency of GDBA-Net through few-shot adaptation and systematic ablation studies. Additional experiments on retinal vessel and skin lesion segmentation further support the applicability of the proposed adaptation strategy beyond nuclei segmentation.

II. RELATED WORK

References (45)

  • Hard-boundary attention network for nuclei instance segmentation
  • Improving generalization capability of deep learning-based nuclei instance segmentation by non-deterministic train time and deterministic test time stain normalization
  • Classification and mutation prediction from non-small cell lung cancer histopathology images using deep learning
  • Validating whole slide imaging systems for diagnostic purposes in pathology
  • Hover-net: Simultaneous segmentation and classification of nuclei in multi-tissue histology images
  • Methods for nuclei detection, segmentation, and classification in digital histopathology: A review—current status and future potential
  • Nuclei segmentation and classification from histopathology images using federated learning for end-edge platform
  • U-net: Convolutional networks for biomedical image segmentation
  • Attention gated networks: Learning to leverage salient regions in medical images
  • UNet++: Redesigning skip connections to exploit multi-scale features in image segmentation
  • Cell detection with star-convex polygons
  • TransUNet: Transformers Make Strong Encoders for Medical Image Segmentation
  • Swin-Unet: Unet-like pure transformer for medical image segmentation
  • Segment Anything
  • SAM 2: Segment Anything in Images and Videos
  • All-in-sam: from weak annotation to pixel-wise nuclei segmentation with prompt-based finetuning
  • SAMCell: Generalized label-free biological cell segmentation with segment anything
  • Segment anything in medical images
  • MedSAM2: Segment anything in 3d medical images and videos (opens arXiv in a new tab)
  • Customized segment anything model for medical image segmentation (opens arXiv in a new tab)
  • SAM-Adapter: Adapting segment anything in underperformed scenes
  • SAM2-Adapter: Evaluating & adapting segment anything 2 in downstream tasks: Camouflage, shadow, medical image segmentation, and more
  • Medical SAM adapter: Adapting segment anything model for medical image segmentation
  • A global-frequency-domain network for medical image segmentation
  • A dataset and a technique for generalized nuclear segmentation for computational pathology
  • A multi-organ nucleus segmentation challenge
  • CryoNuSeg: A dataset for nuclei instance segmentation of cryosectioned H&E-stained histological images
  • Methods for segmentation and classification of digital microscopy tissue images
  • Segmentation of nuclei in histopathology images by deep regression of the distance map
  • Attention U-Net: Learning Where to Look for the Pancreas
  • nnU-Net: a self-configuring method for deep learning-based biomedical image segmentation
  • Pyramid scene parsing network (opens arXiv in a new tab)
  • DAN-NucNet: A dual attention based framework for nuclei segmentation in cancer histology images under wild clinical conditions
  • HiFormer: Hierarchical multi-scale representations using transformers for medical image segmentation
  • TransNuSeg: A lightweight multi-task transformer for nuclei segmentation
  • Quantifying the effects of data augmentation and stain color normalization in convolutional neural networks for computational pathology
  • Measuring domain shift for deep learning in histopathol-ogy
  • Mitosis domain generalization in histopathology images—the MIDOG challenge
  • Causality-inspired single-source domain generalization for medical image segmentation
  • Frequency-mixed single-source domain generalization for medical image segmentation
  • Fourier channel attention powered lightweight network for image segmentation
  • NucleiSegNet: Robust deep learning architecture for the nuclei segmentation of liver cancer histopathology images
  • Ridge-based vessel segmentation in color images of the retina
  • Skin lesion analysis toward melanoma detection 2018: A challenge hosted by the international skin imaging collaboration (ISIC) (opens arXiv in a new tab)
  • The HAM10000 dataset, a large collection of multi-source dermatoscopic images of common pigmented skin lesions