An uncertainty medical image segmentation system and method based on a priori guided diffusion model

By combining prior guidance and flow matching diffusion model, the problem of slow inference process of diffusion model is solved, and fast, efficient and high-quality segmentation results are achieved for medical image segmentation.

CN119887792BActive Publication Date: 2025-10-21HARBIN INST OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510069480.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-16
Publication Date
2025-10-21
Estimated Expiration
2045-01-16

AI Technical Summary

Technical Problem

Existing diffusion models suffer from slow inference processes and high time costs in uncertain medical image segmentation. They also fail to effectively handle blurred boundaries and artifacts in medical images, leading to uncertain segmentation results.

Method used

A prior-guided diffusion model is adopted, which generates an intermediate distribution closer to the target distribution through the prior-guided module and uses the flow matching diffusion module to generate multiple prediction results. By combining the fast inference speed of the prior network and the linear diffusion path of the flow matching diffusion model, the number of inference steps is reduced to improve the segmentation effect.

Benefits of technology

It significantly accelerates the reasoning process, improves the quality and accuracy of segmentation results, reduces redundant reasoning, and enhances segmentation performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119887792B_ABST
    Figure CN119887792B_ABST
Patent Text Reader

Abstract

The application discloses an uncertainty medical image segmentation system and method based on a priori guided diffusion model, and belongs to the technical field of medical image segmentation.The application solves the problem of slow inference process of an existing diffusion model.In the priori stage, an intermediate distribution closer to a target distribution is generated, and the intermediate distribution generated in the priori stage is shared in the inference process of all prediction results, so that the inference process of all prediction results starts from the same intermediate distribution, redundancy of the inference process is avoided, the inference speed of the priori network in the priori stage is significantly faster than that of the diffusion model, and the inference process is greatly accelerated.Finally, a flow matching diffusion model with additional segmentation supervision is used to generate multiple prediction results, and the diffusion path of the flow matching is a straight line in the latent space, so that the flow matching can achieve good inference effect with less inference steps.The method can be applied to medical image segmentation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of medical image segmentation, and in particular relates to an uncertainty medical image segmentation system and method based on a priori guided diffusion model. Background Art

[0002] With the rapid development of medical image analysis technology, medical image segmentation plays an increasingly important role in clinical diagnosis and treatment. However, traditional medical image segmentation algorithms are often unable to effectively handle fuzzy boundaries, artifacts, and subjective differences between different annotators in medical images, resulting in uncertainty in the segmentation results. Therefore, in computer-aided diagnosis, it is usually necessary to provide a series of reasonable segmentation predictions, combined with subsequent screening and other means to obtain high-confidence segmentation results. Diffusion models are at the forefront of the field of uncertain medical image segmentation, but when generating multiple segmentation prediction labels, the high time cost limits the further clinical promotion of existing diffusion models. Therefore, proposing a new diffusion model to accelerate the inference process of the diffusion model is an urgent problem that needs to be solved. Summary of the Invention

[0003] The purpose of the present invention is to solve the problem of slow reasoning process of the existing diffusion model and to propose an uncertain medical image segmentation system and method based on a priori guided diffusion model.

[0004] The technical solution adopted by the present invention to solve the above technical problems is:

[0005] According to one aspect of the present invention, an uncertain medical image segmentation system based on a priori-guided diffusion model is provided. The system includes a medical image acquisition module, a medical image processing module, and a diffusion model M based on a priori-guided diffusion model. The diffusion model M based on a priori-guided diffusion model includes a priori-guided module M1 and a flow matching diffusion module M2.

[0006] The medical image acquisition module is used to acquire the diseased medical image to be segmented;

[0007] The medical image processing module is used to process the diseased medical image to be segmented to obtain the processed diseased medical image to be segmented;

[0008] The input of the diffusion model M based on prior guidance is the processed diseased medical image to be segmented, and the output of the diffusion model M based on prior guidance is the segmentation result of the diseased medical image to be segmented;

[0009] In the diffusion model M based on prior guidance, the input processed diseased medical image to be segmented first passes through the prior guidance module M1, and then the output of the prior guidance module M1 and the processed diseased medical image to be segmented are used as the input of the flow matching diffusion module M2, and the output of the flow matching diffusion module M2 is used as the output of the prior guided diffusion model M.

[0010] Furthermore, the working process of the medical image processing module is:

[0011] Step S11, performing denoising processing on the diseased medical image to be segmented to obtain the denoised diseased medical image to be segmented;

[0012] Step S12: cropping the denoised diseased medical image to be segmented, that is, cropping an N×N image centered on the lesion area from the denoised diseased medical image to be segmented;

[0013] Step S13: normalize the pixel values ​​in the cropped image to obtain a standardized image, which is the processed diseased medical image to be segmented.

[0014] Furthermore, the a priori guidance module M1 includes an encoder, a decoder, a first convolutional layer, and a second convolutional layer; the working process of the a priori guidance module M1 is:

[0015] Step S21: using the processed diseased medical image to be segmented as input to the encoder, and using the output of the encoder as input to the decoder;

[0016] σ=f θ (X)

[0017] Among them, X is the input processed medical image to be segmented, f θ (·) is the encoder-decoder structure in the prior guidance module M1, σ is the output of the decoder;

[0018] Step S22: using the output of the decoder as the input of the first convolutional layer and the second convolutional layer respectively;

[0019] μ=conv1(σ)

[0020] Σ=conv2(σ)

[0021] Where conv1(·) represents the first convolutional layer, μ represents the output of the first convolutional layer, conv2(·) represents the second convolutional layer, and Σ represents the output of the second convolutional layer.

[0022] Then model the intermediate Gaussian distribution X0~N(μ,Σ) with μ as mean and Σ as variance, where N(μ,Σ) is the output of the prior guidance module M1.

