Novel Privacy Preserving Non-Invasive Sensing-Based Diagnoses of Pneumonia Disease Leveraging Deep Network Model

This article presents non-invasive sensing-based diagnoses of pneumonia disease, exploiting a deep learning model to make the technique non-invasive coupled with security preservation. Sensing and securing healthcare and medical images such as X-rays that can be used to diagnose viral diseases such as pneumonia is a challenging task for researchers. In the past few years, patients’ medical records have been shared using various wireless technologies. The wireless transmitted data are prone to attacks, resulting in the misuse of patients’ medical records. Therefore, it is important to secure medical data, which are in the form of images. The proposed work is divided into two sections: in the first section, primary data in the form of images are encrypted using the proposed technique based on chaos and convolution neural network. Furthermore, multiple chaotic maps are incorporated to create a random number generator, and the generated random sequence is used for pixel permutation and substitution. In the second part of the proposed work, a new technique for pneumonia diagnosis using deep learning, in which X-ray images are used as a dataset, is proposed. Several physiological features such as cough, fever, chest pain, flu, low energy, sweating, shaking, chills, shortness of breath, fatigue, loss of appetite, and headache and statistical features such as entropy, correlation, contrast dissimilarity, etc., are extracted from the X-ray images for the pneumonia diagnosis. Moreover, machine learning algorithms such as support vector machines, decision trees, random forests, and naive Bayes are also implemented for the proposed model and compared with the proposed CNN-based model. Furthermore, to improve the CNN-based proposed model, transfer learning and fine tuning are also incorporated. It is found that CNN performs better than other machine learning algorithms as the accuracy of the proposed work when using naive Bayes and CNN is 89% and 97%, respectively, which is also greater than the average accuracy of the existing schemes, which is 90%. Further, K-fold analysis and voting techniques are also incorporated to improve the accuracy of the proposed model. Different metrics such as entropy, correlation, contrast, and energy are used to gauge the performance of the proposed encryption technology, while precision, recall, F1 score, and support are used to evaluate the effectiveness of the proposed machine learning-based model for pneumonia diagnosis. The entropy and correlation of the proposed work are 7.999 and 0.0001, respectively, which reflects that the proposed encryption algorithm offers a higher security of the digital data. Moreover, a detailed comparison with the existing work is also made and reveals that both the proposed models work better than the existing work.


Introduction
Digital medical images such as X-ray images are becoming more crucial for identifying and treating disorders in contemporary hospitals and hence are attracting attention from the research community [1]. In general, such medical images may include confidential and sensitive information [2]. Disastrous accidents may arise if unauthorized access results in the theft of confidential information or the exploitation of these private images. For instance, a hacker may use unauthorized images or replace the original data with fabricated information or data to ruin a patient's life. Furthermore, it is crucial to protect such medical images by means of some lightweight chaos-based encryption schemes. As a result, an unauthorized person cannot access the relevant database without the permission of the authorized party.

Data Security
Preserving images from unauthorized entities has become an increasingly important problem as multimedia technology continues to advance at an exponential rate. Compared to text data, images have distinct properties such as a large data capacity, high redundancy, and significant correlation between neighboring pixels, which make traditional text encryption algorithms inefficient when used on images. The development of acceptable image cryptosystems has been the focus of numerous studies, which have implemented a variety of techniques, including the Fourier transform [3,4], the wavelet transform [5], SCAN [6], chaos [7,8], and other techniques. Among the aforementioned methodologies, chaos-based image encryption is considered as one of the most efficient and effective encryption techniques due to a number of properties such as its high sensitivity to control parameters and initial values, pseudo random evolution, state ergodicity, and structure complexity [9].
Chaotic systems are often employed to produce key streams for scrambling or changing pixel values. Such key-streams can be generated using the initial values that are given to the chaotic systems. Images are created by concatenating these key streams with plaintext images. Additionally, a minor change in the seed values may result in a significantly different key stream. This property corresponds to the sensitivity to the initial condition. Chaotic systems also provide long-term random encryption by exploiting features such as state ergodicity and structural complexity.
With the use of a logistic map [10], a British mathematician named Matthews made the first formal application of chaos theory to cryptography in 1989. It has been shown in this study that chaos-based encryption is feasible. Because of the security requirements for image data, chaos is attracting the attention of researchers in image encryption [9]. The confusion-diffusion structure is used as a generic framework in the development of image encryption schemes in the majority of existing image encryption techniques. According to Shannon [11], an encryption scheme that consists of both a confusion and diffusion property can be considered a secured cryptosystem. Fridrich proposed a confusion-diffusion structure in [12] that encrypted images using the permuting pixel location and diffusing pixel value with chaos for the first time. However, as compared to permuting pixels, the permutation of bits of pixels gives more security, while the calculation cost may be larger.

