System segmentation of Lungs in images chest x-ray using the generative adversarial network

— One of the most common medical imaging methods is a chest x-ray, as it contributes to the early detection of lung cancer compared to other methods. this work presents the use of a generative adversarial network to perform lung chest x-ray image segmentation. The network is two frameworks neural (generator and discriminator). In our work the generator is trained to generate a mask for the input of a given original image, the discriminator distinguishes between the original mask and the generated mask, the final objective is to generate masks for the input. The model is trained and evaluated, well generalized experimental results of the JSRT dataset reveal that the proposed model can a dice score of 0.9778, which is better than other reported state-of-the-art results .


INTRODUCTION
From the early days, artificial intelligence has been a hot topic in research and is now an omnipresent concept when it comes to medical imaging.This term, sometimes a bit overused, also gives rise to false ideas or feeds hopes of a medical revolution.In support of doctors and their expertise, Artificial Intelligence provides access to new insights and improves diagnostic accuracy.Indeed, from the multiple information contained in software and machines using artificial intelligence, medical professionals now have powerful and efficient tools to improve their diagnosis.Based on neural networks and deep learning techniques [1], Artificial Intelligence is becoming a considerable asset in the evolution and improvement of medicine.In the field of medical image analysis, artificial intelligence is very useful in two areas: image classification and organ segmentation.Image classification algorithms can aid in the diagnosis by classifying the image into a specific category of pathology.Image segmentation algorithms [2] images are commonly used on all modalities of imaging like x-rays and magnetic resonance imaging scans, ultrasound, and computed tomography was performed with positron emission tomography.Chest x-ray is often more common with other medical imaging [3].
The chest x-ray is a type of electromagnetic radiation, similar to visible light.Unlike light, however, x-rays have higher energy and can pass through most objects of the body where are used to generate images of tissues and structures inside the body.In through publicly available, official data of the National Health Service [4].There were 44.9 million imaging tests reported in England in the year to March 2020, compared with 44.8 million the previous year, an increase of 0.3%, Of these, 23.2 million are X-ray examinations.Many of these imaging tests can contribute to the early detection of cancer to identify lung nodules, and segmentation of the lung from chest X-rays is essential, and this is a vital step in diagnostic pipelines as well as calculating the heart-to-chest ratios, which is essentially an indicator of its cardiomegaly.
For this, we must search for an algorithm capable of performing the segmentation task well in the medical imaging field that is desired.
In this work, we propose using generative adversarial networks for segmentation.Since it showed excellent results in previously reported studies, instead of widely used techniques like Mask-RCNN, U-Net, etc. Generative adversarial networks are two models, generator and critic, competing with each other while making each other stronger at the same time.This model includes a generator similar to U-net architecture and discriminator which is a classifier between truth masks and the is generated.We demonstrate that model produces highly realistic and accurate segmentation and is able to a dice score of 0.9778 which is better than other reported state-of-theart.

II. RELATED WORK
In lung segmentation problems, one needs to classify an image into three categories: (1) Systems based on a predefined set of rules apply morphological and threshold operations derived from inference [5].Methods for classifying pixels are based on whether they are within or outside the lung areas the intensity of the pixels [6].(3) Deformed model-based methods such as the Active Appearance Model (ASM) [7].Regarding our problem, our review focused on a range of studies.The authors have the lungs before further treatment.For example, the authors in [8] stratified lung regions before applying further treatment to detect Covid19.In another work, the authors of [9] proposed a technique for detecting circular objects in chest radiographs and showed that segmenting the lungs increases performance.Next, in [10], the authors proposed a deep learning-based method for the semantic segmentation task.They used the existing AlexNet and VGG-Net models to classify and assign them to fully convolutional networks and then performed a segmentation using the output of these networks.in [11], The authors proposed a network for the task of segmenting neural structures in electron microscopy and called it U-net, which is a U-like structure, consisting of two parts the encoder, and the decoder.They also used skip connections between the encoder and decoder layers, which improved the performance of the overall segmentation.In [12], the authors proposed a deep belief network to correct vertebral segmentation in CT images.They showed that the adopted model was better than the traditional techniques.In [13], They are authors trained a GAN to search lung nodes, using synthetic data, trained a Progressive Comprehensive Network (PHNN) for segmentation.The generator was adapted to the size of the interest and thus was able to create realistic 3D lung nodules.The accuracy of P-HNN has been improved.In [14], the authors proposed to generate vessel maps for retinal images using GAN for the segmentation task.They have achieved a competitive dice score on the DRIVE and STARE datasets [14].In MI-GAN [36], the authors used a framework to create synthetic medical images with their segmented masks.They used it to train the hash network, and the authors reported the latest dice results on the DRIVE and STARE datasets [15].The authors showed through experiments with MRI and brain CT scans that using GANs to augment the data can improve the segmentation result, especially when the training data is small [16].In [17], the authors created chest Xrays and their segmented masks.The image quality was found to be lower when creating the pair, compared to creating a chest X-ray only.In [18], the authors proposed using the Structure Correcting Adversarial Network the topology that includes a cash network to direct the convolutional hash network to achieve high accuracy segmentation of chest x-ray organs by employing on the JSRT dataset, and they have achieved a competitive dice score.In [20], the authors proposed to use Semantic Segmentation with the fully convolutional network.In recent times, [19] adversarial training has been applied to semantic segmentation and optimization training has been seen using models such as the VGG network that classify images at scale [19].the authors proposed in [21] to use Attention U-Net, in which the FCN used in [20] has been replaced by the Attention U-Net.They did not make any modifications to the critic model design.They did not make any modifications to the critical model design # lungs from chest X-ray images and used the model in datasets JSRT, Montgomery, and Shenzhen [24].The model can achieve a dice score of 0.9740.In the work [22], the authors proposed a generative model of adversarial networks that includes a generator similar to a U-net structure and four different discriminators that are binary classifiers for segmenting lungs from chest X-ray images and used the model in the JSRT, Montgomery, and Shenzhen datasets [24].The model can achieve a dice score of 0.9740.
In Section following generative adversarial networks are discussed and the methodology of our work.We will discuss the proposed architecture for segmentation in the same section.

