A Multi-Level Feature Fusion Medical Image Segmentation Method and System Based on Diffusion Model
By employing a multi-level feature fusion method based on a diffusion model, the problems of weak denoising ability and insufficient boundary sensitivity in medical image segmentation are solved. This achieves high-precision skin lesion segmentation in noisy environments and improves the semantic richness of the segmentation results and the model's generalization ability.
Patent Information
- Application Number
- CN202411021859.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-07-29
AI Technical Summary
Existing medical image segmentation methods suffer from weak denoising capabilities, insufficient sensitivity to lesion boundaries, and insufficient semantic information, resulting in limited segmentation accuracy and precision, especially in noisy environments.
A multi-level feature fusion method based on a diffusion model is adopted. By combining a denoising network with a diffusion model, and utilizing a denoising network encoder, a multi-level feature fusion module and a bottleneck structure, feature information at different levels is gradually extracted and fused to enhance denoising ability and edge sensitivity, thereby improving segmentation accuracy.
The model significantly improved the accuracy and semantic richness of skin lesion segmentation in noisy environments, enhanced the model's sensitivity to edge regions, and improved the accuracy and generalization ability of the segmentation results.
Smart Images

Figure CN119151969B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of medical image processing technology, and in particular relates to a multi-level feature fusion medical image segmentation method and system based on a diffusion model. Background Technology
[0002] The goal of skin lesion segmentation is to identify skin abnormalities or lesions from dermatological images. Traditionally, diagnosis of skin lesions, including melanoma, basal cell carcinoma, squamous cell carcinoma, and other benign or malignant growths, relies on visual examination and manual delineation. Accurate and rapid segmentation of these lesions plays a crucial role in early detection, treatment planning, and disease progression monitoring. Automated medical image segmentation methods have gained significant attention in recent years due to their ability to improve the accuracy and reliability of diagnostic results. However, traditional segmentation network models have limited denoising capabilities, resulting in compromised denoising performance and segmentation accuracy in noisy environments. Furthermore, traditional segmentation network methods treat all regions equally without considering the importance of different regions, often leading to inaccurate segmentation of boundary regions. Finally, traditional segmentation networks use skip connections to enrich semantic information, but this semantic information is limited to the semantic information of feature maps at neighboring levels, without comprehensively considering the semantic information of global multi-level feature maps. Summary of the Invention
[0003] The purpose of this invention is to solve the problems of weak denoising ability, sensitivity to lesion boundaries, and insufficient semantic information in existing medical image segmentation methods, and to provide a medical image segmentation method and system based on a diffusion model and multi-level feature fusion.
[0004] To achieve the above-mentioned objectives, the present invention specifically adopts the following technical solution:
[0005] In a first aspect, the present invention provides a multi-level feature fusion medical image segmentation method based on a diffusion model, comprising the following steps:
[0006] S1: Acquire a medical image with skin lesions, and perform corresponding preprocessing on the medical image to obtain a preprocessed medical image;
[0007] S2: Perform a forward diffusion process on the preprocessed medical image, gradually adding Gaussian noise to obtain a medical image with added noise;
[0008] S3: The medical image with added noise and the preprocessed medical image are input together into the trained denoising network to obtain the segmentation result image of the skin lesion; the denoising network includes a denoising network encoder, a multi-level feature fusion module, a bottleneck structure, and a denoising network decoder. The denoising network encoder includes five encoders with non-shared parameters, each encoder including four residual blocks and two linear attention modules. The multi-level feature fusion module includes ten fusion modules with non-shared parameters, each fusion module including a spatial attention module and a channel attention module. The bottleneck structure includes two residual blocks, one linear attention module, and one self-attention module. The denoising network decoder includes five decoders with non-shared parameters, each decoder including two residual blocks and one linear attention module.
[0009] In the denoising network encoder, the medical image with added noise and the preprocessed medical image are used as input. After processing by the first encoder, a first feature map, a second feature map, a first noise feature map, and a first medical image feature map are obtained. The first noise feature map and the first medical image feature map are then input into the second encoder to obtain a third feature map, a fourth feature map, a second noise feature map, and a second medical image feature map. The second noise feature map and the second medical image feature map are then input into the third encoder to obtain a fifth feature map, a sixth feature map, a third noise feature map, and a third medical image feature map. The third noise feature map and the third medical image feature map are then input into the fourth encoder to obtain a seventh feature map, an eighth feature map, a fourth noise feature map, and a fourth medical image feature map. Finally, the fourth noise feature map and the fourth medical image feature map are input into the fifth encoder to obtain a ninth feature map, a tenth feature map, a fifth noise feature map, and a fifth medical image feature map.
[0010] In the multi-level feature fusion module, the first feature map, the third feature map, the fifth feature map, the seventh feature map, and the ninth feature map are used as the first input, and the second feature map, the fourth feature map, the sixth feature map, the eighth feature map, and the tenth feature map are used as the second input. After processing the first input, the first fusion module obtains the first multi-level fusion feature map; after processing the second input, the second fusion module obtains the second multi-level fusion feature map; after processing the first input, the third fusion module obtains the third multi-level fusion feature map; after processing the second input, the fourth fusion module obtains the fourth multi-level fusion feature map; after processing the first input, the fifth fusion module obtains the fifth multi-level fusion feature map; after processing the second input, the sixth fusion module obtains the sixth multi-level fusion feature map; after processing the first input, the seventh fusion module obtains the seventh multi-level fusion feature map; after processing the second input, the eighth fusion module obtains the eighth multi-level fusion feature map; after processing the first input, the ninth fusion module obtains the ninth multi-level fusion feature map; and after processing the second input, the tenth fusion module obtains the tenth multi-level fusion feature map.
[0011] In the bottleneck structure, the fifth noise feature map and the fifth medical image feature map are used as inputs, and the sixth noise feature map is output after processing.
[0012] In the denoising network decoder, the fifth decoder takes the sixth, tenth, and ninth multi-level fusion feature maps as inputs and processes them to obtain the seventh noise feature map. The fourth decoder takes the seventh, eighth, and seventh multi-level fusion feature maps as inputs and processes them to obtain the eighth noise feature map. The third decoder takes the eighth, sixth, and fifth multi-level fusion feature maps as inputs and processes them to obtain the ninth noise feature map. The second decoder takes the ninth, fourth, and third multi-level fusion feature maps as inputs and processes them to obtain the tenth noise feature map. The first decoder takes the tenth, second, and first multi-level fusion feature maps as inputs and processes them to obtain the segmented image of the skin lesion.
[0013] Based on the above scheme, each step can be implemented in the following preferred manner.
[0014] As a preferred embodiment of the first aspect above, in step S1, the preprocessing specifically involves: randomly cropping medical images with skin lesions of different sizes to obtain a cropped medical image of size 128×128×3; then normalizing the cropped medical image and performing horizontal mirror flipping, vertical mirror flipping, and intensity changes to obtain a preprocessed medical image.
[0015] As a preferred embodiment of the first aspect, the processing flow in the first encoder in step S3 is as follows: The medical image with added noise and the time series are input into the first residual block to obtain a first intermediate feature map; the preprocessed medical image and the time series are input into the second residual block to obtain a second intermediate feature map; the first intermediate feature map and the second intermediate feature map are concatenated to obtain the first feature map; the first feature map and the time series are input into the third residual block to obtain a third intermediate feature map; the third intermediate feature map and the first intermediate feature map are concatenated to obtain a fourth intermediate feature map; the fourth intermediate feature map and the time series are input into the fourth residual block to obtain a fifth intermediate feature map; the fifth intermediate feature map is passed through the first linear attention module to obtain the first noise feature map; the first noise feature map and the third intermediate feature map are concatenated to obtain the second feature map; the second feature map is input into the second linear attention module to obtain the first medical image feature map.
[0016] As a preferred embodiment of the first aspect above, the processing flow in the bottleneck structure in step S3 is as follows: the fifth noise feature map and the fifth medical image feature map are added together to obtain the added feature map; the added feature map and the time series are input into the fifth residual block to obtain the sixth intermediate feature map; the sixth intermediate feature map is processed by the third linear attention module to obtain the seventh intermediate feature map; the sixth intermediate feature map is processed by the self-attention module to obtain the eighth intermediate feature map; the seventh intermediate feature map and the eighth intermediate feature map are added together and input into the sixth residual block to obtain the sixth noise feature map.
[0017] As a preferred embodiment of the first aspect, the processing flow in each fusion module in step S3 is as follows: each feature map in the first input or the second input is processed by a fusion branch, each fusion branch outputs a fusion feature map, the fusion feature maps output by each fusion branch are multiplied to obtain a global fusion feature map, and the global fusion feature map is processed through a convolutional layer with an activation function to obtain a multi-level fusion feature map.
[0018] As a preferred embodiment of the first aspect, in step S3, in each fusion branch, the input feature map is passed through a first spatial attention module to obtain a first spatial weight map, the input feature map and the first spatial weight map are multiplied to obtain a first spatial weighted feature map, the first spatial weighted feature map is passed through a first channel attention module to obtain a first channel weight map, the first spatial weighted feature map and the first channel weight map are multiplied to obtain a first channel weighted feature map, the first channel weighted feature map is subjected to an adaptive average pooling operation to obtain a pooled weighted feature map, and the pooled weighted feature map is processed through a convolutional layer to obtain the output fusion feature map.
[0019] As a preferred embodiment of the first aspect, the processing flow in the fifth decoder in step S3 is as follows: the sixth noise feature map and the tenth multi-level fusion feature map are concatenated to obtain the ninth intermediate feature map; the ninth intermediate feature map and the time series are input into the seventh residual block to obtain the tenth intermediate feature map; the tenth intermediate feature map and the ninth multi-level fusion feature map are concatenated to obtain the eleventh intermediate feature map; the eleventh intermediate feature map and the time series are input into the eighth residual block to obtain the eleventh intermediate feature map; the eleventh intermediate feature map is processed by the fourth linear attention module to obtain the twelfth intermediate feature map; the twelfth intermediate feature map is upsampled to obtain the seventh noise feature map.
[0020] As a preferred embodiment of the first aspect mentioned above, the processing flow in each residual block in step S3 is as follows: The input time series is processed through a fully connected layer and a SiLU activation function to obtain a scale vector and a shift vector. The scale vector, shift vector, and input feature map are scaled and shifted element-wise to obtain a feature map incorporating temporal embedding information. The feature map incorporating temporal embedding information is processed sequentially through a first convolutional layer, a SiLU activation function, a second convolutional layer, and another SiLU activation function to obtain a thirteenth intermediate feature map. The input feature map is processed through a third convolutional layer to obtain a fourteenth intermediate feature map. The thirteenth intermediate feature map and the fourteenth intermediate feature map are added to obtain the feature map output by the residual block.
[0021] Secondly, the present invention provides a multi-level feature fusion medical image segmentation system based on a diffusion model, comprising:
[0022] The data preprocessing module is used to acquire medical images with skin lesions and perform corresponding preprocessing on the medical images to obtain preprocessed medical images.
[0023] The diffusion process processing module is used to perform a forward diffusion process on the preprocessed medical image, gradually adding Gaussian noise to obtain a noisy medical image.
[0024] The result acquisition module is used to input the noise-added medical image and the preprocessed medical image into the trained denoising network to obtain the segmentation result image of the skin lesion. The denoising network includes a denoising network encoder, a multi-level feature fusion module, a bottleneck structure, and a denoising network decoder. The denoising network encoder includes five encoders with non-shared parameters. Each encoder includes four residual blocks and two linear attention modules. The multi-level feature fusion module includes ten fusion modules with non-shared parameters. Each fusion module includes a spatial attention module and a channel attention module. The bottleneck structure includes two residual blocks, one linear attention module, and one self-attention module. The denoising network decoder includes five decoders with non-shared parameters. Each decoder includes two residual blocks and one linear attention module.
[0025] In the denoising network encoder, the medical image with added noise and the preprocessed medical image are used as input. After processing by the first encoder, a first feature map, a second feature map, a first noise feature map, and a first medical image feature map are obtained. The first noise feature map and the first medical image feature map are then input into the second encoder to obtain a third feature map, a fourth feature map, a second noise feature map, and a second medical image feature map. The second noise feature map and the second medical image feature map are then input into the third encoder to obtain a fifth feature map, a sixth feature map, a third noise feature map, and a third medical image feature map. The third noise feature map and the third medical image feature map are then input into the fourth encoder to obtain a seventh feature map, an eighth feature map, a fourth noise feature map, and a fourth medical image feature map. Finally, the fourth noise feature map and the fourth medical image feature map are input into the fifth encoder to obtain a ninth feature map, a tenth feature map, a fifth noise feature map, and a fifth medical image feature map.
[0026] In the multi-level feature fusion module, the first feature map, the third feature map, the fifth feature map, the seventh feature map, and the ninth feature map are used as the first input, and the second feature map, the fourth feature map, the sixth feature map, the eighth feature map, and the tenth feature map are used as the second input. After processing the first input, the first fusion module obtains the first multi-level fusion feature map; after processing the second input, the second fusion module obtains the second multi-level fusion feature map; after processing the first input, the third fusion module obtains the third multi-level fusion feature map; after processing the second input, the fourth fusion module obtains the fourth multi-level fusion feature map; after processing the first input, the fifth fusion module obtains the fifth multi-level fusion feature map; after processing the second input, the sixth fusion module obtains the sixth multi-level fusion feature map; after processing the first input, the seventh fusion module obtains the seventh multi-level fusion feature map; after processing the second input, the eighth fusion module obtains the eighth multi-level fusion feature map; after processing the first input, the ninth fusion module obtains the ninth multi-level fusion feature map; and after processing the second input, the tenth fusion module obtains the tenth multi-level fusion feature map.
[0027] In the bottleneck structure, the fifth noise feature map and the fifth medical image feature map are used as inputs, and the sixth noise feature map is output after processing.
[0028] In the denoising network decoder, the fifth decoder takes the sixth, tenth, and ninth multi-level fusion feature maps as inputs and processes them to obtain the seventh noise feature map. The fourth decoder takes the seventh, eighth, and seventh multi-level fusion feature maps as inputs and processes them to obtain the eighth noise feature map. The third decoder takes the eighth, sixth, and fifth multi-level fusion feature maps as inputs and processes them to obtain the ninth noise feature map. The second decoder takes the ninth, fourth, and third multi-level fusion feature maps as inputs and processes them to obtain the tenth noise feature map. The first decoder takes the tenth, second, and first multi-level fusion feature maps as inputs and processes them to obtain the segmented image of the skin lesion.
[0029] Thirdly, the present invention provides a computer electronic device, comprising: an image acquisition module, an image segmentation module, and a result output module;
[0030] The image acquisition module is used to acquire the preprocessed medical image required as input to the denoising network, as well as the medical image after adding noise.
[0031] The image segmentation module is used to obtain the trained denoising network obtained by the multi-level feature fusion medical image segmentation method based on the diffusion model as described in any of the schemes in the first aspect above.
[0032] The result output module is used to input the preprocessed medical image and the noisy medical image obtained by the image acquisition module into the denoising network obtained by the image segmentation module, and output the segmentation result image of the skin lesion.
[0033] Compared with the prior art, the present invention has the following advantages:
[0034] In skin lesion segmentation tasks, images are affected by various factors such as noise, which interfere with the localization and segmentation of lesion areas. This invention innovatively combines a denoising network and a segmentation network, using the characteristics of a diffusion model to minimize the impact of noise and provide powerful denoising capabilities. Accuracy of edge regions is crucial when segmenting skin lesions. This method improves the model's sensitivity to edge pixels through an edge-aware loss function. This sensitivity to edges ensures segmentation accuracy, especially at fine edges, where they can be captured and described more precisely. In the encoder-decoder network, this method employs a multi-level feature fusion mechanism at skip connections, enabling each decoder to acquire richer details, from shallow to deep details. Each level contributes its unique semantic information, increasing the semantic richness of the segmentation results and helping the model better understand complex skin lesion structures. Because the network structure used in this method integrates features from different levels and exhibits high sensitivity in edge segmentation, the model has better generalization ability across various types of skin lesion images. Attached Figure Description
[0035] Figure 1 This is a schematic diagram of the process structure of the method of the present invention.
[0036] Figure 2 This is a structural diagram of the encoder of the method of the present invention.
[0037] Figure 3 This is a diagram of the decoder structure of the method of the present invention.
[0038] Figure 4 This is a structural diagram of the multi-level feature fusion module of the method of the present invention.
[0039] Figure 5 This is a structural diagram of the fusion module of the method of the present invention.
[0040] Figure 6 This is a structural diagram of the bottleneck module of the method of the present invention.
[0041] Figure 7 This is a comparison diagram of the segmentation effects of the method of the present invention and different methods. Detailed Implementation
[0042] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of the present invention. However, the present invention can be practiced in many other ways different from those described herein, and those skilled in the art can make similar modifications without departing from the spirit of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below. Technical features in the various embodiments of the present invention can be combined accordingly without mutual conflict.
[0043] In the description of this invention, it should be understood that the terms "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined with "first" and "second" may explicitly or implicitly include at least one of those features.
[0044] In a preferred embodiment of the present invention, the above-mentioned multi-level feature fusion medical image segmentation method based on a diffusion model includes the following steps S1 to S5. The specific implementation process of each step is described in detail below.
[0045] S1: Acquire a medical image with skin lesions and perform corresponding preprocessing on the medical image to obtain a preprocessed medical image.
[0046] It should be noted that, in step S1 of the present invention, the specific steps for preprocessing the above-mentioned medical images include: randomly cropping medical images with skin lesions of different sizes to obtain cropped medical images of size 128×128×3; before inputting them into the denoising network, normalizing the cropped medical images and performing data enhancement methods such as horizontal mirror flipping, vertical mirror flipping, and intensity changes to obtain the preprocessed medical images.
[0047] The normalization calculation method is as follows:
[0048]
[0049] Among them, y k It is the normalized value; x k The values are the values before normalization; X is the input sequence, i.e., the cropped medical image; std(X) is the standard deviation of the input sequence, i.e., the standard deviation of the cropped medical image. The mean of the input sequence is denoted as , and the mean of the cropped medical image is denoted as .
[0050] S2: Perform a forward diffusion process on the preprocessed medical image, gradually adding Gaussian noise to obtain a medical image with added noise.
[0051] It should be noted that in step S2, Gaussian noise is added to the preprocessed medical image using a forward diffusion process to simulate noise in the real-world image acquisition process, thereby obtaining a noisy medical image. The forward diffusion process operates as follows: Gaussian noise is continuously added to the preprocessed medical image, and the intensity of the Gaussian noise is adjusted by... To adjust, defined as:
[0052]
[0053] Where x0 is the preprocessed medical image input; x t It is the image with Gaussian noise at time t; q(x) t |x0) represents the image sequence after adding Gaussian noise; N represents a normal distribution; Represents noise variance scheduling; I is the identity matrix; ε represents a normally distributed random variable; β t Indicates the noise increment; α t α represents the noise variance adjustment factor. j The noise reduction factor for time step j is represented; N(0,I) indicates that the distribution follows a normal distribution with a mean of 0 and a variance of the identity matrix I; t represents the number of time steps.
[0054] S3: The medical image with added noise and the preprocessed medical image are input together into the trained denoising network to obtain the segmentation result image of the skin lesion; the denoising network includes a denoising network encoder, a multi-level feature fusion module, a bottleneck structure, and a denoising network decoder. The denoising network encoder includes five encoders with non-shared parameters, each encoder including four residual blocks and two linear attention modules. The multi-level feature fusion module includes ten fusion modules with non-shared parameters, each fusion module including a spatial attention module and a channel attention module. The bottleneck structure includes two residual blocks, one linear attention module, and one self-attention module. The denoising network decoder includes five decoders with non-shared parameters, each decoder including two residual blocks and one linear attention module.
[0055] In the denoising network encoder, the medical image with added noise and the preprocessed medical image are used as input. After processing by the first encoder, a first feature map h1, a second feature map b1, a first noise feature map x1′, and a first medical image feature map g1′ are obtained. The first noise feature map x1′ and the first medical image feature map g1′ are then input into the second encoder for processing, resulting in a third feature map h2, a fourth feature map b2, a second noise feature map x2′, and a second medical image feature map g2′. The second noise feature map x2′ and the second medical image feature map g2′ are then input into the third encoder. The process yields the fifth feature map h3, the sixth feature map b3, the third noise feature map x3′, and the third medical image feature map g3′. The third noise feature map x3′ and the third medical image feature map g3′ are then input into the fourth encoder for processing, yielding the seventh feature map h4, the eighth feature map b4, the fourth noise feature map x4′, and the fourth medical image feature map g4′. The fourth noise feature map x4′ and the fourth medical image feature map g4′ are then input into the fifth encoder for processing, yielding the ninth feature map h5, the tenth feature map b5, the fifth noise feature map x5′, and the fifth medical image feature map g5′.
[0056] In the multi-level feature fusion module, the first feature map h1, the third feature map h2, the fifth feature map h3, the seventh feature map h4, and the ninth feature map h5 are used as the first input, and the second feature map b1, the fourth feature map b2, the sixth feature map b3, the eighth feature map b4, and the tenth feature map b5 are used as the second input. After processing the first input, the first fusion module obtains the first multi-level fused feature map h1′. After processing the second input, the second fusion module obtains the second multi-level fused feature map b1′. After processing the first input, the third fusion module obtains the third multi-level fused feature map h2′. The fourth fusion module processes the first input to obtain the third multi-level fused feature map h2′. After processing the two inputs, the fourth multi-level fusion feature map b2′ is obtained. After processing the first input, the fifth fusion module obtains the fifth multi-level fusion feature map h3′. After processing the second input, the sixth fusion module obtains the sixth multi-level fusion feature map b3′. After processing the first input, the seventh fusion module obtains the seventh multi-level fusion feature map h4′. After processing the second input, the eighth fusion module obtains the eighth multi-level fusion feature map b4′. After processing the first input, the ninth fusion module obtains the ninth multi-level fusion feature map h5′. After processing the second input, the tenth fusion module obtains the tenth multi-level fusion feature map b5′.
[0057] In the bottleneck structure, the fifth noise feature map x5′ and the fifth medical image feature map g5′ are used as inputs, and the sixth noise feature map x6′ is output after processing.
[0058] In the denoising network decoder, the fifth decoder takes the sixth noise feature map x6′, the tenth multi-level fusion feature map b5′, and the ninth multi-level fusion feature map h5′ as inputs, and after processing, obtains the seventh noise feature map x7′. The fourth decoder takes the seventh noise feature map x7′, the eighth multi-level fusion feature map b4′, and the seventh multi-level fusion feature map h4′ as inputs, and after processing, obtains the eighth noise feature map x8′. The third decoder takes the eighth noise feature map x8′, the sixth multi-level fusion feature map b3′, and the fifth multi-level fusion feature map h3′ as inputs, and after processing, obtains the ninth noise feature map x9′. The second decoder takes the ninth noise feature map x9′, the fourth multi-level fusion feature map b2′, and the third multi-level fusion feature map h2′ as inputs, and after processing, obtains the tenth noise feature map x10′. The first decoder takes the tenth noise feature map x10′, the second multi-level fusion feature map b1′, and the first multi-level fusion feature map h1′ as inputs, and after processing, obtains the segmented image of the skin lesion.
[0059] It should be noted that this invention constructs a denoising network encoder, into which both the preprocessed medical image and the noisy medical image are input to obtain feature map information at different levels. The denoising network encoder contains five encoders with non-shared parameters, and its structure is similar to the U-Net encoder section. Each encoder in the denoising network encoder contains two independent feature extraction paths: one for extracting features from the preprocessed medical image and the other for extracting features from the noisy medical image. Each path employs a deep convolutional network to learn the complex relationship between image content and noise patterns.
[0060] The denoising process in the denoising network is as follows:
[0061]
[0062] in, For the normal skin lesion image output by the denoising network, γ t Indicates the noise variance adjustment factor; ∈ θ This represents the trained denoising network.
[0063] In this embodiment, the input to the denoising network encoder is a preprocessed medical image and a noisy medical image. A dual-path approach is used to extract features from both images. The processing flow is described below using the first encoder as an example. The processing flows in the second, third, fourth, and fifth encoders are consistent with the first encoder, except that the noisy medical image is replaced with noise feature maps at various scales, and the preprocessed medical image is replaced with medical image feature maps at various scales. This allows the generation of second, third, fourth, and fifth noise feature maps in the same way as the acquisition of the first noise feature map, and vice versa. Figure 2 As shown, in the first encoder, the medical image with added noise and the time series are first input into the first residual block to obtain the first intermediate feature map. The preprocessed medical image and the time series are input into the second residual block to obtain the second intermediate feature map. The first intermediate feature map and the second intermediate feature map are concatenated to obtain the first feature map. The first feature map and the time series are input into the third residual block to obtain the third intermediate feature map. The third intermediate feature map and the first intermediate feature map are concatenated to obtain the fourth intermediate feature map. The fourth intermediate feature map and the time series are input into the fourth residual block to obtain the fifth intermediate feature map. The fifth intermediate feature map is passed through the first linear attention module to obtain the first noise feature map. The first noise feature map and the third intermediate feature map are concatenated to obtain the second feature map. The second feature map is input into the second linear attention module to obtain the first medical image feature map.
[0064] It should be noted that the implementation of the linear attention module is existing technology and will not be described in detail in this invention.
[0065] It should be noted that this invention constructs a bottleneck structure, and the specific processing flow is as follows: Figure 6 As shown, the fifth noise feature map and the fifth medical image feature map are added together to obtain the added feature map. The added feature map and the time series are input into the fifth residual block to obtain the sixth intermediate feature map. The sixth intermediate feature map is processed by the third linear attention module to obtain the seventh intermediate feature map. The sixth intermediate feature map is processed by the self-attention module to obtain the eighth intermediate feature map. The seventh intermediate feature map and the eighth intermediate feature map are added together and input into the sixth residual block to obtain the sixth noise feature map.
[0066] It should be noted that the implementation method of the self-attention module is existing technology and will not be described in detail in this invention.
[0067] It should be noted that this invention constructs a multi-level feature fusion module, which fuses all feature maps output by the denoising network encoder to enrich the semantic information at each level. The multi-level feature fusion module contains ten fusion modules with non-shared parameters. Each fusion module includes a spatial attention module and a channel attention module. The channel attention module further enhances the response to important channels and weakens the influence of unimportant channels. This module uses adaptive average pooling and max pooling to extract global features and transforms them through a fully connected layer. The spatial attention module emphasizes features of important spatial regions, improving the model's segmentation performance by focusing on specific spatial locations. For each skip connection between the encoder and decoder at each level, an independent fusion module is configured. This module generates a series of convolutional layers during initialization to process the feature maps at each level. The module receives the output feature map of the corresponding level encoder, and through adaptive average pooling or upsampling, the resolution of the feature map is unified to the same size as the output feature map of the current level encoder. Figure 4 As shown, the first fusion module ( Figure 4 The fusion module H1 and the third fusion module ( Figure 4 The fusion module H2 and the fifth fusion module (in the middle) Figure 4 The fusion module H3 and the seventh fusion module ( Figure 4 The fusion module H4 and the ninth fusion module (in the middle) Figure 4 The fusion module H5 is used to process the first input (first feature map h1, third feature map h2, fifth feature map h3, seventh feature map h4, and ninth feature map h5), and each fusion module obtains a first multi-level fused feature map h1′, a third multi-level fused feature map h2′, a fifth multi-level fused feature map h3′, a seventh multi-level fused feature map h4′, and a ninth multi-level fused feature map h5′ respectively; the second fusion module ( Figure 4 The fusion module B1 and the fourth fusion module (in the middle) Figure 4 The fusion module B2 and the sixth fusion module ( Figure 4 The fusion module B3 and the eighth fusion module (in the middle) Figure 4 The fusion module B4 and the tenth fusion module (in the middle) Figure 4 The fusion module B5 is used to process the second input (second feature map b1, fourth feature map b2, sixth feature map b3, eighth feature map b4 and tenth feature map b5), and each fusion module obtains the second multi-level fusion feature map b1′, the fourth multi-level fusion feature map b2′, the sixth multi-level fusion feature map b3′, the eighth multi-level fusion feature map b4′ and the tenth multi-level fusion feature map b5′ respectively.
[0068] In this embodiment, the processing flow in each fusion module is as follows: Figure 5 As shown, each feature map from the first or second input is processed by a separate fusion branch. Each fusion branch outputs a fused feature map. The fused feature maps from all the fusion branches are multiplied to obtain a feature map that integrates multi-level information, i.e., the global fused feature map. The global fused feature map is processed through a 1×1 convolutional layer ReLU(Conv(·)) with an activation function to obtain the global fused feature map. This is converted into an output feature map with a predetermined number of channels, i.e., a multi-level fused feature map F. out :
[0069]
[0070] The 1×1 convolutional layer is used to convert the global fused feature map into a predetermined number of output channels, and then performs a non-linear transformation through the ReLU activation function to provide an enhanced feature map for the decoder.
[0071] In each fusion branch, for the encoder of the l-th level, its output feature map is set to F. l The input feature map F l The spatial weight map SA(F) is obtained through the spatial attention module SA(·). l Then, the input feature map F l Spatial weighted graph SA(F) l Multiplying these two components yields a spatially weighted feature map.
[0072]
[0073] The spatially weighted feature map is passed through the channel attention module CA(·) to obtain the channel weight map. Spatial weighted feature map Multiplying the channel weight map by the channel weight map yields the channel weighted feature map:
[0074]
[0075] The channel weighted feature map is subjected to adaptive average pooling to obtain the pooled weighted feature map. The pooled weighted feature map is then processed through a 3×3 convolutional layer to obtain the output fused feature map.
[0076] It should be noted that this invention constructs a denoising network decoder. The two feature maps (h and b) output by each level encoder are passed to the decoder at the same level via skip connections. The feature maps x and g output by the encoder are passed to the next level encoder. In the denoising network decoder, the sixth noise feature map is used as input, and the output is a segmented image. The denoising network decoder has a structure similar to U-Net, containing five decoders with non-shared parameters. Each decoder performs an upsampling operation to obtain a sampled feature map. Then, the decoder concatenates the multi-level fused feature maps output by the multi-level feature fusion module via skip connections and continues the upsampling operation to reconstruct the image at the original image resolution. The following describes the processing flow using the fifth decoder as an example. The processing flows in the fourth, third, second, and first decoders are consistent with the fifth encoder, except that the input sixth noise feature map is replaced with the seventh, eighth, ninth, and tenth noise feature maps, which are then used as part of the input to the fourth, third, second, and first decoders, respectively. The tenth and ninth multi-level fusion feature maps are replaced with the multi-level fusion feature maps output from the other two fusion modules, which are then used as another part of the input to the fourth, third, second, and first decoders, respectively. This allows the generation of the eighth, ninth, and tenth noise feature maps, as well as the segmentation result image of the skin lesion, in the same way that the fifth decoder outputs the seventh noise feature map. Figure 3 As shown, in the fifth decoder, the sixth noise feature map and the tenth multi-level fusion feature map are concatenated to obtain the ninth intermediate feature map. The ninth intermediate feature map and the time series are input into the seventh residual block to obtain the tenth intermediate feature map. The tenth intermediate feature map and the ninth multi-level fusion feature map are concatenated to obtain the eleventh intermediate feature map. The eleventh intermediate feature map and the time series are input into the eighth residual block to obtain the eleventh intermediate feature map. After the eleventh intermediate feature map is processed by the fourth linear attention module, the twelfth intermediate feature map is obtained. The twelfth intermediate feature map is upsampled to obtain the seventh noise feature map.
[0077] It should be noted that the specific processing flow in each residual block in step S3 is as follows: The input time series is processed through a fully connected layer and a SiLU activation function to obtain a scale vector and a shift vector. The scale vector, shift vector, and input feature map are scaled and shifted element-wise to obtain a feature map incorporating temporal embedding information. The feature map incorporating temporal embedding information is processed through a first convolutional layer, a SiLU activation function, a second convolutional layer, and another SiLU activation function to obtain a thirteenth intermediate feature map. The input feature map is processed through a third convolutional layer to obtain a fourteenth intermediate feature map. The thirteenth intermediate feature map and the fourteenth intermediate feature map are added together to obtain the feature map output by the residual block.
[0078] It should be noted that in step S3, during the training of the denoising network, the Adam optimizer is used to optimize the parameters in the encoder and decoder of the denoising network. This invention utilizes two types of loss functions to optimize the denoising network: one type optimizes the segmentation performance of the denoising network, and the other type optimizes the denoising performance. The total loss function of this invention combines pixel-level loss and boundary-aware loss functions, comparing the predicted mask with the true label to accurately extract the lesion region from the image.
[0079] In this embodiment, the pixel-level loss function L seg By cross-entropy loss function L ce and Dice loss function L Dice The cross-entropy loss function L is composed of weighted combinations. ce Used to optimize pixel-level classification accuracy: Dice loss function L Dice This is used by the denoising network to identify the overall shape and size of the segmented region, improving the consistency of the segmentation. Specifically:
[0080] L seg =aL ce +bL Dice
[0081]
[0082] In the formula, a and b are both hyperparameters; y i This represents the true label of the i-th pixel. This represents the probability predicted by the denoising network, where N is the total number of pixels in the image.
[0083] In this embodiment, the boundary-aware loss function L noise The performance specifically in identifying the edges of skin lesions, by emphasizing the prediction accuracy of boundary regions to enhance the detail of segmentation, can be expressed as:
[0084] L noise =(1+αW) θ )‖e-∈(x t ,g,t)‖ 2
[0085] Where e is the noise predicted by the denoising network, ∈(x t (g,t) represents a given image x at time t. t And the actual noise and the predicted target value under condition g; W θ The dynamic parameter W represents the parameter that increases the weight of noise prediction in the boundary region and decreases the weight as the distance moves inward from the boundary. α is a weighting parameter used to adjust the dynamic parameter W. θ The impact.
[0086] In summary, the total loss function is:
[0087] L=L seg +L noise
[0088] The present invention will now demonstrate the application effect of the multi-level feature fusion medical image segmentation method based on the diffusion model described in the above embodiments on a specific dataset through a specific example, so as to facilitate understanding of the essence of the present invention.
[0089] Example
[0090] To verify the effectiveness of this invention, this embodiment evaluates the performance of the proposed method on the ISIC2018 dataset. The ISIC2018 dataset, from the International Skin Imaging Collaboration, is a comprehensive dataset designed for tasks such as instance segmentation, semantic segmentation, and object detection in medical research. This dataset contains a large number of dermoscopic images, which are crucial for studying skin lesions. The dataset includes categories such as skin cancer, pigmented network, globular body, miliary cyst, negative network, and striae. Each image has pixel-level instance segmentation annotations. In this invention, the test set is randomly partitioned in a 7:2:1 ratio.
[0091] The method of this invention was developed under the PyTorch framework and trained on three 3090 graphics cards. During training, the Adam optimizer was used to optimize the parameters of the denoising network. In this process, the batch sizes were set to 24, the initial learning rate was set to 0.00005, the learning rate decay algorithm was adopted, the patience value was 9, the decay factor was 0.5, and a total of 400 training rounds were performed.
[0092] This invention uses Dice, Sensitivity, Specificity, and Accuracy to evaluate the segmentation performance of the denoising network. Dice measures segmentation performance by calculating the overlap rate between the predicted results and the ground truth labels; a higher Dice value indicates that the segmentation result is closer to the ground truth labels. Sensitivity, also known as recall, measures the ratio of correctly identified positive examples (e.g., lesion areas) to the total number of actual positive examples; a high Sensitivity score indicates that the denoising network has captured all true positive examples well. Specificity measures the ratio of correctly identified negative examples (e.g., healthy tissue) to the total number of actual negative examples; a high Specificity score indicates that the denoising network has effectively avoided mislabeling negative examples as positive examples. Accuracy is the ratio of correctly predicted positive and negative examples to the total number of predictions. Accuracy provides an indicator of the overall model performance.
[0093] On the ISIC2018 dataset, the method of this invention was compared with medical image segmentation methods such as U-Net, DAGAN, TransUnet, Swin-Unet, DeepLabv3+, Att-UNet, UCTransUNet, MissFormer, and EnsDiff. The experimental results are shown in Table 1. It can be seen that the proposed method achieves Dice, Sensitivity, Specificity, and Accuracy of 0.9105, 0.9104, 0.9752, and 0.9612 on the ISIC2018 dataset, respectively, demonstrating the effectiveness of the proposed method in segmenting skin lesion regions and boundaries.
[0094] Table 1. Comparison of objective evaluations of different methods on the ISIC2018 dataset
[0095] method DSC SE SP ACC U-Net 0.8545 0.8800 0.9697 0.9404 DAGAN 0.8807 0.9072 0.9588 0.9324 TransUnet 0.8499 0.8578 0.9653 0.9452 Swin-Unet 0.8946 0.9056 0.9798 0.9645 DeepLabv3+ 0.8820 0.8560 0.9770 0.9510 Att-UNet 0.8566 0.8674 0.9863 0.9376 UCTransUNet 0.8838 0.9825 0.8429 0.9527 MissFormer 0.8631 0.9690 0.8458 0.9427 EnsDiff 0.8775 0.8358 0.9812 0.9502 Method of the present invention 0.9105 0.9104 0.9752 0.9612
[0096] Furthermore, this invention compares the visual effects of the segmentation results from TransUNet, EnsDiff, and U-Net, such as... Figure 7 As shown, it can be seen that the method proposed in this invention can more accurately identify and locate the skin lesion area and boundary, while the segmentation results of other methods are coarser.
[0097] It should be noted that the above-mentioned multi-level feature fusion medical image segmentation method based on diffusion model of the present invention can be used for non-disease diagnosis purposes, such as scientific research, testing or data processing, and can also be used to provide intermediate parameters in the field of auxiliary diagnosis.
[0098] It should also be noted that the multi-level feature fusion medical image segmentation method based on the diffusion model in the above embodiments can essentially be executed by a computer program or module. Therefore, similarly, based on the same inventive concept, another preferred embodiment of the present invention also provides a multi-level feature fusion medical image segmentation system based on the diffusion model, corresponding to the multi-level feature fusion medical image segmentation method based on the diffusion model provided in the above embodiments, comprising:
[0099] The data preprocessing module is used to acquire medical images with skin lesions and perform corresponding preprocessing on the medical images to obtain preprocessed medical images.
[0100] The diffusion process processing module is used to perform a forward diffusion process on the preprocessed medical image, gradually adding Gaussian noise to obtain a noisy medical image.
[0101] The result acquisition module is used to input the noise-added medical image and the preprocessed medical image into the trained denoising network to obtain the segmentation result image of the skin lesion. The denoising network includes a denoising network encoder, a multi-level feature fusion module, a bottleneck structure, and a denoising network decoder. The denoising network encoder includes five encoders with non-shared parameters. Each encoder includes four residual blocks and two linear attention modules. The multi-level feature fusion module includes ten fusion modules with non-shared parameters. Each fusion module includes a spatial attention module and a channel attention module. The bottleneck structure includes two residual blocks, one linear attention module, and one self-attention module. The denoising network decoder includes five decoders with non-shared parameters. Each decoder includes two residual blocks and one linear attention module.
[0102] In the denoising network encoder, the medical image with added noise and the preprocessed medical image are used as input. After processing by the first encoder, a first feature map, a second feature map, a first noise feature map, and a first medical image feature map are obtained. The first noise feature map and the first medical image feature map are then input into the second encoder to obtain a third feature map, a fourth feature map, a second noise feature map, and a second medical image feature map. The second noise feature map and the second medical image feature map are then input into the third encoder to obtain a fifth feature map, a sixth feature map, a third noise feature map, and a third medical image feature map. The third noise feature map and the third medical image feature map are then input into the fourth encoder to obtain a seventh feature map, an eighth feature map, a fourth noise feature map, and a fourth medical image feature map. Finally, the fourth noise feature map and the fourth medical image feature map are input into the fifth encoder to obtain a ninth feature map, a tenth feature map, a fifth noise feature map, and a fifth medical image feature map.
[0103] In the multi-level feature fusion module, the first feature map, the third feature map, the fifth feature map, the seventh feature map, and the ninth feature map are used as the first input, and the second feature map, the fourth feature map, the sixth feature map, the eighth feature map, and the tenth feature map are used as the second input. After processing the first input, the first fusion module obtains the first multi-level fusion feature map; after processing the second input, the second fusion module obtains the second multi-level fusion feature map; after processing the first input, the third fusion module obtains the third multi-level fusion feature map; after processing the second input, the fourth fusion module obtains the fourth multi-level fusion feature map; after processing the first input, the fifth fusion module obtains the fifth multi-level fusion feature map; after processing the second input, the sixth fusion module obtains the sixth multi-level fusion feature map; after processing the first input, the seventh fusion module obtains the seventh multi-level fusion feature map; after processing the second input, the eighth fusion module obtains the eighth multi-level fusion feature map; after processing the first input, the ninth fusion module obtains the ninth multi-level fusion feature map; and after processing the second input, the tenth fusion module obtains the tenth multi-level fusion feature map.
[0104] In the bottleneck structure, the fifth noise feature map and the fifth medical image feature map are used as inputs, and the sixth noise feature map is output after processing.
[0105] In the denoising network decoder, the fifth decoder takes the sixth, tenth, and ninth multi-level fusion feature maps as inputs and processes them to obtain the seventh noise feature map. The fourth decoder takes the seventh, eighth, and seventh multi-level fusion feature maps as inputs and processes them to obtain the eighth noise feature map. The third decoder takes the eighth, sixth, and fifth multi-level fusion feature maps as inputs and processes them to obtain the ninth noise feature map. The second decoder takes the ninth, fourth, and third multi-level fusion feature maps as inputs and processes them to obtain the tenth noise feature map. The first decoder takes the tenth, second, and first multi-level fusion feature maps as inputs and processes them to obtain the segmented image of the skin lesion.
[0106] Based on the same inventive concept, another preferred embodiment of the present invention also provides a computer electronic device corresponding to the multi-level feature fusion medical image segmentation method based on diffusion model provided in the above embodiment, including: an image acquisition module, an image segmentation module, and a result output module;
[0107] The image acquisition module is used to acquire the preprocessed medical image required as input to the denoising network, as well as the medical image after adding noise.
[0108] The image segmentation module is used to obtain the trained denoising network obtained by the multi-level feature fusion medical image segmentation method based on the diffusion model as described in the above embodiments.
[0109] The result output module is used to input the preprocessed medical image and the noisy medical image obtained by the image acquisition module into the denoising network obtained by the image segmentation module, and output the segmentation result image of the skin lesion.
[0110] It is important to note that the image acquisition module acquires both preprocessed and noisy medical images, while the image segmentation module acquires a trained denoising network. Both can be acquired online or offline. For online acquisition, the image acquisition module can control the imaging device online to capture preprocessed medical images and add noise to them to generate noisy medical images. The image segmentation module can train the denoising network online. For offline acquisition, the image acquisition module can acquire both preprocessed and noisy medical images already acquired and stored by the imaging device. The image segmentation module can read the denoising network trained and stored on the storage medium. The result output module outputs the segmented images of skin lesions. In practice, the results can be output to a local display or uploaded to the cloud for remote display or retrieval.
[0111] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the invention. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the invention. Therefore, all technical solutions obtained through equivalent substitution or transformation fall within the protection scope of the present invention.
Claims
1. A multi-level feature fusion medical image segmentation method based on a diffusion model, characterized in that, Includes the following steps: S1: Acquire a medical image with skin lesions, and perform corresponding preprocessing on the medical image to obtain a preprocessed medical image; S2: Perform a forward diffusion process on the preprocessed medical image, gradually adding Gaussian noise to obtain a medical image with added noise; S3: Input the noise-added medical image and the preprocessed medical image into the trained denoising network to obtain the segmentation result image of the skin lesion; The denoising network includes a denoising network encoder, a multi-level feature fusion module, a bottleneck structure, and a denoising network decoder. The denoising network encoder includes five encoders with non-shared parameters, each encoder containing four residual blocks and two linear attention modules. The multi-level feature fusion module includes ten fusion modules with non-shared parameters, each fusion module containing a spatial attention module and a channel attention module. The bottleneck structure includes two residual blocks, one linear attention module, and one self-attention module. The denoising network decoder includes five decoders with non-shared parameters, each decoder containing two residual blocks and one linear attention module. In the denoising network encoder, the medical image with added noise, the preprocessed medical image, and the time series are taken as input. After processing by the first encoder, the first feature map, the second feature map, the first noise feature map, and the first medical image feature map are obtained. The first noise feature map and the first medical image feature map are input into the second encoder for processing to obtain the third feature map, the fourth feature map, the second noise feature map, and the second medical image feature map. The second noise feature map and the second medical image feature map are input into the third encoder for processing to obtain the fifth feature map, the sixth feature map, the third noise feature map, and the third medical image feature map. The third noise feature map and the third medical image feature map are input into the fourth encoder for processing to obtain the seventh feature map, the eighth feature map, the fourth noise feature map, and the fourth medical image feature map. The fourth noise feature map and the fourth medical image feature map are input into the fifth encoder for processing to obtain the ninth feature map, the tenth feature map, the fifth noise feature map, and the fifth medical image feature map. In the multi-level feature fusion module, the first feature map, the third feature map, the fifth feature map, the seventh feature map, and the ninth feature map are used as the first input, and the second feature map, the fourth feature map, the sixth feature map, the eighth feature map, and the tenth feature map are used as the second input. After processing the first input, the first fusion module obtains the first multi-level fusion feature map; after processing the second input, the second fusion module obtains the second multi-level fusion feature map; after processing the first input, the third fusion module obtains the third multi-level fusion feature map; after processing the second input, the fourth fusion module obtains the fourth multi-level fusion feature map; after processing the first input, the fifth fusion module obtains the fifth multi-level fusion feature map; after processing the second input, the sixth fusion module obtains the sixth multi-level fusion feature map; after processing the first input, the seventh fusion module obtains the seventh multi-level fusion feature map; after processing the second input, the eighth fusion module obtains the eighth multi-level fusion feature map; after processing the first input, the ninth fusion module obtains the ninth multi-level fusion feature map; and after processing the second input, the tenth fusion module obtains the tenth multi-level fusion feature map. In the bottleneck structure, the fifth noise feature map and the fifth medical image feature map are used as inputs, and the sixth noise feature map is output after processing. In the denoising network decoder, the fifth decoder takes the sixth, tenth, and ninth multi-level fusion feature maps as inputs and processes them to obtain the seventh noise feature map. The fourth decoder takes the seventh, eighth, and seventh multi-level fusion feature maps as inputs and processes them to obtain the eighth noise feature map. The third decoder takes the eighth, sixth, and fifth multi-level fusion feature maps as inputs and processes them to obtain the ninth noise feature map. The second decoder takes the ninth, fourth, and third multi-level fusion feature maps as inputs and processes them to obtain the tenth noise feature map. The first decoder takes the tenth, second, and first multi-level fusion feature maps as inputs and processes them to obtain the segmented image of the skin lesion.
2. The medical image segmentation method based on a diffusion model with multi-level feature fusion as described in claim 1, characterized in that, In step S1, the preprocessing specifically involves: randomly cropping medical images with skin lesions of different sizes to obtain a cropped medical image of size 128×128×3; then normalizing the cropped medical image and performing horizontal mirror flip, vertical mirror flip, and intensity change to obtain a preprocessed medical image.
3. The medical image segmentation method based on a diffusion model with multi-level feature fusion as described in claim 1, characterized in that, In step S3, the processing flow in the first encoder is as follows: The medical image with added noise and the time series are input into the first residual block to obtain the first intermediate feature map; the preprocessed medical image and the time series are input into the second residual block to obtain the second intermediate feature map; the first intermediate feature map and the second intermediate feature map are concatenated to obtain the first feature map; the first feature map and the time series are input into the third residual block to obtain the third intermediate feature map; the third intermediate feature map and the first intermediate feature map are concatenated to obtain the fourth intermediate feature map; the fourth intermediate feature map and the time series are input into the fourth residual block to obtain the fifth intermediate feature map; the fifth intermediate feature map is passed through the first linear attention module to obtain the first noise feature map; the first noise feature map and the third intermediate feature map are concatenated to obtain the second feature map; the second feature map is input into the second linear attention module to obtain the first medical image feature map.
4. The medical image segmentation method based on a diffusion model with multi-level feature fusion as described in claim 1, characterized in that, In step S3, the specific processing flow in the bottleneck structure is as follows: the fifth noise feature map and the fifth medical image feature map are added together to obtain the added feature map. The added feature map and the time series are input into the fifth residual block to obtain the sixth intermediate feature map. The sixth intermediate feature map is processed by the third linear attention module to obtain the seventh intermediate feature map. The sixth intermediate feature map is processed by the self-attention module to obtain the eighth intermediate feature map. The seventh intermediate feature map and the eighth intermediate feature map are added together and input into the sixth residual block to obtain the sixth noise feature map.
5. The medical image segmentation method based on a diffusion model with multi-level feature fusion as described in claim 1, characterized in that, In step S3, the processing flow in each fusion module is as follows: each feature map in the first input or the second input is processed by a fusion branch, each fusion branch outputs a fusion feature map, the fusion feature maps output by each fusion branch are multiplied to obtain a global fusion feature map, and the global fusion feature map is processed through a convolutional layer with an activation function to obtain a multi-level fusion feature map.
6. The medical image segmentation method based on a diffusion model with multi-level feature fusion as described in claim 5, characterized in that, In step S3, in each fusion branch, the input feature map is passed through the first spatial attention module to obtain the first spatial weight map. The input feature map and the first spatial weight map are multiplied to obtain the first spatial weighted feature map. The first spatial weighted feature map is passed through the first channel attention module to obtain the first channel weight map. The first spatial weighted feature map and the first channel weight map are multiplied to obtain the first channel weighted feature map. The first channel weighted feature map is subjected to an adaptive average pooling operation to obtain the pooled weighted feature map. The pooled weighted feature map is processed through a convolutional layer to obtain the output fusion feature map.
7. The medical image segmentation method based on a diffusion model with multi-level feature fusion as described in claim 1, characterized in that, In step S3, the processing flow in the fifth decoder is as follows: the sixth noise feature map and the tenth multi-level fusion feature map are concatenated to obtain the ninth intermediate feature map; the ninth intermediate feature map and the time series are input into the seventh residual block to obtain the tenth intermediate feature map; the tenth intermediate feature map and the ninth multi-level fusion feature map are concatenated to obtain the eleventh intermediate feature map; the eleventh intermediate feature map and the time series are input into the eighth residual block to obtain the eleventh intermediate feature map; the eleventh intermediate feature map is processed by the fourth linear attention module to obtain the twelfth intermediate feature map; the twelfth intermediate feature map is upsampled to obtain the seventh noise feature map.
8. The medical image segmentation method based on a diffusion model with multi-level feature fusion as described in claim 1, characterized in that, In step S3, the processing flow in each residual block is as follows: The input time series is processed through a fully connected layer and a SiLU activation function to obtain a scale vector and a shift vector. The scale vector, shift vector, and input feature map are scaled and shifted element-wise to obtain a feature map incorporating temporal embedding information. The feature map incorporating temporal embedding information is processed sequentially through a first convolutional layer, a SiLU activation function, a second convolutional layer, and another SiLU activation function to obtain a thirteenth intermediate feature map. The input feature map is processed through a third convolutional layer to obtain a fourteenth intermediate feature map. The thirteenth intermediate feature map and the fourteenth intermediate feature map are added together to obtain the feature map output by the residual block.
9. A multi-level feature fusion medical image segmentation system based on a diffusion model, characterized in that, include: The data preprocessing module is used to acquire medical images with skin lesions and perform corresponding preprocessing on the medical images to obtain preprocessed medical images. The diffusion process processing module is used to perform a forward diffusion process on the preprocessed medical image, gradually adding Gaussian noise to obtain a noisy medical image. The result acquisition module is used to input the noise-added medical image and the preprocessed medical image into the trained denoising network to obtain the segmentation result image of the skin lesion. The denoising network includes a denoising network encoder, a multi-level feature fusion module, a bottleneck structure, and a denoising network decoder. The denoising network encoder includes five encoders with non-shared parameters, each encoder containing four residual blocks and two linear attention modules. The multi-level feature fusion module includes ten fusion modules with non-shared parameters, each fusion module containing a spatial attention module and a channel attention module. The bottleneck structure includes two residual blocks, one linear attention module, and one self-attention module. The denoising network decoder includes five decoders with non-shared parameters, each decoder containing two residual blocks and one linear attention module. In the denoising network encoder, the medical image with added noise, the preprocessed medical image, and the time series are taken as input. After processing by the first encoder, the first feature map, the second feature map, the first noise feature map, and the first medical image feature map are obtained. The first noise feature map and the first medical image feature map are input into the second encoder for processing to obtain the third feature map, the fourth feature map, the second noise feature map, and the second medical image feature map. The second noise feature map and the second medical image feature map are input into the third encoder for processing to obtain the fifth feature map, the sixth feature map, the third noise feature map, and the third medical image feature map. The third noise feature map and the third medical image feature map are input into the fourth encoder for processing to obtain the seventh feature map, the eighth feature map, the fourth noise feature map, and the fourth medical image feature map. The fourth noise feature map and the fourth medical image feature map are input into the fifth encoder for processing to obtain the ninth feature map, the tenth feature map, the fifth noise feature map, and the fifth medical image feature map. In the multi-level feature fusion module, the first feature map, the third feature map, the fifth feature map, the seventh feature map, and the ninth feature map are used as the first input, and the second feature map, the fourth feature map, the sixth feature map, the eighth feature map, and the tenth feature map are used as the second input. After processing the first input, the first fusion module obtains the first multi-level fusion feature map; after processing the second input, the second fusion module obtains the second multi-level fusion feature map; after processing the first input, the third fusion module obtains the third multi-level fusion feature map; after processing the second input, the fourth fusion module obtains the fourth multi-level fusion feature map; after processing the first input, the fifth fusion module obtains the fifth multi-level fusion feature map; after processing the second input, the sixth fusion module obtains the sixth multi-level fusion feature map; after processing the first input, the seventh fusion module obtains the seventh multi-level fusion feature map; after processing the second input, the eighth fusion module obtains the eighth multi-level fusion feature map; after processing the first input, the ninth fusion module obtains the ninth multi-level fusion feature map; and after processing the second input, the tenth fusion module obtains the tenth multi-level fusion feature map. In the bottleneck structure, the fifth noise feature map and the fifth medical image feature map are used as inputs, and the sixth noise feature map is output after processing. In the denoising network decoder, the fifth decoder takes the sixth, tenth, and ninth multi-level fusion feature maps as inputs and processes them to obtain the seventh noise feature map. The fourth decoder takes the seventh, eighth, and seventh multi-level fusion feature maps as inputs and processes them to obtain the eighth noise feature map. The third decoder takes the eighth, sixth, and fifth multi-level fusion feature maps as inputs and processes them to obtain the ninth noise feature map. The second decoder takes the ninth, fourth, and third multi-level fusion feature maps as inputs and processes them to obtain the tenth noise feature map. The first decoder takes the tenth, second, and first multi-level fusion feature maps as inputs and processes them to obtain the segmented image of the skin lesion.
10. A computer electronic device, characterized in that, include: Image acquisition module, image segmentation module, and result output module; The image acquisition module is used to acquire the preprocessed medical image required as input to the denoising network, as well as the medical image after adding noise. The image segmentation module is used to obtain the trained denoising network obtained by the multi-level feature fusion medical image segmentation method based on the diffusion model as described in any one of claims 1 to 8; The result output module is used to input the preprocessed medical image and the noisy medical image obtained by the image acquisition module into the denoising network obtained by the image segmentation module, and output the segmentation result image of the skin lesion.
Citation Information
Patent Citations
Image segmentation method and device, storage medium and electronic equipment
CN111260653A
Medical image tumor segmentation method based on diffusion model and multi-modal fusion
CN116664605A