Data Classification Using Deep Learning
Apart from securing medical images such as X-rays, it is also important to use a technique to diagnose diseases such as pneumonia with high accuracy. Several machine learning techniques have been proposed in recent years that offer an accuracy of 85-90%, which is not acceptable as it can be a source of a great loss for patients in terms of health due to misclassification between normal and pneumonia patients.
Pneumonia is an acute lung infection that causes fever, coughing, muscular pains, chills, and trouble breathing in infected individuals. The pneumonic disease has been documented throughout human history, with early Greek civilization mentioning the condition [13]. Despite our long history with the illness, pneumonia remains a significant medical problem for the global population, with millions of incidents of pneumoniarelated hospitalizations and deaths globally. The World Health Organization (WHO) has stated that, in 2016, more than 700,000 children aged less than 2 years died due to pneumonia [14,15]. The death toll from pneumonia exceeded the combined tolls from malaria, AIDS, and measles in the same year. It is worth mentioning here that more than 95% of children living in backward areas with limited medical resources died of pneumonia. Therefore, a precise, low cost, and quick pneumonia diagnosis is required in such areas.
Chest X-rays are one of the most frequently utilized images for the diagnosis of diseases such as pneumonia in the liver and lungs non-invasively [16]. However, pneumonia diagnosis in chest X-rays also depends on the radiologist's diagnostic expertise [17]. Furthermore, the trustworthiness of diagnostic results continues to face enormous obstacles. This problem arises frequently in underdeveloped countries, where the prevalence and mortality of pediatric pneumonia are much greater than the global norm, such as in the South Asian subcontinent [18]. On the other hand, it is mainly the responsibility of highly qualified and experienced doctors to identify chest X-ray images. Currently, only a few systems for medical image analysis are capable of autonomously identifying human organs or tissues [19]. The automatic classification and detection of organs based on X-ray images has enormous application potential in academic medicine. It may significantly increase the number of cases analyzed by students. Additionally, it can support the advancement of telemedicine education and help to save valuable human resources [20].
As a fundamental part of artificial intelligence, deep learning takes raw data as input and extracts the necessary features [21]. Finally, the learned features are associated with the task, automating the whole process. As a consequence, advancements in deep learning are inextricably linked to the study of the brain's cognitive processes. Today, the most commonly used network model for deep learning is the neural network architecture. Since the idea of artificial neural networks (ANNs) was proposed in 1943, researchers have started to employ mathematical models to theoretically imitate neurons in ANNs, therefore broadening the scope of the study of artificial intelligence [22][23][24]. Deep learning algorithms, such as neural networks, have shown astounding performance in non-invasively classifying patient data problems for disease diagnoses [25][26][27][28].

