A method for virtually staining hematoxylin-eosin images into Masson tricolor images

By constructing an unpaired data set and introducing a pathological prior knowledge base, and using a one-way mapping network for virtual staining, the problems of unstable training process and inconsistent staining in the GAN virtual staining method are solved, and efficient and accurate H&E images are transferred to Masson III. Virtual staining of color images reduces costs and improves diagnostic objectivity.

CN114842272BActive Publication Date: 2024-09-27TSINGHUA SHENZHEN INTERNATIONAL GRADUATE SCHOOL
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210635864.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-06
Publication Date
2024-09-27
Estimated Expiration
2042-06-06

AI Technical Summary

Technical Problem

Existing GAN-based virtual staining methods require highly demanding imaging systems and fully paired images when acquiring training data, resulting in an unstable and difficult-to-converge training process, and the inability to effectively perceive tissue and disease heterogeneity of histopathological images. , resulting in poor virtual dyeing effect.

Method used

Using unpaired hematoxylin-eosin image and Masson three-color image data sets, by constructing a pathology prior knowledge base, using a one-way mapping network for training, and introducing pathology prior guidance loss during the training process, fine-tuning the network to Achieve more stable dyeing results.

Benefits of technology

It achieves efficient and accurate virtual staining from H&E images to Masson tricolor images without requiring a lot of manpower and material resources to construct paired data sets, outputs images with staining consistency, reduces the subjectivity of diagnosis, and achieves Masson The standardization and consistency of tri-color dyeing reduces time, economic and labor costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114842272B
    Figure CN114842272B
Patent Text Reader

Abstract

The present invention discloses a method for virtually staining a hematoxylin-eosin image into a Masson tricolor image, including: constructing a data set of unpaired hematoxylin-eosin images and Masson tricolor images, randomly intercepting blocks from the full slide image of the data set, and obtaining a hematoxylin-eosin block set and a Masson tricolor block set; annotating the degree of fibrosis of the blocks, and constructing a pathological prior knowledge base with two annotated block sets; using the hematoxylin-eosin image as the source domain and the Masson tricolor image as the target domain, training a one-way mapping network; selecting a subset of blocks with a color deviation within a preset range from the Masson tricolor block set to fine-tune the trained one-way mapping network; inputting the hematoxylin-eosin image into the fine-tuned one-way mapping network, and outputting a virtually stained Masson tricolor image. The present invention realizes an accurate, true and efficient virtual staining process from H&E to Masson tricolor by simply constructing a pathological prior knowledge base without constructing a paired data set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of tissue pathology image processing, and in particular to a method for virtually staining a hematoxylin-eosin image into a Masson tricolor image. Background Art

[0002] Liver fibrosis is a pathological repair response caused by liver damage factors. It is an inevitable step for various chronic liver diseases to develop into cirrhosis. The assessment of liver fibrosis is of great significance to the progression, treatment and prognosis of liver disease. Timely and accurate assessment can avoid or delay cirrhosis, and even reverse liver fibrosis and cirrhosis. At present, histopathological examination of liver biopsy samples is the gold standard for the assessment of liver fibrosis, among which histological staining is the basic tool for diagnosis. In clinical practice, hematoxylin-eosin (H&E) staining is the most widely used staining technique, which can reflect the contrast between cell nuclei and non-nuclear components; while Masson trichrome is a special staining that can improve the contrast between collagen fibers and non-collagen fibers, thus providing more necessary information for fibrosis assessment compared with H&E. However, Masson trichrome has problems such as high cost (time cost, economic cost, and high health cost for patients) and unstable staining quality. Therefore, virtual staining has been proposed to convert existing H&E staining into corresponding Masson trichrome staining.

[0003] Virtual staining is usually implemented under the framework of GAN (Generative Adversarial Network). At present, some works have realized virtual staining targeting Masson trichrome. Rivenson et al. and Zhang et al. converted wide-field fluorescence images and quantitative fiber microscopy images into various staining images including Masson trichrome staining in articles such as "Virtual histological staining of unlabelled tissue-autofluorescence images via deep learning", "Phasestain: the digital staining of label-free quantitative phase microscopy images using deep learning" and "Digital synthesis of histological stains using micro-structured and multiplexed virtual staining of label-free tissue". There are two problems with these methods. First, the requirements for the imaging system to obtain training data are higher; second, the training set contains fully paired images, which are difficult to obtain and require a lot of time and labor costs. In order to alleviate the need for fully paired training data, J.-Y. Zhu, T. Park, et al. proposed a bidirectional mapping, unpaired image translation framework CycleGAN in "Unpaired image-to-image translation using cycle-consistent adversarial networks". Part et al. proposed a GAN-based unidirectional mapping network (Contrastive Unpaired Transform, CUT) in "Unpaired image-to-image translation using cycle-consistent adversarial networks". However, virtual staining based on GAN always faces two problems. First, the training process is unstable, which makes it difficult to converge the training process of virtual staining. Second, although the homogeneous information corresponding to the structural staining is retained, in the absence of regularization related to image features, the generator still cannot well perceive the tissue and disease heterogeneity of histopathological images, so as to efficiently learn the salient features required for virtual staining. Summary of the invention