[0023] Furthermore, the flow matching diffusion module M2 includes T U-Net segmentation networks connected in series. The working process of the flow matching diffusion module M2 is as follows:

[0024] Sampling the intermediate Gaussian distribution X0 obtains a sampling result x0, and connecting the diseased medical image to be segmented and the sampling result x0 to obtain a connection result x′ 0,1 , the concatenated result x' 0,1 As the input of the first U-Net segmentation network, the connection result x′ of the first U-Net segmentation network is used 0,1 Perform the distribution transformation of the first time step and use the output of the first U-Net segmentation network as the distribution transformation result g of the first time step 0,1 (x′ 0,1 );

[0025] Then the diseased medical image to be segmented and g 0,1 (x′ 0,1 )Connect to get the connection result x' 0,2 , the concatenated result x' 0,2 As the input of the second U-Net segmentation network, the connection result x′ is connected using the second U-Net segmentation network 0,2 Perform the distribution transformation of the second time step to obtain the distribution transformation result g of the second time step 0,2 (x′ 0,2 ), and so on, the distribution transformation result g of the diseased medical image to be segmented and the T-1 time step 0,T-1 (x′ 0,T-1 )Connect to get the connection result x' 0,T , use the T-th U-Net segmentation network to connect the result x′ 0,T Perform the distribution transformation of the T-th time step to obtain the distribution transformation result g of the T-th time step 0,T (x′0, T );

[0026] Transform the distribution of the T-th time step g 0,T (x′ 0,T ) as the image segmentation result corresponding to the sampling result x0

[0027] Similarly, the intermediate Gaussian distribution X0 is sampled multiple times to obtain multiple sampling results, and then the image segmentation results corresponding to each sampling result are obtained respectively. The image segmentation results corresponding to all the sampling results are the segmentation results of the diseased medical image to be segmented.

[0028] Furthermore, the loss function L1 used in the training process of the prior guidance module M1 is:

[0029]

[0030] Where Y represents the training sample of diseased medical images; Y0 represents the intermediate distribution of the output after Y passes through the prior guidance module M1; are the 0th, 1st, ..., nth segmentation labels of sample Y respectively; P(Y0|Y) represents the probability likelihood of the intermediate distribution Y0 under the condition of sample Y; Indicates that the labels are split based on the middle distribution Y0. The probability likelihood of .

[0031] Furthermore, when the flow matching diffusion module M2 is trained, the parameters of the priori guidance module M1 are first frozen, and then the flow matching diffusion module M2 is trained based on the output of the priori guidance module M1.

[0032] Furthermore, the loss function L2 used in the training of the flow matching diffusion module M2 is:

[0033] L2=MSE+λ×Dice_Loss

[0034] Among them, MSE is the mean square error loss, Dice_Loss is the Dice loss, and λ represents the hyperparameter.

[0035] Furthermore, the mean square error loss MSE is calculated as follows:

[0036] For the i-th sampling result y of the intermediate distribution Y0 i , i = 0, 1, ..., n, the true value of the distribution transformation of each time step in the flow matching diffusion module M2 is recorded as f′ i,t ;

[0037]

[0038] Where t = 1, 2, ..., T, f′ i,t Indicates that the sampling result y i The true value of the distribution transformation at the tth time step after the input stream matches the diffusion module M2;

[0039] According to f′ i,t Get the mean square error loss MSE:

[0040]

[0041] Among them, ||·|| represents the 2-norm, g i,t Indicates that the i-th sampling result y i The distribution transformation result of the t-th U-Net segmentation network after the input stream is matched with the diffusion module M2;

[0042] The Dice loss is calculated as follows:

[0043]

[0044] in, Indicates the calculation of the intermediate segmentation prediction result Y at the tth time step i,1t and Dice loss;

[0045] Y i,1t =f i,t +g i,t (f i,t +Y)*(Tt)

[0046]

[0047] Among them, “*” means multiplication, f i,t +Y represents f i,t Connected with the diseased medical image training sample Y.

[0048] According to another aspect of the present invention, a method for uncertain medical image segmentation based on a priori guided diffusion model specifically comprises the following steps:

[0049] Step S1: Processing the diseased medical image to be segmented to obtain a processed diseased medical image to be segmented;

[0050] The specific process of step S1 is:

[0051] Step S11, performing denoising processing on the diseased medical image to be segmented to obtain the denoised diseased medical image to be segmented;

[0052] Step S12: cropping the denoised diseased medical image to be segmented, that is, cropping an N×N image centered on the lesion area from the denoised diseased medical image to be segmented;

[0053] Step S13: normalizing the pixel values ​​in the cropped image to obtain a standardized image, which is the processed diseased medical image to be segmented;

[0054] Step S2: inputting the processed diseased medical image to be segmented into a diffusion model M based on prior guidance, wherein the diffusion model M based on prior guidance includes a priori guidance module M1 and a flow matching diffusion module M2; outputting a segmentation result of the diseased medical image to be segmented through the diffusion model M based on prior guidance;

[0055] The a priori guidance module M1 includes an encoder, a decoder, a first convolutional layer, and a second convolutional layer. The working process of the a priori guidance module M1 is as follows:

[0056] Step S21: using the processed diseased medical image to be segmented as input to the encoder, and using the output of the encoder as input to the decoder;

[0057] σ=f θ (X)

[0058] Among them, X is the input processed medical image to be segmented, f θ (·) is the encoder-decoder structure in the prior guidance module M1, σ is the output of the decoder;

[0059] Step S22: using the output of the decoder as the input of the first convolutional layer and the second convolutional layer respectively;

[0060] μ=conv1(σ)

[0061] Σ=conv2(σ)

