A lung CT image reconstruction method based on dual-channel denoising diffusion probability model
By adopting a dual-channel denoising diffusion probability model and dynamic negative square noise addition strategy in lung CT imaging reconstruction, the problem of image quality decline after reducing radiation dose is solved, and high-quality lung CT imaging reconstruction is achieved.
Patent Information
- Application Number
- CN202311582960.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-24
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2043-11-24
AI Technical Summary
The existing lung CT imaging reconstruction model is difficult to maintain image quality while reducing radiation dose, resulting in many artifacts and unclear details, affecting the accurate display of lesions.
Using the lung CT image reconstruction method based on the dual-channel denoising diffusion probability model (DC-DDPM), the joint loss function is constructed to optimize network parameters by improving the Unet network and designing a dynamic negative square noise addition strategy.
It realizes that while reducing radiation dose, maintain or improve image quality, reduce artifacts, enhance image details and contrast, and improve clear display of lesions.
Smart Images

Figure CN117437319B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of medical image processing and deep learning, and in particular to a lung CT image reconstruction method based on a dual-channel denoising diffusion probability model. Background Art
[0002] Computed tomography (CT) technology is widely used in clinical practice to screen lung lesions such as lung nodules. Despite this, only 15% of lung cancer cases are diagnosed at an early stage. In order to reduce the radiation hazards of CT scans to the human body, reducing radiation dose has become an urgent need, but this also brings new challenges: reduced dose will cause a lot of artifact noise, lower brightness and lower contrast in the image, so it is impossible to accurately present the detailed structure of lung lesions, affecting the clear display of lung lesions.
[0003] To overcome this challenge, researchers have actively explored the application of artificial intelligence in the field of CT reconstruction in recent years. For example, Fujita et al. demonstrated that the diagnostic ability of fully iteratively reconstructed ultra-low-dose CT in lung cancer screening is comparable to that of low-dose CT, which shows that CT reconstruction technology has practical feasibility; Ye et al. evaluated the clinical value of ultra-low-dose CT and adaptive statistical iterative reconstruction-V technology in lung nodule detection, and the results showed that lung nodule screening can be performed at a low radiation dose of about 10%, but it can only detect lung nodules with a diameter greater than 6 mm; Yang et al. proposed a generative adversarial network (GAN) based on Wasserstein distance and perceptual similarity loss function, which transfers visual perception knowledge to image denoising tasks, and can reduce lung CT noise while retaining more key information. However, there are some inherent problems with GAN-based models, such as easy mode collapse, and additional isolated artifacts may appear in lung CT reconstruction, which increases the risk of misdiagnosis. Summary of the invention
[0004] In order to overcome the technical defect that the existing lung CT image reconstruction model retains too much useless information such as artifacts, the present invention provides a lung CT image reconstruction method based on a dual-channel denoising diffusion probability model to achieve the effect of reducing radiation dose without affecting image quality.
[0005] The present invention provides a lung CT image reconstruction method based on a dual-channel denoising diffusion probability model, comprising the following steps:
[0006] Step S1: construct a dual-channel denoising diffusion probability model (DC-DDPM model), and its sub-steps are:
[0007] Step S1-1, constructing a data set: converting the lung CT image file in ima format into a single-channel png file with a resolution of 224×224, and filtering invalid data to provide high-quality training data;
[0008] Step S1-2, improving the Unet network in the original DDPM model: applying the Sobel convolution operator to high-pass filtering, connecting the high-frequency image and the original image into a two-channel image as the input of the Unet network through the concat operation, and constructing an improved version of the Unet network;
[0009] Step S1-3: Design a dynamic negative square noise adding strategy to dynamically control the degree of noise introduction in different time steps, and its sub-steps are:
[0010] Step S1-3-1, calculate the strategy weight: The strategy weight is an intermediate parameter used to control the degree of noise introduction. t In the calculation formula, t represents the current noise adding time step, off represents the bias parameter, and T represents the total time step required for training the DDPM model. Then the strategy weight w t The calculation formula is as follows:
[0011]
[0012] In formula (1), a weight value in the range of [0, 1] is calculated based on the time step t and the bias parameter off, where w t Negatively correlated with t;
[0013] S1-3-2. Calculate the final noise intensity parameter: Use the strategy weight w t Calculate the final noise intensity parameter β t , where s h and l Represent the highest and lowest values of noise intensity respectively, and parameter β t It is used to adjust the intensity of Gaussian noise in the forward noise addition process to implement different noise addition strategies; the final noise intensity parameter β t The calculation formula is as follows:
[0014] β t =w t (s h -s l )+s l (2);
[0015] Step S1-4: Use the improved Unet network in step 1-2 and the dynamic negative square noise strategy in step S1-3 to build a dual-channel denoising diffusion probability model, and its sub-steps are:
[0016] Step S1-4-1, initializing the network parameters θ of the improved version of Unet, and setting the improved version of Unet network as a trainable Unet network of the dual-channel denoising diffusion probability model;
[0017] Step S1-4-2, given the bias parameter off and the total training time step T, for example, off=5, T=2000, initialize the dynamic negative square noise strategy and set it as the forward noise strategy hyperparameter of the dual-channel denoising diffusion probability model;
[0018] Step S1-4-3, set the exponential moving average network: set the sliding parameter α = 0.999 and initialize an exponential moving average network with the same structure as the improved Unet network, with parameter θ ema Exponential sliding average updates are performed during the training process to improve model stability, where each iteration θ ema The update formula is as follows:
[0019] θ ema ←αθ ema +(1-α)θ (3),
[0020] Step S1-4-4, define the forward diffusion process: according to the dynamic negative square noise adding strategy, define a reversible Markov process from the clear image space to the noise space, and gradually add Gaussian noise according to the time step t;
[0021] Step S1-4-5, define the reverse reconstruction process: based on the improved Unet network, define the step-by-step denoising process from the noise space to the clear image space, and predict the noise distribution of the previous moment at each time step;
[0022] Step S1-4-6, construct a joint loss function: calculate the mean square error loss L between Unet predicted noise and real noise mse And the total variation regularization loss L tv As the joint loss function L of the DC-DDPM model, the formula is as follows:
[0023]
[0024]
[0025] L=L mse +λL tv (6)
[0026] Among them, λ is set to 0.001;
[0027] Step S1-5, training and saving a dual-channel denoising diffusion probability model;
[0028] Step S2: Use a dual-channel denoising diffusion probability model to reconstruct the blurred lung CT image and store it locally on the computer.
[0029] The improved Unet network can better retain high-frequency key information and enhance image details and contrast in the subsequent reconstruction process; the dynamic negative square noise strategy, namely the DNS noise strategy, is introduced. By adjusting the parameters related to the noise time step, the forward noise process is artificially controlled to adjust between the model training time and the model reconstruction effect. The dual-channel denoising diffusion probability model can gradually remove the noise in the image through the forward and reverse processes, thereby obtaining a CT image with fewer artifacts and richer details. The network parameters are optimized by the joint loss function L of the DC-DDPM model. The dynamic negative square noise strategy (namely the DNS noise strategy) can dynamically control the degree of noise introduction in different time steps. When the off parameter is large, the noise is large in the initial stage of the forward noise process, and the noise gradually decreases in the later stage, which further affects the clarity of the initial image. When the off parameter is small, the noise is small in the initial stage of the forward noise process, and the noise gradually increases in the later stage, which further affects the clarity of the later image. By adjusting different off values, different noise effects can be achieved to balance the training time and reconstruction quality. In image reconstruction tasks, mean square error loss is usually used to calculate image similarity loss, while total variation regularization is mainly used in tasks such as denoising, deblurring and image reconstruction. Its core idea is to use the local consistency of the image. In natural scenes, most image pixel values change smoothly, and only the edges and textures will change dramatically. This feature is very important for retaining the key pathological information of lung CT images. Therefore, in model training, a total variation regularization loss term is added.
[0030] Preferably, the sub-steps of step S1-1 are:
[0031] Step S1-1-1, obtaining original data: obtaining a Low Dose CT public dataset, which contains paired image files of full dose and quarter dose obtained by reconstructing CT scans of 10 patients with different slice thicknesses (1 mm and 3 mm) using two reconstruction kernels (B30 and D45);
[0032] Step S1-1-2, exclude useless information: use the pydicom library to exclude useless information, which includes other information such as patient identity information and time information, and extract the original image data in the ima file;
[0033] Step S1-1-3, filtering invalid image data: binarizing the original image data to determine the proportion of black and white pixels. If the proportion of white is greater than 50%, the image is considered invalid.
[0034] Step S1-1-4, window width and window level processing: the window width value is set to 1500HU to highlight structures of different densities, and the window level value is set to -400HU to highlight the characteristics of lung tissue. The above window width and window level settings are applied to adjust the display range of the image data, thereby enhancing the visualization effect of the lung structure;
[0035] Step S1-1-5, image saving: the final single-channel image data obtained in steps S1-1-1 to S1-1-4 are scaled to a resolution of 224×224 and stored in a local computer in png format.
[0036] Preferably, the sub-steps of step S1-2 are:
[0037] Step S1-2-1: Set the global default parameters: the number of input channels is set to 1 to adapt to the processing of single-channel images; the number of basic channels is set to 128 to provide sufficient network capacity; the channel multiplication array is defined as [1, 2, 2, 2], which means that after each downsampling operation, the number of channels will be multiplied by the corresponding multiple; the number of residual blocks is set to 2 to increase the depth and expression ability of the network; the activation function uses Sigmoid Linear Unit (SiLU), and the regularization method selects group regularization;
[0038] Step S1-2-2: Set the initial convolution module: perform initial processing on the input image through convolution operation, the number of input channels is 2, one channel is the single-channel original input, and the other channel is the image after Sobel high-pass filtering. The number of output channels is set to the basic channel number, that is, 128, the convolution kernel size is set to 3, and the padding is 1 to maintain the size of the output image;
[0039] Step S1-2-3: Set up a downsampling module: The downsampling module is used to gradually reduce the resolution of the image to capture features of different scales. This step includes four downsampling operations, each of which consists of two residual blocks and one downsampling convolution. The residual block is used to gradually increase the number of channels to improve the network's expressiveness. The number of input channels is the number of output channels of the previous step, and the number of output channels is the number of base channels multiplied by the corresponding value in the channel multiplication array. The number of input and output channels of the downsampling convolution is the same, which is equal to the number of output channels of the previous step, and a stride of 2 is used to halve the length and width.
[0040] Step S1-2-4: Setting up parallel convolution modules: The parallel convolution modules help maintain the stability of the network. In this step, two residual blocks are used to process the input and keep the number of input and output channels unchanged to ensure the continuity of the network.
[0041] Step S1-2-5: Setting up the upsampling module: The upsampling module is used to gradually restore the resolution of the image to reconstruct the detail information; this step includes four upsampling operations, each operation consists of two residual blocks and an upsampling convolution, the residual block is used to reduce the number of channels to reduce information loss, the number of input channels is equal to the number of output channels of the previous operation, and the number of output channels is the number of base channels multiplied by the corresponding value in the inverse array of channel multiplication; the nearest neighbor method is used for upsampling, the scaling factor is 2, to double the length and width, and the convolution operation is used to reduce information loss;
[0042] Step S1-2-6: Setting the output convolution module: The output convolution module is used to generate the model's prediction of noise; the number of input channels is the number of base channels, the number of output channels is 1, the convolution kernel size is set to 3, and the padding is 1 to generate a single-channel prediction image;
[0043] Step S1-2-7: Set the Sobel operator: In the input of the original Unet, add the Sobel operator convolution kernel to output the high-pass filter image, where the kernel in the x direction is fixed to [[1, 0, -1], [2, 0, -2], [1, 0, -1]]; the kernel in the y direction is fixed to [[1, 2, 1], [0, 0, 0], [-1, -2, -1]].
[0044] An image can be represented as its frequency components in the frequency domain. Low-frequency components usually correspond to smooth changes and large light and dark structures in the image, while high-frequency components correspond to details and edges in the image. Through concat connection, the low-frequency components of the image can be weakened, while the high-frequency components can be enhanced, achieving the effect of detail enhancement. In lung CT images, image details often contain key information about some diseases, such as lung nodules, burrs, etc. High-pass filtering can be used to enhance and prevent the loss of detail information.
[0045] Preferably, the sub-steps of step S1-5 are:
[0046] Step S1-5-1, define the optimizer: select the Adam optimizer, which can adaptively adjust the learning rate of each parameter, and set the initial learning rate to 1e-4;
[0047] Step S1-5-2, loading training data: loading CT image data from the constructed training set, dividing the data into training batches for model training;
[0048] Step S1-5-3, iterative training: cyclically train the dual-channel denoising diffusion probability model on the training data set, and the number of steps is set to 10000;
[0049] Step S1-5-4, forward diffusion process: In each training step, the original training image x is input, and a T-step reversible forward process is performed according to the dynamic negative square noise strategy to obtain a noise sample set {x1, x2, ..., x T};
[0050] Step S1-5-5, reverse reconstruction process: Based on the improved Unet network, perform T-step reverse process to gradually predict the noise of the previous moment and obtain the predicted sequence {px T-1 , px T-2 , ..., px0};
[0051] Step S1-5-6, calculate the joint loss: calculate the MSE loss term L mse and TV (total variation) regularization loss term L tv The combined loss including the back propagation updates the Unet parameters θ and the exponential moving average network parameters θ ema ;
[0052] Step S1-5-7, model saving: when the preset number of training rounds is reached, the training ends, and the exponential moving average network is set as the Unet network of the dual-channel denoising diffusion probability model;
[0053] Step S1-5-8, evaluation indicators: Use PSNR and SSIM indicators to evaluate the reconstruction quality of the dual-channel denoising diffusion probability model on the validation set.
[0054] Preferably, the sub-steps of step S2 are:
[0055] Step S2-1: Inputting lung CT images: By setting the corresponding API, inputting the absolute file path or folder path of the lung CT images;
[0056] Step S2-2: Image preprocessing: read all lung CT images or a single lung CT image in the folder pointed to by the input path in step S2-1, and scale or crop each lung CT image to a resolution of 224×224 to obtain an original CT image matrix of shape (n, 1, 224, 224), where n is the number of images;
[0057] Step S2-3: Use the DC-DDPM model to reconstruct the image: pass the original CT image outputted in step S2-2 into the DC-DDPM model trained in step S1-5 to obtain a clear CT image matrix with a shape of (n, 1, 224, 224);
[0058] Step S2-4: Reconstruction result storage: The clear CT image matrix data reconstructed in step S2-3 is converted into a format, and finally n restored single-channel images in png format are obtained and saved locally on the computer.
[0059] The technical solution provided by the present invention has the following advantages over the prior art: in the present invention, a high-pass filtering processing unit is added to the improved Unet network to enhance the acquisition of high-frequency information by the Unet network, so that the model network can better retain key information in the subsequent reconstruction process and enhance the details and contrast of the image; a dynamic negative square noise addition strategy is designed to provide a hyperparameter to the dual-channel denoising diffusion probability model to realize the control of the noise intensity of the forward process, and finally achieve the purpose of artificially controlling the training time and the training effect; in the present invention, the MSE loss is not simply used as the only loss, but a TV total variation regularization loss is added to generate a smooth image, reduce the noise and artifacts in the image, and encourage the generation of locally consistent content; the method of the present invention improves the Unet network of the DDPM model and designs a smoother dynamic negative square noise addition strategy, so as to achieve better CT image reconstruction quality and faster model training speed than the original DDPM model; the method uses the flask framework to design an API, and uses the model trained by the method to reconstruct the input low-dose CT image, and finally outputs a higher quality CT image. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0061] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0062] Figure 1 It is an overall flow chart of a lung CT image reconstruction method based on a dual-channel denoising diffusion probability model described in an embodiment of the present invention;
[0063] Figure 2 This is a schematic diagram of an improved Unet network with high-frequency filtering added in an embodiment of the present invention;
[0064] Figure 3 This is a specific parameter diagram of the improved version of Unet network in an embodiment of the present invention;
[0065] Figure 4A comparison chart of the dynamic negative square noise adding strategy designed in the embodiment of the present invention and other public noise adding strategies in terms of noise weight;
[0066] Figure 5 Schematic diagram of the forward denoising process and the reverse denoising process of the original DDPM model;
[0067] Figure 6 is an original low-dose lung CT image involved in a preferred embodiment of the present invention;
[0068] Figure 7 yes Figure 6 A lung CT image reconstructed by a lung CT image reconstruction method based on a dual-channel denoising diffusion probability model according to a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0069] In order to more clearly understand the above-mentioned objectives, features and advantages of the present invention, the scheme of the present invention will be further described below. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.
[0070] In the description, it should be noted that the terms "first" and "second" are only used for descriptive purposes and should not be understood as indicating or implying relative importance. It should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected" and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be internal communication between two elements. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0071] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present invention, rather than all of the embodiments.
[0072] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0073] In one embodiment, Figure 1 As shown, a lung CT image reconstruction method based on a dual-channel denoising diffusion probability model includes the following steps:
[0074] Step S1: construct a dual channel denoising diffusion probability model (Dual Channel Denoising Diffusion Probability Model, DC-DDPM model), and its sub-steps are:
[0075] Step S1-1, constructing a data set: converting the lung CT image file in ima format into a single-channel png file with a resolution of 224×224, and filtering invalid data to provide high-quality training data; the sub-steps of step S1-1 are:
[0076] Step S1-1-1, obtaining original data: obtaining a Low Dose CT public dataset from the Mayo Clinic official website or other websites, which contains paired image files of full dose and quarter dose obtained by reconstructing CT scans of 10 patients with different slice thicknesses (1 mm and 3 mm) using two reconstruction kernels (B30 and D45);
[0077] Step S1-1-2, exclude useless information: use the pydicom library to exclude useless information, which includes other information such as patient identity information and time information, and extract the original image data in the ima file;
[0078] Step S1-1-3, filtering invalid image data: binarizing the original image data to determine the proportion of black and white pixels. If the proportion of white is greater than 50%, the image is considered invalid.
[0079] Step S1-1-4, window width and window level processing: the window width value is set to 1500HU to highlight structures of different densities, and the window level value is set to -400HU to highlight the characteristics of lung tissue. The above window width and window level settings are applied to adjust the display range of the image data, thereby enhancing the visualization effect of the lung structure;
[0080] Step S1-1-5, image saving: scaling the final single-channel image data obtained from step S1-1-1 to step S1-1-4 to a resolution of 224×224 and storing it locally on the computer in png format;
[0081] Step S1-2, improve the Unet network in the original DDPM model: apply the Sobel convolution operator to high-pass filtering, connect the high-frequency image and the original image into a two-channel image as the input of the Unet network through the concat operation, and build an improved version of the Unet network; the sub-steps of step S1-2 are:
[0082] Step S1-2-1, set the global default parameters: the number of input channels is set to 1 to adapt to the processing of single-channel images; the number of basic channels is set to 128 to provide sufficient network capacity; the channel multiplication array is defined as [1, 2, 2, 2], which means that after each downsampling operation, the number of channels will be multiplied by the corresponding multiple; the number of residual blocks is set to 2 to increase the depth and expression ability of the network; the activation function uses Sigmoid Linear Unit (SiLU), and the regularization method selects group regularization;
[0083] Step S1-2-2, setting the initial convolution module: the input image is initially processed by convolution operation, the number of input channels is 2, one channel is the single-channel original input, and the other channel is the image after Sobel high-pass filtering. The number of output channels is set to the basic channel number, that is, 128, the convolution kernel size is set to 3, and the padding is 1 to maintain the size of the output image;
[0084] Step S1-2-3, set the downsampling module: the downsampling module is used to gradually reduce the resolution of the image to capture features of different scales. This step includes four downsampling operations, each of which consists of two residual blocks and one downsampling convolution. The residual block is used to gradually increase the number of channels to improve the expression ability of the network. The number of input channels is the number of output channels of the previous step, and the number of output channels is the number of base channels multiplied by the corresponding value in the channel multiplication array; the number of input and output channels of the downsampling convolution is the same, which is equal to the number of output channels of the previous step, and a stride of 2 is used to halve the length and width;
[0085] Step S1-2-4, setting parallel convolution module: The parallel convolution module helps to maintain the stability of the network. In this step, two residual blocks are used to process the input and keep the number of input and output channels unchanged to ensure the continuity of the network;
[0086] Step S1-2-5, set up sampling module: the up sampling module is used to gradually restore the resolution of the image to reconstruct detail information; this step includes four up sampling operations, each operation consists of two residual blocks and an up sampling convolution, the residual block is used to reduce the number of channels to reduce information loss, the number of input channels is equal to the number of output channels of the previous step, the number of output channels is the number of base channels multiplied by the corresponding value in the inverse array of channel multiplication; the nearest neighbor method is used for up sampling, the scaling factor is 2, to double the length and width, and the convolution operation is used to reduce information loss;
[0087] Step S1-2-6, setting the output convolution module: the output convolution module is used to generate the model's prediction of noise; the number of input channels is the number of base channels, the number of output channels is 1, the convolution kernel size is set to 3, and the padding is 1 to generate a single-channel predicted image;
[0088] Step S1-2-7, set Sobel operator: in the input of the original Unet, add a Sobel operator convolution kernel to output a high-pass filter image, where the kernel in the x direction is fixed to [[1, 0, -1], [2, 0, -2], [1, 0, -1]]; the kernel in the y direction is fixed to [[1, 2, 1], [0, 0, 0], [-1, -2, -1]];
[0089] Step S1-3: Design a dynamic negative square noise adding strategy to dynamically control the degree of noise introduction in different time steps, and its sub-steps are:
[0090] Step S1-3-1, calculate the strategy weight: The strategy weight is an intermediate parameter used to control the degree of noise introduction. t In the calculation formula, t represents the current noise adding time step, off represents the bias parameter, T represents the total time step required for training the DDPM model, and the strategy weight w t The calculation formula is as follows:
[0091]
[0092] In formula (1), a weight value in the range of [0, 1] is calculated based on the time step t and the bias parameter off, where w t Negatively correlated with t;
[0093] S1-3-2. Calculate the final noise intensity parameter: Use the strategy weight w t Calculate the final noise intensity parameter β t , where s h and l Represent the highest and lowest values of noise intensity respectively, and parameter β t It is used to adjust the intensity of Gaussian noise in the forward noise addition process to implement different noise addition strategies; the final noise intensity parameter β t The calculation formula is as follows:
[0094] β t =w t (s h -s l )+s l (2);
[0095] Step S1-4: Use the improved Unet network in step 1-2 and the dynamic negative square noise strategy in step S1-3 to build a dual-channel denoising diffusion probability model, and its sub-steps are:
[0096] Step S1-4-1, initializing the network parameters θ of the improved version of Unet, and setting the improved version of Unet network as a trainable Unet network of the dual-channel denoising diffusion probability model;
[0097] Step S1-4-2, given the bias parameter off and the total training time step T, for example, off=5, T=2000, initialize the dynamic negative square noise strategy and set it as the forward noise strategy hyperparameter of the dual-channel denoising diffusion probability model;
[0098] Step S1-4-3, set the exponential moving average network: set the sliding parameter α = 0.999 and initialize an exponential moving average network with the same structure as the improved Unet network, with parameter θ ema Exponential sliding average updates are performed during the training process to improve model stability, where each iteration θ ema The update formula is as follows:
[0099] θ ema ←αθ ema +(1-α)θ (3),
[0100] Step S1-4-4, define the forward diffusion process: according to the dynamic negative square noise adding strategy, define a reversible Markov process from the clear image space to the noise space, and gradually add Gaussian noise according to the time step t;
[0101] Step S1-4-5, define the reverse reconstruction process: based on the improved Unet network, define the step-by-step denoising process from the noise space to the clear image space, and predict the noise distribution of the previous moment at each time step;
[0102] Step S1-4-6, construct a joint loss function: calculate the mean square error loss L between Unet predicted noise and real noise mse And the total variation regularization loss L tv As the joint loss function L of the DC-DDPM model, the formula is as follows:
[0103]
[0104]
[0105] L=L mse +λL tv (6)
[0106] Among them, λ is set to 0.001;
[0107] Step S1-5: training and saving the dual-channel denoising diffusion probability model; the sub-steps of step S1-5 are:
[0108] Step S1-5-1, define the optimizer: select the Adam optimizer, which can adaptively adjust the learning rate of each parameter, and set the initial learning rate to 1e-4;
[0109] Step S1-5-2, loading training data: loading CT image data from the constructed training set, dividing the data into training batches for model training;
[0110] Step S1-5-3, iterative training: cyclically train the dual-channel denoising diffusion probability model on the training data set, and the number of steps is set to 10000;
[0111] Step S1-5-4, forward diffusion process: In each training step, the original training image x is input, and a T-step reversible forward process is performed according to the dynamic negative square noise strategy to obtain a noise sample set {x1, x2, ..., x T};
[0112] Step S1-5-5, reverse reconstruction process: Based on the improved Unet network, perform T-step reverse process to gradually predict the noise of the previous moment and obtain the predicted sequence {px T-1 , px T-2 , ..., px0};
[0113] Step S1-5-6, calculate the joint loss: calculate the MSE loss term L mse and TV (total variation) regularization loss term L tv The combined loss including the back propagation updates the Unet parameters θ and the exponential moving average network parameters θ ema ;
[0114] Step S1-5-7, model saving: when the loss value changes small enough or reaches the preset number of training rounds, the training ends. For example, when the loss value changes less than 0.07 or reaches the preset number of training rounds of 1000, the training ends, and the exponential moving average network is set as the Unet network of the dual-channel denoising diffusion probability model;
[0115] Step S1-5-8, evaluation indicators: use PSNR and SSIM indicators to evaluate the reconstruction quality of the dual-channel denoising diffusion probability model on the validation set;
[0116] Step S2: reconstruct the blurred lung CT image using a dual-channel denoising diffusion probability model and store it locally on the computer; the sub-steps of step S2 are:
[0117] Step S2-1, inputting lung CT images: by setting the corresponding API, inputting the absolute file path or folder path of the lung CT images; specifically:
[0118] Step S2-1-1, define the input interface: use Flask to build a RESTful API interface, receive a POST request, and obtain the CT image file path parameter in the request body;
[0119] Step S2-1-2, verify parameters: check whether the request parameters are legal, whether the file path exists, and return an error;
[0120] Step S2-1-3: When step S2-1-2 passes the verification, proceed to the next step;
[0121] Step S2-2, image preprocessing: read all lung CT images in the folder pointed to by the input path in step S2-1 or a single lung CT image pointed to, and scale or crop each lung CT image to a resolution of 224×224 to obtain a CT image matrix of shape (n, 1, 224, 224), where n is the number of images; specifically:
[0122] Step S2-2-1, read the image: use the OpenCV tool to read the CT image file and obtain the image data in the form of numpy array;
[0123] Step S2-2-2, cropping the image: set the central cropping area, crop a 224x224 region of interest, and adjust the array shape to (n, 1, 224, 224), where n is the number of CT images;
[0124] Step S2-2-3, normalization processing: normalize the pixel values to the range of [0, 1] for model reconstruction processing;
[0125] Step S2-3, using the DC-DDPM model to reconstruct the image: the CT image outputted in step S2-2 is passed into the DC-DDPM model trained in step S1-5 to obtain a clear CT image matrix of shape (n, 1, 224, 224); the specific steps are as follows:
[0126] Step S2-3-1, model prediction: input the preprocessed image into the trained dual-channel denoising diffusion probability model to perform the denoising process;
[0127] Step S2-3-2, reconstructing the image: the DC-DDPM model performs the reverse process and outputs a reconstructed clear CT image matrix;
[0128] Step S2-4, storage of reconstruction results: convert the format of the clear CT image matrix data reconstructed in step S2-3, and finally obtain n single-channel images in png format after restoration and save them to the local computer. The specific steps are as follows:
[0129] Step S2-4-1, format conversion: The numpy() method provided by the numpy library converts the clear CT image matrix obtained in S2-3-2 into ndarray format, and the fromarray() method provided by the PIL library is used to convert the image matrix from ndarray into image format;
[0130] Step S2-4-2, save the image: use the save() method of the PIL library to save the image matrix in image format in png format to the specified directory;
[0131] Step S2-4-3, return response: construct a JSON response, including the path to save the image, and return it to the requester. Figure 6 and Figure 7 It can be clearly observed that Figure 7 Artifacts are reduced and details are better in the left and right ventricles and the interventricular septum.
[0132] The above is only a specific implementation of the present invention, which enables those skilled in the art to understand or implement the present invention. Although detailed descriptions are given with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments, and they should all be covered by the protection scope of the claims.
Claims
1. A lung CT image reconstruction method based on a dual-channel denoising diffusion probability model, characterized in that: The steps include: Step S1: construct a dual-channel denoising diffusion probability model, and its sub-steps are: Step S1-1, constructing a data set: converting the lung CT image file in ima format into a single-channel png file with a resolution of 224×224, and filtering invalid data; Step S1-2, improving the Unet network in the DDPM model: applying the Sobel convolution operator to high-pass filtering, connecting the high-frequency image and the original image into a two-channel image as the input of the Unet network through the concat operation, and constructing an improved version of the Unet network; Step S1-3: Design a dynamic negative square noise adding strategy to dynamically control the degree of noise introduction in different time steps, and its sub-steps are: Step S1-3-1, calculate the strategy weight: The strategy weight is an intermediate parameter used to control the degree of noise introduction. t In the calculation formula, t represents the current noise adding time step, off represents the bias parameter, T represents the total time step required for training the DDPM model, and the strategy weight w t The calculation formula is as follows: In formula (1), a weight value in the range of [0, 1] is calculated based on the time step t and the bias parameter off, where w t Negatively correlated with t; S1-3-2. Calculate the final noise intensity parameter: Use the strategy weight w t Calculate the final noise intensity parameter β t , where s h and l Represent the highest and lowest values of noise intensity respectively, and parameter β t It is used to adjust the intensity of Gaussian noise in the forward noise addition process to implement different noise addition strategies; the final noise intensity parameter β t The calculation formula is as follows: b t =w t (s h -s l )+s l (2); Step S1-4: Use the improved Unet network in step 1-2 and the dynamic negative square noise strategy in step S1-3 to build a dual-channel denoising diffusion probability model, and its sub-steps are: Step S1-4-1, initializing the parameters of the improved version of the Unet network, setting it as a trainable Unet network of the dual-channel denoising diffusion probability model; Step S1-4-2, given the bias parameter off and the total training time step T, initialize the dynamic negative square noise strategy and set it as the forward noise strategy hyperparameter of the dual-channel denoising diffusion probability model; Step S1-4-3, set the exponential moving average network: set the sliding parameters and initialize an exponential moving average network with the same structure as the improved Unet network, with parameters θ ema Exponential sliding average updates are performed during the training process to improve the model stability during training. ema The update formula is as follows: i ema ←th ema +(1-α)θ (3), Step S1-4-4, define the forward diffusion process: according to the dynamic negative square noise adding strategy, define a reversible Markov process from the clear image space to the noise space, and gradually add Gaussian noise according to the time step t; Step S1-4-5, define the reverse reconstruction process: based on the improved Unet network, define the step-by-step denoising process from the noise space to the clear image space, and predict the noise distribution of the previous moment at each time step; Step S1-4-6, construct a joint loss function: calculate the mean square error loss L between Unet predicted noise and real noise mse And the total variation regularization loss L tv As the joint loss function L of the dual-channel denoising diffusion probability model, the formula is as follows: L=L mse +λL tv (6), Among them, λ is set to 0.001; Step S1-5, training and saving a dual-channel denoising diffusion probability model; Step S2: Use a dual-channel denoising diffusion probability model to reconstruct the blurred lung CT image and store it locally on the computer.
2. The lung CT image reconstruction method based on the dual-channel denoising diffusion probability model according to claim 1 is characterized in that: The sub-steps of step S1-1 are: Step S1-1-1, obtaining original data: obtaining a Low Dose CT public data set, which includes paired image files of full dose and quarter dose obtained by reconstructing CT scans of 10 patients with different slice thicknesses using two reconstruction cores; Step S1-1-2, exclude useless information: use the pydicom library to exclude useless information, which includes patient identity information and time information, and extract the original image data in the ima file; Step S1-1-3, filtering invalid image data: binarizing the original image data to determine the proportion of black and white pixels. If the proportion of white is greater than 50%, the image is considered invalid. Step S1-1-4, window width and window level processing: the window width is set to 1500HU to highlight structures of different densities, and the window level is set to -400HU to highlight the characteristics of lung tissue; Step S1-1-5, image saving: the final single-channel image data obtained in steps S1-1-1 to S1-1-4 are scaled to a resolution of 224×224 and stored in a local computer in png format.
3. The lung CT image reconstruction method based on dual-channel denoising diffusion probability model according to claim 1, characterized in that: The sub-steps of step S1-2 are: Step S1-2-1, set the global default parameters: the number of input channels is set to 1 to adapt to the processing of single-channel images; the number of basic channels is set to 128 to provide sufficient network capacity; the channel multiplication array is defined as [1, 2, 2, 2], which means that after each downsampling operation, the number of channels will be multiplied by the corresponding multiple; the number of residual blocks is set to 2 to increase the depth and expression ability of the network; Step S1-2-2, setting the initial convolution module: the input image is initially processed by convolution operation, the number of input channels is 2, one channel is the single-channel original input, and the other channel is the image after Sobel high-pass filtering. The number of output channels is set to the basic channel number, that is, 128, the convolution kernel size is set to 3, and the padding is 1 to maintain the size of the output image; Step S1-2-3, set the downsampling module: the downsampling module is used to gradually reduce the resolution of the image to capture features of different scales. This step includes four downsampling operations, each of which consists of two residual blocks and one downsampling convolution. The residual block is used to gradually increase the number of channels to improve the expression ability of the network. The number of input channels is the number of output channels of the previous step, and the number of output channels is the number of base channels multiplied by the corresponding value in the channel multiplication array; the number of input and output channels of the downsampling convolution is the same, which is equal to the number of output channels of the previous step, and a stride of 2 is used to halve the length and width; Step S1-2-4, setting parallel convolution module: The parallel convolution module helps to maintain the stability of the network. In this step, two residual blocks are used to process the input and keep the number of input and output channels unchanged to ensure the continuity of the network; Step S1-2-5, set up sampling module: the up sampling module is used to gradually restore the resolution of the image to reconstruct detail information; this step includes four up sampling operations, each operation consists of two residual blocks and an up sampling convolution, the residual block is used to reduce the number of channels to reduce information loss, the number of input channels is equal to the number of output channels of the previous step, the number of output channels is the number of base channels multiplied by the corresponding value in the inverse array of channel multiplication; the nearest neighbor method is used for up sampling, the scaling factor is 2, to double the length and width, and the convolution operation is used to reduce information loss; Step S1-2-6, setting the output convolution module: the output convolution module is used to generate the model's prediction of noise; the number of input channels is the number of base channels, the number of output channels is 1, the convolution kernel size is set to 3, and the padding is 1 to generate a single-channel predicted image; Step S1-2-7, set the Sobel operator: in the input of the original Unet, add the Sobel operator convolution kernel to output the high-pass filter image, where the kernel in the x direction is fixed to [[1, 0, -1], [2, 0, -2], [1, 0, -1]]; the kernel in the y direction is fixed to [[1, 2, 1], [0, 0, 0], [-1, -2, -1]].
4. The lung CT image reconstruction method based on dual-channel denoising diffusion probability model according to claim 1, characterized in that: The sub-steps of step S1-5 are: Step S1-5-1, define the optimizer: select Adam optimizer and set the initial learning rate to 1e-4; Step S1-5-2, loading training data: loading CT image data from the constructed training set, dividing the data into training batches for model training; Step S1-5-3, iterative training: cyclically train the dual-channel denoising diffusion probability model on the training data set, and the number of steps is set to 10000; Step S1-5-4, forward diffusion process: In each training step, the original training image x is input, and a T-step reversible forward process is performed according to the dynamic negative square noise strategy to obtain a noise sample set {x1, x2, ..., x T }; Step S1-5-5, reverse reconstruction process: Based on the improved Unet network, perform T-step reverse process to gradually predict the noise of the previous moment and obtain the predicted sequence {px T-1 , px T-2 , ..., px0}; Step S1-5-6, calculate the joint loss: calculate the MSE loss term L mse and TV regularization loss term L tv The combined loss including the back propagation updates the Unet parameters θ and the exponential moving average network parameters θ ema ; Step S1-5-7, model saving: when the preset number of training rounds is reached, the training ends, and the exponential moving average network is set as the Unet network of the dual-channel denoising diffusion probability model; Step S1-5-8, evaluation indicators: Use PSNR and SSIM indicators to evaluate the reconstruction quality of the dual-channel denoising diffusion probability model on the validation set.
5. The lung CT image reconstruction method based on dual-channel denoising diffusion probability model according to claim 1, characterized in that: The sub-steps of step S2 are: Step S2-1, inputting lung CT images: by setting the corresponding API, inputting the absolute file path or folder path of the lung CT images; Step S2-2, image preprocessing: read all lung CT images in the folder pointed to by the input path in step S2-1 or a single lung CT image pointed to, and scale or crop each lung CT image to a resolution of 224×224 to obtain an original CT image matrix of shape (n, 1, 224, 224), where n is the number of images; Step S2-3, using a dual-channel denoising diffusion probability model to perform image reconstruction: the CT image outputted in step S2-2 is passed into the dual-channel denoising diffusion probability model trained in step S1-5 to obtain a clear CT image matrix with a shape of (n, 1, 224, 224); Step S2-4, storage of reconstruction results: convert the format of the clear CT image matrix data reconstructed in step S2-3 to obtain n restored single-channel images in png format and store them locally on the computer.
Citation Information
Patent Citations
Restricted CT (Computed Tomography) image reconstruction method and equipment based on de-noising diffusion model
CN116993610A
CBCT image reconstruction method and system, computer device and storage medium
CN116993848A