Uncertain medical image segmentation system and method based on prior guide diffusion model

By introducing a priori guidance module and a flow-matching diffusion module into the diffusion model, the problem of slow inference process of the existing diffusion model is solved, efficient and high-quality results of medical image segmentation are achieved, and clinical promotion is promoted.

CN119887792AActive Publication Date: 2025-04-25HARBIN INST OF TECH

Patent Information

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

AI Technical Summary

Technical Problem

The existing diffusion model has slow in inference process in uncertain medical image segmentation, resulting in limited clinical promotion.

Method used

A diffusion model based on prior guidance is proposed. The intermediate Gaussian distribution is generated through the prior guidance module, and the flow matching diffusion module is used to generate multiple prediction results, reducing the number of inference steps and improving the segmentation effect.

Benefits of technology

It significantly accelerates the reasoning process of diffusion model, improves the quality and efficiency of medical image segmentation, and enhances the potential of clinical promotion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119887792A_ABST
    Figure CN119887792A_ABST
Patent Text Reader

Abstract

The invention discloses an uncertain medical image segmentation system and method based on a prior guide diffusion model, and belongs to the technical field of medical image segmentation. The problem that the reasoning process of an existing diffusion model is slow is solved. According to the method, the intermediate distribution closer to the target distribution is generated in the prior stage, and the intermediate distribution generated in the prior stage is shared in the subsequent reasoning process of all prediction results, so that the reasoning process of all prediction results starts from the same intermediate distribution, the redundant reasoning process is avoided, and the reasoning efficiency is improved. And the reasoning speed of the priori network in the priori stage is obviously faster than the reasoning process of the diffusion model, so that the acceleration of the reasoning process is greatly realized. And then, a flow matching diffusion model with additional segmentation supervision is used for generating multiple prediction results, and a diffusion path of flow matching is a straight line in a hidden space, so that the flow matching can achieve a good reasoning effect by using fewer reasoning 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 uncertain 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 often cannot effectively deal with fuzzy boundaries, artifacts, and subjective differences between different annotators in medical images, resulting in uncertainty in segmentation results. Therefore, in computer-aided diagnosis, it is usually necessary to give a series of reasonable segmentation predictions, combined with subsequent screening and other means to obtain high-confidence segmentation results. The diffusion model is at the forefront of the field of uncertain medical image segmentation, but when multiple segmentation prediction labels are generated, the high time cost limits the further clinical promotion of the existing diffusion model. Therefore, proposing a new diffusion model to accelerate the reasoning process of the diffusion model is an urgent problem 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 comprising a medical image acquisition module, a medical image processing module and a diffusion model M based on a priori guided, and the diffusion model M based on a priori guided comprises a priori guided module M1 and a flow matching diffusion module M2; wherein:

[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 image of size N×N centered on the lesion area from the denoised diseased medical image to be segmented;

[0013] Step S13, standardize the pixel values ​​in the cropped image to obtain a standardized image, and the standardized image 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 of the encoder, and using the output of the encoder as input of the decoder;

[0016] σ=f θ (X)

[0017] Among them, X is the input processed diseased medical image to be segmented, f θ (·) is the encoder-decoder structure in the prior guided 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, and the working process of the flow matching diffusion module M2 is:

[0024] The intermediate Gaussian distribution X0 is sampled to obtain a sampling result x0, and the diseased medical image to be segmented and the sampling result x0 are connected 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 );

[0025] Then the diseased medical image to be segmented and g 0,1 (x′ 0,1 ) 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 and 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-1th time step 0,T-1 (x′ 0,T-1 ) 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 Tth time step and obtain the distribution transformation result g of the Tth time step 0,T (x′0, T );

[0026] Transform the distribution of the Tth 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] Among them, 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 conditioned on 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 when the flow matching diffusion module M2 is trained 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 calculation method of the mean square error loss MSE is:

[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 calculation method of the Dice loss is:

[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 means f i,t Connected with diseased medical image training sample Y.

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

[0049] Step S1, processing the diseased medical image to be segmented to obtain the 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 image of size N×N centered on the lesion area from the denoised diseased medical image to be segmented;

[0053] Step S13, performing standardization processing on the pixel values ​​in the cropped image to obtain a standardized image, where the standardized image is the processed diseased medical image to be segmented;

[0054] Step S2, inputting the processed diseased medical image to be segmented into the diffusion model M based on prior guidance, wherein the diffusion model M based on prior guidance includes a prior guidance module M1 and a flow matching diffusion module M2; outputting the 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 of the encoder, and using the output of the encoder as input of the decoder;

[0057] σ=f θ (X)

[0058] Among them, X is the input processed diseased medical image to be segmented, f θ (·) is the encoder-decoder structure in the prior guided 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] The intermediate Gaussian distribution X0 is sampled to obtain a sampling result x0, and the diseased medical image to be segmented and the sampling result x0 are connected 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 );

