A DSA image generation method based on registration enhancement and optimal transfer GAN
By introducing registration enhancement and optimal transmission GAN in DSA image generation, combined with the adaptive attention mechanism and optimal transmission metric function, the problems of blur and distortion in DSA image generation in the existing technology are solved, significantly improving image quality and Discriminative ability, the generated image is closer to the real image.
Patent Information
- Application Number
- CN202311793094.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-25
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2043-12-25
AI Technical Summary
Existing technologies have problems with blur, distortion, and detail loss when generating DSA images. Traditional GAN neural networks ignore the feature level of images, resulting in a large gap between the generated images and the real images.
Using a method based on registration enhancement and optimal transmission GAN, by constructing a generator and a discriminator, using a convolution kernel to extract global information, an adaptive attention mechanism integrates feature information, and measures feature similarity through the optimal transmission metric function. Trained using a combination of mean square error, perceptual loss, and structural similarity loss functions.
It significantly improves the quality of the generated image and the discriminant ability of the discriminator, achieves high-precision evaluation of the quality of the generated image and captures subtle differences, and the generated DSA image is closer to the real image.
Smart Images

Figure CN117765041B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image processing, and in particular relates to a DSA image generation method based on registration enhancement and optimal transmission GAN. Background Art
[0002] Digital subtraction angiography (DSA) is a commonly used technique in angiography. It processes the DSA image before silhouette to generate a silhouetted image that only contains the blood vessels, making it easier for doctors to observe and diagnose lesions.
[0003] A Chinese patent document with publication number CN109087306A discloses an arterial vascular image model training method and a segmentation method, including: S1, preprocessing the acquired DSA image to construct an arterial vascular image library; S2, annotating some sample images in the arterial vascular image library to construct an annotated sample image set; S3, constructing a convolutional deep network, and setting deep network parameters to generate an initial arterial vascular segmentation model; S4, using the annotated sample image set to train the initial arterial vascular segmentation model to generate an arterial vascular image segmentation model; S5, further annotating the vascular target image obtained by segmenting other images in the arterial vascular image library except some sample images using the arterial vascular image segmentation model to iteratively train the arterial vascular image segmentation model.
[0004] The Chinese patent document with publication number CN115439651A discloses a DSA cerebrovascular segmentation system and method based on a spatial multi-scale attention network; obtaining original DSA image data; labeling the category of each frame image, labeling the vascular structure and non-vascular structure, and producing a DSA cerebrovascular data set; preprocessing the image and dividing it into a test set, a training set and a validation set; sending the data of the training set to a spatial multi-scale attention network model for training, adjusting the parameters of the model training process, and selecting the best model through the AUC value in the validation set; dividing the image of the test set into local image blocks, testing the test set data through the best model selected, and reconstructing the prediction results to verify the segmentation effect.
[0005] However, images generated by existing methods may have problems such as blur, distortion, and detail loss, which are more prominent when generating silhouetted DSA images.
[0006] In addition, the existing technology also uses a generative adversarial network (GAN) to process the DSA image before the silhouette. However, the traditional GAN neural network usually only focuses on the image quality at the pixel level and ignores the feature level of the image, resulting in a large gap between the generated image and the real image. Summary of the invention
[0007] The present invention provides a DSA image generation method based on registration enhancement and optimal transmission GAN, which enables the network to generate images with higher quality.
[0008] A DSA image generation method based on registration enhancement and optimal transfer GAN, comprising:
[0009] (1) Collect DSA image datasets before and after silhouette;
[0010] (2) Build the generator
[0011] After the input image enters the generator, it is convolved with convolution kernels of different sizes to obtain a series of feature maps containing global information; the feature maps are cut into a series of small blocks and a series of feature vectors v are obtained through linear transformation. i ;
[0012] The feature vector v i After inputting the adaptive attention mechanism, we get the attention result Z corresponding to each small block i i , these results Z i After being projected into a shared representation space, weighted summation is performed to obtain a representation Z that integrates all scale information, and finally the output image G of the generator is obtained through a feedforward neural network;
[0013] (3) Constructing the discriminator
[0014] Calculate the optical flow map F between the generated image G and the real image R GR , the generated image G is based on the optical flow map F GR Perform spatial distortion and generate the distorted image G warp The real image and the real image are respectively input into a deep convolutional network for feature extraction; the optimal transfer metric function is used to measure the similarity between the two extracted features;
[0015] (4) Construct a loss function and use the DSA image dataset to train the generator and discriminator;
[0016] (5) Input the DSA image to be silhouetted into the trained generator to generate the silhouetted image.
[0017] In step (2), each small patch is projected into a high-dimensional space through a linear transformation to obtain a series of feature vectors v i , the formula is as follows:
[0018] v i =LinerTransform(patch i (X)
[0019] Where X represents the feature map containing global information output by the generator, and LinerTransform represents the linear transformation function.
[0020] In step (2), the attention result Z corresponding to each small block i is obtained i The specific process is:
[0021] First, the original attention matrix M is calculated using the Transformer module, and then it is used as the input of a linear transformation to perform eigenvalue decomposition to obtain the eigenvalue λ and eigenvector U. λ and U describe the stretching and rotation of this linear transformation in different directions.
[0022] Use the sigmoid function to convert the eigenvalue λ to a number between 0 and 1 to obtain the adaptive weight A; use these adaptive weights to linearly combine the original eigenvectors to obtain the new attention matrix M′; use the new attention matrix M′ to further calculate the attention result Z corresponding to each small block i i .
[0023] 'The specific formula is:
[0024] Q i =W q *v i ,K i =W k *v i ,V i =W v *vi
[0025]
[0026] λ,U=Eigendecomposition(M)
[0027] A = sigmoid(FC(λ))
[0028] M′=U*A*U T
[0029] Z i =Attention(Q i ,K i ,V i )=softmax(M′)V i
[0030] In the formula, v i is the vector corresponding to the i-th small block, W q ,W K ,W v is the weight matrix, Q i ,K i ,V iRepresents Query, Key, and Value vectors respectively, d k is the dimension of key, Eigendecomposition represents eigenvalue decomposition, M is the original attention matrix, λ and U represent eigenvalues and eigenvectors, A is the adaptive weight, FC represents the fully connected layer, M′ represents the new attention matrix, Attention(Q i ,K i ,V i ) represents the new adaptive attention mechanism.
[0031] The process of obtaining the representation Z that integrates all scale information is:
[0032] All attention results Z i Through a learnable linear transformation, it is projected into a shared representation space with a fixed dimension, which is not affected by the input scale; and after weighted summation, a representation that integrates all scale information is obtained. The process can be expressed by the following formula
[0033] Z′=W z *Concat(Z1,Z2,…,Z n )
[0034] Z=∑α i *Z′
[0035] Among them, Z′ is the representation after projection and Z is the final integrated representation.
[0036] In step (3), the optimal transfer metric function is used to measure the similarity between the two extracted features:
[0037] First, calculate the correlation matrix of each feature representation. The formula is as follows:
[0038] CM(G warp )=h(G warp )*h(G warp ) T
[0039] CM(R)=h(R)*h(R) T
[0040] In the formula, the deep convolutional network is denoted as h, and the feature representation of the generated image after alignment is h(G warp ) and the feature representation h(R) of the real image;
[0041] The correlation matrix CM(G warp ) and CM(R) are regarded as probability distributions, and the optimal transmission metric function OT is used to measure the difference between the two distributions. The calculation formula is as follows:
[0042] OT(CM(G warp ),CM(R))=min Tr <Tr,Mc>
[0043] Where <.,.> represents the inner product of the matrix, Tr is a transport matrix that satisfies all elements non-negative and each row and column is 1, and Mc is a cost matrix that represents the generated image G after alignment. warp The cost required to transfer the features of R to the features of the real image R.
[0044] In step (3), the optimal transfer metric function OT is used as the loss function to evaluate the score S of the generated image. G , the calculation formula is as follows:
[0045] S G =OT(CM(G warp ),CM(R))
[0046] In the optimal transmission metric function OT, Tr is solved by iteratively normalizing the rows and columns of Tr through the Sinkhorn iterative algorithm until a stable state is reached.
[0047] A combination of mean square error loss, perceptual loss and structural similarity loss can also be used as the loss function.
[0048] Compared with the prior art, the present invention has the following beneficial effects:
[0049] 1. The present invention introduces the concept of pixel-level registration in the discriminator, so that the discriminator can accurately align the features of the generated image and the target image. This precise feature alignment can capture tiny pixel-level differences, thereby achieving high-precision evaluation of the quality of the generated image.
[0050] 2. The present invention introduces the optimal transmission method, which enables GAN to perform deep comparison in complex feature space, rather than just in the original image space. This deep comparison enables the model to better understand and capture the subtle differences between generated images and real images, thereby significantly improving the quality of generated images and the discriminant ability of the discriminator. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 This is a flow chart of a DSA image generation method based on registration enhancement and optimal transmission GAN of the present invention;
[0052] Figure 2 It is a workflow diagram of the generator in the present invention;
[0053] Figure 3 4 is a flowchart of the discriminator in the present invention. DETAILED DESCRIPTION
[0054] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be pointed out that the embodiments described below are intended to facilitate the understanding of the present invention and do not have any limiting effect on the present invention.
[0055] like Figure 1 As shown, a DSA image generation method based on registration enhancement and optimal transfer GAN includes the following steps:
[0056] Step 1: Collect DSA image datasets before and after silhouette.
[0057] Step 2, build the generator.
[0058] First, the input image is decomposed at different scales. This is achieved by applying a series of filters of different sizes, each of which analyzes the image at a specific spatial scale. We first designed a series of convolution kernels of different sizes. Then, these convolution kernels slide on the original DSA image and perform convolution operations to obtain a series of feature maps. Each feature map corresponds to the feature representation of the original image at a certain scale. In this process, small-scale convolution kernels can capture local information in the image, such as edges, textures, etc.; large-scale convolution kernels can capture a larger range of contextual information, so that global information in the image can be extracted. These feature maps are cut into a series of patches, each of which is linearly transformed into a high-dimensional space to obtain a series of feature vectors v i These feature vectors contain rich features of the original image at multiple scales.
[0059] Each patch is projected into a high-dimensional space through a linear transformation, resulting in a series of vectors v i . These vectors will serve as input to the Transformer.
[0060] v i =LinerTransform(patch i (X)
[0061] For each scale i, define a Transformer module T i Each Transformer module receives a series of vectors v i As input, in the traditional Transformer, the attention mechanism is obtained by multiplying the query and the key, and all inputs are considered equally, which may not be optimal when processing data such as images with strong local correlation. Therefore, it is possible to consider introducing an adaptive attention mechanism so that the model can better mine the correlation between elements.
[0062] Specifically, we first calculate the original attention matrix M, and then use it as an input for a linear transformation. Then, we perform eigenvalue decomposition to obtain λ (eigenvalue) and U (eigenvector). Since the original matrix can be regarded as an operation of linear transformation on the space, λ and U describe the stretching and rotation of this transformation in different directions. i Represents the direction U i The degree of stretching performed on the surface, that is, the importance in this direction.
[0063] Then use the sigmoid function to convert these eigenvalues to numbers between 0 and 1 to obtain the adaptive weight A. This process can be understood as using the sigmoid function to map the original importance measure (λ) to between 0 and 1, so that large eigenvalues correspond to higher importance (close to 1), while small eigenvalues correspond to lower importance (close to 0). In this way, the importance of different input elements can be mathematically measured.
[0064] The original feature vectors are linearly combined with these adaptive weights to obtain a new attention matrix M′. This process can be understood as adjusting the original spatial transformation according to the new importance metric. In this way, a new attention matrix is obtained, which not only describes the relationship between input elements, but also takes into account the importance of different input elements.
[0065] The specific formula is as follows:
[0066] Q i =W q *v i ,K i =W k *v i ,V i =W v *vi
[0067]
[0068] λ,U=Eigendecomposition(M)
[0069] A = sigmoid(FC(λ))
[0070] M′=U*A*U T
[0071] Z i =Attention(Q i ,K i ,V i )=softmax(M′)V i
[0072] Among them, v i is the vector corresponding to the i-th patch, W q ,W K ,W v is the weight matrix, Q i ,K i ,V i Represents Query, Key, and Value vectors respectively, d k is the dimension of the key, Eigendecomposition represents eigenvalue decomposition, M is the original attention matrix, λ and U represent eigenvalues and eigenvectors. A is the adaptive weight, FC represents the fully connected layer. M′ represents the new attention matrix, Attention(Q i ,K i ,V i ) represents the new attention mechanism, Z i is the attention result at the i-th scale, and these results are projected into a shared representation space through a learnable linear transformation. This representation space has a fixed dimension and is not affected by the input scale. And a weighted sum is performed to obtain a representation that integrates all scale information. This process can be expressed by the following formula
[0073] Z′=W z *Concat(Z1,Z2,…,Z n )
[0074] Z=∑α i *Z′
[0075] Where Z′ is the projected representation and Z is the final integrated representation.
[0076] Finally, the generator output G is obtained through a feedforward neural network.
[0077] Step 3: Build the discriminator.
[0078] In a traditional discriminator, the task of the discriminator is usually to evaluate the difference between the generated image and the real image to guide the generator to produce results closer to the real image. However, in the DSA silhouette image regression task, this difference may be reflected in small differences at the pixel level, such as subtle image structures or image intensity changes. This requires the discriminator to have high-precision alignment capabilities to accurately capture these small differences.
[0079] However, traditional GAN discriminators often focus on capturing the global features of the image and may ignore these subtle differences. In addition, due to the nonlinearity and complexity of the image generation process, there may be some minor alignment errors between the generated image and the target image, which may affect the evaluation effect of the discriminator.
[0080] Based on the above reasons, the present invention designs a discriminator based on pixel-level registration, which can accurately align the features of the generated image and the target image, capture subtle differences, and thus more accurately evaluate the quality of the generated image.
[0081] Specifically, we first use FlowNet to calculate the optical flow between the generated image G and the real image R. FlowNet is a deep neural network used to calculate the optical flow between two images. Let F be the optical flow calculation function, and we can get the optical flow graph F GR , that is, F GR =FlowNet(G,R).
[0082] Using the optical flow map F obtained in the previous step GR Perform an image warping operation, that is, spatially warp the generated image G according to the optical flow map so that its feature layout is better aligned with the real image R. The warping operation function is denoted as Warp, so the distorted generated image is denoted as G warp .
[0083] G warp =Warp(G,F GR )
[0084] After the image is distorted, the distorted image G warp The real image is input into a deep convolutional network (DeepConvNet) for feature extraction. This network consists of multiple deep convolutional layers, each of which extracts features at different levels of the image and further abstracts these features. We denote this deep convolutional network as h, so the feature representation of the generated image after alignment (denoted as h(G warp )) and the feature representation of the real image (denoted as h(R)) can be expressed as: h(G warp )=DeepConv(G warp ), h(R)=DeepConvNet(R)
[0085] Next, a method called "Deep Correlation Matrix Comparison" (DCMMC) is used to measure the similarity between two features. This method first calculates the correlation matrix (CM) represented by each feature. This matrix reflects the interaction information within the feature, thus providing richer contextual information for the comparison process. Specifically, the correlation matrix can be calculated using the following formula:
[0086] CM(G warp )=h(G warp)*h(G warp ) T
[0087] CM(R)=h(R)*h(R) T
[0088] Next, we regard the correlation matrix as a probability distribution and use the optimal transmission method to measure the difference between the two distributions. Specifically, we define a measurement function, denoted as OT, and the calculation formula is as follows:
[0089] OT(CM(G warp ),CM(R))=min Tr <Tr,Mc>
[0090] Among them, <.,.> represents the inner product of the matrix, Tr is a "transportation matrix" that satisfies all elements non-negative and each row and column is 1, and Mc is a "cost matrix" that represents the cost of G warp The cost required to transfer the features of to the features of R. Our goal is to find such a Tr that minimizes the total cost. We use the Sinkhorn iteration algorithm to iteratively normalize the rows and columns of Tr to solve T until a stable state is reached.
[0091] Step 4: Construct a loss function and train the generator and discriminator.
[0092] Use the above optimal transfer metric function OT as the loss function R to evaluate the score S of the generated image G , the calculation formula is as follows:
[0093] S G =OT(CM(G warp ),CM(R))
[0094] This optimal transfer-based discriminator design enables the GAN of the present invention to perform exhaustive comparisons on complex feature spaces, rather than just on the original image space, thus better capturing the subtle differences between generated and real images.
[0095] In addition to the optimal transmission metric function, in the actual training process, the present invention also adopts a combined loss function, including mean square error (MSE) loss, perceptual loss, and structural similarity (SSIM) loss.
[0096] 1. Mean Square Error (MSE) loss: This is a basic pixel-level loss function that directly measures the difference between the network output and the target image at the pixel level. The specific formula is as follows:
[0097] L_MSE=(1 / N)∑i (y i -t i ) 2
[0098] Among them, y i is the output of the network, t i is the target image and N is the number of pixels.
[0099] 2. Perceptual loss: This loss function takes into account the high-level semantic information of the image. It extracts the features of the image through a pre-trained deep neural network, and then calculates the MSE loss between the features. This makes the image generated by the network closer to the target image in visual effect.
[0100] 3. Structural Similarity (SSIM) Loss: SSIM is an indicator for evaluating image quality that takes into account the brightness, contrast, and structural information of the image. By adding SSIM loss to the total loss, the image generated by the network can be structurally closer to the target image.
[0101] Through the combination of these four loss functions, the difference between the network output and the target image can be measured from different angles, so that the network can generate higher quality images. During the training process, the AdamW optimizer was used, which is an optimizer that introduces weight decay (equivalent to L2 regularization) based on the Adam optimizer. At the same time, the cosine annealing learning rate scheduling strategy was used, so that the model converged quickly in the early stage and could be steadily improved in the later stage.
[0102] Step 5: In actual application, the DSA image to be silhouetted is input into the trained generator to generate a higher quality silhouetted image.
[0103] The embodiments described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above are only specific embodiments of the present invention and are not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A DSA image generation method based on registration enhancement and optimal transfer GAN, characterized in that: include: (1) Collect DSA image datasets before and after silhouette; (2) Build a generator; After the input image enters the generator, it is convolved with convolution kernels of different sizes to obtain a series of feature maps containing global information; the feature maps are cut into a series of small blocks and a series of feature vectors v are obtained through linear transformation. i ; The feature vector v i After inputting the adaptive attention mechanism, we get the attention result Z corresponding to each small block i i , these results Z i After being projected into a shared representation space, weighted summation is performed to obtain a representation Z that integrates all scale information, and finally the output image G of the generator is obtained through a feedforward neural network; (3) Construct a discriminator; Calculate the optical flow map F between the generated image G and the real image R GR , the generated image G is based on the optical flow map F GR Perform spatial distortion and generate the distorted image G warp The real image and the real image are respectively input into a deep convolutional network for feature extraction; the optimal transfer metric function is used to measure the similarity between the two extracted features, specifically: First, calculate the correlation matrix of each feature representation. The formula is as follows: CM(G warp )=h(G warp )*h(G warp ) T CM(R)=h(R)*h(R) T In the formula, the deep convolutional network is denoted as h, and the feature representation of the generated image after alignment is h(G warp ) and the feature representation h(R) of the real image; The correlation matrix CM(G warp ) and CM(R) are regarded as probability distributions, and the optimal transmission metric function OT is used to measure the difference between the two distributions. The calculation formula is as follows: OT(CM(G warp ),CM(R))=min Tr <Tr,Mc> Where <.,.> represents the inner product of the matrix, Tr is a transport matrix that satisfies all elements non-negative and each row and column is 1, and Mc is a cost matrix that represents the generated image G after alignment. warp The cost required to transfer the features of the real image R to its features; (4) Construct a loss function and use the DSA image dataset to train the generator and discriminator. Specifically, the loss function combines the optimal transfer metric function with the mean square error loss, perceptual loss, and structural similarity loss. The optimal transfer metric function OT is used to evaluate the score S of the generated image. G , the calculation formula is as follows: S G =OT(CM(G warp ),CM(R)) In the optimal transmission metric function OT, Tr is solved by iteratively normalizing the rows and columns of Tr through the Sinkhorn iterative algorithm until a stable state is reached; (5) Input the DSA image to be silhouetted into the trained generator to generate the silhouetted image.
2. The DSA image generation method based on registration enhancement and optimal transmission GAN according to claim 1 is characterized in that: In step (2), each small patch is projected into a high-dimensional space through a linear transformation to obtain a series of feature vectors v i , the formula is as follows: v i =LinerTransform(patch i (X)) Where X represents the feature map containing global information output by the generator, and LinerTransform represents the linear transformation function.
3. The DSA image generation method based on registration enhancement and optimal transmission GAN according to claim 1 is characterized in that: In step (2), the attention result Z corresponding to each small block i is obtained i The specific process is: First, the original attention matrix M is calculated using the Transformer module, and then it is used as the input of a linear transformation to perform eigenvalue decomposition to obtain the eigenvalue λ and eigenvector U. λ and U describe the stretching and rotation of this linear transformation in different directions. Use the sigmoid function to convert the eigenvalue λ to a number between 0 and 1 to obtain the adaptive weight A; use these adaptive weights to linearly combine the original eigenvectors to obtain the new attention matrix M'; use the new attention matrix M' to further calculate the attention result Z corresponding to each small block i i .
4. The DSA image generation method based on registration enhancement and optimal transmission GAN according to claim 3 is characterized in that: Get the attention result Z corresponding to each small block i i The formula is: Q i =W q *v i ,K i =W k *v i ,V i =W v *you λ,U=Eigendecomposition(M) A = sigmoid(FC(λ)) M'=U*A*U T Z i =Attention(Q i ,K i ,V i )=softmax(M')V i In the formula, v i is the vector corresponding to the i-th small block, W q ,W K ,W v is the weight matrix, Q i ,K i ,V i Represents Query, Key, and Value vectors respectively, d k is the dimension of key, Eigendecomposition represents eigenvalue decomposition, M is the original attention matrix, λ and U represent eigenvalues and eigenvectors, A is the adaptive weight, FC represents the fully connected layer, M' represents the new attention matrix, Attention(Q i ,K i ,V i ) represents the new adaptive attention mechanism.
5. The DSA image generation method based on registration enhancement and optimal transmission GAN according to claim 4 is characterized in that: The process of obtaining the representation Z that integrates all scale information is: All attention results Z i Through a learnable linear transformation, it is projected into a shared representation space with a fixed dimension, which is not affected by the input scale; and after weighted summation, a representation that integrates all scale information is obtained. The process can be expressed by the following formula W'=W z *Concat(Z1,Z2,…,Z n ) Z=∑α i *WITH' Among them, Z' is the representation after projection, Z is the final integrated representation, and W z represents the weight matrix, α i Represents the weighting coefficient.
