COVID-19 detection in Chest X-ray Images using Deep Learning



COVID-19 is an important threat worldwide. This disease is caused by the novel SARS-CoV-2. CXR and CT images reveal specific information about the disease. However, when interpreting these images, experiencing an overlap with other lung infections complicates the detection of the disease. Due to this situation, the need for computer-aided systems is increasing day by day. In this study, solutions were developed with proposed models based on deep neural networks (DNN). All the analyses were performed on a publicly available CXR dataset. This study offers a comparison of the deep learning models (SqueezeNet, Inception-V3, VGG16, MobileNet, Xception, VGG19+MobileNet (Concatenated)) that results in the detection and classification of a disease. Empirical evaluation demonstrates that the Inception-V3 model gives 90% accuracy with 100% precision for the COVID-19 infection. This model has been provided with better results compared to other models. In addition to the studies in the literature, it has been observed that the proposed pre-trained-based concatenated model gives very similar successful results to the other models.

1. Introduction

COVID-19 is an infectious disease whose first symptoms resemble the flu. The origin of the disease, which first started in China and rapidly spread to the rest of the world, is the SARS-CoV-2 (beta coronavirus) virus. Standard methods used for the diagnosis of COVID-19 are viral nucleic acid test and chest computed tomography imaging. The application process of these methods can take time. Elderly patients with chronic obstructive, cardiovascular, or hypertension are vulnerable to this condition, posing danger. For COVID-19 diagnosis, 47 models have been identified, 34 of which are based on medical illustrations. 16 prognostic models have been identified for determining the lethal state, the length of hospital stay, and disease progression.

Symptoms such as age, body temperature, blood pressure, and creatinine are taken into account most often when detecting COVID-19 [1]. In the global fight against COVID-19, X-ray and computed tomography (CT) imaging tools play an important role. However, various picture characteristics can make differences in the interpretation of CT or X-ray scan results. The interpretation of CT or X-ray images by radiologists is moderate in the diagnosis of COVID-19. AI (Artificial Intelligence) technologies contribute to the power of imaging tools and assist experts. AI-supported image analysis simplifies workflow by providing minimal contact with the patient [2,3]. The combination of AI and imaging techniques can support the COVID-19 prognostic forecast. For this reason, AI-based systems are needed to improve performance in the diagnosis of COVID-19. In most medical imaging classifications, CNN is used. In some studies, SVM and RF were used. It is stated by the researchers that the proposed models perform well on the test data. This may not always be the case, since the classification success may change as a result of the noise situations on real-life data [4].

Ilyas et al. have observed ResNet, VGG19, InceptionV3 deep learning architectural results on chest x-ray images. VGG19, ResNet, ResNet50 and InceptionV3 achieve an accuracy of 98%, 96%, 95% and 96%, respectively [5]. Diagnostic performance on Chest X-Ray (CXR) images may not be sufficient for routine clinical use. AI technologies are needed to improve the diagnostic performance of CXR. For this purpose, Oh et al. have applied U-Net, FC-DenseNet67, and FC-DenseNet103 architectures on CXR images. Accuracies of 85.9%, 81.8%, and 88.9% were achieved, respectively [6]. Wang et al. applied the COVID-Net architecture on 13,975 CXR images taken from 13,870 patients. In COVID-19 detection, it gave more successful prediction results than VGG-19 and ResNet-50 models [7]. Zhang et al. measured 83.61% AUC and 71.70% sensitivity on the X-VIRAL data set with the CAAD model [8]. The X-VIRAL data set contains 5,977 viral pneumonia (no COVID-19), 18,619 non-viral pneumonia and 18,774 healthy CXR images [9]. Farooq and et al. made COVID-19 detection on the COVIDx dataset containing CXR images. The results indicate an approximately 13% superior performance when compared to COVID-Net [10]. Mahdy and et al. have used SVM for COVID-19 classification. The results serve 97.48% accuracy, 95.76% sensitivity, and 99.7% specificity [11]. In another study, 89.2% accuracy was achieved on the 135 non-COVID-19 and 320 COVID-19 CXR images with the ResNet50 model [12]. The COVID-CAPS model framework based on capsule networks has been presented on X-Ray images by Afhsar and et al. It was more successful than CNN based models. The model achieved 95.7% accuracy [13]. In the study by Minaee et al., classification process was studied on 5000 Chest X-ray images with the help of popular convolutional neural networks. Model implementations were carried out with Pytorch. In the results, the specificity rate was around 90% and the sensitivity rate was around 97% [14]. COVID-19 was detected with the DeTraC method proposed by Abbas and et al.. DeTrac has yielded effective results in classifying cases [15]. In a study by Rajamaran et al. 99.01% accuracy, and 99.72% AUC was obtained with the deep learning model proposed on CXR images [16]. In a study by Apostolopoulos et al., 96.78% accuracy was obtained in the diagnosis of COVID-19 disease on X-ray images [17]. In a study by Singh et al., 98.94% accuracy was obtained with Xception architecture on X-ray pulmonary images [18].