[0004] The purpose of the present invention is to overcome the defects of the above-mentioned background technology that paired training sets are difficult to obtain, the structure cannot be stained well, and the staining is not standard, and to provide a method for virtually staining a hematoxylin-eosin image into a Masson tricolor image.

[0005] To achieve the above object, the present invention adopts the following technical solutions:

[0006] A method for virtually staining a hematoxylin-eosin image into a Masson tricolor image comprises the following steps: S1, constructing a data set of unpaired hematoxylin-eosin images and Masson tricolor images, and randomly intercepting and preprocessing blocks from the full slide images of the data set to obtain a hematoxylin-eosin block set and a Masson tricolor block set; S2, annotating the degree of fibrosis of the blocks in the hematoxylin-eosin block set and the Masson tricolor block set, and using the annotated hematoxylin-eosin block set and Masson tricolor block set to obtain a Masson tricolor image. A pathology prior knowledge base is constructed by using the hematoxylin-eosin image as the source domain and the Masson tricolor image as the target domain to train the one-way mapping network guided by the pathology prior knowledge base; S4, a plurality of blocks with dyeing color deviation within a preset range are selected from the Masson tricolor block set as a subset to fine-tune the one-way mapping network trained in step S3; S5, the hematoxylin-eosin image to be processed is input into the one-way mapping network fine-tuned in step S4, and a virtually stained Masson tricolor image is output.

[0007] In some embodiments, the preprocessing in step S1 refers to performing RGB color normalization on the image block.

[0008] In some embodiments, in step S2, the degree of fibrosis of the image block is marked according to the amount of fibrosis;

[0009] Among them, the absence of any stained fibers on the block is defined as no fibrosis, and the label is 0; the presence of stained fibers in the cell interval on the block is defined as less fibrosis, and the label is 1; the presence of stained fibers in non-cell interval positions on the block is defined as more fibrosis, and the label is 2.

[0010] In some embodiments, the training of the one-way mapping network guided by the pathological prior knowledge base in step S3 includes introducing the loss guided by the pathological prior into the loss function of the one-way mapping network; in the pathological prior guidance, the hematoxylin-eosin image, the physically stained Masson trichrome image, and the Masson trichrome image obtained by virtual staining of the hematoxylin-eosin image are all classified to obtain a prediction of the degree of fibrosis, and then the prediction is supervised by manual annotation.

[0011] In some embodiments, when step S3 is performed for training, given an unpaired training set {{x∈X},{y∈Y}}, the image output from the one-way mapping network is represented as:

[0012]

[0013] Among them, G is the generator, which consists of an encoder G encoder and a decoder G decoder G(x) is the generator function; X and x represent the set of hematoxylin-eosin images and the samples in the set, respectively; Y and y represent the set of Masson tri-color images and the samples in the set, respectively.

[0014] In some embodiments, the loss function of the one-way mapping network is:

[0015] L CUT =L GAN (G,D,X,Y)+λ X L patchNCE (G,H,X)+λ Y L patchNCE (G,H,Y)

[0016] Among them, L GAN is the adversarial discrimination loss, D is the decoder, H is a two-layer multi-layer perceptron network, L PatchNCE refers to the multi-layer patch-based mutual information loss function, λ X represents the patch loss weight of the hematoxylin-eosin image, λ Y Represents the patch loss weight of the Masson tri-color image.

[0017] In some embodiments, the pathology prior guided loss function is:

[0018]

[0019] Among them, F is a multi-layer perceptron, which acts as a classifier to decode the encoder The extracted feature vector; ω1 is the weight of the pathological prior loss of the virtually stained Masson trichrome image, ω2 is the weight of the pathological prior loss of the real Masson trichrome image, and ω3 is the weight of the pathological prior loss of the hematoxylin-eosin image; is the image output from the one-way mapping network A collection of; E y~Y (·), E x~X (·) denotes mathematical expectation, and different subscripts represent the average of different losses in brackets. represents the mean of the pathological prior loss of the virtually stained Masson tricolor image, E y~Y (·) represents the mean of the pathological prior loss of the real Masson tri-color image; E x~X (·) represents the mean of the pathological prior loss of hematoxylin-eosin images; G enc (·) indicates encoding operation, B y , B x The samples are Labeling of y and x for the degree of fibrosis.

[0020] In some embodiments, the step of selecting a number of image blocks whose color deviation is within a preset range in step S4 includes: selecting a number of image blocks whose standard deviation of a certain color channel is less than a preset threshold as the subset.

[0021] In some embodiments, in step S4, the step of fine-tuning the trained one-way mapping network includes:

[0022] The set Y of Masson three-color images is used as the source domain of fine-tuning, and the subset is used as the target domain of fine-tuning to perform fine-tuning training. The training process keeps the parameters of the encoder obtained by the training in step S3 unchanged, only updates the parameters of the decoder, and does not introduce pathological prior guidance.

[0023] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the steps of the aforementioned method of virtually staining a hematoxylin-eosin image into a Masson tricolor image.

[0024] The present invention has the following beneficial effects:

