RestainNet: A self-supervised digital re-stainer for stain normalization

Bingchao Zhao, Chu Han, Xipeng Pan, Jiatai Lin, Zongjian Yi, Changhong Liang, Xin Chen, Bingbing Li, Weihao Qiu, Danyi Li, Liang Li, Ying Wang, Zaiyi Liu

Abstract

Color inconsistency is an inevitable challenge in computational pathology, which generally happens because of stain intensity variations or sections scanned by different scanners. It harms the pathological image analysis methods, especially the learning-based models. A series of approaches have been proposed for stain normalization. However, most of them are lack flexibility in practice. In this paper, we formulated stain normalization as a digital re-staining process and proposed a self-supervised learning model, which is called RestainNet. Our network is regarded as a digital restainer which learns how to re-stain an unstained (grayscale) image. Two digital stains, Hematoxylin (H) and Eosin (E) were extracted from the original image by Beer-Lambert's Law. We proposed a staining loss to maintain the correctness of stain intensity during the restaining process. Thanks to the self-supervised nature, paired training samples are no longer necessary, which demonstrates great flexibility in practical usage. Our RestainNet outperforms existing approaches and achieves state-of-the-art performance with regard to color correctness and structure preservation. We further conducted experiments on the segmentation and classification tasks and the proposed RestainNet achieved outstanding performance compared with SOTA methods. The self-supervised design allows the network to learn any staining style with no extra effort.

The Challenge of Color Inconsistency

In computational pathology, Hematoxylin and Eosin (H&E) staining is the gold standard for visualizing tissue morphology. However, "color inconsistency" remains a significant hurdle for automated analysis. Variations in tissue thickness, dye manufacturers, staining protocols, and digital scanner hardware (e.g., Aperio vs. Hamamatsu) result in significant shifts in image appearance.

While human pathologists can easily adjust to these variations, deep learning models are often sensitive to them. A model trained on images from one hospital may fail when deployed at another due to these distribution shifts. Existing normalization methods often struggle: traditional statistical methods can be too rigid and lose fine detail, while modern Generative Adversarial Networks (GANs) typically require "paired" data—the exact same tissue slice scanned on different machines—which is difficult and expensive to produce.

Methodology: Digital Re-staining

RestainNet addresses these issues by formulating normalization as a self-supervised "digital re-staining" process. The framework operates in three primary stages:

  1. De-staining: The model extracts the L-channel (luminance) from the Lab color space. This provides a grayscale structural map of the tissue, preserving high-frequency morphological details while removing color information.
  2. Dye Extraction: Utilizing Beer-Lambert’s Law, the system mathematically decomposes the original RGB image into two distinct digital dye maps: Hematoxylin (H) and Eosin (E). These maps represent the concentration of each stain at every pixel.
  3. Self-Supervised Re-staining: A U-Net-based architecture is trained to take the "unstained" L-channel and the extracted H&E maps to reconstruct the original image.
The RestainNet architecture showing the training phase (Domain A to Domain A) and the testing phase (Domain B to Domain A).

The Staining Loss

To prevent the network from "hallucinating" colors or producing biologically implausible results, the authors introduced a Staining Loss ($L_{staining}$). This loss ensures that the digital stains extracted from the generated image match the stains extracted from the original image. This forces the network to respect the biological reality of the tissue staining rather than just optimizing for visual similarity.

Experimental Setup

The model was rigorously evaluated across three distinct tasks using well-known benchmarks:

  • MITOS-ATYPIA14: Used for evaluating stain normalization performance across different scanner types.
  • Zhao et al. Colorectal Dataset: A patch-level classification dataset used to measure the impact of normalization on diagnostic accuracy.
  • MICCAI’16 GlaS (Gland Segmentation): A challenge dataset used to evaluate structural preservation during normalization.

Key Results and Insights

RestainNet achieved state-of-the-art (SOTA) performance across multiple quantitative and qualitative metrics:

  • Superior Image Quality: The model achieved a Peak Signal-to-Noise Ratio (PSNR) of 21.55 and a Structural Similarity Index (SSIM) of 0.916, outperforming existing methods in maintaining image integrity.
  • Downstream Performance Gains: On the GlaS dataset, RestainNet preprocessing improved the Dice score from 0.842 to 0.878. For colorectal cancer classification, the F1-score increased from 0.815 to 0.910.
  • Structural Preservation: Unlike GAN-based methods that can introduce artifacts or blur edges, RestainNet’s reliance on the L-channel ensures that tissue morphology remains intact.
  • Flexibility: Because it is self-supervised, the model does not require paired data. It can learn a specific laboratory's staining style simply by training on that lab's existing image archives.
Qualitative comparison of RestainNet against SOTA methods like StainGAN, STST, Vahadane, and Reinhard.

Conclusion

RestainNet provides a robust, flexible solution for stain normalization in computational pathology. By combining physics-informed dye extraction with a self-supervised reconstruction task, it achieves high color consistency without sacrificing structural detail. While the model currently focuses on correcting scanner and protocol variations, future work may explore its application in "virtual staining," potentially generating H&E visualizations from completely unstained tissue samples.

Summary updated

BibTeX
@inproceedings{zhao2022restainnet,
  author = {Bingchao Zhao and Chu Han and Xipeng Pan and Jiatai Lin and Zongjian Yi and Changhong Liang and Xin Chen and Bingbing Li and Weihao Qiu and Danyi Li and Liang Li and Ying Wang and Zaiyi Liu},
  title = {{RestainNet: A self-supervised digital re-stainer for stain normalization}},
  booktitle = {Computers},
  year = {2022},
  doi = {10.1016/j.compeleceng.2022.108304},
}
Figure