Next Article in Journal
Bridge Damping Extraction Method from Vehicle–Bridge Interaction System Using Double-Beam Model
Previous Article in Journal
Fabrication of Sinusoidal Microstructures on Curved Copper Surface by Ultra-Precision Diamond Cutting with a Rotary B-Axis and Fast Tool Servo System
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

An Effective Convolutional Neural Network Model for the Early Detection of COVID-19 Using Chest X-ray Images

1
Department of Computer Science, School of System and Technology, University of Management and Technology, Lahore 54000, Pakistan
2
Department of Computer Science, Lahore Garrison University, Lahore 54000, Pakistan
3
Department of Computer Science and Engineering, UET Lahore, Narowal Campus, Lahore 54890, Pakistan
4
Department of Information Technology, Bahauddin Zakariya University, Multan 60000, Pakistan
5
Department of Computer Engineering, and Department of AI Convergence Network, Ajou University, Suwon 16499, Korea
6
Department of Computer Science, College of Computers and Information Technology, Taif University, P.O. Box 11099, Taif 21944, Saudi Arabia
7
Department of Information Technology, College of Computers and Information Technology, Taif University, P.O. Box 11099, Taif 21944, Saudi Arabia
*
Authors to whom correspondence should be addressed.
Appl. Sci. 2021, 11(21), 10301; https://doi.org/10.3390/app112110301
Submission received: 3 September 2021 / Revised: 28 October 2021 / Accepted: 31 October 2021 / Published: 2 November 2021
(This article belongs to the Topic Artificial Intelligence in Healthcare)

Abstract

:
COVID-19 has been difficult to diagnose and treat at an early stage all over the world. The numbers of patients showing symptoms for COVID-19 have caused medical facilities at hospitals to become unavailable or overcrowded, which is a major challenge. Studies have recently allowed us to determine that COVID-19 can be diagnosed with the aid of chest X-ray images. To combat the COVID-19 outbreak, developing a deep learning (DL) based model for automated COVID-19 diagnosis on chest X-ray is beneficial. In this research, we have proposed a customized convolutional neural network (CNN) model to detect COVID-19 from chest X-ray images. The model is based on nine layers which uses a binary classification method to differentiate between COVID-19 and normal chest X-rays. It provides COVID-19 detection early so the patients can be admitted in a timely fashion. The proposed model was trained and tested on two publicly available datasets. Cross-dataset studies are used to assess the robustness in a real-world context. Six hundred X-ray images were used for training and two hundred X-rays were used for validation of the model. The X-ray images of the dataset were preprocessed to improve the results and visualized for better analysis. The developed algorithm reached 98% precision, recall and f1-score. The cross-dataset studies also demonstrate the resilience of deep learning algorithms in a real-world context with 98.5 percent accuracy. Furthermore, a comparison table was created which shows that our proposed model outperforms other relative models in terms of accuracy. The quick and high-performance of our proposed DL-based customized model identifies COVID-19 patients quickly, which is helpful in controlling the COVID-19 outbreak.

1. Introduction

A coronavirus known as the SARS-CoV-2 has caused a global pandemic as stated by world health organization (WHO) [1]. It is a disease caused by an infection by a newly discovered type of coronavirus [2]. This virus is part of a wider family of previously discovered viruses that can cause infectious diseases in the respiratory system of the human body such as coughs and colds [3]. It also causes severe illnesses, such as pneumonia, severe acute respiratory syndrome (SARS) and failure of multiple organs [4]. COVID-19 became an epidemic causing great havoc around the globe [5]. It was declared as a global pandemic by WHO as reported on 11 March 2020, and a public health emergency was initiated worldwide. As of 28 February 2021, more than 114,353,718 cases of the COVID-19 pandemic have been reported and more than 2,536,439 deaths have been reported due to this virus [6]. The health statistics show that more than 80% of the patients infected with the COVID-19 virus have mild symptoms such as cough, cold and fever [7]. The mortality rate of COVID-19 is approximately 6%. It is a transmitted from one person to another when a person infected with coronavirus coughs, sneezes or exhales. The droplets of the cough or sneeze of an infected person contain this virus and are heavier than air, so they quickly settle on surfaces or other human bodies [8]. With the rapid spread of coronavirus and a continuously increasing number of patients on a daily basis, hospitals find it difficult to provide equal health facilities for patients with other diseases as majority of resources have been occupied by COVID-19 patients [9]. Therefore, it is necessary to contain the spread of this disease by lockdowns and maintaining social distance [10].
The day-to-day spread of COVID-19 among patients suffering from the symptoms has caused clinics to get congested [11]. There is a critical expectation from doctors to take sudden decisions on how to treat a patient as each patient requires a different treatment according to their health condition [12]. Doctors were supposed to guide patients suffering from minor symptoms with relevant information and virtual care options to treat high-risk and higher-acuity patients with their best efforts and resources. One of the most effective ways is to detect the level of infection through medical imaging such as X-rays and chest radiology [10,13]. Most organizations have concentrated on the use of X-rays and CT scans to detect COVID-19 and boost treatments for the disease to cover the challenges [14]. Currently reverse-transcription polymerase chain reaction (RT-PCR) is the widely used approach for the diagnosis of COVID-19. The main problem with this technique is that there are not enough testing kits available globally and the test itself is quite time consuming and expensive [6]. Moreover, this diagnostic technique is prone to produce false-positive results, thus it is required to have other testing methods which can provide faster results in conditions where time is of critical importance. The limitation of most clinical diagnosis methods includes time constraints, geolocation barriers and trained staff to provide accurate diagnostic methods.
The ideal way to accelerate clinical decision related to COVID-19 is through the assistance of machine learning techniques. Artificial intelligence, machine learning and DL have proved to be a viable option in medical consultancy with properly trained models [15]. Computer scientists are working hard to learn more and more about novel coronavirus using computational methods [16]. These computational methods can be used in this pandemic so the world can recover from this disaster as soon as possible. DL is an efficient technology which can detect and predict COVID-19 through medical imaging [17]. The detection through medical imaging can support the medical care framework by lessening and smothering the pandemic effect [18]. The automated diagnosis allows doctors to act quickly upon lifesaving decisions [19].
The aim of this research is to assist doctors in making clinical decisions and provide an early diagnosis of COVID-19. In this research a customized convolutional neural network (CNN) model is proposed to diagnose COVID-19 from X-ray images. The model takes chest X-ray images as inputs and predicts whether the provided X-ray image is of a COVID-19 patient or a normal person. The model successfully detects COVID-19 with high accuracy in less time and using fewer resources. The model consists of nine layers and a total of 5,668,097 parameters. Two publicly available datasets were used for the development of the model. First, the images from the dataset that were used for the training and validation of the model were preprocessed to generate accurate results. The novelty of this study is that we propose a model to detect COVID-19 early. The model contains a few numbers of layers and parameters to provide prediction in less time with accurate and efficient results. Two different datasets are used for training and validation which allows us to test cross-dataset robustness of the model. We compared our classifier to a variety of advanced DL classifiers and found that ours outperformed them in terms of both computational cost and classification efficiency. The proposed model can be deployed in the most remote areas and can be used for early diagnosis of COVID-19 before the patient develops serious symptoms.
The rest of the paper is further divided into five sections. Section 2 presents the work related to our research. The dataset, techniques used for developing the model in our research, and details of the designed layers and preprocessing are discussed in Section 3. Section 4 describes the experimental setup and results of the research followed by a comparison with similar models. The accuracy, performance and datasets are explained in detail in Section 4. Section 5 represents limitations and future work which should be considered for this research. The last section, i.e., Section 6 provides the conclusion of the study.