Studies supporting CT images are also underway. Some of the CT findings of COVID-19 are consolidation, pleural thickening, and GGO. AI systems can assist doctors or radiologists to quickly diagnose the diseases. The AI system has been developed by Zhang et al to diagnose COVID-19 using CT scans. In the classification model, 361.221 CT images from 2246 patients were used for training. In the test phase, 40,880 images from 260 patients were used. The overall accuracy of the proposed model was around 92% [19]. In another study on CT images, the AI model achieved 87% accuracy on independent test data [20]. Ardakani et al. studied 1020 CT images (from 108 patients (COVID group) and 86 patients (non-COVID group)). For COVID-19 detection, AlexNet, VGGNet, GoogleNet, MobileNet, ResNet, SqueezeNet, and Xception architectures were used. The best results were obtained with ResNet-101 and Xception [21]. In another study on CT images, a deep learning model was developed in 4352 images collected from 332 patients. AUC for COVID-19, pneumonia, and non-pneumonia has been obtained as 0.96, 0.95 and 0.98, respectively [22].

In this study, methods for the diagnosis of COVID-19 based on AI techniques are proposed. The proposed techniques have been evaluated on CXR scanning images. The general flow diagram of the study carried out for disease detection is given in Figure 1.

2. Material And Method

2.1. Material

Since there is a limited source of COVID-19 data in open access, operations have been performed on the small dataset. In this study, 3 different datasets were used. Each dataset is available on the Internet. The first dataset was collected from two different sources. One of the sources contains COVID-19 X-ray images. These images were developed by Cohen JP. The other source is from the ChestX-ray8 database [23, 24, 25]. The second dataset was developed by the Canadian Image Processing Group [26,27]. The third dataset is taken from the website, which is open to public access by COVIDEEP developers [28]. The combination of three datasets has been studied in this study (Figure 2).

The dataset contains a total of 1521 CXR images 730 of which having pneumonia, 234 COVID-19, and 557 normal. The dataset is organized in 2 folders (train, test), as given in Table 1.

Table 1. General distribution of the dataset




Normal (Healthy)

COVID-19+ChestX-ray8 [23, 24, 25]




COVID-chestxray [26, 27]









Training Set




Test Set





2.2. Deep Learning Models

We evaluated the performance of ImageNet pre-trained CNN models: VGGNet [29], InceptionNet [30,31], XceptionNet [32], MobileNet [33], SqueezeNet [34]. Besides, we applied transfer learning method on the ImageNet dataset. Thus, we overcame long training time and insufficient data problems. Through the transfer learning technic, the parameters of the previous layers are kept except the last layer and the last layer is retrained. Before the training phase, images have been reshaped to 256x256. Data augmentation before training is important to reduce overfitting. Therefore the techniques used for augmentation in this study are the geometric transformations such as zooming, rescaling, rotation, horizontal flip, vertical flip, and shearing. Deep learning models are designed for the detection of disease without requiring any handcrafted feature extraction. In this study, we augmented the data of CXR images. Then, we used the deep learning models to extract features automatically. Following, we used the Softmax classifier to detect COVID-19. Finally, various deep learning models were compared (Figure 3).

