Mutual verification semi-supervised pulmonary nodule segmentation algorithm
Through the cross-checking semi-supervised pulmonary nodule segmentation algorithm, using alternate training of labeled and unlabeled images and mutual verification between sub-networks, the problem of low segmentation accuracy caused by the lack of label data is solved, and the problem of low segmentation accuracy is achieved in less labeled data. High-precision pulmonary nodule segmentation reduces dependence on annotated data.
Patent Information
- Application Number
- CN202410893985.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-04
- Publication Date
- 2024-09-10
AI Technical Summary
Existing deep learning-based pulmonary nodule segmentation algorithms are prone to overfitting when labeled data is scarce, and the segmentation accuracy is not high, making it difficult to effectively utilize unlabeled data, resulting in cognitive bias during model training and affecting the improvement of segmentation accuracy.
A mutual-checking semi-supervised pulmonary nodule segmentation algorithm is adopted. Through alternating training of labeled and unlabeled images, the mutual verification of subnet A and subnet B and CutMix data enhancement technology are used to reduce the dependence on annotated data and improve The model’s supervised information mining capabilities in unlabeled data.
It achieves improved pulmonary nodule segmentation accuracy with less annotated data, reduces dependence on annotated data sets, reduces cognitive bias in model training, and improves segmentation accuracy and model generalization performance.
Smart Images

