TL;DR
Deep learning models can segment tumors on pathology slides with impressive accuracy, yet they still fail silently when they encounter unfamiliar tissue or rare cancer subtypes. DUET is a pipeline that not only segments tumors in whole-slide images, but also flags when and why its predictions shouldn't be trusted—distinguishing between out-of-distribution (OOD) inputs and in-distribution errors on rare morphologies, all from the segmentation model's own internal embeddings.
What Problem Does This Paper Address?
Digital pathology is booming, and AI models are increasingly used to outline tumor regions pixel by pixel on whole-slide images (WSIs). However, bringing these models into routine clinical practice hits two major roadblocks:
- Out-of-distribution (OOD) shifts: A model trained on slides from one hospital might suddenly see slides from another hospital with different staining protocols or scanners, a different cancer type in the same organ, or tissue from an entirely different organ. In these cases, models can fail silently with high confidence.
- In-distribution errors: Even on slides from the same hospital and cancer type, rare morphological variants may be too underrepresented in the training data for the model to learn properly, leading to localized segmentation mistakes.
The authors tackle both problems in the context of oral squamous cell carcinoma (OSCC)—a major health burden in India—by building a system that segments tumor epithelium while simultaneously estimating its own reliability.
Methods
DUET tiles a WSI into $256 \times 256$ pixel patches and passes each patch through a segmentation model. The authors compare three encoders: a lightweight CNN-Seg (ImageNet-pretrained ResNet34), a general-purpose vision foundation model ViTL-Seg (DINOv2 ViT-L), and a domain-specific pathology foundation model UNI2H-Seg (UNI2-h), each paired with a U-Net-style decoder (and a ViT-Adapter for the transformers).
From the trained encoder's bottleneck (or CLS token for ViTs), DUET extracts a patch feature vector, L2-normalizes it, and reduces its dimensionality with PCA. It then runs two complementary detectors:
- OOD Detector (Unsupervised): An 8-component Gaussian Mixture Model (GMM) is fitted to the PCA-reduced training features. At test time, each patch is scored by its negative log-likelihood (NLL) under the GMM—the higher the score, the more atypical the patch. Patch scores are averaged to produce a slide-level OOD score.
- In-Distribution Error Detector (Supervised): Two separate XGBoost regressors take the PCA features concatenated with the model's predicted tumor fraction $\tau$ and predict the exact fraction of false-positive (FP) and false-negative (FN) pixels in each patch. These are summed across the slide to estimate slide-level precision and recall.
Datasets
- Training & In-Distribution Testing: Trained on 409 WSIs from OCAT (an Indian OSCC clinical trial cohort, split 85:15 for train/val) and tested in-distribution on N0 (a separate Indian clinical trial cohort).
- External Head & Neck Cohorts (Annotated): TCGA HNSC (468 diagnostic WSIs, newly annotated by three expert pathologists and released publicly), ORCA, and OCDC. TCGA HNSC also serves as an OOD test set for stain and scanner shifts.
- Unannotated OOD-Only Cohorts: Non-squamous OC (120 slides of different tumor types in the oral cavity) and TCGA Multi-organ (150 slides split evenly across lung, breast, and kidney cancers).
Key Insights and Ideas
- Domain-specific pretraining shines brightest in OOD detection, not segmentation: While all three encoders perform within 5 Dice points of each other on tumor segmentation, the pathology foundation model (UNI2H-Seg) crushes the competition on OOD detection.
- Cleanly separating the unfamiliar: In UMAP projections of UNI2H-Seg's features, in-distribution N0 patches overlap with training data, while TCGA HNSC, non-squamous OC, and multi-organ patches each carve out their own distinct regions. Neither ResNet34 nor DINOv2 ViT-L exhibits this clean separation.
- Being OOD doesn't always mean failing: TCGA HNSC is flagged as OOD due to stain and scanner differences, yet the models still segment it well. An OOD flag simply warns clinicians that the output shouldn't be blindly trusted until validated on that distribution.
- Lightweight CNNs still have a place: Because CNN-Seg is 19× faster than UNI2H-Seg (2,523 vs. 135 patches/s) and uses ~8× less GPU memory (0.9 GB vs. 6.8 GB) while trailing by less than 5 Dice points, it remains a practical choice for resource-constrained clinics.
Key Results
- Segmentation: UNI2H-Seg achieves the highest Dice on 4 of 5 datasets (89.5% on OCAT val, 85.2% on N0, 86.0% on TCGA HNSC), while ViTL-Seg leads on OCDC (81.6%).
- OOD Detection ($\text{TPR}@\text{FPR}_5$): UNI2H-Seg leads the next-best encoder by at least 28 percentage points at the patch level and 15 points at the slide level—flagging 95.1% of TCGA HNSC slides, 95.8% of non-squamous OC slides, and 100.0% of multi-organ slides. It also outperforms a 10-pass MC-dropout uncertainty baseline in nearly every setting.
- In-Distribution Error Detection: All three encoders separate FP and FN error patches from non-error patches with >0.90 AUROC, and slide-level aggregation yields strong Spearman correlations with actual recall (0.763–0.806 on N0).
Limitations and Future Work
The two OOD-only cohorts (Non-squamous OC and TCGA Multi-organ) lack pixel-level tumor annotations, so the authors could not directly measure how closely OOD scores correlate with actual drops in segmentation accuracy on those slides. Future work includes obtaining annotations for these OOD cohorts, testing on larger and more diverse external datasets, and prospectively validating both the uncertainty signals and the lightweight CNN-Seg model in routine clinical workflows.
Summary updated