AtlasPatch: Scalable Foundation Model-based Tissue Detection and Patch Extraction for Computational Pathology

Ahmed Alagha, Christopher Leclerc, Yousef Kotp, Omar Metwally, Calvin Moras, Peter Rentopoulos, Ghodsiyeh Rostami, Bich Ngoc Nguyen, Jumanah Baig, Abdelhakim Khellaf, Vincent Quoc-Huy Trinh, Rabeb Mizouni, Hadi Otrok, Jamal Bentahar, Mahdi S. HosseiniarXiv 2026

TL;DR

AtlasPatch introduces a highly scalable preprocessing pipeline for computational pathology that eliminates the trade-off between speed and accuracy in tissue detection. By fine-tuning the SAM2 foundation model on a massive new dataset of 30,000 annotated thumbnails using just 0.076% of its weights, it achieves robust tissue detection at thumbnail resolution. This approach accelerates whole-slide image preprocessing by up to 16× while maintaining or improving downstream diagnostic performance.

What Problem Does This Paper Address?

Gigapixel whole-slide images (WSIs) are foundational to digital pathology, but their massive size presents a major computational hurdle: a large portion of any given slide is just empty background. To train machine learning models efficiently, researchers must first isolate the actual tissue and chop it into smaller patches.

Currently, researchers face a frustrating dilemma. They can use classical thresholding heuristics (like Otsu thresholding), which are blazing fast but brittle—frequently failing when confronted with staining variations, pen marks, or scanner artifacts. Alternatively, they can use deep learning models that run inference patch-by-patch across the entire slide. While robust, this patch-wise approach is computationally punishing, requiring thousands of forward passes per slide. This "preprocessing tax" creates a massive bottleneck when trying to scale up to train modern pathology foundation models on cohorts of hundreds of thousands of slides.

Methods

AtlasPatch bypasses the patch-wise bottleneck by performing deep learning-based tissue detection only once at the low-resolution thumbnail level.

  1. Parameter-Efficient SAM2 Adaptation: The authors leverage the Segment Anything 2 (SAM2) foundation model. To adapt it to histopathology without massive compute costs or overfitting, they freeze the entire image encoder and mask decoder backbones. They only update the Layer Normalization (LN) parameters during training, which accounts for a mere 0.076% of the model's total weights.
  2. Pyramid-Aware Contour Mapping: Once the fine-tuned SAM2 generates a clean thumbnail-level tissue mask, AtlasPatch converts this mask into polygonal contours. It then mathematically extrapolates these low-resolution boundaries directly up to the full-resolution slide coordinates.
  3. Parallelized Patch Extraction: These high-resolution contours directly guide a multi-core CPU parallelized patch extraction and embedding pipeline, completely avoiding repeated patch-wise neural network inference.
Figure 1: Overview of the AtlasPatch slide-preprocessing pipeline. Following the acquisition of diagnostic WSIs as multi-resolution pyramids, AtlasPatch utilizes the thumbnail for tissue detection using the finetuned SAM2 model, then extrapolates the resulting contour into the desired high resolution. This is followed by computing patch coordinates for downstream patch image export or feature embeddings.

Datasets

To train and validate the tissue detector, the authors curated a massive, highly diverse multi-cohort dataset of ~30,000 WSI thumbnail-mask pairs semi-manually annotated via Labelbox. The dataset deliberately spans multiple organs, scanner vendors, and common artifacts:

  • In-house Data: Over 18,000 slides from the Centre hospitalier de l’Université de Montréal (CHUM) covering pancreas and digestive system tissues.
  • Public Data: Carcinomas and biopsies from the Camelyon17 challenge (breast), the PANDA challenge (prostate), and eight distinct projects from The Cancer Genome Atlas (TCGA), spanning bladder, breast, colorectal, kidney, lung, stomach, and uterine tissues.
Figure 4: Example thumbnails ordered along key axes of vari- ation, highlighting challenging edge cases for tissue detection. Rows illustrate variation in tissue percentage, boundary defini- tion, object count, brightness, heterogeneity, and colorfulness, arranged from low (left) to high (right).

Key Insights and Ideas

  • The Power of LN-Tuning: Tuning only the layer normalization parameters is remarkably effective for cross-domain adaptation. It allows a model trained on natural images to master the subtle, stochastic boundaries of histopathology slides with minimal training cost.
  • Global Context Beats Local Detail: Operating at the thumbnail level preserves global geometric context. Patch-wise detectors often get confused by local artifacts (like a dark ink mark) and misclassify them as tissue. AtlasPatch avoids this by looking at the entire slide at once.
  • Information-Dense Patching: Because AtlasPatch's tissue masks are highly precise, it extracts fewer total patches per slide compared to heuristic methods (e.g., ~3,047 patches/WSI vs. ~8,976 for CLAM). By filtering out background noise and artifacts early, it saves massive amounts of downstream storage, memory, and feature-encoding compute.

Key Results

  • Massive Speedups: AtlasPatch processes slides up to 16× faster than patch-based deep learning pipelines (such as Trident-Hest) and more than 2× faster than widely used pipelines like CLAM and Trident-GrandQC.
  • High Precision: It achieves a tissue detection precision of 0.986 on a held-out test set of 3,000 slides, demonstrating extreme robustness against variations in brightness, fragmentation, and artifacts.
  • Downstream Parity: The authors validated the extracted patches across six slide-level classification tasks using Multiple-Instance Learning (MIL). AtlasPatch matched or exceeded the diagnostic accuracy of alternative pipelines while processing fewer patches. Notably, on the PANDA dataset, CLAM failed to detect any tissue in roughly 54% of the slides due to thresholding failures, whereas AtlasPatch handled them seamlessly.

Limitations and Future Work

  • The Annotation Bottleneck: While the resulting model is highly robust, creating the 30,000-image ground truth dataset required substantial manual effort. The authors suggest incorporating active learning in future iterations to automatically identify and prioritize ambiguous slides for human review.
  • Fine-Grained Internal Holes: AtlasPatch focuses on capturing the complete global spatial footprint of the tissue, meaning it occasionally misses tiny internal holes within a tissue structure.
  • User Interface: The tool is currently distributed as a modular Python package and command-line tool. The authors note that clinical adoption would benefit from a dedicated pathologist-friendly graphical user interface (GUI) integrated with standard slide viewers.

Summary updated

BibTeX
@misc{alagha2026atlaspatch,
  author = {Ahmed Alagha and Christopher Leclerc and Yousef Kotp and Omar Metwally and Calvin Moras and Peter Rentopoulos and Ghodsiyeh Rostami and Bich Ngoc Nguyen and Jumanah Baig and Abdelhakim Khellaf and Vincent Quoc-Huy Trinh and Rabeb Mizouni and Hadi Otrok and Jamal Bentahar and Mahdi S. Hosseini},
  title = {{AtlasPatch: Scalable Foundation Model-based Tissue Detection and Patch Extraction for Computational Pathology}},
  year = {2026},
  eprint = {2602.03998},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.03998},
}
Figure