[0066] Then the diseased medical image to be segmented and g 0,1 (x′ 0,1 ) 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 and 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-1th time step 0,T-1 (x′ 0,T-1 ) 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 Tth time step and obtain the distribution transformation result g of the Tth time step 0,T (x′ 0,T );

[0067] Transform the distribution of the Tth 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] Among them, 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 conditioned on sample Y; Indicates that the labels are split based on the middle distribution Y0. The probability likelihood of ;

[0072] When the flow matching diffusion module M2 is trained, 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 the flow matching diffusion module M2 is trained 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 means f i,t Connected with 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, and then shares the intermediate distribution generated in the prior stage in the reasoning process of all prediction results. The present invention enables the reasoning process of all prediction results to start from the same intermediate distribution, which not only avoids redundant reasoning processes, but also the reasoning speed of the prior network in the prior stage is significantly faster than the reasoning process of the diffusion model, thereby greatly accelerating the reasoning 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 reasoning effects with fewer reasoning steps, and the additional segmentation supervision added in the present invention can significantly improve the segmentation effect, and while improving the reasoning speed, it also significantly improves the quality of the reasoning results. 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 a priori 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 The present embodiment is described in the present embodiment. The uncertain medical image segmentation system based on the prior guided diffusion model includes a medical image acquisition module, a medical image processing module and a diffusion model M based on prior guided, and the diffusion model M based on prior guided includes a prior guided module M1 and a flow matching diffusion module M2; wherein:

[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 implementation method 2: This implementation method is different from the specific implementation method 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 image of size N×N centered on the lesion area from the denoised diseased medical image to be segmented;

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

[0102] The 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 is different 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:

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

[0106] σ=f θ (X)

[0107] Among them, X is the input processed diseased medical image to be segmented, f θ (·) is the encoder-decoder structure in the prior guided 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] The other steps and parameters are the same as those in the first or second embodiment.

[0114] The encoder in the prior guidance module M1 is the encoder used by the U-Net segmentation network, and the decoder in the prior 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 including 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 prior guidance module M1 is the entire structure of the encoder in the U-Net segmentation network, and the decoder in the prior 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 prior guidance module M1 includes the first one to three decoding units.

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