2. Related Work

In this section we discuss the related works for COVID-19 detection using various learning techniques with their limitations which pave the way for our proposed scheme.
Juan Eduardo Luján-García [20] generated a CNN based on transfer learning consisting of pretrained weights. The CNN model was used to classify between COVID-19, pneumonia and healthy patients using the chest X-ray images. The CNN architecture was based on Xception followed by ImageNet for pertained weights. The model reached an accuracy of 0.91 by detecting SARS-CoV-2 and pneumonia correctly. The model resulted in greater accuracy, but images used for the testing of the model were from already trained data.
Sadman Sakib [21] developed a framework based on deep learning known as DL-CRC to differentiate between COVID-19, pneumonia and normal chest radiographs. The framework also performs data augmentation using GAN and generic augmentation techniques to generate synthetic COVID-19 infected chest X-ray images. Data augmentation helped to tackle the class imbalance issue and improved the accuracy of the model to 93.94% However, the framework could not be used to classify the different stages of COVID-19, such as asymptomatic, mild, high, and severe due to shortage of data [22].
Ashraf Yunis Maghari [23] proposed a CNN model based on CheXNet algorithm to distinguish between COVID-19 and normal chest X-rays. Two experiments were considered to train the model which resulted in an accuracy of 84% and 89.7%. It was claimed that the model has the potential role to quickly identify patients, which could be helpful and effective in mitigating the COVID-19 outbreak. However, no preprocessing was considered which could have increased the accuracy of the developed model. Mentioning ROC and confusion matrix could have been considered to further clarify the accuracy of model.
Nora El-Rashidy [24] developed a CNN deep learning model to detect COVID-19 using patients X-ray images. The model further contains a patient and a cloud layer to track the patient using sensors and a mobile app. The CNN model reached an accuracy of 97.95%, making it efficient enough to contribute in improving patient quality care. It was claimed that the main purpose of the study was to remove the gap between healthcare systems and technologies. However, there is a lack of collected data for real-time COVID-19 tracking causing system to place a greater focus on image processing.
A study conducted by Andrea Loddo [25] trialed ten popular CNN models on two publicly available datasets. Their findings showed that VGG19 displayed promising accuracy of 98.87% and the accuracy of patient status classification only dipped to 95.91%, when it miscategorized some records, compared to other techniques which resulted with better accuracy. The experiments reveal that using the same model on different datasets without proper fine-tuning leads to lower accuracy. As the study suggests that preprocessing combined with data standardization and normalization can enhance model accuracy.
Michael J. Horry [26] developed a CNN model by using multiple imaging datasets (X-rays, CT scans and ultrasound). The experiment was conducted VGG19 model on the datasets and due to limited dataset size, they performed data preprocessing to fine-tune their data, which highly improved the accuracy of COVID-19 detection. The study reveals that by using VGG19 and fine-tuned data, the ultrasound dataset yielded 100% accuracy compared to 86% for X-rays and 84% for CT scans. The study showed how the lack of publicly available datasets and nonstandardization of data can affect results and that model training requires a lot of preprocessing and fine-tuning.
Alberto Signoroni [27] developed end-to-end deep learning on chest X-rays to predict the severity of lung compromise in patients. The study used Brixia Score to monitor patients and used a BSNet architecture model, which performed segmentation in lungs to determine severity. Their method of using a weakly supervised network was capable of developing self-attentive techniques on all chest X-rays which helps qualified technicians’ predicting accuracy.
A study carried out by Basant Giri [28] shows the major diagnostic techniques that are being clinically used to detect COVID-19 includes RT-PCR, which is highly efficient but requires more time and trained labor. The CRISPR method is a cheap alternative which requires less time to produce results, although this technique has a high risk of sample contamination. Molecular POC is a faster and cheaper technique which may not require RNA extraction. However, it is prone to low accuracy outcomes in the first five days after symptoms are identified. NGS is a popular technique used to detect viral variant and other infections, though it is an expensive method and requires more time compared to other diagnostic methods.
A binary-based CNN model was developed by Khandaker Foysal Haque [29] to classify COVID-19 and normal chest X-ray images. The proposed model resulted in 97.56% of accuracy. It was claimed that despite the model having better accuracy, it can be further improved by increasing the dataset for better training of the model. The study compared the performance of its model to two other models and resulted in better accuracy than the compared models. However, the model used in the study was trained on a small dataset containing 165 COVID-19 and 165 normal X-rays, which can be further improved to work on larger datasets for better accuracy.
A study performed by Muhammad E. H. Chowdhury [30] shows a robust method for automated detection of COVID-19 using X-ray images. The proposed method uses binary and multiclass prediction models with image augmentation to provide comparison with models without image augmentation. The study shows how a CNN model with image augmentation can improve their reliability and accuracy. The proposed method uses pretrained models. Adding image augmentation can greatly improve speed and accuracy, which are helpful in COVID-19 diagnosis, and resulted in an accuracy of 99.7%. However, the model is a 121-layer variant which is complex and hard to train as it requires capable resources to train and implement the model on a large-scale.
Many attempts have been made to diagnose COVID-19 using chest X-ray images, as seen in the preceding discussion, but the developed models are based on a complex architecture, which means the models demand a large number of datasets to be trained in order to achieve more accuracy. The models also require time for training and predicting the outcomes as the models are based on high numbers of parameters and layers. Furthermore, the proposed models are trained on datasets which are not equally distributed. Unequal distribution of data can give rise to the class imbalance problem which may lead to wrong predictions.
The novelty of the research is that we proposed a customized CNN model with comparatively less layers so that the model is trained with less datasets to provide efficient predictions and accuracy. The model contains fewer parameters so it could predict accurate results in a timely fashion. Cross-dataset experiments were carried out in order to test the efficiency of the model. The customized CNN model was trained and validated on equally distributed data of COVID-19 and normal X-ray images to fix the class imbalance issue. The proposed method of using CNN with chest X-rays requires no trained staff, is highly economical as X-ray machines are readily available in every hospital, and can deliver output instantly. This method can be deployed in most of the remote locations where RT-PCR and other diagnostic tools are unavailable. Using the CNN-based model with its high output capacity, it is possible to detect hundreds of results in a day, which might not have been possible with other techniques for early diagnosis.

