A semi-supervised image segmentation method and system based on collaborative optimization
By employing a collaborative optimization method combining category-adaptive entropy filtering and prototype contrastive learning, the problems of pseudo-label noise and feature distribution shift in semi-supervised medical image segmentation are solved. This method achieves segmentation results comparable to fully supervised methods with a small number of annotations, reducing annotation costs and improving segmentation performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHONGQING UNIV OF TECH
- Filing Date
- 2026-04-23
- Publication Date
- 2026-06-16
AI Technical Summary
Existing semi-supervised medical image segmentation methods suffer from pseudo-label noise and feature distribution shifts when utilizing unlabeled data, making it difficult to guarantee segmentation results with a small number of labeled samples. Furthermore, existing methods struggle to balance local details with global semantic information.
A semi-supervised image segmentation method based on collaborative optimization is adopted. The pseudo-label filtering ratio is dynamically adjusted through a category adaptive entropy filtering module. Combined with dual-path decoupled prediction and prototype contrastive learning, the feature learning ability is enhanced, and the influence of feature distribution shift and pseudo-label noise is mitigated.
Achieving segmentation results comparable to fully supervised methods with limited labeled data reduces labeling costs and improves segmentation performance. It alleviates the problem of inconsistent feature distribution through dual-path collaborative optimization and prototype comparative learning, thereby improving the quality of pseudo-labels.
Smart Images