Related Work
Encrypting medical images is an effective method of protecting them from attacks [29][30][31]. Several traditional encryption techniques, such as the Data Encryption Standard (DES) [32], the Advanced Encryption Standard (AES) [33], and the International Data Encryption Algorithm (IDEA) [34], were designed to protect textual data. The approaches, however, have been discovered to be incompatible with digital images due to their inherent characteristics such as high correlation and pixel redundancy and correlation [35,36]. Scholars have suggested selective encryption techniques to reduce correlation and redundancy [37,38]. For instance, some approaches encrypt critical compression coefficients [39] and others encrypt the interleaved patient information included in images [40], while others encrypt only the important bits of particular coefficients using a stream cipher [41][42][43][44]. However, such security techniques have several vulnerabilities, such as high computational time and weak security, which may also result in data loss and some false negative diagnoses [45][46][47]. Recently, Bouslimi et al. [48] proposed a combined watermarking/encryption system in Cipher-block chaining mode (CBC) to secure the integrity of medical images and create a medical image encryption technique by combining a stream cipher algorithm and two sub-stitutive watermarking approaches [48]. They are capable of preserving an image's integrity and authenticity. Zhang et al. [49] created a one-of-a-kind image encryption technique that combines bit-level rotation matrix permutation and block diffusion. Zhou et al. [50] developed a novel security approach that uses a hyper-chaotic system and 2D compressive sensing to concurrently encrypt and compress medical images. Zhang et al. [51] suggested a compressive sensing and pixel permutation technique for medical image encryption and compression. Additionally, it is capable of encrypting and compressing medical images concurrently. However, such approaches are not ideal for large datasets, such as X-ray image datasets, and are vulnerable to security attacks.
Numerous methodologies have been proposed to detect pneumonia using machine learning, deep learning, and transfer learning. Liang et al. [52] presented a model for the future forecasting of pneumonia non-invasively using a deep residual network (DRN) in which X-ray images are incorporated. To enhance the model training, a large dataset is used in the same field. The accuracy, recall, F1-score, and RoC values for the DRN model are 90.5%, 96.7%, 92.7%, and 95.3%, respectively. However, the DRN model is not suitable because the model accuracy is not sufficient, increasing the False Positive Rate (FPR). Morillo et al. [53] also proposed a pneumonia detection technique using machine learning in which Fourier transform analysis is used, which also helps to extract features.
Moreover, band-pass (BP) filtering is incorporated for the removal of noise from tracheal sounds. The model accuracy is 85%, which is less than the technique proposed in [54][55][56]]. An automated system has been developed for the rapid diagnosis of pneumonia based on a deep sequential convolutional neural network [57]. A publicly available dataset is used in which X-ray images of healthy and pneumonia patients are included. The overall accuracy of the model is 94%, which is not acceptable to avoid FPR. In [58], Masot et al. proposed a deep learning-based technique for the prediction of COVID-1 and pneumonia. In the dataset, three different labels are used: healthy subject, subject COVID-1, and pneumonia. Based on the feature values and classification model, the desired output can be predicted. The accuracies obtained with histogram equalization and without histogram equalization are 86.1% and 88%, respectively. Ni et al. [59] also presented a deep learning approach to classify healthy, COVID-1, and pneumonia patients in which CT images are used. One of the evaluation parameters, known as accuracy, is used to gauge the performance of the model, which predicts correct results with an accuracy of 84%, which is less than the accuracy of the model proposed in [58]. Zhang et al. [60] proposed a machine learning model to detect pneumonia using chest radiography, in which a 90% rate of accuracy of true prediction is achieved, which is better than the model in [58,59]. Antin et al. [61] proposed a supervised learning approach for the diagnosis of pneumonia using machine learning algorithms in which X-ray images are incorporated into the dataset. For the classification of healthy pneumonia patients, logistic regression is used, and a 60% rate of accuracy of true predictions is achieved, which is significantly lower than other approaches and may not be suitable for the diagnosis of pneumonia. In [61], there is a lack of dimensionality reduction in the dataset, which results in less accuracy, which is 72. Jain et al. [62] presented a classification technique for the diagnosis of pneumonia in which convolutional neural networks and transfer learning are integrated.
Moreover, a dataset containing X-ray images is used and six different models are proposed for model training and testing. Such models have varying layers and achieve 92.31% accuracy, as demonstrated by model 1, which has two convolutional layers. A great deal of work has been presented in the literature in which an accuracy between 90% to 95% is achieved. A new methodology is proposed to improve the model's accuracy, in which CNN is incorporated to classify pneumonia and healthy patients.
Apart from proposing pneumonia diagnosis using a neural network, it is also important to secure medical data so that they can be prevented form misuse. Therefore, in this research, we present a block encryption technique that combines neural networks, chaotic systems, and complementary DNA principles for securing medical data in the form of images. A novel heterogeneous chaotic system is implemented using neural networks in which random sequences are generated. Such random sequences are then utilized as inputs for the proposed encryption procedures, which include pixel position scrambling and substitution.

