Fuzzy enhancement and deep hash layer based neural network to detect Covid-19

This paper proposes a deep learning framework for Covid-19 detection by using chest X-ray images. The proposed method first enhances the image by using fuzzy logic which improvises the pixel intensity and suppresses background noise. This improvement enhances the X-ray image quality which is generally not performed in conventional methods. The pre-processing image enhancement is achieved by modeling the fuzzy membership function in terms of intensity and noise threshold. After this enhancement we use a block based method which divides the image into smooth and detailed regions which forms a feature set for feature extraction. After feature extraction we insert a hashing layer after fully connected layer in the neural network. This hash layer is advantageous in terms of improving the overall accuracy by computing the feature distances effectively. We have used a regularization parameter which minimizes the feature distance between similar samples and maximizes the feature distance between dissimilar samples. Finally, classification is done for detection of Covid-19 infection. The simulation results present a comparison of proposed model with existing methods in terms of some well-known performance indices. Various performance metrics have been analysed such as Overall Accuracy, F-measure, specificity, sensitivity and kappa statistics with values 93.53%, 93.23%, 92.74%, 92.02% and 88.70% respectively for 20:80 training to testing sample ratios; 93.84%, 93.53%, 93.04%, 92.33%, and 91.01% respectively for 50:50 training to testing sample ratios; 95.68%, 95.37%, 94.87%, 94.14%, and 90.74% respectively for 80:20 training to testing sample ratios have been obtained using proposed method and it is observed that the results using proposed method are promising as compared to the conventional methods.


Introduction
The usage of machine learning (ML) intends to impart intelligence by a machine in solving various real time problems. In healthcare sector, ML can act as a transforming edge for clinical decisions [1]. ML algorithms provide precise and accurate information by training any image data which helps to detect the * Corresponding author. Arvind Dhaka, Assistant Professor, Manipal University Jaipur, India. E-mail: arvind.neomatrix@ gmail.com. particular disease in its early stage. The major requisite of ML algorithm is availability of real time data and high computational power [2,3]. For a pandemic situation like Covid-19, ML can be used to predict the infection in patients in its early stage which can help the clinical industry to identify the effective treatment. Covid-19 disease has 2% fatality rate and most of the deaths are due to respiratory failure [4,5]. If early detection of Covid-19 is performed then the further spread of this disease can be reduced by referring the patient to quarantine. World Health Organization (WHO) is receiving data from all over the world for this pandemic and this data is also made available to public by different image repositories which enables the researcher to design an automated diagnosis for this disease [6,7]. Thus, the need it to develop an efficient ML algorithm for prediction of Covid-19 infection with higher accuracy. This paper proposes a model which has been analyzed by two classification algorithms i.e. SVM and ELM with the use of chest X-ray image. The outcomes of classifier are adopted in this paper for Covid+and Pneumonia identification. This paper uses an integration of deep learning (DL) with ML and has several advantages in terms of feature extraction and classification which can benefit the clinical decisions. DL refers to extract features by using deep convolutional neural networks (CNNs) [8]. The CNN layer processes all non-linear information. The deeper the layer is the more complex information is learned [8].
The fuzzy set theory is used to enhance the intensity and contrast of dark areas of image by setting the fuzzy rules in such a way that the pixels with incomplete information of redundant information are separated. In this paper, we have chosen the fuzzy logic based approach for image pre-processing so that the image quality can be enhanced by using fuzzy membership of intensity and noise threshold. Moreover, it makes it easier to divide the image into smooth and detail regions because these regions are separated by comparing the intensity threshold as computed in fuzzy logic based approach.
In this paper, we have used the chest X-ray images for automatic diagnosis of Covid-19 by training and testing the proposed model. We have used chest Xray image dataset [6,7] to train and test the proposed model in three ratios of training to testing samples i.e. 20:80, 50:50 and 80:20. We have observed that as the number of training images increase the prediction accuracy also increases. We have first developed a deep CNN using a hashing layer to learn the imaging characteristics of the chest X-ray image. Then we have analyzed the performance of proposed method by using extreme machine learning (ELM) classifier [9] and support vector machine (SVM) classifier [10] to classify Covid+, Pneumonia and Normal cases. ELM method has shown better performance over SVM method for the given training set. The hashing layer that has been introduced in the proposed model transforms the high dimensional feature information into low dimensional binary data. This binary data captures the detailed regions of Covid infection effectively. It has been observed that Covid+images have more detailed regions and Covid-images have more smooth regions. Thus a smaller patch size is effective for capturing these detailed regions more precisely. The performance of the proposed method has been compared with other state-of-art methods. It is assumed that the proposed method is superior to other methods. We have obtained promising results that show the effectiveness of proposed method for automatic detection of Covid-19.