[0062] Where conv1(·) represents the first convolutional layer, μ represents the output of the first convolutional layer, conv2(·) represents the second convolutional layer, and Σ represents the output of the second convolutional layer.

[0063] Then model the intermediate Gaussian distribution X0~N(μ,Σ) with μ as mean and Σ as variance, where N(μ,Σ) is the output of the prior guidance module M1;

[0064] The flow matching diffusion module M2 includes T U-Net segmentation networks connected in series. The working process of the flow matching diffusion module M2 is as follows:

[0065] Sampling the intermediate Gaussian distribution X0 obtains a sampling result x0, and connecting the diseased medical image to be segmented and the sampling result x0 to obtain a connection result x' 0,1 , the concatenated result x' 0,1 As the input of the first U-Net segmentation network, the connection result x′ of the first U-Net segmentation network is used 0,1 Perform the distribution transformation of the first time step and use the output of the first U-Net segmentation network as the distribution transformation result g of the first time step 0,1 (x′ 0,1 );

[0066] Then the diseased medical image to be segmented and g 0,1 (x′ 0,1 )Connect to get the connection result x' 0,2 , connect the result x′ 0,2 As the input of the second U-Net segmentation network, the second U-Net segmentation network is used to connect the result x' 0,2Perform the distribution transformation of the second time step to obtain the distribution transformation result g of the second time step 0,2 (x' 0,2 ), and so on, the distribution transformation result g of the diseased medical image to be segmented and the T-1 time step 0,T-1 (x′ 0,T-1 ) Connect to get the connection result x′ 0,T , use the Tth U-Net segmentation network to connect the result x' 0,T Perform the distribution transformation of the T-th time step to obtain the distribution transformation result g of the T-th time step 0,T (x′ 0,T );

[0067] Transform the distribution of the T-th time step g 0,T (x′ 0,T ) as the image segmentation result corresponding to the sampling result x0

[0068] Similarly, the intermediate Gaussian distribution X0 is sampled multiple times to obtain multiple sampling results, and then the image segmentation results corresponding to each sampling result are obtained respectively. The image segmentation results corresponding to all the sampling results are the segmentation results of the diseased medical image to be segmented.

[0069] Furthermore, the loss function L1 used in the training process of the prior guidance module M1 is:

[0070]

[0071] Where Y represents the training sample of diseased medical images; Y0 represents the intermediate distribution of the output after Y passes through the prior guidance module M1; are the 0th, 1st, ..., nth segmentation labels of sample Y respectively; P(Y0|Y) represents the probability likelihood of the intermediate distribution Y0 under the condition of sample Y; Indicates that the labels are split based on the middle distribution Y0. The probability likelihood of ;

[0072] When training the flow matching diffusion module M2, the parameters of the prior guidance module M1 are first frozen, and then the flow matching diffusion module M2 is trained based on the output of the prior guidance module M1. The loss function L2 used when training the flow matching diffusion module M2 is:

[0073] L2=MSE+λ×Dice_Loss

[0074] Among them, MSE is the mean square error loss, Dice_Loss is the Dice loss, and λ represents the hyperparameter;

[0075] The calculation method of mean square error loss MSE is:

[0076] For the i-th sampling result y of the intermediate distribution Y0 i , i = 0, 1, ..., n, the true value of the distribution transformation of each time step in the flow matching diffusion module M2 is recorded as f′ i,t ;

[0077]

[0078] Where t = 1, 2, ..., T, f′ i,t Indicates that the sampling result y i The true value of the distribution transformation at the tth time step after the input stream matches the diffusion module M2;

[0079] According to f′ i , t gets the mean square error loss MSE:

[0080]

[0081] Among them, ||·|| represents the 2-norm, g i,t Indicates that the i-th sampling result y i The distribution transformation result of the t-th U-Net segmentation network after the input stream is matched with the diffusion module M2;

[0082] The calculation method of Dice loss is:

[0083]

[0084] in, Indicates the calculation of the intermediate segmentation prediction result Y at the tth time step i,1t and Dice loss;

[0085] Y i,1t =f i,t +g i,t (f i,t +Y)*(Tt)

[0086]

[0087] Among them, “*” means multiplication, f i,t +Y represents f i,t Connected with the diseased medical image training sample Y.

[0088] The beneficial effects of the present invention are:

[0089] The present invention first generates an intermediate distribution that is closer to the target distribution in the prior stage. Subsequently, the intermediate distribution generated in the prior stage is shared during the inference process of all predicted results. The present invention enables the inference process of all predicted results to start from the same intermediate distribution, which not only avoids redundant inference processes, but also makes the inference speed of the prior network in the prior stage significantly faster than the inference process of the diffusion model, thereby significantly accelerating the inference process. Then, a flow matching diffusion model with additional segmentation supervision is used to generate multiple prediction results. The diffusion path of flow matching is a straight line in the latent space, which enables flow matching to achieve good inference results with fewer inference steps. Moreover, the additional segmentation supervision added in the present invention can significantly improve the segmentation effect, significantly improving the quality of the inference results while increasing the inference speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0090] Figure 1 It is a block diagram of an uncertainty medical image segmentation system based on a priori guided diffusion model of the present invention;

[0091] Figure 2 It is the workflow diagram of the prior guidance module M1;

[0092] Figure 3 It is a schematic diagram of the training process of the flow matching diffusion module M2. DETAILED DESCRIPTION

[0093] Specific implementation method 1: Combination Figure 1 This embodiment describes an uncertain medical image segmentation system based on a priori-guided diffusion model. The system includes a medical image acquisition module, a medical image processing module, and a priori-guided diffusion model M. The priori-guided diffusion model M includes a priori-guided module M1 and a flow matching diffusion module M2.

[0094] The medical image acquisition module is used to acquire the diseased medical image to be segmented;

