Wavelet Based CNN for Diagnosis of COVID 19 using Chest X Ray

Human race has overcome numerous pandemic and epidemics like Spanish flu, SARS, cholera, plague, etc since ages and COVID 19 pandemic is one among them. COVID 19 being the recent one, is much different than the others due to the contribution of AI in diagnosis and prediction of COVID 19 patients. Among the various use cases, one widely used area is medical diagnosis. AI and deep learning based algorithms are exploited enormously by data scientist to support radiologist in early prediction and detection of corona patients. Subsequently, in this work, we utilize wavelet based Convolutional Neural Networks for detecting and recognizing of COVID 19 cases from chest X ray images. Currently, previous works utilize existing CNN architectures for classification of healthy and affected chest X rays, however these networks process the image in a single resolution and loss the potential features present in other resolutions of the input image. Wavelets are known to decompose the image into different spatial resolutions based on the high pass and low pass frequency components and extract valuable features from the affected portion of lung X ray efficiently. Henceforth, in this article, we utilize a hybrid CNN model of wavelet and CNN to diagnose the lung X rays. The proposed CNN model is trained and validated on open source COVID 19 chest X ray images and performs better than existing state of the art CNN models with an accuracy of 99.25%, ROC-AUC value of 1.00 and very less false negative values. Further, the performance of our model is validated by Gradient Class Activation Map visualization technique. The visualization of feature maps clearly indicates that our proposed network has perfectly extracted features from the corona virus affected portion of the lung.


Introduction
Corona virus disease (COVID-19) is an infectious viral infection that is caused due to novel corona virus strain called COVID 19. People with higher immunity power when affected with this novel corona virus strain are diagnosed for mild respiratory illnesses and are able recover without the need for any special treatment. People in their old age and already diagnosed with other medical ailments like cardiovascular issues, diabetes (type I and type II), chronic respiratory disorders, and cancer are more likely to be affected highly with novel corona virus. However, still now vaccines distribution among a large human population has not yet happened. Early diagnosis of the disease can control the spreading of corona virus. Till this time there is no specific technique for identifying the infected patients within a day, the diagnosis was made using Reverse Transcription Polymerase Chain Reaction (RT-PCR). We can also see some disadvantages for associated this PCR test which include discomfortness of the patient, time consuming, low flexibility and less availability of materials utilized in the test. There was a great challenge for the researchers to predict the infected patient within few hours. When, using imaging the threshold for detecting of covid infection from chest X rays varies depending on the published guidelines in each local area. In order to overcome this problem, an alternative technique for the diagnosis of covid-19 can be made by the researches by using convolutional neural network. Doctors predict that the infection due to the corona virus affects the lungs and causes respiratory disorders. From this, we can clearly identify that there would be some changes or some layer of lesion on the lungs. The symptoms of n-COVID 19 would be fever, dry cough, tiredness and mild to moderate respiratory disorders. When a person of these symptoms approaches a doctor, an antigen test which is commonly called as PCR test, can be done and the patient should wait for about two days to find the result whether he is affected by this virus or not. Due to the over spreading of the virus and the unavailability of PCR equipments, it is very difficult to make a huge number of test for a particular day. Therefore, the researchers suggest a medical imaging technology, in order to diagnose the patients. The imaging of the chest can be obtained by computed tomography scan or X rays and following this a mathematical approach could predict the presence of virus.
The prediction of covid-19 using CT scan images or X rays of a chest is not so easy. Only radiological experts and few doctors who are familiar with this kind of medical imaging can estimate the presence of corona virus using CT scan image. Therefore, research starts off automatically in detecting the possible presence of corona virus by using convolutional neural networks. The proposed work aims to predict the covid-19 from chest X-ray images with wavelet based convolutional neural network.
Currently, many CNN architectures are utilized to classify the lung chest X ray images of suspected patients. Most of these architectures use the chest x ray images directly and often process the image in spatial domain itself. But, essential texture features predominant for covid 19 classification are better extracted and obtained in spectral domain only. However, existing CNN architectures hardly perform any kind of spectral analysis. Another, drawback with existing CNN architecture is that, the currently available architecture models process the input image in single resolution only, whereas for applications requiring multi resolution analysis, it is crucial to extract features in different resolutions. Henceforth, in an attempt to solve both the problems, we have developed a novel CNN architecture that utilizes wavelet and convolution layers to detect covid affected chest x ray.