3. Material and Methods

In this section, the workflow and the procedure followed for the development of the customized CNN model are discussed in detail. The workflow of the architecture to detect COVID-19 from X-ray images is shown in Figure 1, which indicates that the raw X-ray images were preprocessed to refine and reduce noise. The proposed customized CNN model was further trained and validated on equally distributed data of COVID-19 and normal X-ray images to overcome the class imbalance problem. The preprocessed images were provided to the model as an input. The model uses a series of layers and filters to extract features from the X-ray images and distinguish them as COVID-19 and normal class.

3.1. Dataset

The anterior-to-posterior (PA) picture of a chest X-ray was selected in this investigation as it is a frequently used approach by radiologists in medical assessment. The following two datasets were used to collect the X-ray images of COVID-19 and normal patients. Eight hundred images were selected for the training and testing of the proposed model.

3.1.1. Kaggle COVID-19 Radiography Database

The Kaggle COVID-19 Radiography Database [31] is a publicly available dataset. As of writing, the dataset contains 3616 chest X-rays with COVID-19 infection, 10,192 normal chest X-rays, 6012 lung opacity and 1345 viral pneumonia images. In Figure 2, we exhibit several photos from Kaggle’s COVID-19 radiography dataset to illustrate the distinctions between COVID-19 and normal chest X-ray images. Researchers from Qatar University and Tampere University collaborated to compile the data. The dataset’s chest X-ray images come from a variety of sources, including the Italian Society of Medical and Interventional Radiology’s COVID-19 Dataset (SIRM) [32] and a number of recent publications.

3.1.2. COVID-19 Chest X-ray Dataset by Joseph Paul Cohen

Joseph Paul Cohen, Lan Dao and Paul Morrison proposed a dataset which is publicly available at GitHub [33]. The dataset contains 494 images of COVID-19, severe acute respiratory syndrome (SARS) and Middle East respiratory syndrome (MERS). Both X-ray and CT images are provided in the dataset which is collected from public sources and hospitals. The dataset is approved by the Ethics Committee of the University of Montreal. Figure 3 illustrates the sample of chest X-ray images selected from the dataset.

3.1.3. Data Distribution

The Table 1 provides information about the dataset which was merged for the study of COVID-19 detection using CNN. The merged dataset accumulates the images of normal patients and COVID-19 of both male and female. A total of eight hundred X-ray images was merged which contained 400 images of COVID-19 and four hundred images of normal patients with the view of poster anterior. The number of images used were considered to ensure that the model can still efficiently produce accurate results with less images.

3.2. Preprocessing

A preprocessing step with various techniques was applied on the X-ray images used in the proposed model. To provide a better understanding of preprocessing, data visualization was performed on both the X-ray images before and after preprocessing. The quality and dimensions of the images were taken into notice to obtain best possible results. Images before preprocessing had the dimensions of 1496 pixels width and 2148 pixels height, which were based on a single-color channel grayscale image. The maximum pixel value of images was 255.0000 and the minimum was 0.0000. The mean value of the pixels was 148.9668 followed by the standard deviation of 59.8905. A visualized example of the details in X-ray image before preprocessing is displayed in Figure 4a.
All the X-ray images were converted to grayscale for preprocessing. Rescaling was also carried out by a ratio of 1:255 after converting them to grayscale. Images were zoomed at a range of 0.2 pixels for the betterment of the model so it could pay attention to details present within the lungs. Horizontal flipping was further applied for better training of the model. The X-ray images after preprocessing had the dimensions of 224 pixels in width and 224 pixels in height and were based on a single-color channel. The Maximum pixel value was 1.0000 and the minimum was 0.00. The mean value of the pixels was 0.4909 and the standard deviation which was 0.2268. A visualized example of the details in the X-ray images after preprocessing is represented in Figure 4b.

3.3. Layers of the Architecture