Contributions of the Work
Given the current circumstances in the early WHO report, pneumonia detection and treatment are a highly demanded area of research. Our findings and contributions in this work, in particular for the identification of pneumonia, are as follows: 1.
To secure the medical images (X-ray images), a neural network-based image encryption is proposed, and a comparison is made to show the effectiveness of the proposed encryption; 2.
Collection of primary data from thee different hospitals in Rawalpindi/Islamabad, Pakistan; 3.
Statistical and physiological features are integrated for the non-invasive diagnosis of pneumonia; 4.
We developed a scheme that can reliably predict the presence of pneumonia, and it can be implemented using a smartphone application. CNN is used as a classification algorithm for the proposed approach; 5.
A K-fold analysis is also used in this research to select a particular subset of the dataset, and as a consequence, the suggested model has maximum accuracy; 6.
We built multiple learning models called "K-learning models" after performing the K-fold analysis. The purpose of these models is to deploy ensemble-based learning approaches. 7.
For the validation of the proposed model, various metrics such as precision, recall, F1 score, and support are used. Misclassifications in the context of pneumonia detection might be exceedingly expensive in terms of human lives if a model incorrectly identifies false positives; hence, we used accuracy as mentioned in addition to the earlier measures to evaluate the proposed model. Moreover, for more validation, tuning is also performed.
The rest of the proposed work is organized as follows: Section 3 provides a description of the chaotic maps which are used in the proposed encryption scheme for data security. In Section 4, the methodology to generate the pseudo-random number is given, while Sections 5 and 6 are devoted to the proposed encryption scheme and its evaluation, respectively. Section 7 provides the mathematics behind the proposed model with reference to the CNN. In Section 8, materials and methods regarding the dataset used in the proposed work and processing are explained. In Section 9, the proposed model is explained in detail, while in Section 10, experimental results and an analysis of the proposed work and its comparison with existing methods are given. Finally, Section 11 concludes the proposed research work.

Chaotic Maps Used in the Proposed Work
Among the several chaotic maps available in the literature, three chaotic maps-piecewise linear chaotic map (PWLCM), logistic map, and logistic tent system (LTS)-are used in the proposed encryption scheme. In particular, such maps are incorporated to create a pseudo-random number generator.

Logistic Map
A one-dimensional logistic map is defined in Equation (1) [63]: where G is a control parameter with a value varying from 3.58 and 4. T n and T n+1 are the chaotic map's outputs/states when they iterate at n and n + 1, respectively, and their values will lie between 0 and 1.

Piece-Wise Linear Chaotic Map (PWLCM)
Several linear segments that exhibit superior properties to the logistic map are used to construct the PWLCM, which is defined as follows [64]: where G is the range-control parameter (0, 0.5). n and T n+1 are the chaotic map's outputs/states at n and n + 1 iterations, respectively, and their values lie between 0 and 1.

Logistic Tent Map (LTS)
LTS is a combination of logistic and piece-wise liner maps as discribed in Equation (3).
where G is the chaotic behavior control parameter in the range [0, 4], T n and T n+1 are the chaotic map's outputs/states when it iterates at n and n + 1, respectively, and their values will lie between 0 and 1.

Proposed Pseudo-Random Number Generator
This section describes the proposed chaotic pseudo-random generator based on neural networks. The proposed generator design is heterogeneous, implying the utilization of many chaotic maps. Figure 1 shows the neural network-based proposed generator. Four layers comprise the proposed neural network generator: two hidden layers and two input/output layers (one input and one output). In the neural network, each neuron in the neural network generator has a transfer function defined by a chaotic map equation. The proposed architecture employs a single neuron as the input layer, which receives an encryption key with a size of 64 bits, divided into two equal sections with a size of 32 bits. The first section is devoted to the input for the neural network's initialization cycle, while the second section serves as the output for the neural network's initialization cycle. The two hidden layers are composed of n hl number of neurons, whereas the output layer is composed of m ol neurons.
To implement a heterogeneous chaotic system in neural network layers, multiple chaotic maps are incorporated as transfer functions. For instance, if the logistic map is empty in the first layer, the PWLCM will be used in the second layer, and so on. The weight matrices of the four layers are denoted as W 0 , W 1 , W2, and W 3 , numbered from 0 to 3, respectively, as shown in Figure 1, and with the dimensions of 1 × 1, n hl × 1, n hl × n hl , and m ol × n hl . The layers' bias matrices are B 0 ,B 1 , B 2 , and B 3 . P 0 , P 1 , P − 2, and P 3 are the control parameter matrices for the chaotic map transfer function. Both B 0 -B 3 and P 0 -P 3 are 1 × 1, n hl × 1, n hl × 1, and m ol × 1, respectively. The neural network generator's m ol outputs can be utilized to perform the encryption algorithm's various operations.
A 1D Cubic map is employed to build the neural network generator. The seed values for the cubic maps are defined by the second 32 bit section of the 64 bit key.The cubic map is given in Equation (4): where T n is the seed value for the first cycle of the chaotic function or the prior state for subsequent cycles, and T n+1 is the chaotic function's current state. Both T n and T n+1 lie in (0, 1). λ is the chaotic control parameter, with a value of 2.59. To reveal its chaotic properties, 50 iterations are made for this map. Following that, the map's outputs are used to initialize the initial parameters of the neural network.
In the proposed work, four outputs are utilized-i.e., m ol = 4-to generate chaotic sequences corresponding to each output: The total number of iterations of the chaotic neuron transfer function is updated using (OP 4z ).
The output of the aforementioned parameters and the working of the proposed generator are shown in Figure 2.