Contribution
The contribution of this paper is as follows: 1. Initially, the chest X-ray images of the patients are fuzzified in terms of intensity enhancement and noise suppression. 2. The enhanced image is divided in sub-regions as smooth and detail regions by using a block based sliding window method. 3. The features are extracted from these subregions and are used for training the deep neural network. 4. A new hashing layer is added in the proposed network which transforms the high dimensional real features into low dimensional binary features.
The rest of the paper is as follows: Section 2 presents literature overview; the proposed method and the proposed algorithm have been detailed in Section 3. Section 4 discusses results and finally Section 5 concludes the paper.

Literature review
In [11] the authors proposed a COVIDX-Net arctitecture that included seven different architectures of deep CNN models. But, due to the lack of public COVID-19 datasets, the study is validated on 50 Chest X-ray images only. In [12][13][14] the authors have analysed the existing deep learning architectures for classifying Covid cases. In [14] the authors have proposed a COVID-Net Deep CNN architecture which was tested for 13870 chest X-ray images and obtained classification accuracy of 93.3%. In [15] authors have proposed deep CNN framework known as DeepCOVIDExplainer which was tested for 16995 chest X-ray images and obtained 93.1% classification accuracy. In [16] the authors proposed DarkCovidNet model for detecting the Covid virus in 1125chest X-ray images and obtained 98.08% classification accuracy. In [17] authors have 260 chest X-ray images to train the DL model. But, due to limited number of training set the accuracy was not validated. In [18] the authors adopted the concept of transfer learning with CNN and proposed a model for Covid detection but the number of classes were taken as 2 and 3 only. This model had an average 3-class classification accuracy of 92%. In [19] the authors have used a pre-trained ResNet-50 for detecting the Covid virus in chest X-ray images and obtained 96.23% classification accuracy. In [20] the authors used SVM classifier with Res-Net model for detecting the Covid virus in chest X-ray images and obtained 95.38% classification accuracy in 41 epochs only. In [21] the authors implemented a hybrid deep learning model by using SVM classifier and obtained accuracy of 90.5 %. In [22] the authors used the existing DL method to extract image features but have not used any technique for improvising the feature extraction.
Based the literature review it has been observed that various deep learning frameworks have been proposed for early detection of COVID-19 in the patients. But, so far the feature extraction which is fur-ther fed to the training model has not been improved as per literature survey. Moreover, the researchers have not used any technique for improvising the image during pre-processing. In this paper we have pre-processed the image using a fuzzy based method and overall accuracy of the proposed deep network has been improvised by inserting a hashing layer after fully connected layer.

Proposed model
In this paper we propose a machine learning framework for Covid-19 detection. The process starts with image pre-processing which enhances the chest Xray images using fuzzy logic [23]. Then the image is divided into smooth and detail regions on the basis of pixel intensity. After fuzzification, the features are extracted using machine learning (ML) method. After feature extraction the training data is generated and classifier is trained to detect Covid+, Pneumonia and Normal cases. Figure 1 presents the block diagram of the proposed model.

