A breast ultrasound image segmentation method based on denoising diffusion probability model
Through the breast ultrasound image segmentation method based on the denoising diffusion probability model and Gaussian distribution fusion module, combined with the multi-channel perceptual cross-attention module, the limitations of global context information utilization and spatial information retention in the existing technology are solved, and a higher level is achieved. The segmentation accuracy and detail extraction capabilities adapt to the complex structure of breast images.
Patent Information
- Application Number
- CN202410412181.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-08
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-04-08
AI Technical Summary
Existing medical image segmentation networks have limitations in utilizing global context information and retaining spatial information, resulting in insufficient accuracy and detail extraction capabilities for breast ultrasound image segmentation.
A breast ultrasound image segmentation method based on the denoising diffusion probability model is adopted, combined with the Gaussian distribution fusion module and the dual-channel dynamic condition module. The denoising diffusion probability model and the Gaussian distribution fusion module are used to enhance the global semantic feature capturing ability, and multi-channel perception cross attention is used. The force module performs feature fusion to improve segmentation accuracy.
It significantly improves the accuracy and detail feature extraction capabilities of breast image segmentation, reduces high-frequency noise interference, enhances adaptability to complex structures, and achieves more accurate segmentation of lesion areas.
Smart Images

Figure CN118196121B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of medical image segmentation, and in particular to a breast ultrasound image segmentation method based on a denoising diffusion probability model. Background Art
[0002] Breast tumor is a phenomenon in which breast epithelial cells proliferate uncontrollably under the action of multiple carcinogenic factors. In clinical diagnosis, due to the irregular shape and low contrast of the tumor, it is easily interfered by high-density tissues such as pectoral muscles and other glands, which has a great impact on the physician's clinical diagnosis. Medical image segmentation is to extract the pixel area corresponding to the diseased organ from the medical image and divide it into different lesion areas, aiming to obtain the information characteristics of these lesion sites. Accurate lesion area segmentation assists doctors in diagnosing and treating related diseases. In recent years, automatic segmentation of medical images has received increasing attention in modern computer-aided diagnosis (CAD). With the emergence of deep learning technology, medical image segmentation technology has made great progress, but it is still challenging to establish a reliable medical image segmentation algorithm system.
[0003] With the rapid development of deep learning technology, its superiority in image processing tasks has become increasingly prominent. Deep learning methods can automatically learn deeper information from images without too much manual intervention, making them more robust when processing image processing tasks based on different imaging principles. Deep learning technology has also been widely used in the field of breast ultrasound image segmentation. By training deep learning models, it is possible to automatically and accurately segment various organ tissues in breast ultrasound images, providing strong support for the diagnosis of breast diseases.
[0004] At present, methods based on convolutional neural networks (CNNs) have strong detail extraction capabilities and have achieved remarkable results in the field of medical image segmentation, but convolution operations have limitations in capturing long-range relationships. To overcome this limitation, the Transformer for sequence-to-sequence prediction has become a highly regarded alternative network architecture. Transformer-based methods no longer rely on convolution operations, but instead use self-attention mechanisms to effectively model global context information, so that it can better capture long-range dependencies when dealing with tasks such as medical image segmentation, improving segmentation accuracy and global consistency. And under large-scale pre-training, the Transformer model can learn rich feature information and has excellent transferability to downstream tasks. The SegFormer method proposed by Xie et al. decomposes the image into multiple non-overlapping image blocks, then uses the Transformer module to encode these image blocks, and finally generates dense image segmentation results through linear layered decoding. However, the pure Transformer method has the problem of feature loss, so the method of combining CNN modules with Transformer modules is receiving more and more attention. Although the TransUNet method combines the Transformer module with the traditional U-Net structure, it uses traditional CNN for feature extraction in the encoding stage. The receptive field of the subsequent convolution is too large, the advantages of the Transformer are not fully utilized, and multi-scale information is not effectively integrated and utilized.
[0005] Recently, the Diffusion Probabilistic Model (DPM) has gained wide popularity as a powerful generative model that can generate high-quality and diverse images. Therefore, some researchers have begun to apply it to the field of image segmentation. For example, the MedSegDiff method has achieved great success and surpassed the previous popular segmentation methods such as nnUNet and TransUNet. However, these methods are all based on the classic U-Net network. In order to address the limitations of existing medical image segmentation networks in utilizing global context information and retaining spatial information, this paper proposes a medical image segmentation method (CTrans-SegDiff) based on a denoising diffusion probabilistic model. Summary of the invention
[0006] The purpose of the present invention is to solve the above-mentioned problem and to provide a breast ultrasound image segmentation method based on a denoising diffusion probability model.
[0007] To achieve the above purpose, the technical solution adopted by the present invention is: including three parts: denoising diffusion probability model, Gaussian distribution fusion module and dynamic condition module, which are as follows:
[0008] ① Denoising diffusion probability model: This model is a generative model based on probability modeling, which consists of a forward diffusion stage and a backward diffusion stage. During the forward diffusion process, the model 0 Gradually add Gaussian noise ε~N(0,1), and generate a pure Gaussian noise image x after T steps. T ; The true posterior distribution expression is:
[0009]
[0010] Then the image after adding noise at any time t is defined as follows:
[0011]
[0012] in, α t =1-β t β t ~(0,1) is the noise intensity added each time; σ represents the standard deviation of the Gaussian distribution;
[0013] The reverse process is to perform reverse denoising on the noisy process, predict the image at the previous moment based on the noisy image at the current moment, and use the Bayesian formula to calculate the estimated distribution:
[0014] p(x t-1 |x t )=N(x t-1 ;μ θ (x t ,t),∑ θ (x t ,t)) (15)
[0015] Among them, the mean μ of the estimated distribution θ (x t ,t) and variance ∑ θ (x t ,t) are:
[0016]
[0017]
[0018] The reverse denoising process is also a Markov process, which uses a neural network to fit μ θ , thus obtaining the image x at time t-1 t-1 :
[0019]
[0020] Among them, ε θrepresents a fitting function based on a neural network. Finally, the estimated distribution q(x t |x 0 ) and the true posterior distribution p(x t-1 |x t ), the training objective of the denoising diffusion probability model is obtained as:
[0021]
[0022] In formula (7), E x0,ε Indicates the mathematical expectation of the calculated value in brackets;
[0023] ② Gaussian distribution fusion module: This module mainly fits the features of the dynamic condition module into a Gaussian distribution, and then hierarchically integrates the Gaussian distribution dynamic condition features and the diffusion coding features to eliminate the information incompatibility that may be caused by the direct fusion of the two features, and reduces the negative impact of high-frequency noise components in the fusion process. First, the features of the dynamic condition module are constrained to be a Gaussian distribution G(.) to obtain the feature y i , and pass through the maximum pooling max and average pooling avg of the pooling layer pool(.) and the convolution layer to obtain the feature y i ′; then the constrained dynamic condition module feature y i and diffusion encoding feature x i Perform dot product operation and obtain b through convolution operation conv(.) i ′, this process is used to simulate the cross-relationship between features; next, the diffusion encoding feature x i After the pooling layer and the convolution layer, we get x i ′; Finally, the feature y i ′、b i ′ and x i ′ is concatenated and then upsampled by the convolution layer to restore the resolution of the original image to obtain the final segmentation image feature f i ;
[0024] y i ′=conv([max,avg]pool(G(y i ))) (8)
[0025] b i ′=conv(y i ⊙x i ) (9)
[0026] x i ′=conv([max,avg]pool(x i )) (20)
[0027] f i =bi ′∩y i ′∩x i ' (twenty one)
[0028] The loss function of the present invention (CTrans-SegDiff) can be expressed as:
[0029]
[0030] Among them, E x0,ε,t [.] represents the mathematical expectation of the calculated value in brackets, ε is Gaussian noise, ε θ is a fitting function based on a neural network; I is a dynamic condition module that segments the image;
[0031] ③Dual channel dynamic condition module
[0032] In the encoder module, we input the local features of the CNN branch and the Transformer branch into the multi-channel perceptual cross attention module for feature fusion, thereby enriching the local details of the Transformer branch and enhancing CNN's perception of a wider context;
[0033] Furthermore, the CNN branch in the dual-channel dynamic condition module adopts the ConvNext convolutional neural network architecture, which uses the idea of grouped convolution, where each convolution kernel is responsible for processing a corresponding channel;
[0034] Specifically, each convolution kernel generates a feature map, and effective information is extracted by learning features at different levels; the input image first passes through a convolution layer and an LN normalization layer, and the next four stages are composed of ConvNext sub-networks. From stage 1 to stage 4, the number of stacking times of ConvNext sub-networks is (3, 3, 9, 3). After processing by the average pooling layer, LN normalization layer and linear layer, the local features of each stage are input into the multi-channel perception cross attention module.
[0035] Furthermore, the Transformer branch in the dual-channel dynamic conditional module adopts the Swin Transformer module, which adopts a downsampling hierarchical design to gradually increase the receptive field, so that the attention mechanism can pay attention to global features; the entire model adopts a hierarchical design and includes four stages; each stage will reduce the resolution of the input feature map and increase the receptive field layer by layer.
[0036] First, the input image x∈R H×W×3 Divide Image blocks are preliminarily processed using 4×4 convolution and LN normalization layers on the input image blocks;
[0037] Then use the Swin Transformer sub-network to stack four stages, where the number of stackings is (2, 2, 6, 2) in sequence;
[0038] Finally, after image block merging operation, average pooling, LN normalization layer and linear layer processing, the image features are input into the multi-channel perceptual cross attention module.
[0039] Furthermore, the multi-channel perception cross attention module in the dual-channel dynamic condition module is as follows:
[0040] Self-attention and multi-head attention usually ignore the impact of position information on the results, so we use the position-sensitive self-attention mechanism to propose a multi-channel perceptual cross-attention module to fully fuse the features of the same resolution extracted by the CNN and Transformer branches; this module performs position encoding on the query Q, key K, and value V respectively, so that relevant contextual information can be captured in the entire feature map, not just local information; by introducing position-sensitive encoding, the multi-channel perceptual cross-attention module can better consider the positional relationship between features, thereby enhancing the effect of feature fusion; in this module, we first convert the feature C of each layer i As a query, T i As keys and values, we can calculate the attention value y 1 ; Secondly, in order to fully learn the features in the two branches, we will calculate the result y 1 As a query, each layer of CNN branch feature C i As the key and value, the attention mechanism is applied again to calculate the final attention value y; the calculation formula is as follows:
[0041]
[0042]
[0043] where r Q , r K , r V are the positional encodings of Q, K, and V, respectively, and are all learnable weight matrices, d k is the dimension of the query or key, is a scaling factor; the Softmax function is used to normalize the attention weights.
[0044] Compared with the prior art, the present invention has the following beneficial effects:
[0045] (1) The breast image segmentation method based on the denoising diffusion probability model enhances the ability to capture global semantic features and complex detail information. At the same time, the dynamic condition module, as an auxiliary module, improves the attention of the denoising diffusion probability model to the region, which helps to better adapt to the complex structure and changes of breast images, thereby significantly improving the segmentation accuracy of the lesion area.
[0046] (2) The multi-channel perceptual cross-attention module utilizes position information to fully interactively fuse the features of the two branches, improving the ability of attention in modeling position-related interactions without increasing too much computational cost.
[0047] (3) The Gaussian distribution fusion module constrains the features of the dynamic condition module into a Gaussian distribution, and then fuses the Gaussian distribution dynamic condition module features with the diffusion coding features. This better handles the interaction between noise and semantic features, reduces the interference of high-frequency noise, and improves the module's ability to distinguish detail features. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 It is a flow chart of the technical solution of the present invention;
[0049] Figure 2 It is a dual-channel dynamic conditional coding graph of the present invention;
[0050] Figure 3 This is a visual comparison diagram of the breast tumor ultrasound image segmentation results of the present invention. DETAILED DESCRIPTION
[0051] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, the present invention is further explained below in conjunction with specific implementation methods.
[0052] The denoising diffusion probability model has attracted much attention because it can generate very high-quality images. It is also more widely used for image segmentation because it can extract key semantic features in the training images. However, due to problems such as blurring of the target area, lesions or tissues are often difficult to distinguish clearly from their background. This means that it will be difficult to learn effectively using only static images as conditions for each step.
[0053] In order to solve this problem, the present invention proposes a medical image segmentation method based on a denoising diffusion probability model. The method enhances the ability to capture global semantic information and complex information, while increasing the attention paid to the lesion area by the denoising diffusion probability model. In addition, it better realizes the interaction between noise and semantic features, and effectively reduces the interference of high-frequency noise. Through these improvements, the method can more accurately segment the lesion area in breast tumor images, providing strong support for the diagnosis of diseases such as breast tumors.
[0054] Figure 1 The technical solution flow chart of the method (CTrans-SegDiff) of the present invention is shown. The method mainly consists of three parts: denoising diffusion probability model, Gaussian distribution fusion module and dynamic condition module.
[0055] ① Denoising diffusion probability model: This model is a generative model based on probability modeling, which consists of a forward diffusion stage and a backward diffusion stage. During the forward diffusion process, the model 0 Gradually add Gaussian noise ε~N(0,1), and generate a pure Gaussian noise image x after T steps. T The true posterior distribution expression is:
[0056]
[0057] Then the image after adding noise at any time t is defined as follows:
[0058]
[0059] in, α t =1-β t β t ~(0,1) is the noise intensity added each time; σ represents the standard deviation of the Gaussian distribution.
[0060] The reverse process is to perform reverse denoising on the denoising process, and predict the image at the previous moment based on the denoised image at the current moment. The estimated distribution is calculated using the Bayesian formula:
[0061] p(x t-1 |x t )=N(x t-1 ;μ θ (x t ,t),∑ θ (x t ,t)) (27)
[0062] Among them, the mean μ of the estimated distribution θ (x t ,t) and variance ∑ θ (x t ,t) are:
[0063]
[0064]
[0065] The reverse denoising process is also a Markov process, which uses a neural network to fit μ θ , thus obtaining the image x at time t-1 t-1 :
[0066]
[0067] Among them, ε θ Represents a fitting function based on a neural network. Finally, the estimated distribution q(x t |x 0 ) and the true posterior distribution p(x t-1 |x t ), the training objective of the denoising diffusion probability model is obtained as:
[0068]
[0069] In formula (7), E x0,ε Indicates the mathematical expectation of the calculated value in parentheses.
[0070] ② Gaussian distribution fusion module: This module aims to fit the features of the dynamic condition module into a Gaussian distribution, and then hierarchically integrate the Gaussian distribution dynamic condition features and the diffusion coding features to eliminate the information incompatibility that may be caused by directly fusing the two features, and reduce the negative impact of high-frequency noise components in the fusion process. First, constrain the features of the dynamic condition module to a Gaussian distribution G(.) to obtain the feature y i , and pass through the maximum pooling max and average pooling avg of the pooling layer pool(.) and the convolution layer to obtain the feature y i ′; then the constrained dynamic condition module feature y i and diffusion encoding feature x i Perform dot product operation and obtain b through convolution operation conv(.) i ′, this process is used to simulate the cross-relationship between features. Next, the diffusion encoding feature x i After the pooling layer and the convolution layer, we get x i ′. Finally, the feature y i ′、b i ′ and x i ′ is concatenated and then upsampled by the convolution layer to restore the resolution of the original image to obtain the final segmentation image feature f i .
[0071] y i ′=conv([max,avg]pool(G(y i ))) (8)
[0072] b i ′=conv(y i ⊙x i ) (9)
[0073] x i ′=conv([max,avg]pool(xi )) (32)
[0074] f i =b i ′∩y i ′∩x i ′ (33)
[0075] The loss function of the present invention (CTrans-SegDiff) can be expressed as:
[0076]
[0077] Among them, E x0,ε,t represents the mathematical expectation of the calculated value in the brackets. ε is Gaussian noise, ε θ It is a fitting function based on neural network; I is the dynamic condition module to segment the image.
[0078] ③Dual channel dynamic condition module
[0079] In the encoder module, we input the local features of the CNN branch and the Transformer branch into the multi-channel perception cross attention module for feature fusion, thereby enriching the local details of the Transformer branch and enhancing CNN's perception of a wider context. This dynamic fusion process maximizes the feature representation of the two branches, and after passing through three different levels of dual-branch encoding modules in sequence, multi-scale information is obtained.
[0080] The CNN branch uses the ConvNext convolutional neural network architecture. The network uses the idea of grouped convolution, in which each convolution kernel is responsible for processing a corresponding channel. This means that each convolution kernel generates a feature map and extracts effective information by learning features at different levels. The input image first passes through a convolution layer and an LN normalization layer. The next four stages are composed of ConvNext subnetworks. From stage 1 to stage 4, the number of stacking times of the ConvNext subnetwork is (3, 3, 9, 3). After processing by the average pooling layer, LN normalization layer, and linear layer, the local features of each stage are input into the multi-channel perception cross attention module.
[0081] The Transformer branch uses the Swin Transformer module, which uses a downsampling hierarchical design to gradually increase the receptive field, allowing the attention mechanism to pay attention to global features. The entire model adopts a hierarchical design and consists of four stages. Each stage will reduce the resolution of the input feature map and increase the receptive field layer by layer. First, the input image x∈R H×W×3 Divide The input image blocks are preliminarily processed using 4×4 convolution and LN normalization layers. Next, the Swin Transformer subnetwork is stacked in four stages, where the number of stacks is (2, 2, 6, 2). Finally, after image block merging, average pooling, LN normalization layer, and linear layer processing, the image features are input into the multi-channel perceptual cross attention module.
[0082] Multi-channel perceptual cross-attention module: Self-attention and multi-head attention usually ignore the position information
[0083] The results are affected by this, so we use the position-sensitive self-attention mechanism and propose a multi-channel perceptual cross-attention module to fully fuse the features of the same resolution extracted by the CNN and Transformer branches. This module encodes the query Q, key K, and value V respectively, so that relevant contextual information can be captured in the entire feature map, not just local information. By introducing position-sensitive encoding, the multi-channel perceptual cross-attention module can better consider the positional relationship between features, thereby enhancing the effect of feature fusion. In this module, we first convert the feature C of each layer into i As a query, T i As keys and values, we can calculate the attention value y 1 Secondly, in order to fully learn the features in the two branches, we will calculate the result y 1 As a query, each layer of CNN branch feature C i As the key and value, the attention mechanism is applied again to calculate the final attention value y. The calculation formula is as follows:
[0084]
[0085]
[0086] where r Q , r K , r V are the positional encodings of Q, K, and V, respectively, and are all learnable weight matrices, d k is the dimension of the query or key, is the scaling factor. The Softmax function is used to normalize the attention weights.
[0087] Example:
[0088] The images used in this paper are from the public BUSI dataset. This dataset is a breast ultrasound image obtained from the Baheya Women's Cancer Early Detection and Treatment Hospital in Cairo, Egypt in 2018, covering 600 female patients aged 25 to 75 years old. A total of 780 images were collected, and the average size of each image was 500*500 pixels. These images were divided into three categories: 133 normal, 437 benign, and 210 malignant. 80% of them were used for training and 20% for validation.
[0089] In order to evaluate the performance of the method of the present invention, several commonly used image segmentation evaluation indicators are used, including F1 score (F1Score), precision (Precision), mean intersection and union (MIoU) and recall rate (Recall). Specifically, the F1 score comprehensively considers the accuracy and recall ability of the model; Precision is used to measure the proportion of correctly predicted samples in the total samples; MIoU calculates the intersection and union ratio of the predicted value and the actual value of each category, and then takes the average of each category; Recall measures the proportion of the actual values that are correctly predicted as positive categories.
[0090] Table 1 Comparison results of the method of the present invention and common image segmentation methods on the BUSI breast dataset
[0091]
[0092] As shown in Table 2, the present invention uses a series of evaluation indicators to compare the methods implemented by various network architectures, and finds that advanced network architectures can usually obtain better results. For example, Transformer-based segmentation methods, including TransUNet and MedT, have performed well and surpassed CNN-based methods. Recently proposed DPM-based segmentation methods, such as SegDiff, are also better than TransUNet and MedT. The algorithm CTrans-SegDiff of the present invention not only adopts the latest diffusion model, but also adjusts it for medical image segmentation tasks, and designs a suitable segmentation strategy based on the diffusion model. The segmentation results of the present invention in terms of MIoU, F1 Score, Precision and Recall evaluation indicators are better than the other four comparison algorithms. The segmentation results of the present invention are more accurate, with the smallest difference from the GT image, and successfully reduce the situation of mis-segmentation.
[0093] Figure 3The results of the model of the present invention (CTrans-SegDiff) and other image segmentation models are compared. A variety of image segmentation methods with different network architectures are compared, including CNN systems (Attention U-Net), Transformer systems (MedT, TransUNet) and ddpm systems (SegDiff). The experiments were conducted on the BUSI breast dataset, and all compared methods were implemented using default settings. The first column in the figure is an ultrasound image of a breast tumor, and the second column is a standard tumor image (GT) marked by a professional doctor. The next four columns show the segmented images obtained by the SegDiff, MedT, TransUNet and Attention U-Net methods, respectively, and the last column shows the segmented image obtained by the method of the present invention.
[0094] In the ultrasound breast tumor image segmentation experiment, the present invention and other comparison algorithms can segment the tumor area relatively accurately. However, other image segmentation methods have the problem of under-segmentation when processing edge information. The present invention retains more breast tumor edge information, making the segmentation result more complete, reducing information loss, and thus presenting the lesion area more comprehensively.
[0095] All the above experiments were conducted on the PyTorch platform, and training and testing were completed on a single NVIDIA A100. The resolution of all images was uniformly adjusted to 96×96 pixels. The network was trained end-to-end using the Adam optimizer. The initial learning rate was set to 1×10 -4 , the batch size is set to 8.
[0096] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations falling within the meaning and range of equivalent elements of the claims be included in the invention. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.
[0097] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.
Claims
1. A breast image segmentation method based on a denoising diffusion probability model, characterized in that: It includes three parts: denoising diffusion probability model, Gaussian distribution fusion module and dual-channel dynamic condition module, as follows: ① De-noising diffusion probability model: The denoising diffusion probability model is a generative model based on probability modeling, which consists of a forward diffusion stage and a backward diffusion stage. During the forward diffusion process, the denoising diffusion probability model Gradually add Gaussian noise ,implement After the step, a pure Gaussian noise image is generated ; The true posterior distribution expression is: At any time The noisy image is defined as follows: in, ; ; is the noise intensity added each time; The reverse process is to perform reverse denoising on the noisy process, predict the image at the previous moment based on the noisy image at the current moment, and use the Bayesian formula to calculate the estimated distribution: Among them, the mean of the estimated distribution and variance They are: The reverse denoising process is also a Markov process, which is fitted by a neural network. , thus obtaining Image of the moment : in, Represents a neural network-based fitting function. Finally, the estimated distribution is calculated. and the true posterior distribution The KL divergence of , the training objective of the denoising diffusion probability model is: In formula (7), E x0 , ε Indicates the mathematical expectation of the calculated value in brackets; ② Gaussian distribution fusion module: The Gaussian distribution fusion module mainly fits the features of the dual-channel dynamic condition module into a Gaussian distribution, and then hierarchically integrates the Gaussian distribution dynamic condition features and the diffusion coding features to eliminate the information incompatibility that may be caused by the direct fusion of the two features, and reduces the negative impact of high-frequency noise components in the fusion process. First, the features of the dual-channel dynamic condition module are constrained to be a Gaussian distribution G(.) to obtain the features , and pass through the maximum pooling max and average pooling avg of the pooling layer pool(.) and the convolution layer to obtain the feature ; Then the constrained dual-channel dynamic condition module features and diffusion coding features Perform dot product operation and obtain through convolution operation conv(.) , this process is used to simulate the cross-relationship between features; next, the diffusion encoding feature After the pooling layer and the convolution layer, we get ; Finally, the feature , and After splicing, the convolution layer is used to upsample the original image to restore its resolution and obtain the final segmented image features. ; (8) (9) The loss function of CTrans-SegDiff can be expressed as: Among them, E x0 , ε , t [.] indicates the mathematical expectation of the calculated value in brackets. is Gaussian noise, It is a fitting function based on a neural network; Segment the image for the dual-channel dynamic conditional module; ③ Dual-channel dynamic condition module The dual-channel dynamic conditional module includes an encoder module and a multi-channel perceptual cross-attention module. In the encoder module, the local features of the CNN branch and the Transformer branch are input into the multi-channel perceptual cross-attention module for feature fusion, thereby enriching the local details of the Transformer branch and enhancing CNN's perception of a wider context.
2. A breast image segmentation method based on a denoising diffusion probability model as claimed in claim 1, characterized in that: The CNN branch in the dual-channel dynamic condition module adopts the ConvNext convolutional neural network architecture. The ConvNext convolutional neural network uses the idea of grouped convolution, in which each convolution kernel is responsible for processing a corresponding channel; Specifically, each convolution kernel generates a feature map, and effective information is extracted by learning features at different levels; the input image first passes through a convolution layer and an LN normalization layer, and the next four stages are composed of ConvNext sub-networks. From stage 1 to stage 4, the number of stacking times of ConvNext sub-networks is (3, 3, 9, 3). After processing by the average pooling layer, LN normalization layer and linear layer, the local features of each stage are input into the multi-channel perception cross attention module.
3. The method for breast image segmentation based on a denoising diffusion probability model as claimed in claim 1, characterized in that: The Transformer branch in the dual-channel dynamic condition module uses the Swin Transformer module, which adopts a downsampling hierarchical design to gradually increase the receptive field, allowing the attention mechanism to pay attention to global features; The model adopts a hierarchical design and consists of four stages; each stage reduces the resolution of the input feature map and increases the receptive field layer by layer. First, the input image Divide Image blocks are preliminarily processed using 4×4 convolution and LN normalization layers on the input image blocks; Then use the Swin Transformer sub-network to stack four stages, where the number of stackings is (2, 2, 6, 2) in sequence; Finally, after image block merging operation, average pooling, LN normalization layer and linear layer processing, the image features are input into the multi-channel perceptual cross attention module.
4. The method for breast image segmentation based on a denoising diffusion probability model as claimed in claim 1, characterized in that: The multi-channel perception cross attention module in the dual-channel dynamic condition module is as follows: Self-attention and multi-head attention usually ignore the impact of position information on the results, so a multi-channel perceptual cross attention module is proposed using the position-sensitive self-attention mechanism to fully fuse the features of the same resolution extracted by the CNN and Transformer branches; the multi-channel perceptual cross attention module performs position encoding on the query Q, key K, and value V respectively, so that relevant contextual information can be captured in the entire feature map, not just local information; by introducing position-sensitive encoding, the multi-channel perceptual cross attention module can better consider the positional relationship between features, thereby enhancing the effect of feature fusion; the multi-channel perceptual cross attention module first combines the features of each layer As a query, As keys and values, to calculate the attention value ; Secondly, in order to fully learn the features of the two branches, the calculation results As a query, each layer of CNN branch features As the key and value, the attention mechanism is applied again to calculate the final attention value ; The calculation formula is as follows: in , , They are , , The position encodings are all learnable weight matrices, is the dimension of the query or key, is the scaling factor; Function is used to normalize the attention weights.