Proposed Cryptosystem for Medical Images
This section describes the details of the proposed cryptosystem and a novel pixel bit permutation mechanism based on DNA principles.
The proposed encryption algorithm consists of two different blocks. In the first block, pixel permutation (P-box) is performed, while the second block comprises substitution and permutation, or SP-box, as shown in Figure 3.

P-Box
The P-box refers to the permutation-box, which is used to shuffle the locations of the image pixels by determining the pixel position.
For an N × N image, the original positions of the image pixels are permuted using the first N-bits of the P-sequence. The last N bits are utilized to compute the chosen pixel's target location. The number of permutation iterations is equal to the total number of pixels present in the original image (N × M), where N and M represent the number of rows and columns of the image pixels, respectively. The proposed permutation operation is shown in Figure 4, in which each pixel value is permuted according to the values preset in the P-sequence.

SP-Box
In this step, the input is the scrambled pixels, which are permuted in the P-box. The SP-box contains two operation: one is substitution and the other is permutation. Such operations are performed on each pixel one by one; i.e., the pixel value is substituted with the new value followed by the permutation of the substituted pixel value. The permutation operation is then applied on bits of the bi-plane, which are extracted from the plane text image. The operations in the SP-box are repeated until the substitution and permutations of the last pixel value to obtain the final encrypted image. Such encrypted images are shown in Figure 5 and their corresponding plaintext images are shown in Figure 6. Figure 5. (a-p) Encrypted images corresponding to normal and pneumonia patients' X-ray images. Figure 6. (a-h) X-ray images of normal patients, (i-p) X-ray images of pneumonia patients.

Proposed Encryption Scheme Evaluation
To gauge the performance of the proposed encryption algorithm, the following parameters are under consideration: The detail of such security parameters can be seen in [65][66][67]. Table 1 shows the statistical value of the security parameters calculated for the evaluation of the proposed cryptosystem for medical images. As with the MSE, the contrast of the encrypted image should be high as much as possible, while the correlation, energy, and execution time should be low for strong encryption. However, the entropy value must be close to 8.00 for an 8 bit encrypted image. It can be seen from Table 1 that the values for the security parameters for the proposed work are much better than existing schemes.

Noise Attack Analysis
To check the robustness of the proposed encryption algorithm against noise attack, salt and pepper noise is added to the encrypted image and decrypted with the decryption algorithm. It is found that the information in the decrypted image, which is reconstructed from the noise-encrypted image, is clearly seen, as can be seen in Figure 7. There is some noise in the decrypted image, but the content of the plaintext image is visible.

Convolutional Neural Networks (CNN)
In recent years, CNN has dominated the machine vision domain. A CNN consists of several hidden, input, and output layers. Convolutional, pooling, fully connected, and normalizing layers are common hidden layers in CNNs. For increasingly sophisticated models, more layers might be employed. Examples of a standard CNN are illustrated in Figure 8. The vector calculus and chain rule may be used in the CNN learning process [74]. Let T be any scalar (i.e., T ∈ R) and x ∈ R W be a vector. The partial derivative of T with regard to x will be ∂T ∂x The size of ∂T ∂x is same as x, and the i th element is ∂T ∂x . Also, ∂T ∂x Q = ( ∂T ∂x ) Q . Moreover, it is presumed that N ∈ R M . In this case, the partial derivative of T with regard to x will be The derivative is represented by Equation (6), which is a P × S matrix with the entry at the intersection of the j th row and k th column. From this, the chain rule can be incorporated to calculate the following: A cost or loss function may be used to calculate the difference between a CNN's N L forecast and the outcome t, N 1 → M 1 , N 2 →. . . , N L → S L = T, using a simplistic loss function T = |t − N L | 2 . However, more complicated functions are often used. A prediction's output can be thought of as argmax i . xL i . Convolution may be stated as follows: The size of the filter g is (P × M × D l ); thus, the spatial size of the convolution will be (P l − P + 1) × (M l − M + 1) with D slides, which means y(x l+1 ) in R P l+1 ×M l+1 ×D l+1 , P l+1 The probability of each symbol-for example, S ∈ {1, 2, 3, . . . S} for each training sample-is calculated using Equation (9).
where T is a non-normalized log probability. The cross entropy for this model can be computed as Because cross-entropy loss is differentiable in terms of logistics, T S , it may be used to gradient-train deep models. The range is between −1 and +1, where the simple form of the gradients is ∂l . Typically, when cross-entropy is minimized, the log-likelihood of the correct label is maximized. A CNN architecture analyzes a distribution over labels independent of training instances u(S) with a smooth parameter ζ, since this may create some overfitting problems, where for a training example, q(S|N) = σ S,N is replaced as follows [75]: where q S|N is a mixture of q S|N with weight 1 − ζ and the fixed distribution µ(S) with weight ζ. When label-smoothing regularization is applied with µ(S) = 1 S , q S|N becomes Alternatively, this can be expressed in the form of entropy as follows: Thus, the label-smoothing regularization is equivalent to replacing a single crossentropy loss H(q, v) with two losses, H(q, v) and H(u, v), with the second loss penalizing the deviation of the predicted label distribution v from the prior u with a relative weight of ζ (1−ζ) , which is equivalent to computing the Kullback-Leibler divergence. A further mathematical formulation of CNN architecture can be seen in [76,77].

