An unsupervised denoising method for total hip arthroplasty X image based on cascaded mask model
Through the DiT method of the cascade mask model, the shortcomings of traditional and deep learning methods in X-ray image denoising are solved, efficient and unsupervised noise removal and artifact elimination are achieved, and the image anatomical annotation accuracy and surgical intelligence of total hip replacement are improved.
Patent Information
- Application Number
- CN202410979059.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-07-22
AI Technical Summary
Among the existing X-ray radiographic image denoising methods, traditional image processing methods cannot completely remove noise and artifacts. Deep learning methods have difficulty obtaining training data sets and take a long time to train. The model has many layers and is difficult to converge, which affects the effectiveness of THA surgery.
The Diffusion Transformers (DiT) method using a cascaded mask model reduces the number of iterations and training time by cascading multiple DiT modules and utilizing the mask method, generating high-resolution clear images, reducing the difficulty of model training and improving convergence.
Effectively remove complex noise and artifacts, improve the accuracy of key anatomical point annotation in hip X-ray images, and achieve a more intelligent surgical process.
Smart Images

Figure CN118822891B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of X image processing. BACKGROUND
[0002] Total Hip Arthroplasty (THA) uses a metal hip prosthesis to replace the human hip joint, which can effectively treat hip joint diseases and is the standard operation for treating severe hip joint injuries. With the intensification of China's social aging, the demand for total hip arthroplasty is also increasing. In THA, the surgeon needs to manually mark key points and calculate key angles on the preoperative and postoperative X-ray radiographic images, in order to develop a surgical plan and assess postoperative risks. However, the imaging process of X-ray is easily affected by electronic interference and beam hardening phenomenon, and the image often contains a large amount of noise. Especially after THA, the patient's body is implanted with a metal prosthesis, when X-ray passes through the metal, the metal will scatter or absorb X-ray, producing serious metal artifacts. Complex noise and metal artifacts can seriously interfere with the doctor's judgment, and thus affect the THA surgical effect.
[0003] Currently, there are two mainstream denoising methods for X-ray radiographic images, namely, denoising methods based on traditional image processing and denoising methods based on deep learning. Denoising methods based on traditional image processing generally use frequency domain filtering or image gradients for denoising. The working principle is to directly transform the image to achieve image denoising. However, this method cannot completely remove noise and artifacts. It also causes image transition smoothing and loss of some information. Existing denoising methods based on deep learning are mainly based on supervised denoising methods based on convolutional neural networks (CNNs). Their training data sets are large-scale manually annotated noisy images or large batches of noisy-noiseless image pairs. In actual medical applications, high-quality annotation costs are extremely expensive, and noisy-noiseless image pairs are difficult to obtain. Therefore, supervised deep learning denoising methods are difficult to apply and promote in clinical scenarios. To overcome the drawbacks of supervised denoising models, researchers have recently begun researching medical image denoising based on unsupervised deep learning. For example, Liu et al. proposed a diffusion model for CT image denoising. (Liu, X., Yaoqin Xie, Junting Cheng, Songhui Diao, Shan Tan and Xiaokun Liang, “Diffusion Probabilistic Priors for Zero-Shot Low-Dose CT Image Denoising.” (2023)) uses a cascade of an unconditional diffusion model and a conditional diffusion model to denoise low-dose CT images using diffusion priors. However, this model requires a large number of iterations, takes a long time to train, and has many layers, making it difficult to converge. Summary of the Invention
[0004] To address the problems that current denoising algorithms based on traditional image processing cannot completely remove noise and may lose information due to transitional smoothing, and that denoising methods based on deep learning have large iterative steps, long model training times, and a large number of model layers, making convergence difficult, and that training data sets are difficult to obtain, this patent proposes an unsupervised denoising method for total hip replacement X-ray images based on the cascaded mask CMDiT module.
[0005] This patent proposes cascading multiple Diffusion Transformers (DiT) models, using the low-resolution denoised normal dose X-ray radiation (NDXR) image generated by the shallow DiT module as the conditional parameter C of the next-level DiT module, and then splitting the overall task of generating a high-resolution, clear denoised image in one go into multiple subtasks. The DiT module in each subtask adopts a smaller structure and is trained separately, greatly reducing the number of model layers and easing the difficulty of model training.
[0006] To address the current difficulty in obtaining training data for medical image denoising models, this patent uses diffusion priors to solve an iterative denoising algorithm, generating denoised images with higher resolution than the previous model from low-dose X-ray radiation (LDXR) images, achieving fully unsupervised training requiring only NDXR images.
[0007] To address the problem that current medical image denoising models take a long time to train due to multiple iterations, this patent proposes a mask method. In the process of generating Tokens information, all Tokens are calculated in parallel, only the Tokens with lower confidence are recalculated, and the Tokens with higher confidence are retained, which greatly reduces the number of iterations and shortens the model training time.
[0008] Therefore, the technical solution adopted by the present invention is: an unsupervised denoising method for total hip replacement X-ray images based on a cascade mask model, the method comprising:
[0009] Step 1: Obtain a dataset of images of the human pelvic hip joint. This dataset contains images of the pelvic joint in both normal and unilateral positions before and after total hip replacement surgery. The images include: NDXR images and LDXR images. NDXR represents normal X-ray radiation dose, and LDXR represents low X-ray radiation dose.
[0010] Step 2: Construct the DiT module, which includes the variational autoencoder VAE and the U-ViT network;
[0011] The input image, diffusion time t, and condition c are concatenated and used as the input of the variational autoencoder VAE. The variational autoencoder VAE maps the input image, diffusion time t, and condition c to the latent space. If condition c does not exist, it is not mapped. The mapped data is then fed into the U-ViT network.
[0012] Step 3: Cascade N DiT modules and train each DiT module separately using NDXR images. The first DiT module is an unconditional DiT module. The training process is to generate random noise through forward diffusion of N*K-order downsampled NDXR images, and continuously denoise the random noise to produce an N*K-order downsampled NDXR image, where N is the number of cascaded models and K is the pre-set downsampling order. Cascade N-1 conditional DiT modules backward. For the nth DiT module, use the low-resolution NDXR image generated by the previous DiT module as a condition, and the random noise generated by forward diffusion of the n*K-order downsampled NDXR image as input. The training model continuously denoises the random noise and restores it to an n*K-order downsampled NDXR image.
[0013] Step 4: Generate Tokens using the Mask method;
[0014] Mask the tokens, generate tokens in parallel and calculate the confidence, then retain the tokens with confidence higher than the threshold and regenerate the tokens with confidence lower than the set threshold, repeating until all token information is generated; Tokens represents noise, Mask represents mask;
[0015] Step 5: Denoising of LDXR images;
[0016] The LDXR image y0 is input into the pre-trained unconditional DiT module and is downsampled to N*K order. Obtaining a completely random noise map through forward diffusion According to the unconditional iterative denoising algorithm derived from the diffusion prior, The denoised low-resolution NDXR image is obtained by back diffusion of DiT As the conditional input of the next level conditional DiT module;
[0017] Step 6: Low-resolution NDXR image generated by unconditional DiT in step 5 As the conditional c input of a conditional DiT module, y0 is simultaneously subjected to (N–1)*K order downsampling and forward diffusion to obtain Input into the conditional DiT module, and generate low-resolution NDXR images according to the conditional iterative denoising algorithm As the conditional c input of the next level DiT module;
[0018] Step 7: Repeat step 6 until the last level of conditional DiT module generates an ultra-high resolution NDXR image x0, completing the denoising of the LDXR image.
[0019] Furthermore, the U-ViT network in the single DiT module in step 2 is a plurality of serially connected TransformerBlock structures, where Transformer Block is a component in the Transformer architecture. The structure of each TransformerBlock is as follows: the output data of the patch embedding module is A, which passes through the Transformer Block structure, the first Norm module, and the Multi-Head Attention module in sequence. The output data of the Multi-Head Attention module is spliced with the input data A to obtain data B. Data B passes through the second Norm module and the MLP module in sequence. The output data of the MLP module is spliced with the output data of the second Norm module and then passes through the third Norm module and the Pointwise Feedforward module in sequence. The output of the Pointwise Feedforward module is spliced with the data B as the output of the Transformer Block structure.
[0020] The patch embedding module represents the image segmentation process, dividing the image into multiple small images of the same size, and then flattening each small image. Multi-Head Attention represents the multi-head attention block. MLP represents the dimensionality increase and then dimensionality reduction operation of the image. Pointwise Feedforward represents the nonlinear transformation module.
[0021] Furthermore, in step 3, the training method of the DiT module is:
[0022] The forward diffusion process is as follows: split the NDXR image into multiple image blocks of the same size, record the position of each image block, input each image block into the variational autoencoder VAE separately, use the existing variational autoencoder VAE to map the image space X to the latent space Z, with a latent dimension of d; after the time step t and the conditional parameter c are also passed through the variational autoencoder VAE, all the flattened sequences after mapping are spliced and then input into the embedding layer to embed the corresponding position information; if the conditional parameter c does not exist, the conditional parameter is not embedded; the sequence in the latent space is input into the multi-head attention block, and the multi-head attention block is used to extract the latent space Z. The head attention mechanism maps image information to three vectors q, k, and v. q represents the query vector, which is used to find relevant information in the sequence. k represents the key vector, which is used to match the correlation with the query vector. v is the value vector, which is obtained by the weighted sum of the dot product of q and k. The network pays attention to global information through the three vectors q, k, and v. Finally, the sequence is upgraded and then reduced in dimension through MLP to obtain a sequence with unchanged dimension. The DiT module reverse diffusion process is then learned by reversing the forward diffusion process. After the last DiT module, the sequence is decoded from the latent space to the image space, and the predicted noise is generated after rearrangement.
[0023] Furthermore, the diffusion method of step 3 is specifically as follows:
[0024] The forward diffusion process is:
[0025]
[0026] Among them, q(x t |x0) means x with x0 as the condition t probability distribution, represents Gaussian distribution, x0 represents real, noise-free data samples, I represents the identity matrix, is a pre-set parameter, when the time step is t:
[0027]
[0028] in, x t represents the data sample when the time step is t, ε t represents the Gaussian noise added to the data sample at time step t;
[0029] The reverse diffusion process is:
[0030]
[0031] p θ (x t-1 |x t ) represents x t x for the condition t-1Probability distribution, u θ (x t , t) represents x t , t is the mean value of the parameter, ∑ θ (x t , t) represents x t , t is the variance of the parameter;
[0032] Back diffusion is achieved by training the log-likelihood variational lower bound of x0:
[0033]
[0034] Denotes the loss function, D kL (q * (x t-1 |x t ,x0)||p θ (x t-1 |x t )) represents the KL divergence, which measures the difference between the data distribution generated by the model and the real data distribution, q * (x t-1 |x t , x0) represents the given noise data x t and the true posterior x of the original data x0 t-1 distributed;
[0035] Only D kL Item requires training, and D kL The items are:
[0036]
[0037] represents the simplified training loss function, ε θ (x t ) indicates that the model is at time step t, according to the input data x t The predicted noise, represents the square of the 2-norm;
[0038] DiT is trained to predict a noise ε θ As close as possible to ε in the forward diffusion process t , so that the noisy image is minus the noise ε θ Then restore to a clean image.
[0039] Furthermore, the specific method of step 4 is:
[0040] Using sampling function Generate binary mask M = {m i} i=1,2...256, T represents the total step length of the sampling function, t represents the current sampling step length, and the binary mask M is applied to the potential space Z. When m i =1, use M*Token to replace the original Token content, and the result is expressed as Z M , calculate the log-likelihood of the masked Token:
[0041]
[0042] z i Z M The i-th element in will be masked by the logP(z i |Z M ) as the confidence, all the unmasked Tokens are recorded as Tokens and the confidence is set to 1; in the next step t+1, according to the sampling function Recalculate the number of tokens that need to be masked, and unmask the tokens with the highest confidence, m i The calculation method is:
[0043]
[0044] Indicates the calculated confidence, Sorted j (.) means for all Sort from small to large, and in each iteration, parallelize the prediction of logP(z i |Z M ), retain the Tokens with the highest confidence; the remaining Tokens are masked and re-predicted in the next iteration; the masking ratio is gradually reduced until all Tokens are generated in T iterations.
[0045] Furthermore, the specific method of denoising in step 5 is:
[0046] Assume that there is a relationship between the LDXR image y0 and the noise-free NDXR image x0:
[0047] y0=x0+ε n
[0048] where ε n Represents the noise contained in the LDXR image y0. According to the forward diffusion process, for time step t, in the backward diffusion process in the unconditional DiT module, there is:
[0049]
[0050] y t represents the LDXR image data at time step t, denotes the parameter in DiT, ε t denotes the Gaussian noise added to the data sample at time step t;
[0051] Substituting the above equation into the forward diffusion process formula, we have:
[0052]
[0053] x t denotes the LDXR image y t corresponding NDXR image data;
[0054] Taking the forward diffusion process as a prior for denoising, combined with the backward diffusion formula:
[0055]
[0056] p θ (x 0:T ) denotes the joint probability distribution of x0to x T , p(x T ) denotes the marginal probability distribution of individual time step T, p θ (x t-1 |x t ) denotes the probability distribution of x t given x t-1 ;
[0057] Substitute the maximum posterior framework to solve the iterative denoising formula:
[0058]
[0059] denotes the real NDXR image x t-1 data calculated by the posterior, λ t-1 denotes the pre-set hyperparameter, denotes the mean with as the parameter, σ t denotes the variance at time step t;
[0060] If it is a conditional diffusion model:
[0061]
[0062] This patent proposes an unsupervised denoising method for total hip arthroplasty X-ray images based on cascaded masked CMDiT modules. The proposed DiT module, with U-ViT as the backbone network, exhibits strong noise learning capabilities. Furthermore, a masking method is used to mask low-confidence tokens, significantly reducing model iterations and training time. Multiple DiT modules are then cascaded, with the output of the previous DiT module serving as the prior for the next DiT module, effectively reducing model training difficulty and improving convergence. Furthermore, the training process requires no traditional text-based assistance or a large dataset of annotated noisy-non-noise image pairs. Instead, fully unsupervised training is performed using readily available NDXR images, resulting in high-resolution and high-accuracy denoised images. Therefore, the proposed denoising method effectively removes complex image noise and artifacts, improves the accuracy of anatomical key point annotation in hip X-ray images, and enables more intelligent surgical workflows. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 This is the normal X-ray radiation dose radiation map data set required by the present invention.
[0064] Figure 2 This is the network structure of the cascade mask CMDiT module of the present invention.
[0065] Figure 3 This is the network structure of a single DiT module of the present invention.
[0066] Figure 4 This is the network structure of the Transformer Block in U-ViT of the present invention. DETAILED DESCRIPTION
[0067] This patent implements unsupervised training of NDXR images based on a diffusion prior, using a mask method to reduce the number of image generation iterations, thereby effectively reducing model training time. Furthermore, this patent cascades multiple DiT modules to gradually generate higher-resolution images. Compared to existing denoising methods, the model proposed in this patent is easier to converge. Furthermore, the training data does not require labeling and is easily accessible. Therefore, this patent can generate high-resolution denoised images of the hip joint while preserving detailed information, significantly improving the accuracy and intelligence of surgical planning and evaluation before and after total hip replacement surgery.
[0068] The present invention will be further described in detail below with reference to the accompanying drawings and examples, but the embodiments of the present invention are not limited thereto.
[0069] The algorithm flow chart of the present invention is as follows Figure 2As shown, an unsupervised denoising method for total hip replacement X-ray images based on the cascade mask CMDiT module includes the following steps:
[0070] Step 1: Obtain an image dataset containing human hip joints. The training images in the dataset are NDXR images, and the test images are LDXR images containing noise artifacts.
[0071] Step 2: Construct a single DiT module. The structure of a single DiT module is as follows Figure 3 As shown in Figure 1, a VAE variational autoencoder is added to the image input, which treats the input image, diffusion time t, and possible conditions c as a flattened sequence and maps them to the latent space. Then, based on the traditional Transformer encoder module Transformer Block, the structure of Transformer Block is as follows: Figure 4 As shown in the figure, multiple Transformer Blocks are connected and long skip connections are added between deep and shallow layers to form a U-ViT network. The pre-training parameters of the front and middle parts of U-ViT are consistent with those of the traditional Transformer, thereby making full use of its global feature extraction capability for images.
[0072] Step 3: Training of Cascade Mask CMDiT Module. Split the NDXR image in step 1 into 16*16 size image blocks and input them into the linear projection layer. Assuming the image size is 256*256, use the existing VAE variational autoencoder to transform the image space X={x i} i=1,2...256 Mapping to the latent space Z = {z i} i=1,2...256 , the potential dimension is d. The time step t and the possible conditional parameter c are also flattened in the same way and added to the sequence, input into the embedding layer, and embed the learnable one-dimensional position information. The sequence in the latent space is input into the multi-head attention block, and the image information is mapped to three vectors q, k, and v through the multi-head attention mechanism. The weighted sum of the dot product of q and k is used to obtain v, realizing the network's attention to global information. Finally, the sequence is increased and then reduced in dimension by MLP to obtain a sequence with unchanged dimension. In the diffusion process, the cosine variance table is used to set the parameter {α N,t} t=1,2…T , the time step T is set to 50 steps, and the model learns its backward diffusion process by reversing the forward diffusion process. After the final DiT, the sequence is decoded from the latent space to the image space and the predicted noise is generated after permutation.
[0073] Step 4: According to the training process described in step 3, use the Mask method to generate noise. First, design a sampling function Generate binary mask M = {mi} i=1,2…256 , in each iteration, choose m i = 1, the binary mask M is applied to the latent space Z, when m i =1, use [MASK]Token to replace the original Token content, and the result is represented by Z M , calculate the log-likelihood of the masked Token:
[0074]
[0075] In each iteration step t, the log P(z i |Z M ) as the confidence, indicating the degree of trust the model has in this prediction. The confidence of the unmasked tokens is set to 1. In the next step t+1, according to the sampling function Recalculate the number of tokens that need to be masked, and unmask the tokens with the highest confidence, m i The calculation method is:
[0076]
[0077] In each iteration, the model predicts logP(z i |Z M ), retaining the tokens with the highest confidence. The remaining tokens are masked and re-predicted in the next iteration. The masking ratio is gradually reduced until all tokens are generated in T iterations. By using the masking method, the number of iterations can be reduced and model performance can be improved.
[0078] Step 5: The number of cascaded DiTs is set to 8, and the LDXR image y0 in step 1 is downsampled by 2×8 to obtain a low-resolution LDXR image Afterwards Input given parameters {θ8, {α 8,t} t=1,2...50}Pre-trained unconditional DiT denoising model, after 50 steps of forward diffusion process, random noise is obtained Then, the 8 well-trained DiT modules are cascaded, and the output of the previous model is used as the conditional input of the next model. When the step size is equal to 1, the forward diffusion process obtains equal Will Input into the 8-step cascade model, combined with the unconditional iterative denoising algorithm, after given parameters {θ8, {α 8,t} t=1,2...50The pre-trained unconditional DiT module of} is back-diffused to obtain a 2×8-order downsampled low-resolution noise-free NDXR image. Afterwards, As given parameters {θ7, {α 7,t} t=1,2...50}, the LDXR image y0 is downsampled by 2×7 and forward diffused to obtain Combined with the conditional iterative denoising algorithm, After back diffusion, a 2×7-order downsampled low-resolution noise-free NDXR image is obtained. Repeating the above process, through N steps of cascading DiT diffusion process, we finally get a high-resolution noise-free NDXR image x0. The denoising process can be summarized as inputting the noisy LDXR image y0 into the model and finally outputting a noise-free NDXR image x0.
[0079] Step 6: Use the validation set to evaluate the performance of the trained optimal model and evaluate the accuracy of the model on the denoised image generation task.
[0080] For the U-ViT neural network in step 2 of the specific implementation plan, the algorithm needs to be introduced in detail:
[0081] a. An introduction to the overall structure of the algorithm. U-ViT is a model that applies the Transformer to computer vision. It consists of patch embedding, positional encoding, a multi-head attention mechanism, an MLP, and a Pointwise Feedforward. In the Transformer Block module, the input is first normalized through a Norm layer, and then the multi-head attention mechanism uses the network's attention to global information. The sequence is then dimensionalized by an MLP layer, then reduced to further extract features, resulting in a dimensionality-invariant sequence. Finally, after passing through the Norm layer, the input is fed into a Pointwise Feedforward layer for nonlinear transformation. Long skip connections are used between deep and shallow Transformer Block modules, and the input image is diffused through multiple Transformer Block modules.
[0082] b. Introduction to patch embedding
[0083] The input image is divided into image blocks of fixed size P*P, and the image is flattened to a length of (I / P) 2 The potential dimension is d.
[0084] c. Introduction to Positional Encoding
[0085] The positional encoding added by U-ViT can be understood as a table with N rows, where N is the same as the length of the input sequence. Each row represents a vector, and the dimension of the vector is the same as the dimension of the input sequence embedding.
[0086] d. Introduction to the multi-head attention mechanism.
[0087] The image information is mapped to three vectors q, k, and v through the multi-head attention mechanism, and v is obtained by the weighted sum of the dot product of q and k as the network's attention to the global information.
[0088] e. Introduction of MLP layer.
[0089] Multi-Layer Perceptron (MLP) is a classic feedforward neural network that performs dimensionality increase and then dimensionality reduction on images. Dimension increase helps capture more feature information and helps the model better understand the meaning of the input sequence.
[0090] d. Introduction of Pointwise Feedforward layer.
[0091] Pointwise Feedforward Network is a part of the feedforward neural network that performs nonlinear transformation on each input token.
[0092] For the specific implementation plan, the VAE variational autoencoder in step 3 needs to be introduced in detail:
[0093] The Variational Auto-Encoder (VAE) model consists of two parts: an encoder and a decoder. You can directly use a pre-trained VAE.
[0094] a. Introduction of encoder.
[0095] The encoder converts the image space Mapping to latent space These latent representations are used in the forward diffusion process of the diffusion model, and the model's operations on the input will all act in the latent space Z.
[0096] b. Introduction of decoder.
[0097] The decoder decodes the potential sequence obtained in the diffusion model into pixels, which can then be restored to an image through linear combination. In essence, it converts the potential space Mapping back to image space
[0098] The diffusion process in step 3 of the specific implementation plan needs to be introduced in detail:
[0099] In the diffusion model, there is a forward diffusion process:
[0100]
[0101] in is a pre-set parameter, when the time step is t:
[0102]
[0103] Among them The forward diffusion process can be simply described as the image x0 and the noise ε t Weighted summation gives x t The DiT will be trained to reverse its forward diffusion process, called backward diffusion:
[0104]
[0105] According to the classic diffusion model design, back diffusion is achieved by training the log-likelihood variational lower bound of x0:
[0106]
[0107] In the formula, only D kL Item requires training, and D kL The term can be expressed as:
[0108]
[0109] Therefore, it is necessary to train ε in DiT θ term, that is, DiT is trained to predict a noise ε θ As close as possible to ε in the forward diffusion process t , so that the noisy image is minus the noise ε θ Then restore to a clean image.
[0110] The iterative denoising algorithm in step 5 of the specific implementation plan needs to be introduced in detail:
[0111] Assume that there is a relationship between the LDXR image y0 and the noise-free NDXR image x0:
[0112] y0=x0+ε n
[0113] where ε n Represents the noise contained in the LDXR image y0. According to the forward diffusion process, for the time step t, in the reverse diffusion process in the unconditional DiT:
[0114]
[0115] Substitute the above equation into the forward diffusion process equation, we have:
[0116]
[0117] Combine the backward diffusion equation with the forward diffusion process as a prior for denoising:
[0118]
[0119] Substitute the above equation into the forward diffusion process equation, we have:
[0120]
[0121] If it is a conditional diffusion model:
[0122]
Claims
1. An unsupervised denoising method for total hip replacement X-ray images based on a cascade mask model, the method comprising: Step 1: Obtain an image dataset of the human pelvic hip joint; This dataset contains images of the pelvis in both normal and unilateral positions before and after total hip replacement surgery. The images include: NDXR images and LDXR images. NDXR represents normal X-ray radiation dose, and LDXR represents low X-ray radiation dose. Step 2: Construct the DiT module, which includes the variational autoencoder VAE and the U-ViT network; The input image, diffusion time t, and condition c are concatenated and used as the input of the variational autoencoder VAE. The variational autoencoder VAE maps the input image, diffusion time t, and condition c to the latent space. If condition c does not exist, it is not mapped. The mapped data is then fed into the U-ViT network. Step 3: Cascade N DiT modules and train each DiT module separately using NDXR images. The first DiT module is an unconditional DiT module. The training process is to generate random noise through forward diffusion of N*K-order downsampled NDXR images, and continuously denoise the random noise to produce an N*K-order downsampled NDXR image, where N is the number of cascaded models and K is the pre-set downsampling order. Cascade N-1 conditional DiT modules backward. For the nth DiT module, use the low-resolution NDXR image generated by the previous DiT module as a condition, and the random noise generated by forward diffusion of the n*K-order downsampled NDXR image as input. The training model continuously denoises the random noise and restores it to an n*K-order downsampled NDXR image. Step 4: Generate Tokens using the Mask method; Mask the tokens, generate tokens in parallel and calculate the confidence, then retain the tokens with confidence higher than the threshold and regenerate the tokens with confidence lower than the set threshold, repeating until all token information is generated; Tokens represents noise, Mask represents mask; Step 5: Denoising of LDXR images; The LDXR image y0 is input into the pre-trained unconditional DiT module and is downsampled to N*K order. Obtaining a completely random noise image through forward diffusion According to the unconditional iterative denoising algorithm derived from the diffusion prior, The denoised low-resolution NDXR image is obtained by back diffusion of DiT As the conditional input of the next level conditional DiT module; Step 6: Low-resolution NDXR image generated by unconditional DiT in step 5 As the conditional c input of a conditional DiT module, y0 is simultaneously subjected to (N–1)*K order downsampling and forward diffusion to obtain Input into the conditional DiT module, and generate low-resolution NDXR images according to the conditional iterative denoising algorithm As the conditional c input of the next level DiT module; Step 7: Repeat step 6 until the last level of conditional DiT module generates an ultra-high resolution NDXR image x0, completing the denoising of the LDXR image.
2. The unsupervised denoising method for total hip replacement X-ray images based on a cascade mask model according to claim 1, characterized in that: The U-ViT network in the single DiT module in step 2 is a structure of multiple serially connected Transformer Blocks. Transformer Block is a component in the Transformer architecture. The structure of each Transformer Block is as follows: the output data of the patch embedding module is A, which passes through the Transformer Block structure, the first Norm module, and the Multi-Head Attention module in sequence. The output data of the Multi-Head Attention module is spliced with the input data A to obtain data B. Data B passes through the second Norm module and the MLP module in sequence. The output data of the MLP module is spliced with the output data of the second Norm module and then passes through the third Norm module and the Pointwise Feedforward module in sequence. The output of the Pointwise Feedforward module is spliced with data B as the output of the Transformer Block structure. The patch embedding module represents the image segmentation process, dividing the image into multiple small images of the same size, and then flattening each small image. Multi-Head Attention represents the multi-head attention block, MLP represents the dimensionality increase and then dimensionality reduction operation of the image, and Pointwise Feedforward represents the nonlinear transformation module.
3. The unsupervised denoising method for total hip replacement X-ray images based on a cascade mask model according to claim 1, characterized in that: In step 3, the training method of the DiT module is: The forward diffusion process is as follows: split the NDXR image into multiple image blocks of the same size, record the position of each image block, input each image block into the variational autoencoder VAE separately, use the existing variational autoencoder VAE to map the image space X to the latent space Z, with a latent dimension of d; after the time step t and the conditional parameter c are also passed through the variational autoencoder VAE, all the flattened sequences after mapping are spliced and then input into the embedding layer to embed the corresponding position information; if the conditional parameter c does not exist, the conditional parameter is not embedded; the sequence in the latent space is input into the multi-head attention block, and the multi-head attention block is used to extract the latent space Z. The head attention mechanism maps image information to three vectors q, k, and v. q represents the query vector, which is used to find relevant information in the sequence. k represents the key vector, which is used to match the correlation with the query vector. v is the value vector, which is obtained by the weighted sum of the dot product of q and k. The network pays attention to global information through the three vectors q, k, and v. Finally, the sequence is upgraded and then reduced in dimension through MLP to obtain a sequence with unchanged dimension. The DiT module reverse diffusion process is then learned by reversing the forward diffusion process. After the last DiT module, the sequence is decoded from the latent space to the image space, and the predicted noise is generated after rearrangement.
4. The unsupervised denoising method for total hip replacement X-ray images based on a cascade mask model according to claim 1, wherein: The diffusion method of step 3 is specifically as follows: The forward diffusion process is: Among them, q(x t |x0) means x with x0 as the condition t probability distribution, represents Gaussian distribution, x0 represents real, noise-free data samples, I represents the identity matrix, is a pre-set parameter, when the time step is t: in, x t represents the data sample when the time step is t, ε t represents the Gaussian noise added to the data sample at time step t; The reverse diffusion process is: p θ (x t-1 |x t ) represents x t x for the condition t-1 Probability distribution, u θ (x t ,t) represents x t ,t is the mean value of the parameter, Σ θ (x t ,t) represents x t ,t is the variance of the parameter; Back diffusion is achieved by training the log-likelihood variational lower bound of x0: Denotes the loss function, D kL (q * (x t-1 |x t ,x0)‖p θ (x t-1 |x t )) represents the KL divergence, which measures the difference between the data distribution generated by the model and the real data distribution, q * (x t-1 |x t ,x0) represents the given noise data x t and the true posterior x of the original data x0 t-1 distributed; Only D kL Item requires training, and D kL The items are: represents the simplified training loss function, ε θ (x t ) indicates that the model is at time step t, according to the input data x t The predicted noise, represents the square of the 2-norm; DiT is trained to predict a noise ε θ As close as possible to ε in the forward diffusion process t , so that the noisy image is minus the noise ε θ Then restore to a clean image.
5. The unsupervised denoising method for total hip replacement X-ray images based on a cascade mask model according to claim 1, wherein: The specific method of step 4 is: Using sampling function Generate binary mask M = {m i } i=1,2…256 , T represents the total step length of the sampling function, t represents the current sampling step length, and the binary mask M is applied to the potential space Z. When m i =1, use M*Token to replace the original Token content, and the result is expressed as Z M , calculate the log-likelihood of the masked Token: z i Z M The i-th element in will be masked by the logP(z i |Z M ) as the confidence, all the unmasked Tokens are recorded as Tokens and the confidence is set to 1; in the next step t+1, according to the sampling function Recalculate the number of tokens that need to be masked, and unmask the tokens with the highest confidence, m i The calculation method is: Indicates the calculated confidence, Sorted j (.) means for all Sort from small to large, and in each iteration, parallelize the prediction of logP(z i |Z M ), retain the Tokens with the highest confidence; the remaining Tokens are masked and re-predicted in the next iteration; the masking ratio is gradually reduced until all Tokens are generated in T iterations.
6. The unsupervised denoising method for total hip replacement X-ray images based on a cascade mask model according to claim 1, wherein: The specific method of denoising in step 5 is: Assume that there is a relationship between the LDXR image y0 and the noise-free NDXR image x0: y0=x0+ε n where ε n Represents the noise contained in the LDXR image y0. According to the forward diffusion process, for time step t, in the backward diffusion process in the unconditional DiT module, there is: y t represents the LDXR image data at time step t, represents the parameters in DiT, ε t represents the Gaussian noise added to the data sample at time step t; Substituting the above formula into the forward diffusion process formula, we have: x t represents the LDXR image y t Corresponding NDXR image data; The forward diffusion process is used as the prior for denoising, combined with the backward diffusion formula: p θ (x 0:T ) represents x0 to x T The joint probability distribution of p(x T ) represents the marginal probability distribution of a single time step T, p θ (x t-1 |x t ) represents x t x for the condition t-1 Probability distribution; Substitute into the maximum a posteriori framework to solve the iterative denoising formula: represents the true NDXR image x calculated by the posterior t-1 Data, λ t-1 represents the pre-set hyperparameters, Indicates t is the mean of the parameter, σ t represents the variance when the time step is t; If it is a conditional diffusion model:
Citation Information
Patent Citations
Automatic calibration method and system for hip joint X-ray image reference object template
CN114463392A
Low-dose CT image denoising method and system based on fast diffusion model
CN117952850A