Medical image segmentation method and system based on sparsity adaptive bernoulli diffusion and uncertainty guidance
By employing a sparsity-adaptive Bernoulli diffusion and uncertainty-guided approach, this method addresses the issues of mismatch between binary masks and continuous noise, disappearance of small target signals, and blurred boundaries in medical image segmentation. It achieves higher accuracy and more stable segmentation results and is applicable to the segmentation of colon polyps and multiple abdominal organs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHONGQING UNIV OF POSTS & TELECOMM
- Filing Date
- 2026-05-06
- Publication Date
- 2026-06-12
AI Technical Summary
Existing diffusion models in medical image segmentation suffer from problems such as mismatch between binary masks and continuous Gaussian noise, easy disappearance of signals from small targets, difficulty in accurately segmenting regions with blurred boundaries, and unstable inference results.
We employ a sparsity-adaptive Bernoulli diffusion and uncertainty-guided approach. By constructing a Bernoulli forward diffusion process in a discrete state space, we design an adaptive noise scheduling strategy to protect small targets. Combined with multi-scale feature fusion and uncertainty graph construction, we optimize the loss function and trajectory integration inference strategy to improve segmentation accuracy and stability.
It effectively adapts to binary segmentation masks, protects signals of small targets, enhances the learning ability of boundary regions, improves segmentation accuracy and inference stability, and is suitable for complex scenarios such as colon polyps and abdominal multi-organ segmentation.
Smart Images

