# Classification and Predictions of Lung Diseases from Chest X-rays Using MobileNet V2
## 3 Dataset  
The ChestX-ray14 database [20] was used to develop deep learning algorithms. This database is currently one of the largest public X-ray databases, containing 112 back-to-front and front-to-back thoracic films from 30,805 unique patients. Each image was annotated with as many as 14 different thoracic pathological ethics, which were selected based on the frequency of observation and diagnosis in clinical practice. The label of each image was obtained with the automatic extraction method in the radiological report, and each image produced 14 binary values (Atelectasis, Cardiomegaly, Consolidation, Edema, Effusion, Emphysema, Fibrosis, Hernia, Infiltration, Mass, Nodule, Pleural Thickening, Pneumonia, Pneumothorax). Some of them are provided in Figure 1, where 0 means that the pathology does not exist and 1 means that there are many pathologies in each image. Figure 1: Six examples of the ChestX-ray14 dataset. ChestX-ray14 consists of 112,120 frontal chest X-rays from 30,805 patients. All images are labeled with up to 14 pathologies or “No Finding”. The dataset does include acute findings, such as the “Nodule” (**f**), and also treated patients with a drain, such as “Pneumothorax” (**d**). We show the distribution of each class illustrated in Figure 2. The prevalence of individual pathologies is generally low and varies between 0:2% and 17:74%, as shown in Table 1(a), while the distribution of patient gender and view position is quite low. Even with a ratio of 1.3 and 1.5, respectively (see Table 1(b)), most of the data image samples were biased, as we got \"Infiltration\" as the most frequent with (9546) image samples, while the least frequent was \"Hernia\", with just 227 samples. \"Emphysema\",\" Fibrosis\",\" Edema\" Pneumonia\", were close to each other, but were lower, with the number of samples between (322) and (727). For the other diseases, like in Figure 1(a), the frequency of classes was over 1093 and under 4214. This class imbalance issue will have had a huge impact on the result. Next, we create the data generator to do data augmentation and split the dataset into training, validation, and testing. Figure 1(b),c illustrates the distribution of the least frequent disease, \"Hernia\", and the most frequent, \"Infiltration\", with respect to the meta-information (age, gender, negative case, or positive case). Figure 2: The distribution of diseases in the dataset: the figures (**a**,**b**) represent the least frequent disease, “Hernia”, and the most frequent disease, “Infiltration”, and include (**c**) the meta-information which are age, gender, case positive or negative. For the split, we used a built function from the \"sklearn\" library called \"train_test_split\", and we got 38,819 image samples for the training, and for validation/testing we got, successively, 12,940 and 12,940. The dataset was imbalanced and biased, as the difference between \"Hernia\" (227 samples) and \"Infiltration\" (more than 17,000 samples) shows. We tried to focus on the positive and negative frequency. As we can see in Table 2, the false class samples were much higher than the true class samples (Ex: Edema True: 2303, False: 109,817 prevalence: 2.05%). To solve the class imbalance problem, we tried to include meta-information. At first, we used the patient age as the reference and then balanced the positive and negative samples for each disease by multiplying the weight of the positive cases with the negative sample frequency and did the same for the negative weight. The result is better illustrated in Figures 3 and 4 for both the least most disease frequencies.