Transfer Learning
Transfer learning is a type of machine learning that involves training to construct a model for prediction tasks such as COVID-19 and liver disease forecasting [78,79]. It is a circumstance in which information obtained in one context is utilized to maximize performance in another [52,80,81]. Transfer learning is often utilized when the new dataset on which the pre-trained model is trained is smaller than the original dataset. This research work presents a strategy for repurposing an Inception-v3 model trained on a base dataset (ImageNet) to learn (or transfer) features for training on a new dataset (CIFAR-10 and Caltech Faces) [54]. Transfer learning enables us to start with the features learned on the ImageNet dataset and adapt them, as well as the model's structure, to the new dataset/task, rather than beginning the learning process from scratch with random weight initialization.

Fine Tuning
The proposed model is tuned to recognize 1000 generic object classes listed as part of the ImageNet hierarchy [82].
The concept of fine-tuning a network is based on the idea of transfer learning [83]. We train a CNN to learn features for a large domain by optimizing the classification function for that domain's error minimization. After replacing the classification function, the network is adjusted again to minimize the error in a more specific domain. This configuration moves the network's features and properties from the wide domain to the specialized domain.
The CNN classification function, known as softmax, is used to calculate the probability of each of the 1000 classes in the ImageNet dataset. To commence the fine-tuning procedure, existing softmax classifier values are deleted and replaced with new random values, and an updated softmax classifier is then trained from scratch by incorporating the back-propagation algorithm in which a large amount of pneumonia patient data is used.
It is crucial to precisely calibrate the learning rates of each layer before initiating the back-propagation process for fine-tuning. In this research, we boosted the learning rate of the top classification layer to 10 and dropped it to 0.1 for the next seven layers. Five thousand rounds of the back-propagation approach were employed, using stochastic gradient descent to optimize the network parameters (SGD). The accuracy of image classification in a validation set develops throughout the fine-tuning process, as seen in Figure 9. Accuracy significantly increased throughout the first rounds and stabilized at roughly 40,000 iterations.

Materials and Methods
The proposed non-invasive model for pneumonia diagnosis complements the conventional diagnostics tools/mechanisms and enables medical practitioners to diagnose pneumonia with better reliability and accuracy. There are 5300 verified chest X-ray images in the dataset used in the proposed research. The X-ray images for the healthy and pneumonia patients and the distribution of the data are shown in Figure 6.
The images are divided into two groups: a training set and a testing set of patients. All chest X-ray imaging was performed as part of the patients' regular medical treatment. To analyze chest X-ray images, all chest radiographs were first reviewed for quality control, with any scans that were poor quality or illegible being removed. After that, the diagnoses for the images were rated by two experts before being approved for use in the AI system. Finally, a third expert evaluated the assessment set to make sure there were no grading problems.
Because the images are of varying sizes and quality, attributes such as sharpness, contrast, and brightness levels are varied for practically all of them. Pneumonia can be diagnosed with the help of X-rays. According to findings on X-ray images, organic causes of pneumonia include uneven mucosal surfaces and increased luminal fluid. Different patterns may be seen in X-ray images while looking for pneumonia. As seen in Figure 6, healthy and normal patients and pneumonia-infected individuals exhibit various patterns in their X-ray images, as seen in Figure 6. From X-ray images, many patterns may be used to identify pneumonia symptoms. Further information on these symptoms based on X-ray pictures is given in [84].
There are various parameters and symptoms to examine when attempting to diagnose a person with pneumonia, including cough, fever, chest pain, flu, low energy, sweating and shaking, chills, shortness of breath, fatigue, loss of appetite, and headache. However, not all symptoms appear in every pneumonia patient, and the severity of each symptom may vary from patient to patient.