[0025] Without consuming a lot of manpower and material resources to construct a paired data set, the present invention realizes an accurate, true and efficient virtual staining process from H&E images to Masson trichrome images through the simple construction of a pathological prior knowledge base. Only a large number of unpaired images are needed to realize training, which can make full use of a large amount of data without time-consuming and labor-intensive processing. The present invention uses pathological priors to guide training, so that the effects of virtual staining and physical staining are closer, and virtual staining images with staining consistency can be output, reducing the subjectivity of diagnosis. By constructing a subset of blocks with relatively consistent staining styles (the color deviation of staining is within a small preset range), the network is fine-tuned, and the standardization and consistency of Masson trichrome staining that is difficult to achieve with physical staining is realized, which lays a foundation for accurate, objective and efficient diagnosis of liver fibrosis. At the same time, the present invention can be easily embedded in the pathological digitization process, effectively saving time, economic and labor costs, and reducing the burden on patients. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 is a flow chart of a method for virtually staining a hematoxylin-eosin image into a Masson tricolor image in an embodiment of the present invention;

[0027] Figure 2a is a schematic diagram of a method for virtually staining a hematoxylin-eosin image into a Masson tricolor image in an embodiment of the present invention;

[0028] Figure 2b Schematic diagram of the overall network framework and virtual dyeing process in an embodiment of the present invention;

[0029] Figure 3a is an unprocessed H&E image in an embodiment of the present invention;

[0030] Figure 3b It is the Masson tri-color image obtained by virtual staining using the initial CUT;

[0031] Figure 3c is a virtually stained Masson tricolor image obtained by using the CUT+pathology prior guidance method in an embodiment of the present invention;

[0032] Figure 3d is a real Masson tri-color image paired with an H&E image for result evaluation in an embodiment of the present invention;

[0033] Figure 4a is a real Masson trichrome staining image in an embodiment of the present invention;

[0034] Figure 4b is a virtually stained Masson tricolor image obtained by the CUT+pathology priori guided method in an embodiment of the present invention;

[0035] Figure 4c It is a virtual stained Masson tricolor image obtained by the CUT+pathology prior guidance+overlap method in an embodiment of the present invention;

[0036] Figure 4d It is a virtual stained Masson tricolor image obtained by the CUT+pathology prior guidance+fine-tuning method in an embodiment of the present invention;

[0037] Figure 4e It is a virtual stained Masson tricolor image obtained by the CUT+pathology prior guidance+fine-tuning+overlap method in an embodiment of the present invention;

[0038] Description of reference numerals:

[0039] 11-True Hematoxylin-Eosin Whole Slide Image (H&E WSI)

[0040] 12-H&E image blocks obtained by cropping H&E WSI

[0041] 13-Encoder

[0042] 14-Decoder

[0043] 15-Masson tricolor block obtained by virtual dyeing

[0044] 16-Masson three-color WSI obtained by splicing the Masson three-color blocks obtained by virtual dyeing

[0045] 17-Real Masson trichrome staining image

[0046] 21-Classifier

[0047] 22-Predicted Label

[0048] 23-True Label

[0049] 31-H&E Image 1

[0050] 32-H&E Image 2

[0051] 33-H&E Image 3

[0052] Masson tricolor image obtained by virtual staining of H&E image by 34-CUT

[0053] Masson tricolor image obtained by virtual staining of H&E image by 35-CUT

[0054] Masson tri-color image obtained by 36-CUT triple virtual staining of H&E image

[0055] Masson tricolor image obtained by virtual staining of H&E image by 37-CUT+P-feat

[0056] Masson tricolor image obtained by virtual staining of H&E image by 38-CUT+P-feat

[0057] Masson tricolor image obtained by triple virtual staining of H&E image by 39-CUT+P-feat

[0058] 40-Masson tri-color image obtained by real staining of H&E image

[0059] 41-Masson tricolor image obtained by real staining of H&E image

[0060] 42-Masson tri-color image obtained by three true staining of H&E image

[0061] 43-Masson tricolor image obtained by four true staining of H&E image

[0062] 44-Masson trichrome image obtained by five true stainings of H&E images

[0063] 45-Masson tricolor image obtained by six true staining of H&E image

[0064] Masson tricolor image obtained by four virtual stainings of H&E image by 46-CUT

[0065] Masson tricolor image obtained by 47-CUT five virtual stainings of H&E images

[0066] Masson tricolor image obtained by six virtual stainings of H&E images by 48-CUT

[0067] Masson tricolor image obtained by four virtual staining of H&E image by 49-CUT+P-feat+overlap

[0068] Masson tricolor image obtained by five virtual staining of H&E image by 50-CUT+P-feat+overlap

[0069] Masson tricolor image obtained by six virtual staining of H&E image by 51-CUT+P-feat+overlap

[0070] Masson tricolor image obtained by four virtual staining of H&E image by 52-CUT+P-feat+Finetune

[0071] Masson tricolor image obtained by five virtual staining of H&E image by 53-CUT+P-feat+Finetune

[0072] Masson tricolor image obtained by six virtual staining of H&E images with 54-CUT+P-feat+Finetune

[0073] Masson tricolor image obtained by four virtual staining of H&E image by 55-CUT+P-feat+Finetune+overlap

[0074] Masson tricolor image obtained by five virtual stainings of H&E image using 56-CUT+P-feat+Finetune+overlap