III. METHODOLOGY
In this section, the overall architecture for the Generative adversarial network is discussed, and the data description that we will use to evaluate our model.

A. Generative Adversarial Network.
Generative adversarial network (GAN) is a class of unsupervised learning algorithms.These algorithms were introduced by Goodfellow and al. 2014 [25].They allow the generation of images with a high degree of realism.GAN is a generative model where two networks are deposed in competition in a game theory script.The initial network is the generator G, it generates a sample (e.g. an image), while its adversary, the discriminator D tries to detect whether a sample is real or is the result of the generator.Learning is capable of being modeled as a zero-sum game.As an alternative can trick the discriminator to offer a high probability, figure 1 presents the architecture of the GAN.The function of the original GAN is provided as described in [25] by minimizing and maximizing the V, Equation 1shows that: So that y is the real data, z is random data, D(y) is the prediction of the discriminator on y, G(z) is the data generated by z noise, and D(G(z)) is the prediction of the discriminator on the generated data.Both the generator and the discriminators play the min-max game and adapt their parameters based on the actions of the other.After a number of learning iterations, it's feasible that both networks have parameters that can no longer be optimized.At this point, the generator generates synthetic data with a truly realistic appearance, so the discriminator isn't capable to distinguish the real data from the generated data.

B. Generator Architecture Utmost of the work.
In GANs the structure of the encoder and decoder type is given for generator networks.Since it allows us to use the noise code in a natural and best way.The encoder outputs the feature from image, as it's a multi-layer neural network.So that it extracts regional features in the first layers, and by going deeper, it folds more global information.After this, the first layers of the encoder reduce the input to the bottleneck, and from that, the decoder condenses the samples. of our generator model is more complex than the discriminator model.The generator is a model encoder-decoder using a U-Net architecture.The model takes an input image and generates a target image.It does this by first downsampling or garbling the input image to a bottleneck layer, and also upsampling or decoding the bottleneck representation to the size of the output image.U-Net architecture means that hop connections are added between the coding layers and the corresponding decoding layers, forming a U shape.Architecture doesn't need random noise because it learns to ignore it so doesn't ameliorate results, the general structure of the generator is shown in Figure 2.

C. Discriminator.
The Discriminator has the job of holding two images, an input image, and deciding whether the other image was produced by the generator or not.The discriminator is a deep convolutional neural network whose function is to classify the input image as real or false.architecture network is of the form convolutionbatch normalization-activation.The discriminator first takes either the lung mask, the image produced by the generator network, or the true ground lung mask.After that, it categorizes each image as fake or real.Discriminator configurations similar to the image discriminator or the patch discriminator are used [26].The main difference between the image discriminator and the patch discriminator is that the image discriminator predicts the entire image by mapping the input image to a single digital output, while the image-correction discriminator maps each patch to a single digital output by splitting the input into a set of corrections.As [26], They solved the problem of blurry images caused by failures at high frequencies such as edges using the correction discriminator.The debug discriminator has another advantage in that it has fewer parameters compared to the full image discriminator.Thus, it works better with very large arbitrary images and reduces computational time.The general structure of the discriminator in our work is shown in Figure 3.
The discriminator in our work takes two images, mask real and mask generated by the generator, two sequences together that are categorized as real or fake.The model is optimized using binary cross-entropy.The network in this work consists of six layers, one of which is the input, four layers of the Relu convolution batch normalization model are hidden, and the last is a final output layer.For the used discriminators, the step size and kernel were fixed using the values 2 and 4 × 4, respectively.