The architecture of the proposed CNN model is made up of a series of layers that run in order. The convolution layer, pooling layer and dense (ANN) layer are the three major types of layers used in CNN. The customized CNN model was based on nine layers. A 3D model is shown in Figure 5 to clarify the layers and filters used in the model and architecture. Four convolution layers, three max-pooling layers and two dense artificial neural network (ANN) layers are used in this nine-layer model. Convolution and max-pooling layers provide assistance in generating feature maps that are the intermediate outcome of each layer which has been used to design the CNN architecture.

3.3.1. Convolution Layer

The convolution layer in the architecture contains multiple local filters (kernel) which serve as convolution kernels to generate feature maps in the convolution layers. The convolution layer extracts feature map of the image or feature maps generated by previous layers with a kernel size of 2 × 2. An example of convolution layer is further mentioned in Algorithm 1 where kernel size is written by Ki × Kj (Line 4). It produces an output value for each Ri × Rj (Line 4) filter of the input image or feature map by calculating the product of each kernel weight (Line 11) and the value at the preceding location of the matrix in the input image or a feature map as shown in Figure 6.
The first convolution layer in the architecture uses 32 filters to form feature maps of the input of X-ray image as shown in Figure 5. The second convolution layer further uses 64 filters to form feature maps from the feature maps generated by the first convolution layer. Adding two convolution layers, one after another increases the nonlinearity and reduces the number of parameters to fight overfitting. The third convolution layer occurs after the first Max-pooling layer which uses 64 filters on the feature maps generated by the Max-pooling layer. The patterns become more complicated as the layers are executed, resulting in greater combinations of patterns to catch. To capture as many variations as possible, the filter size is increased in subsequent layers. The fourth and last convolution layer containing 128 filters was made after the second max-pooling layer. All convolution layers were about 2 × 2 kernel size.
Algorithm 1 Convolution Layer
1. Input: x (X coordinate), y (Y coordinate)
2. Output: sum (sum of product of kernel weight and the value at the corresponding position)
3. x ← 0
4. Ri (Input of feature map), Rj (Output of feature map),
   Ki × Kj (kernel size)
5. For (i = 0 to i < Rj-Kj) do
6.      y ← 0
7.    For (j=0 to j < Rj-Kj) do
8.      Sum ← 0
9.       For (ki=0 to ki < Ki) do
10.          For (kj=0 to kj < Kj)
11.            sum+ ← image[i+ki][j+kj]*K[ki][kj]
12.          Endfor
13.       Endfor
14.       f1[x][y]   TransformToNonLinear(count)
15.       Y++
16.     Endfor
17.     X++
18. Endfor

3.3.2. Max-Pooling and Dropout Layer

The pooling layer collects the feature maps from convolutional layer and generates a reduced size of feature maps to emphasize more on important features. An example of how a Max-Pooling layer generates feature maps from the provided input feature map is presented in Figure 7. A kernel size of 2 × 2 matrix is used for the max-pooling layer in the CNN architecture which finds the maximum value from the 2 × 2 location on feature map 1 generated by convolutional layer and removes the rest of the values. An example of the max-pooling layer’s algorithm is also shown in Algorithm 2. The Ri × Rj (Line 4) container in the input feature map pools out each value from the output feature map, with Ki × Kj (Line 4) indicating the pooling kernel size. The amount of output function maps grows as the number of pooling kernels grows.
The number of max-pooling layers used in the architecture is three. It occurs after the convolution layer to decrease the size of feature maps so the model can execute and process images in less time as an architecture with fast diagnosis and light weight was considered. The first Max-Pooling layer consists of 64 filters which generated the feature maps of size 110 × 110. The second max-pooling layer occurs after the third convolution layer as mentioned in Figure 5. The second max-pooling layer generates the feature map of size 54 × 54; it uses 64 filters to shrink the input feature maps. The third and last max-pooling occurs after fourth convolution layer to generate smallest feature maps of 26 × 26 making the work flow of dense layer to predict and classify easily. The third max-pooling layer has the greatest number of filters which were 128. At the end of each max-pooling layer a dropout technique was carried to prevent overfitting of the CNN model. At each update of the training process, dropout works by setting the outgoing edges of hidden units to 0 at random.
Algorithm 2 Pooling Layer
1. Input: x (X coordinate), y (Y coordinate)
2. Output: sum (sum of product of kernel weight and the value at the corresponding position)
3. x ← 0
4. Ri (Input of feature map), Rj (Output of feature map),
   Ki × Kj (kernel size)
5. For (i = 0 to i < Rj-Kj) do
6.     y ← 0
7.    For (j=0 to j < Rj-Kj) do
8.        Sum ← 0
9.       For (ki = 0 to ki < Ki) do
10.         For (kj = 0 to kj < Kj)
11.            temp ← image[i+ki][j+kj]*Kki][kj]
12.            var ← max(var, temp)
13.         Endfor
14.       Endfor
15.       f1[x][y] ← TransformToNonLinear(count)
16.       Y++
17.     Endfor
18.     X++
19.  Endfor

3.3.3. Dense Layer

Dense layers, also known as fully connected layers, use the feature maps generated by previous layers to apply linear transformation. The feature map in Equation (1) is represented as a one-dimensional vector which is indicated by i of similar size of Ri. Variable j of size Rj represents the vector of the output feature map. The linear transformation can be represented in this way with a matrix M and b represented as a bias vector.
j = M × i + b
The proposed model uses two dense layers to diagnose COVID-19 from X-ray images. The first dense layer consisted of 64 neurons and a nonlinear rectified linear unit (ReLU) as activation layer. Another dense layer containing a single neuron and sigmoid as activation function was added as the architecture is based on binary classification. A summary of the layers and the total parameters used in the model is represented in Table 2. To further understand the characteristics of the architecture. A total of 5,668,097 parameters were used in this model to reach the output of classifying between the COVID-19 and normal classes.

3.4. Training and Validation

