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

: COVID-19 has been difﬁcult 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 beneﬁcial. 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 classiﬁcation 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 identiﬁes COVID-19 patients quickly, which is helpful in controlling the COVID-19 outbreak.


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.

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 Appl. Sci. 2021, 11, 10301 4 of 17 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.

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.
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.

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.

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.

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.

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. 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.

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.

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.
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.

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.

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.

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.

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.   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.

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.

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.

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.

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.

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.

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.

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.  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 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.

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.
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.

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. 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.

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 Ten-sorFlow 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.

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. 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.

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 Ten-sorFlow 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.

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.

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.

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.
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. Accuracy: = + + + + 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 Figures 11 and 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. 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 Figures 11 and 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.

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

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

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.

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.

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 maxpooling 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.