D. Datasets
For training and validation data to evaluate our model, we used the Japan Society of Radiological Technology (JSRT) dataset [27].The JSRT contains 247 images, 154 of which contain pulmonary nodules.The X-rays all have a resolution of 2048 × 2048 and 12-bit grayscale, this dataset, is also available for lung and heart segmentation masks.

IV. EXPERIMENTS AND RESULTS
All experiments were performed using the Colab GPU with 12 GB of memory.The aforementioned ' was implemented using Python was as programming due to its wide use and easy-to-use built-in libraries.The implementation of the architecture is based on the Keras and Tensorflow libraries.To optimize the network, Adam's technique was taken with a learning rate of 0.0002 and a decay rate of 0.5, because they showed superior performance in our results.
The model we presented for our dataset was trained on 40 epochs with 3 x-ray scans per batch and a dimension of 512*512.To evaluate our segmentation network, we calculated a dice score coefficient (DSC), which are widely accepted evaluation metrics for imaging segmentation.The dice score is determined by Equation 2: Where X is the anticipated set of pixels and Y is the ground truth.
Using our model, we were able to obtain a standard dice score of 0.9778 for the lungs better than other reported results of different architectures in our dataset.Our model performed very well, even though the test came from different data sets.Generally, in the segmentation tasks, there are two anomalies: (1) Over-segmentation, (2) Under-segmentation.Oversegmentation occurs if non-interest pixels are classified as useful and important.Under-segmentation refers to the scenario in which classified some important pixels as background pixels.
Figure 5 shows the cases of segmentation results.V. CONCLUSION This work presents the GAN U-Net architecture framework that implements a segmentation model for the lung in chest Xray images.Our method has achieved a dice score that is better than other reported results for lung segmentation compared.One of the limitations of the proposed generative adversarial network is that it requires a lot of computing power.Besides, in future works, we will use our model on other datasets with different image sizes in order to better understand the role of the GAN architecture and to do a comparative study of results and performance.

FIGURE 1
FIGURE 1 GAN ARCHITECTURE.G THE STRUCTURE OF THE GENERATOR IS A U-NET NETWORK THAT WE GIVE THE X-RAY IMAGES AND ITS MASK.D DISCRIMINATION NETWORK, A SIMPLE CONVOLUTIONAL NEURAL NETWORK THAT INPUTS THE GROUND TRUTH IMAGE IS CLASSIFIED WITH THE IMAGE GENERATED BY THE GENERATOR INTO BINARY, IE, "0" OR "1".
The data was split by a technique train-test split, 160 images are used for training, 40 are used for validation, and 40 images were used for testing.160 images were used for training, 40 images for validation, and 40 images for testing.

FIGURE 3 SHOWS
FIGURE 3 SHOWS THE STRUCTURE OF DISCRIMINATION.THE MASK CONCATENATION AND THE MASK SEGMENTED ARE GIVEN AS INPUT TO THE DISCRIMINATOR, AFTER WHICH IT IS CLASSIFIED, IT PREDICTS WHETHER THE INPUT IS REAL OR FAKE.

FIGURE 4 DICE
FIGURE 4 DICE SCORE COEFFICIENT RESULTS FOR OUR MODEL.

FIGURE 5 RESULTS
FIGURE 5 RESULTS CASES FOR OVER-SEGMENTATION AND UNDER-SEGMENTATION.AS CAN BE SEEN IN INPUT IMAGES, SHOW A SLIGHT UNDER SEGMENTATION IN (A) DUE TO SOME LOW VARIANCE IN THE LEFT LUNG.IN(B), THE AREA AROUND THE LUNGS SHOWS A REGULAR INTENSITY VARIATION, RESULTING IN OVER-SEGMENTATION.(C) SEGMENTATION CAN BE SEEN AS THE BEST PERFORMANCE.

TABLE 1 .
DICE SCORE COMPARISON BETWEEN OF DIFFERENT ARCHITECTURES IN OUR DATASET.