A semi-supervised medical image segmentation method for improving pseudo label confidence by using pixel weight
By introducing a collaborative mean teacher model that enhances pixel weights and pseudo-label confidence in semi-supervised learning, the problem of excessive reliance on labeled data is solved, improving the performance and robustness of medical image segmentation, and enhancing segmentation results by utilizing unlabeled data.
Patent Information
- Application Number
- CN202311313000.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-11
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-10-11
AI Technical Summary
Existing semi-supervised learning methods rely on a large amount of labeled data in medical image segmentation, and the models tend to converge prematurely, leading to a decline in the quality of pseudo-labels and making it difficult to effectively utilize unlabeled data to improve segmentation performance.
A collaborative mean teacher model with pixel weights and pseudo-label confidence enhancement is adopted. The pixel weight matrix guides the model to focus on key areas, and the pseudo-label quality is improved by comparing pseudo-label confidence. The model is trained using a small amount of labeled data and a large amount of unlabeled data, combined with collaborative training of teacher and student models.
It improves the performance and robustness of medical image segmentation models, reduces dependence on labeled data, and enhances the model's generalization ability on unlabeled data.
Smart Images

Figure CN117994259B_ABST
Abstract
Description
Technical Field
[0001] This method belongs to the field of computer vision, specifically medical image processing, and is primarily used for semi-supervised medical image segmentation. It can improve segmentation performance and robustness by training the model using unlabeled data, even with only a small amount of labeled data. Background Technology
[0002] Deep learning-based methods for fast target segmentation in magnetic resonance imaging (MRI) have become increasingly popular in recent years. Generally, the success of deep learning methods in medical image segmentation tasks relies on large amounts of labeled data. The time-consuming and labor-intensive nature of data annotation is a major challenge in medical image segmentation. The aim of this work is to enhance MR image segmentation using a semi-supervised learning-based approach with a small amount of labeled data and a large amount of unlabeled data.
[0003] However, the dominant semi-supervised learning methods in deep learning currently include consistency regularization, pseudo-labeling, and deep co-training. Among recently proposed methods, consistency-based regularization and pseudo-labeling are widely considered effective ways to improve the performance of semi-supervised models. Pseudo-labeling involves assigning pseudo-annotations to unlabeled images and then using the pseudo-labeled images in conjunction with the labeled images to update the segmentation model. Pseudo-labeling is usually implemented iteratively, allowing the model to iteratively improve the quality of the pseudo-annotations. The quality of the pseudo-labels is the main constraint on the pseudo-labeling strategy. Based on the assumption that perturbations should not change the model output, consistency learning is widely used by forcing the prediction of the input image to remain unchanged under different perturbations and pushing the decision boundary towards low-density regions. Tarvainen et al. proposed the mean-teacher architecture, which utilizes two models, a teacher and a student, for collaborative training based on the consistency principle. The teacher model supervises and guides the student model on unlabeled data, thereby improving the accuracy and generalization ability of the student model. However, the teacher and student models often converge to consistency prematurely, degenerating into self-trained models and generating low-confidence pseudo-labels from perturbed inputs during training. Therefore, maintaining the differences between models while improving the quality of generated pseudo-labels becomes the key to improving model performance.
[0004] Based on the current state of affairs, we propose a collaborative mean-teacher model for semi-supervised image segmentation. This model utilizes pixel weights to guide the model's focus on different regions and employs confidence comparison to enhance pseudo-label confidence. Building upon the collaborative mean-teacher and pseudo-label methods, we add pseudo-label confidence enhancement and pixel weight focus. Pseudo-label confidence enhancement is achieved by fusing the confidence matrices of pseudo-labels generated by the teacher and student models to generate new pseudo-labels. Pixel weight focus involves designing an initial weight W0 for each original image. During training, pseudo-label comparisons are performed to update the weights of pixels with differing classifications, allowing the model to focus more on target regions that require special attention.
[0005] This invention integrates the above ideas to segment targets in magnetic resonance imaging (MRI) medical images. The research found that this invention, which is based on semi-supervised learning and uses pixel weights to improve the confidence of pseudo-labels, is innovative and original. Summary of the Invention
[0006] The technical problem to be solved by this invention is to provide a semi-supervised medical image segmentation method that uses pixel weights to improve the confidence of pseudo-labels. This segmentation method uses a small number of precisely labeled samples and a large number of unlabeled samples to train a segmentation model with higher performance, which can effectively reduce the dependence on precisely labeled samples.
[0007] The semi-supervised segmentation model proposed in this invention (see model structure diagram) Figure 1 First, the original 2D magnetic resonance imaging (MRI) medical images need to be resized to 224×224 pixels for inference, while the output is restored to its original size for evaluation. For each unlabeled sample, two different image augmentations are performed to obtain two perturbed samples, which are input into the student model and the teacher model respectively. Noise is added to the teacher model. This allows the two models to produce different perspectives and representations of the same sample. A pixel weight matrix W is then added to each sample. i Its function is to guide the model to focus on areas that require more attention. The initial values of the pixel weight matrix are all set to λ, where λ is a constant between 0 and 1. The following defines the symbols used in this invention: Training set D = {D...} l D u},in This indicates that there is a labeled dataset. X represents an unlabeled dataset. i X represents the i-th labeled image. j Y represents the j-th unlabeled image. iN represents the true labels of the labeled samples, N represents the number of labeled images, and M represents the number of unlabeled images.
[0008] The preprocessed data samples and pixel weight matrix serve as the initial input to the model. Both the student and teacher modules use ViT as the model structure, and their identical structures facilitate the teacher module obtaining and updating the current model parameters from the student module via exponential moving average. The student and teacher modules output probability distributions S(X) and T(X) respectively for the input image. The pseudo-label P output by the student model... S The supervised loss (using cross-entropy loss) is calculated with the real labels. sup Then compare it with the pseudo-label P output by the teacher model. T Calculate the semi-supervised consistency loss (using compatibility loss) L semi The overall loss function Where λ is the weighting factor. The student model updates its parameters using the total loss function. Then, the teacher model's parameters are updated based on the updated student model parameters and the exponential moving average (EMA) method. The formula for updating the teacher model parameters is:
[0009]
[0010] in, This represents the parameters of the teacher model in the previous iteration. θ represents the updated teacher model parameters. t This represents the parameters of the student model. α is a constant close to 1, used to control the update speed of the teacher model. The larger α is, the more the teacher model retains previous information and the smoother it is; the smaller α is, the faster the teacher model follows changes in the student model and the more sensitive it is.
[0011] The parameters of the teacher model are updated using a decay coefficient α. This allows the teacher model to maintain a long-term average state, rather than fluctuating with the student model. This exponential moving average update method makes the teacher model more stable and robust, avoiding the influence of noise or overfitting from the student model.
[0012] Because a pixel weight matrix is added, the values in this matrix are input into the model as factors. When calculating the loss function, these values are multiplied by the loss value of each pixel as weights, thus increasing or decreasing the contribution of certain pixels to the total loss. This allows the model to optimize its parameters based on the pixel weights and uses this information during training. The supervised loss function after adding weights is:
[0013]
[0014] Where: N represents the number of labeled images, L i y represents the cross-entropy loss value of the prediction result for pixel sample i. Cross-entropy compares the model's prediction result with the true label of the data. As the prediction becomes more accurate, the value of cross-entropy decreases. If the prediction is completely correct, the value of cross-entropy is 0; i p represents the label of pixel i, with 1 for positive and 0 for negative. i ω represents the probability that pixel i is predicted to be of the positive class. i This represents the weight of pixel i.
[0015] The consistency loss is calculated between the pseudo-labels output by the teacher and student models. The consistency loss measures the difference between the outputs of the student and teacher models on the same unlabeled data. The consistency loss can be calculated using mean squared error or mean squared logit error. A smaller consistency loss indicates greater consistency between the student and teacher models, meaning the student model is closer to the teacher model. The consistency loss function is:
[0016] L semi= d(S(X), T(X))
[0017] Where d represents the distance metric between the two probability distributions, calculated using the mean squared error. S(X) and T(X) represent the probability distributions output by the student model and the teacher model, respectively.
[0018] The overall loss function is:
[0019]
[0020] Where γ(t) is the weighting factor, usually defined by a time-dependent Gaussian warm-up function (proposed by Yu et al. in 2019): Where t i t represents the current training iteration. total This represents the total number of iterations. This allows the model to rely more on precisely labeled data in the early stages of training, improving model performance.
[0021] The method for updating pixel weights uses pseudo-labels p output by students and teachers. s and p t Pixel comparison is performed. When the predicted category of a pixel differs from that of the pseudo-label, the pixel weights corresponding to the pixels with different pseudo-label classifications are increased, and the weight matrix W′ is updated. i The pixel weight update formula is as follows:
[0022]
[0023] in W represents the confidence values of the teacher model and the student model in predicting the current pixel. i (pixel) represents the weight from the previous time step. The updated weights are normalized so that their values remain between 0 and 1.
[0024] The pseudo-label confidence enhancement module merges the pseudo-label confidence matrices output by teachers and students to obtain new pseudo-labels. The pseudo-label confidence is calculated by having the teacher model perform K random forward propagations with random dropout, adding Gaussian noise to each input data point, and then calculating the mean of the output probability distribution, denoted as μ. c Finally, the pixel-level confidence score is calculated using the entropy minimization method. The confidence score is measured by calculating the entropy of the class probability of each pixel output by the image segmentation model; lower entropy indicates higher confidence, and higher entropy indicates lower confidence. The calculation formula is as follows:
[0025]
[0026] Where μ c The calculation formula is as follows:
[0027]
[0028] This represents the probability that the pixel-level segmentation prediction generated in the k-th generation is the C-th segmentation target category.
[0029] The pseudo-label confidence matrices generated by the teacher and student models are compared pixel-by-pixel, and the categories to which the pixels belong are updated. The category with the higher confidence is selected, and finally, a fused pseudo-label is generated. The fused pseudo-label is then used for iterative training on the dataset.
[0030] This invention utilizes teacher and student models for collaborative training. Collaborative training leverages unlabeled data to enhance the model's generalization ability and reduce labeling costs. The basic idea of collaborative training is to use the prediction results of one model as pseudo-labels for another, thereby expanding the training data. In this way, two or more models can learn from and correct each other, thus improving segmentation performance. The characteristics of different models can be utilized to improve model robustness and diversity. Collaborative training can use models with different structures or parameters to teach each other, allowing the models to learn different feature representations and segmentation strategies. In this way, two or more models can complement and optimize each other, thereby improving segmentation quality.
[0031] However, such co-trained models often converge to uniformity prematurely, degenerating into self-trained models and generating low-confidence pseudo-labels from perturbed inputs during training. To avoid this degradation, we propose encouraging model inconsistency during training and ensuring low-uncertainty pseudo-labels. Based on this motivation, we propose a co-means teacher model for semi-supervised image segmentation that utilizes pixel weights to guide the model to focus on different regions and uses confidence contrast to improve pseudo-label confidence. This model comprises 1) a co-means teacher, 2) a pixel weight calculation module, and a pseudo-label confidence contrast. The pixel weight calculation module allows the teacher and student models to focus on different regions during training, gradually widening the divergence between the co-trained sub-networks. Simultaneously, pixel weights enable the model to focus on key regions during training, improving model performance. Meanwhile, pseudo-label confidence contrast ensures low uncertainty in pseudo-labels. With these conditions, we can safely maintain the co-training state to improve the effectiveness of SSL mining of unlabeled data. Attached Figure Description
[0032] Figure 1 Structural diagram of the present invention. Detailed Implementation
[0033] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0034] A semi-supervised medical image segmentation method that utilizes pixel weights to improve the confidence of pseudo-labels includes the following steps:
[0035] Step 1: Acquire 2D magnetic resonance imaging (MRI) medical images;
[0036] Step two: Crop, scale, and filter the image, and add random perturbations;
[0037] Resize all images to 224×224 pixels. Then add random perturbations, including rotation, scaling, translation, flipping, cropping, noise addition, and brightness adjustment.
[0038] Step 3: Add a pixel weight matrix W to each sample. i The initial values of the pixel weight matrix are all set to λ, which is a constant between 0 and 1; in this invention, it is set to 0.5. As follows:
[0039]
[0040] Step four involves feeding images with different perturbations into the teacher and student models respectively, allowing the two models to train collaboratively until convergence. The collaborative training process involves perturbing each original image and then inputting it into both the student and teacher models. The student and teacher models will predict and output corresponding pseudo-labels and confidence matrices based on the input images. According to the consistency principle (prediction theories should be identical for the same input data), the compatibility loss between the pseudo-labels output by the student and teacher models is calculated. This compatibility loss function can be used to supervise the training of the student model by leveraging the differences between the teacher and student models.
[0041] Based on the assumption that perturbations should not change the model output, the teacher and student models should have the same prediction theory for the same input data. Therefore, the consistency between the predictions of the two models can be calculated as the loss function, i.e., the compatibility loss can be calculated:
[0042]
[0043] We use mean squared error (MSE) for calculation, where d represents the Euclidean distance metric between the two probability distributions. S(X) and T(X) represent the probability distributions output by the student and teacher models, respectively, and i refers to each pixel. i T(X) represents the student model's classification of pixel i. i ) represents the teacher model's classification of pixel i.
[0044] On the other hand, based on the pseudo-label P output by the student model S Calculate the supervised loss (using cross-entropy loss) against the true labels. The supervised loss is weighted using a pixel weight matrix, increasing or decreasing the contribution of certain pixels to the total loss, thereby allowing the model to focus on regions that require more attention.
[0045]
[0046] Where: N represents the number of labeled images, L i y represents the cross-entropy loss value of the prediction result for pixel sample i. Cross-entropy compares the model's prediction result with the true label of the data. As the prediction becomes more accurate, the value of cross-entropy decreases. If the prediction is completely correct, the value of cross-entropy is 0; i This represents the label of pixel i, with 1 for positive and 0 for negative. i ω represents the probability that pixel i is predicted to be of the positive class. i This represents the weight of pixel i.
[0047] The overall loss function is:
[0048]
[0049] wherein the total loss function is a sum of a supervised loss function (calculated using cross entropy loss) and a semi-supervised loss function γL semi (calculated using consistency loss), where γ(t) is a weighting factor, which represents a proportion of the semi-supervised loss in the total loss, and is a factor related to training time, which is small at the beginning of training and increases as the training time elapses.
[0050] The student model updates the parameters of the model through the total loss function. Then, the parameters of the teacher model are updated according to the updated parameters of the student model and an exponential moving average (EMA) method.
[0051]
[0052] wherein represents parameters of the teacher model in a previous iteration, represents updated parameters of the teacher model, and θ t represents parameters of the student model. α is a constant close to 1, which is used to control an update speed of the teacher model. A larger α indicates that the teacher model retains more previous information and is smoother; a smaller α indicates that the teacher model follows changes of the student model faster and is more sensitive. In this method, α gradually increases as the number of training steps (iter_hum) increases until reaching an upper limit alpha=0.99, and a calculation formula thereof is as follows:
[0053]
[0054] The model updates the parameters of the exponential moving average model according to the student model, the teacher model, the α parameter, and a global step.
[0055] A pseudo-label confidence u is calculated according to pseudo-labels and probability distributions output by the student model and the teacher model, using an entropy minimization method:
[0056]
[0057] wherein μ c is calculated as follows:
[0058]
[0059] K represents the number of times the model performs random forward propagation with random dropout, and k represents the k-th time. μ c represents a mean value of probability distributions output by K times, and represents a probability that a pixel-level segmentation prediction generated in the k-th time is the C-th segmentation target category.
[0060] The pseudo-label confidence matrices generated by the teacher and student models are compared pixel-by-pixel, the pixel categories are updated, and the category with the highest confidence is selected. Finally, the fused pseudo-labels are generated. The new pseudo-labels and data are then input into the model again in the next iteration.
[0061] Based on the comparison of pseudo-labels output by the student model and the teacher model, the pixel weight matrix is updated, and the new weight matrix and data are input into the model again in the new iteration:
[0062]
[0063] in W represents the confidence values of the teacher model and the student model in predicting the current pixel. i (pixel) represents the weight from the previous time step. The updated weights are normalized to ensure that the weight values remain between 0 and 1.
[0064] This method uses the optimizer class `optim.SGD` provided by PyTorch, which implements the stochastic gradient descent (SGD) algorithm. It has four parameters: learning rate `lr`; `momentum` (momentum factor, using a value of 0.9); and `weight_decay` (weight decay coefficient, using a value of 0.0001). The learning rate `lr` is updated based on the base learning rate (`base_lr = 0.01`), the current training step count (`iter_num`), and the maximum training step count (`max_iterations`). The formula is as follows:
[0065] lr=base_lr*(1-iter_num / max_iterations) 0.9
[0066] The maximum training steps are set to 3000, and the above operation is repeated until the model converges. The finally trained student model can segment lesion regions in medical images. Experimental results show that the method proposed in this invention outperforms the mean-teacher model on both the ACDC and brats2019 datasets with 5% labeled data. The mean-teacher model achieves an accuracy of 86.67% on the ACDC dataset with 5% labeled data, while the method of this invention achieves an accuracy of 87.52%. On the brats2019 dataset with 10% labeled data, the mean-teacher model achieves an accuracy of 82.21%, while the method of this invention achieves an accuracy of 83.42%.
Claims
1. A semi-supervised medical image segmentation method that utilizes pixel weights to improve the confidence of pseudo-labels, characterized in that... Includes the following steps: Step 1: Acquire 2D magnetic resonance imaging (MRI) medical images; Step two: Crop, scale, and filter the image, and add random perturbations; Step 3: Add a pixel weight matrix W to each sample. i The initial values of the pixel weight matrix are all set to λ, which is a constant between 0 and 1; Step 4: Input images with different perturbations into the teacher model and student model respectively, and let the two models train together until convergence. The co-training process is to input each original image into the student model and teacher model after it has been perturbed by different perturbations. The student model and teacher model will make predictions based on the input images and output the corresponding pseudo-labels and confidence matrices. Based on the assumption that perturbations should not change the model output, the teacher and student models should have the same prediction theory for the same input data. Therefore, the consistency between the predictions of the two models is calculated as the loss function, i.e., the compatibility loss is calculated: The mean squared error is used for calculation, where d represents the Euclidean distance metric between the two probability distributions; S(X) and T(X) represent the probability distributions output by the student model and the teacher model, respectively, and i refers to each pixel. i T(X) represents the student model's classification of pixel i. i ) represents the teacher model's classification of pixel i; On the other hand, based on the pseudo-label P output by the student model S Calculate supervised loss with real labels The supervised loss is weighted using a pixel weight matrix, increasing or decreasing the contribution of certain pixels to the total loss, thereby allowing the model to focus on regions that require more attention. Where: N represents the number of labeled images, L i y represents the cross-entropy loss value of the prediction result for pixel sample i. i The label of pixel i is represented by 1 for positive and 0 for negative; p i ω represents the probability that pixel i is predicted to be of the positive class. i This represents the weight of pixel i, which is obtained from the pixel weight matrix; The overall loss function is: The overall loss function is the supervised loss function. The semi-supervised loss function γL is calculated using cross-entropy loss. semi The sum is calculated using the compatibility loss, where γ(t) is a weighting factor that represents the proportion of the semi-supervised loss to the total loss; The student model updates its parameters using the total loss function; then, the teacher model's parameters are updated based on the updated parameters of the student model and the exponential moving average (EMA) method. in, This represents the parameters of the teacher model in the previous iteration. θ represents the updated teacher model parameters. t This represents the parameters of the student model; α is a constant close to 1, used to control the update speed of the teacher model; α is gradually increased with the number of training steps iter_num until it reaches an upper limit of alpha = 0.99, calculated as follows: The pseudo-label confidence level u is calculated based on the pseudo-labels and probability distributions output by the student and teacher models, using the entropy minimization method: Where μ c The calculation is as follows: K represents the number of times the model performs a random forward propagation with random dropout, where k represents the k-th time; μ c This represents the mean of the probability distribution of the K outputs. This represents the probability that the pixel-level segmentation prediction generated in the k-th generation is the C-th segmentation target category; The pseudo-label confidence matrices generated by the teacher and student models are compared at the pixel level. The categories to which the pixels belong are updated, and the categories with higher confidence are selected. Finally, the fused pseudo-labels are generated. The new pseudo-labels and data are then input into the model again in the new iteration. Based on the comparison of pseudo-labels output by the student model and the teacher model, the pixel weight matrix is updated, and the new weight matrix and data are input into the model again in the new iteration: in W represents the confidence values of the teacher model and the student model in predicting the current pixel. i (pixel) represents the weight from the previous time step; the updated weights are normalized so that the weight values are always kept between 0 and 1. This implementation uses the `optim.SGD` optimizer class provided by PyTorch to implement the stochastic gradient descent (SGD) algorithm. It has four parameters: learning rate `lr`; `momentum` (momentum factor, using a value of 0.9); and `weight_decay` (weight decay coefficient, using a value of 0.0001). The learning rate `lr` is updated based on the base learning rate `base_lr` = 0.01, the current training step count `iter_num`, and the maximum training step count `max_iterations`. The formula is as follows: lr=base_lr*(1-iter_num / max_iterations) 0.9 。
Citation Information
Patent Citations
Super-pixel-based two-stage weak supervision new crown focus segmentation method
CN114913164A
Weakly supervised pathological image tissue segmentation method based on online noise suppression strategy
CN115880262A