[0075] Masson tricolor image obtained by six virtual staining of H&E image by 57-CUT+P-feat+Finetune+overlap DETAILED DESCRIPTION

[0076] The present invention will be further described below in conjunction with the accompanying drawings and specific implementation methods.

[0077] The embodiment of the present invention provides a method for virtually staining a hematoxylin-eosin image into a Masson tricolor image, referring to Figure 1 The method comprises the following steps S1 to S5:

[0078] S1. Construct a data set of unpaired hematoxylin-eosin images and Masson tricolor images, and randomly extract tiles from the full slide images of the data set and perform preprocessing to obtain a hematoxylin-eosin tile set and a Masson tricolor tile set. In some embodiments, the preprocessing is to normalize the RGB color of the tile.

[0079] S2, annotating the fibrosis degree of the blocks in the hematoxylin-eosin block set and the Masson tricolor block set, and constructing a pathology prior knowledge base using the annotated hematoxylin-eosin block set and the Masson tricolor block set. In this embodiment, the pathology prior knowledge base is a liver fibrosis-related pathology prior knowledge base.

[0080] S3, using hematoxylin-eosin images as source domains and Masson trichrome images as target domains, and using the unpaired dataset of step S1 to train a GAN-based unidirectional mapping network (CUT network) guided by pathological prior knowledge;

[0081] S4. Select a portion of the blocks with color deviation within a preset range from all Masson tricolor blocks as a subset, and use the subset to fine-tune the trained CUT network. "Color deviation" refers to the color deviation of the slice image caused by factors such as dye concentration, dyeing time, and temperature changes in the dyeing environment caused by human and machine operations in the pathological film making process. For example, the fibers on the Masson tricolor slice may be dyed dark blue, or "over-dyed" and "under-dyed", which ultimately leads to uneven and inconsistent dyeing of each slice. In order to enable the CUT network to eventually output a virtual dyed Masson tricolor image with a relatively consistent dyeing style (including dyeing intensity, saturation, uniformity, etc.), in the embodiment of the present invention, blocks with similar overall dyeing intensity, saturation, etc. are selected as subsets, that is, a number of blocks with relatively small dyeing color deviations are selected to constitute a subset, and even only one block can be selected for fine-tuning. In an embodiment of the present invention, more than two blocks with color deviations within a preset range are selected to form the subset, such as selecting 10 blocks with smaller color deviations from all Masson three-color blocks, or another 10 blocks with smaller color deviations. The color deviation between blocks can be measured by the standard deviation of a channel in the R, G, and B channels of the blocks. For example, if the standard deviation of the channel values ​​of several blocks is small, it means that the color deviation of the dyeing of these blocks is small and the dyeing style is similar. Specifically, several blocks whose standard deviation of the R channel (or the G channel or the B channel) is less than the preset threshold σ can be selected to form the subset. The value of the preset threshold σ here can be preset according to actual needs. In one embodiment of the present invention, σ=50 is selected, which means that several blocks with a standard deviation of the R channel within 50 can be selected to form a subset. It should be understood that σ=50 here is only an example, and other values ​​can be selected according to actual conditions. The present invention does not limit the threshold value. As long as the CUT network is fine-tuned by selecting a subset of blocks with similar staining styles (staining intensity, saturation, uniformity, etc.) so as to allow the CUT to output a Masson three-color image with better staining consistency, it should be regarded as the protection scope of the present invention.

[0082] S5. Input the hematoxylin-eosin image to be processed into the CUT network fine-tuned in step S4, and output a virtually stained Masson tricolor image.

[0083] The specific steps are as follows:

[0084] S1. Liver biopsy data collected in the hospital can be used to construct a dataset of unpaired H&E images and Masson tri-color images. The dataset comes from 72 cases of fibrosis of different degrees and contains 200 whole slide images (Whole Slide Image, WSI).

[0085] The WSI was scaled to a resolution of 0.216 um / pixel, and 797 and 936 256*256 pixel tiles were cut and randomly selected from the WSIs of the H&E image and Masson trichrome image, respectively, for steps S1 and S2, of which 384 samples were used as a subset in step S3 for staining fine-tuning.

[0086] S2. In H&E blocks and Masson tricolor blocks, the blocks are labeled 0, 1, and 2 according to the amount of fibrosis (none, less, more), and the blocks and labels are used to form a pathological prior knowledge base. Among them, none: no fibers are stained on the image. Less: fibers in the cell interval are stained. More: fibers in non-cell intervals such as in the liver lobule and portal area are stained. That is, if no fibers are stained on the block, it is defined as no fibrosis, and the label is 0; if fibers in the cell interval are stained on the block, it is defined as less fibrosis, and the label is 1; if fibers in non-cell intervals are stained on the block, it is defined as more fibrosis, and the label is 2.

[0087] S3, using H&E images as the source domain and Masson tri-color images as the target domain, training the CUT network guided by pathological prior knowledge;

[0088] The CUT architecture can initially virtually dye H&E images into Masson tri-color images. Given an unpaired training set {{x∈X},{y∈Y}}, the image output from CUT can be represented as:

[0089]