Figure CN122199980A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of medical image processing and analysis technology, and relates to a medical image segmentation method and system based on sparsity adaptive Bernoulli diffusion and uncertainty guidance. Background Technology
[0002] Medical image segmentation is a key technology in medical image analysis and computer-aided diagnosis, and its results directly affect the accuracy of lesion identification, quantitative organ analysis, and subsequent clinical decision-making. In tasks such as colon polyp segmentation and abdominal multi-organ segmentation, the segmentation targets are often characterized by blurred boundaries, complex structures, large scale differences, and sparse foreground regions. Therefore, high demands are placed on the modeling ability, boundary characterization ability, and inference stability of the segmentation model.
[0003] In recent years, deep learning-based methods for medical image segmentation have made significant progress. Existing methods mainly include those based on convolutional neural networks (CNNs), Transformers, and diffusion models. CNNs excel at modeling local texture information but have limited ability to model long-range dependencies. Transformer methods enhance global representation capabilities through self-attention mechanisms, but may still suffer from insufficient local structure representation in scenarios with small targets and weak boundaries. Diffusion models, due to their progressive generation and strong distribution modeling capabilities, have been introduced into medical image segmentation tasks in recent years and have shown good application potential.
[0004] However, existing diffusion segmentation methods still have significant shortcomings in medical image scenarios. First, mainstream diffusion models often use continuous Gaussian noise to construct the forward diffusion process, while medical image segmentation labels are typically binary discrete masks, leading to a mismatch in data attributes. Continuous Gaussian diffusion causes the binary mask to deviate from its original discrete state space, introducing a large number of intermediate continuous states without clear physical meaning, thus increasing the difficulty of model learning. Second, small lesions or sparse targets in medical images are prone to signal attenuation or even disappearance in the early stages of diffusion. Once key foreground information is prematurely destroyed during the forward noise addition process, subsequent inverse recovery becomes extremely difficult. Third, target boundaries in medical images are often blurred. If the training phase does not focus on areas with difficult boundaries, problems such as overly smoothed boundaries or local morphological distortions can easily occur. Fourth, the diffusion model inference process relies on progressive inverse sampling, which introduces a degree of randomness, easily causing fluctuations in the final segmentation result at the boundaries, affecting the stability of model inference.
[0005] Therefore, how to construct a medical image segmentation method that can adapt to the discrete characteristics of binary segmentation masks, protect small target signals, enhance the learning ability of fuzzy boundary regions, and improve inference stability has become an important technical problem to be solved in this field. Summary of the Invention
[0006] In view of this, the purpose of this invention is to provide a medical image segmentation method and system based on sparsity adaptive Bernoulli diffusion and uncertainty guidance, which aims to solve the problems in the prior art such as the mismatch between continuous Gaussian diffusion and binary mask attributes, the easy disappearance of signals in small targets in the early stage of diffusion, the difficulty in accurately segmenting blurred boundary regions, and the instability of inference results due to random sampling.
[0007] To achieve the above objectives, the present invention provides the following technical solution: A medical image segmentation method based on sparsity adaptive Bernoulli diffusion and uncertainty guidance, the method specifically includes the following steps: S1. Image data preprocessing: Obtain the medical image dataset and its corresponding segmentation labels, and perform size unification, intensity normalization and cropping on the original medical images to obtain standardized images; S2. Bernoulli forward diffusion construction: For the binary segmentation mask, a Bernoulli forward diffusion process defined in the discrete state space is constructed, and an adaptive noise scheduling strategy based on the target sparsity is designed to dynamically adjust the noise addition rate in the early stage of forward diffusion. S3. Multi-scale conditional feature fusion: The standardized original medical image is input into the conditional encoder, and the noise mask is input into the mask encoder. Spatial feature stitching is used in the shallow layer, and cross-attention mechanism is used in the deep layer to achieve multi-scale conditional feature fusion. S4. Bernoulli inverse denoising prediction: Input the fused features into the decoder to predict the Bernoulli noise probability parameters at the current time step, and recover the probability representation of the original segmentation mask through the calibration function. S5. Uncertainty Map Construction and Loss Reweighting: Pixel-level information entropy is calculated based on the recovered segmentation probability map to construct an uncertainty map. The loss function is then dynamically reweighted based on this uncertainty map to enhance the model's ability to learn about fuzzy boundaries and difficult-to-distinguish regions. S6. Model Training: Construct a joint loss function consisting of uncertainty-weighted segmentation loss and distribution constraint loss, and update the model parameters through backpropagation; S7. Trajectory Integration Reasoning: During the reasoning process, the prediction results of multiple key time steps at the end of the inverse denoising are extracted. The fusion weights are assigned according to the mean uncertainty of the results of each time step, and weighted integration is performed to obtain the final medical image segmentation result.
[0008] Furthermore, in step S1, the medical image data is first subjected to intensity normalization processing, the expression of which is:
[0009] in, Represents the original medical image, and These represent the mean and standard deviation of image intensity in the dataset, respectively. This represents the normalized image; The normalized image is then cropped at the center or resized.
[0010] in, This indicates a cropping operation. This represents the standardized input image.
[0011] Furthermore, in step S2, for the binary segmentation mask Construct a Bernoulli forward diffusion process defined in discrete state space, with the state transition expression as follows:
[0012]
[0013] in, Indicates the Bernoulli distribution. Indicates the first The intensity of diffused noise at each time step Represents the Bernoulli distribution parameters at the current time step; Further definition:
[0014]
[0015] Then the original segmentation mask Time to step The edge distribution is as follows:
[0016] Its reparameterization form is:
[0017]
[0018] in, This represents the XOR operation. Let represent the Bernoulli noise variable; to mitigate signal attenuation of small targets in the early stages of forward diffusion, this invention further designs an adaptive noise scheduling strategy based on target sparsity, where the target sparsity is:
[0019] in, and These represent the height and width of the segmentation mask, respectively. This represents the proportion of the target region in the entire image; the cumulative signal preservation coefficients are constructed as follows:
[0020] in:
[0021]
[0022] in, Indicates the total number of diffusion steps. Indicates the smoothing bias term. Indicates the maximum protection strength. This represents the sensitivity coefficient to sparsity; the sparser the target, the lower the sensitivity coefficient. The smaller, The smaller the value, the slower the noise accumulation rate in the early stages of forward diffusion, thus better protecting the structural information of small targets.
[0023] Further, in step S3, the original medical image is input into the conditional encoder, and the noise mask is input into the mask encoder to extract image branch features and mask branch features respectively; in the shallow layer, local detail features are fused using a spatial stitching method, the expression of which is:
[0024] in, This represents the shallow features of the mask branch. This represents shallow features of image branches. This represents the feature concatenation operation; at a deeper level, a cross-attention mechanism is used for semantic fusion, and its expression is:
[0025]
[0026]
[0027]
[0028] in, This represents the deep features of the mask branch. Represents deep features of image branches. , and They represent the learnable mapping matrices, This represents the dimension of the key vector. By combining shallow feature concatenation with deep cross-attention, both the ability to depict local boundary details and the ability to model global semantics can be enhanced simultaneously.
[0029] Furthermore, in step S4, the fused multi-scale features are fed into the decoder to predict the Bernoulli noise probability parameters at the current time step:
[0030] in, This represents the neural network model to be trained. Represents network parameters, Indicates a conditional input image. This represents the predicted Bernoulli noise probability map; further, based on the Bernoulli diffusion mechanism, the original segmentation mask probability map is recovered through a calibration function:
[0031] in, This represents the probability map of the recovered original segmentation mask.
[0032] Furthermore, in step S5, based on the recovered segmentation probability map... Calculate pixel-level information entropy and construct an uncertainty graph, the expression of which is:
[0033] in, To prevent overflow in numerical calculations, a very small constant, Indicates position The uncertainty value; further, based on the uncertainty graph, the loss function is dynamically reweighted, and the uncertainty-weighted binary cross-entropy loss is defined as:
[0034] in, This represents the uncertainty weighting coefficient. This represents the binary cross-entropy loss function. This approach guides the model to focus on learning fuzzy boundary regions and difficult sample regions during training.
[0035] Furthermore, in step S6, the joint loss function is used for optimization during the model training phase, and its expression is:
[0036] in, Indicates the total loss. This represents the uncertainty-weighted loss. This represents the KL divergence loss used to constrain the consistency between the inverse process and Bernoulli's posterior. and This represents the loss weight coefficient. By minimizing the total loss function described above, the model parameters are updated using the backpropagation algorithm, thereby improving the boundary segmentation accuracy while maintaining distribution consistency.
[0037] Furthermore, in step S7, after the model training is completed, the medical image to be segmented is input into the trained model to obtain the prediction results of multiple key time steps at the end of the inverse denoising process; let the set of key time steps be:
[0038] The corresponding set of segmentation prediction results is as follows:
[0039] For each time step Calculate the mean uncertainty of the corresponding prediction result:
[0040] Furthermore, the trajectory is integrated with weights based on the mean of uncertainty:
[0041] Finally, the continuous prediction results are obtained through fusion, and the final binary segmentation result is obtained through threshold mapping:
[0042] in, The function represents an indicator function, which takes a value of 1 when the condition within the parentheses is true, and a value of 0 otherwise. This trajectory integration reasoning method effectively reduces fluctuations caused by single random sampling, improving the stability and robustness of medical image segmentation results.
[0043] The present invention also provides a medical image segmentation system based on sparsity adaptive Bernoulli diffusion and uncertainty guidance, which employs the method described above.
[0044] The beneficial effects of this invention are as follows: 1) This invention employs Bernoulli diffusion to model the binary segmentation mask, ensuring the diffusion process aligns with the discrete attributes of the medical image segmentation labels, thus reducing attribute mismatch issues caused by continuous Gaussian diffusion. A sparsity-adaptive noise scheduling strategy is designed to dynamically mitigate signal attenuation in the initial diffusion stage based on the sparsity of the target region, effectively protecting the structural information of minute lesions and sparse foreground regions. Simultaneously, a multi-scale conditional feature fusion module is designed to preserve local spatial details at a shallow level and enhance global semantic modeling capabilities at a deeper level, thereby improving segmentation performance in complex medical image scenarios.
[0045] 2) This invention constructs a pixel-level uncertainty map and dynamically reweights the loss function, enabling the model to pay more attention to blurred boundaries and difficult regions during training, thereby improving boundary segmentation accuracy. Simultaneously, it proposes a trajectory ensemble inference strategy based on entropy weights, which improves model inference stability and result consistency by fusing prediction results from multiple key time steps at the end of the inverse denoising phase.
[0046] 3) This invention can be applied to two-dimensional colon polyp segmentation, three-dimensional abdominal multi-organ segmentation, and other medical image segmentation tasks, and has good application value and promotion prospects.
[0047] Other advantages, objectives, and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination, or may be learned from practice of the invention. The objectives and other advantages of the invention can be realized and obtained through the following description. Attached Figure Description
[0048] To make the objectives, technical solutions, and advantages of the present invention clearer, the preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, wherein: Figure 1 This is a schematic diagram of the network model structure corresponding to the system of the present invention. Detailed Implementation
[0049] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0050] The accompanying drawings are for illustrative purposes only and are schematic diagrams, not actual pictures. They should not be construed as limiting the invention. To better illustrate the embodiments of the invention, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions. It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0051] In the accompanying drawings of the embodiments of the present invention, the same or similar reference numerals correspond to the same or similar components. In the description of the present invention, it should be understood that if terms such as "upper," "lower," "left," "right," "front," and "rear" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the terms used to describe positional relationships in the drawings are only for illustrative purposes and should not be construed as limiting the present invention. For those skilled in the art, the specific meaning of the above terms can be understood according to the specific circumstances.
[0052] This invention provides a medical image segmentation method and system based on sparsity adaptive Bernoulli diffusion and uncertainty guidance. Figure 1 This is a schematic diagram of the network model structure corresponding to the system of the present invention. In this embodiment, the method provided by the present invention includes the following steps: S1. Image Data Preprocessing Stage: First, the medical images are normalized and cropped. The expression is as follows:
[0053]
[0054] in, Represents the original image. and These represent the mean and standard deviation of the image intensity, respectively. This indicates a cropping operation. This step yields a standardized medical image. .
[0055] S2, Bernoulli forward diffusion construction stage: targeting the segmentation mask Construct the Bernoulli diffusion process:
[0056]
[0057] And define:
[0058]
[0059] Then we have:
[0060] Its reparameterization form is:
[0061]
[0062] Further define the target sparsity and the adaptive noise scheduling function:
[0063]
[0064]
[0065]
[0066] This method slows down the signal attenuation of small targets in the early stages of diffusion.
[0067] S3, Multi-scale Conditional Feature Fusion Stage: The original image is input into the conditional encoder, and the noise mask is input into the mask encoder. This is performed in the shallow layer:
[0068] Execute at a deeper level:
[0069]
[0070]
[0071]
[0072] The fused multi-scale conditional features are obtained.
[0073] S4, Bernoulli inverse denoising prediction stage: The fused features are input into the decoder to predict the Bernoulli noise probability map at the current time step:
[0074] And the original mask probability is recovered through a calibration function:
[0075] S5. Uncertainty Graph Construction and Loss Reweighting Stage: Construct the uncertainty graph based on the recovered segmentation probability graph.
[0076] Further construct an uncertainty-weighted loss:
[0077] S6. Model training phase: The total loss function is:
[0078] The model parameters are updated by minimizing the loss function through backpropagation.
[0079] S7. Trajectory Integration Inference Stage: Extracting prediction results from multiple key time steps at the end of the inverse denoising phase, defined as:
[0080]
[0081] Calculate the mean uncertainty at each time step:
[0082] Calculate the corresponding fusion weights:
[0083] The weighted fusion yields the final prediction result:
[0084] The final segmentation result is obtained through threshold mapping:
[0085] In this embodiment, tests were conducted on the BTCV and CVC-ClinicDB datasets. In the field of medical image segmentation, the Dice Similarity Coefficient (DSC) and Intersection over Union (IoU) are generally used to evaluate the performance of methods on datasets. Table 1 shows the test results on the datasets, and it can be seen that the network model based on this invention performs better on each dataset in terms of Dice and IoU metrics.
[0086] Table 1
[0087] In summary, this invention can effectively adapt to the discrete properties of binary segmentation masks, enhance the protection capability of small targets, improve the segmentation accuracy of boundary regions, and improve the inference stability and robustness of diffusion segmentation models.
[0088] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A medical image segmentation method based on sparsity adaptive Bernoulli diffusion and uncertainty guidance, characterized in that, The method specifically includes the following steps: S1. Image data preprocessing: Obtain the medical image dataset and its corresponding segmentation labels, and perform size unification, intensity normalization and cropping on the original medical images to obtain standardized images; S2. Bernoulli forward diffusion construction: For the binary segmentation mask, a Bernoulli forward diffusion process defined in the discrete state space is constructed, and an adaptive noise scheduling strategy based on the target sparsity is designed to dynamically adjust the noise addition rate in the early stage of forward diffusion. S3. Multi-scale conditional feature fusion: The standardized original medical image is input into the conditional encoder, and the noise mask is input into the mask encoder. Spatial feature stitching is used in the shallow layer, and cross-attention mechanism is used in the deep layer to achieve multi-scale conditional feature fusion. S4. Bernoulli inverse denoising prediction: Input the fused features into the decoder to predict the Bernoulli noise probability parameters at the current time step, and recover the probability representation of the original segmentation mask through the calibration function. S5. Uncertainty Map Construction and Loss Reweighting: Pixel-level information entropy is calculated based on the recovered segmentation probability map to construct an uncertainty map. The loss function is then dynamically reweighted based on this uncertainty map to enhance the model's ability to learn about fuzzy boundaries and difficult-to-distinguish regions. S6. Model Training: Construct a joint loss function consisting of uncertainty-weighted segmentation loss and distribution constraint loss, and update the model parameters through backpropagation; S7. Trajectory Integration Reasoning: During the reasoning process, the prediction results of multiple key time steps at the end of the inverse denoising are extracted. The fusion weights are assigned according to the mean uncertainty of the results of each time step, and weighted integration is performed to obtain the final medical image segmentation result.
2. The medical image segmentation method based on sparsity adaptive Bernoulli diffusion and uncertainty guidance according to claim 1, characterized in that, In step S1, the medical image data is first subjected to intensity normalization processing, the expression of which is: in, Represents the original medical image, and These represent the mean and standard deviation of image intensity in the dataset, respectively. This represents the normalized image; The normalized image is then cropped at the center or resized. in, This indicates a cropping operation. This represents the standardized input image.
3. The medical image segmentation method based on sparsity adaptive Bernoulli diffusion and uncertainty guidance according to claim 2, characterized in that, In step S2, for the binary segmentation mask Construct a Bernoulli forward diffusion process defined in discrete state space, with the state transition expression as follows: in, Indicates the Bernoulli distribution. Indicates the first The intensity of diffused noise at each time step Represents the Bernoulli distribution parameters at the current time step; Further definition: Then the original segmentation mask Time to step The edge distribution is as follows: Its reparameterization form is: in, This represents the XOR operation. Let represent the Bernoulli noise variable; design an adaptive noise scheduling strategy based on target sparsity, where the target sparsity is: in, and These represent the height and width of the segmentation mask, respectively. This represents the proportion of the target region in the entire image; the cumulative signal preservation coefficients are constructed as follows: in: in, Indicates the total number of diffusion steps. Indicates the smoothing bias term. Indicates the maximum protection strength. This represents the sensitivity coefficient to sparsity; the sparser the target, the more sensitive it is to sparsity. The smaller, The smaller the value, the slower the noise accumulation rate in the early stages of forward diffusion, thus better protecting the structural information of small targets.
4. The medical image segmentation method based on sparsity adaptive Bernoulli diffusion and uncertainty guidance according to claim 3, characterized in that, In step S3, the original medical image is input into the conditional encoder, and the noise mask is input into the mask encoder to extract image branch features and mask branch features respectively. In the shallow layer, local detail features are fused using a spatial stitching method, the expression of which is: in, This represents the shallow features of the mask branch. This represents shallow features of image branches. This represents the feature concatenation operation; at a deeper level, a cross-attention mechanism is used for semantic fusion, and its expression is: in, This represents the deep features of the mask branch. Represents deep features of image branches. , and They represent the learnable mapping matrices, This represents the dimension of the key vector.
5. The medical image segmentation method based on sparsity adaptive Bernoulli diffusion and uncertainty guidance according to claim 4, characterized in that, In step S4, the fused multi-scale features are fed into the decoder to predict the Bernoulli noise probability parameters at the current time step: in, This represents the neural network model to be trained. Represents network parameters, Indicates a conditional input image. This represents the predicted Bernoulli noise probability map; further, based on the Bernoulli diffusion mechanism, the original segmentation mask probability map is recovered through a calibration function: in, This represents the probability map of the recovered original segmentation mask.
6. The medical image segmentation method based on sparsity adaptive Bernoulli diffusion and uncertainty guidance according to claim 5, characterized in that, In step S5, based on the recovered segmentation probability map... Calculate pixel-level information entropy and construct an uncertainty graph, the expression of which is: in, To prevent overflow in numerical calculations, a very small constant, Indicates position The uncertainty value; further, based on the uncertainty graph, the loss function is dynamically reweighted, and the uncertainty-weighted binary cross-entropy loss is defined as: in, This represents the uncertainty weighting coefficient. This represents the binary cross-entropy loss function.
7. The medical image segmentation method based on sparsity adaptive Bernoulli diffusion and uncertainty guidance according to claim 6, characterized in that, In step S6, the joint loss function is used for optimization during the model training phase, and its expression is: in, Indicates the total loss. This represents the uncertainty-weighted segmentation loss. This represents the KL divergence loss used to constrain the consistency between the inverse process and Bernoulli's posterior. and This represents the loss weighting coefficient.
8. The medical image segmentation method based on sparsity adaptive Bernoulli diffusion and uncertainty guidance according to claim 7, characterized in that, In step S7, after the model training is completed, the medical image to be segmented is input into the trained model to obtain the prediction results of multiple key time steps at the end of the inverse denoising process; let the set of key time steps be: The corresponding set of segmentation prediction results is as follows: For each time step Calculate the mean uncertainty of the corresponding prediction result: Furthermore, the trajectory is integrated with weights based on the mean of uncertainty: Finally, the continuous prediction results are obtained through fusion, and the final binary segmentation result is obtained through threshold mapping: in, This represents an indicator function, which takes the value 1 when the condition within the parentheses is true, and 0 otherwise.
9. A medical image segmentation system based on sparsity adaptive Bernoulli diffusion and uncertainty guidance, characterized in that, The system employs the method as described in any one of claims 1 to 8.