Fast and scalable search of whole-slide images via self-supervised deep learning

Chengkuan Chen, Ming Y. Lu, Drew F. K. Williamson, Tiffany Chen, Andrew J. Schaumberg, Faisal MahmoodNature Biomedical Engineering 2022

Abstract

The adoption of digital pathology has enabled the curation of large repositories of gigapixel whole-slide images (WSIs). Computationally identifying WSIs with similar morphologic features within large repositories without requiring supervised training can have significant applications. However, the retrieval speeds of algorithms for searching similar WSIs often scale with the repository size, which limits their clinical and research potential. Here we show that self-supervised deep learning can be leveraged to search for and retrieve WSIs at speeds that are independent of repository size. The algorithm, which we named SISH (for self-supervised image search for histology), requires only slide-level annotations for training, encodes WSIs into meaningful discrete latent representations and leverages a tree data structure for fast searching followed by an uncertainty-based ranking algorithm for WSI retrieval. We evaluated SISH on multiple tasks and on datasets spanning over 22,000 patient cases and 56 disease subtypes. SISH can also be used to aid the diagnosis of rare cancer types for which the number of available WSIs is often insufficient to train supervised deep-learning models.

Introduction

Digital pathology has led to the creation of massive repositories of whole-slide images (WSIs)—digital files that can reach gigapixel sizes. While these archives are invaluable for research and diagnosis, searching them efficiently remains a significant computational challenge. Existing search methods typically suffer from poor scalability, where retrieval speeds decrease as the database grows ($O(n)$ or $O(n \log n)$), and heavy reliance on expert-labeled "regions of interest" (ROIs). SISH (Self-supervised Image Search for Histology) addresses these bottlenecks by providing a tool that is both fast enough for massive clinical databases and capable of learning from slide-level data alone.

Methodology

The SISH pipeline consists of several novel stages designed to transform massive images into a searchable, constant-time index.

Mosaic Generation and Preprocessing

To handle the computational load of gigapixel images, SISH utilizes a two-stage K-means clustering approach to select a "mosaic" of representative patches from a slide. This process distills the slide's essential morphological features into a manageable subset of data.

WSI patching and RGB histogram extraction process used to identify representative patches for mosaic generation.

Discrete Latent Encoding

Rather than using standard continuous vector embeddings, SISH employs a Vector Quantized-Variational AutoEncoder (VQ-VAE) or similar encoder architectures (such as DenseNet-121). This maps image patches into discrete latent codes (integers), which are significantly more efficient for indexing and retrieval than floating-point vectors.

Feature extraction pipeline showing the use of an encoder and DenseNet-121 to generate discrete binarized features for indexing.

Indexing and Retrieval

These discrete codes are stored in a Van Emde Boas (vEB) tree. This classical data structure enables search, insertion, and deletion in $O(\log \log M)$ time. Since $M$ (the maximum index value) is a fixed constant, the search speed is effectively independent of the number of slides in the database ($O(1)$ complexity). A Guided Search Algorithm (GSA) retrieves candidates from the tree, followed by an uncertainty-based ranking module to filter noise and return the most relevant matches.

Results

The authors validated SISH using over 22,000 patient cases spanning 56 disease subtypes from cohorts including TCGA, CPTAC, and Brigham and Women’s Hospital (BWH).

  • Constant-Time Scalability: SISH's median query speed remained near-constant even as the database size grew from 500 to over 11,000 slides. On a database of 13.4 million images, SISH returned results in approximately 0.3 seconds.
  • Efficiency Gains: SISH was 15x to 230x faster than the previous state-of-the-art (Yottixel) on large datasets.
  • Accuracy and Interpretability: SISH consistently outperformed existing methods in disease subtype retrieval accuracy. In validation studies, board-certified pathologists agreed that the ROIs retrieved by SISH were morphologically relevant in over 70% of cases.

Discussion and Conclusion

SISH demonstrates that discretization is the key to enabling high-speed tree structures for pathology search. By achieving state-of-the-art accuracy using only slide-level labels, it proves that expensive pixel-level manual labeling is not a prerequisite for effective search. Furthermore, SISH serves as a powerful tool for diagnosing rare diseases, as it can find similar cases in global archives without requiring large training sets for specific disease classifiers. Future work will focus on multimodal integration, combining WSIs with genomic data and electronic health records for more holistic diagnostic support.

Summary updated

BibTeX
@inproceedings{chen2022fast,
  author = {Chengkuan Chen and Ming Y. Lu and Drew F. K. Williamson and Tiffany Chen and Andrew J. Schaumberg and Faisal Mahmood},
  title = {{Fast and scalable search of whole-slide images via self-supervised deep learning}},
  booktitle = {Nature Biomedical Engineering},
  year = {2022},
  doi = {10.1038/s41551-022-00929-8},
}
Figure