Model Selection, Training and Evaluation
The goal of the proposed work is to classify healthy subjects and pneumonia disease subjects, differentiating them from each other. To achieve this classification, the classi-fication performance is analyzed. The block diagram of the proposed work is given in Figure 12. The step by step explanation of the proposed model is presented below.

1.
The collection of data was in the form of (X-ray) images and consent forms. Different X-ray images varied with size; for example, A × B, where A and B denote the rows and columns of pixels, respectively.

2.
Statistical features were extracted from the X-ray images using CNN, which extracted features through the filters available in different layers. Initial layer filters were responsible for extracting low-level features, while higher layers filters were responsible for extracting high-level features. Such extracted features were then forwarded to the classifier for the decision.

3.
Split features were extracted from X-ray images by observing patterns. For example, the patterns shown on the X-ray images of healthy individuals varied from the patterns that appeared on the X-ray images of pneumonia-infected patients. Here, CNN extracted different features/patterns and took a decision based on the extracted features/patterns. Pneumonia images are different from those of normal patients. From Figure 6i-p, one can see different colors, showing a sign of abnormality in the patient. However, the X-ray of the normal patients does not show color variation (see Figure 6a-h).

4.
Distinct feature vectors (X.Vs) for each X-ray image were made: X.V = X 1 , X 2 , The given matrix (X.Vs) represents only those feature vectors created from statistical features extracted from the X-ray images. Such features can be expressed in a single data set, as shown in Equation (14). The dataset was split into two sections: one for training and the other for testing. The training data were drawn from a collection of healthy and pneumonia-infected subjects, and the model was trained using CNN. In total, 80% of the dataset was chosen at random for training purposes, with both healthy and contaminated data types taken into account, as given in Equation (15). The precise proportion of data allotted for training and testing might vary. Previously, CBC (complete blood count) determined the type and amount of white blood cells in the body; findings may indicate the presence of an illness. Blood tests for potassium, sodium, and other chemistries (BMP) have been used to evaluate the severity of a disease. This is a non-invasive method to examine the human body, and safety measures must also be adhered to while performing the whole procedure; otherwise, it will be harmful to human beings. Machine learning approaches are used in the proposed study to overcome the weaknesses in CBC and BMP for the real-time identification or diagnosis of pneumonia.
if Testing data samples T = 100 Training data sample (Total F.Vs) − (100) (15) CNN was applied to the proposed mode to classify pneumonia and healthy subjects. Moreover, several ML algorithms such as decision tree, naive Bayes and random forest were also tested on the proposed work. The purpose of using other classifiers/Ml algorithms was to compare the results of the ML algorithm with the deep learning algorithm. In this work, the performance of CNN is better than other ML algorithms, as can be seen in Table 4. Therefore, CNN is selected in this research work due to its higher performance.
Moreover, to improve the accuracy of the proposed model, we applied transfer learning and fine tuning. After fine tuning, the model accuracy was found to be 96%. Further, to enhance the proposed model, K-fold analysis and voting techniques were also incorporated, and an accuracy of 97.7% was successfully achieved. The detailed results and analysis are given in Tables 4 and 5.

K-Fold Analysis
The statistical approach of cross-validation is used to estimate the skill of machine learning models. We initially shuffled our dataset in k-fold cross-validation such that the order of the inputs and outputs was perfectly random. These steps were performed to ensure that our information was not skewed in any manner. The dataset was then divided into k equal-sized sections. We employed 10-fold cross-validation in this analysis.
As a result, the very first step was to shuffle and divide our data into 10 folds. Then, in each k interaction, we utilized one fold for testing and calculating the empirical square loss and the remaining nine to train our model. As a result, we chose a different fold for testing each time that we started a new interaction. This ensured that each of the k parts was only utilized for testing once. The values for the parameters such as accuracy, precision, recall, and F-1 score are listed in Table 5.
In the proposed work, five different values of K were selected (K = 25, K = 30, K = 35 and K = 40) to generate four different K-models in order to apply the voting techniques, which are explained in the next sections.