VGGNet has two different variations: VGG16 and VGG19. VGG16 was trained on the ImageNet dataset of 1000 classes. It uses 16 layers, including 13 convolutional layers (5 convolutional blocks) and 3 fully-connected dense layers. VGG19 consists of 19 layers. It uses 16 convolutional layers (5 convolutional blocks) and 3 fully-connected dense layers. SqueezeNet consists of a stand-alone convolution layer, 8 fire modules, and a final convolution layer. Xception is a CNN based deep neural network. It consists of depthwise separable convolution layers. MobileNet is based on linear bottlenecks and inverted residuals. It starts with convolution layers, followed by inverted residual blocks, linear bottlenecks blocks, convolution layer, and a fully-connected dense layer [21]. Inception-V3 was an improved version of the GoogleNet (In 2015). It consists of 48-layers. Inception-V3 consists of three kinds of Inception modules: Inception A, Inception B, and Inception C. Inception modules A,B, and C are composed of convolutional and pooling layers [35]. In this study, the last network is a concatenated (VGG19+MobileNet) neural network. We have trained VGG19, MobileNet, and a concatenation of VGG19 and MobileNet. This concatenated model is designed by concatenating the extracted features of VGG19 and MobileNet.

3. Results

In this study, the implementation of the deep transfer learning models is carried out using a personal computer with 24 GB RAM and Intel(R) Core(TM) i7-7700 CPU running on Windows 10 (64 bit). CXR images have been used for the prediction of COVID-19. In this way, popular pre-trained models have been trained and tested on CXR images. The deep learning models’ training phases were performed with a batch size of 32, an initial learning rate of 0.0001, and 100 epochs. In Fig. 4, Fig. 5, Fig. 6, Fig. 7, Fig. 8, and Fig. 9 the training accuracy, validation accuracy and loss graphs of the multi-class classifications are shown. It can be seen from Fig. 5 and Fig. 7 that the highest training accuracy and the lowest loss are obtained with the Inception-V3 and MobileNet. Therefore it can be said that Inception-V3 and MobileNet models have similar performance. Therefore, these two models can be considered to be a more suitable model. Also, the main reason for the extreme high or extreme low fluctuations that are generally seen in all graphs is the low data amount of the COVID-19 class. However, as the number of epochs increased (especially when the epoch was between 80 and 100), the train and validation distributions converged.

When the results are examined in general, deep learning models are proved to be successful in detecting COVID-19. (Fig. 10 (a,b,c,d,e,f))

Accuracy, precision, recall, and F1-score values are shown in Table 2 for the detection of the disease. The best accuracy result is obtained in the Inception-V3 model. The obtained accuracy, precision, recall, and F1-score values are 90%, 100%, 88%, and 94%, respectively.

Table 2. Performance results


Performance (%)




































4. Discussion And Conclusions

COVID-19 caused by SARS-CoV-2 is rapidly spreading around the world. For the diagnosis of COVID-19, stages such as CT imaging, clinical findings, nucleic acid detection are passed. Globally, it is extremely important to detect COVID-19 and bring the infected patients under control as soon as possible. For this purpose, deep learning-based systems are being developed on CXR images. Automated deep learning methods for the diagnosis of COVID-19 from CXR images are proposed in this paper. We presented pre-trained CNN models and a concatenated neural network (VGG19 and MobileNet) for classifying CXR images.

Performance results show that the Inception-V3 pre-trained model yielded the highest accuracy of 90% and the highest precision of 100% among the other deep learning models. Therefore, the method can be used for the diagnosis of the disease. Also, the proposed concatenated model can become an efficient diagnostic tool for disease detection. 

