Sign in
PathologybioRxiv

Using Progressive Context Encoders for Anomaly Detection in Digital Pathology Images

R. Gillard, Q. Gu, C. Meroueh, N. Prodduturi, S. Patil, T. J. Flotte, S. N. Hart

Abstract

Whole slide imaging (WSI) is transforming the practice of pathology, converting a qualitative discipline into a quantitative one. However, one must exercise caution in interpreting algorithm assertions, particularly in pathology where an incorrect classification could have profound impacts on a patient, and rare classes exist that may not have been seen by the algorithm during training. A more robust approach would be to identify areas of an image for which the pathologist should concentrate their effort to make a final diagnosis. This anomaly detection strategy would be ideal for WSI, but given the extremely high resolution and large file sizes, such an approach is difficult. Here, we combine progressive generative adversarial networks with a flexible adversarial autoencoder architecture capable of learning the "normal distribution" of WSIs of normal skin tissue at extremely high resolution and demonstrate its anomaly detection performance. Our approach yielded pixel-level accuracy of 89% for identifying melanoma, suggesting that our label-free anomaly detection pipeline is a viable strategy for generating high quality annotations - without tedious manual segmentation by pathologists. The code is publicly available at https://github.com/Steven-N-Hart/P-CEAD.

PDFDOICode
Full-text digest ↓

02 /Specification & Classification

Click any tag to browse matching papers

In-depth summary

✦ Multi-agent verified full-text synthesis

Claude Opus 5.5 · xhigh effort · 8 Nov 2026 · from the full text of version 1 (4 Jul 2021) · CC BY 4.0

A progressive context encoder trained only on normal skin whole slide images flags melanoma regions without manual tumor labels, reaching 89% pixel-level accuracy across 9 test slides.

Binary classifiers in dermatopathology misclassify any lesion outside their training classes, and rare entities make exhaustive labeled sets impractical; earlier GAN, autoencoder and context-encoder anomaly detectors were only run on low-resolution or small images. P-CEAD learns solely from normal skin and uses progressive growing to extend inpainting-based anomaly detection to 1024×1024 whole slide image patches.

Key results

  1. SuggestedAlthough trained only on normal skin, P-CEAD segmented invasive melanoma on held-out slides in close agreement with ground truth drawn by a pathologist, and no tumor labels were used during training.

    Across 9 melanoma WSIs not used in any training phase, the inference settings were KDE cutoff 0.21 and polygon dilation 4. Mean sensitivity was 94% ± 8, specificity 87% ± 7 and accuracy 89% ± 7 (Table 1). No competing method was benchmarked on these slides. · RESULTS; Tables; METHOD

  2. SuggestedScaling GANanomalyDetection directly to whole slide images failed. The authors switched to an inpainting adversarial autoencoder (a U-net bowtie generator) that drops the latent-space loss and the extra encoder network.

    GANanomalyDetection mostly learned collagen and fat, and it encoded either real or generated images but never both. This caused blur or mode collapse across eight weighted loss terms (weights 1, 0.01, 0.001, or 50; Table S1). Adding an encoder network gave negligible gain. Visual assessment only (Supplemental Figure 1). · RESULTS; DISCUSSION/CONCLUSION; Loss Functions; Phase 1: Network weight training

  3. SuggestedThe model needed both skip connections and shuffled-pixel inpainting masks. Without skip connections, reconstructions were blurry or color-distorted. Without masking, the autoencoder reconstructed any input, anomalies included.

    Qualitative comparisons only (Supplementary Figure 2): pruning skip connections lost high-resolution detail. By default about 20% of the pixels in each patch were masked with randomly placed squares whose pixels were shuffled; this inpainted more realistically than black-pixel masking. · Phase 1: Network weight training; RESULTS; DISCUSSION/CONCLUSION; Figure legends

  4. ShownFiltering patches with ResNet50 embeddings and PCA enriched the training set for diagnostically relevant epidermis and dropped many collagen and whitespace patches, although a stricter cutoff would have discarded too many useful normal examples.

    Keeping patches in the first 80% of PC1 cut 534531 patches from 200 WSIs to 427625. Per-slide retention ranged from 9.71% to 99.29% (mean 76.1%). Manual inspection confirmed the epidermis was enriched; cutoffs looser than 80% let in blurry or blank patches. · Phase 0: Preprocessing; Different PCA thresholds; RESULTS

  5. SuggestedInference filter settings strongly affect performance. Patch-level review linked false positives to features such as immune infiltrate that were scarce in normal training slides or to a missing preserved epidermis, and false negatives to degenerated tumor cells and extracellular matrix.

    Changing polygon dilation shifted sensitivity and specificity markedly (Figure 3). False positives clustered in areas with lymphocytic infiltrate, parakeratosis, knife artefact, epidermal denudation or large arterial lumina. False negatives were linked to degenerated tumor cells and abundant extracellular matrix. Reconstructions were darker overall. · RESULTS; Exploration of predictions; Figure legends