The entire dataset was mainly divided into two categories: 75% for training and 25% for validation. The training and validation were further categorized as COVID-19 and normal chest X-ray images. A set of eight hundred X-ray images of both COVID-19 and normal patients was used for training and validation purposes as shown in Table 3. Images were given to the model as input with a batch size of 32 for training. The batch size refers to the number of samples processed and it must be greater than one and less than or equal to the number of samples in the training dataset. After training, the dataset was provided to the model for validation to check its effectiveness. Shuffling was applied to the images for training, but the images used in validation of the data were not shuffled.
The proposed customized CNN model was trained on 100 epochs and reached up to 98% accuracy and loss decrease up to 99%, as visualized in Figure 8. The reason to choose 100 epochs for training was preferred after several iterations of trial and error. An epoch is a term used in DL that refers to the number of passes the DL algorithm has made over the entire dataset [34]. Execution time for 100 epochs was calculated to provide detailed information of results. The Figure 9 shows the graph which indicates the time taken for all epochs to run and train the model. The calculated average time for 100 epochs turned out to be 8.37 s.

4. Experimental Results

We used a comprehensive strategy to find the best model for the classification task by applying different techniques. The simulations were carried out using Python’s TensorFlow and Keras library. Experimental results were visualized using Python’s Matplotlib library to conceive the achievements reached by the model. The output of the proposed model was assessed using comprehensive experimental results and discussion.

4.1. Performance Indicators

The effectiveness of the proposed model is evaluated by using accuracy, precision, recall and F1-score. Evaluation of these performance metrics was calculated after the outcome of confusion matrix where four different outcomes were obtained by confusion matrix. In this case true positive (TP) indicates the number of X-rays which are predicted as COVID-19 positive, true negative (TN) denotes the number of X-rays predicted as normal, false positive (FP) represents the number of X-rays that are in fact normal, but predicted as COVID-19 positive and false negative (FN) gives the number of X-rays which are actually COVID-19 positive but predicted as normal.
  Accuracy :   = T P + T N T P + T N + F P + F N α
  Precision   = T P T P + F P
  Recall   = T P T P + F N
  F 1 - Score   = 2 ×   Percision   ×   Recall     Percision   +   Recall  
The accuracy is a metric for evaluation of classification models as shown in Equation (2). Accuracy shows the number of correct predictions made by the model. In the case of binary classification, accuracy is calculated in terms of positive and negative. Precision is calculated to find the ratio between numbers of cases that are correctly predicted as positive as mentioned in Equation (3). Another important factor in CNN evaluation is recall, also known as sensitivity, which is evaluated to find the ratio between COVID-19 positive cases that are predicted positive as indicated in Equation (4). F1- score measurement is also considered as an important factor in the evaluation which is used to identify a balance between precision and recall as shown in Equation (5). As represented in Table 4, the accuracy reached by the model is 98.5%. The precision, recall and F1-score reached by the model was 98%. Confusion matrix shows that the customized CNN model predicted 98 TP and TN cases as shown in Figure 10. This confusion matrix states that the proposed customized CNN model performed very well in predicting the TN cases.
Some random image samples were also considered to cross check the output generated by the model. The examples of the output produced by the model while testing is mentioned in Figure 11 and Figure 12. Normal X-ray samples and the corresponding predictions are shown in Figure 12 where output X-ray size is also mentioned in the prediction column. COVID-19 X-ray samples and the corresponding predictions are portrayed in Figure 11 along with the output image size. The model classified the images efficiently even though the images used were not preprocessed in this cross-check procedure.

4.2. Comparison with Similar Study

A comparison table was designed in Table 5 to show number of samples, accuracy and image preprocessing between the proposed model and some other models. As is shown, the study carried by Juan Eduardo Luján-García [20] produced remarkable early results with their proposed Xception CNN reaching an accuracy of 91% using image preprocessing. The study led by Sadman Sakib [21] outperformed DL-CRC by reaching an accuracy of 93.94% by using GAN for image preprocessing. A state of the art research by Muhammad E. H. Chowdhury [30] delivered early and substantial results with their proposed ChexNet reaching an accuracy of 99.7%. Image augmentation was carried out for the training of ChexNet which resulted in exceptional accuracy surpassing the techniques used in other studies. As reported in Table 5, we were able to achieve a 98.87% accuracy rate with the customized CNN model with fewer layers compared to ChexNet. The customized CNN model also outperformed other models in term of accuracy. Two datasets containing COVID-19 and normal chest X-rays were used to prevent the class imbalance problem. It was further shown in the table that five out of seven models including the proposed models used image preprocessing so the model could produce efficient results.

5. Limitations and Future Work

Despite the fact that the customized CNN model had promising results in detecting COVID-19 from X-ray images, the current model still has some limitations. First, the model depends on COVID-19 patients’ chest X-rays to focus on lungs for diagnosis. However, it is often necessary in clinical practice to classify COVID-19 patients and then segment the infected areas to decide how to further treat the patients. As a result, we’ll look at an artificial-intelligence-based automatic diagnosis model that combines COVID-19 detection and lung infection area analysis into one system. Second, the model is based on binary classification which can be used to assist multiclass labelling between COVID-19 and normal X-rays. However, the ability to identify the difference between COVID-19 and viral pneumonia is still deficient. To provide category differentiation between normal, viral pneumonia and COVID-19 X-ray images can prove to be more efficient as COVID-19 and viral pneumonia can result in similarity between the images which makes it difficult to distinguish in medical terms. For future work, we will do further analysis to imbed these tasks to provide more benefits for the medical professionals in hospitals.

6. Conclusions