[0095] The medical image processing module is used to process the diseased medical image to be segmented to obtain the processed diseased medical image to be segmented;

[0096] The input of the diffusion model M based on prior guidance is the processed diseased medical image to be segmented, and the output of the diffusion model M based on prior guidance is the segmentation result of the diseased medical image to be segmented;

[0097] In the diffusion model M based on prior guidance, the input processed diseased medical image to be segmented first passes through the prior guidance module M1, and then the output of the prior guidance module M1 and the processed diseased medical image to be segmented are used as the input of the flow matching diffusion module M2, and the output of the flow matching diffusion module M2 is used as the output of the prior guided diffusion model M.

[0098] Specific embodiment 2: This embodiment differs from specific embodiment 1 in that the working process of the medical image processing module is as follows:

[0099] Step S11, performing denoising processing on the diseased medical image to be segmented to obtain the denoised diseased medical image to be segmented;

[0100] Step S12: cropping the denoised diseased medical image to be segmented, that is, cropping an N×N image centered on the lesion area from the denoised diseased medical image to be segmented;

[0101] Step S13: normalize the pixel values ​​in the cropped image to obtain a standardized image, which is the processed diseased medical image to be segmented.

[0102] Other steps and parameters are the same as those in the first embodiment.

[0103] During the training process, the diseased medical image samples in the training set are also processed using the method of this embodiment, and the labels of the diseased medical image samples also need to be cropped.

[0104] Specific implementation method three: Combination Figure 2 This embodiment differs from the first or second embodiment in that the a priori guidance module M1 includes an encoder, a decoder, a first convolutional layer, and a second convolutional layer; the working process of the a priori guidance module M1 is as follows:

[0105] Step S21: using the processed diseased medical image to be segmented as input to the encoder, and using the output of the encoder as input to the decoder;

[0106] σ=f θ (X)

[0107] Among them, X is the input processed medical image to be segmented, f θ (·) is the encoder-decoder structure in the prior guidance module M1, σ is the output of the decoder;

[0108] Step S22: using the output of the decoder as the input of the first convolutional layer and the second convolutional layer respectively;

[0109] μ=conv1(σ)

[0110] Σ=conv2(σ)

[0111] Where conv1(·) represents the first convolutional layer, μ represents the output of the first convolutional layer, conv2(·) represents the second convolutional layer, and Σ represents the output of the second convolutional layer.

[0112] Then model the intermediate Gaussian distribution X0~N(μ,Σ) with μ as mean and Σ as variance, where N(μ,Σ) is the output of the prior guidance module M1.

[0113] Other steps and parameters are the same as those in the first or second embodiment.

[0114] The encoder in the a priori guidance module M1 is the encoder used by the U-Net segmentation network, and the decoder in the a priori guidance module M1 is the first several layers of the decoder used by the U-Net segmentation network. For example, for a U-Net segmentation network with four encoding units (also called downsampling units) in the encoder and four decoding units (also called upsampling units) in the decoder, the encoder in the a priori guidance module M1 is the entire structure of the encoder in the U-Net segmentation network, and the decoder in the a priori guidance module M1 only includes the first several decoding units in the decoder in the U-Net segmentation network, that is, the decoder in the a priori guidance module M1 includes the first one to three decoding units.

[0115] Specific implementation method four: Combination Figure 3 This embodiment differs from any one of the first to third embodiments in that the flow matching and diffusion module M2 includes T U-Net segmentation networks connected in series. The working process of the flow matching and diffusion module M2 is as follows:

[0116] Sampling the intermediate Gaussian distribution X0 obtains a sampling result x0, and concatenating the diseased medical image to be segmented and the sampling result x0 to obtain a concatenated result x' 0,1 The connection method here is similar to the process of connecting two-dimensional image slices to obtain a three-dimensional image. The connection process of the diseased medical image to be segmented and the sampling result x0 is similar to the connection process of adjacent two-dimensional image slices. The connection result x' 0,1 As the input of the first U-Net segmentation network, the connection result x′ of the first U-Net segmentation network is used 0,1 Perform the distribution transformation of the first time step and use the output of the first U-Net segmentation network as the distribution transformation result g of the first time step o,1 (x′ 0,1 );

[0117] The sampling method in the present invention is random sampling. In order to obtain the best segmentation result, multiple sampling results can be obtained by sampling, and then the segmentation results corresponding to each sampling result are obtained respectively, and then the segmentation results are screened;

[0118] Then the diseased medical image to be segmented and g 0,1 (x′ 0,1 )Connect to get the connection result x' 0,2 , the concatenated result x' 0,2 As the input of the second U-Net segmentation network, the connection result x′ is connected using the second U-Net segmentation network 0,2 Perform the distribution transformation of the second time step to obtain the distribution transformation result g of the second time step 0,2 (x' 0,2 ), and so on, the distribution transformation result g of the diseased medical image to be segmented and the T-1 time step 0,T-1 (x' 0,T-1 )Connect to get the connection result x' 0,T , use the Tth U-Net segmentation network to connect the result x' 0,T Perform the distribution transformation of the T-th time step to obtain the distribution transformation result g of the T-th time step 0,T (x′ 0,T );

[0119] After the distribution transformation of T time steps in the flow matching diffusion module M2, the distribution transformation result g of the T time step is converted to 0,T (x′ 0,T ) as the image segmentation result corresponding to the sampling result x0

[0120] Similarly, the intermediate Gaussian distribution X0 is sampled multiple times to obtain multiple sampling results, and then the image segmentation results corresponding to each sampling result are obtained respectively. The image segmentation results corresponding to all the sampling results are the segmentation results of the diseased medical image to be segmented.

[0121] The other steps and parameters are the same as those in the first to third embodiments.