Fuzzy based enhancement of chest X-ray
We propose a method, which enhances the contrast between the infrared region and surrounding areas of the X-ray image. Consider, I (i, j) as the input image with pixel space (i, j). The image is first preprocessed to bring it to the image size N × N. In image pre-processing the fuzzy logic based enhancement is performed on the chest X-ray images.

The fuzzification algorithm
The proposed algorithm for fuzzy based enhancement of chest X-ray is based on the pixel intensity and background noise. Algorithm 1 presents the steps for Fuzzy enhancement of chest X-ray image. The step-wise algorithm is detailed as follows: Step 1: The intensity value of each pixel is calculated as Where, I max and I min are maximum and minimum intensity of pixel. G (i, j) is absolute value of image gradient to pixel intensity. I intensity (i, j) is the intensity of pixel at pixel space (i, j).
Step 2: The fuzzy membership function [24,25] is modeled in such a way that it reduces the effect of background noise. The intensity m intensity and noise (m noise ) values with which the fuzzy limits are set are given as Where N is normalized membership value, σ min is minimum standard deviation from fuzzy set [26][27][28].
The term m denotes fuzzy membership operator which is chosen on the basis of detail and smooth regions. In the fuzzification process, each pixel can be classified as detail or smooth pixel on the basis of membership value. The membership value of each detail region pixel (m d (i, j)) is given as Here, τ n is noise threshold where n is the noise level and τ is the intensity threshold. The membership value of each smooth region pixel (m s (i, j)) is given as When the membership value is associated with intensities of detail and smooth regions then m is enhanced and when the membership value originates from the noise then we suppress it. Thus, the overall fuzzy membership operator is given as j)), for smooth region (5) Step 3: In this step fuzzification is done on intensity and noise values. The fuzzification based on intensity generates the intensity enhanced image pixels F intensity (i, j) which is illustrated as follows Algorithm 1 Fuzzy enhancement of chest X-ray image 1 Input: Chest X-Ray image, I (i,j). 2 Output: Fuzzy enhanced Image, F (i,j). 3 Calculate intensity value of each pixel of input image, I intensity (i, j). 4 Calculate fuzzy limits for intensity and noise value as, m intensity and m noise respectively by choosing the value of fuzzy membership operator (m). 5 Calculate the fuzzy membership operator for smooth and detail region as m s (i, j) and m d (i, j) respectively. 6 Calculate overall fuzzy membership operator, m. 7 Perform fuzzification for generating intensity enhanced image pixels, F intesnity (i, j) . 8 Perform fuzzification for generating the fuzzified noisy image pixels, (F noise (i, j)). 9 Return, final fuzzy enhanced image as Step 4: The fuzzification based on noise generates the fuzzified noisy image pixels (F noise (i, j)) which is illustrated as follows Step 5: The noise is suppressed for all the pixels in both smooth and detail regions. Thus, in the fuzzy enhanced image (F (i, j)) the image intensity is restored and noise is reduced using fuzzy rule which can be written as

Block based division of image into smooth and detailed regions
In this paper we propose a block based method to divide the image into smooth and detail regions. Algorithm 2 presents the steps for block based division of smooth and detail region. In order to divide smooth and detail regions, all rows and columns of the image are scanned for first and last non-zero pixel. The rectangle area (w × h) is segmented using sliding window to generate sub-regions for smooth and detailed features. Here, width of rectangle is w = (x i − x j ) and length of rectangle is h = y i − y j .x, y are length across x-axis and y-axis of the rectangle. Thus, N sub-regions are generated which are segmented as detailed and smooth regions. The pixel intensities in each rectangle segment (τ) are compared with maximum value of intensity threshold values calculated from classified Covid+, Normal and Pneumonia images as τ c , τ n , τ p respectively such that τ c > τ p > τ n . If τ > τ n then those pixels are labeled in detailed region and if τ ≤ τ n then label those pixels in smooth region. Further, the detailed region is sub-classified as detailed region-1 and detailed region-2. If τ ≥ τ c orτ p < τ < τ c , then the image corresponding to the detailed region-1. If τ p ≤ τ < τ c , then label those pixels in detailed region-2.