Different studies on datasets used in this study were examined. When the studies using the COVID-19 data in the first dataset [23] are examined; it is noted that 80% accuracy is achieved with the InceptionV2 model on 50 COVID-19 patients by Narin et al. [36]. With the Inception-V3 model proposed in this study, the InceptionV2 model accuracy rate has increased by 10%. Inception, Xception, and InceptionResNet models were applied on 224 COVID-19 patients by Apostolopoulos et al. The accuracy rates were 86%, 85%, and 84%, respectively [37]. With the Inception-V3 model proposed in this study, the Inception, Xception and InceptionResNet models’ accuracy rates have increased by 4%, 5% and 6%, respectively. Singh et al. administered DarkCovidNet on 132 COVID-19 patients and achieved an accuracy of 87.02% [18]. With the Inception-V3 model proposed in this study, DarkCovidNet model’s success increased by about 3%. When the studies using COVID-19 patient data in the first and second datasets [23, 26] are examined; Zhong is seen to achieve an 87.3% accuracy with the DCNN model. With the Inception-V3 model proposed in this study, the success of the DCNN model increased by ~3% [38]. In the study by Gour, the ~89.86% accuracy achieved with VGG19 increased by ~1% in our study. Also, the ~87.73% accuracy achieved with CovNet30 increased by ~ 3% in our study [39]. To the best of our knowledge, there is no study conducted on the third dataset [28] in the literature.

Nowadays, because of the limited number of COVID-19 data available for open access, class values (COVID, NONCOVID) of the datasets studied are not evenly distributed. With the increasing number of data in the future, more effective and robust solutions for the classification of COVID-19 can be developed.

In light of the information mentioned in this paper, COVID-19 prediction models should be quickly brought to the literature to support medical decision-making systems.


Author Contributions

E.E. processed and analyzed the data. T.A. and E.E. reviewed the manuscript.

Conflict of interest