Figure CN118628513A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of segmentation algorithms, and in particular to a mutual verification semi-supervised pulmonary nodule segmentation algorithm. Background Art
[0002] Studies have shown that lung nodules are closely related to lung cancer and are one of the early symptoms of lung cancer. If lung nodules can be diagnosed and treated as early as possible, it will be of great benefit to reducing the mortality rate of lung cancer. Therefore, realizing a high-precision algorithm for automatic segmentation of lung nodules has valuable clinical value and practical significance. However, due to the random location, different sizes and shapes of lung nodules, the segmentation accuracy of existing lung nodule segmentation algorithms based on deep learning is still not high enough.
[0003] The goal of lung nodule segmentation is to accurately classify each pixel, so the dataset is required to be at the pixel level. However, the training of the segmentation model in the existing deep learning-based lung nodule segmentation algorithm relies on professional physicians to label the open source datasets one by one. The process of manually labeling lung nodule CT images is not only cumbersome and time-consuming, but also requires a large number of professional physicians. Therefore, obtaining sufficient and high-quality labeled data has become an important problem facing this task, which has directly affected the development of data-oriented fully supervised learning in the field of lung nodule segmentation and also hindered the improvement of segmentation accuracy.
[0004] At present, there are not many studies that directly apply semi-supervised learning to the field of lung nodule segmentation. Semi-supervised learning is a learning method that is different from fully supervised. It focuses more on how to effectively use unlabeled data to improve model performance. Semi-supervised learning is a technology used to train models when the amount of data is insufficient or the label cost is high. Therefore, it is suitable for training lung nodule segmentation models, thereby effectively addressing the problem of scarce labeled data sets. In the case of scarce labeled data sets, segmentation methods based on semi-supervised learning have proven their effectiveness. However, in the prior art, due to the existence of problems such as cognitive bias during training, segmentation models are easily misled by information generated in unlabeled data, affecting the improvement of segmentation accuracy. Therefore, how to address the problems of scarce labeled data sets, easy overfitting of model training, and susceptibility to the influence of tissues similar to lung nodules during model training, resulting in poor segmentation accuracy, requires further research. Summary of the invention
[0005] The present invention aims to solve the above problems, thereby providing a method that can solve the problem of insufficient model training caused by a lack of labeled data sets. The lung nodule segmentation model is trained by labeled images and unlabeled images to obtain a mutually verified semi-supervised lung nodule segmentation algorithm that can accurately segment lung nodules and effectively identify image noise.
[0006] The invention solves the above problem, and the technical solution adopted is:
[0007] A mutual verification semi-supervised pulmonary nodule segmentation algorithm, comprising the following steps:
[0008] S1: Acquire a lung CT image dataset and preprocess the lung CT image dataset; wherein the lung CT image dataset includes annotated images and unannotated images;
[0009] S2: Divide the preprocessed lung CT image dataset into a training set and a test set; the training set contains annotated images and unannotated images, and the test set consists of annotated images;
[0010] S3: Construct a mutually verified semi-supervised lung nodule segmentation model, and use the training set to train the lung nodule segmentation model until all the data in the training set are trained; after each round of training is completed, it is necessary to save the training parameters of the lung nodule segmentation model of this round, and calculate the loss through the loss function to adjust the parameters; wherein, the mutually verified semi-supervised lung nodule segmentation model includes subnet A and subnet B. After the data is input into the lung nodule segmentation model, subnet A outputs the prediction image A, and subnet B outputs the prediction image B; during training, labeled images and unlabeled images are trained alternately. In each batch of training data, there are both labeled images and unlabeled images. The labeled images are trained first, and then the unlabeled images are trained; during the training process, the lung nodule segmentation model parameters under the minimum loss need to be saved;
[0011] S4: Read the lung nodule segmentation model parameters with the minimum loss in the training stage, and substitute them into the segmentation model to obtain the optimal lung nodule segmentation model;
[0012] S5, the optimal pulmonary nodule segmentation model is tested using the test set, and the model accuracy of the optimal pulmonary nodule segmentation model is evaluated using evaluation indicators.
[0013] Preferably, the specific steps of alternately performing labeled image training and unlabeled image training in step S3 are:
[0014] S301: Input a labeled image, subnet A outputs predicted image A, and subnet B outputs predicted image B;
[0015] S302: Input the prediction map A and the prediction map B into the comparison difference review module, compare the prediction map A and the prediction map B to determine the wrong prediction area; calculate the wrong prediction area loss through the loss function according to the actual label corresponding to the wrong prediction area and the wrong prediction area of the prediction map A, calculate the mixed loss of the prediction map A according to the actual label, and update the subnet A parameters; calculate the wrong prediction area loss through the loss function according to the actual label corresponding to the wrong prediction area and the wrong prediction area of the prediction map B, calculate the mixed loss of the prediction map B according to the actual label, and update the subnet B parameters;
[0016] S303: According to the loss calculated in step 302, subnet A and subnet B are compared, and the one with smaller loss is used as the teacher model, and the one with larger loss is used as the student model;
[0017] S304: Input two unlabeled images, and the CutMix data enhancement module perturbs the two unlabeled images to generate a perturbed image A; input the two unlabeled images before perturbation into the teacher model, output prediction images C and D, and the CutMix data enhancement module perturbs the prediction images C and D to generate a perturbed image B; input the perturbed image A into the student model, and output the prediction image E; use the perturbed image B as a pseudo label, calculate the loss of the prediction image E, and update the parameters of the student model.
[0018] Preferably, in step S302, the specific working process of the comparison difference review module is as follows:
[0019] S3021: inputting the prediction image A, the prediction image B and the input annotated image into a comparison difference review module, the comparison difference review module performs binarization processing on the prediction image A and the prediction image B, and then performs an XOR operation on the binarization processing results to generate a mask of the wrong prediction area;
[0020] S3022: jointly calculating the mask with the prediction map A, the prediction map B, and the input labeled image to obtain the wrong prediction area in the prediction map A, the wrong prediction area in the prediction map B, and the true value corresponding to the wrong prediction area;
[0021] S3023: Use the loss function to calculate the loss of the wrong prediction area in the prediction map A and the true value corresponding to the wrong prediction area, and adjust the parameters of subnet A; use the loss function to calculate the loss of the wrong prediction area in the prediction map B and the true value corresponding to the wrong prediction area, and adjust the parameters of subnet B.
[0022] Preferably, the loss function includes a subnet loss function, and the subnet loss function formula is expressed as:
[0023] L subnet =L s +μL u (1)
[0024] Among them, L s is the training loss for labeled images, L u is the unlabeled image training loss, μ is the balance weight, and μ is automatically generated using the sigmoid ramp up algorithm;
[0025] In the unlabeled image training, the teacher model μ is 0, and its loss function is expressed as;
[0026] L subnet =L s(2)
[0027] The function formula for the training loss of labeled images is expressed as;
[0028]
[0029] Among them, Dice(*,*) is the Dice loss function, BCE(*,*) is the BCE loss function, L rec (*,*) is the correction loss function derived from the contrast difference review module, β is the balance weight; Y represents the prediction map A or prediction map B; Y label represents the corresponding annotated image; Y diff represents the wrong prediction area obtained in the comparison difference review stage; Indicates the true value corresponding to the wrong prediction area;
[0030] The loss formula for unlabeled image training is expressed as;
[0031]
[0032] Where I(*) represents an indicator function. When the condition in the brackets is met, the indicator function returns 1, and if the condition is not met, it returns 0; v Indicates the uncertainty of a pixel; H is the set threshold. When the uncertainty of a pixel is less than H, it indicates that the pixel is reliable. Represents the predicted data of a certain pixel; is the value corresponding to the pixel in the pseudo label.
[0033] Preferably, the loss function includes a mixed loss function, and the formula of the mixed loss function is,
[0034] L=0.5Dice(Y,Y label )+0.5BCE(Y,Y label ) (5)
[0035] In S304, subnet A and subnet B are compared by a hybrid loss function to determine a teacher model and a student model.
[0036] Preferably, in step S305, before using the CutMix data enhancement module to perturb the prediction image C and the prediction image D to generate the perturbed image B, it is also necessary to input the prediction image C and the prediction image D into the uncertainty estimation module, and use the Monte Carlo Dropout algorithm in the uncertainty estimation module to perform uncertainty estimation on each pixel in the prediction image C and the prediction image D, and generate an uncertainty matrix u of the same size as the prediction image C and the prediction image D corresponding to the prediction image C and the prediction image D.
[0037] Preferably, in step S5, during the testing phase, for the input annotated image, subnetwork A and subnetwork B in the optimal lung nodule segmentation model will each generate their own prediction outputs, namely, prediction map A and prediction map B. The optimal lung nodule segmentation model performs a weighted average calculation on each pixel in prediction map A and prediction map B, and the result after the weighted average calculation is used as the final output.
[0038] Compared with the prior art, the present invention adopting the above technical solution has the following outstanding features:
[0039] In order to solve the problem that the lack of labeled data leads to poor segmentation accuracy of the lung nodule segmentation model after training, the present invention uses labeled data and unlabeled data to collaboratively train the model, and establishes a lung nodule segmentation model based on a semi-supervised learning framework with mutual verification. The model can achieve higher lung nodule segmentation accuracy with less labeled data, and effectively reduce the segmentation model's dependence on labeled data sets. The method uses subnet A and subnet B, in conjunction with the built-in comparison difference review module of the separation model, to achieve mutual verification and mutual learning between the two subnets. At the same time, by using data enhancement, uncertainty estimation and other technologies, the model can mine more reliable supervision information from unlabeled data for model training, thereby reducing dependence on labeled data sets. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 is a flow chart of the training and testing of the pulmonary nodule segmentation algorithm in an embodiment of the present invention;
[0041] Figure 2 is a flow chart of a lung nodule segmentation algorithm according to an embodiment of the present invention when training is performed based on labeled images and unlabeled images;
[0042] Figure 3 This is a schematic diagram of the process of comparing and checking images by the difference review module in an embodiment of the present invention;
[0043] Figure 4 is a schematic diagram of the process of selecting pseudo labels in an embodiment of the present invention;
[0044] Figure 5 is a schematic diagram of the CutMix data enhancement module performing disturbance in an embodiment of the present invention;
[0045] Figure 6 is a schematic diagram of the process of performing unlabeled image training in an embodiment of the present invention;
[0046] Figure 7 It is an intermediate and final result diagram when the uncertainty estimation module in the embodiment of the present invention removes noise and uncertainty factors from sample 1, sample 2, sample 3, and sample 4;
[0047] Figure 8This is a network architecture diagram of the U-Net model in an embodiment of the present invention;
[0048] Fig. 9 MM-TransUNet model network architecture diagram in an embodiment of the present invention;
[0049] Fig.10 is a curve chart showing how the μ value changes with increasing training rounds when the sigmoid ramp up algorithm is used to generate μ in formula 1 in an embodiment of the present invention;
[0050] Fig.11 is a flowchart of performing lung parenchyma segmentation, region of interest extraction and data enhancement operations on a lung CT image dataset in an embodiment of the present invention;
[0051] Fig.12 is a detailed information list in an XML file in an embodiment of the present invention;
[0052] Fig.13 This is a schematic diagram of the MaxViT module of the MM-TransUNet model processing feature maps;
[0053] Fig.14 It is a schematic diagram of processing feature graphs by a block attention processing module and a table attention processing module in the MaxViT module of the MM-TransUNet model in an embodiment of the present invention;
[0054] Fig.15 It is an architecture diagram of the MSCA attention mechanism in the present invention when processing feature graphs;
[0055] Fig.16 This is a comparison chart of the lung nodule segmentation effect output by the algorithm in the embodiment of the present invention and the U-Net, TransNet, MT, and CCT models. DETAILED DESCRIPTION
[0056] The present invention will be further described below in conjunction with embodiments, the purpose of which is only to provide a better understanding of the content of the present invention. Therefore, the examples given do not limit the protection scope of the present invention.
[0057] like Figure 1 As shown, this embodiment discloses a mutual verification semi-supervised pulmonary nodule segmentation algorithm, the steps include:
[0058] S1: Acquire a lung CT image dataset and preprocess the lung CT image dataset; wherein the lung CT image dataset includes annotated images and unannotated images.
[0059] For the annotated images in the data set, conventional data enhancement methods are used as preprocessing to increase training samples. In this embodiment, the specific process of enhancing the annotated images is as follows: Fig.11 As shown, including:
[0060] S101: Use the OTSU algorithm to perform binary segmentation on the input image to obtain a binary image.
[0061] S102: Fill the cavity of the lung parenchyma using a flood filling method to obtain a filled image; and use an opening operation to remove noise and small bubbles in the binary image to obtain a denoised image.
[0062] S103: Subtract the denoised image from the filled image to obtain a preliminary lung parenchyma mask image containing a small connected region.
[0063] S104: performing an opening operation to remove small connected regions in the preliminary lung parenchyma mask image to obtain a final lung parenchyma mask image.
[0064] S105: performing an AND operation on the final-order lung parenchyma mask image and the original CT image to obtain a lung parenchyma image.
[0065] S106: The location of the lung nodules is located by reading the information provided by the XML file in the LIDC-IDRI dataset, and then the original image is cropped using the method of taking the lung nodules as the center point; the detailed information in the XML file is as follows: Fig.12 shown.
[0066] S107: Then, the cropped image is randomly flipped, randomly rotated, and the like, and the expanded image and the original image are used together as input data for training and testing the segmentation model.
[0067] Since unlabeled images do not contain clear supervisory information, different disturbances are added to the unlabeled images in the hope of mining certain supervisory information from them. Therefore, the CutMix module is used to perform data enhancement for the unlabeled images in the dataset. Figure 5 ,The CutMix module combines the random cropping method and the image mixing method. First, two unlabeled images are selected and ,randomly cropped. The blank areas left are not set to 0, but are filled with the ,cropped area of another image to complete the perturbation of the unlabeled ,image.
[0068] The specific process of the CutMix module is to randomly select two unlabeled images A and B from the data set, cut out a rectangular area of random position and size in image B, copy the cut area to the same position in image A, and thus form a new synthetic image; calculate the proportion of the cut area in the total area of image A, and this proportion will be used for subsequent loss function calculation. In terms of loss calculation, CutMix uses the same weighted summation method as the image mixing method. In terms of image cutting, CutMix improves the strategy of roughly removing pixels and setting them to 0 in the random cutting method, and replaces them with patches of the same area in another image. This ensures that there will be no unnatural mixing in the image, making the decision boundary smoother, which is conducive to improving the generalization performance of the model. The CutMix module adds perturbations to the image, which can be expressed as Formula 9.
[0069]
[0070] Where M represents the binary mask corresponding to the cropped area; represents pixel-by-pixel multiplication; 1-M represents the corresponding binary mask except the cropped area; x A Represents a pixel in image A, x B Represents a pixel in image B.
[0071] S2: Divide the preprocessed lung CT image dataset into a training set and a test set; the training set contains annotated images and unannotated images, and the test set consists of annotated images. This embodiment uses the LIDC-IDRI dataset as the original lung CT image dataset. After screening the LIDC-IDRI dataset, the images that were consistently judged by four doctors were selected as annotated image samples, totaling 928 cases. By selecting different slices in the samples, a total of 4946 slices were formed as annotated image datasets; then they were divided into training sets and test sets in a ratio of 7:3; for the unannotated image dataset, the images that were inconsistently judged or not judged by the four doctors in the LIDC-IDRI dataset were used as samples for slicing.
[0072] S3: Construct a mutually verified semi-supervised lung nodule segmentation model (MC-SSL), and use the training set to train the MC-SSL model until all the data in the training set are trained; after each round of training, it is necessary to save the training parameters of the MC-SSL model of this round, and calculate the loss through the loss function to adjust the parameters; wherein, the MC-SSL model includes subnet A and subnet B. After the data is input into the MC-SSL model, subnet A outputs the prediction map A, and subnet B outputs the prediction map B; during training, labeled images and unlabeled images are trained alternately. In each batch of training data, there are both labeled images and unlabeled images. The labeled images are trained first, and then the unlabeled images are trained; during the training process, the lung nodule segmentation model parameters under the minimum loss need to be saved;
[0073] like Figure 2-4 As shown, the specific steps of alternating training with labeled images and training without labeled images are as follows;
[0074] S301: Input a labeled image, subnet A outputs predicted image A, and subnet B outputs predicted image B.
[0075] S302: Inputting the prediction map A and the prediction map B into the comparison and difference review module, comparing the prediction map A and the prediction map B to determine the wrong prediction area; wherein the specific working process of the comparison and difference review module includes.
[0076] S3021: The prediction image A, the prediction image B and the input annotated image are input into the comparison difference review module. The comparison difference review module binarizes the prediction image A and the prediction image B, and then performs an XOR operation on the binarization results to generate a mask of the wrong prediction area; the mask expression of the wrong prediction area is Formula 10.
[0077] M diff =BINA(Y A )⊕BINA(Y B ) (10)
[0078] Among them, BINA(*) means the image is binarized; Y A Represents the prediction graph A, Y B Indicates the prediction graph B; M diff is the mask of the wrong prediction area.
[0079] S3022: The mask is jointly calculated with the prediction map A, the prediction map B, and the input annotated image to obtain the wrong prediction area in the prediction map A, the wrong prediction area in the prediction map B, and the true value corresponding to the wrong prediction area; the wrong prediction area in the prediction map A The expression is formula 11, predicting the wrong prediction area of Figure B The expression is formula 12.
[0080]
[0081] Among them, CLIP(*) represents the operation of obtaining the area corresponding to the mask, that is, taking the intersection.
[0082] S3023: Use the loss function to calculate the loss of the wrong prediction area in the prediction map A and the true value corresponding to the wrong prediction area, calculate the loss of the wrong prediction area, and simultaneously calculate the mixed loss of the prediction map A, and adjust the parameters of subnet A; Use the loss function to calculate the loss of the wrong prediction area in the prediction map B and the true value corresponding to the wrong prediction area, calculate the loss of the wrong prediction area, and adjust the parameters of subnet B; The mathematical expression corresponding to the loss calculation of subnet A is shown in Formula 13, and the mathematical expression corresponding to the loss calculation of subnet B is shown in Formula 14.
[0083]
[0084] Among them, MSE(*) represents the mean square error loss function, Represents the wrong prediction area mask M diff The corresponding true value.
[0085] S303: Figure 4 , according to the loss calculated in step 302, subnet A and subnet B are compared, the one with smaller loss is used as the teacher model, and the one with larger loss is used as the student model; this module is called the dynamic competitive pseudo-label module (DCPL module).
[0086] In the DCPL module, subnet A and subnet B are compared, and the loss function of the teacher model and the student model is selected as a mixed loss function. The mixed loss function is shown in Formula 5.
[0087] L=0.5Dice(Y,Y label )+0.5BCE(Y,Y label ) (5)
[0088] S304: Figure 6 , input two unlabeled images, the CutMix data enhancement module perturbs the two unlabeled images to generate perturbed image A; input the two unlabeled images before perturbation into the teacher model, output prediction images C and D, the CutMix data enhancement module perturbs prediction images C and D to generate perturbed image B; input perturbed image A into the student model, output prediction image E; use perturbed image B as a pseudo label, calculate the loss of prediction image E, and update the parameters of the student model. The process of generating perturbed image A is performed when the data is preprocessed in step S1.
[0089] Before using the CutMix data enhancement module to perturb the prediction images C and D to generate the perturbed image B, the prediction images C and D need to be input into the uncertainty estimation module. In the uncertainty estimation module, the Monte Carlo Dropout algorithm is used to estimate the uncertainty of each pixel in the prediction images C and D. The uncertainty matrix u of the same size as the prediction images C and D is generated for the prediction images C and D. The formulas for calculating the uncertainty matrix u are shown in Formulas 6 and 7.
[0090] u=-∑ c μ c logμ c (6)
[0091]
[0092] Where T is the number of forward propagations, It refers to the predicted probability of the cth class in the tth forward propagation; μ c represents the average value of the c-th class in the T-th forward propagation; u is the uncertainty matrix of the input image, which has the same size as the input image.
[0093] like Figure 7 As shown in the figure, the uncertainty matrix u generated by the uncertainty estimation module for four samples is shown; it can be seen from the figure that after each random pixel discarding, there will be some differences in the output image; but in these different output images, there are some identical pixels, which are the pixels that the uncertainty matrix is looking for, and are also the more reliable part of the pseudo-label. Finally, the uncertainty matrix corresponding to the prediction map C and the prediction map D is applied to the prediction map C and the prediction map D to remove the noise and unreliable pixel areas in the prediction map C and the prediction map D, and generate pseudo-labels.
[0094] Under the guidance of the uncertainty matrix u, predictions with higher uncertainty can be eliminated, and only pixels with higher reliability can be used for student model learning; the uncertainty estimation module can help the student model learn more reliable knowledge and optimize the training loss of unlabeled images, thereby reducing the overall uncertainty of the model.
[0095] S4: Read the lung nodule segmentation model parameters with the minimum loss in the training stage, and substitute them into the segmentation model to obtain the optimal lung nodule segmentation model.
[0096] S5: The optimal pulmonary nodule segmentation model is tested using the test set, and the model accuracy of the optimal pulmonary nodule segmentation model is evaluated using the evaluation index; in the test phase, for the input labeled image, subnet A and subnet B in the optimal pulmonary nodule segmentation model will each generate their own prediction output, i.e., prediction map A and prediction map B. The optimal pulmonary nodule segmentation model calculates the weighted average value of each pixel in the prediction map A and prediction map B, and the result after the weighted average value calculation is used as the final output. The formula for calculating the weighted average value is shown in Formula 8;
[0097] Output = αO A +βO B (8)
[0098] Among them, α and β are respectively used as the pixel values O in the predicted image A. A , predict pixel value O in image B B ; α and β are obtained by comparing the loss values of subnet A and subnet B during supervised training, and counting the proportion of the winning rounds of subnet A and subnet B in the total number of rounds.
[0099] Furthermore, the loss function in the MC-SSL model includes a subnetwork loss function, and the subnetwork loss function is shown in Formula 1.
[0100] L subnet =L s +μL u (1)
[0101] Among them, L s is the training loss for labeled images, L u is the training loss of unlabeled images, μ is the balance weight, and μ is automatically generated using the sigmoid ramp up algorithm; the change curve of μ is as follows Fig.10 shown.
[0102] In unlabeled image training, the loss function of the teacher model can be expressed as since μ is 0.
[0103] L subnet =L s (2)
[0104] The function of the training loss for labeled images is shown in Formula 3.
[0105]
[0106] Among them, Dice(*,*) is the Dice loss function, BCE(*,*) is the BCE loss function, L rec (*,*) is the correction loss function derived from the contrast difference review module, β is the balance weight; Y represents the prediction map A or prediction map B; Y labelrepresents the corresponding annotated image; Y diff represents the wrong prediction area obtained in the comparison difference review stage; Indicates the true value corresponding to the wrong prediction area;
[0107] The loss formula for unlabeled image training is shown in Formula 4.
[0108]
[0109] Where I(*) represents an indicator function. When the condition in the brackets is met, the indicator function returns 1, and if the condition is not met, it returns 0; v Indicates the uncertainty of a pixel; H is the set threshold. When the uncertainty of a pixel is less than H, it indicates that the pixel is reliable. Represents the predicted data of a certain pixel; is the value corresponding to the pixel in the pseudo label.
[0110] The traditional Mean Teacher framework uses two subnets with the same structure, so that the student model can pass parameters to the teacher model; however, the subnet design with the same structure in Mean Teacher is prone to disadvantages such as overfitting and cognitive bias. In order to avoid these risks, two heterogeneous models are selected as subnets in the present invention. The two heterogeneous subnets can learn from each other, complement each other, and verify each other, so that the model can obtain better segmentation accuracy when the proportion of labeled data is small.
[0111] In the selection of subnets, the present invention requires that the two subnets have certain differentiation, so as to maximize the vitality of "competition for jobs, mutual learning and teaching". Therefore, the present invention selects U-Net based on CNN as subnet A. CNN has good inductive bias ability, so that U-Net can better capture local features in the image. At the same time, U-Net requires less labeled data due to its simple structural design, and can generate more reliable pseudo-labels in the early stage of training for subnet B to learn. The detailed structure of the U-Net model is as follows: Figure 8 shown.
[0112] Subnet B can choose the TransUNet model, which can model global information well, which complements the advantages of CNN.
[0113] Furthermore, subnet B can also choose the MM-TransUNet model based on the multi-scale multi-axis attention mechanism, such as Fig. 9As shown in the figure, the MM-TransUNet model is based on the TransUNet model. The Transformer layer of the encoder in the TransUNet model is replaced with the MaxViT network, and the MSCA attention mechanism is added to the jump connection structure of the decoder. Although the MaxViT network built into MM-TransUNet does not have good inductive bias capabilities and has weak perception of local features, it can model global information well, which complements the advantages of CNN.
[0114] The working steps of the MM-TransUNet model are:
[0115] Step 1: Input the image in the training set into the encoder, and first use the residual mechanism in conjunction with the convolutional neural network (CNN) to extract shallow features of the input image layer by layer to extract shallow feature maps; the residual mechanism is located in the first three layers of the encoder, and the shallow feature maps output by the third layer residual block are divided into blocks, and position encoding is added.
[0116] Step 2: The shallow feature map after adding position encoding is processed by MaxViT module 12 times to fully perceive the deep context information, further deep feature learning, and extract the deep feature map of the image. The specific process of each MaxViT module processing is as follows Fig.13 As shown, specifically including.
[0117] (1) The feature map is input into the MBConv module, and the feature map is convolved by a 1x1 convolution layer. The input feature map after convolution dimension increase will be processed by depthwise separable convolution (3x3 convolution layer); the channel attention module (SE) is input to strengthen the relevant features in the feature map and weaken the irrelevant features to obtain an enhanced feature map. The enhanced feature map is then convolved point by point with the input feature map to restore the dimension, and the enhanced feature map is output.
[0118] (2) Fig.14 , the enhanced feature map is input into the block attention processing module (Block Attention), and the block attention processing module (Block Attention) divides the input feature map into complementary overlapping image blocks. The splitting operation can be expressed by Formula 15.
[0119]
[0120] After splitting the input image into several complementary overlapping image blocks, the self-attention mechanism (Block-SA) is applied to each split image block P×P to achieve interaction in a local range. Then the image blocks that complete the local interaction are input into the feedforward neural network (FNN) for full connection, so that the output feature map has the same size as the final enhanced feature map.
[0121] (3) The feature map output by the block attention processing module is input into the table attention processing module (GridAttention). The table attention processing module aggregates the input image into different local grids in the form of global expansion. The specific operation can be expressed by Formula 16.
[0122]
[0123] The input feature map is aggregated into different local grids in the form of global expansion. ) The local space within the local area performs a self-attention mechanism (Grid-SA) to achieve global interaction. Finally, all local grids are input into the feed-forward neural network for full connection, so that the output feature map has the same size as the final enhanced feature map.
[0124] In step 3, the shallow feature map and the deep feature map are input into the decoder, the shallow feature map and the deep feature map are connected and upsampled, the features are fused layer by layer, and finally the lung nodule segmentation image is output; wherein, the shallow feature map output by each layer in the three-layer ResNet-50 network is firstly subjected to the multi-scale cross-axial attention mechanism, namely the MSCA attention mechanism, to extract the important features in the shallow feature map.
[0125] like Fig.15 The specific steps of applying the MSCA attention mechanism to process shallow feature maps are as follows: input a shallow feature map F with a shape of H×W×C, perform multi-scale convolution operations on the feature map in parallel along the X-axis and Y-axis respectively; the convolution kernel of the X-axis is set to 1×7, 1×11 and 1×21, and the convolution kernel of the Y-axis is set to 7×1, 11×1 and 21×1; after the multi-scale convolution operation, the convolution output and F of the input feature map F along the X-axis and Y-axis are obtained. x and F y ; F x and F y The specific calculation formulas are shown in Formulas 17 and 18.
[0126]
[0127] Then calculate F x and F y The cross attention on the X-axis can be expressed by formula 19. First, F x As the key and value matrix, and F y As the query matrix, we get F T ;
[0128] F T =MHCA y (F y ,F x ,F x) (19)
[0129] Among them, MHCA y (*,*,*) indicates multi-head cross attention along the X-axis.
[0130] The cross attention on the Y axis can be expressed by formula 20, then F y As the key and value matrix, and F x As the query matrix, we get F B .
[0131] F B =MHCA x (F x ,F y ,F y ) (20)
[0132] Among them, MHCA x (*,*,*) indicates multi-head cross attention along the Y-axis.
[0133] Finally, F B 、F T , F are integrated to obtain the first layer important feature map, the second layer important feature map or the third layer important feature map. The integration process formula is shown in Formula 21.
[0134] F out =Conv 1×1 (F T )+Conv 1×1 (F B )+F (21)
[0135] By adding the MSCA attention mechanism to the feature maps in the skip connection, the neural network's perception of specific channels and spatial dimensions can be enhanced to more effectively extract richer and more useful features, thereby enhancing the functionality of the skip connection.
[0136] Experiment and analysis: The experiment uses stochastic gradient descent with momentum as the optimization algorithm of the model. The stochastic gradient descent algorithm minimizes the loss by calculating the gradient of each sample and updating the parameters. The introduction of momentum term can accelerate convergence and reduce fluctuations. The initial learning rate is set to 0.01. The specific experimental details are shown in Table 1.
[0137]
[0138] Table 1 Experimental details settings
[0139] As shown in Table 1, the initial learning rate is set to 0.01. Choosing a larger learning rate at the beginning of training can make the network converge faster. ExponentialLR is used to create a learning rate scheduler, and the learning rate decay rate gamma is set to 0.9, so that at the end of each epoch, the learning rate will be updated according to the set decay rate. The learning rate is gradually reduced during the training process to better optimize the model. Through the setting of exponential decay, the learning rate is gradually reduced in the later stage of training, which is conducive to more fine-tuning the parameters of the model.
[0140] It should be noted that in order to enable all data to participate in the training process, this experiment will dynamically adjust the number of labeled images and unlabeled images in the batch according to the different proportions of labeled data. Table 1 shows the experimental results when the proportion of labeled data is 50%. Since each batch contains both labeled data and unlabeled data, when the total amount of labeled data accounts for 50%, the proportion of labeled data in the batch should also be 50%. Therefore, the number of labeled images and unlabeled images in a batch of size 32 is set to 16 each.
[0141] To ensure the fairness of the experiment, all experiments were conducted in the same environment, where the hardware environment is shown in Table 2 and the software environment is shown in Table 3.
[0142]
[0143] Table 2 Hardware parameters
[0144]
[0145] Table 3 Software parameters
[0146] In order to verify the performance of the mutual verification semi-supervised pulmonary nodule segmentation model (MC-SSL) proposed in the present invention on the pulmonary nodule segmentation task, this embodiment uses MC-SSL to perform segmentation experiments on pulmonary nodule images in the LIDC-IDRI dataset and calculate indicators. At the same time, MC-SSL can be regarded as consisting of modules such as contrast difference review (CDR), dynamic competitive pseudo-label (DCPL), CutMix data enhancement, uncertainty estimation (MC Dropout), and subnet selection. In order to determine whether they have a positive impact on the segmentation accuracy, an ablation experiment is set up to complete the test of each module.
[0147] The specific settings and results of the ablation experiment can be seen from Table 4; it should be noted that, since two heterogeneous subnets are used in the MC-SSL framework, and without adding any modules, the two heterogeneous subnets cannot produce a unified segmentation structure, the basic model selected in the ablation experiment is the MM-TransUNet model with higher segmentation accuracy; at the same time, when the DCPL module is not used, the original module position no longer adopts the "competitive job" strategy, but specifies subnet B as a fixed teacher model; at the same time, since the CutMix and MC Dropout modules are attached to the DCPL module, the ablation experiment is performed on the basis of the DCPL module; since there are many indicators for evaluating pulmonary nodule segmentation, this embodiment selects the Dice coefficient with the highest correlation as the evaluation indicator, which indicates the degree of overlap between the predicted image and the label image.
[0148]
[0149]
[0150] Table 4 Ablation experiment settings and results
[0151] As shown in Table 4, this ablation experiment was conducted under three different proportions of labeled data, thereby increasing the universality of the conclusion. The three proportions are 10%, 30%, and 50% respectively. As can be seen from the data, the different proportions of labeled data will affect the accuracy of MC-SSL segmentation. As the amount of labeled data increases, the segmentation accuracy is also improving. At the same time, despite the different proportions, the experimental results still show some commonalities in the three different cases. First, the CDR, DCPL, MC Dropout, and CutMix modules designed in the MC-SSL framework can help MC-SSL achieve improvements in segmentation accuracy in all three cases. Among them, the CDR module can help MC-SSL achieve a more obvious improvement in segmentation accuracy. This is the credit of the mutual verification between subnets designed by the CDR module. Through the mutual verification between subnets, the subnets are helped to self-aware of the areas where errors may occur and conduct reviews, thereby improving the segmentation accuracy. After adding the DCPL module, MC-SSL also achieved a significant improvement in segmentation accuracy. The reason is the competition mechanism between subnets. The DCPL module avoids the drawbacks of the original fixed teacher-student model. Through the strategy of "competition for positions", the subnets are in a state of continuous learning, thereby improving segmentation accuracy. The CutMix and MC Dropout modules designed on the basis of the DCPL module can stimulate the improvement of segmentation accuracy to varying degrees. Among them, the CutMix module can help MC-SSL further mine the information in unlabeled data and obtain a good improvement in accuracy, while the segmentation accuracy brought by MC Dropout is less. The reason may be that after adding this module, MC-SSL becomes more complex and requires more time to adjust parameters to obtain the best performance. In short, when all these modules are integrated into the model, the model can achieve the best accuracy improvement.
[0152] In order to verify the effectiveness of the subnet selection in this chapter, this embodiment sets up relevant experiments to prove that selecting U-Net and MM-TransUNet as the two subnets of MC-SSL is more beneficial to improving the segmentation accuracy; Table 5 shows the specific settings and results of the subnet selection experiment.
[0153]
[0154] Table 5 Subnet selection experiment
[0155] It can be seen from the subnet selection experimental results that when U-Net and MM-TransUNet models are selected as subnets, the segmentation accuracy of the MC-SSL framework can reach the maximum value. The reason is that U-Net has a simpler design and requires less labeled data. Therefore, it can be used as a teacher model to produce more reliable pseudo-labels in the early stage of training. MaxViT in MM-TransUNet can complement the advantages of CNN and maximize the advantages of the mutual verification and competition strategies between the subnets designed in MC-SSL, thereby achieving higher segmentation accuracy.
[0156] Comparative experiments and analysis: In order to further verify the superiority of the MC-SSL framework proposed in this chapter in the field of pulmonary nodule segmentation, MC-SSL is compared with the existing open source models U-Net, TransUNet, MT, and CCT models based on the LIDC-IDRI dataset. The specific settings and results of the comparative experiments can be seen in Table 6.
[0157]
[0158]
[0159] Table 6 Comparison of experimental settings and results
[0160] As shown in Table 6, regardless of whether the proportion of labeled data is 10%, 30%, or 50%, the U-Net and TransUNet models based on fully supervised learning cannot utilize the information in unlabeled images, so the segmentation accuracy is not as good as their performance in the case of 100% labeled data. Although semi-supervised frameworks can use unlabeled data for training, different semi-supervised frameworks process unlabeled data differently, resulting in different impacts. If the information in the unlabeled data is misunderstood, the cognitive bias during training will continue to expand, which is likely to have a negative impact on the segmentation accuracy.
[0161] First, MC-SSL overcomes the difficulty that the fully supervised model cannot utilize unlabeled data, and realizes the use of unlabeled data for model training, thus expanding the training data set. Secondly, MC-SSL achieves better mining of information in unlabeled data through mutual verification and mutual learning between subnets, thereby reducing the occurrence of problems such as cognitive bias, and ensuring that unlabeled data brings a positive improvement to segmentation accuracy. Therefore, MC-SSL is superior to the semi-supervised MT and CCT models.
[0162] Fig.16 The segmentation effect of MC-SSL in the present invention on CT images of lung nodules is demonstrated by comparing the U-Net, TransUNet, MT, and CCT models in the present invention in the experiment when the labeled data accounts for 30%.
[0163] Fig.16 In the example, for the case of irregular convex lung nodules represented by sample 1, the segmentation is more difficult. MC-SSL can restore its convex shape well and roughly segment the boundary of the lung nodules; but the other models are greatly affected and the marking effect is poor. Sample 2 represents the case of irregular concave main body. MC-SSL can segment the concave trend of the lung nodules and can also grasp the boundary of the lung nodules well; but the other models cannot correctly segment all the details. For the regular-shaped lung nodules in samples 3 and 4, MC-SSL can complete the segmentation task better than other models, and other models introduce some other noise during segmentation.
[0164] The above description is only a preferred feasible embodiment of the present invention, and does not limit the scope of rights of the present invention. All equivalent changes made using the contents of the present specification and its drawings are included in the scope of rights of the present invention.
Claims
1. A mutual verification semi-supervised pulmonary nodule segmentation algorithm, characterized in that the steps include: S1: Acquire a lung CT image dataset and preprocess the lung CT image dataset; wherein the lung CT image dataset includes annotated images and unannotated images; S2: Divide the preprocessed lung CT image dataset into a training set and a test set; the training set contains annotated images and unannotated images, and the test set consists of annotated images; S3: Construct a mutually verified semi-supervised lung nodule segmentation model, and use the training set to train the lung nodule segmentation model until all the data in the training set are trained; after each round of training is completed, it is necessary to save the training parameters of the lung nodule segmentation model of this round, and calculate the loss through the loss function to adjust the parameters; wherein, the mutually verified semi-supervised lung nodule segmentation model includes subnet A and subnet B. After the data is input into the lung nodule segmentation model, subnet A outputs the prediction image A, and subnet B outputs the prediction image B; during training, labeled images and unlabeled images are trained alternately. In each batch of training data, there are both labeled images and unlabeled images. The labeled images are trained first, and then the unlabeled images are trained; during the training process, the lung nodule segmentation model parameters under the minimum loss need to be saved; S4: Read the lung nodule segmentation model parameters with the minimum loss in the training stage, and substitute them into the segmentation model to obtain the optimal lung nodule segmentation model; S5, the optimal pulmonary nodule segmentation model is tested using the test set, and the model accuracy of the optimal pulmonary nodule segmentation model is evaluated using evaluation indicators.
2. The mutual verification semi-supervised pulmonary nodule segmentation algorithm according to claim 1, characterized in that: The specific steps of alternately performing labeled image training and unlabeled image training in step S3 are as follows: S301: Input a labeled image, subnet A outputs predicted image A, and subnet B outputs predicted image B; S302: Input the prediction map A and the prediction map B into the comparison difference review module, compare the prediction map A and the prediction map B to determine the wrong prediction area; calculate the wrong prediction area loss through the loss function according to the actual label corresponding to the wrong prediction area and the wrong prediction area of the prediction map A, calculate the mixed loss of the prediction map A according to the actual label, and update the subnet A parameters; calculate the wrong prediction area loss through the loss function according to the actual label corresponding to the wrong prediction area and the wrong prediction area of the prediction map B, calculate the mixed loss of the prediction map B according to the actual label, and update the subnet B parameters; S303: According to the loss calculated in step 302, subnet A and subnet B are compared, and the one with smaller loss is used as the teacher model, and the one with larger loss is used as the student model; S304: Input two unlabeled images, and the CutMix data enhancement module perturbs the two unlabeled images to generate a perturbed image A; input the two unlabeled images before perturbation into the teacher model, output prediction images C and D, and the CutMix data enhancement module perturbs the prediction images C and D to generate a perturbed image B; input the perturbed image A into the student model, and output the prediction image E; use the perturbed image B as a pseudo-label, calculate the loss of the prediction image E, and update the parameters of the student model.
3. The mutual verification semi-supervised pulmonary nodule segmentation algorithm according to claim 2, characterized in that: In step S302, the specific working process of the comparison difference review module is as follows: S3021: inputting the prediction image A, the prediction image B and the input annotated image into a comparison difference review module, the comparison difference review module performs binarization processing on the prediction image A and the prediction image B, and then performs an XOR operation on the binarization processing results to generate a mask of the wrong prediction area; S3022: jointly calculating the mask with the prediction map A, the prediction map B, and the input labeled image to obtain the wrong prediction area in the prediction map A, the wrong prediction area in the prediction map B, and the true value corresponding to the wrong prediction area; S3023: Use the loss function to calculate the loss of the wrong prediction area in the prediction map A and the true value corresponding to the wrong prediction area, and adjust the parameters of subnet A; use the loss function to calculate the loss of the wrong prediction area in the prediction map B and the true value corresponding to the wrong prediction area, and adjust the parameters of subnet B.
4. The mutual verification semi-supervised pulmonary nodule segmentation algorithm according to claim 3, characterized in that: The loss function includes the subnetwork loss function, and the formula of the subnetwork loss function is expressed as; L subnet =L s +μL u (1) Among them, L s is the training loss for labeled images, L u is the unlabeled image training loss, μ is the balance weight, and μ is automatically generated using the sigmoid ramp up algorithm; In the unlabeled image training, the teacher model μ is 0, and its loss function is expressed as; L subnet =L s (2) The function formula for the training loss of labeled images is expressed as; Among them, Dice(*, *) is the Dice loss function, BCE(*, *) is the BCE loss function, L rec (*, *) is the correction loss function derived from the contrast difference review module, β is the balance weight; Y represents the prediction map A or prediction map B; Y label represents the corresponding annotated image; Y diff represents the wrong prediction area obtained in the comparison difference review stage; Indicates the true value corresponding to the wrong prediction area; The loss formula for unlabeled image training is expressed as; Where I(*) represents an indicator function. When the condition in the brackets is met, the indicator function returns 1, and if the condition is not met, it returns 0; v Indicates the uncertainty of a pixel; H is the set threshold. When the uncertainty of a pixel is less than H, it indicates that the pixel is reliable. Represents the predicted data of a certain pixel; is the value corresponding to the pixel in the pseudo label.
5. The mutual verification semi-supervised pulmonary nodule segmentation algorithm according to claim 4, characterized in that: The loss function includes a mixed loss function, and the formula of the mixed loss function is: L=0.5Dice(Y,Y label )+0.5BCE(Y,Y label ) (5) In S304, subnet A and subnet B are compared by a hybrid loss function to determine a teacher model and a student model.
6. The mutual verification semi-supervised pulmonary nodule segmentation algorithm according to claim 2, characterized in that: In step S305, before using the CutMix data enhancement module to perturb the prediction images C and D to generate the perturbed image B, the prediction images C and D need to be input into the uncertainty estimation module, and the Monte Carlo Dropout algorithm is used in the uncertainty estimation module to estimate the uncertainty of each pixel in the prediction images C and D, and an uncertainty matrix u of the same size as the prediction images C and D is generated for the prediction images C and D. The formula for calculating the uncertainty matrix u is: u=-∑ c m c logμ c (6) Where T is the number of forward propagations, It refers to the predicted probability of the c-th class in the t-th forward propagation; μc represents the average value of the c-th class in the T-th forward propagation; u is the uncertainty matrix of the input image, which has the same size as the input image; The uncertainty matrices corresponding to the prediction images C and D are applied to the prediction images C and D to remove noise and unreliable pixel areas in the prediction images C and D.
7. The mutual verification semi-supervised pulmonary nodule segmentation algorithm according to claim 1, characterized in that: In step S5, in the test phase, for the input labeled image, subnet A and subnet B in the optimal pulmonary nodule segmentation model will each generate their own prediction output, namely, prediction map A and prediction map B. The optimal pulmonary nodule segmentation model calculates the weighted average value of each pixel in the prediction map A and prediction map B, and the result after the weighted average value calculation is used as the final output. The formula for calculating the weighted average value is: Output=αO A +βO B (8) Among them, α and β are respectively used as the pixel values O in the predicted image A. A , predict pixel value O in image B B ; α and β are obtained by comparing the loss values of subnet A and subnet B during supervised training, and counting the proportion of the winning rounds of subnet A and subnet B in the total number of rounds.
8. The mutual verification semi-supervised pulmonary nodule segmentation algorithm according to claim 1, characterized in that: In the mutual verification semi-supervised lung nodule segmentation model, subnet A is the U-Net model, and subnet B is the MM-TransUNet model. The MM-TransUNet model is based on the TransUNet model. The Transformer layer of the encoder in the TransUNet model is replaced by the MaxViT network, and the MSCA attention mechanism is added to the jump connection structure of the decoder.
9. The mutual verification semi-supervised pulmonary nodule segmentation algorithm according to claim 8, characterized in that: The MaxViT network working process is: The feature map extracted previously is input into the MBConv block. After the feature map passes through the 1x1 convolution layer and the 3x3 convolution layer, it is input into the channel attention module to strengthen the relevant features in the feature map and weaken the irrelevant features to obtain the enhanced feature map. The enhanced feature map is then convolved point by point with the input feature map to restore the dimension and output the enhanced feature map. The enhanced feature map is input into the block attention processing module and split into several complementary overlapping image blocks. Then, the self-attention mechanism is applied to each split image block to achieve interaction in a local range. The image blocks that have completed the local interaction are then input into the feedforward neural network for full connection, so that the output feature map has the same size as the final enhanced feature map. The feature map output by the block attention processing module is input into the table attention processing module, the input feature map is aggregated into different local grids in the form of global expansion, the self-attention mechanism is performed on the local space within each grid to achieve global interaction, and finally, all local grids are input into the feedforward neural network for full connection, so that the output feature map has the same size as the final enhanced feature map.
10. The mutual verification semi-supervised pulmonary nodule segmentation algorithm according to claim 8, characterized in that: The MSCA attention mechanism is used to process the shallow feature maps output by the first three layers of the ResNet-50 network in the encoder of the MM-TransUNet model. The specific processing steps include: The input feature map F of the shallow layer with the shape of H×W×C is subjected to multi-scale convolution operations along the X-axis and Y-axis in parallel. The convolution kernel of the X-axis is set to 1×7, 1×11 and 1×21, and the convolution kernel of the Y-axis is set to 7×1, 11×1 and 21×1. After the multi-scale convolution operation, the convolution output and F of the input feature map F along the X-axis and Y-axis are obtained. x and F y ; Then calculate F x and F y For the cross attention on the X-axis, first, F x As the key and value matrix, and F y As the query matrix, we get F T ; For the attention on the Y axis, F y As the key and value matrix, and F x As the query matrix, we get F B ; Finally, F B 、F T , F are integrated to obtain the first layer important feature map, the second layer important feature map or the third layer important feature map; the first layer important feature map, the second layer important feature map or the third layer important feature map is used to jump upward layer by layer with the deep feature map finally output by the encoder to obtain the final lung parenchyma image.
Citation Information
Cited By
Mobile terminal pulmonary nodule detection and multistage classification method based on deep learning
CN119273695A
Ultrasonic image segmentation model training method, ultrasonic image segmentation method, electronic equipment and storage medium
CN119323713A
Ultrasonic image segmentation model training method, ultrasonic image segmentation method, electronic device and storage medium
CN119323713B
Medical image segmentation method based on contrast difference review and related products
CN119762790A
OCT fingerprint anti-counterfeiting method based on physiological structure consistency
CN121963325A