Feature extraction
Consider the dataset D = {F (i, j)} N i,j=1 having N samples from detail and smooth regions. We map every region to image patch with size (a × a). (a × a) denotes the patch size which is neighborhood of central pixel. Let us consider l ij be label of the pair of Find first and last non-zero pixel. 5 end for 6 for j = 1, 2..N do 7 Find first and last non-zero pixel. 8 end for 9 Select a rectangle by x-axis and y-axis coordinates as (w × h). 10 Scan F (i, j) by w × h rectangle as a sliding window. 11 Compare the image pixel intensity (τ) in the rectangle with intensity thresholds τ c , τ p τ n . If τ ≥ τ c or τ p < τ < τ c , label those pixels in detailed region-1, If τ p ≤ τ < τ c , label those pixels in detailed region-2, If τ n ≤ τ label those pixels in smooth region. 12 Return smooth, detail region-1 and detail region-2 for feature extraction.  image patch a i , a j N i,j=1 . l ij = 1, ifa i and a j belong to same class otherwise zero. The deep features are generated as f deep = N (W, b|a d ) , d = i, j. Here, N is the network function characterized by network weight W and bias b which performs convolution, pooling and non-linear mapping which uses five convolution layers are two fully connected layers. Table 1 shows configuration of these layers. Algorithm 3 presents the steps for feature extraction.

Deep learning
The extracted deep features are separated on the basis of similarity with the original feature space. Figure 2 shows the layer wise structure of the feature learning part of the deep network used. This is achieved by evaluating the feature distance for all the extracted features. We use Eucledian distance (ED) [28] to measure the similarity between deep features and is calculated as ED = a i − a j 2 2 . Euclidean distance is the only metric that is the same in all direction, that is, rotation invariant. The other similarity measurement metrics are dependent on how the coordinate system is rotated. Another, feature of Euclidean distance is that it exists for finite dimensional space thus is that it doesn't matter what norm use because it is convenient to use the Euclidean norm. In this paper we have used 2D X-ray images which are also rotation invariant. Thus, using Euclidean distance can solve our purpose to compute the similarity measure because all the image points have a finite dimensional space only.
We insert a hashing layer after fully connected layer to compute feature distance effectively because when the FD is very high then the computation of ED is not feasible [28]. This new layer transforms the high dimensional real features into low dimensional binary features. The binary features generated form the hashing layer is written as sgn (.) performs element wise operations on the binary valued features. Thus, the hashing layer generates the binary codes for all the feature pairs. These binary codes are represented as We define the likelihood of pairwise labels as The negative likelihood of Equation (8) resembles an optimization problem [29] where the minimization of l ij leads to minimizing the feature distance between similar samples to as small as possible and maximizing the feature distance between dissimilar samples to as large as possible. (9) log p l ij |f hash is equated to minimization function min f hash l ij .
The above mode can be integrated into the proposed framework of deep learning such that, Where, p 1 , p 2 , . . . p 7 are the parameters of seven layers corresponding to which the output of each layer is computed. We choose two more parameters for minimization problem i.e. W and b. We also need a regularization parameter which forms the minimization problem as The effect of regularization parameter on overall accuracy has been analysed in results section. Thus, the feature learning and hash code learning are connected together in the proposed framework. The major advantage of the proposed framework is minimization of the feature distance between similar samples which improves the overall accuracy. The proposed framework has also been minimized for weight and bias.

Classification
Once the network is trained through the proposed model we can obtain the deep learned features effectively. These features are then into an ELM classifier [9] and SVM classifier [10] for the subsequent classification as Covid+, Pneumonia and Normal cases. The simulation results validates that by using an ELM classifier the detection is faster and is insensitive to manual parameter setup. Algorithm 4 presents the steps for deep hash learning and classification.