[0122] Specific embodiment 5: This embodiment differs from any one of specific embodiments 1 to 4 in that the loss function L1 used in the training process of the prior guidance module M1 is:

[0123]

[0124] Where Y represents the training sample of diseased medical images; Y0 represents the intermediate distribution of the output after Y passes through the prior guidance module M1; are the 0th, 1st, ..., nth segmentation labels of sample Y respectively; P(Y0|Y) represents the probability likelihood of the intermediate distribution Y0 under the condition of sample Y; Indicates that the labels are split based on the middle distribution Y0. The probability likelihood of .

[0125] The other steps and parameters are the same as those in the first to fourth embodiments.

[0126] The present invention uses the Monte Carlo sampling method to estimate and calculate the loss function L1.

[0127] Specific embodiment six: This embodiment differs from any one of specific embodiments one to five in that, when training the flow matching diffusion module M2, the parameters of the priori guidance module M1 are first frozen, and then the flow matching diffusion module M2 is trained based on the output of the priori guidance module M1.

[0128] The other steps and parameters are the same as those in the first to fifth embodiments.

[0129] Specific embodiment 7: This embodiment differs from any one of specific embodiments 1 to 6 in that the loss function L2 used in the training of the flow matching diffusion module M2 is:

[0130] L2=MSE+λ×Dice_Loss

[0131] Among them, MSE is the mean square error loss, Dice_Loss is the Dice loss, and λ represents a hyperparameter (which can be set according to actual conditions).

[0132] The other steps and parameters are the same as those in the first to sixth embodiments.

[0133] Specific embodiment eight: This embodiment differs from any one of specific embodiments one to seven in that the mean square error loss MSE is calculated as follows:

[0134] For the i-th sampling result y of the intermediate distribution Y0 i , i = 0, 1, ..., n, the true value of the distribution transformation of each time step in the flow matching diffusion module M2 is recorded as f′ i,t Based on the theory that the diffusion paths in the flow matching model are all straight lines, we can get:

[0135]

[0136] Where t = 1, 2, ..., T, f′ i,t Indicates that the sampling result y i The true value of the distribution transformation at the tth time step after the input stream matches the diffusion module M2;

[0137] According to f′i , t gets the mean square error loss MSE:

[0138]

[0139] Among them, ||·|| represents the 2-norm, g i,t Indicates that the i-th sampling result y i The distribution transformation result of the t-th U-Net segmentation network after the input stream is matched with the diffusion module M2;

[0140] The mean square error loss MSE is used to supervise the distribution transformation of the flow matching diffusion module M2;

[0141] The Dice loss is calculated as follows:

[0142]

[0143] in, Indicates the calculation of the intermediate segmentation prediction result Y at the tth time step i,1t and Dice loss;

[0144] Y i,1t =f i,t +g i,t (f i,t +Y)*(Tt)

[0145]

[0146] Among them, “*” means multiplication, f i,t +Y represents f i,t Connected with the diseased medical image training sample Y.

[0147] The other steps and parameters are the same as those in the first to seventh embodiments.

[0148] The present invention uses the loss function L2 to train the flow matching diffusion module M2, that is, to train each U-Net segmentation network in the flow matching diffusion module M2 based on the true value of the distribution transformation at each time step. During the training process, each step is to convert f i,t Connect with the image, use the connection result as the input of the U-Net segmentation network, and calculate the loss of the training process based on the output of the U-Net segmentation network. In the actual segmentation process, f is no longer needed i,tParticipate in the prediction, after sampling the intermediate distribution Y0 output by the prior guidance module M1, directly connect the sampling result with the image to be segmented, and then use the first U-Net segmentation network to perform the distribution transformation of the connection result at the first time step; then connect the distribution transformation result of the first time step with the image to be segmented, and then use the second U-Net segmentation network to perform the distribution transformation of the connection result at the second time step, and so on, and use the final distribution transformation result of the Tth U-Net segmentation network as the segmentation result corresponding to the current sampling.

[0149] Specific embodiment 9: The uncertain medical image segmentation method based on the prior guided diffusion model described in this embodiment specifically includes the following steps:

[0150] Step S1: Processing the diseased medical image to be segmented to obtain a processed diseased medical image to be segmented;

[0151] The specific process of step S1 is:

[0152] Step S11, performing denoising processing on the diseased medical image to be segmented to obtain the denoised diseased medical image to be segmented;

[0153] Step S12: cropping the denoised diseased medical image to be segmented, that is, cropping an N×N image centered on the lesion area from the denoised diseased medical image to be segmented;

[0154] Step S13: normalizing the pixel values ​​in the cropped image to obtain a standardized image, which is the processed diseased medical image to be segmented;

[0155] Step S2: inputting the processed diseased medical image to be segmented into a diffusion model M based on prior guidance, wherein the diffusion model M based on prior guidance includes a priori guidance module M1 and a flow matching diffusion module M2; outputting a segmentation result of the diseased medical image to be segmented through the diffusion model M based on prior guidance;

[0156] The a priori guidance module M1 includes an encoder, a decoder, a first convolutional layer, and a second convolutional layer. The working process of the a priori guidance module M1 is as follows:

[0157] Step S21: using the processed diseased medical image to be segmented as input to the encoder, and using the output of the encoder as input to the decoder;

[0158] σ=f θ (X)

[0159] Among them, X is the input processed medical image to be segmented, f θ(·) is the encoder-decoder structure in the prior guidance module M1, σ is the output of the decoder;

[0160] Step S22: using the output of the decoder as the input of the first convolutional layer and the second convolutional layer respectively;

[0161] μ=conv1(σ)

[0162] Σ=conv2(σ)

