Patch Transformer for Multi-tagging Whole Slide Histopathology Images

Weijian Li, Viet-Duy Nguyen, Haofu Liao, Matt Wilder, Ke Cheng, Jiebo LuoarXiv 2019

TL;DR

The Patch Transformer is the first end-to-end deep learning framework designed to simultaneously assign multiple attribute tags (e.g., stain, species, and organ) to Whole Slide Images (WSIs). By leveraging a modified multi-head attention mechanism, the model learns to identify both the global context of a slide and the specific regions of interest (ROIs) unique to each tagging task, significantly outperforming existing single-tag and multi-instance learning methods.

What Problem Does This Paper Address?

Whole Slide Images (WSIs) are massive, high-resolution digital scans of tissue samples used in pathology. Managing these images requires accurate metadata—tags describing the stain type (e.g., H&E, IHC), the species (e.g., Human, Mouse), and the organ (e.g., Lung, Liver).

Currently, this tagging is often done manually, which is slow, subjective, and prone to error. While many researchers have applied deep learning to classify WSIs with a single tag, histopathology datasets are inherently multi-labeled. Furthermore, WSIs are too large to process at once; they must be broken into small "patches." The challenge lies in aggregating information from thousands of patches to make multiple, accurate slide-level predictions while accounting for the fact that different tags might depend on different visual features within the same slide.

Methods

The authors propose the Patch Transformer, which consists of three main stages:

  1. Visual Feature Extraction: A pre-trained ResNet-50 backbone extracts latent visual embeddings from $M$ randomly sampled patches of a WSI.
  2. Patch Transformation Module: Inspired by the Transformer architecture, this module uses multi-head attention to learn relationships between patches. Crucially, the authors modified the standard "Scaled Dot-Product Attention." Instead of mixing features (which can blur unique characteristics), they use element-wise multiplication between patch features and attention weights to preserve distinct patch identities while incorporating global context.
  3. Multi-Tag Attention (MTA) Module: This module creates specific representations for each tagging task. Since the "Organ" tag might require looking at different tissue structures than the "Stain" tag, the MTA module adaptively weights patches differently for each output head.
Fig. 1. Overview of the proposed Patch Transformer. The proposed model mainly consists of three parts: (1) Visual Feature Extraction: capturing the visual feature of each patch from the original WSI; (2) Patch Transformation Module: producing the characteristic enhanced patch representations by an attention aggregation mechanism; (3) Multi-Tag Attention Module: constructing tag-related global slide representations for final prediction leveraging the extracted patch features following the same attention format as (2).

The entire pipeline is trained end-to-end using a weighted combination of multi-class cross-entropy losses for each tag.

Datasets

The study utilized a large, diverse dataset provided by a histopathology service company:

  • Size: 4,920 Whole Slide Images.
  • Tags:
    • Stain: 3 classes (H&E, IHC, Special).
  • Species: 6 classes (Human, Monkey, Mouse, Pig, Rat, Zebrafish).
  • Organ: 16 classes (Bone, Brain, Liver, Lung, etc.).
  • Preprocessing: Images were processed at 40x resolution, with background removal via the Otsu method. During training, 32 patches ($512 \times 512$ pixels) were sampled per slide.

Key Insights and Ideas

  • Preserving Uniqueness: Standard self-attention (SDPA) tends to fuse features together. In pathology, a single diagnostic patch might be the only clue for a label. The authors' decision to use a residual connection and element-wise multiplication ensures these "needle in a haystack" features aren't washed out by the majority of the slide.
  • Task-Specific Focus: The model confirms that different tags "look" at different things. Qualitative analysis showed that the Stain head focuses on simple color patterns and large tissue areas, while the Species and Organ heads prioritize complex structures and textures that provide more contextual information.
  • Cross-Tag Synergy: By training on multiple tags simultaneously, the model exploits correlations (e.g., specific species often being associated with specific stains), leading to better performance than training separate models for each tag.

Key Results

The Patch Transformer (specifically the PT-3head-MTA variant) outperformed state-of-the-art baselines like Graph Convolutional Networks (GCN) and Deep Multiple Instance Learning (DeepMIL).

  • Quantitative: The model achieved a Macro F1 score of 0.910 and a Micro F1 score of 0.944 averaged across all tasks. It showed particularly strong gains in the complex "Organ" and "Species" tagging tasks compared to two-step patch-based methods.
  • Qualitative: Confusion matrices demonstrate high accuracy across almost all classes, with minor confusion only occurring between highly similar tissue types (e.g., different skin regions).
Fig. 2. Normalized confusion matrices of the proposed PT-3head-MTA model for Stain tag, Species tag and Organ tag.
Fig. 3. Multi-Tag Attention Module’s attention result visualization. Each WSI has three columns. Each of the three columns belongs to one of the three tags: Stain, Species, and Organ from left to right. Patches in the columns are sorted by attention weights in the corresponding tag from the top to the bottom. The ground truth tags for the four WSIs are respectively: (IHC, Human, Liver), (H&E, Mouse, Bone), (Special Stain, Rat, Kidney), (H&E, Mouse, Liver).

Limitations and Future Work

  • Resolution: The current model uses a fixed resolution. The authors suggest that incorporating multi-resolution data (mimicking how pathologists zoom in and out) could further improve organ and species identification.
  • Sampling: The model randomly samples 32 patches. While effective, more sophisticated sampling or processing more patches could capture even rarer features.
  • Applications: The authors propose that the learned slide-level features could be highly effective for WSI retrieval tasks (finding similar cases in a database).

Summary updated

BibTeX
@misc{li2019patch,
  author = {Weijian Li and Viet-Duy Nguyen and Haofu Liao and Matt Wilder and Ke Cheng and Jiebo Luo},
  title = {{Patch Transformer for Multi-tagging Whole Slide Histopathology Images}},
  year = {2019},
  eprint = {1906.04151},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1906.04151},
}

Loading related content...

Figure