Results and discussion
We have analysed the efficiency of the proposed method on the chest X-ray image data set [6,7]. The dataset includes 123 frontal view chest X-rays images from [6] and 224 Covid+images, 700 pneumonia images and 504 normal images [7]. We have taken the 12 classes of the data. A quantitative analysis is performed to evaluate the performance of proposed method w.r.t. length of hashing layer, patch size and regularization parameter. The performance of the proposed method has also been compared with other deep learning methods [14, 18, 21 and 22]. In our experiments we have chosen the 500 samples per class randomly for training and testing. The results have been analyzed for three cases of training and testing ratio i.e. 20:80, 50:50 and 80:20. We evaluate performance metrics i.e. overall accuracy, class accuracy, specificity, sensitivity, F-measure and kappa statistics.
Tables 2-4 present the quantitative comparison with state-of-art methods [14, 18, 21 and 22] for performance metrics (overall accuracy, class accuracy, specificity, sensitivity, F-measure and kappa statistics) w.r.t. training to testing ratio as 20:80, 50:50 and 80:20 respectively. From Tables 2-4 we observe   Li et al. [22] have not used any technique for improvising the feature extraction, on the other hand the proposed method uses a fuzzy based image prepro-cessing and block based division method to improve the quality of extracted features. Overall Accuracy (OA) is a performance measure which is computed by dividing the accurately classified classes by total number of classes. The accuracy analysis between the proposed and other models shows that the proposed model achieves higher accuracy due to inclusion of hashing layer and minimization of weight and bias of the network characterization function. F-measure metric is a weighted harmonic mean of the recall and precision. Sensitivity is computed for Covid+cases. Specificity is computed for Covid-cases. Kappa-statistics measures expected value of outcome by subtracting it from the classification success which is kind of reliability measure. It is observed that as we increase the training data these performance metrics improve. Table 3 Comparison of proposed method with other method for training to testing ratio as 50:50

Class
Wang Apostolopoulos Alqudah Li Proposed et al. [14] et al. [18] et al. [21] et al. [ Table 5 presents the ELM and SVM classifier comparison results by using proposed method. It is observed that ELM classifier shows better results as compared to SVM classifier due to its insensitivity to parameters setup. Figure 3 shows that as the length of hashing layer increases the OA increases but this increase is until the length 64. Beyond this length the OA becomes stable. It has been observed that normal images have more smooth regions and infected images have more detailed regions. Therefore the smaller patch size is needed for detecting detailed regions effectively. In Fig. 4, it is observed that OA is more when patch size is smaller which means better detection and OA drops as we increase patch size. for The regularization parameter ( ) also affects accuracy. From Fig. 5 it has been observed that the optimal value of accuracy is achieved for = 10.

Conclusion
In this paper, a deep learning model is proposed for Covid-19 classification from chest X-ray images. There has been an improvement in OA using propsoed method due to the newly added hashing layer as it minimizes the Euclidian feature distance between similar samples and minimizes the Euclidian feature distance between dissimilar samples. This training dataset is then used in SVM and ELM classifier for Covid-19 classification as Covid+, Pneumonia and Normal cases. The comparison results in terms of various performance metrics are drawn between the proposed method and existing state-of-art methods by considering different ratios of training and testing  data. The experimental results show that the proposed method has an overall improvement in terms of accuracy, F-measure, sensitivity, specificity, and Kappa statistics.
This paper proposes a deep learning framework for Covid-19 detection which has better accuracy than conventional models. The limitation of the proposed approach is that if the patients in critical state might not be able to undergo X-ray scanning. This approach can be used for diagnosis due to cost-effectiveness of X-rays images. In future, the diagnosis can be made more effective by training more massive datasets using continuous data collection. Further, it is planned to make use of different classifiers for different features extracted from the chest images. We aim to enhance the model efficiency and usability by deploying it in hardware.