[0090] Where X and x are the H&E image set and the samples in the H&E image set respectively; Y and y are the Masson three-color image set and the samples in the Masson three-color image set respectively. G(x) is the generator function, G is the generator, which is composed of an encoder G encoder and a decoder G decoder The loss function of CUT is:

[0091] L CUT =L GAN (G,D,X,Y)+λ X L PatchNCE (G,H,X)+λ Y L PatchNCE (G,H,Y) (2)

[0092] Among them, L GAN is the adversarial discrimination loss, D is the decoder, H is a two-layer multi-layer perceptron network, LPatchNCE refers to the multi-layer patch-based mutual information loss function, λ X represents the patch loss weight of the hematoxylin-eosin image, λ Y Represents the patch loss weight of the Masson tri-color image.

[0093] On the basis of the existing CUT, in order to ensure that the structural features required for virtual staining are efficiently extracted, we introduced pathological prior guidance. The guidance loss is defined as:

[0094]

[0095] Among them, F is a multi-layer perceptron, which acts as a classifier to decode the encoder The extracted feature vector; ω1 is the weight of the pathological prior loss of the virtually stained Masson trichrome image, ω2 is the weight of the pathological prior loss of the real Masson trichrome image, and ω3 is the weight of the pathological prior loss of the hematoxylin-eosin image; is the image output from the one-way mapping network A collection of; E y~Y (·), E x~X (·) denotes mathematical expectation, and different subscripts represent the average of different losses in brackets. represents the mean of the pathological prior loss of the virtually stained Masson tricolor image, E y~Y (·) represents the mean of the pathological prior loss of the real Masson tri-color image; E x~X (·) represents the mean of the pathological prior loss of hematoxylin-eosin images; G enc (·) indicates encoding operation, B y , B x The samples are In the pathological prior guidance, H&E images, Masson tricolor images of physical staining, and Masson tricolor images obtained from H&E virtual staining are all classified to obtain the prediction of fibrosis degree, and then the prediction is supervised by manual annotation. and x have exactly the same structure and exactly the same fibrillation degree markers, so we think that:

[0096]

[0097] On this basis, we set ω1=2ω2=2ω3, so that the final pathological prior guided loss of the embodiment of the present invention is defined as:

[0098]

[0099] We set the weights of both items in formula (5) to 1, and we can get the loss function of the entire training phase of step S3 as:

[0100] L=L CUT +L P-feat (6)

[0101] S4. Since the color deviation of the target domain image (Masson tri-color image) used in the training set is very large, it is difficult for the decoder to converge. For a WSI that is cut into many tiles, when each tile is virtually colored by the model trained by S3, the color distribution of the virtual WSI may be very uneven. Therefore, we select Masson tri-color images with more consistent coloring from the set Y to form a subset Y*, take Y as the source domain, and take Y* as the target domain. We further fine-tune the trained CUT and keep the encoder G obtained from S3. encoder The parameters of G remain unchanged, and only the decoder G is updated during training. decoder Moreover, this fine-tuning stage only uses the original loss function of CUT, without introducing pathological prior guided loss.

[0102] S5. Input the hematoxylin-eosin image to be processed into the CUT network fine-tuned in step S4, and output a virtually stained Masson tricolor image.

[0103] In the embodiment of the present invention, the Adams optimizer is used for training to minimize the training loss. The initial learning rates for preliminary training and fine-tuning are set to 2e-4 and 2e-5 respectively. In the preliminary training, 200 generations of warmup training are used, the total number of training generations is set to 200, and the learning rate is linearly decayed to 0.

[0104] The embodiment of the present invention firstly extracts blocks from the data set and constructs a pathology prior knowledge base through manual annotation; secondly, accurate virtual staining from H&E to Masson trichrome is achieved by training a CUT-based network; finally, a subset consisting of blocks with staining color deviations within a preset range is constructed to fine-tune the encoder to achieve consistency of the final output virtual staining.

[0105] In step S1, an unpaired dataset is constructed using liver biopsy data collected from the hospital, and H&E tiles and Masson tricolor tiles are cropped from WSI. The selected biopsy data come from liver diseases of different types and degrees of fibrosis, which can effectively reflect disease heterogeneity and tissue heterogeneity, laying the foundation for the generalization performance of the virtual staining model. Table 1 below is a description of the composition of the constructed dataset:

[0106] Table 1

[0107]

[0108] Step S2 is to assign labels 0, 1, and 2 to the tiles in the H&E and Masson tricolor tiles according to the amount of fibrosis (none, less, more), and use images and labels to form a pathology prior knowledge base. The purpose of building a pathology prior knowledge base is to use the label information attached to the database to provide constraints for the encoding process of the encoder. This has two benefits: first, it provides additional supervision information for the encoding process of the encoder and stabilizes the entire adversarial training process; second, it allows the encoder to pay more attention to the information of the fiber area, thereby extracting the most significant features related to virtual staining and achieving more accurate and realistic virtual staining.

[0109] Step S3 uses H&E images as the source domain and Masson trichromatic images as the target domain to train the CUT network guided by pathological prior knowledge. In addition to using the loss of the CUT network itself, this process also introduces pathological prior guided loss. In the pathological prior guided loss, the features extracted by the encoder are further used to predict the degree of fibrosis of the image block, so that the encoding process of the encoder is guided by the pathological prior knowledge base. Its advantages are the same as those of step S1.