[0163] Where conv1(·) represents the first convolutional layer, μ represents the output of the first convolutional layer, conv2(·) represents the second convolutional layer, and Σ represents the output of the second convolutional layer.

[0164] Then model the intermediate Gaussian distribution X0~N(μ,Σ) with μ as mean and Σ as variance, where N(μ,Σ) is the output of the prior guidance module M1;

[0165] The flow matching diffusion module M2 includes T U-Net segmentation networks connected in series. The working process of the flow matching diffusion module M2 is as follows:

[0166] Sampling the intermediate Gaussian distribution X0 obtains a sampling result x0, and connecting the diseased medical image to be segmented and the sampling result x0 to obtain a connection result x' 0,1 , the concatenated result x' 0,1 As the input of the first U-Net segmentation network, the connection result x′ of the first U-Net segmentation network is used 0,1 Perform the distribution transformation of the first time step and use the output of the first U-Net segmentation network as the distribution transformation result g of the first time step 0,1 (x′ 0,1 );

[0167] The sampling method in the present invention is random sampling. In order to obtain the best segmentation result, multiple sampling results can be obtained by sampling, and then the segmentation results corresponding to each sampling result are obtained respectively, and then the segmentation results are screened;

[0168] Then the diseased medical image to be segmented and g o,1 (x′ 0,1 ) Connect to get the connection result x′ 0,2 , connect the result x′ 0,2 As the input of the second U-Net segmentation network, the connection result x′ is connected using the second U-Net segmentation network 0,2 Perform the distribution transformation of the second time step to obtain the distribution transformation result g of the second time step 0,2 (x' 0,2 ), and so on, the distribution transformation result g of the diseased medical image to be segmented and the T-1 time step0,T-1 (x' 0,T-1 ) Connect to get the connection result x′ 0,T , use the Tth U-Net segmentation network to connect the result x' 0,T Perform the distribution transformation of the T-th time step to obtain the distribution transformation result g of the T-th time step 0,T (x′0, T );

[0169] After the distribution transformation of T time steps in the flow matching diffusion module M2, the distribution transformation result g of the T time step is converted to 0,T (x′ 0,T ) as the image segmentation result corresponding to the sampling result x0

[0170] Similarly, the intermediate Gaussian distribution X0 is sampled multiple times to obtain multiple sampling results, and then the image segmentation results corresponding to each sampling result are obtained respectively. The image segmentation results corresponding to all the sampling results are the segmentation results of the diseased medical image to be segmented.

[0171] Specific embodiment ten: This embodiment differs from specific embodiment nine in that the loss function L1 used in the training process of the prior guidance module M1 is:

[0172]

[0173] Where Y represents the training sample of diseased medical images; Y0 represents the intermediate distribution of the output after Y passes through the prior guidance module M1; are the 0th, 1st, ..., nth segmentation labels of sample Y respectively; P(Y0|Y) represents the probability likelihood of the intermediate distribution Y0 under the condition of sample Y; Indicates that the labels are split based on the middle distribution Y0. The probability likelihood of ;

[0174] When training the flow matching diffusion module M2, the parameters of the prior guidance module M1 are first frozen, and then the flow matching diffusion module M2 is trained based on the output of the prior guidance module M1. The loss function L2 used when training the flow matching diffusion module M2 is:

[0175] L2=MSE+λ×Dice_Loss

[0176] Among them, MSE is the mean square error loss, Dice_Loss is the Dice loss, and λ represents a hyperparameter (which can be set according to actual conditions);

[0177] The calculation method of mean square error loss MSE is:

[0178] For the i-th sampling result y of the intermediate distribution Y0i , i = 0, 1, ..., n, the true value of the distribution transformation of each time step in the flow matching diffusion module M2 is recorded as f′ i,t Based on the theory that the diffusion paths in the flow matching model are all straight lines, we can get:

[0179]

[0180] Where t = 1, 2, ..., T, f′ i,t Indicates that the sampling result y i The true value of the distribution transformation at the tth time step after the input stream matches the diffusion module M2;

[0181] According to f′ i , t gets the mean square error loss MSE:

[0182]

[0183] Among them, ||·|| represents the 2-norm, g i,t Indicates that the i-th sampling result y i The distribution transformation result of the t-th U-Net segmentation network after the input stream is matched with the diffusion module M2;

[0184] The calculation method of Dice loss is:

[0185]

[0186] in, Indicates the calculation of the intermediate segmentation prediction result Y at the tth time step i,1t and Dice loss;

[0187] Y i,1t =f i,t +g i,t (f i,t +Y)*(Tt)

[0188]

[0189] Among them, “*” means multiplication, f i,t +Y represents f i,t Connected with the diseased medical image training sample Y.

[0190] Other steps and parameters are the same as those in the ninth embodiment.

[0191] The above examples are merely illustrative of the calculation model and process of the present invention and are not intended to limit the embodiments of the present invention. Persons skilled in the art will readily appreciate that other variations or modifications based on the above description are possible. This list of embodiments is not exhaustive; however, any obvious variations or modifications derived from the technical solution of the present invention remain within the scope of protection of the present invention.

Claims