[0116] The intermediate Gaussian distribution X0 is sampled to obtain a sampling result x0, and the diseased medical image to be segmented and the sampling result x0 are concatenated 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. 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 ) 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 and 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-1th time step 0,T-1 (x' 0,T-1 ) 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 Tth time step and obtain the distribution transformation result g of the Tth 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 Tth time step is 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 Specific Embodiments 1 to 3.

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

[0123]

[0124] Among them, 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 conditioned on 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 Specific Embodiments 1 to 4.

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

[0127] Specific implementation example 6: This implementation example is different from any one of specific implementation examples 1 to 5 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 Specific Implementation Methods 1 to 5.

[0129] Specific implementation example 7: This implementation example is different from any one of specific implementation examples 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 Specific Embodiments 1 to 6.

[0133] Specific implementation eight: This implementation differs from any one of specific implementations 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 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 calculation method of the Dice loss is:

[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 means f i,t Connected with diseased medical image training sample Y.

[0147] The other steps and parameters are the same as those in Specific Embodiments 1 to 7.

[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 implementation method 9: The uncertain medical image segmentation method based on the prior guided diffusion model described in this implementation method specifically includes the following steps:

[0150] Step S1, processing the diseased medical image to be segmented to obtain the 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 image of size N×N centered on the lesion area from the denoised diseased medical image to be segmented;

[0154] Step S13, performing standardization processing on the pixel values ​​in the cropped image to obtain a standardized image, where the standardized image is the processed diseased medical image to be segmented;

[0155] Step S2, inputting the processed diseased medical image to be segmented into the diffusion model M based on prior guidance, wherein the diffusion model M based on prior guidance includes a prior guidance module M1 and a flow matching diffusion module M2; outputting the 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 of the encoder, and using the output of the encoder as input of the decoder;

[0158] σ=f θ (X)

[0159] Among them, X is the input processed diseased medical image to be segmented, f θ(·) is the encoder-decoder structure in the prior guided 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] The intermediate Gaussian distribution X0 is sampled to obtain a sampling result x0, and the diseased medical image to be segmented and the sampling result x0 are connected 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 );

[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 ) 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 and 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-1th time step0,T-1 (x' 0,T-1 ) 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 Tth time step and obtain the distribution transformation result g of the Tth 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 Tth time step is 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 implementation example ten: This implementation example is different from specific implementation example nine in that the loss function L1 used in the training process of the priori guidance module M1 is:

[0172]

[0173] Among them, 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 conditioned on sample Y; Indicates that the labels are split based on the middle distribution Y0. The probability likelihood of ;

[0174] When the flow matching diffusion module M2 is trained, 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 the flow matching diffusion module M2 is trained 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 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 means f i,t Connected with diseased medical image training sample Y.

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

[0191] The above calculation examples of the present invention are only used to explain the calculation model and calculation process of the present invention in detail, and are not intended to limit the implementation methods of the present invention. For ordinary technicians in the relevant field, other different forms of changes or modifications can be made based on the above description. It is impossible to list all the implementation methods here. All obvious changes or modifications derived from the technical solution of the present invention are still 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 in that: 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.

2. The uncertain 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 image of size N×N centered on the lesion area from the denoised diseased medical image to be segmented; Step S13, standardize the pixel values ​​in the cropped image to obtain a standardized image, and the standardized image is the processed diseased medical image to be segmented.

3. The uncertain medical image segmentation system based on a priori guided diffusion model according to claim 2, characterized 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: Step S21, using the processed diseased medical image to be segmented as input of the encoder, and using the output of the encoder as input of 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 guided 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.

4. The uncertain medical image segmentation system based on a priori guided diffusion model according to claim 3, characterized in that: 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: The intermediate Gaussian distribution X0 is sampled to obtain a sampling result x0, and the diseased medical image to be segmented and the sampling result x0 are connected 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 ) 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 and 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-1th time step 0,T-1 (x' 0,T-1 ) 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 Tth time step and obtain the distribution transformation result g of the Tth time step 0,T (x' 0,T ); Transform the distribution of the Tth 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.

5. The uncertain medical image segmentation system based on a priori guided diffusion model according to claim 4, characterized in that: The loss function L1 used in the training process of the prior guidance module M1 is: Among them, 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 .

6. The uncertain medical image segmentation system based on a priori guided diffusion model according to claim 5, 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.

7. The uncertain medical image segmentation system based on a priori guided diffusion model according to claim 6, characterized in that: The loss function L2 used when the flow matching diffusion module M2 is trained is: L2=MSE+λ×Dice_Loss Among them, MSE is the mean square error loss, Dice_Loss is the Dice loss, and λ represents the hyperparameter.

8. The uncertain medical image segmentation system based on a priori guided diffusion model according to claim 7, 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 calculation method of the 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 means f i,t Connected with diseased medical image training sample Y.

9. 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 the 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 image of size N×N centered on the lesion area from the denoised diseased medical image to be segmented; Step S13, performing standardization processing on the pixel values ​​in the cropped image to obtain a standardized image, where the standardized image is the processed diseased medical image to be segmented; Step S2, inputting the processed diseased medical image to be segmented into the diffusion model M based on prior guidance, wherein the diffusion model M based on prior guidance includes a prior guidance module M1 and a flow matching diffusion module M2; outputting the 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 of the encoder, and using the output of the encoder as input of 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 guided 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 middle 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 ) 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 and 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-1th time step 0,T-1 (x′ 0,T-1 ) 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 Tth time step and obtain the distribution transformation result g of the Tth time step 0,T (x' 0,T ); Transform the distribution of the Tth 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.

10. The uncertain medical image segmentation method based on a priori guided diffusion model according to claim 9, characterized in that: The loss function L1 used in the training process of the prior guidance module M1 is: Among them, 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 the flow matching diffusion module M2 is trained, 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 the flow matching diffusion module M2 is trained 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 means f i,t Connected with diseased medical image training sample Y.

Citation Information

Patent Citations

  • Image segmentation method based on residual diffusion model

    CN116993770A

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

    CN118038052A

  • Radiotherapy dose prediction method based on prior guidance adversarial diffusion model

    CN118767343A

  • A generalist framework for panoptic segmentation of images and videos

    WO2024081778A1

  • Monocular depth and optical flow estimation using diffusion models

    WO2024159082A2

Cited By

  • Lightning potential and proximity forecasting method based on diffusion model

    CN120873785A

  • Medical image segmentation method and system based on prior guidance residual diffusion

    CN121564351A