Voting Techniques
The Ensemble Voting Classifier is a meta classifier that combines comparable or excellent machine learning classifiers for classification and detection. "Hard" and "soft" voting are carried out via the Ensemble Voting Classifier.

Hard Voting
The simplest case of majority voting is hard ensemble voting. This technique works on the majority votes. For instance, in the proposed research, to increase the model's accuracy, dif k using k-fold analysis classifies the event into classes A and B based on the majority votes. In Figure 13, the accuracies of all the k-models are displayed, and it can be seen that the majority votes in favor of class A. Therefore, after applying hard voting, an upcoming sample will fall in class A.

Soft Voting
In soft voting, the classes are predicted based on the classifier's predicted probability p. In Figure 14, different probabilities of a particular type occurring through an individual k-model are displayed. Mathematically, the probability of either class and the assignment of the class to the upcoming sample can be calculated using Equations (16) and (17).
where Po(E A ) and Po(E B ) is the probability of events A and B occurring, respectively. According to the calculated probabilities, Equations (16) and (17)

Experimental Setup
The presented model was developed in Python, and the computer system on which it was run had the following specifications: 8 GB RAM, Windows 8, and a graphics card. Furthermore, Python 3.7 uses several libraries such as pandas, Matplotib, Numpy, Seaborn, Tensorflow, Sklearn, CV2, Image Data, and transfer learning.

Results and Discussion
To analyze the model's performance in diagnosing pneumonia, it was necessary to examine the performance of classifiers using quantitative measures to evaluate their effectiveness. Therefore, metrics such as precision, recall, F1 score, and support were used to assess the proposed model. Following that, the results of the TP (True Positive), TN (True Negative), FP (False Positive), and FN (False Negative) tests were used to create the five performance measures indicated in the confusion matrix.

Confusion Matrix
The classifier's accuracy and error can be represented via the confusion matrix. This describes the model's performance on test images when the real values are known and summarizes the output results. Figure 15 shows the confusion matrix for the proposed models in which CNN, transfer learning and fine tuning are applied: The suggested CNN-based model (model-1) has a training and validation accuracy of 95.1% and of 95.3%, respectively, while model-1 has training and validation losses of 0.18% and 0.15%, respectively. Transfer learning improved the training and validation accuracy of model-1 to 93.6% and 95.5%, respectively. While the training and validation losses are 1.8% and 1.3% at this level, Finally, the transfer learning-based model is fine-tuned, and it achieves a training and validation accuracy of 96.5% and 97.1%, respectively. Similarly, when fine tuning is used, the training and validation losses are reduced to 0.8% and 1.2%, respectively. This impact can be seen in Figure 16.

Receiver Operator Characteristic (ROC) Curve
An ROC curve represents a binary classifier's diagnostic ability. It originated in signal detection theory but has since been used in various fields, including medicine, radiography, natural disasters, and machine learning. The receiver operating characteristic (ROC) curve illustrates the trade-off between sensitivity (or TPR) and specificity (1-FPR). Classifiers that produce curves closer to the top-left corner perform better. From Figure 17, it can be seen that the ROC curve for the proposed work is closer to the desired value.

Conclusions
The proposed work is intended to secure X-ray images and identify pneumonia based on neural networks. To ensure that the patients' X-ray images are not used by any unauthorized person, they are secured using chaos and neural networks. Moreover, a neural network-based model is proposed for the pneumonia diagnosis with high accuracy. In the diagnosis of this disease, false positive events are more harmful than false negative events. Hence, a deep learning system algorithm such as CNN is incorporated in the proposed work to increase the true positive rate. Moreover, to further increase the accuracy of the proposed model, transfer learning and fine tuning are also incorporated. Numerous evaluations of our suggested model, including testing through the analysis of k-fold experimentation and performance comparisons of other algorithms, helped us to select the best-suited deep learning method for completing the desired task. From the experimentation and analysis, it can be seen that the accuracy of the proposed work is 97%. Moreover, the proposed methodology works better when compared with the machine learning and deep learningbased existing models.
The proposed work is based on a deep learning algorithm. The accuracy of the proposed work is acceptable. However, it can be improved by the use of hybrid AI algorithms in the future.