1. An uncertain medical image segmentation system based on a priori guided diffusion model, characterized by: The system includes a medical image acquisition module, a medical image processing module, and a diffusion model M based on prior guidance, and the diffusion model M based on prior guidance includes a prior guidance module M1 and a flow matching diffusion module M2; wherein: The medical image acquisition module is used to acquire the diseased medical image to be segmented; The medical image processing module is used to process the diseased medical image to be segmented to obtain the processed diseased medical image to be segmented; The input of the diffusion model M based on prior guidance is the processed diseased medical image to be segmented, and the output of the diffusion model M based on prior guidance is the segmentation result of the diseased medical image to be segmented; In the diffusion model M based on prior guidance, the input processed diseased medical image to be segmented first passes through the prior guidance module M1, and then the output of the prior guidance module M1 and the processed diseased medical image to be segmented are used as the input of the flow matching diffusion module M2, and the output of the flow matching diffusion module M2 is used as the output of the prior guided diffusion model M; The a priori guidance module M1 includes an encoder, a decoder, a first convolutional layer, and a second convolutional layer. The working process of the a priori guidance module M1 is as follows: Step S21: using the processed diseased medical image to be segmented as input to the encoder, and using the output of the encoder as input to the decoder; σ=f θ (X) Among them, X is the input processed medical image to be segmented, f θ (·) is the encoder-decoder structure in the prior guidance module M1, σ is the output of the decoder; Step S22: using the output of the decoder as the input of the first convolutional layer and the second convolutional layer respectively; μ=conv1(σ) ∑=conv2(σ) Where conv1(·) represents the first convolutional layer, μ represents the output of the first convolutional layer, conv2(·) represents the second convolutional layer, and Σ represents the output of the second convolutional layer. Then model the intermediate Gaussian distribution X0~N(μ,∑) with μ as mean and ∑ as variance, where N(μ,∑) is the output of the prior guidance module M1; The flow matching diffusion module M2 includes T U-Net segmentation networks connected in series. The working process of the flow matching diffusion module M2 is as follows: Sampling the intermediate Gaussian distribution X0 obtains a sampling result x0, and connecting the diseased medical image to be segmented and the sampling result x0 to obtain a connection result x′ 0,1 , the connection result x′ 0,1 As the input of the first U-Net segmentation network, the connection result x′ of the first U-Net segmentation network is used 0,1 Perform the distribution transformation of the first time step and use the output of the first U-Net segmentation network as the distribution transformation result g of the first time step 0,1 (x′ 0,1 ); Then the diseased medical image to be segmented and g 0,1 (x′ 0,1 ) Connect to get the connection result x′ 0,2 , the connection result x′ 0,2 As the input of the second U-Net segmentation network, the connection result x′ is connected using the second U-Net segmentation network 0,2 Perform the distribution transformation of the second time step to obtain the distribution transformation result g of the second time step 0,2 (x′ 0,2 ), and so on, the distribution transformation result g of the diseased medical image to be segmented and the T-1 time step 0,T-1 (x′ 0,T-1 ) Connect to get the connection result x′ 0,T , use the T-th U-Net segmentation network to connect the result x′ 0,T Perform the distribution transformation of the T-th time step to obtain the distribution transformation result g of the T-th time step 0,T (x′ 0,T ); Transform the distribution of the T-th time step g 0,T (x′ 0,T ) as the image segmentation result corresponding to the sampling result x0 Similarly, the intermediate Gaussian distribution X0 is sampled multiple times to obtain multiple sampling results, and then the image segmentation results corresponding to each sampling result are obtained respectively. The image segmentation results corresponding to all the sampling results are the segmentation results of the diseased medical image to be segmented.

2. The uncertainty medical image segmentation system based on the prior guided diffusion model according to claim 1, characterized in that: The working process of the medical image processing module is as follows: Step S11, performing denoising processing on the diseased medical image to be segmented to obtain the denoised diseased medical image to be segmented; Step S12: cropping the denoised diseased medical image to be segmented, that is, cropping an N×N image centered on the lesion area from the denoised diseased medical image to be segmented; Step S13: normalize the pixel values ​​in the cropped image to obtain a standardized image, which is the processed diseased medical image to be segmented.

3. The uncertainty medical image segmentation system based on the prior guided diffusion model according to claim 2, characterized in that: The loss function L1 used in the training process of the prior guidance module M1 is: Where Y represents the training sample of diseased medical images; Y0 represents the intermediate distribution of the output after Y passes through the prior guidance module M1; are the 0th, 1st, ..., nth segmentation labels of sample Y respectively; P(Y0|Y) represents the probability likelihood of the intermediate distribution Y0 under the condition of sample Y; Indicates that the labels are split based on the middle distribution Y0. The probability likelihood of .

4. The uncertainty medical image segmentation system based on the prior guided diffusion model according to claim 3, characterized in that: When the flow matching diffusion module M2 is trained, the parameters of the priori guidance module M1 are first frozen, and then the flow matching diffusion module M2 is trained based on the output of the priori guidance module M1.

5. The uncertainty medical image segmentation system based on the prior guided diffusion model according to claim 4, characterized in that: The loss function L2 used in the training of the flow matching diffusion module M2 is: L2=MSE+λ×Dice_Loss Among them, MSE is the mean square error loss, Dice_Loss is the Dice loss, and λ represents the hyperparameter.

6. The uncertain medical image segmentation system based on the prior guided diffusion model according to claim 5, characterized in that: The calculation method of the mean square error loss MSE is: For the i-th sampling result y of the intermediate distribution Y0 i , i = 0, 1, ..., n, the true value of the distribution transformation of each time step in the flow matching diffusion module M2 is recorded as f′ i,t ; Where t = 1, 2, …, T, f′ i,t Indicates that the sampling result y i The true value of the distribution transformation at the tth time step after the input stream matches the diffusion module M2; According to f′ i,t Get the mean square error loss MSE: Among them, ||·|| represents the 2-norm, g i,t Indicates that the i-th sampling result y i The distribution transformation result of the t-th U-Net segmentation network after the input stream is matched with the diffusion module M2; The Dice loss is calculated as follows: in, Indicates the calculation of the intermediate segmentation prediction result Y at the tth time step i,1t and Dice loss; Y i,1t =f i,t +g i,t (f i,t +Y)*(T-t) Among them, "*" means multiplication, f i,t +Y represents f i,t Connected with the diseased medical image training sample Y.