[0110] Step S4 forms a subset of the Masson three-color images whose color deviations are within a preset range, and performs decoder G decoder Fine-tuning. During the fine-tuning process, only the loss of the CUT model is used for training. Before fine-tuning, the virtual staining outputs Masson tricolor images with inconsistent staining and large color deviation. After fine-tuning, it can output virtual staining Masson tricolor images with relatively consistent staining intensity and saturation, achieving the consistency of virtual staining. In other words, it achieves the standardization of staining, which is difficult to achieve with physical staining in clinical processes.

[0111] The embodiment of the present invention is based on unpaired images and uses a CUT network based on a GAN framework to achieve virtual staining from H&E to Masson trichrome, build a pathology prior knowledge base, and introduce pathology prior guided loss based on the original loss of the CUT network to achieve a pathology prior guided virtual staining training process, so that the model can extract significant features related to virtual staining; fine-tune the model based on a subset of staining color deviations within a preset range, so that the virtual staining model can achieve staining standardization and staining consistency. Figure 2aAs shown, the embodiments of the present invention randomly extract blocks from unpaired hematoxylin-eosin whole slide images and Masson trichrome staining images (or Masson trichrome images for short), and annotate them to form a preliminary training set. Then, patches with consistent staining in the target domain are selected as new target domains to form a fine-tuning training set. In step S3, the generator G (composed of an encoder 13 and a decoder 14) is trained with the preliminary training set. The encoder is frozen, and the decoder is trained with the fine-tuning training set in step S4. Weight loading in the figure refers to loading the trained model parameters in step S3 into the model of step S4, and block selection refers to selecting blocks with better staining consistency from the Masson trichrome blocks in the initial training set to form a subset. Weight freezing refers to freezing the encoder G in the fine-tuning training of step S4. encoder The weights of the decoder G are updated only decoder The weight of Figure 2a As shown, when the trained CUT is used to implement the method of virtually staining a hematoxylin-eosin image into a Masson tricolor image, an H&E block 12 is first randomly intercepted from the real hematoxylin-eosin whole slide image 11 to be processed, and then enters the encoder 13 of the CUT network for encoding, extracts features, and is then decoded by the decoder 14 to output a virtually stained Masson tricolor block 15. The virtually stained Masson tricolor block 15 is then spliced ​​to obtain a virtually stained Masson tricolor WSI 16, which is finally compared with the real Masson tricolor stained image 17.

[0112] like Figure 2b As shown in the figure, the contrast loss based on the image block refers to the loss function in CUT, the pathology classifier 21 is the pathology prior prediction part, the predicted label 22 refers to the classification result of the output feature of the encoder (characterizing the qualitative size of the fiber amount in this image block), and the real label 23 is the artificial label given in the pathology prior library. The constraints provided by using contrast unpaired training with a small data set are too loose, and the encoder cannot extract accurate features. Adding additional supervision can obtain better virtual staining performance,

[0113] The following discusses the superiority of the method from the perspective of quantitative and qualitative indicators. The quantitative indicators use Peak Signal to Noise Ratio (PSNR), Structural Similarity (SSIM), MultiScale Structural Similarity (MS-SSIM), Mutual Information (MI) and Information Fidelity Criterion (IFC). These indicators can be used to evaluate the similarity of two images. We manually captured the basically corresponding blocks from the test set for more accurate evaluation. The results are shown in Table 2:

[0114] Table 2

[0115]

[0116] The box-selected result represents the best result. The method of the embodiment of the present invention adopts fine-tuning (Finutune) based on CUT, introducing pathology prior loss (Pathology Prior-guided Feature Loss, P-feat Loss) and a subset of staining color deviation within a preset range, which is named CUT+P-feat Loss+Finetune in the table. Other comparison methods in the table are methods of eliminating certain modules or directly evaluating H&E images. As can be seen from Table 2, the method of the present invention can make virtual staining closest to real staining. Specifically, PSNR, SSIM, MS-SSIM, MI, and IFC are all commonly used indicators for evaluating the similarity of two images. Before the evaluation, the H&E images and paired Masson tricolor images in the test set are first annotated (different from constructing a pathology prior knowledge base), and they are annotated as 0 (no fiber), 1 (intercellular fibrosis), 2 (non-intercellular fibrosis), and 3 (non-intercellular fiber). It should be noted that the concepts of annotation 2 and annotation 3 are different. The presence of fibers does not mean that there is "fibrosis". Label 3 refers to the inherent fibers of the tissue (such as the fibers of the blood vessel wall), and label 2 refers to the fibrosis caused by the lesion, so these two situations should be evaluated separately. Label 0 means no fibers, so no evaluation is required. For the Masson tricolor virtual staining evaluation, the results of label 1, label 2, and label 3 need to be compared. In Table 2, the embodiment of the present invention (CUT+P-feat Loss+Finetune) is the best in label 1, label 2, label 3, and Mean for most indicators. Therefore, its virtual staining performance is closest to real physical staining.