The objective of this research was to develop a classification methodology for COVID-19 diagnosis using deep learning techniques on chest X-ray images. To attain this goal, a customized unsupervised CNN model was proposed to detect COVID-19 using chest X-ray images early. The data used for training, validation and testing were preprocessed for the model to enhance the intricacies within the X-ray images. Cross-dataset studies are performed to evaluate the resilience of the proposed model in a practical situation. Two publicly available datasets were used to train and validate the model. Specifically, the model was generated from nine layers to provide accurate and efficient results. The nine layers consist of four convolution layers to generate nonlinear feature maps, three max-pooling layers to extract local data and decrease the size of generated feature maps from convolution layer to prioritize important features in image and two dense (ANN) layers to classify between COVID-19 and normal X-ray images. The accuracy, precision, recall and F1-score reached by the customized CNN model for COVID-19 and normal chest X-ray images were 98.5%, 98%, 98% and 98% respectively. A comparison table was designed to compare the number of samples and accuracy with other models. In comparison to other methods with and without self-attention, our method delivered greater accuracy with fewer parameters and produces results in less time providing efficient COVID-19 classification task performance. The findings of the experiments showed that our method outperformed as compare to other COVID-19 screening methods. COVID-19 has already taken millions of lives worldwide and still poses a risk to populations. Our healthcare systems are struggling to save lives and healthcare staff are overworked to tackle this situation. An automated diagnosis system provides faster and easier screening predictions. We hope that our proposed model will be highly impactful in high-risk areas where lack of resources and diagnosis facility remain deficient as the proposed model has the ability to become a candidate in detecting COVID-19 early in hospitals.

Author Contributions

Conceptualization, M.S.F.; data curation, S.H.R.K.; formal analysis, A.U.R., M.I., M.A.R., J.F.A.-A. and M.M.; investigation, J.A., M.S.F.; methodology, M.S.F.; project administration, M.S.F. and M.M.; resources, M.S.F. and S.H.R.K.; software, M.S.F.; supervision, M.S.F., J.F.A.-A. and M.M.; validation, M.I.; visualization, M.A.R.; writing—original draft, M.S.F., A.U.R. and S.H.R.K.; writing—review and editing, J.A., M.M., M.S.F. and S.H.R.K.; proofreading and writing the paper script in overleaf, M.S.F. and J.A. All authors have read and agreed to the published version of the manuscript.

Funding

Taif University Researchers Supporting Project number (TURSP-2020/211), Taif University, Taif, Saudi Arabia.

Institutional Review Board Statement

Not Applicable.

Informed Consent Statement

Not Applicable.

Data Availability Statement

Not Applicable.

Acknowledgments