7. An uncertain medical image segmentation method based on a priori guided diffusion model, characterized in that: The method specifically comprises the following steps: Step S1: Processing the diseased medical image to be segmented to obtain a processed diseased medical image to be segmented; The specific process of step S1 is: Step S11, performing denoising processing on the diseased medical image to be segmented to obtain the denoised diseased medical image to be segmented; Step S12: cropping the denoised diseased medical image to be segmented, that is, cropping an N×N image centered on the lesion area from the denoised diseased medical image to be segmented; Step S13: normalizing the pixel values ​​in the cropped image to obtain a standardized image, which is the processed diseased medical image to be segmented; Step S2: inputting the processed diseased medical image to be segmented into a diffusion model M based on prior guidance, wherein the diffusion model M based on prior guidance includes a priori guidance module M1 and a flow matching diffusion module M2; outputting a segmentation result of the diseased medical image to be segmented through the diffusion model M based on prior guidance; The a priori guidance module M1 includes an encoder, a decoder, a first convolutional layer, and a second convolutional layer. The working process of the a priori guidance module M1 is as follows: Step S21: using the processed diseased medical image to be segmented as input to the encoder, and using the output of the encoder as input to the decoder; σ=f θ (X) Among them, X is the input processed medical image to be segmented, f θ (·) is the encoder-decoder structure in the prior guidance module M1, σ is the output of the decoder; Step S22: using the output of the decoder as the input of the first convolutional layer and the second convolutional layer respectively; μ=conv1(σ) ∑=conv2(σ) Where conv1(·) represents the first convolutional layer, μ represents the output of the first convolutional layer, conv2(·) represents the second convolutional layer, and Σ represents the output of the second convolutional layer. Then model the intermediate Gaussian distribution X0~N(μ,∑) with μ as mean and ∑ as variance, where N(μ,∑) is the output of the prior guidance module M1; The flow matching diffusion module M2 includes T U-Net segmentation networks connected in series. The working process of the flow matching diffusion module M2 is as follows: Sampling the intermediate Gaussian distribution X0 obtains a sampling result x0, and connecting the diseased medical image to be segmented and the sampling result x0 to obtain a connection result x′ 0,1 , connect the result x′ 0,1 As the input of the first U-Net segmentation network, the connection result x′ of the first U-Net segmentation network is used 0,1 Perform the distribution transformation of the first time step and use the output of the first U-Net segmentation network as the distribution transformation result g of the first time step 0,1 (x′ 0,1 ); Then the diseased medical image to be segmented and g 0,1 (x′ 0,1 ) Connect to get the connection result x′ 0,2 , connect the result x′ 0,2 As the input of the second U-Net segmentation network, the connection result x′ is connected using the second U-Net segmentation network 0,2 Perform the distribution transformation of the second time step to obtain the distribution transformation result g of the second time step 0,2 (x′ 0,2 ), and so on, the distribution transformation result g of the diseased medical image to be segmented and the T-1 time step 0,T-1 (x′ 0,T-1 ) Connect to get the connection result x′ 0,T , use the T-th U-Net segmentation network to connect the result x′ 0,T Perform the distribution transformation of the T-th time step to obtain the distribution transformation result g of the T-th time step 0,T (x′ 0,T ); Transform the distribution of the T-th time step g 0,T (x′ 0,T ) as the image segmentation result corresponding to the sampling result x0 Similarly, the intermediate Gaussian distribution X0 is sampled multiple times to obtain multiple sampling results, and then the image segmentation results corresponding to each sampling result are obtained respectively. The image segmentation results corresponding to all the sampling results are the segmentation results of the diseased medical image to be segmented.

8. The uncertain medical image segmentation method based on a priori guided diffusion model according to claim 7, characterized in that: The loss function L1 used in the training process of the prior guidance module M1 is: Where Y represents the training sample of diseased medical images; Y0 represents the intermediate distribution of the output after Y passes through the prior guidance module M1; are the 0th, 1st, ..., nth segmentation labels of sample Y respectively; P(Y0|Y) represents the probability likelihood of the intermediate distribution Y0 under the condition of sample Y; Indicates that the labels are split based on the middle distribution Y0. The probability likelihood of ; When training the flow matching diffusion module M2, the parameters of the prior guidance module M1 are first frozen, and then the flow matching diffusion module M2 is trained based on the output of the prior guidance module M1. The loss function L2 used when training the flow matching diffusion module M2 is: L2=MSE+λ×Dice_Loss Among them, MSE is the mean square error loss, Dice_Loss is the Dice loss, and λ represents the hyperparameter; The calculation method of mean square error loss MSE is: For the i-th sampling result y of the intermediate distribution Y0 i , i = 0, 1, ..., n, the true value of the distribution transformation of each time step in the flow matching diffusion module M2 is recorded as f′ i,t ; Where t = 1, 2, …, T, f′ i,t Indicates that the sampling result y i The true value of the distribution transformation at the tth time step after the input stream matches the diffusion module M2; According to f′ i,t Get the mean square error loss MSE: Among them, ||·|| represents the 2-norm, g i,t Indicates that the i-th sampling result y i The distribution transformation result of the t-th U-Net segmentation network after the input stream is matched with the diffusion module M2; The calculation method of Dice loss is: in, Indicates the calculation of the intermediate segmentation prediction result Y at the tth time step i,1t and Dice loss; Y i,1t =f i,t +g i,t (f i,t +Y)*(T-t) Among them, "*" means multiplication, f i,t +Y represents f i,t Connected with the diseased medical image training sample Y.

Citation Information

Patent Citations

  • Anti-difference medical image segmentation method based on multi-modal diffusion model

    CN118038052A

  • Monocular depth and optical flow estimation using diffusion models

    WO2024159082A2