Medical image translation method based on cyclic consistency generative adversarial network
The medical image translation method through cycle consistency generative adversarial network solves the problem of difficulty in converting CT and MRI images into each other, achieves accurate diagnosis of lumbar fracture areas, reduces patient expenses, and performs well in specific fields and public data sets Outstanding performance.
Patent Information
- Application Number
- CN202410701194.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-08-30
AI Technical Summary
Existing CT and MRI medical images have difficulty in converting each other when diagnosing lumbar fractures, resulting in delayed diagnosis and unfavorable treatment, especially in emergency situations where MRI images cannot be obtained quickly.
A medical image translation method based on cycle consistency generative adversarial network is adopted to generate images through image preprocessing, dual-stream neural network to obtain global and local features, auxiliary classifier fusion features, adaptive normalized residual block and upsampling decoder. And stepwise transformation is performed through cycle consistency and generative adversarial networks, and finally the model is evaluated by kernel initial distance.
It achieves accurate mutual conversion between CT images and MRI images, improves the diagnostic accuracy of lumbar fracture areas, reduces patient expenses, and shows excellent performance in specific fields and public data sets.
Smart Images

Figure CN118570168A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision image translation, and in particular to a medical image translation method based on a cycle-consistent generative adversarial network. Background Art
[0002] Lumbar fracture is the most common type of spinal fracture and is more likely to occur in the elderly. Lumbar fracture includes old fractures and new fractures. Severe cases can cause low back pain, height loss, lumbar kyphosis, lower limb paralysis, urinary incontinence and fecal incontinence. Computed tomography (CT) and magnetic resonance imaging (MRI) are the standard methods for diagnosing lumbar fractures.
[0003] MRI is good at diagnosing new fractures, is non-invasive, and does not cause any harmful effects on the body; it has multi-parameter imaging and can provide a variety of imaging sequences and parameters; MRI has excellent contrast in displaying soft tissues, can clearly display organs, muscles, ligaments and other structures, and helps diagnose and evaluate many diseases and injuries. But it is expensive, time-consuming, and inconvenient. No, especially in emergency situations at night, the inability to perform MRI examinations may delay the diagnosis and treatment of trauma patients and even have an adverse effect on the recovery of the nervous system. In addition, some people are not suitable for MRI examinations, such as those with metal implants or claustrophobia. In addition, the machine is not used in some developing countries and remote areas.
[0004] CT is good at diagnosing old fractures, has high-resolution images, and can produce high-resolution images, which allows doctors to observe the fine structures of human tissues and organs more clearly, so as to diagnose diseases more accurately; CT scans can usually complete the imaging process in a few seconds or minutes, which makes CT imaging very advantageous in emergency situations, such as trauma, stroke and other acute conditions; CT scans have good imaging effects on both soft tissue and bone tissue, so they have high accuracy in diagnosing tumors, fractures, brain diseases, etc.; CT scans are a non-invasive examination method that can reduce patients' pain and the risk of complications; CT scans can be used to diagnose and evaluate various diseases, including but not limited to lesions in the head, chest, abdomen, bones and other parts. Although CT scans have many advantages, they also have some limitations and disadvantages, such as exposure to radiation and the use of contrast agents that affect renal function. Therefore, it is of great practical significance to explore a method to convert CT images and MRI images to each other so that they can better meet clinical needs. Summary of the invention
[0005] The technical problem to be solved by the present invention is to convert medical images of lumbar fractures to each other, and to realize the conversion between electronic computer tomography (CT) and magnetic resonance imaging (MRI) through a model, so as to assist doctors in diagnosis and reduce the cost of patients.
[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is: a medical image translation method based on cycle consistency generative adversarial network, comprising the following steps:
[0007] S1: Through image preprocessing, the uneven data set is adjusted to uniformity, such as contrast brightness and other attributes;
[0008] S2: Acquiring global and local features of medical images through two-stream neural network;
[0009] S3: The weight of the feature map is obtained by fusing the two obtained features into the auxiliary classifier, and then multiplied by the fused feature to obtain a feature map with weight;
[0010] S4: By taking the feature map as input, the adaptive normalized residual block and the upsampling decoder, a generated medical image in another domain is obtained;
[0011] S5: The generated medical image and the real medical image are taken as input by the encoder of the discriminator at the same time, and the authenticity of the generated medical image is predicted through cycle consistency and generative adversarial network;
[0012] S6: Through game theory, the generated medical images are gradually transformed into real medical images;
[0013] S7: Finally, the model is evaluated by Kernel Inception Distance.
[0014] In a preferred solution, the image preprocessing uses the ImageEnance class of the PIL library to enhance and unify the original medical image's contrast, brightness, chroma, sharpness and other attributes. The preprocessed medical image has a more balanced and clearer display effect, and is also more conducive to the model extracting image features.
[0015] In a preferred embodiment, the medical images include MRI images and CT images.
[0016] In a preferred solution, the two-stream neural network obtains different types of features by constructing two different encoders, wherein the first encoder uses convolutional downsampling and residual network blocks to encode the local features of the medical image; the second encoder uses Swin-Transformer to encode the global features of the medical image. Local features are more suitable for describing and matching local details, while global features are more suitable for analyzing and describing the overall features of the entire image. The features obtained by the two encoders are fused, and the image features obtained have better generation effects than a single encoder.
[0017] In a preferred embodiment, the auxiliary classifier obtains the weight of each fused feature map by respectively performing global maximum pooling and global average pooling and then performing linear transformation through a fully connected layer, fuses the two obtained weights and changes the number of channels through convolution to obtain the final feature map weight, and multiplies the obtained weight information with the fused feature map to obtain the final feature map with weight.
[0018] In a preferred solution, the expression for image preprocessing is:
[0019] p s (s k )=n k / n,0≤s k ≤1,k=0,1,2,...,L-1
[0020]
[0021] RGB to HSV
[0022] V=max(R,G,B)
[0023]
[0024] HSV to RGB
[0025] C=V*S
[0026]
[0027] m=VC
[0028]
[0029] (R,G,B)=((R′+m)*255,(G′+m)*255,(B′+m)*255)
[0030] where p s (s k ) is the probability of the kth gray level appearing in the original image, n k is the independent variable, L is the number of gray levels, EH(s k ) at 0≤s k In the range of ≤L-1, it is a single-valued single-increasing function. It calculates the grayscale mean through the image and creates a grayscale image to achieve contrast enhancement. R, G, B represent the values of the three colors red, green, and blue respectively. H, S, V represent hue, saturation, and brightness respectively. C represents the color value of the color. X is a temporary variable used to help calculate the values of each component in RGB. m represents the minimum value of the color, which is the result of brightness minus color value. HSV is adjusted by image conversion and then converted back to RGB to achieve image correlation processing.
[0031] In a preferred embodiment, the expression of the two-stream neural network is:
[0032] Input:(N,C in ,H in ,W in )
[0033] Output:(N,C out ,H out ,W out )
[0034]
[0035] The N, C, H, and W in the convolution encoder represent the batch size, number of channels, height, and width, respectively. Padding represents the padding before convolution. Dilation represents the filter with gaps between each point. Kernel_size represents the size of the convolution on each channel. Stride represents the position interval of the applied filter. Q, K, and V in the Swin-Transformer encoder represent query, key, and value, respectively. k represents the vector dimension, and B represents the relative position bias.
[0036] In a preferred solution, the expression of the feature fusion is:
[0037]
[0038] Among them, Z concat It represents the tensor after feature fusion, K represents the parameters of the convolution kernel, X and Y represent the number of channels of the two feature maps, C represents the number of channels, and the number of channels of the concatenated tensor becomes 2C. The local features obtained by convolution and the global features of Swin-transformer are fused through concat concatenation and then channel dimension reduction is performed through 1×1 convolution.
[0039] In the preferred solution, the expression for cycle consistency is selected as:
[0040]
[0041] Among them, L cycle Denotes the cycle consistency loss function L lsgan and L identity They represent the adversarial loss function and the identity loss function respectively, E represents the mathematical expectation, x represents the input image, D and G represent the discriminator and generator of the model respectively, and |*|1 represents the L1 norm, also known as the Manhattan distance.
[0042] In the preferred solution, the expression of the generative adversarial network is:
[0043]
[0044] D KID =max(eig(K gen -K real ))
[0045] K gen and K real Represent the Gaussian kernel matrix of the feature space of the generated sample and the real sample, μ gen and μ real Represents the mean vector of the feature vector of the generated sample and the real sample, C gen and C real Represent the covariance matrix eig of the characteristic equations of generated samples and real samples respectively.
[0046] The beneficial effects of the present invention are as follows: the method in the present invention successfully combines Swin-transformer and traditional convolutional layers to form a new dual-branch model to solve the limitations of convolutional feature extraction and apply it to solve the problem of medical image translation. The model can accurately identify the lumbar fracture area. According to the CAM heat map, the model is more able to pay attention to the relevant changes in the cone area, which is of great help in converting medical images of lumbar fracture areas. It has been experimentally proved on a specific field - lumbar compression fracture dataset and horse2zebra public dataset, and has achieved excellent performance, providing an important reference for research and practice in the field of medical image translation. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The present invention will be further described below in conjunction with the accompanying drawings and embodiments:
[0048] Figure 1 It is a schematic diagram of the model framework of the present invention;
[0049] Figure 2 Generate a network graph for the cyclic adversarial generation of the present invention;
[0050] Figure 3 A two-stream neural network encoder diagram of the present invention;
[0051] Figure 4 This is a detailed diagram of the dual encoder of the present invention. DETAILED DESCRIPTION
[0052] like Figure 1 As shown, a medical image translation method based on a cycle consistency generative adversarial network comprises the following steps:
[0053] S1: Through image preprocessing, the uneven data set is adjusted to uniformity, such as contrast brightness and other attributes;
[0054] S2: Acquiring global and local features of medical images through two-stream neural network;
[0055] S3: The weight of the feature map is obtained by fusing the two obtained features into the auxiliary classifier, and then multiplied by the fused feature to obtain a feature map with weight;
[0056] S4: By taking the feature map as input, the adaptive normalized residual block and the upsampling decoder, a generated medical image in another domain is obtained;
[0057] S5: The generated medical image and the real medical image are taken as input by the encoder of the discriminator at the same time, and the authenticity of the generated medical image is predicted through cycle consistency and generative adversarial network;
[0058] S6: Through game theory, the generated medical images are gradually transformed into real medical images;
[0059] S7: Finally, the model is evaluated by Kernel Inception Distance.
[0060] The present invention uses the image translation U-GAT-IT model of the cycle-consistent adversarial generative network as the basic model, takes the CT images and MRI images of the medical fractured lumbar vertebra as data sets, and realizes the mutual conversion between the CT images and MRI images of the fractured lumbar vertebra through the improved U-GAT-IT model.
[0061] Preferably, Figure 2 As shown in Figure 2, the specific steps of the cyclic adversarial generation network graph are:
[0062] Image preprocessing is used to adjust the medical images in the dataset to a uniform state. Image translation is to achieve conversion between different fields. This model uses cycle consistency and generative adversarial methods to achieve mutual translation from domain X to domain Y and from domain Y to domain X. The model uses CT images as domain X and MRI images as domain Y. The principles of cycle consistency and generative adversarial methods are as follows:
[0063]
[0064] Among them, L cycle Denotes the cycle consistency loss function L lsganDenotes the adversarial loss function, E denotes mathematical expectation, x denotes the input image, D and G denote the discriminator and generator of the model respectively, and |*|1 denotes the L1 norm, also known as the Manhattan distance. Through cycle consistency and the related loss function of the generative adversarial network, the interchange of medical images to medical images in another domain can be achieved without one-to-one correspondence.
[0065] The Y domain image generated by the generator G and the original Y domain image are fed into the discriminator D as input y In the above example, the X-domain image generated by the generator F and the original X-domain image are fed into the discriminator D as input. x In the process, the generated image is closer and closer to the original image through game theory.
[0066] Preferably, Figure 3 As shown in the figure, the specific steps of the two-stream neural network encoder diagram are: first, the medical image is taken as input and input into the two-stream neural network. Then it is divided into two paths, one path enters the convolutional neural network encoder to extract the local features of the image, and the other path enters the Swin-transformer encoder to obtain the global features of the image. The two features are then fused, and finally a 1×1 convolution is used for dimensionality reduction, and finally a synthesized medical image in another field is output.
[0067]
[0068] Among them, Z concat It represents the tensor after feature fusion, K represents the parameters of the convolution kernel, X and Y represent the number of channels of the two feature maps, C represents the number of channels, and the number of channels of the concatenated tensor becomes 2C. The local features obtained by convolution and the global features of Swin-transformer are fused through concat concatenation and then channel dimension reduction is performed through 1×1 convolution.
[0069] Input:(N,C in ,H in ,W in )
[0070] Output:(N,C out ,H out ,W out )
[0071]
[0072] The N, C, H, and W in the convolution encoder represent the batch size, number of channels, height, and width, respectively. Padding represents the padding before convolution. Dilation represents the filter with gaps between each point. Kernel_size represents the size of the convolution on each channel. Stride represents the position interval of the applied filter. Q, K, and V in the Swin-Transformer encoder represent query, key, and value, respectively. k represents the vector dimension, and B represents the relative position bias.
[0073] Preferably, Figure 4 As shown, the specific steps of the dual encoder detailed diagram are:
[0074] Convolutional encoder part:
[0075] First, local features are extracted through three layers of convolution-instance normalization-ReLU activation function, then the CAM auxiliary classifier is entered to obtain the weight of the feature map, and then the local features are multiplied by the weights to obtain the feature map with weights, and finally it is sent to the residual block.
[0076] The calculation formulas for instance normalization and ReLU are as follows:
[0077]
[0078] ReLU = max(0,X)
[0079] Among them, x represents the feature tensor, C, H, W represent the number of channels, height and width of the feature tensor respectively, μ and σ represent the mean and standard deviation respectively, γ and β represent the learnable scaling factor and bias respectively, and y represents the normalized value. The ReLU activation function is actually the max(0,X) function.
[0080] CAM-assisted classifier is a method for visualizing the attention mechanism of convolutional neural networks. It can help understand the area that the network focuses on when performing classification tasks and generate attention heat maps. The calculation formula of CAM-assisted classifier is as follows:
[0081]
[0082] M represents the weight matrix, c represents the calculated category, A represents the feature map of the last convolution output, whose size is K×U×V, where K is the number of channels, U and V are the height and width of the feature map, and w is the weight of the classifier, whose size is K. (u,v) represents the spatial position coordinates.
[0083] The calculation steps are as follows:
[0084] First, calculate the weight matrix Mc , then upsample the weight matrix to make it consistent with the input image size, and finally perform the softmax function to obtain the category activation map corresponding to category c. Through the above steps, the CAM of each category can be obtained, thereby visualizing the area that the neural network focuses on when identifying different categories.
[0085] Swin-transformer encoder part:
[0086] Swin-transformer is composed of a sliding window multi-head self-attention mechanism (MSA) and a multi-layer perceptron (MLP), and layer normalization (LN) is added before each MSA and MLP.
[0087] The purpose of introducing W-MSA is to reduce the amount of calculation. Calculating self-attention by blocks requires less calculation than calculating the attention mechanism on the entire image. Calculating the self-attention mechanism in each block separately will result in the inability to exchange information between each block. Therefore, SW-MSA is introduced to offset each window by sliding the window, thereby solving the problem of the inability to exchange information between blocks.
[0088] The calculation formula of the multi-head attention mechanism is as follows:
[0089] Q i =QW i Q ,K i =KW i K ,V i =VW i V ,i=1,2,...,8
[0090]
[0091] head i =Attention(Q i ,K i ,V i ),i=1,2,...,8
[0092] MultiHead(Q,K,V)=Concat(head1,head2,...,head8)
[0093] Q, K, V represent query, key, and value respectively, and W represents weight. First, the feature map X is divided into 8 parts and multiplied by the weight W to obtain Q, K, and V. Then, each feature is obtained by calculating the Attention weight matrix of each attention head, and finally each feature is concatenated to obtain the final feature.
[0094] The calculation formula of the multi-layer perceptron is as follows:
[0095] H=sigmoid(b1+W1x)
[0096] O = softmax(b2+W2H)
[0097] Among them, H represents the hidden layer, O represents the output layer, W represents the weight, and b represents the bias. From the above formula, we can see that the input of the next layer is the output of the previous layer. The above formula only performs a linear transformation on the data. In order to achieve the classification effect, we need to introduce an activation function to perform a nonlinear transformation on each non-input layer, such as the sigmoid and softmax activation functions.
[0098] The calculation formula for layer normalization is as follows:
[0099]
[0100] Among them, x represents the feature tensor, C, H, W represent the number of channels, height and width of the feature tensor respectively, μ and σ represent the mean and standard deviation respectively, γ and β represent the learnable scaling factor and bias respectively, and y represents the normalized value. ε represents a very small number, which is used to prevent the denominator from being zero in the calculation.
[0101] The comparative experiment table is shown below:
[0102] Table 1 Index results (200,000 epochs)
[0103]
[0104] As shown in Table 1, the method proposed in the present invention obtains the best index in both FID (Fréchet Inception Distance) and KID (Kernel Inception Distance), where FID is an index used to evaluate the difference between two image distributions. It is based on the feature extractor of the image and calculates the statistical characteristics of the two distributions. KID is an index used to evaluate the quality of generated images. It measures the difference between the generated image and the real image, and measures the quality of the generated image by comparing the distance between the feature distribution of the generated image and the feature distribution of the real image. It can be seen from Table 1 that the FID index is improved by 2.3% and 33.5% on the fracture lumbar CT-MRI dataset and the public dataset Horse2zebra, and the KID index is improved by 54% and 57%. The reason for the greater improvement on the public dataset may be that the Swin-transformer encoder can pay more attention to global features, while the Horse2zebra image is too complex and requires global and local features to be extracted simultaneously.
[0105] The experimental results verify the effectiveness of the medical image translation method based on cycle-consistent generative adversarial networks proposed by the present invention. In order to enable the mutual conversion of medical images in different fields, the present invention designs a two-stream neural network, uses convolution and transformer as two encoders for feature extraction, and then fuses the obtained features to obtain new features, thereby improving the accuracy of image translation. The data set is then preprocessed to make it more in line with the needs of the model. In summary, the present invention is superior to existing methods and has achieved advanced performance in the field of medical image translation.
[0106] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A medical image translation method based on cycle-consistent generative adversarial network, characterized in that: The following steps are involved: S1, unify the data set through image preprocessing; S2, obtaining global and local features of medical images through a two-stream neural network; S3, fusing the global features and local features obtained in step S2 into the auxiliary classifier to obtain the weight of the feature map, and then multiplying it with the fused features to obtain a feature map with weights; S4, obtaining a generated medical image in another domain by taking the feature map as input to an adaptively normalized residual block and an upsampling decoder; S5. The generated medical image and the real medical image are simultaneously inputted through the encoder of the discriminator, and the authenticity of the generated medical image is predicted through cycle consistency and generative adversarial network. S6. Generate an adversarial network to transform the generated medical image into a real medical image.
2. According to claim 1, a medical image translation method based on cycle-consistent generative adversarial network is characterized in that: Medical images include MRI images and CT images.
3. According to claim 1, a medical image translation method based on cycle-consistent generative adversarial network is characterized in that: The two-stream neural network in step S2 obtains different types of features by constructing two different encoders, wherein the first encoder uses convolutional downsampling and residual network blocks to encode to obtain local features of medical images; the second encoder uses Swin-Transformer to encode to obtain global features of medical images.
4. According to claim 1, a medical image translation method based on cycle-consistent generative adversarial network is characterized in that: The auxiliary classifier in step S3 is respectively subjected to global maximum pooling and global average pooling, and then linearly transformed through a fully connected layer to obtain the weight of each fused feature map. The obtained weights are fused and the number of channels is changed through convolution to obtain the final feature map weight. The obtained weight information is multiplied with the fused feature map to obtain a feature map with weights.
5. According to claim 1, a medical image translation method based on cycle-consistent generative adversarial network is characterized in that: Image preprocessing uses the ImageEnance class of the PIL library to enhance and unify the contrast, brightness, chroma, and sharpness of the original medical image.
6. According to claim 2, a medical image translation method based on cycle-consistent generative adversarial network is characterized in that: The expression of image preprocessing is: p s (s k )=n k / n,0≤s k ≤1,k=0,1,2,...,L-1 RGB to HSV V=max(R,G,B) HSV to RGB C=V*S m=VC (R,G,B)=((R′+m)*255,(G′+m)*255,(B′+m)*255) where p s (s k ) is the probability of the kth gray level appearing in the original image, n k is the independent variable, L is the number of gray levels, EH(s k ) at 0≤s k In the range of ≤L-1, it is a single-valued single-increasing function. The grayscale mean is calculated through the image and a grayscale image is created to achieve the effect of contrast enhancement. R, G, and B represent the values of the three colors red, green, and blue, respectively. H, S, and V represent hue, saturation, and brightness, respectively. C represents the color value of the color, and X is a temporary variable used to help calculate the values of each component in RGB. m represents the minimum value of the color, which is the result of brightness minus color value. HSV is adjusted by image conversion and then converted back to RGB to achieve image correlation processing.
7. The medical image translation method based on cycle-consistent generative adversarial network according to claim 3, characterized in that: The expression of the two-stream neural network is: Input:(N,C in ,H in ,W in ) Output:(N,C out ,H out ,W out ) Where N, C, H, and W in the convolution encoder represent the batch size, number of channels, height, and width, respectively; padding represents the padding before convolution; dilation represents the filter with gaps between each point; kernel_size represents the size of the convolution on each channel; and stride represents the position interval of the applied filter; Q, K, and V in the Swin-Transformer encoder represent query, key, and value, respectively. k represents the vector dimension, and B represents the relative position bias.
8. The medical image translation method based on cycle-consistent generative adversarial network according to claim 1, characterized in that: The expression of feature fusion is: Among them, Z concat Represents the tensor after feature fusion, K represents the parameters of the convolution kernel, one feature image is used as the X domain, and the other feature image is used as the Y domain. C represents the number of channels. The number of channels of the concatenated tensor becomes 2C. The local features obtained by convolution and the global features of Swin-transformer are fused through concat concatenation, and then channel dimension reduction is performed through 1×1 convolution.
9. The medical image translation method based on cycle-consistent generative adversarial network according to claim 1, characterized in that: The expression for selecting cycle consistency is: Among them, L cycle Denotes the cycle consistency loss function L lsgan and L identity They represent the adversarial loss function and the identity loss function respectively, E represents the mathematical expectation, x represents the input image, D and G represent the discriminator and generator respectively, and |*|1 represents the L1 norm, also known as the Manhattan distance.
10. The medical image translation method based on cycle-consistent generative adversarial network according to claim 1, characterized in that: The expression of generating adversarial network is: D KID =max(eig(K gen -K real )) K gen and K real Represent the Gaussian kernel matrix of the feature space of the generated sample and the real sample, μ gen and μ real Represents the mean vector of the feature vector of the generated sample and the real sample, C gen and C real Represent the covariance matrix eig of the characteristic equations of generated samples and real samples respectively.
Citation Information
Patent Citations
Medical image segmentation method based on long and short distance features
CN114463341A
Multi-stage image description device with sparsity
CN116935386A
Two-stage full 3D aneurysm segmentation method and system
CN117710389A
Person re-identification system and method integrating multi-scale GAN and label learning
US20220374630A1
Cited By
Method, system and device for generating CTA image based on CT image and medium
CN119205966A
A method, system, device and medium for generating CTA images based on CT images
CN119205966B
Adversarial sample detection method based on neural network
CN119785185A
A Neural Network-Based Adversarial Sample Detection Method
CN119785185B
Artificial intelligence-based laryngeal tumor classification analysis method and device and storage medium
CN120355971A