[0117] The embodiment of the present invention also intuitively displays the results with qualitative indicators:

[0118] First, the accuracy of dyeing. Figure 3a , Figure 3b , Figure 3c , Figure 3d As shown, the CUT staining method based on pathological prior guidance, i.e., the method of this embodiment, can accurately stain the fiber area of ​​the H&E image compared with the CUT staining method of the prior art. The result of virtual staining is very different from the result of Masson trichrome staining of physical staining, covering areas of fibrosis of different degrees. Figure 3a represents unprocessed H&E images, (H&E image one 31, H&E image two 32, H&E image three 33), Figure 3b represents Masson tricolor images obtained by virtual staining using CUT (Masson tricolor image 34 obtained by virtual staining of CUT on H&E image 1, Masson tricolor image 35 obtained by virtual staining of CUT on H&E image 2, Masson tricolor image 36 obtained by virtual staining of CUT on H&E image 3), Figure 3c represents the virtual stained Masson tricolor images obtained by using the CUT+pathology prior guided method (Masson tricolor image 37 obtained by virtual staining of H&E image 1 by CUT+P-feat, Masson tricolor image 38 obtained by virtual staining of H&E image 2 by CUT+P-feat, Masson tricolor image 39 obtained by virtual staining of H&E image 3 by CUT+P-feat), Figure 3d Represents real Masson trichrome images paired with H&E images for result evaluation (Masson trichrome image 40 obtained by real staining of H&E image one, Masson trichrome image 41 obtained by real staining of H&E image two, Masson trichrome image 42 obtained by real staining of H&E image three).

[0119] Second, the uniformity of dyeing. Figure 4a , Figure 4b , Figure 4c , Figure 4d , Figure 4e Different virtual coloring effects are shown. Figure 4a Represents true Masson trichrome staining images (Masson trichrome image 43 obtained by true staining of H&E image four, Masson trichrome image 44 obtained by true staining of H&E image five, and Masson trichrome image 45 obtained by true staining of H&E image six). Figure 4bRepresents the virtually stained Masson tricolor images obtained by the CUT+pathology prior-guided method, among which (Masson tricolor image 46 obtained by virtually staining CUT to H&E image four, Masson tricolor image 47 obtained by virtually staining CUT to H&E image five, Masson tricolor image 48 obtained by virtually staining CUT to H&E image six). Figure 4c Indicates the virtual stained Masson tricolor images obtained by CUT+pathological prior guidance+overlap method, among which (Masson tricolor image 49 obtained by virtual staining of H&E image 4 by CUT+P-feat+overlap, Masson tricolor image 50 obtained by virtual staining of H&E image 5 by CUT+P-feat+overlap, Masson tricolor image 51 obtained by virtual staining of H&E image 6 by CUT+P-feat+overlap). Overlap means that when the model is inferring, the step size of the intercepted block is smaller than the block size, that is, the same area of ​​the same block may be inferred multiple times and the average value is taken to obtain the final virtual staining result, which is more useful in improving staining consistency but more time-consuming. Figure 4d : represents the virtual stained Masson tricolor image obtained by CUT+pathological prior guidance+fine-tuning method, among which (Masson tricolor image 52 obtained by virtual staining H&E image 4 by CUT+P-feat+Finetune, Masson tricolor image 53 obtained by virtual staining H&E image 5 by CUT+P-feat+Finetune, Masson tricolor image 54 obtained by virtual staining H&E image 6 by CUT+P-feat+Finetune). Compared with the CUT+P-feat+overlap method, the method of the present invention replaces the overlap operation with fine-tuning (Fientune), and realizes the staining consistency based on single reasoning. Figure 4eThe virtual stained Masson tricolor images obtained by the CUT+pathological prior guidance+fine-tuning+overlap method (Masson tricolor image 55 obtained by virtual staining of H&E image 4 by CUT+P-feat+Finetune+overlap, Masson tricolor image 56 obtained by virtual staining of H&E image 5 by CUT+P-feat+Finetune+overlap, Masson tricolor image 57 obtained by virtual staining of H&E image 6 by CUT+P-feat+Finetune+overlap). Compared with the staining effect diagram of the method without fine-tuning, the staining uniformity and consistency of this embodiment have been significantly improved; compared with the staining effect of the method using the overlap operation, this embodiment can be comparable to the staining uniformity of the two while avoiding a large amount of calculation. Note: The overlap method means that the virtual staining model infers different areas of the same block multiple times during the inference process, and takes the average of the multiple results as the final result of the area. The calculation cost and time cost of this operation are very high.

[0120] The embodiment of the present invention is based on the CUT network of the GAN framework, and proposes an H&E-Masson three-color virtual staining method guided by prior knowledge of histopathology without any paired images. The method is used in the histopathological evaluation process of liver fibrosis to directly virtually stain the H&E image into a Masson three-color image through calculation, thereby avoiding a time-consuming, material-intensive and multi-step staining process. The embodiment of the present invention solves the problems of difficulty in obtaining paired training sets, inability to stain structures well, and non-standard staining.

[0121] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art of the present invention, several equivalent substitutions or obvious variations can be made without departing from the concept of the present invention, and the performance or use is the same, which should be regarded as belonging to the protection scope of the present invention.