The authors are grateful for the support of Taif University Researchers Supporting Project number (TURSP-2020/211), Taif University, Taif, Saudi Arabia.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Naming the Coronavirus Disease (COVID-19) and the Virus that Causes It. Available online: https://www.who.int/emergencies/diseases/novel-coronavirus-2019/technical-guidance/naming-the-coronavirus-disease-(covid-2019)-and-the-virus-that-causes-it (accessed on 31 August 2021).
  2. Shereen, M.A.; Khan, S.; Kazmi, A.; Bashir, N.; Siddique, R. COVID-19 Infection: Origin, Transmission, and Characteristics of Human Coronaviruses. Available online: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7113610/ (accessed on 31 August 2021).
  3. Coronaviruses: Definition, COVID-19, SARS, MERS. Available online: https://www.medicalnewstoday.com/articles/256521 (accessed on 31 August 2021).
  4. Zaim, S.; Chong, J.H.; Sankaranarayanan, V.; Harky, A. COVID-19 and Multiorgan Response; Elsevier: Amsterdam, The Netherlands, 2021; Available online: https://www.sciencedirect.com/science/article/pii/S0146280620300955 (accessed on 31 August 2021).
  5. WHO Director-General’s Opening Remarks at the Media Briefing on COVID-19—11 March 2020. Available online: https://www.who.int/director-general/speeches/detail/who-director-general-s-opening-remarks-at-the-media-briefing-on-covid-19---11-march-2020 (accessed on 31 August 2021).
  6. Grasselli, G.; Pesenti, A.; Cecconi, M. Critical Care Utilization for the COVID-19 Outbreak in Lombardy, Italy: Early Experience and Forecast during an Emergency Response. JAMA 2020, 323, 1545–1546. Available online: https://jamanetwork.com/journals/jama/article-abstract/2763188 (accessed on 31 August 2021). [CrossRef] [PubMed] [Green Version]
  7. COVID Live Update: 217,920,243 Cases and 4,524,009 Deaths from the Coronavirus—Worldometer. Available online: https://www.worldometers.info/coronavirus/ (accessed on 31 August 2021).
  8. Liu, J.; Liao, X.; Qian, S.; Yuan, J.; Wang, F.; Liu, Y.; Wang, Z.; Wang, F.-S.; Liu, L.; Zhang, Z. Community transmission of severe acute respiratory syndrome Coronavirus 2, Shenzhen, China, 2020. Emerg. Infect. Dis. 2020, 26, 1320–1323. [Google Scholar] [CrossRef] [PubMed]
  9. De Filippo, O.; D’Ascenzo, F.; Angelini, F.; Bocchino, P.P.; Conrotto, F.; Saglietto, A.; Secco, G.G.; Campo, G.; Gallone, G.; Verardi, R.; et al. Reduced Rate of Hospital Admissions for ACS during Covid-19 Outbreak in Northern Italy. N. Engl. J. Med. 2020, 383, 88–89. [Google Scholar] [CrossRef] [PubMed]
  10. Narin, A.; Kaya, C.; Pamuk, Z. Automatic detection of coronavirus disease (COVID-19) using X-ray images and deep convolutional neural networks. Pattern Anal. Appl. 2021, 24, 1207–1220. [Google Scholar] [CrossRef] [PubMed]
  11. Karaca-Mandic, P.; Sen, S.; Georgiou, A.; Zhu, Y.; Basu, A. Association of COVID-19-Related Hospital Use and Overall COVID-19 Mortality in the USA. J. Gen. Intern. Med. 2020. [Google Scholar] [CrossRef] [PubMed]
  12. Inui, S.; Fujikawa, A.; Jitsu, M.; Kunishima, N.; Watanabe, S.; Suzuki, Y.; Umeda, S.; Uwabe, Y. Chest CT Findings in Cases from the Cruise Ship Diamond Princess with Coronavirus Disease (COVID-19). Radiol. Cardiothorac. Imaging 2020, 2, e200100. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  13. Apostolopoulos, I.D.; Mpesiana, T.A. Covid-19: Automatic detection from X-ray images utilizing transfer learning with convolutional neural networks. Phys. Eng. Sci. Med. 2020, 43, 635–640. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  14. News—HealthITAnalytics. Available online: https://healthitanalytics.com/topic/infrastructure (accessed on 31 August 2021).
  15. Data Scientists Use Machine Learning to Discover COVID-19 Treatments. Available online: https://healthitanalytics.com/news/data-scientists-use-machine-learning-to-discover-covid-19-treatments (accessed on 31 August 2021).
  16. Asraf, A.; Islam, M.Z.; Haque, M.R.; Islam, M.M. Deep Learning Applications to Combat Novel Coronavirus (COVID-19) Pandemic. SN Comput. Sci. 2020, 1. [Google Scholar] [CrossRef] [PubMed]
  17. Kumar, A.; Gupta, P.K.; Srivastava, A. A Review of Modern Technologies for Tackling COVID-19 Pandemic; Elsevier: Amsterdam, The Netherlands, 2020; Available online: https://www.sciencedirect.com/science/article/pii/S1871402120301272 (accessed on 31 August 2021).
  18. Chouhan, V.; Singh, S.K.; Khamparia, A.; Gupta, D.; Tiwari, P.; Moreira, C.; Damaševičius, R.; De Albuquerque, V.H.C. A novel transfer learning based approach for pneumonia detection in chest X-ray images. Sciences 2020, 10, 559. [Google Scholar] [CrossRef] [Green Version]
  19. Esteva, A.; Kuprel, B.; Novoa, R.A.; Ko, J.; Swetter, S.M.; Blau, H.M.; Thrun, S. Dermatologist-Level Classification of Skin Cancer with Deep Neural Networks. 2017. Available online: https://www.nature.com/articles/nature21056?spm=5176.100239.blogcont100708.20.u9mVh9 (accessed on 31 August 2021).
  20. Luján-García, J.E.; Moreno-Ibarra, M.A.; Villuendas-Rey, Y.; Yáñez-Márquez, C. Fast COVID-19 and pneumonia classification using chest X-ray images. Mathematics 2020, 8, 1423. [Google Scholar] [CrossRef]
  21. Sakib, S.; Tazrin, T.; Fouda, M.M.; Fadlullah, Z.M.; Guizani, M. DL-CRC: Deep Learning-Based Chest Radiograph Classification for COVID-19 Detection: A Novel Approach. 2020. Available online: https://ieeexplore.ieee.org/abstract/document/9199819/ (accessed on 31 August 2021).
  22. Irfan, M.; Iftikhar, M.; Yasin, S.; Draz, U.; Ali, T.; Hussain, S.; Bukhari, S.; Alwadie, A.; Rahman, S.; Glowacz, A.; et al. Role of Hybrid Deep Neural Networks (HDNNs), Computed Tomography, and Chest X-rays for the Detection of COVID-19. Int. J. Environ. Res. Public Health 2021, 18, 3056. [Google Scholar] [CrossRef] [PubMed]
  23. Musleh, A.A.; Maghari, A.Y. COVID-19 Detection in X-ray Images Using CNN Algorithm. 2020. Available online: https://covid19.elsevierpure.com/en/publications/covid-19-detection-in-x-ray-images-using-cnn-algorithm (accessed on 31 August 2021).
  24. El-Rashidy, N.; El-Sappagh, S.; Islam, S.M.; El-Bakry, H.M.; Abdelrazek, S. End-to-end deep learning framework for coronavirus (COVID-19) detection and monitoring. Electronics 2020, 9, 1439. [Google Scholar] [CrossRef]
  25. Loddo, A.; Pili, F.; Di Ruberto, C. Deep Learning for COVID-19 Diagnosis from CT Images. Appl. Sci. 2021, 11, 8227. [Google Scholar] [CrossRef]
  26. Horry, M.J.; Chakraborty, S.; Paul, M.; Ulhaq, A.; Pradhan, B.; Saha, M.; Shukla, N. COVID-19 detection through transfer learning using multimodal imaging data. IEEE Access 2020, 8, 149808–149824. [Google Scholar] [CrossRef]
  27. Signoroni, A.; Savardi, M.; Benini, S.; Adami, N.; Leonardi, R.; Gibellini, P.; Vaccher, F.; Ravanelli, M.; Borghesi, A.; Maroldi, R. BS-Net: Learning COVID-19 pneumonia severity on a large chest X-ray dataset. Med. Imag. Anal. 2021, 71, 102046. [Google Scholar] [CrossRef] [PubMed]
  28. Giri, B.; Pandey, S.; Shrestha, R.; Pokharel, K.; Ligler, F.S.; Neupane, B.B. Review of analytical performance of COVID-19 detection methods. Anal. Bioanal. Chem. 2021, 413, 35–48. [Google Scholar] [CrossRef] [PubMed]
  29. Haque, K.F.; Haque, F.F.; Gandy, L.; Abdelgawad, A. Automatic detection of COVID-19 from chest X-ray images with convolutional neural networks. In Proceedings of the 2020 International Conference on Computing, Electronics & Communications Engineering (iCCECE), Southend, UK, 17–18 August 2020; IEEE: Piscataway, NJ, USA, 2020; pp. 125–130. [Google Scholar]
  30. Chowdhury, M.E.; Rahman, T.; Khandakar, A.; Mazhar, R.; Kadir, M.A.; Mahbub, Z.B.; Islam, K.R.; Khan, M.S.; Iqbal, A.; Emadi, N.A. Can AI help in screening viral and COVID-19 pneumonia? IEEE Access 2020, 8, 132665–132676. [Google Scholar] [CrossRef]
  31. COVID-19 Radiography Database. Available online: https://www.kaggle.com/tawsifurrahman/covid19-radiography-database (accessed on 10 February 2021).
  32. RSM Italian Society of Radiology. Available online: https://www.sirm.org/category/senzacategoria/covid-19/ (accessed on 22 October 2021).
  33. COVID-19 Chest X-ray. Available online: https://github.com/ieee8023/covid-chestxray-dataset (accessed on 10 February 2021).
  34. Radiopaedia | Epoch (Machine Learning). Available online: https://radiopaedia.org/articles/epoch-machine-learning#:~:text=An%20epoch%20is%20a%20term,of%20data%20is%20very%20large (accessed on 6 May 2021).