Methods, data and reproducibility

A progressively grown U-net generator (4×4 to 1024×1024) with a WGAN gradient-penalty discriminator learns to inpaint pixel-shuffled masks in normal skin patches. Per-pixel RGB errors are scored by Mahalanobis distance to a normal error reference distribution (NERD), thresholded, filtered, smoothed by kernel density estimation and converted to polygons.

  • Pool of normal H&E skin excision slides (no inflammation or neoplasia) chosen by a senior dermatopathologist; Mayo Clinic, scanned at 40X on Aperio ScanScope V1 · human (clinical skin excisions, Mayo Clinic) · n = 200 WSIs; 534531 patches pre-filter, 427625 post-filter
  • Normal skin WSIs used to train the progressive inpainting autoencoder (Phase 1) · human (clinical skin excisions, Mayo Clinic) · n = 150 WSIs (330415 patches)
  • Held-out normal skin WSIs used to fit the normal error reference distribution (Phase 2) · human (clinical skin excisions, Mayo Clinic) · n = 25 WSIs (44693 patches)
  • Separate held-out normal skin WSIs used to set the Mahalanobis distance threshold (Phase 3) · human (clinical skin excisions, Mayo Clinic) · n = 25 WSIs (52517 patches)
  • Test skin slides with definitive invasive melanoma, annotated by a pathologist in QuPath 0.2.3 · human (clinical skin excisions, Mayo Clinic) · n = 9 slides
Methods & tools
P-CEAD (Progressive Context Encoders for Anomaly Detection), Progressively Growing GAN framework (ProGAN), U-net bowtie autoencoder generator with skip connections, WGAN loss with gradient penalty and epsilon drift penalty, ResNet50 (patch embedding), Principal Component Analysis (PCA), Mahalanobis distance to the normal error reference distribution, Gaussian kernel density estimator (bandwidth 100), Shapely (polygon union, dilation, intersection), QuPath 0.2.3 (manual annotation), Aperio ScanScope V1 (40X slide scanning), GANanomalyDetection (attempted, discarded)
Software & environment
The only versioned software is QuPath 0.2.3 (annotation). Patches were stored as TF Records and processing ran on Google Colab and Google Cloud Platform. No deep learning framework versions, dependency files or containers are stated.
Assay conditions & compute
Phase 0: 12.5 h on Google Colab (32 vCPUs, 208 GB RAM, 2 NVIDIA Tesla T4s). Training ran on GCP n1-highmem-16 VMs with two Tesla V100 GPUs. Phase 1 took 129.5 h (16GB memory); Phases 2 and 3 each took under 1 h.
Reproducibility gaps
Training and test slides are internal Mayo Clinic material with no stated public release. The text does not say whether trained weights or the pathologist melanoma annotations are available.
Limitations (6)
  • P-CEAD only localizes anomalous regions and does not identify what they are; characterizing flagged areas is left to a separate downstream step. · stated by the authors
  • The minimum-cluster and patch-level pixel filters applied at inference can, in principle, lower the method's analytical sensitivity. · stated by the authors
  • The cost and technical demands of Phase 1 training may be prohibitive for many clinical pathology departments. · stated by the authors
  • The model was trained on Mayo Clinic Aperio SVS slides with JPEG2000 compression. Reconstruction error distributions from external labs or other scanners may differ and could require a recomputed NERD. · stated by the authors
  • Inference parameters tuned for melanoma may not transfer to non-melanoma lesions or to anomalies in other tissues; changing the filters changes the performance metrics. · stated by the authors
  • Evaluation uses only 9 melanoma slides from one institution, with no comparison against other anomaly detectors or supervised segmentation. The KDE threshold appears to have been set on the same tumor slides used for reporting, so the reported metrics may be optimistic. · noted in this summary

Who should read:Read this if you want an unsupervised way to flag tumor regions in gigapixel H&E whole slide images without annotations, or practical lessons on scaling GAN and autoencoder anomaly detection to 1024×1024 patches.

Reproducibility ledger

Nobody has reported trying to reproduce this paper yet. Did you replicate an experiment or run the code? Your report saves the next lab a week.

Sign in to file a reproducibility report.

Similarity Map
SelectedSame fieldCross-field
THISShen '23Schaumberg '17Zheng '25Liang '24Bilaloglu '19Verma '25
64% semantic matchPathology
H. Shen, J. Wu, X. Shen+6 more·bioRxiv·Jan 15, 2023