Pneumonia detection method based on cycle-consistent adversarial network with attention mechanism
By introducing attention mechanism and data enhancement technology into the cyclic consistency generative adversarial network, the accuracy and diversity of the cyclic consistency generative adversarial network under small sample data is solved, and the accuracy of medical image detection and pneumonia detection are improved. Performance of the model.
Patent Information
- Application Number
- CN202210588370.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-27
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2042-05-27
AI Technical Summary
The existing cyclic consistency generative adversarial network may reduce the quality and diversity of synthetic images in unpaired image conversion, and the accuracy of deep learning models is low in the case of small sample data, which is prone to overfitting, affecting medical images. Accuracy of detection.
Introduce attention mechanisms into a cyclic consistency adversarial network, separate image foreground and background by the attention network for separate synthesis, and use AttenCycleGAN and attention-guided data augmentation technology to improve the quality of image conversion and data set diversity, enhance the quality of image conversion and enhance the Model detection performance.
The image synthesis quality and diversity of the pneumonia detection model are improved, the model overfitting is reduced, the processing ability of small sample data is enhanced, and the accuracy and accuracy of medical image detection is significantly improved.
Smart Images

Figure CN115035055B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of medical image processing, and in particular to a pneumonia detection method based on a cycle-consistent adversarial network with an attention mechanism. Background Art
[0002] Generative adversarial networks (GANs) are widely used in small sample image expansion due to their advantages such as fast image synthesis speed and high quality. Cycle-consistent generative adversarial networks (AttenCycleGAN) are a type of improved GAN. It cleverly mirrors two traditional GANs to obtain a cycle-consistent network to achieve conversion between image domains without paired images, greatly reducing the threshold of image conversion, and its image conversion mode has become a paradigm for unsupervised image conversion. However, because it completes the synthetic conversion without paired images, it is an unsupervised learning process. The network does not know which areas in the image need to be converted, so it simply synthesizes every part of the image. For example, if the image of a horse is converted to synthesize the image of a zebra, if there is a person on the horse's back, it is possible that the person will be synthesized into a "zebra", and the resulting zebra image is a "zebra man". The above situation will reduce the quality and diversity of the synthesized image. The present invention separates the foreground of the image - "horse" and the background - other elements except the horse by adding an attention network to the generator, and synthesizes them separately, and then fuses the synthesized images of the two parts to obtain the final synthesized image. Adding an attention network aims to minimize the difference between the underlying data generation distribution of the entire image in the source domain and the target domain, seeking to obtain a synthetic image that is closer to the distribution of the real image. Adding attention to the image translation network significantly improves the quality of the translated image.
[0003] Computer vision based on the attention mechanism will teach the system to pay attention and measure the importance of different information features according to the information weight, which can solve the problem of small differences between detection samples. At the same time, it can also overcome the problems of slow manual detection, low efficiency and easy errors in the detection process. However, a good deep learning model is built on a large amount of training data. Even if an attention mechanism is added to the detection model to identify discriminable areas in the image, the accuracy of the model will be reduced when the amount of data is relatively small, and even overfitting will occur. Medical image detection is the key to analyzing medical images, and its detection accuracy affects the relevant evaluation process to a certain extent, so how to better solve the above problems has become the key to medical image analysis. Summary of the invention
[0004] The present invention introduces the visual attention mechanism into CycleGAN, making full use of the advantages of both. It can not only solve the detection problem of small samples, but also solve the problem of small differences between normal samples and abnormal samples, so as to improve the accuracy of medical image detection.
[0005] The present invention belongs to image detection technology based on computer vision technology. Computer vision is used to simulate the function of human vision, expand the collected image from specific objects, and finally perform actual detection, control and application. The present invention proposes a pneumonia detection method (AXCGAN) based on a cycle consistency adversarial network with an attention mechanism, which uses AttenCycleGAN and attention-guided data enhancement to expand the original image, greatly improving the performance of the detection model.
[0006] A pneumonia detection method based on a cycle-consistent adversarial network with an attention mechanism includes the following steps:
[0007] S1: Construct a detection model, which includes: a pneumonia X-ray image synthesis module and a pneumonia X-ray image detection (XCCNN network) module; the pneumonia X-ray image synthesis module is composed of a cycle consistency adversarial network (AttenCycleGAN) based on an attention mechanism, including a random data enhancement module, a generator (G Ax and F Ay ) and a discriminator (Dx and Dy); the pneumonia X-ray image detection (XCCNN) module includes an automatic data enhancement unit, a feature extraction unit, an attention-guided data enhancement unit, and a BAP feature fusion unit;
[0008] S2: Detecting the pneumonia X-ray image using the detection model: inputting the original lung medical image into the pneumonia X-ray image synthesis module to obtain a synthesized pneumonia X-ray image, and adding it to the original lung medical image to obtain an expanded lung medical data set;
[0009] The expanded lung medical image set is input into the pneumonia X-ray image detection (XCCNN network) module to obtain the final pneumonia X-ray map.
[0010] Furthermore, in step S2, the original lung medical image is input into the pneumonia X-ray image synthesis module to obtain a synthesized pneumonia X-ray image, and added to the original lung medical image to obtain an expanded lung medical data set. The specific process is as follows:
[0011] S201: Dataset division: The original lung medical images are divided into a training set and a test set in a ratio of 8:2; each data set is further divided into normal X-ray images and pneumonia X-ray images;
[0012] S202: Input the divided data into the random data enhancement unit of AttenCycleGAN to obtain preprocessed data;
[0013] S203: Model training: Use the dataset preprocessed in S202 to train the G of AttenCycleGAN Ax and F Ay and Dx and Dy;
[0014] S204: Model testing: input the test set in S201 into the model trained in S203 to obtain a synthesized pneumonia X-ray image;
[0015] S205: Adding the synthesized pneumonia X-ray image to the original lung medical image to obtain an expanded lung medical image set.
[0016] Furthermore, in step S2, the expanded lung medical image set is input into the pneumonia X-ray image detection (XCCNN network) module to obtain the final pneumonia X-ray image. The specific process is as follows:
[0017] S211: performing data enhancement on the input expanded lung medical image set using an automatic data enhancement method to obtain an automatically data enhanced image;
[0018] S212: Input the image after automatic data enhancement into the feature extraction unit of the XCCNN network to obtain a feature map of the image; perform data dimension reduction on the feature map of the image to obtain an attention map;
[0019] S213: Input the attention map into the attention-guided data enhancement unit to obtain a data-enhanced image;
[0020] S214: inputting the data-enhanced image together with the image automatically enhanced in step S211 into a feature extraction unit to extract its feature map and attention map;
[0021] S215: Input the attention map and feature map in S214 into the BAP feature fusion unit to obtain the fused features and obtain the final pneumonia X-ray image.
[0022] The technical solution provided by the present invention has the following beneficial effects:
[0023] A pneumonia detection model AXCGAN is proposed. This model introduces a cycle consistency adversarial network AttenCycleGAN based on the attention mechanism. Under the guidance of attention, the synthesis of pneumonia X-ray images is completed, which not only improves the quality and diversity of the synthesized images, but also performs data expansion to solve problems such as model overfitting caused by small data. On the other hand, attention-guided data enhancement is used to increase the diversity of training data to enhance the ability to locate the recognizable parts in the original image, solve the problem of small differences between normal images and diseased images, thereby obtaining better medical image detection performance and improving the detection accuracy of medical images. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The specific effects of the present invention will be further described below in conjunction with the accompanying drawings and embodiments, in which:
[0025] Figure 1 It is a specific flow chart of a pneumonia detection method (AXCGAN) based on a cycle-consistent adversarial network with attention mechanism in the present invention;
[0026] Figure 2 It is an architectural diagram of the detection model of the present invention.
[0027] Figure 3 It is a schematic diagram of the pneumonia X-ray image synthesis module in the detection model of the present invention.
[0028] Figure 4 It is a schematic diagram of the cycle consistency constraints in the pneumonia X-ray image synthesis module in the detection model of the present invention.
[0029] Figure 5 It is a schematic diagram of forward synthesis in the pneumonia X-ray image synthesis module in the detection model of the present invention. DETAILED DESCRIPTION
[0030] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, specific embodiments of the present invention are now described in detail with reference to the accompanying drawings.
[0031] refer to Figure 1 and Figure 2 ; A pneumonia detection method based on attention mechanism-based cycle consistency adversarial network (AXCGAN), including the following steps:
[0032] S1: Construct a detection model, which includes: a pneumonia X-ray image synthesis module and a pneumonia X-ray image detection (XCCNN network) module; the pneumonia X-ray image synthesis module is composed of AttenCycleGAN, which includes a random data enhancement module, a generator (G Ax and F Ay ) and a discriminator (Dx and Dy); the pneumonia X-ray image detection (XCCNN) module includes an automatic data enhancement unit, a feature extraction unit, an attention-guided data enhancement unit, and a BAP feature fusion unit;
[0033] Specifically, refer to Figure 3 , AttenCycleGAN has two attention-guided synthesis generators (denoted as G Ax and F Ay ) and two discriminators (denoted as Dx and Dy).
[0034] The generator is used to generate samples. During training, its generation ability is improved as much as possible, and it can be infinitely close to the real image. Ax It is used to learn the mapping from the source domain X (i.e., normal X-ray images) to the target domain Y (i.e., pneumonia X-ray images), and convert the X-domain images into Y-domain images, i.e., G Ax :X→Y; F Ay It is used to learn the mapping from the target domain Y to the source domain X, and convert the Y domain image into the X domain image, that is, F Ay :Y→X;
[0035] The discriminator improves its recognition ability as much as possible during training, and can accurately identify the generated fake images. Among them, Dx is used to determine whether the generated sample belongs to X, and Dy is used to determine whether the generated sample belongs to Y. The input data set is the X domain, and each image x, y in the Y domain, where x, y obeys the data distribution of x~p data(x) , x∈X and y~p data(y) , y∈Y;
[0036] The generator and the discriminator are engaged in adversarial games during the training process, and the goal is that the generator can produce relatively good outputs during the adversarial learning process; G Ax and D y The loss function is formula 1:
[0037]
[0038] F Ay and D x The loss function is formula 2:
[0039]
[0040] Among them, the loss function refers to the samples taken in the X domain, refers to samples taken from the X domain; and is the discriminator D y and D x loss; and is the generator G Ax and G Ay loss;
[0041] For Formula 1, y represents the sample taken from the Y domain, x represents the sample taken from the X domain, and G(x) represents the generator G Ax The generated image, D y (y) represents the discriminator D y The probability of judging whether y is a sample taken from the Y domain, and D y (G(x)) represents the discriminator D yJudgement generator G Ax The probability of whether the generated image is a sample taken from the Y domain.
[0042] Generator G Ax We hope that the images we generate are "as close to samples in domain Y as possible"; that is, the generator G Ax Hope D y (G(x)) is as large as possible, then log(1-D y The smaller (G(x)) is, the smaller L GAN (G Ax ,D y ,X,Y) will become smaller, G Ax I should hope that L GAN (G Ax ,D y ,X,Y) the smaller the better; the discriminator D y The stronger the ability, the y (y) should be larger, D y (G(x)) should be smaller; therefore D y The purpose and G Ax Different, D y I should hope that L GAN (G Ax ,D y ,X,Y) the larger the better.
[0043] refer to Figure 4 , in the adversarial training process of the generator and the discriminator, a cycle consistency constraint is introduced, which is specifically manifested as follows:
[0044] Each image x, y in the input dataset X, Y, the image returned after the loop is close to the original data. The input image x passes through the generator G Ax and F Ay After conversion, the image x' is finally restored to be close to the original source domain distribution; in order to ensure that the input and output of the two networks are as consistent as possible, the cycle consistency loss is used to constrain them; for the reverse, it is necessary to ensure that the output y' is close to the input y, that is, x→G Ax (x)→F Ay (G Ax (x))≈x' and y→F Ay (y)→G Ax (F Ay (y))≈y', that is, the cycle conversion of X→Y→X and Y→X→Y is completed; the cycle consistency loss function is formula 3:
[0045]
[0046] Among them, the loss function refers to the samples taken in the X domain, refers to the samples taken from the Y domain, They are the forward loop loss starting from the source domain X and the reverse loop loss starting from the target domain Y.
[0047] Furthermore, each generator adds an attention network, see Figure 5 The attention network generates an attention map in the discriminative region between the source domain and the target domain to constrain the attention map to the relevant image region and guide the transformation synthesis of the discriminative region, so as to improve the synthesis quality of the discriminative region in the image and the diversity of the synthesized image; the added attention network includes Ax and Ay, where Ax is responsible for the generation of attention maps from domain X to domain Y, and Ay is responsible for the generation of attention maps from domain Y to domain X.
[0048] Attention-guided generator G Ax and F Ay Synthesis, specifically:
[0049] The image is input into the attention network Ax and Ay in the generator, which respectively generates a mapping G from the source domain to the target domain. Ax (x) and G Ay (y), attention map x a =Ax and y a =Ay;
[0050] For image conversion from domain X to domain Y: First, create an “image foreground” by cross-multiplying the mapping from source domain X to target domain Y with the attention map to obtain the discriminative region in the image, i.e., the “image foreground” x f =G Ax (x)⊙Ax; Second, create an "image background" x b =G Ax (x)⊙(1-Ax); Finally, the “image foreground” and “image background” are fused to obtain the transformation of the target domain, that is, the pneumonia X-ray image is x f +x b ;
[0051] For image conversion from domain Y to domain X: First, create an “image foreground” by cross-multiplying the mapping from target domain Y to source domain X and the attention mapping to obtain the discriminative region in the image, i.e., the “image foreground” y f =G Ay (y)⊙Ay; Second, create an “image background” y b =G Ay (y)⊙(1-Ay); Finally, the “image foreground” and “image background” are fused to obtain the transformation of the target domain, that is, the pneumonia X-ray image is y f +y b .
[0052] S2: Detecting the pneumonia X-ray image using the detection model: inputting the original lung medical image into the pneumonia X-ray image synthesis module to obtain a synthesized pneumonia X-ray image, and adding it to the original lung medical image to obtain an expanded lung medical data set;
[0053] The expanded lung medical image set is input into the pneumonia X-ray image detection (XCCNN network) module to obtain the final pneumonia X-ray map.
[0054] Furthermore, in step S2, the original lung medical image is input into the pneumonia X-ray image synthesis module to obtain a synthesized pneumonia X-ray image, and added to the original lung medical image to obtain an expanded lung medical data set. The specific process is as follows:
[0055] S201: Dataset division: The original lung medical images are divided into a training set and a test set in a ratio of 8:2; each data set is further divided into normal X-ray images and pneumonia X-ray images;
[0056] S202: Input the divided data into the random data enhancement of AttenCycleGAN to obtain preprocessed data;
[0057] S203: Model training: Use the dataset preprocessed in S202 to train the generator G of AttenCycleGAN Ax and F Ay and discriminators Dx and Dy;
[0058] S204: Model testing: input the test set in S201 into the model trained in S203 to obtain a synthesized pneumonia X-ray image;
[0059] S205: Adding the synthesized pneumonia X-ray image to the original lung medical image to obtain an expanded lung medical image set.
[0060] Furthermore, in step S2, the expanded lung medical image set is input into the pneumonia X-ray image detection (XCCNN network) model to obtain the final pneumonia X-ray image. The specific process is as follows:
[0061] S211: performing data enhancement on the input expanded lung medical image set using an automatic data enhancement method to obtain an automatically data enhanced image;
[0062] S212: inputting the image after automatic data enhancement into the feature extraction unit of the pneumonia X-ray image detection model to obtain a feature map of the image; performing data dimension reduction on the feature map of the image to obtain an attention map;
[0063] S213: Input the attention map into the attention-guided data enhancement unit to obtain a data-enhanced image;
[0064] S214: inputting the data-enhanced image together with the image automatically enhanced in step S211 into a feature extraction unit to extract its feature map and attention map;
[0065] S215: Input the attention map and feature map in S214 into the BAP feature fusion unit to obtain the fused features and obtain the final pneumonia X-ray image.
[0066] The final lung X-ray image can be further input into the fully connected layer FC for classification or subsequent application. The present invention aims to improve the detection accuracy of pneumonia X-ray images.
[0067] In order to better explain the present invention, a specific implementation case using the method of the present invention is provided. The following case tests the proposed AXCGAN on a well-known benchmark dataset ChestX-Ray 2017. The proposed AXCGAN is implemented based on Pytorch and runs on RTX 2080Ti GPU hardware.
[0068] The data set used in this embodiment is the ChestX-Ray 2017 data set, which contains 5232 children's lung X-ray images, including 3883 pneumonia images and 1349 normal images. The training set and the test set are divided into 8:2 ratios, and 1000 pneumonia images are synthesized using the pneumonia X-ray image synthesis model and added to the training set to obtain the expanded data set, which is then input into the XCCNN network. Therefore, 5186 lung X-ray images participate in the XCCNN network training, and 1046 images are used to test the trained network.
[0069] Table 1 Comparison of detection accuracy between AXCGAN and other methods (%)
[0070]
[0071] The results of AXCGAN on the ChestX-Ray 2017 dataset are shown in Table 1. The accuracy of the invention is 99.32%. [1] TLPD [2] DL-DEPC [3] , CP-CNN [4] , DCNN [5] 、ACNN-RF [6]The average accuracies are 92.80%, 96.39%, 92.57%, 95.30%, 96.09% and 96.90% respectively. It can be seen that AXCGAN has a good effect in medical image detection.
[0072] Special note: The present invention is not directly applied to, or is not directly intended for, disease diagnosis and evaluation. The present invention is intended to improve the accuracy of medical image detection.
[0073] The beneficial effects of the present invention are as follows: a detection model AXCGAN is proposed, AttenCycleGAN is introduced, and the synthesis of pneumonia X-ray images is completed under the guidance of attention, which not only improves the quality and diversity of the synthesized images, but also performs data expansion to solve the problem of model overfitting caused by small data; on the other hand, attention is used to guide data enhancement to increase the diversity of training data to enhance the ability to locate the recognizable parts in the original image, solve the problem of small differences between normal images and diseased images, thereby obtaining better medical image detection performance and improving the detection accuracy of medical images.
[0074] [1]Kermany DS,Goldbaum M,Ca IW,et al.Identifying Medical Diagnoses and Treatable Diseases by Image-Based Deep Learning[J].Cell,2018,172(5):1122-1131.e9.
[0075] [2]Chouhan V,Singh SK,KhampariaA,et al.ANovel Transfer LearningBased Approach for Pneumonia Detection in Chest X-ray Images[J].AppliedSciences,2020,10(2):559.
[0076] [3]Hammoudi K, Benhabiles H, Melkemi M, et al. Deep Learning on Chest X-ray Images to Detect and Evaluate Pneumonia Cases at the Era of COVID-19[J]. 2020.
[0077] [4]Saraiva A,Ferreira N,Sousa L,et al.Classification of Images ofChildhood Pneumonia using Convolutional Neural Networks[C] / / 6th InternationalConference on Bioimaging.2019.
[0078] [5]Yi R,Tang L,Tian Y,et al.Identification and classification ofpneumonia disease using a deep learning-based intelligent computationalframework[J].Neural Computing andApplications, 2021(4):1-14.
[0079] [6] Wu H, Xie P, Zhang H, et al. Predict pneumonia with chest X-ray images based on convolutional deep neural learning networks [J]. Journal of Intelligent and Fuzzy Systems, 2020, 39(12): 1-15.
[0080] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0081] The serial numbers of the embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments. In a unit claim that lists several means, several of these means may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order and these words may be interpreted as identifiers.
[0082] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A pneumonia detection method based on a cycle-consistent adversarial network with an attention mechanism, characterized in that: The following steps are involved: S1: Construct a detection model, which includes: a pneumonia X-ray image synthesis module and a pneumonia X-ray image detection module; the pneumonia X-ray image synthesis module is composed of a cycle-consistent adversarial generative network based on an attention mechanism, and the pneumonia X-ray image synthesis module includes: a random data enhancement unit, an attention-guided synthesis generator and a discriminator; the pneumonia X-ray image detection model includes: an automatic data enhancement unit, a feature extraction unit, an attention-guided data enhancement unit and a BAP feature fusion unit; the cycle-consistent adversarial generative network based on the attention mechanism includes: two attention-guided synthesis generators and a discriminator, wherein the two generators are denoted as GAx and FA respectively. y, the two discriminators are denoted as Dx and Dy respectively; the generator is used to generate samples, and its generation ability is improved as much as possible during training, which can infinitely approach the real image, among which GAx is used to learn the mapping from source domain X to target domain Y, and convert the X domain image into the Y domain image, that is, GAx:X→Y; FAy is used to learn the mapping from target domain Y to source domain X, and convert the Y domain image into the X domain image, that is, FAy:Y→X; the discriminator improves its recognition ability as much as possible during training, and can accurately identify the generated fake images, among which Dx is used to judge whether the generated sample belongs to X, and Dy is used to judge whether the generated sample belongs to Y; the input data set is the X domain, and each image x, y in the Y domain, where x, y obey the data distribution as follows , and , ; The generator and the discriminator are in adversarial game during the training process, and the goal is that the generator can produce relatively good output during the adversarial learning process; The loss function of GAx and Dy is formula 1: The loss function of FAy and Dx is formula 2: Among them, the loss function refers to the samples taken in the X domain, refers to samples taken from the X domain; and is the loss of the discriminator Dy and Dx; and is the loss of generator GAx and GAy; for Formula 1, y represents the sample taken from the Y domain, x represents the sample taken from the X domain, and G(x) represents the image generated by the generator GAx, represents the probability that the discriminator Dy determines whether y is a sample taken from the Y domain, and It represents the probability that the discriminator Dy determines whether the image generated by the generator GAx is a sample taken from the Y domain; S2: Detecting the pneumonia X-ray image using the detection model: inputting the original lung medical image into the pneumonia X-ray image synthesis module to obtain a synthesized pneumonia X-ray image, and adding the synthesized pneumonia X-ray image to the original lung medical image to obtain an expanded lung medical data set; The expanded lung medical image set is input into the pneumonia X-ray image detection module to obtain a final pneumonia X-ray image.
2. The pneumonia detection method based on the cycle-consistent adversarial network with attention mechanism as claimed in claim 1, characterized in that: The random data enhancement unit is used to preprocess the input lung medical original image, and the preprocessing method includes: center cropping, color jittering, random rotation and random combinations thereof.
3. The pneumonia detection method based on the cycle-consistent adversarial network with attention mechanism as claimed in claim 1, characterized in that: Each generator adds an attention network, which generates an attention map in the discriminative area between the source domain and the target domain to constrain the attention map to the relevant image area and guide the transformation synthesis of the discriminative area, so as to improve the synthesis quality of the discriminative area in the image and the diversity of the synthesized image; the added attention network includes A x and A y , where A x is responsible for generating the attention map from domain X to domain Y. y It is responsible for generating the attention map from domain Y to domain X.
4. The pneumonia detection method based on the cycle-consistent adversarial network with attention mechanism as claimed in claim 3 is characterized in that: Attention Guided Generator G Ax and F Ay Synthesis, specifically: Image input to the attention network A in the generator x and A y In the above example, we generate the mapping from source domain to target domain. G Ax ( x )and G Ay ( y ), Attention Mapping x a =A x and y a =A y ; For image conversion from domain X to domain Y: First, create an "image foreground" by cross-multiplying the mapping from source domain X to target domain Y with the attention map to obtain the discriminative area in the image, namely the "image foreground" ; Second, create an "image background" ; Finally, the “image foreground” and “image background” are fused to obtain the transformation of the target domain, that is, the pneumonia X-ray image is x f + x b ; For image conversion from domain Y to domain X: First, create an "image foreground" by cross-multiplying the mapping from target domain Y to source domain X and the attention mapping to obtain the discriminative area in the image, namely the "image foreground" ; Second, create an "image background" ; Finally, the “image foreground” and “image background” are fused to obtain the transformation of the target domain, that is, the pneumonia X-ray image is y f + y b .
5. The pneumonia detection method based on the cycle-consistent adversarial network with attention mechanism as claimed in claim 1, characterized in that: During the adversarial training of the generator and the discriminator, cycle consistency constraints are introduced, which are specifically manifested in: For each image in the input dataset X, Y x , y , the images returned after the loop are close to the original data, the input image x Through the generator GAX and FAY After conversion, the image is finally restored to a distribution close to the original source domain. x '; In order to ensure that the input and output of the two networks are as consistent as possible, the cycle consistency loss is used to constrain them; for the reverse, the output y 'Approximate input y ,Right now x →GA x ( x )→FAy(GA x ( x ))≈ x 'and y →FAy( y )→GA x (FAy( y ))≈ y ', that is, the cycle conversion of X→Y→X and Y→X→Y is completed; the cycle consistency loss function is formula 3: Among them, the loss function refers to the samples taken in the X domain, refers to the samples taken from the Y domain, , They are the forward loop loss starting from the source domain X and the reverse loop loss starting from the target domain Y.
6. The pneumonia detection method based on the cycle-consistent adversarial network with attention mechanism as claimed in claim 1, characterized in that: The total loss of the generated network based on the cycle consistency of the attention mechanism is as follows: in, yes G Ax and D y The loss function of yes G Ay and D x The loss function of is the cycle consistency loss function; λ controls the relative importance of the two objectives; The final optimization function of the cycle-consistent adversarial generative network based on the attention mechanism is to solve the maximum and minimum adversarial problem, as shown in Formula 5: 。 7. The pneumonia detection method based on the cycle-consistent adversarial network with attention mechanism as claimed in claim 1, characterized in that: In step S2, the original lung medical image is input into the pneumonia X-ray image synthesis module to obtain a synthesized pneumonia X-ray image, which specifically includes: S201: dividing the original lung medical images into a training set and a test set according to a certain ratio; each data set is further divided into normal X-ray images and pneumonia X-ray images; S202: Input the divided data into a random data enhancement unit to obtain preprocessed data; S203: Use the preprocessed data set to train the generator and discriminator of the cycle consistency adversarial network based on the attention mechanism; S204: the test set is input into the trained model to obtain a synthetic pneumonia X-ray image; S205: Adding the synthesized pneumonia X-ray image to the original lung medical image to obtain an expanded lung medical image set.
8. The pneumonia detection method based on the cycle-consistent adversarial network with attention mechanism as claimed in claim 1, characterized in that: In step S2, the expanded lung medical image set is input into the pneumonia X-ray image detection module to obtain the final pneumonia X-ray image, which specifically includes: S211: performing data enhancement on the input expanded lung medical image set using an automatic data enhancement method to obtain an automatically data enhanced image; S212: inputting the image after automatic data enhancement into the feature extraction unit of the pneumonia X-ray image detection model to obtain a feature map of the image; performing data dimension reduction on the feature map of the image to obtain an attention map; S213: Input the attention map into the attention-guided data enhancement unit to obtain a data-enhanced image; S214: inputting the data-enhanced image together with the image automatically enhanced in step S211 into a feature extraction unit to extract its feature map and attention map; S215: Input the attention map and feature map in S214 into the BAP feature fusion unit to obtain the fused features and obtain the final pneumonia X-ray image.
9. The pneumonia detection method based on the cycle-consistent adversarial network with attention mechanism as claimed in claim 1, characterized in that: The attention-guided data enhancement unit includes two types of data enhancement: attention cropping and attention erasing.