Claims

1. A method for virtually staining a hematoxylin-eosin image into a Masson tricolor image, characterized in that: The steps include: S1. Construct a dataset of unpaired hematoxylin-eosin images and Masson trichrome images, and randomly extract image blocks from the whole slide images in the dataset and perform preprocessing to obtain a hematoxylin-eosin image block set and a Masson trichrome image block set; S2, annotating the degree of fibrosis of the blocks in the hematoxylin-eosin block set and the Masson tricolor block set, and constructing a pathology prior knowledge base using the annotated hematoxylin-eosin block set and the Masson tricolor block set; S3, using the hematoxylin-eosin image as the source domain and the Masson tricolor image as the target domain, training a one-way mapping network guided by a pathology prior knowledge base; S4, selecting a number of blocks whose dyeing color deviation is within a preset range from the Masson three-color block set as a subset to fine-tune the one-way mapping network trained in step S3; S5, inputting the hematoxylin-eosin image to be processed into the one-way mapping network fine-tuned in step S4, and outputting a virtually stained Masson tricolor image; In step S3, training the one-way mapping network guided by the pathological prior knowledge base includes introducing the loss guided by the pathological prior into the loss function of the one-way mapping network; in the pathological prior guidance, the hematoxylin-eosin image, the physically stained Masson tricolor image and the Masson tricolor image obtained by virtual staining of the hematoxylin-eosin image are all classified to obtain the prediction of the degree of fibrosis, and then the prediction is supervised by manual annotation.

2. The method for virtually staining a hematoxylin-eosin image into a Masson tricolor image according to claim 1, characterized in that: The preprocessing in step S1 refers to performing RGB color normalization on the image block.

3. The method for virtually staining a hematoxylin-eosin image into a Masson tricolor image according to claim 1, characterized in that: In step S2, the degree of fibrosis of the image block is marked according to the amount of fibrosis; Among them, the absence of any stained fibers on the block is defined as no fibrosis, and the label is 0; the presence of stained fibers in the cell interval on the block is defined as less fibrosis, and the label is 1; the presence of stained fibers in non-cell interval positions on the block is defined as more fibrosis, and the label is 2.

4. The method for virtually staining a hematoxylin-eosin image into a Masson tricolor image according to claim 1, characterized in that: When training in step S3, given an unpaired training set {{x∈X},{y∈Y}}, the image output from the one-way mapping network is represented as: Among them, G is the generator, which consists of an encoder G encoder and a decoder G decoder G(x) is the generator function; X and x represent the set of hematoxylin-eosin images and the samples in the set, respectively; Y and y represent the set of Masson tri-color images and the samples in the set, respectively.

5. The method for virtually staining a hematoxylin-eosin image into a Masson tricolor image according to claim 4, characterized in that: The loss function of the one-way mapping network is: L CUT =L GAN (G,D,X,Y)+λ X L PatchNCE (G,H,X)+λ Y L PatchNCE (G,H,Y) Among them, L GAN is the adversarial discrimination loss, D is the decoder, H is a two-layer multi-layer perceptron network, L PatchNCE refers to the multi-layer patch-based mutual information loss function, λ X represents the patch loss weight of the hematoxylin-eosin image, λ Y Represents the patch loss weight of the Masson tri-color image.

6. The method for virtually staining a hematoxylin-eosin image into a Masson tricolor image according to claim 4, characterized in that: The loss function guided by the pathological prior is: Among them, F is a multi-layer perceptron, which acts as a classifier to decode the encoder G encoder The extracted feature vector; ω1 is the weight of the pathological prior loss of the virtually stained Masson trichrome image, ω2 is the weight of the pathological prior loss of the real Masson trichrome image, and ω3 is the weight of the pathological prior loss of the hematoxylin-eosin image; is the image output from the one-way mapping network A collection of; E y~Y (·), E x~X (·) denotes mathematical expectation, and different subscripts represent the average of different losses in brackets. represents the mean of the pathological prior loss of the virtually stained Masson tricolor image, E y~Y (·) represents the mean of the pathological prior loss of the real Masson tri-color image; E x~X (·) represents the mean of the pathological prior loss of hematoxylin-eosin images; G enc (·) indicates encoding operation, B y , B x The samples are Labeling of y and x for the degree of fibrosis.

7. The method for virtually staining a hematoxylin-eosin image into a Masson tricolor image according to claim 1, characterized in that: The step of selecting a number of image blocks whose dyeing color deviation is within a preset range in step S4 includes: selecting a number of image blocks whose standard deviation of a certain color channel is less than a preset threshold as the subset.

8. The method for virtually staining a hematoxylin-eosin image into a Masson tricolor image according to claim 4, characterized in that: In step S4, the step of fine-tuning the trained one-way mapping network includes: The set Y of Masson three-color images is used as the source domain of fine-tuning, and the subset is used as the target domain of fine-tuning to perform fine-tuning training. The training process keeps the parameters of the encoder obtained by the training in step S3 unchanged, only updates the parameters of the decoder, and does not introduce pathological prior guidance.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for virtually staining a hematoxylin-eosin image into a Masson tricolor image as described in any one of claims 1 to 8 can be implemented.