Figure CN122223337A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical image segmentation technology, specifically to a semi-supervised image segmentation method and system based on collaborative optimization. Background Technology
[0002] Medical image segmentation is a core component of computer-aided diagnostic systems, aiming to accurately delineate target anatomical structures or lesion areas from images such as computed tomography (CT) and magnetic resonance imaging (MRI). However, its performance typically relies on large-scale, high-quality labeled datasets. Therefore, semi-supervised medical image segmentation has emerged, which can achieve stable supervision of unlabeled data while reducing annotation costs.
[0003] Semi-supervised segmentation often employs the Mean Teacher framework, where the student model applies strong supervision to labeled data, and its weights are then passed to the teacher model via an exponentially moving average (EMA). The teacher model then applies soft consistency constraints to unlabeled data. Due to the differences in supervision signals between labeled and unlabeled data, the models struggle to align within the shared feature space, leading to feature distribution shifts during training and hindering the effective utilization of unlabeled data. Bai et al. proposed the BCP method, which alleviates the empirical distribution mismatch problem by bidirectionally copying and pasting images and label regions between labeled and unlabeled data. However, this method remains susceptible to pseudo-label noise in highly uncertain regions with equal boundaries, and its explicit modeling and constraints on the feature distribution shift between labeled and unlabeled data are still relatively insufficient.
[0004] To address the impact of pseudo-label noise in unlabeled data, pseudo-labels need to be filtered. However, existing pseudo-label filtering methods typically use fixed thresholds or fixed filtering ratios. Even if the filtering ratios can be set separately for each category, it is difficult to dynamically and adaptively adjust them during training based on the learning difficulty of different categories. This results in easy-to-learn categories being over-filtered or difficult-to-learn categories having residual noise.
[0005] Furthermore, most semi-supervised methods have begun to incorporate self-supervised auxiliary tasks to enhance feature learning capabilities. Contrastive learning, as a representative example, learns discriminative features from unlabeled data by constructing positive and negative sample pairs. However, existing contrastive learning methods generally struggle to simultaneously consider both local details and global semantic information, and their emphasis is biased towards discriminative ability between different categories while still ignoring the problem of imbalanced feature distribution within the same category. Summary of the Invention
[0006] This invention aims to solve the technical problems existing in the prior art, and innovatively proposes a semi-supervised image segmentation method and system based on collaborative optimization, which can still guarantee the segmentation effect even under the condition of only a small number of labeled samples.
[0007] To achieve the above objectives, this invention provides a semi-supervised image segmentation method based on collaborative optimization, comprising the following steps:
[0008] S1: Send the medical image data acquired by the data acquisition module to the local machine, read the raw data, and input it into the data preprocessing module;
[0009] S2: The data preprocessing module converts medical image data into a unified format and performs standardization processing;
[0010] S3: Initialize the model;
[0011] S4: Adaptive category filtering is performed on the teacher network's predictions on unlabeled images using the category-adaptive entropy filtering module;
[0012] S4-1: Probability output of the teacher model on unlabeled samples Calculate each category The average entropy;
[0013] The formula is as follows:
[0014] ;
[0015] in, For each category The average entropy, This indicates that among all unlabeled samples in the current training batch B, the predicted value is... A collection of pixels of a class;
[0016] Represents a set Number of elements in the middle; Represents probability entropy; This represents the unlabeled probability output of the teacher model; Indicates the total number of categories;
[0017] S4-2: Dynamically allocate the unreliable point filtering ratio for each category;
[0018] Based on average entropy, linear interpolation is performed according to category difficulty, and an unreliable point filtering ratio is assigned to each category. ;
[0019] ;
[0020] in, For the minimum filtering ratio range of categories, This represents the maximum filtering ratio range for each category. To prevent small amounts from being divided by zero, The minimum average entropy among all categories, It is the highest average entropy among all categories;
[0021] S4-3: Generate the filtering threshold and final pseudo-labels;
[0022] S4-3-1: Sort the pixel entropy for each predicted category and apply it according to the different filtering ratios for each category. Take the corresponding filtration ratio The filtering threshold is obtained from the quantiles. ;
[0023] S4-3-2: Unlabeled predictions for the teacher model based on thresholds Perform pixel-level filtering to obtain the final unlabeled pseudo-labels;
[0024] ;
[0025] in, The pseudo-labels for the final unlabeled data. This represents the probability entropy of the unlabeled probability output of the teacher model. This represents the unlabeled probability output of the teacher model;
[0026] S4-3-3: Use filtered pseudo-labels Supervised student model unlabeled prediction, calculate pseudo-supervised loss ;
[0027] ;
[0028] in, For cross-entropy loss, This represents the unlabeled probability output of the teacher model. These are pseudo-labels for the final unlabeled data;
[0029] S5: Model training;
[0030] S6: Model reasoning and result visualization.
[0031] In the above scheme, step S2 further includes:
[0032] S2-1: Slice 3D medical image data into 2D images by layer, and uniformly scale or crop them to the set size;
[0033] S2-2: Standardize the pixel intensity of the sliced 2D image data;
[0034] The formula is as follows:
[0035] ;
[0036] in, The raw grayscale value of a single 2D image data pixel. , These are the mean and standard deviation of the grayscale values of all pixels, respectively. Standard scores;
[0037] S2-3: Preprocess the standardized image data;
[0038] Add random flipping, slight rotation, and equal-weight enhancement operations, and combine them with region copy-paste to generate a blended image.
[0039] In the above scheme, step S5 further includes the following steps:
[0040] S5-1: Dual-path decoupled pre-training;
[0041] S5-2: Dual-path collaborative optimization activated;
[0042] S5-3: Enhanced through a triple hybrid supervision module;
[0043] S5-4: Prototype Comparison Learning;
[0044] S5-5: Total Loss Optimization and Model Update.
[0045] In the above scheme, step S5-1 also includes the following steps:
[0046] S5-1-1: Input labeled 2D image data and unlabeled 2D image data;
[0047] S5-1-2: Prediction of labeled 2D image data;
[0048] Labeled prediction of labeled 2D image data using the output of the first C channel. And use real labels to supervise the labeled predictions. Calculate supervised loss ;
[0049] S5-1-3: Prediction of unlabeled 2D image data;
[0050] S5-1-3-1: The teacher model generates predictions for unlabeled 2D image data, and the pseudo-labels are obtained after filtering by the CAEF module. ;
[0051] S5-1-3-2: Unlabeled predictions output from the back C channel of the student model Supervised unlabeled prediction using pseudo-labels Calculate the pseudo-supervision loss .
[0052] In the above scheme, step S5-2 also includes the following steps:
[0053] S5-2-1: Uncertainty Computation and Fusion;
[0054] S5-2-1-1: Through the student model Predicting the C-channel probability before outputting unlabeled 2D image data And the predicted probability of the C channel ;
[0055] S5-2-1-2: Substitute the predicted probability into the following formula to calculate the probability entropy;
[0056] ;
[0057] in, Indicates the total number of categories. Represents probability entropy. Indicates the predicted probability. Represents a logarithmic function;
[0058] S5-2-1-3: Weighted average fusion yields a dual-path uncertainty diagram. ;
[0059] The dual-path uncertainty is fused using the following formula:
[0060] ;
[0061] in, , Representing the student model The unlabeled probability output; For student models The predicted probability entropy of the front C channel, The predicted probability entropy of the C channel after the student model; and through exponential mapping Transform uncertainty into Dice loss weights;
[0062] S5-2-2: Cross-supervision and collaborative optimization;
[0063] S5-2-2-1: Student Model The two probability outputs are used to obtain the prediction result through the argmax function. and ;
[0064] S5-2-2-2: The dual-path collaborative optimization loss is calculated using the following formula:
[0065] ;
[0066] in, To optimize losses through dual-path collaboration, It is the basic loss function, with Dice loss having uncertainty weights; For student models The prediction results for the C channel are as follows. For student models Prediction results for the C-channel.
[0067] In the above scheme, step S5-3 also includes the following steps:
[0068] S5-3-1: Random Sampling Binary Mask Based on this, hybrid image data is constructed. and its mixed labels :
[0069] ;
[0070] ;
[0071] in, For element-wise multiplication, For labeled 2D image data, For unlabeled 2D image data, For labeled 2D image data, the true labels are... The pseudo-labels are the unlabeled predictions of the teacher model after CAEF filtering.
[0072] S5-3-2: Mixing image data After inputting the student model, a dual-path decoupled prediction head is used. Provide dual-path probability output and The final probability output is then calculated by grouping the overall mixed image data according to the regions.
[0073] The formula is as follows:
[0074] ;
[0075] in, The probability of the mixed image data for the final output student model. For element-wise multiplication, The predicted probability of the mixed image data for the first C channels of the student model. The predicted probability of the mixed image data of the C channel after the student model;
[0076] S5-3-3: Calculate the triple hybrid supervision loss;
[0077] The triple hybrid supervision loss is calculated using the following formula:
[0078] ;
[0079] in, This indicates the loss from triple hybrid supervision. It is a weighted sum of cross-entropy loss and Dice loss. For the overall loss, For regional losses;
[0080] To calculate the global loss of the mixed image data, global supervision is performed on the entire mixed image region. and Corresponding to the target area With background area Regional-level losses will be monitored locally.
[0081] In the above scheme, step S5-4 also includes the following steps:
[0082] S5-4-1: Integrate labeled features with high-quality unlabeled features from the teacher model, and construct category prototypes using the mean of batch intra-class features;
[0083] ;
[0084] in, For the first Accumulated categories after rounds of training prototype, For the first Accumulated categories after rounds of training prototype, For only based on the first The temporary prototype calculated from the training data. For smoothing coefficients;
[0085] S5-4-2: For the pixel features of the student model, calculate the prototype probability based on the cosine similarity normalization with the category prototype;
[0086] ;
[0087] in, For prototypes of all categories Summation, For student network pixels feature, Represents cosine similarity. Scaling factor For student model pixels Features and the first Accumulated categories after rounds of training prototype cosine similarity, For student model pixels Features and the first Accumulated categories after rounds of training prototype Cosine similarity;
[0088] S5-4-3: Filtering is performed using a filtering function, and only unlabeled pixel features that are consistently predicted by the student model, teacher model, and prototype are retained for comparative learning;
[0089] The filtering function is as follows:
[0090] ;
[0091] in, It is an indicator function. , and For unlabeled pixels, the student model, teacher model, and prototype branch are respectively represented. The category predictions of all three are obtained by applying the argmax operation to their probability predictions; A set of pixel indices representing unlabeled samples;
[0092] S5-4-4: Calculate the prototype contrast loss;
[0093] The formula is as follows:
[0094] ;
[0095] in, For prototype comparison loss, For consistency filtering function, Represents cosine similarity. Temperature coefficient; It is a logarithmic function; For student network pixels feature, Indicates the first Accumulated categories after rounds of training prototype, express An exponential function with base 0; For student model pixels Features and the first Accumulated categories after rounds of training prototype The cosine similarity;
[0096] Step S5-5 also includes the following steps:
[0097] S5-5-1: Calculate the total loss;
[0098] The total loss is calculated using the following formula:
[0099] ;
[0100] in, To optimize losses through dual-path collaboration, The supervised loss for the student model, Losses due to pseudo-supervision This indicates the loss from triple hybrid supervision. , These are the weighting coefficients. Indicates prototype contrast loss;
[0101] S5-5-2: Model Update;
[0102] S5-5-2-1: Backpropagation total loss, update student model weights, update teacher model weights according to EMA rules;
[0103] S5-5-2-3: Continuous iterative training, calculate the Dice metric on the validation set after each training round, and select the model weights with the best Dice metric after training is completed;
[0104] Step S6 also includes:
[0105] S6-1: The unlabeled medical image data collected in step S1 is preprocessed in step S2;
[0106] S6-2: Input the preprocessed image data into the trained student model to obtain the predicted probability map;
[0107] S6-3: Output the predicted probability map to the 2D slice visualization module;
[0108] S6-4: Label the predicted results on the image data to visualize the results;
[0109] S6-4-1: Based on the predicted probability map, classify each pixel and generate a semantic segmentation mask;
[0110] S6-4-2: Classify by image type;
[0111] S6-4-3: Assign highly distinguishable color markers to different categories to achieve intuitive visualization of segmented regions and anatomical structures.
[0112] This invention also provides a semi-supervised image segmentation system based on collaborative optimization for implementing the above method, comprising:
[0113] The data acquisition module is used to acquire both unlabeled and labeled medical image data.
[0114] The data preprocessing module is used to slice 3D medical images to generate 2D medical images, and to perform image size unification, pixel intensity normalization and standardization operations.
[0115] A dual-path collaborative optimization training mechanism is used for two-stage progressive dual-path decoupling prediction and collaborative optimization.
[0116] The category adaptive entropy filtering module is used to adaptively filter the prediction difficulty of each category within the same training batch;
[0117] The prototype contrastive learning strategy is used to construct category prototypes and conduct contrastive learning to align features of labeled and unlabeled data, thereby enhancing the intra-class compactness and inter-class discriminativeness of features.
[0118] The slice visualization module is used to determine the pixel-by-pixel category of the model's output probability map and convert the prediction results into corresponding segmentation masks.
[0119] In summary, the beneficial effects of this invention are as follows: Compared with fully supervised segmentation methods, this technical solution requires only a small amount of labeled data to achieve segmentation results comparable to fully supervised U-Net. Through a dual-path collaborative optimization training method, the differences between labeled and unlabeled supervision in modeling can be clearly displayed. A consistent supervision signal is applied and collaborative optimization is performed, thereby alleviating the feature distribution shift problem in semi-supervised training at the input and output levels and improving semi-supervised segmentation performance. A class-adaptive entropy filtering mechanism is proposed, which can adaptively filter unreliable pseudo-labels from unlabeled data based on the difficulty of the classes during training, improving the quality of pseudo-labels. Prototype contrastive learning is introduced, using stable class prototypes and consistency screening strategies to construct sample features, alleviating the problem of inconsistent feature distribution at the feature level. Overall, the results are excellent, requiring only a small amount of labeled data to achieve segmentation accuracy comparable to fully supervised U-Net, significantly reducing labeling costs while ensuring segmentation performance. Attached Figure Description
[0120] Figure 1 This is a flowchart illustrating the method.
[0121] Figure 2 This is a general framework diagram of semi-supervised medical image segmentation according to the present invention.
[0122] Figure 3 This is a schematic diagram of the triple hybrid supervision module of the present invention.
[0123] Figure 4 This is a diagram of the category-adaptive entropy filtering module of the present invention.
[0124] Figure 5 This is a diagram illustrating the prototype comparative learning strategy of this invention.
[0125] Figure 6 This is a diagram of the basic segmentation network structure of the present invention.
[0126] Figure 7 (1) is the original heart slice image, (2) is the heart slice segmentation result image of the uncertainty-aware mean teacher segmentation network, (3) is the heart slice segmentation result image of the smoothness and class separation network, (4) is the heart slice segmentation result image of the cross-style consistency shape perception and local context constraint network, (5) is the heart slice segmentation result image of the bidirectional copy and paste method, (6) is the heart slice segmentation result image of this technical solution, and (7) is the real labeled slice of the heart segmentation task.
[0127] Figure 8 (1) is the original prostate slice image, (2) is the prostate slice segmentation result image of the uncertainty-aware mean teacher segmentation network, (3) is the prostate slice segmentation result image of the smoothness and class separation network, (4) is the prostate slice segmentation result image of the cross-style consistency shape perception and local context constraint network, (5) is the prostate slice segmentation result image of the bidirectional copy and paste method, (6) is the prostate slice segmentation result image of this technical solution, and (7) is the real labeled slice of the prostate segmentation task. Detailed Implementation
[0128] The present invention will be further described below with reference to the embodiments and accompanying drawings:
[0129] like Figures 1-6 As shown, a semi-supervised image segmentation method based on collaborative optimization includes the following steps:
[0130] S1: The acquired medical image data is sent to the local machine via the data acquisition module, the raw data is read, and input into the data preprocessing module; in this embodiment, the data acquisition module is an MRI imaging device;
[0131] S2: The data preprocessing module converts medical image data into a unified format and performs standardization processing;
[0132] S2-1: Slice the 3D medical image data into 2D images by layer, and uniformly scale or crop them to images with a length and width of 256;
[0133] S2-2: Standardize the pixel intensity of the sliced 2D image data to reduce grayscale differences caused by different devices;
[0134] The formula is as follows:
[0135] ;
[0136] in, The raw grayscale value of a single 2D image data pixel. , These are the mean and standard deviation of the grayscale values of all pixels, respectively. Standard scores;
[0137] S2-3: Preprocess the standardized image data;
[0138] Add random flipping, slight rotation, and equal-weight enhancement operations, and combine them with region copy-paste to generate a blended image;
[0139] Finally, the preprocessed data is used for dual-path collaborative optimization training.
[0140] S3: Initialize the model;
[0141] Using U-Net as the base model, the output channels of the segmentation prediction head are expanded from C (number of target categories) to 2C, where C equals the number of target categories. The first C channels and the last C channels each constitute two decoupled prediction paths, forming a dual-path decoupled prediction head. ;
[0142] Define the outputs of the front C channel and the back C channel as follows:
[0143] ;
[0144] ;
[0145] in, For the output of the C channel, This is the output of the front C channel. For multi-head transformation of 2C channel number, For the input feature map, For tensor slicing operations, retain the entire height and width, and take the C-th to 2C-1-th channels of the channel dimension. For tensor slicing operations, retain the entire height and width, and take the 0th to C-1th channels of the channel dimension;
[0146] Initialize the student and teacher models;
[0147] S4: The predictions of the teacher model on unlabeled images are adaptively filtered by the class-adaptive entropy filtering module;
[0148] S4-1: Probability output of the teacher model on unlabeled samples Calculate each category The average entropy;
[0149] The formula is as follows:
[0150] ;
[0151] in, For each category The average entropy, This indicates that among all unlabeled samples in the current training batch B, the predicted value is... The set of pixels for each class, with a batch size |B|≥16 to ensure statistical stability. Represents a set Number of elements in the middle; Represents probability entropy; This represents the unlabeled probability output of the teacher model; This indicates the total number of categories.
[0152] S4-2: Dynamically allocate the unreliable point filtering ratio for each category;
[0153] Based on average entropy, linear interpolation is performed according to category difficulty, and an unreliable point filtering ratio is assigned to each category. ;
[0154] ;
[0155] in, For the minimum filtering ratio range of categories, The maximum filtering ratio range for each category is adaptively generated based on the statistical characteristics of the category entropy distribution. To prevent small amounts from being divided by zero, this embodiment... The value is 1e-6. The minimum average entropy among all categories, It is the largest average entropy among all categories. , This invention adaptively determines the minimum and maximum filtering ratio range based on the statistical characteristics of the category pixel entropy distribution. , Specifically, by statistically modeling the category entropy distribution (e.g., based on the mean and standard deviation), a dynamic boundary is constructed to achieve adaptive generation of the filtering range. Based on this, a normalized mapping based on the category average entropy is used to achieve adaptive interpolation of the filtering ratio.
[0156] S4-3: Generate the filtering threshold and final pseudo-labels;
[0157] S4-3-1: Sort the pixel entropy for each predicted category and apply it according to the different filtering ratios for each category. Take the corresponding filtration ratio The filtering threshold is obtained from the quantiles. ;
[0158] S4-3-2: Unlabeled prediction of teacher networks based on threshold Perform pixel-level filtering to obtain the final unlabeled pseudo-labels;
[0159] ;
[0160] Where the subscript t represents the teacher model, The pseudo-labels for the final unlabeled data. This represents the probability entropy of the unlabeled probability output of the teacher model. This represents the unlabeled probability output of the teacher model;
[0161] S4-3-3: Use filtered pseudo-labels Supervised student model unlabeled prediction, calculate pseudo-supervised loss ;
[0162] ;
[0163] in, For cross-entropy loss, This represents the unlabeled probability output of the teacher model. The pseudo-labels for the final unlabeled data.
[0164] S5: Model training;
[0165] This embodiment uses the PyTorch deep learning framework for model training, and the optimizer of the PyTorch deep learning framework is set to SGD, with an initial learning rate of 0.01.
[0166] S5-1: Dual-path decoupled pre-training;
[0167] S5-1-1: Input labeled 2D image data and unlabeled 2D image data;
[0168] S5-1-2: Prediction of labeled 2D image data;
[0169] Labeled prediction of labeled 2D image data using the output of the first C channel. And use real labels to supervise the labeled predictions. Calculate supervised loss ;
[0170] S5-1-3: Prediction of unlabeled 2D image data;
[0171] S5-1-3-1: The teacher model generates predictions for unlabeled 2D image data, and the pseudo-labels are obtained after filtering by the CAEF module. ;
[0172] S5-1-3-2: Unlabeled predictions output from the back C channel of the student model Supervised unlabeled prediction using pseudo-labels Calculate the pseudo-supervision loss ;
[0173] S5-2: Dual-path collaborative optimization activated;
[0174] S5-2-1: Uncertainty Computation and Fusion;
[0175] S5-2-1-1: Through the student model Predicting the C-channel probability before outputting unlabeled 2D image data And the predicted probability of the C channel ;
[0176] S5-2-1-2: Substitute the predicted probability into the following formula to calculate the probability entropy;
[0177] ;
[0178] in, Indicates the total number of categories. Represents probability entropy. Indicates the predicted probability. Represents a logarithmic function;
[0179] S5-2-1-3: Weighted average fusion yields a dual-path uncertainty diagram. ;
[0180] The dual-path uncertainty is fused using the following formula:
[0181] ;
[0182] in, , Representing the student model The unlabeled probability output; For student models The predicted probability entropy of the front C channel, The predicted probability entropy of the C channel after the student model; and through exponential mapping Transform uncertainty into Dice loss weights;
[0183] S5-2-2: Cross-supervision and collaborative optimization are achieved through a dual-path collaborative optimization training mechanism;
[0184] S5-2-2-1: Student Model The two probability outputs are used to obtain the prediction result through the argmax function. and ;
[0185] S5-2-2-2: The dual-path collaborative optimization loss is calculated using the following formula:
[0186] ;
[0187] in, To optimize losses through dual-path collaboration, It is the basic loss function, with Dice loss having uncertainty weights; For student models The prediction results for the C channel are as follows. For student models Prediction results for the front C channel;
[0188] Optimize loss through dual-path collaboration By incorporating the total loss, the two prediction paths can supervise each other and optimize collaboratively, thereby improving the efficiency of unlabeled data utilization.
[0189] S5-3: Enhanced through a triple hybrid supervision module;
[0190] S5-3-1: Random Sampling Binary Mask Based on this, hybrid image data is constructed. and its mixed labels :
[0191] ;
[0192] ;
[0193] in, For element-wise multiplication, For labeled 2D image data, For unlabeled 2D image data, For labeled 2D image data, the true labels are... The pseudo-labels are the unlabeled predictions of the teacher model after CAEF filtering.
[0194] S5-3-2: Mixing image data After inputting the student model, a dual-path decoupled prediction head is used. Provide dual-path probability output and The final probability output is then calculated by grouping the overall mixed image data according to the regions.
[0195] The formula is as follows:
[0196] ;
[0197] in, The probability of the mixed image data for the final output student model. For element-wise multiplication, The predicted probability of the mixed image data for the first C channels of the student model. The predicted probability of the mixed image data of the C channel after the student model;
[0198] S5-3-3: Calculate the triple hybrid supervision loss;
[0199] The triple hybrid supervision loss is calculated using the following formula:
[0200] ;
[0201] in, This indicates the loss from triple hybrid supervision. It is a weighted sum of cross-entropy loss and Dice loss. For the overall loss, For regional losses, To calculate the global loss of the mixed image data, global supervision is performed on the entire mixed image region. and Corresponding to local areas respectively and Regional-level losses will be monitored locally.
[0202] S5-4: Based on the prototype comparison learning strategy, perform prototype comparison learning;
[0203] S5-4-1: Integrate labeled features with high-quality unlabeled features from the teacher model, and construct category prototypes using the mean of batch intra-class features;
[0204] ;
[0205] in, For the first Accumulated categories after rounds of training prototype, For the first Accumulated categories after rounds of training prototype, For only based on the first The temporary prototype calculated from the training data. For smoothing coefficients;
[0206] Through the aforementioned progressive update strategy, the category prototype can continuously absorb discriminative information from labeled samples and high-quality unlabeled samples during training, gradually forming a stable and representative class-level semantic center. Pixel-level prediction is then performed using the prototype. For ease of description, we will use the round information in the prototype representation. Omitted.
[0207] S5-4-2: For the pixel features of the student model, calculate the prototype probability based on the cosine similarity normalization with the category prototype;
[0208] ;
[0209] in, For prototypes of all categories Summation, For student network pixels feature, Represents cosine similarity. For student model pixels Features and the first Accumulated categories after rounds of training prototype cosine similarity, For student model pixels Features and the first Accumulated categories after rounds of training prototype Cosine similarity; The scaling factor, in this embodiment, ranges from 0.07 to 0.09. This pixel probability representation obtained through the prototype is called the prototype probability. This prototype probability is only used for consistency screening and contrastive learning and does not directly participate in the main segmentation supervision.
[0210] S5-4-3: Filtering is performed using a filtering function, and only unlabeled pixel features that are consistently predicted by the student model, teacher model, and prototype are retained for comparative learning;
[0211] A progressive screening strategy is used. In the early stages of training, unlabeled pixel features from the student network that are consistent with the predictions of both the student and teacher models are used for contrastive learning. As training progresses, the screening rigor is gradually increased. The consistency of predictions from the student model, the teacher model, and the prototype is used to screen unlabeled pixels for reliability. Only pixel features that are consistent with the predictions of all three models are used for contrastive learning, or a dynamic threshold φ is set.
[0212] The filtering function is as follows:
[0213] ;
[0214] in, It is an indicator function, taking the value 1 if the condition is true, and 0 otherwise. , and For unlabeled pixels, the student model, teacher model, and prototype branch are respectively represented. The category predictions of all three are obtained by applying the argmax operation to their probability predictions; A set of pixel indices representing unlabeled samples;
[0215] For any satisfying Unlabeled pixel features If the predicted category matches the anchor prototype category, it is considered a positive sample; otherwise, it is considered a negative sample.
[0216] S5-4-4: Calculate the prototype contrast loss;
[0217] Using category prototypes as anchors, reliable features of the same category are brought closer together and features of different categories are pushed further apart, forming a prototype-level contrast loss, thereby achieving cross-distribution class-level semantic alignment;
[0218] The formula is as follows:
[0219] ;
[0220] in, For prototype comparison loss, For consistency filtering function, Represents cosine similarity. The value is a temperature coefficient, which is 0.1 or 0.5 in this embodiment; It is a logarithmic function; For student network pixels feature, Indicates the first Accumulated categories after rounds of training prototype, express An exponential function with base 0;
[0221] This achieves cross-distribution semantic alignment by bringing similar features closer together and dissimilar features further apart.
[0222] S5-5: Total Loss Optimization and Model Update;
[0223] S5-5-1: Calculate the total loss;
[0224] The total loss is calculated using the following formula:
[0225] ;
[0226] in, To optimize losses through dual-path collaboration, The supervised loss for the student model, Losses due to pseudo-supervision This indicates the loss from triple hybrid supervision. , These are weighting coefficients, which are set to 0.5 and 0.1 respectively in this embodiment. Indicates prototype contrast loss;
[0227] S5-5-2: Model Update;
[0228] S5-5-2-1: Backpropagation total loss, update student model weights, update teacher network weights according to EMA rules;
[0229] S5-5-2-3: Continuous iterative training, calculate the Dice metric on the validation set after each training round, and select the model weights with the best Dice metric after training is completed;
[0230] S6: Model Inference and Result Visualization;
[0231] S6-1: The unlabeled medical image data collected in step S1 is preprocessed in step S2;
[0232] S6-2: Input the preprocessed image data into the trained student model to obtain the predicted probability map;
[0233] S6-3: Output the predicted probability map to the 2D slice visualization module;
[0234] S6-4: Label the predicted results on the image data to visualize the results;
[0235] S6-4-1: Based on the predicted probability map, classify each pixel and generate a semantic segmentation mask;
[0236] S6-4-2: Classify by image type;
[0237] In this embodiment, cardiac images are divided into four categories: left ventricle, right ventricle, myocardium, and background.
[0238] Cardiac images are classified into two categories: prostate region and background.
[0239] S6-4-3: Assign highly distinguishable color markers to different categories to achieve intuitive visualization of segmented regions and anatomical structures.
[0240] Compared to fully supervised segmentation methods, this approach exhibits superior performance with extremely low annotation rates, achieving segmentation results comparable to fully supervised U-Net with only a small amount of labeled data. A dual-path collaborative optimization training method alleviates the feature distribution shift problem in semi-supervised training at both the input and output levels. A category-adaptive entropy filtering mechanism is proposed to filter out difficult pixels in unlabeled pseudo-labels, improving the quality of pseudo-labels. Finally, prototype-based comparative learning is used, employing a consistency screening strategy to construct sample features, mitigating the feature distribution inconsistency problem at the feature level. The complementary combination of these three methods effectively improves the segmentation accuracy of the semi-supervised model. Experimental results are shown in Tables 1 and 2.
[0241] Table 1. Comparison with other state-of-the-art methods on the ACDC heart dataset
[0242]
[0243] Table 2. Comparison with other state-of-the-art methods on the PROMISE12 prostate dataset
[0244]
[0245] To better illustrate this technical solution, segmentation experiments were conducted on heart and prostate datasets using this solution. The segmentation results are as follows: Figure 7 , Figure 8 As shown, Figure 7 , Figure 8 Visual comparisons with other state-of-the-art semi-supervised methods are provided on the ACDC heart dataset and the PROMISE12 prostate dataset. In the segmentation visualization of the heart dataset, green represents myocardium, and red and blue represent the left and right ventricles, respectively. It can be seen that the proposed invention achieves overall segmentation results close to the true labels on both datasets under semi-supervised conditions, and compared to other methods, it is more accurate in handling segmentation details.
Claims
1. A semi-supervised image segmentation method based on collaborative optimization, characterized in that: Includes the following steps: S1: Send the medical image data acquired by the data acquisition module to the local machine, read the raw data, and input it into the data preprocessing module; S2: The data preprocessing module converts medical image data into a unified format and performs standardization processing; S3: Initialize the model; S4: Adaptive category filtering is performed on the teacher network's predictions on unlabeled images using the category-adaptive entropy filtering module; S4-1: Probability output of the teacher model on unlabeled samples Calculate each category The average entropy; The formula is as follows: ; Where the subscript t represents the teacher model, For each category The average entropy, This indicates that among all unlabeled samples in the current training batch B, the predicted value is... A collection of pixels of a class; Represents a set Number of elements in the middle; Represents probability entropy; This represents the unlabeled probability output of the teacher model; Indicates the total number of categories; S4-2: Dynamically allocate the unreliable point filtering ratio for each category; Based on average entropy, linear interpolation is performed according to category difficulty, and an unreliable point filtering ratio is assigned to each category. ; ; in, For the minimum filtering ratio range of categories, This represents the maximum filtering ratio range for each category. To prevent small amounts from being divided by zero, The minimum average entropy among all categories, It is the highest average entropy among all categories; Indicate category The average entropy; S4-3: Generate the filtering threshold and final pseudo-labels; S4-3-1: Sort the pixel entropy for each predicted category and apply it according to the different filtering ratios for each category. Take the corresponding filtration ratio The filtering threshold is obtained from the quantiles. ; S4-3-2: Unlabeled predictions for the teacher model based on thresholds Perform pixel-level filtering to obtain the final unlabeled pseudo-labels; ; in, The pseudo-labels for the final unlabeled data. This represents the probability entropy of the unlabeled probability output of the teacher model. This represents the unlabeled probability output of the teacher model; S4-3-3: Use filtered pseudo-labels Supervised student model unlabeled prediction, calculate pseudo-supervised loss ; ; in, For cross-entropy loss, This represents the unlabeled probability output of the teacher model. These are pseudo-labels for the final unlabeled data; S5: Model training; S6: Model reasoning and result visualization.
2. The semi-supervised image segmentation method based on collaborative optimization according to claim 1, characterized in that: Step S2 also includes: S2-1: Slice 3D medical image data into 2D images by layer, and uniformly scale or crop them to the set size; S2-2: Standardize the pixel intensity of the sliced 2D image data; The formula is as follows: ; in, The raw grayscale value of a single 2D image data pixel. , These are the mean and standard deviation of the grayscale values of all pixels, respectively. Standard scores; S2-3: Preprocess the standardized image data; Add random flipping, slight rotation, and equal-weight enhancement operations, and combine them with region copy-paste to generate a blended image.
3. The semi-supervised image segmentation method based on collaborative optimization according to claim 1, characterized in that: Step S5 also includes the following steps: S5-1: Dual-path decoupled pre-training; S5-2: Dual-path collaborative optimization activated; S5-3: Enhanced through a triple hybrid supervision module; S5-4: Prototype Comparison Learning; S5-5: Total Loss Optimization and Model Update.
4. The semi-supervised image segmentation method based on collaborative optimization according to claim 3, characterized in that: Step S5-1 also includes the following steps: S5-1-1: Input labeled 2D image data and unlabeled 2D image data; S5-1-2: Prediction of labeled 2D image data; Labeled prediction of labeled 2D image data using the first C channel output. And use real labels to supervise the labeled predictions. Calculate supervised loss ; S5-1-3: Prediction of unlabeled 2D image data; S5-1-3-1: The teacher model generates predictions for unlabeled 2D image data, and the pseudo-labels are obtained after filtering by the CAEF module. ; S5-1-3-2: Unlabeled predictions output from the back C channel of the student model Supervised unlabeled prediction using pseudo-labels Calculate the pseudo-supervision loss .
5. The semi-supervised image segmentation method based on collaborative optimization according to claim 3, characterized in that: Step S5-2 also includes the following steps: S5-2-1: Uncertainty Computation and Fusion; S5-2-1-1: Through the student model Predicting the C-channel probability before outputting unlabeled 2D image data And the predicted probability of the C channel ; S5-2-1-2: Substitute the predicted probability into the following formula to calculate the probability entropy; ; in, Indicates the total number of categories. Represents probability entropy. Indicates the predicted probability. Represents a logarithmic function; S5-2-1-3: Weighted average fusion yields a dual-path uncertainty diagram. ; The dual-path uncertainty is fused using the following formula: ; in, , Representing the student model The unlabeled probability output; For student models The predicted probability entropy of the front C channel, The predicted probability entropy of the C channel after the student model; and through exponential mapping Transform uncertainty into Dice loss weights; S5-2-2: Cross-supervision and collaborative optimization; S5-2-2-1: Student Model The two probability outputs are used to obtain the prediction result through the argmax function. and ; S5-2-2-2: The dual-path collaborative optimization loss is calculated using the following formula: ; in, To optimize losses through dual-path collaboration, It is the basic loss function, with Dice loss having uncertainty weights; For student models The prediction results for the C channel are as follows. For student models Prediction results for the C-channel.
6. The semi-supervised image segmentation method based on collaborative optimization according to claim 3, characterized in that: Step S5-3 also includes the following steps: S5-3-1: Random Sampling Binary Mask Based on this, hybrid image data is constructed. and its mixed labels : ; ; in, For element-wise multiplication, For labeled 2D image data, For unlabeled 2D image data, For labeled 2D image data, the true labels are... The pseudo-labels are the unlabeled predictions of the teacher model after CAEF filtering. S5-3-2: Mixing image data After inputting the student model, a dual-path decoupled prediction head is used. Provide dual-path probability output and The final probability output is then calculated by grouping the overall mixed image data according to the regions. The formula is as follows: ; in, The probability of the mixed image data for the final output student model. For element-wise multiplication, The predicted probability of the mixed image data for the first C channels of the student model. The predicted probability of the mixed image data of the C channel after the student model; S5-3-3: Calculate the triple hybrid supervision loss; The triple hybrid supervision loss is calculated using the following formula: ; in, This indicates the loss from triple hybrid supervision. It is a weighted sum of cross-entropy loss and Dice loss. For the overall loss, For regional losses; To calculate the global loss of the mixed image data, global supervision is performed on the entire mixed image region. and Corresponding to the target area With background area Regional-level losses will be monitored locally.
7. The semi-supervised image segmentation method based on collaborative optimization according to claim 3, characterized in that: Step S5-4 also includes the following steps: S5-4-1: Integrate labeled features with high-quality unlabeled features from the teacher model, and construct category prototypes using the mean of batch intra-class features; ; in, For the first Accumulated categories after rounds of training prototype, For the first Accumulated categories after rounds of training prototype, For only based on the first The temporary prototype calculated from the training data. For smoothing coefficients; S5-4-2: For the pixel features of the student model, calculate the prototype probability based on the cosine similarity normalization with the category prototype; ; in, For all categories Summing the prototypes, For student model pixels feature, Represents cosine similarity. This is the scaling factor; For student model pixels Features and the first Accumulated categories after rounds of training prototype cosine similarity, For student model pixels Features and the first Accumulated categories after rounds of training prototype Cosine similarity; S5-4-3: Filtering is performed using a filtering function, and only unlabeled pixel features that are consistent in prediction among the student model, teacher Moe update, and prototype are retained for comparative learning; The filtering function is as follows: ; in, It is an indicator function. , and For unlabeled pixels, the student model, teacher model, and prototype branch are respectively represented. The category predictions of all three are obtained by applying the argmax operation to their probability predictions; A set of pixel indices representing unlabeled samples; S5-4-4: Calculate the prototype contrast loss; The formula is as follows: ; in, For prototype comparison loss, For consistency filtering function, Represents cosine similarity. Temperature coefficient; It is a logarithmic function; For student model pixels feature, Indicates the first Accumulated categories after rounds of training prototype, express An exponential function with base 0; For student model pixels Features and the first Accumulated categories after rounds of training prototype Cosine similarity; Step S5-5 also includes the following steps: S5-5-1: Calculate the total loss; The total loss is calculated using the following formula: ; in, To optimize losses through dual-path collaboration, The supervised loss for the student model, Losses due to pseudo-supervision This indicates the loss from triple hybrid supervision. , These are the weighting coefficients. Indicates prototype contrast loss; S5-5-2: Model Update; S5-5-2-1: Backpropagation total loss, update student model weights, update teacher network weights according to EMA rules; S5-5-2-3: Continuous iterative training, calculate the Dice metric on the validation set after each training round, and select the model weights with the best Dice metric after training is completed; Step S6 also includes: S6-1: The unlabeled medical image data collected in step S1 is preprocessed in step S2; S6-2: Input the preprocessed image data into the trained student model to obtain the predicted probability map; S6-3: Output the predicted probability map to the 2D slice visualization module; S6-4: Label the predicted results on the image data to visualize the results; S6-4-1: Based on the predicted probability map, classify each pixel and generate a semantic segmentation mask; S6-4-2: Classify by image type; S6-4-3: Assign highly distinguishable color markers to different categories to achieve intuitive visualization of segmented regions and anatomical structures.
8. A semi-supervised image segmentation system based on collaborative optimization, used to implement the semi-supervised image segmentation method based on collaborative optimization as described in claims 1-7, characterized in that, include: The data acquisition module is used to acquire both unlabeled and labeled medical image data. The data preprocessing module is used to slice 3D medical images to generate 2D medical images, and to perform image size unification, pixel intensity normalization and standardization operations. A dual-path collaborative optimization training mechanism is used for two-stage progressive dual-path decoupling prediction and collaborative optimization. The category adaptive entropy filtering module is used to adaptively filter the prediction difficulty of each category within the same training batch; The prototype contrastive learning strategy is used to construct category prototypes and conduct contrastive learning, aligning features of labeled and unlabeled data to enhance feature intra-class compactness and inter-class discriminativeness. The slice visualization module is used to determine the pixel-by-pixel category of the model's output probability map and convert the prediction results into corresponding segmentation masks.