Self-adaptive image segmentation method and device based on mutual information regularization and medium
By adopting an adaptive image segmentation method based on mutual information regularization in the image segmentation task, the problem of model interpretability and high training cost in the target domain is solved. Through iterative training and loss function optimization, pseudo label noise is reduced and improved improve the accuracy and reliability of image segmentation.
Patent Information
- Application Number
- CN202410681763.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-09-13
AI Technical Summary
The existing technology suffers from the problems of lack of model interpretability, high training cost and pseudo label noise in image segmentation tasks, resulting in performance degradation in the target domain.
An adaptive image segmentation method based on mutual information regularization is used to minimize the relative entropy between pseudo labels and model output probabilities and maximize the mutual information between pseudo labels and target domain data through iterative training to generate hard labels and construct losses. Function to optimize the model, reduce pseudo label noise and improve model reliability.
It improves the accuracy and reliability of image segmentation results, reduces model training costs, and enhances the interpretability and generalization of the model.
Smart Images

Figure CN118644516A
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image segmentation, and in particular relates to an adaptive image segmentation method, device and medium based on mutual information regularization. Background Art
[0002] Domain adaptation can transfer deep learning models from a domain that has been labeled or has a large amount of data (source domain) to another domain that lacks a large amount of labeled data or is related to the source domain but has certain differences (target domain), so as to improve its performance in the target domain. The implementation of domain adaptation methods in image segmentation tasks can be roughly divided into two categories: generative methods and pseudo-label methods. Among them, generative methods mainly include two strategies: one is cross-domain style transfer through adversarial training, and the other is learning domain-invariant feature representations between different domains. However, since domain adaptation methods that do not require source domain data cannot obtain source domain data during training, the above methods cannot be directly implemented under this condition, and methods based on adversarial training usually require longer training time. There are also many methods for generating pseudo labels using self-training. Some methods use prediction entropy to ensure different decision boundaries in the target domain. For example, the paper Mlsl: Multi-level self-supervised learning for domain adaptation with spatially independent and semantically consistent labeling (Javed Iqbal, Mohsen Ali., Proceedings of the IEEE / CVF Winter Conference on Applications of Computer Vision. 2020: 1864–1873) generates pseudo labels in the target domain based on confidence or uncertainty estimates. For example, the paper Unsupervised domain adaptation for semantic segmentation via class-balanced self-training (YangZou, Zhiding Yu, BVK Kumar, Jinsong Wang, Proceedings of the European conference on computer vision.2018:289–305) proposed a balanced classification selection strategy to select pseudo-labeled target samples with high confidence, but the above methods require additional artificial division or additional prior conditions. The former may lead to a lack of interpretability of the model, and the additional conditions in the latter may affect model training if used improperly. In addition, pseudo labels are prediction results generated by the model based on target domain data, which may contain errors or noise. Such pseudo labels may mislead the model during training, resulting in a decrease in the performance of the model in the target domain. Therefore, it is necessary to design a model with stronger interpretability and lower training cost to achieve image segmentation and improve the accuracy and reliability of image segmentation results. Summary of the invention
[0003] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and to provide an adaptive image segmentation method, device and medium based on mutual information regularization, so as to further improve the accuracy of the image segmentation results.
[0004] The purpose of the present invention can be achieved by the following technical solutions:
[0005] The present invention provides an adaptive image segmentation method based on mutual information regularization, comprising the following steps:
[0006] Obtain an image to be segmented, input a trained adaptive image segmentation model based on mutual information regularization, output the probability that each pixel in the image to be segmented belongs to each preset segmentation category, and obtain the image segmentation result accordingly;
[0007] The adaptive image segmentation model based on mutual information regularization is iteratively trained using a domain adaptation method, with a labeled image dataset as source domain data and an unlabeled image dataset as target domain data, with the goal of minimizing the relative entropy between pseudo labels and the output probability of the adaptive image segmentation model based on mutual information regularization and maximizing the mutual information between pseudo labels and the target domain data. The pseudo labels are generated according to the output probability of the adaptive image segmentation model based on mutual information regularization and a preset threshold.
[0008] Furthermore, the objective function of the adaptive image segmentation model based on mutual information regularization is specifically expressed as follows:
[0009]
[0010] Among them, W * is a pseudo label, represents the constraint that the sum of all output probabilities is 1, K is the number of preset segmentation categories, and D KL is the KL divergence, w i is the pseudo label of the i-th pixel, p i is the probability of the i-th pixel output by the model, S is the image size, β is the hyperparameter, I is the mutual information, is a hard label generated from the pseudo label, is the pixel position index, w ij represents the pseudo label of the jth category of the i-th pixel, p ij represents the probability that the i-th pixel belongs to the j-th category, Indicates w ij Sum over i.
[0011] Furthermore, the optimal solution of the objective function of the adaptive image segmentation model based on mutual information regularization is obtained by solving the KKT condition:
[0012]
[0013] Furthermore, the stopping condition for the iterative training of the adaptive image segmentation model based on mutual information regularization is that the model loss or the number of iterations reaches a preset value.
[0014] Furthermore, the model loss is constructed based on the BEC loss of the model output probability and the hard label generated based on the pseudo label, the BEC loss of the optimal pseudo label and the hard label generated based on the pseudo label, and the single image loss.
[0015] Furthermore, the calculation formula for the single image loss is as follows:
[0016]
[0017] Among them, L mira is the loss of a single image, K is the number of preset segmentation categories, S is the image size, and u ij is the iteration operator, p ij Output probability for the model.
[0018] Furthermore, the expression of the model loss is as follows:
[0019] L seg =bce(peudolabel,prediction)+α 1 L mira +α 2 L mira_bce
[0020] Among them, L seg is the model loss, bce(peudolabel, prediction) is the BEC loss of the model output probability and the hard label generated based on the pseudo label, and L mira_bce is the BEC loss of the optimal pseudo-label and the hard label generated based on the pseudo-label, L mira is the single image loss, α 1 and α 2 is the coefficient.
[0021] Furthermore, during the iterative training of the adaptive image segmentation model based on mutual information regularization, the structure and parameters of the model are updated through gradient back propagation.
[0022] The present invention also provides an electronic device, comprising a memory, a processor, and a program stored in the memory, wherein the processor implements the above method when executing the program.
[0023] The present invention also provides a computer-readable storage medium on which a computer program is stored, and the program implements the above method when executed by a processor.
[0024] Compared with the prior art, the present invention has the following beneficial effects:
[0025] 1. The present invention realizes image segmentation through an adaptive image segmentation model based on mutual information regularization, wherein the adaptive image segmentation model based on mutual information regularization adopts a domain adaptive method for iterative training, takes a labeled image dataset as source domain data, and an unlabeled image dataset as target domain data, with the goal of minimizing the relative entropy between a pseudo-label generated according to the model output probability and the model output probability and maximizing the mutual information between the pseudo-label and the target domain data. The former can reduce the classification ambiguity caused by class overlap, and the latter can strengthen the correlation between the pseudo-label and the target domain data. The above scheme solves the noise problem in the pseudo-label, improves the reliability, interpretability and generalization of the model, and further improves the accuracy of the image segmentation result.
[0026] 2. During the model training process, the present invention constructs a loss function based on the model loss, the BEC loss of the model output probability and the hard label generated based on the pseudo label, the BEC loss of the optimal pseudo label and the hard label generated based on the pseudo label, and the single image loss. It only needs to use the existing information for optimization calculation, and does not require an additional constraint module, which greatly reduces the training cost of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 Schematic diagram of the training process of the adaptive image segmentation model based on mutual information regularization;
[0028] Figure 2 Schematic diagram of the structure of the adaptive image segmentation model based on mutual information regularization. DETAILED DESCRIPTION
[0029] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.
[0030] Example:
[0031] This embodiment provides an adaptive image segmentation method based on mutual information regularization, comprising the following steps:
[0032] The image to be segmented is obtained, and the image after image standardization and random cropping is input into the trained adaptive image segmentation model based on mutual information regularization, that is, the target model. The probability that each pixel in the image to be segmented belongs to each preset segmentation category can be output, and the image segmentation result can be obtained accordingly.
[0033] The adaptive image segmentation model based on mutual information regularization adopts the DeepLabv3+ framework, and its structure is as follows Figure 2 As shown. The adaptive image segmentation model based on mutual information regularization adopts a domain adaptation method for iterative training, with a larger labeled image dataset as the source domain data and a smaller unlabeled image dataset as the target domain data. A suitable window is selected according to the image size of the source domain dataset and the target domain dataset. In this embodiment, the images are uniformly scaled to a fixed size of 224*224, randomly cropped with a probability of 50%, and all images are standardized before being input into the adaptive image segmentation model based on mutual information regularization. Networks such as DeepLabv3+ or Unet can be used as the basic framework of the pre-training model and the target model.
[0034] For a segmentation model f θ , whose output is a K-dimensional probability vector, where K is the number of predefined segmentation categories. According to the K-dimensional probability vector, the corresponding pseudo label can be generated for the input target domain data. Define the output of the segmentation model as probability And there is p i =softmax(f θ (x i ) / τ), τ represents the temperature coefficient. In this embodiment, the objective function of the adaptive image segmentation model based on mutual information regularization includes two parts. One is to minimize the relative entropy between the pseudo-label and the output probability of the segmentation model, aiming to reduce the distance between the pseudo-label distribution and the probability distribution, and learn the pseudo-label distribution that can explain the probability distribution; the other is to maximize the mutual information between the pseudo-label and the target domain data, aiming to reduce the uncertainty in the data and strengthen the correlation between the pseudo-label and the target domain data. The pseudo-label is generated based on the model output probability, that is, the model outputs the probability of each preset category, and then generates the pseudo-label according to the preset threshold.
[0035] The expression of the objective function is as follows:
[0036]
[0037] Among them, W * is a pseudo label (soft label), represents the constraint that the sum of all output probabilities is 1, D KL is the KL divergence, wi is the pseudo label of the i-th pixel, p i is the probability of the i-th pixel output by the model, β is a hyperparameter, I is the mutual information, According to the distribution The generated hard labels (i.e. 0,1 labels), is the pixel position index.
[0038] Using the definitions of mutual information and relative entropy to expand the above formula, we can get:
[0039]
[0040] Among them, w ij represents the pseudo label of the jth category of the i-th pixel, p ij represents the probability that the i-th pixel belongs to the j-th category, Indicates w ij Sum over i.
[0041] The optimization problem described in the above formula is a strictly convex optimization problem. The optimal solution of the objective function is obtained by solving the KKT (Karush-Kuhn-Tucker) condition:
[0042]
[0043] Summing over i yields:
[0044]
[0045] Using iterative operators To iterate:
[0046]
[0047] The stopping condition of iterative training is that the model loss or the number of iterations reaches a preset value. seg BEC loss bce(peudolabel, prediction) based on model output probability and hard label generated based on pseudo label, BEC loss L based on optimal pseudo label and hard label generated based on pseudo label mira_bce and single image loss L seg Construction. The expression of model loss is as follows:
[0048] L seg =bce(peudolabel,prediction)+α 1 L mira +α 2 L mira_bce
[0049] Among them, α 1 and α2 is the coefficient.
[0050] Single image loss L mira The calculation formula is as follows:
[0051]
[0052] The training process of the adaptive image segmentation model based on mutual information regularization is as follows: Figure 1 As shown, the following steps are included:
[0053] S1. Pre-train the adaptive image segmentation model based on mutual information regularization based on source domain data, feed the target domain data into the pre-trained model to generate pseudo labels.
[0054] S2. Use mutual information regularization to remove noise in pseudo labels. Regularization achieves its purpose by constraining mutual information in the loss function (i.e., regularization term). The regularization term imposes a certain penalty on the model parameters, thereby limiting the size or complexity of the model parameters.
[0055] S3: Input the target domain data and the pseudo-label obtained in step S1 into an adaptive image segmentation model based on mutual information regularization, and output a predicted value.
[0056] S4: Calculate the cross entropy loss between the pseudo-label after denoising in step S2 and the predicted value generated in step S3, and update the parameters of the model through gradient back propagation until the model loss or the number of iterations reaches the set threshold.
[0057] If the above method is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0058] The above description of the embodiments is to facilitate the understanding and use of the invention by those skilled in the art. It is obvious that those skilled in the art can easily make various modifications to these embodiments and apply the general principles described herein to other embodiments without creative work. Therefore, the present invention is not limited to the above embodiments, and improvements and modifications made by those skilled in the art based on the disclosure of the present invention without departing from the scope of the present invention should be within the scope of protection of the present invention.
Claims
1. An adaptive image segmentation method based on mutual information regularization, characterized in that: The following steps are involved: Obtain an image to be segmented, input a trained adaptive image segmentation model based on mutual information regularization, output the probability that each pixel in the image to be segmented belongs to each preset segmentation category, and obtain the image segmentation result accordingly; The adaptive image segmentation model based on mutual information regularization is iteratively trained using a domain adaptation method, with a labeled image dataset as source domain data and an unlabeled image dataset as target domain data, with the goal of minimizing the relative entropy between pseudo labels and the output probability of the adaptive image segmentation model based on mutual information regularization and maximizing the mutual information between pseudo labels and the target domain data. The pseudo labels are generated according to the output probability of the adaptive image segmentation model based on mutual information regularization and a preset threshold.
2. The method for adaptive image segmentation based on mutual information regularization according to claim 1, characterized in that: The expression of the objective function of the adaptive image segmentation model based on mutual information regularization is as follows: Among them, W * is a pseudo label, represents the constraint that the sum of all output probabilities is 1, K is the number of preset segmentation categories, and D KL is the KL divergence, w i is the pseudo label of the i-th pixel, p i is the probability of the i-th pixel output by the model, S is the image size, β is the hyperparameter, I is the mutual information, is a hard label generated from the pseudo label, is the pixel position index, w ij represents the pseudo label of the jth category of the i-th pixel, p ij represents the probability that the i-th pixel belongs to the j-th category, Indicates w ij Sum over i.
3. The method for adaptive image segmentation based on mutual information regularization according to claim 2, characterized in that: The optimal solution of the objective function of the adaptive image segmentation model based on mutual information regularization is obtained by solving the KKT condition:
4. The method for adaptive image segmentation based on mutual information regularization according to claim 1, characterized in that: The stopping condition of the iterative training of the adaptive image segmentation model based on mutual information regularization is that the model loss or the number of iterations reaches a preset value.
5. The method for adaptive image segmentation based on mutual information regularization according to claim 4, characterized in that: The model loss is constructed based on the BEC loss of the model output probability and the hard label generated based on the pseudo label, the BEC loss of the optimal pseudo label and the hard label generated based on the pseudo label, and the single image loss.
6. The method for adaptive image segmentation based on mutual information regularization according to claim 5, characterized in that: The calculation formula for the single image loss is as follows: Among them, L mira is the loss of a single image, K is the number of preset segmentation categories, S is the image size, and u ij is the iteration operator, p ij Output probability for the model.
7. The method for adaptive image segmentation based on mutual information regularization according to claim 5, characterized in that: The expression of the model loss is as follows: L seg =bce(peudolabel,prediction)+α1L mira +α2L mira_bce Among them, L seg is the model loss, bce(peudolabel, prediction) is the BEC loss of the model output probability and the hard label generated based on the pseudo label, and L mira_bce is the BEC loss of the optimal pseudo-label and the hard label generated based on the pseudo-label, L mira is the single image loss, and α1 and α2 are coefficients.
8. The method for adaptive image segmentation based on mutual information regularization according to claim 1, characterized in that: During the iterative training of the adaptive image segmentation model based on mutual information regularization, the structure and parameters of the model are updated through gradient back propagation.
9. An electronic device comprising a memory, a processor, and a program stored in the memory, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 8 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