II. Related work
Recently in healthcare and medical domain, deep learning has been extensively used for automation, specifically in medical imaging. In deep learning, convolutional neural networks is the widely used architecture for classification tasks and is also used in numerous other machine learning applications. Numerous studies in the literature have included variety of CNN architectures in order to estimate the presence of covid-19 using x-ray images. (Makris et al., 2020) [1] has proposed a deep learning and convolutional neural network approach for detecting covid-19 from chest X-ray images. The study proposed in this work employed nine CNN architectures for classification of X-Ray images obtained from patients infected with covid-19 and healthy individuals. The experimental research finding shows that the CNN has the potential to detect respiratory diseases with high accuracy even still a large amount of sample chest X ray images need to be collected.
In order to detect the presence of covid-19 on chest X-ray and chest CT scan images, an augmented CNN has been proposed by (Purohit et al., 2020) [2] in this work. The augmented image generated in this work utilizes multi image augmentation technique based on first and second order derivative edge operators. The proposed CNN model has three layers convolution, pooling and fully connected layers similar to LeNet CNN model. RELU and sigmoid activation functions were utilized in the model. ReLU non-linearity is used after each convolutional layer and sigmoid activation function is used finally for classification purposes.
(Novitasari et al., 2020) [3] has proposed a different technique for detection of covid using CNN as a feature extraction and support vector machine as a classifier. Three classifications are made on the basis of normal, pneumonia and covid-19 by extracting the features of chest x ray using googlenet, resnet18, resnet50and resnet101 architectures. The CNN classification model proposed by (Pathak et al., 2020) [4] uses ResNet-50 architecture for extracting the features of the given set of chest CT images. In order to train the covid-19 classification model, a transfer learning approach has been used and is based on the optimized hyper parameters of CNN model. K-fold validation model was done to prevent overfitting. The accuracy of the model was 96 percentages and can be used as an alternative to covid-19 testing kits.
Low cost automatic diagnosis of covid-19 investigated by (Apostolopoulos & Mpesiana, 2020) [5] utilize transfer learning based techniques for training convolutional neural network. 1427 chest X-ray images consisting of 224 covid positive images, 700 images of bacterial pneumonia and 504 healthy chest X ray images was utilized for training and the results suggest that with transfer learning best accuracy, IOP Publishing doi:10.1088/1757-899X/1084/1/012015 3 sensitivity and specificity is obtained. (Ahuja et al., 2020) [6] suggests a three step methodology to categorize the measured lung CT scan slices for detecting the presence of COVID-19. Data augmentation proposed in this technique is used to decompose the images into three levels using wavelet transform and in order to increase the size of data set a rotation, translation and shear operations were used. Two level grouping is performed using four diverse transfer learning-based architectures, such as ResNet18, ResNet50, ResNet101, and SqueezeNet, and their enactments are verified. However, they do not utilize spectral images as such in the architecture.
(Narin et al., 2020) [7] has utilized ResNet50, InceptionV3 and Inception-ResNetV2 for the detection of corona virus and pneumonia using chest X-rays. ROC analyses and confusion matrices for these models are analyzed using 5-fold cross validation and results show that 97% accuracy is obtained for InceptionV3 and 87% for Inception-ResNetV2. (Abbas et al., 2020) [8] has proposed a novel CNN model called Decompose, Transfer, and Compose (DeTraC), for the sorting of COVID-19 chest X-ray images. DeTraC can deal with any indiscretions within the image dataset by examining its class boundaries using a class decomposition technique. The result shows a sensitivity of 97.91%, and a specificity of 91.87% by for the identification of COVID-19 X-ray images.
(Zhang et al., 2020) [9] have proposed a new deep anomaly detection model for fast, efficient and reliable COVID-19 screening. The developed architecture in [9] has an end-to-end model without having any feature extraction techniques, and it requires chest X-ray images for diagnosis.(Ozturk et al., 2020) [10] have proposed a novel model called DarkCovidNet for the diagnosis of COVID-19 using X-ray images without requiring manual feature selection techniques. The model is designed with 17 convolution layers and in each DarkNet layer there is one convolutional layer followed by Batch Normalization and Leaky ReLU activations. Following this the model is evaluated for average sensitivity, specificity, and F1score values gives 95.13%, 95.30%, and 96.51% respectively.
(Hemdan et al., 2020) [11] have proposed a novel deep learning algorithm called COVIDX-Net to assist clinicians in automatic diagnosis COVID-19 in chest X-ray images. The COVIDX-Net includes seven different CNN models like modified VGG19, MobileNet v2 and so on.(Toraman et al., 2020) [12] has proposed an innovative artificial neural network (ANN) technique to detect COVID-19 X rays from healthy ones by using capsule networks. From the analysis, a good classification accuracy has been achieved with even an input image size of 128 x 128. This architecture got an accuracy of about 97.24%, and 84.22% for binary class and multi-class classification respectively.
(Yaşar & Ceylan, 2020) [13] have proposed a novel architecture to identify Covid-19 from Chest X-Ray images using Local Binary Pattern (LBP), Dual Tree Complex Wavelet Transform and CNN. DT-CWT utilizes two filters to work simultaneously and when applied to an image, processes are done for six different directions in which three of them indicate real and remaining three indicate imaginary sub-bands. These same experiments were again repeated with images obtained by applying Local Binary Patterns feature extraction to the X-Ray images. (Kakde et al., 2020) [14] has proposed an Optimal Classification of COVID-19: A Transfer Learning Approach. The first fully connected layers consist of 32 number of filters with ELU activation function, second fully connected layer consists of 64 number of filters and third fully connected layer consist of 128 number of filters with ELU activation function. The fully connected layers are followed by batch normalization after each layer to reduce the problem and vanishing gradient and it also reduces some amount of over fitting.