The authors declare that they have no conflict of interest.


  1. Wynants, L., et al. Prediction models for diagnosis and prognosis of covid-19 infection: systematic review and critical appraisal. Bmj.369, (2020).
  1. Shi, F., et al. Review of artificial intelligence techniques in imaging data acquisition, segmentation and diagnosis for covid-19. IEEE reviews in biomedical engineering. (2020).
  1. Dong, D., et al. The role of imaging in the detection and management of COVID-19: a review. IEEE reviews in biomedical engineering. (2020).
  1. Mohamadou, Y., Halidou, A., Kapen, P. T. A review of mathematical modeling, artificial intelligence and datasets used in the study, prediction and management of COVID-19. Applied Intelligence. 1-13 (2020).
  1. Ilyas, M., Rehman, H., Naït-Ali, A. Detection of Covid-19 From Chest X-ray Images Using Artificial Intelligence: An Early Review. Preprint at (2020).
  1. Oh, Y., Park, S., Ye, J. C. Deep learning covid-19 features on cxr using limited training data sets. IEEE Transactions on Medical Imaging. (2020).
  1. Wang, L., Wong, A. COVID-Net: A Tailored Deep Convolutional Neural Network Design for Detection of COVID-19 Cases from Chest X-Ray Images. Preprint at (2020).
  1. Zhang, J., et al. Viral pneumonia screening on chest X-ray images using confidence-aware anomaly detection. Preprint at (2020).
  1. Farooq, M., Hafeez, A. Covid-resnet: A deep learning framework for screening of covid19 from radiographs. Preprint at (2020).
  1. Khalifa, N. E. M., Taha, M. H. N., Hassanien, A. E., Elghamrawy, S. Detection of coronavirus (COVID-19) associated pneumonia based on generative adversarial networks and a fine-tuned deep transfer learning model using chest X-ray dataset. Preprint at (2020).
  1. Hassanien, A. E., Mahdy, L. N., Ezzat, K. A., Elmousalami, H. H., Ella, H. A. Automatic x-ray covid-19 lung image classification system based on multi-level thresholding and support vector machine. Preprint at (2020).
  1. Hall, L. O., Paul, R., Goldgof, D. B., Goldgof, G. M. Finding covid-19 from chest x-rays using deep learning on a small dataset. Preprint at (2020).
  1. Afshar, P., et al. Covid-caps: A capsule network-based framework for identification of covid-19 cases from x-ray images. Preprint at (2020).
  1. Minaee, S., Kafieh, R., Sonka, M., Yazdani, S., Soufi, G. J. Deep-covid: Predicting covid-19 from chest x-ray images using deep transfer learning. Preprint at (2020).
  1. Abbas, A., Abdelsamea, M. M., Gaber, M. M. Classification of COVID-19 in chest X-ray images using DeTraC deep convolutional neural network. Preprint at (2020).
  1. Rajaraman, S., et al. Iteratively Pruned Deep Learning Ensembles for COVID-19 Detection in Chest X-rays. Preprint at (2020).
  1. Apostolopoulos, I. D., Mpesiana, T. A. Covid-19: automatic detection from x-ray images utilizing transfer learning with convolutional neural networks. Physical and Engineering Sciences in Medicine. 1, (2020).
  1. Singh, K. K., Siddhartha, M., Singh, A. Diagnosis of Coronavirus Disease (COVID-19) from Chest X-ray images using modified XceptionNet. ROMANIAN JOURNAL OF INFORMATION SCIENCE AND TECHNOLOGY23, S91-105 (2020).
  1. Zhang, K., et al. Clinically applicable AI system for accurate diagnosis, quantitative measurements, and prognosis of covid-19 pneumonia using computed tomography. Cell. (2020).
  1. Bai, H. X., et al. AI augmentation of radiologist performance in distinguishing COVID-19 from pneumonia of other etiology on chest CT. Radiology. 296(3), 201491 (2020).
  1. Ardakani, A. A., Kanafi, A. R., Acharya, U. R., Khadem, N., Mohammadi, A. Application of deep learning technique to manage COVID-19 in routine clinical practice using CT images: Results of 10 convolutional neural networks. Computers in Biology and Medicine. 121, 103795 (2020).
  1. Li, L., et al. Using Artificial Intelligence to Detect COVID-19 and Community-acquired Pneumonia Based on Pulmonary CT: Evaluation of the Diagnostic Accuracy. Radiology296(2), (2020).
  1. Cohen J.P., COVID-19 Image Data Collection. 8023/COVID-chestxray-dataset (2020).
  1. Wang, X., et al. Chestx-ray8: Hospital-scale chest x-ray database and benchmarks on weakly-supervised classification and localization of common thorax diseases. In Proceedings of the IEEE conference on computer vision and pattern recognition.2097-2106 (2017).
  1. Talo M., Automated Detection of COVID-19 Cases Using Deep Neural Networks with X-Ray Images. (2020).
  1. Agchung, Figure 1 COVID-19 Chest X-ray Dataset Initiative. (2020).
  1. BUILD AI YOU CAN TRUST Accelerate Deep Learning Development with Explainable AI. (2020).
  1. Simonyan, K., Zisserman A. Very deep convolutional networks for large-scale image recognition. Preprint at (2015).
  1. Szegedy, C., Ioffe, S., Vanhoucke, V., Alemi, AA. Inception-v4, inception-resnet and the impact of residual connections on learning. In: Thirty-first AAAI conference on artificial intelligence. (2017)
  1. Szegedy C., et al. “Going deeper with convolutions”. IEEE Conf. Comput. Vis. Pattern Recognit. 1-9 (Jun. 2015).
  1. Chollet, F. Xception: Deep learning with depthwise separable convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition.1251-1258 (2017).
  1. Howard, A. G., et al. Mobilenets: Efficient convolutional neural networks for mobile vision applications. Preprint at (2017).
  1. Iandola, F. N., et al. SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and< 0.5 MB model size. Preprint at (2016).
  1. Guan, Q., et al. Deep convolutional neural network Inception-v3 model for differential diagnosing of lymph node in cytological images: a pilot study. Annals of translational medicine7(14), (2019).
  1. Narin, A., Kaya, C., Pamuk, Z. Automatic Detection of Coronavirus Disease (COVID-19) Using X-ray Images and Deep Convolutional Neural Networks. Preprint at (2020).
  1. Apostolopoulos, I.D., Mpesiana, T.A. Covid-19: automatic detection from x-ray images utilizing transfer learning with convolutional neural networks. Physical and Engineering Sciences in Medicine, 1, (2020).
  1. Zhong, Y. Using Deep Convolutional Neural Networks to Diagnose COVID-19 From Chest X-Ray Images. Preprint at (2020).
  1. Gour, M., Jain, S. Stacked Convolutional Neural Network for Diagnosis of COVID-19 Disease from X-ray Images. Preprint at (2020).