Detection of COVID-19 Cases In Chest X-ray Images Using Wavelets And Support Vector Machines

This paper presents a novel technique for the detection of COVID-19 cases in chest X-ray scans. The proposed system uses the Wavelet transform (WT) to find discriminative features in the X-ray images and Support Vector Machines (SVM) to classify the extracted features. The WT is well-known for its energy compression capability. The proposed system preprocesses the chest X-ray image with WT which produces a set of approximation coefficients that include a limited number of high-magnitude coefficients. The proposed system introduces a novel threshold scanning technique that extracts only selected high-energy approximation coefficients. The thresholded coefficients are encoded using a modified version of the run-length encoding (RLE) scheme. The resulting code vector is used as the features representing the input image. These limited features are then presented to a SVM for classification (normal or COVID-19). The use of limited features in the proposed system significantly simplifies the work of the SVM classifier and increases its accuracy. Another advantage of diminishing the number of features is the reduction of the time complexity of the system. The proposed system produces a maximum accuracy of 94.5% when the decomposition level is 2 and the threshold level is 903. the accuracy is computed versus the Wavelet decomposition level. This experiment used the Haar wavelet. A maximum accuracy of 76.14 % occurred for a decomposition level of 2.


INTRODUCTION
The coronavirus disease (COVID), also known as the COVID-19 pandemic, was first identified in Wuhan, China, in late 2019. The World Health Organization (WHO) declared the pandemic a Public Health Emergency in February, 2019 and a pandemic in March, 2019. As of May 2020, more than 4.5 million cases of COVID-19 have been reported in more than 180 countries, leaving more than 300,000 deaths. About 1.64 million people have recovered [1].
The virus mainly spreads among people in the same vicinity, especially through small droplets produced by talking, coughing, and sneezing. The droplets do not travel through air over long distances, but rather fall onto surfaces or to the ground [2]. An analysis of thousands of cases in China did not report any airborne transmission. A person may get infected by touching a contaminated surface or object and then touching his/her face [3][4][5]. Spread of the virus may occur from people who do not show symptoms [6]. However, the virus is most contagious during the first three days after the arrival of symptoms.
Fever is the most common symptom. Other symptoms may include cough, shortness of breath, fatigue, and loss of smell. Complications may include acute respiratory distress syndrome and pneumonia [7]. The time from exposure to onset of symptoms may vary from two to fourteen days, but is normally around five days [8] . People only need to wear a mask if they are taking care of a person with suspected corvid -19 infection. Wearing a mask is important if a person is coughing or sneezing. To date, there are no specific vaccines, medicines, or specific antiviral treatment for COVID-19. According to the World Health Organization (WHO), treatments are under investigation, and have been tested through clinical trials. Available treatment is restricted to symptomatic and supportive therapy.
Presented in this paper is a novel COVID-19 detection system based on WT and support vector machines (SVMs). Experimental results show that the proposed WSVM system outperforms commonly proposed systems such as the Conventional Neural Networks (CNNs). The proposed system produces a high accuracy rate of 94.5%.

THE STATE OF THE ART IN COVID-19 DETECTION
As of May 11, 2020, the status of the countries most hit by the virus is shown in Table 1. The viral test (RT-PCR, antigen, isothermal nucleic acid amplification) detects the presence of the virus itself [9]. RT-PCR is considered the most acceptable method for diagnosing COVID-19. RT-PCR (Reverse transcription polymerase chain reaction) is a laboratory technique that combines reverse transcription of RNA into DNA. The other approach for diagnosing COVID-19 is based on the detection of antibodies produced in response to infection [10]. Antibody tests can determine if a person has had the disease, even if he/she was asymptomatic or had minor symptoms. However, antibody tests may not be able to find antibodies in a person who is currently infected with COVID-19.
Automatic or computer-aided diagnosis (CAD) systems are based on machine learning and Artificial intelligence (AI) methods. In this section, we review some of the most recent automatic techniques in COVID-19 detection. Wang et al. [11] proposed a deep learning technique for COVID19 detection (COVID-Net), which achieved a classification accuracy of 92.4% in classifying normal, pneumonia, and COVID-19 classes. Hemdan et al. [12] diagnosed COVID-19 in X-ray images using deep learning models and proposed a COVIDX-Net model that consisted of 7 CNN models. Sethy et al. [13] used SVM to classify the features in X-ray images, obtained from various convolutional neural network models. They reported that the ResNet50 model with a SVM classifier provided the highest accuracy. Ioannis et al. [14] developed a deep learning model using 224 confirmed COVID-19 images. Their model obtained 98.75% accuracy for a two-class problem and a 93% accuracy for a three-classes problem. Narin et al. [15] achieved a 98% detection accuracy in chest X-ray images using the ResNet50 model.

MATERIALS AND METHODS
The proposed system uses the Wavelet transform (WT) to find discriminative features in the X-ray images and a SVM to classify the extracted features. The WT is well-known for its energy compression capability. The proposed system preprocesses the chest X-ray image with WT which produces a set of approximation coefficients that include a limited number of highmagnitude (energy) coefficients. The proposed system presents a novel threshold scanning technique that extracts only selected high-energy approximation coefficients. The small number of extracted coefficients are encoded and used as features representing the input image. These limited features are then applied to a SVM for classification (normal or COVID-19). A block diagram showing the main stages of the proposed system is depicted in Fig.1. The first operation performed by the proposed system is to apply the WT on the input image, which represents any chest X-ray image in the employed dataset.

3.1Chest X-ray Image Dataset
The chest X-ray images representing COVID-19 cases were obtained from Cohen [16]. Cohen gathered the COVID-19 images from different public sources. At the time of writing this report, there were 125 chest X-ray images diagnosed with COVID-19 in the database. The images were gathered from 43 females and 82 males whose diagnosis were positive. The images had different formats (png, jpg, and jpeg). A total of 88 positive cases were taken from this database. Fig. 2 (top) shows sample COVID-19 images that came from this database. This database, however, does not contain normal (negative) cases. Fortunately, normal chest X-rays are abundantly available. In this study, the normal chest X-ray images were obtained from the Chest X-ray8 database provided by Wang et al. [17]. Chest X-ray8 comprises 108,948 frontal view X-ray images of 32,717 patients. For this study, only 88 normal (no-findings) images were taken from this database. Fig. 2 (bottom) shows sample images drawn from the chest X-ray database. Hence, our dataset consisted of 88 COVID-19 images and 88 normal images, giving a total of 176 chest X-ray images. Since the number of COVID-19 images was limited, 80% of the images were used for training and the rest was used for testing. Other public COVID-19 chest X-ray images can be found in [18-20]. The original images comprising the employed dataset were of different spatial and intensity resolutions. All images were first converted to 8-bit gray-scale images with spatial resolution of 512 x 512.

Support Vector Machines
SVMs, originally proposed by Cortes and Vapnik [21], are supervised machine learning algorithms that have been widely implemented in regression and classification applications. A SVM is considered one of the top Artificial Intelligence (AI) algorithms. SVMs can solve linear and non-linear problems. As depicted in Fig. 3, a SVM classifies data by finding the most similar examples (support vectors) among classes and determining the best hyperplane that isolates the data points of the classes. In two-dimensional (2-D) data, the hyperplane becomes a simple line.
A SVM tries to find the widest possible margin that separates the two classes with no interior data points. SVMs were originally designed to be binary or wo-class classifiers. However, SVMs have been altered to tackle data composed of more than two classes [22]. SVMs have shown remarkable success in solving linear and non-linear classification problems [23][24]. A scatter diagram of the dataset decomposed at Level 2, using the Haar wavelet, is shown in Fig.4. The  The SVM algorithm implemented here uses the Gaussian kernel defined by: where σ is a user-defined variance parameter.
The Gaussian kernel is a general-purpose kernel. It can be used when there is no prior information about the data. Other kernels include the Polynomial kernel, Gaussian radial basis function (RBF), Laplace RBF kernel, Hyperbolic tangent kernel, and Sigmoid kernel. The second stage of the proposed system is to use the WT to obtain discriminative features from the input image.

Wavelet Transform and Optimum Threshold Level
The WT or Wavelet decomposition, is a mathematical function (transform) that gives another way of representing the input signal or image. The WT is a lossless or energy invariant transform which means that the signal's energy does not change when it is transformed [25][26].
The Wavelet decomposition tree, depicted in Fig. 5, illustrates the major operations performed by Wavelet decomposition operating on an input signal. The input signal, at the first level of decomposition, produces approximation and detail coefficients. The approximation coefficients represent the low frequency contents of the input signal and the detail coefficients represent the high-frequency contents. At the second level of decomposition, the approximation coefficients produce two sets of approximation and detail coefficients, whose lengths are equal to half of the length of the original approximation vector. The process of decomposition further splits the approximation coefficients into two new vectors for each subsequent level of decomposition [27][28][29]. The WT possesses a great energy compaction property since most of the energy of the transformed signal is concentrated in few large coefficients. This property implies that small coefficients can be replaced by zeros without introducing a huge distortion in the reconstructed signal. The energy compactness property of WT has been successfully utilized in image compression schemes, such as the jpeg compression scheme [30]. In data compression methods, only wavelet coefficients which contain most of the signal energy are retained for use in the signal reconstruction. In the proposed system, we exploit this energy compression property of the WT to form a discriminative feature vector representing the input image. The proposed hard-thresholding scheme is given by: where, ̂( i), and C(i) are the ith approximation coefficient after and before thresholding, respectively; and T is the threshold level.
indicates that the elimination of small-valued coefficients can be achieved by setting to zeros, all coefficients whose values are less than a certain threshold level. An illustration of the proposed scanning technique, using a threshold value of 3, is shown in Table-2. By selecting a nonnegative threshold, the small approximation coefficients can be reset to zeros, resulting in a vector of approximation coefficients consisting of mostly zeros. A thorough description of thresholding methods can be found in [32][33]. The resulting thresholded vector is then encoded by the proposed system, using a modified version of the run-length encoding (RLE) scheme. The RLE scheme is used in MPEG, JPEG, H.263, and H.261 compression schemes [31]. It replaces a string of identical values by codes to indicate the value and the number of times it occurs. To illustrate the modified RLE scheme employed in this study, consider an approximation vector consisting of 60 zeros. It can be replaced by two numbers. The first number is zero, which indicates the string zeros (spaces) and the other number is 60, which indicates the number of zeros. Fig. 6 depicts an illustration of the modified RLE scheme used in this study. The resulting code vector is used as the feature vector representing the input image. The last step of the proposed system is to present the code vector to a SVM for classification.

DISCUSSION AND RESULTS
In the first experiment (Fig.7), the accuracy is computed versus the Wavelet decomposition level. This experiment used the Haar wavelet. A maximum accuracy of 76.14 % occurred for a decomposition level of 2.

Figure 7: Accuracy versus Wavelet Decomposition Level
Since the optimum decomposition level is 2, we further investigate the approximation coefficients at level 2. Fig. 8 shows the histogram of the approximation coefficients of all the 176 images comprising the employed dataset, decomposed at level 2 using the Haar wavelet. Fig. 8 indicates that only few approximation coefficients have high magnitudes. Specifically, a small subset of the approximation coefficients has magnitudes greater than 900. Next we investigate the accuracy using threshold values around 900 at a decomposition level of 2. The threshold values were investigated in the range between 900 and 905. The experiment indirectly investigates the accuracy as a function of retained approximation coefficients after thresholding, using a decomposition level of 2 and the Haar wavelet. Fig. 9 depicts the accuracy as a function of threshold level. Fig. 9 shows that a maximum accuracy of 94.5% is achieved when the threshold level is 903. In the experiment of Fig.9, approximation coefficients whose absolute values are less than the variable threshold level, were set to zeros. The resultant thresholded vector is composed of mostly zeros and is then encoded using a modified RLE scheme. This procedure reduces the number of features that have to be learned by the SVM classifier and simplifies its job. Another advantage of diminishing the number of features is the reduction of the time complexity of the overall system. Several statistical measures are used to analyze the performance of the proposed WSVM system. Specifically, the performance of the proposed algorithm is evaluated by computing the sensitivity (SE), specificity (SP) and accuracy (AC) as follows: Accuracy is the fraction of the real events that are correctly detected and the non-events that are correctly rejected, among all events and non-events and is given as: Sensitivity: is the fraction of real events that are correctly detected among all real events and is defined by Specificity is defined as the fraction of nonevents that are correctly rejected and is given by: where, FP: number of false positive specimens (predicts normal as COVID-19). TP: number of true positive specimens (predicts COVID-19 as COVID-19). FN: number of false negative specimens (predicts COVID-19 as normal). TN: number of true negative specimens (predicts normal as normal).
The prevalence is determined from the sensitivity, specificity, and accuracy using the following equation: Accuracy = (sensitivity) (prevalence) + (specificity) (1 − prevalence) The calculated SE, SP, AC, and prevalence are given in Table 3.  Table.3 shows that the proposed system produces high sensitivity and specificity values, indicating that the system is reliable and robust.

CONCLUSION
In this paper, a novel approach to the classification of COVID-19 using WT and SVM is proposed and developed. The WT is well-known for its energy compression capability. The proposed system preprocesses the chest X-ray image with WT which produces a set of approximation coefficients that include a limited number of high-magnitude (energy) coefficients. The proposed system uses a novel threshold scanning technique that extracts only selected highenergy approximation coefficients. The small number of extracted coefficients are encoded and used as features representing the input image. These limited features are then applied to a SVM for classification (normal or COVID-19). To determine the optimum threshold level, one can start by inspecting the histogram of the approximation coefficients or by using statistical moments of the approximation coefficients. Other thresholding schemes used in image compression were cited in the paper.
The proposed system significantly reduces the dimensions of the input image which in turn, simplifies the work of the SVM classifier and increases its accuracy. Another advantage of reducing the number of features is the reduction of the time complexity of the proposed system. Most of the systems that are currently proposed in the literature of COVID-19 detection, present the input chest X-ray image directly to a CNN classifier or other classifiers without doing any preprocessing to the input image.
The rival system, the CNN classifier, cannot compete with the proposed system in this application, as the CNN system requires a substantial amount of training data. However, there is currently a significant lack of COVID-19 chest X-ray images. The proposed system, on the other hand, does not require much data for training. Experimental tests on the employed databases achieved 94.5% of recognition accuracy using a threshold value of 903, decomposition level of two, and the dB 1 wavelet.
The author declares that no external funding was received for this work.