III. Wavelet Convolutional Neural Networks
Generally, if we consider any image they contain smooth regions interrupted by some angles or few abrupt changes in contrast. The most important data source will be in the region of abrupt changes. Analysis of data in these regions are difficult and it cannot be done using Fourier transform because it represents data only as a total sum of sine waves that are not localized in time or space. So, in order to analyze this abrupt change data, we need to go for another method in which the data can be analyzed in both time and frequency.
Wavelets can be analyzed in both time and frequency and it is considered to be a wave for a finite duration that comes in different sizes and shapes. The major strength of the wavelet analysis is the existence of wide range of wavelets. There are two major parts in wavelet transform, out of which scaling represents the extension or compression of the signal in time domain and it is inversely proportional to the frequency. Therefore, if the signal is scaled by a factor of 2, then the frequency will be reduced by half and when the signal is scaled by a factor of 0.5, the frequency will be increased by 2. This results in the fact that smaller scale factor results in a shrunken wavelet which corresponds to a high frequency and the larger scale factor The second important factor in wavelet transform is shifting which represents the delaying or advancement in the signal. The shifting of a wavelet transform is done to align the feature of the signal. Continuous wavelet transforms analyze the signal at intermediate scales with each octave, characterizing the oscillatory behavior of the signals and they can be used in time frequency analysis and filtering of time localized frequency component. The redundancy of the coefficients can be reduced by using discrete wavelet transform and this translation occurs at integer multiples which is best suited for de-noising and compressing the images and signals. De-noising an image can be obtained by performing a multilevel wavelet decomposition which means the discrete wavelet transform split the signal into an approximation level and detailed level which is also called as low pass sub band and high pass sub band. The details can be analyzed and a suitable thresholding technique can be used.
CNN filters the data, applies some non-linearity followed by max pooling or average pooling of the output. These steps are repeated to form the layers. There are few challenges with deep CNN like they require large data sets, significant computing resources for training and evaluation. Typically, we must choose mini settings for the network which do not independently affect the performance and also it is very difficult to understand and interpret the features. Therefore, in an attempt to address these problems, we have designed a novel CNN architecture with wavelet and traditional convolutional layers especially to process a small dataset in a limited resource environment. Further, this speeds up the deployment of developed CNN model in various medical environments to aid doctors and radiologist. Figure 1 shows the block diagram of our proposed wavelet CNN for diagnosis of covid 19 chest X ray images. The architecture has two small pipelines that process the data in two different input formats. Initially, the input image is given to a normal CNN architecture with three convolutional layers followed by global average pooling, dropout and flatten layers. The other branch process the output images obtained after wavelet decomposition. The input image is decomposed into three different resolutions using haar wavelets. The first level decomposed images are passed into two convolution layers and this output is concatenated with second level decomposed wavelet images. Both these together, are processed by two convolution layers and further concatenated with third level decomposed wavelet images. Finally, the obtained features are down sampled using global average pooling and flattened. The flattened output from both the branches are concatenated and processed by two dense layers and a dense layer with softmax function at last. Therefore, this architecture processes the images in spatial domain, spectral domain along with multi resolution analysis.
Processing images using wavelets helps the architecture to identify hidden pattern of lesions formed due to covid 19 virus. Further, decomposition into multiple resolutions compliments the model in lesion feature extraction. The wavelet branch extracts the texture and hidden patterns in chest x ray more precisely and the other branch which processes the image in traditional convolutional layers extracts other important features necessary for classification of covid 19 chest x ray images. The developed CNN algorithm was trained, tested and evaluated on open source kaggle dataset (https://www.kaggle.com/tawsifurrahman/covid19-radiography-database) of covid x ray images. The dataset consists of 219 covid positive images, 1341 healthy lung x ray images and 1345 viral pneumonia images. Among these, only covid positive and normal images are considered for training and testing. The entire dataset is split it training and testing with 20% images allocated for testing. The number of images is increased using data augmentation techniques during training to improve model performance and prevent overfitting of the model. The original images are resized to 224x224x3 figure size and given for training. Further, the model is trained on Adam optimizer with a decay learning rate for 30 epochs with initial learning rate as 3e-4 and batch size 32.

IV.2 Performance of Wavelet CNN for diagnosis of Covid 19:
The proposed wavelet CNN is trained on covid radiography dataset and 5 fold stratified cross validation is done to ensure the performance of the model. Table 1 shows the results obtained from 5 fold cross validation. The model is found to deliver very high performance on covid 19 chest x ray images with an average training accuracy of 99.37% and average testing accuracy of 99.25% with training error 0.0261 and testing error 0.0021 on average. Figure 3a shows the performance plot of wavelet CNN for covid 19. From the plot, it can observed that the model is found fit extremely well on the dataset with very less or nil overfitting. Also, the difference between training and validation error which is generalization error is also very less, thereby proving that the model generalizes well on the testing data and performs on unseen test images. Therefore, this proves that the proposed wavelet CNN model has perfectly combined both wavlet features and spatial features obtained from two branches of the network while training and thereby learning better and improving the model performance on a limited and small dataset.

IV.3 Performance Metrics, Confusion Matrix and ROC -AUC
In order to further evaluate the performance of the model, we obtain precision, recall, F1 score and support for test dataset. Table 2 shows the performance metrics of the model for wavelet CNN. From the table, it can be observed that model has very high precision, recall and f1 score value on the test dataset. This shows that the model has very little or almost nil misclassification error on test data. Further, high values are also obtained using macro and weighted averaging method.
Further, figure 3b shows the confusion matrix of test dataset for the proposed Wavelet CNN architecture. The confusion matrix shows that the model performs extremely well on the inter classification between covid and normal chest x ray images. This further ensures that the model is highly reliable for diagnosis of covid 19 using chest x ray.
In addition to this, figure 3c shows the ROC-AUC curve of proposed Wavelet CNN model. From the figure, it can be observed that we obtain an ideal ROC AUC curve as a straight line. The ROC AUC

IV.4 Grad CAM Visualization of Proposed Wavelet CNN
Previously, CNN was often considered as a black box and visualization of internal feature maps was one such technique that allowed researchers to clearly understand of how CNN extracted features. Among the various types of visualization techniques, Gradient Class Activation Map (Grad CAM) is one which helps us exactly identify which portion of image was utilized for classification. Figure 6 shows the Grad CAM visualization of COVID 19 images tested on wavelet CNN architecture. In figure 6, the highlighted part in rainbow colour indicates the portion of image that was primarily responsible for classifying the given image as covid 19 infected one.
On close observation, it can be inferred that, in first image the lung with higher lesions (left lung) has been highlighted correctly. Similarly, in second and third samples, left and right lung are highlighted respectively. Further, in fourth image, left lung is found to have higher lesions and that has been exactly highlighted by GradCAM.

V. Conclusion:
Therefore, in this work we propose a novel CNN architecture that overcomes the disadvantages of traditional CNN models. In proposed CNN architecture, wavelets are utilized to extract features in multiresolution images and also in spectral domain. Including wavelets, combines the advantage of multiresolution and spectral domain analysis into the existing CNN architectures, thereby improving its performance with a richer feature set. Further, the performance of the model is validated through Grad CAM visualization and the important features extracted within the lungs are analyzed. Henceforth, the developed Wavelet CNN model is found to classify affected chest X ray from the healthy ones precisely.