Figure 1. Workflow diagram of the proposed customized CNN model.
Figure 1. Workflow diagram of the proposed customized CNN model.
Applsci 11 10301 g001
Figure 2. COVID-19 and normal X-rays sample from the dataset.
Figure 2. COVID-19 and normal X-rays sample from the dataset.
Applsci 11 10301 g002
Figure 3. COVID-19 and normal X-rays sample from the dataset.
Figure 3. COVID-19 and normal X-rays sample from the dataset.
Applsci 11 10301 g003
Figure 4. X-ray image before preprocessing: (a) picture; (b) X-ray image after preprocessing.
Figure 4. X-ray image before preprocessing: (a) picture; (b) X-ray image after preprocessing.
Applsci 11 10301 g004
Figure 5. Complete layered architecture of proposed CNN model.
Figure 5. Complete layered architecture of proposed CNN model.
Applsci 11 10301 g005
Figure 6. Example of a convolution layer which takes images/feature maps of previous layers as input and generates its own feature maps.
Figure 6. Example of a convolution layer which takes images/feature maps of previous layers as input and generates its own feature maps.
Applsci 11 10301 g006
Figure 7. Example of a max-pooling layer which takes feature maps of previous layers as input and generates its own reduce sized feature maps.
Figure 7. Example of a max-pooling layer which takes feature maps of previous layers as input and generates its own reduce sized feature maps.
Applsci 11 10301 g007
Figure 8. Accuracy evolution: (a) picture; (b) loss evolution.
Figure 8. Accuracy evolution: (a) picture; (b) loss evolution.
Applsci 11 10301 g008
Figure 9. Graph with the execution time of each epoch.
Figure 9. Graph with the execution time of each epoch.
Applsci 11 10301 g009
Figure 10. Confusion matrix.
Figure 10. Confusion matrix.
Applsci 11 10301 g010
Figure 11. COVID-19 X-rays were tested output which produced by model are shown.
Figure 11. COVID-19 X-rays were tested output which produced by model are shown.
Applsci 11 10301 g011
Figure 12. Normal X-rays and outputs produced by the model.
Figure 12. Normal X-rays and outputs produced by the model.
Applsci 11 10301 g012
Table 1. Dataset information.
Table 1. Dataset information.
SourceCOVID-19
Samples
Normal SamplesType
Kaggle [31]300400PA
GitHub [33]1000PA
Total400400
Table 2. Summary of proposed CNN model showing layer names, output shapes and parameters.
Table 2. Summary of proposed CNN model showing layer names, output shapes and parameters.
Layer (Type)Output ShapeParameters
Conv2D(None, 222, 222, 32)896
Conv2D(None, 220, 220, 64)18,496
MaxPooling2D(None, 110, 110, 64)0
Dropout(None, 110, 110, 64)0
Conv2D(None, 108, 108, 64)36,928
MaxPooling2D(None, 54, 54, 64)0
Dropout(None, 54, 54, 64)0
Conv2D(None, 52, 52, 128)73,856
MaxPooling2D(None, 26, 26, 128)0
Dropout(None, 26, 26, 128)0
Flatten(None, 86528)0
Dense(None, 64)5,537,856
Dropout(None, 64)0
Dense(None, 1)65
Total: 5,668,097
Table 3. Data distribution.
Table 3. Data distribution.
ClassTrainingValidation
COVID-19300100
Normal300100
Total600200
Table 4. Performance Table.
Table 4. Performance Table.
AccuracyPrecisionRecallF1-Score
98.5%98%98%98%
Table 5. Comparison table.
Table 5. Comparison table.
MethodCOVID-19
Samples
Normal SamplesClassAccuracyPreprocessing
Xception CNN [20]2871349Multi91%
DL-CRC [21]20927,228Multi93.94%
CNN [23]278278Binary89.7%-
ConvNet [24]250500Binary97.78%-
Sequential CNN [29]206206Binary97.56%
CheXNet [30]165165Multi99.7%
Customized
CNN (this work)
400400Binary98.5%
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Farooq, M.S.; Rehman, A.U.; Idrees, M.; Raza, M.A.; Ali, J.; Masud, M.; Al-Amri, J.F.; Kazmi, S.H.R. An Effective Convolutional Neural Network Model for the Early Detection of COVID-19 Using Chest X-ray Images. Appl. Sci. 2021, 11, 10301. https://doi.org/10.3390/app112110301

AMA Style

Farooq MS, Rehman AU, Idrees M, Raza MA, Ali J, Masud M, Al-Amri JF, Kazmi SHR. An Effective Convolutional Neural Network Model for the Early Detection of COVID-19 Using Chest X-ray Images. Applied Sciences. 2021; 11(21):10301. https://doi.org/10.3390/app112110301

Chicago/Turabian Style

Farooq, Muhammad Shoaib, Attique Ur Rehman, Muhammad Idrees, Muhammad Ahsan Raza, Jehad Ali, Mehedi Masud, Jehad F. Al-Amri, and Syed Hasnain Raza Kazmi. 2021. "An Effective Convolutional Neural Network Model for the Early Detection of COVID-19 Using Chest X-ray Images" Applied Sciences 11, no. 21: 10301. https://doi.org/10.3390/app112110301

APA Style

Farooq, M. S., Rehman, A. U., Idrees, M., Raza, M. A., Ali, J., Masud, M., Al-Amri, J. F., & Kazmi, S. H. R. (2021). An Effective Convolutional Neural Network Model for the Early Detection of COVID-19 Using Chest X-ray Images. Applied Sciences, 11(21), 10301. https://doi.org/10.3390/app112110301

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop