Pneumonia Detection Technique Empowered with Transfer Learning Approach

: Detection of normal findings or pneumonia using modern technology has a lot of significance in medical analysis and artificial intelligence. Still, more specifically, its importance increases in deep learning. Deep learning is extensively applied in the realm of medicine and disease classification. Early diagnosis of pneumonia is essential so it can be efficiently treated with the type of antibiotics. Bacterium and viruses are the population's first cause of pneumonia and death. Bacteria and viruses are part of mammalian pathogens and the most invasive type of bacteria or virus causing many diseases. Bacterial infection is among the most common types of disease in all age groups, but most bacterial infectious diseases are not the same. Our research will propose a transfer learning-based approach for pneumonia prediction utilizing a dataset comprising chest X-ray images. The dataset-based images will be grouped into two groups based on the parameters. Our proposed model displayed an average accuracy of 94.54% on the dataset. The proposed model (PDTLA) performed well compared with previous quantitative and qualitative research studies. Pneumonia detection transfer learning algorithm (PDTLA) is the name of the modified model.


Introduction
Our bodies and surrounding environments host a multitude of bacteria and virus species.Among these, certain bacteria species play a positive role in human health, aiding in processes such as food digestion, fermentation of dairy products, and even drug synthesis.Conversely, there are bacteria and viruses that can pose threats to human health.This diversity underscores the complex relationship between microorganisms and human biology, encompassing both beneficial and harmful interactions.The toxic species of bacteria are the leading cause of various diseases.Pneumonia is a dangerous illness of the lungs that causes severe respiratory problems.The patient's lung gets inflamed with fluid, leading to breathing difficulty with severe symptoms, which can lead to a high mortality rate.Bacterial pneumonia causes severe symptoms of the disease as compared with viral pneumonia.The most affected population includes people with a weakened immune system, the elderly, and infants.Early pneumonia detection and timely treatment provision can save lives (Patel et al., 2021).Chest X-ray is mainly used for detecting pneumonia.Chest X-ray images are often not so clear and are misclassified.A bacterial and viral pneumonia chest X-ray is similar in many aspects and can lead to inaccurate diagnosis by the medical professional (Rahman et al., 2020).
Traditional machine learning methods are often employed for feature extraction, where the acquired representations are subsequently fed into classifiers like SVMs or random forests for tasks like classification.
However, in recent times, deep learning models, notably convolutional neural networks (CNNs), have gained widespread adoption in diverse fields such as image processing and computer vision.CNN architectures have demonstrated remarkable success in areas including healthcare, security, language translation, pathology, and microbiology.Typically, these networks are trained on sizable, labeled datasets, employing supervised learning techniques and leveraging pre-trained weights (Sarwar et al., 2019).The highest reported level of accuracy in the research analysis phase was 92.5%, with significant areas to improve upon by changing the algorithm and modifying the CNN layers.Our problem is a binary classification problem commonly dealt with in Convolution neural networks (Hameed et al., 2021).The proposed study provides a transfer learning-based model to classify pneumonia more accurately than other models.In the proposed research, the model will classify the chest X-ray as either standard or pneumonia.Figure 1 Shows the typical and pneumonia images.Image detection and machine learning refer to the algorithms employed for the artificial intelligence diagnosis system developed.We utilize a mixed supervised deep detection method when using many different types of images to conclude.In the supervised approach, we map a function F with two inputs, a, and b. x=f (a, b) from the convolutional neural network extracts information from input images using a set of pre-defined weights denoted by W. This procedure entails scrutinizing pixels within designated areas of interest to acquire pertinent characteristics.The subsequent segments of the document adhere to this format: Segment 2 delves into correlated studies regarding bacterial identification via machine learning and deep learning techniques.In Segment 3, we delve into the constituents and blueprint of the framework.The fifth segment addresses the research dataset and effectiveness assessment.

Related Works
The identification of normal chest X-ray or pneumonia X-ray images is a challenge in medical imaging and deep learning.With vast amounts of data, it won't be easy to classify the data efficiently and accurately manually.Deep understanding will provide us with a mechanism that will detect the virus and bacteria pneumonia using an automated approach.The presence of pneumonia is detected using X-ray-based images, which contain both cases of the bacterial and virus-related disease.The detection of pneumonia has been extensively researched using traditional machine-learning methods.The data on bacterial and virus-related pneumonia is not in abundance.Therefore, researching this problem takes a lot of effort.When performing analysis using machine learning algorithms, features need to be extracted manually, while when we use Deep learning models, components get autonomously selected by the input layer.Compared to traditional machine learning approaches, deep learning is preferred when using the image dataset.Rajpurkar et al. (2017) developed an application base system exceeding the results the radiologist gathered.The researchers used ChexNet to detect almost 14 diseases of the lungs, including pneumonia.Data scarcity is an issue in lung diseases that negatively affects the research study.The researchers (Liang & Zheng, 2020) used the imageNet dataset to gather a considerable amount of data and fine-tuned it by processing many Image-based datasets.Chouhan et al. (2020) proposed a novel deep-learning approach that extracted features from the dataset, and the dataset used was ImageNet.
The scientists introduced a collaborative framework that amalgamated all pre-existing trained models to achieve elevated accuracy.Pneumonia stands as a prominent contributor to mortality among juveniles globally (Gabruseva et al., 2020).The researchers devised a computational strategy for identifying pneumonia within thoracic X-ray regions squeeze and extinction-based convolutional neural networks.Hashmi et al. (2020) worked on a novel approach using a weight classifier that used Denset as the base model.The predictions were made on the bases of the quality a dataset contains.Li et al. (2018) improved upon the model by developing a fewer layer's deep learning model to reduce the significant computational complexity and time complexity of model training and testing.The covid-19 virus has hit the world and caused a lot of harm to the global medical health community coronavirus affects the lung tissue and causes inflammation in the air sacs of the lungs (Phankokkruad, 2020).The researcher used three pre-trained models to achieve the best accuracy and develop a deep comparative analysis for the best detection technique.The researchers (Narayanan et al., 2020) have worked on a two-stage deep learning model to detect the presence of viral pneumonia by using chest radiography and incorporated it with image segmentation techniques to achieve better results.Early diagnosis is necessary to detect the presence of viral or bacterial infection in the lungs Al Mamlook et al. (2020) conducted a comparative analysis with the previous studies to signify the use of deep learning compared with machine learning approaches.Over the deep learning, models performed better on performance evaluation metrics.Zebin & Rezvy (2020) applied a combination of CNN layers and depth-wise separable convolutional layers to decrease the time required for training.Zhang et al. (2020) worked on a deep-learning neural network by conducting a multinational study on the matter and used DenseNet as a base model to drive the analysis.Researchers, specialists, and medical professionals are working towards an artificial solution for diagnosing pneumonia.In this research study, a comparison is conducted between binary classification models VVG 16 and denseNet (Fu et al., 2021).A different approach using GAN adversarial network technique was implemented in Zhang et al.
(2020)'s study, in which the researchers used the DCCN network to classify MRI images.The researchers (Iparraguirre-Villanueva et al., 2022) conducted a comparative analysis among CT scan images and chest X-rays to devise a more robust technique for detection (Fu et al., 2021).In Berrimi et al. (2021)'s study, researchers used 14 databases and mobile net V2 to conduct a comparative analysis among different types of diseases in the lungs.In the previous studies, most of the research was specific to one classification.Most of the research was related to machine learning algorithms that only utilized qualitative-type data with less accuracy.Transfer learning is a deep and machine learning-based technique (Haghanifar et al., 2022) that adopts a trained model and implements knowledge from previously learned data sequences.The model is already familiarized with the concept of an object by using transfer.With the help of transfer learning, we can implement our trained model on the different virus and bacteria-based X-ray images with an automated classification of the type of pneumonia detected (Ramzan et al., 2019).In recent research, using both quantitative and qualitative methods, Chow et al. (2023) carried out a thorough examination of 18 deep Convolutional Neural Network (CNN) models for COVID-19 diagnosis from chest X-ray (CXR) pictures.Their research clarifies the effectiveness of transfer learning in this field.Similar to this, Ali et al. (2023) presented a CNN-based model designed especially for the diagnosis of chest infections, making use of an isolated, multistage, multiclass transfer learning architecture.This method shows how versatile CNNs are for problems involving medical imaging.Furthermore, Vardhan et al. (2023) demonstrated the possibility of utilizing current knowledge in radiographic analysis by presenting a deep transfer learning framework modified for estimating lung opacities from chest X-rays.Together, these results highlight how important CNNs and transfer learning strategies are to improving diagnostic capacities.The main contributions towards solving this detection problem include: 1.The primary aim of this research investigation is to enhance precision and correctness.2. Maintaining stringent threshold criteria.3. Developing a comparative examination with existing research to refine the forecasting system.The use of convolutional neural networks (CNNs) and transfer learning for pneumonia detection has been studied recently.For example, Wang et al. (2020) achieved an accuracy of 94.9% in pneumonia identification on chest X-rays by fine-tuning the ResNet-50 model that had been pre-trained on the ImageNet dataset using a transfer learning strategy.Similar to this, Chow et al. (2023) achieved 96.7% accuracy by fine-tuning the DenseNet-121 model, which had been pre-trained on the Chest X-ray Images (CXR) dataset, using transfer learning.The effectiveness of transfer learning in enhancing the efficiency of pneumonia detection methods based on chest X-rays is demonstrated by this research.To evaluate its application in various modalities and in actual clinical settings, more research is necessary.The cited studies underscore the effectiveness of this approach in refining pre-trained CNN models and enhancing pneumonia detection performance.However, additional research is required to investigate transfer learning's applicability to diverse modalities and its implementation in real clinical environments.

Limitations
Pneumonia identification through thoracic X-ray imaging has been thoroughly examined.Prior methodologies exhibit the subsequent limitations:


The majority of studies concerning pneumonia rely on traditional convolutional neural networks (Chouhan et al., 2020).


The dataset presented a restricted range of classes and insufficient images for thorough analysis.


Our model outperforms previous ones (Berrimi et al., 2021;Iparraguirre-Villanueva et al., 2022) in terms of accuracy, despite encountering a higher loss rate.

Materials and Methods
The fields of medicine and medical diagnosis have seen a transformation thanks to deep learning and machine learning.These days' high-capacity graphics cards can train and evaluate a significant quantity of data instantly.Artificial intelligence is being implemented in many fields related to fraud detection, image prediction, and object classification.A considerable amount of data can be analyzed and classified based on features (Sattar et al., 2019).Early detection of pneumonia will help medical practitioners solve the late diagnosis of the disease and will fasten the treatment plan for individual patients.Different algorithms have been implemented on quantitative data, but much research is related to machine learning.Deep learning has not been implemented in many diseases because of the high requirements of the resources related to Graphical processing units (Sarwar et al., 2022).The primary source of feature extraction is the images of the dataset, which are chest X-ray-based images.We are using a modified version of AlexNet, and AlexNet is a CNN that can extract features from an image.AlexNet is already a trained model, so the previous weights are used while training for the new dataset images.
The main reason for working on this research is to create an efficient system that will proceed toward an application-level system with actual implementation in the real world.The model system architecture is represented in Figure 2. The enhanced system model (PDTLA) will contain two layers the pre-processing layer and the second one is the application layer.The pre-trained model for the use of the classification is AlexNet.For bacterial and virus pneumonia-based detection systems, our dataset was sourced from the Kaggle database (Hurtí k et al., 2022).The employed dataset was in raw format.In pre-processing layer, the dataset images were converted to 227* 227*1 image size.All the images were of the same size and dimension.AlexNet pre-trained model was imported in the second layer and adapted according to our binary classification problem.The detailed diagram of the proposed (PDTLA) model is shown in Figures 2 and 3.The proposed model undergoes validation.Inputting the chest radiograph images once it has completed training and testing on the dataset.The provided images' height, width, and dimensions are modified to 227*227*3 by the initial pre-processing layer.Subsequently, the information is transmitted to the utility layer, the second stratum, after the images have been altered (Saleem et al., 2020).Utility strata then segregate the images into two categories: class 2, identified as pneumonia, and class 1, identified as typical.If pneumonia is detected in a chest radiograph, the individual will be directed to a healthcare practitioner for further evaluation.Machine learning and artificial intelligence utilize diverse sorts of algorithms (Zhuang et al., 2021) to derive valid deductions from the data and formulate future projections utilizing quantitative data.Projections utilizing images and videos necessitate more advanced approaches of feature map extraction, central loss, and intersection over union (IOU) loss.A plethora of techniques are accessible to conduct video and image detections.In the contemporary era, prognostications based on images and videos are imperative.This is the time when deep learning performs its usefulness in fields of biomedicine disease-based classification.Yolo v4 AlexebAB (Salem et al., 2022), res net, and AlexNet are advanced pre-trained models for transfer learning on new problems.When a model has a strong grasp of the fundamental principles underlying object classification, such as in the case of YOLO v4, its performance becomes notably swift and effective.With this proficiency, detections can be executed within milliseconds.The PDTLA architecture, consisting of both a pre-processing layer and an application layer, employs a customized version of the AlexNet convolutional neural network to streamline the process of diagnosing pneumonia from chest X-ray images.Pre-processing steps like grayscale conversion, resizing, and data augmentation ensure standardized inputs.The adapted AlexNet, featuring an eight-layer architecture with convolutional and fully connected layers, utilizes ReLU activation functions for effective training.Transfer learning expedites feature extraction by capitalizing on AlexNet's familiarity with image patterns.The model's sequential flow, depicted in Figures 2 and 3, emphasizes its methodical approach to pneumonia detection, offering the potential for rapid diagnosis and treatment planning.

Preprocessing
The pre-detection system in our detection model is based on AlexNet, a convolutional neural network.AlexNet is an Object detection model it is trained on 1000 classes related to objects.During training, AlexNet utilizes the Imagenet dataset as its foundation, comprising millions of images to establish weights w for subsequent predictions.Throughout the training process, the image dimensions are standardized to 227*227*3, as depicted in Figure 4. AlexNet is capable of detecting images in Red green blue color format.

Procedure for preprocessing the dataset:
1) Conversion to grayscale: Chest X-rays are typically in color, but grayscale is sufficient for analysis and reduces computational complexity.2) Resizing: Images may have varying dimensions and need to be resized to a standard size for analysis.
3) Intensity normalization: The pixel intensities of the image may need to be adjusted to improve the contrast and make it easier for algorithms to detect patterns.4) Denoising: X-rays often contain noise that can obscure important details, so denoising techniques can be applied to remove this noise.5) Segmentation: The lungs in chest X-rays are the main focus of pneumonia detection, so a segmentation step is typically used to isolate the lungs from the rest of the image.
6) Augmenting Data: Expanding the dataset's size and accommodating disparities in chest X-ray position, orientation, and scale can be achieved through data augmentation methods.This involves techniques such as varying angles, mirror imaging, resizing, and shifting.

Adapted Deep Learning AlexNet
In 2012, the earlier iteration of AlexNet boasted a larger number of layers compared to its current version (Hurtí k et al., 2022).It has been widely adopted for transfer learning applications to address novel challenges.While the complete AlexNet model comprises eight layers, The complexity of the YOLO network surpasses that of AlexNet, which features a distinct structure consisting of a head, backbone, and tail, Consisting of more than 126 strata for instruction.In contrast to YOLO, AlexNet incorporates five Convolutional strata, in addition to a blend of maximum pooling and three Wholly Connected Strata.Each stratum of AlexNet encompasses multiple kernels (filters) (Sethy, 2022), which are activated by the Rectified Linear Unit (ReLU) function.ReLU, a function utilized in deep neural networks, accelerates training speed in comparison to the sigmoid function.Following the ReLU function's implementation, images undergo normalization, involving processes like cropping and resizing.Training a new model demands extensive data and preprocessing, hence the adoption of transfer learning to mitigate training time.Leveraging previously trained models expedites feature extraction compared to untrained models, as these models have already learned patterns, squares, and edges (Nasir et al., 2020).Gathering vast amounts of data from scratch consumes both time and computational resources.
The first five layers of the neural network are already pre-trained on a huge dataset ImageNet collected over the years and contains millions of pre-trained images using GPUs.The softmax functions convert the output into 0 and 1 and are implemented using softmax layers in the AlexNet model.Only the last three layers of the network are changed according to our requirements, as we do not require 1000 classes for classification purposes.Our problem is a binary solution based, so we only used two classes, bacterial or virus-based pneumonia.The model output will be equal to two as the problem contains only two classes.Using a pre-trained model already trained on a multi-class dataset, fasten the training time to detect multiple classes.The fully connected layers present at the last of the network model classify the images into particular binary classes.At the same time, the convolutional layers present in the second stage of the model are used for feature extraction and image filtering.In the proposed model of AlexNet, the last three layers of the system model are customized for custom image detection and are changed according to our specific problem.The network architecture comprises fully connected, softmax, and output classification layers, each requiring distinct properties to enhance accuracy.During the training phase, we experimented with varying learning rates between epochs 0 and 1, adjusting the number of iterations based on the problem's complexity.Initially, we set the total epochs to 60, but observed overfitting and failure to detect classes across different dataset images.Consequently, we settled on 40 epochs, with a learning rate of 1e-4, ensuring convergence with optimal weights.The proposed PDTLA system leverages transfer learning to adapt a pre-trained model to a new problem.By utilizing convolutional neural network layers, sourced domain knowledge, and specific learning parameters, the model effectively tackles pneumonia disease detection in children as well (Barakat et al., 2023;Key et al., 2022).

Dataset
The data has a group of X-ray images with different types of structures.One has normal class, and the other contains pneumonia and a total of 4883.The model uses a public dataset available on Kaggle (Bal Naypyane, 2021).The dataset is divided into binary classes.The total amount of images was 1499 for normal lungs and 3600 pneumonia-based images of a chest X-ray.After the images were classified as normal, pneumonia images were transferred to their particular class folder in Matlab 2019.The dimensions of the images were changed to a single dimension in all dataset images for both classes.After preprocessing, the number of images is shown in Table 1.Quantity of visuals in the dataset for regular thorax radiographs was less than for pneumonia chest X-rays.

Experimental Analysis
The appraisal segment, we will scrutinize the outcomes derived from both the coaching phase and the proposed model's effectiveness using knowledge transfer, concentrating on precise performance measures.The primary goal of this investigation was to devise a streamlined and swift mechanism for recognizing bacteria and healthy erythrocytes.MATLAB 2018 was employed to produce binary classification outcomes for the experimentation.Coaching was carried out on a sole rx 580 GPU with 8 GB of detected RAM for processing.The dataset was partitioned into coaching and authentication sets, with 80% designated for coaching and 20% for authentication.To assess the model's effectiveness, a variety of measures were employed, encompassing sensitivity, selectivity, exactitude, correctness, False negative rate (FNR), False positive rate (FPR), failure rate, F1 score, Likelihood ratio positive (LRP), and Likelihood ratio negative (LRN).Additionally, the Matthews Correlation coefficient (MCC) was utilized to gauge the overall discrepancy between anticipated and observed values.] * 100 (7)

𝑠𝑒𝑛𝑠𝑖𝑡𝑖𝑣𝑖𝑡𝑦
The equations are self-created.Equations represent the results in the experimental method phase.All the equations represent the values of the confusion matrix and the results.
Pneumonia signifies the condition in which Systematic Nominalization of the lungs air sacs was detected in the particular chest X-ray image provided into the system and if the image not detected the proposed model will not classify as minimum threshold criteria will not be met.The proposed system model (PDTLA) pneumonia detection classifies the images into 2 different classes.Normal will represent the class in which the chest X-ray was not abnormal, and no disease of the lungs was detected.Table 3 illustrates the simulation parameters we used to train our PDTLA system model.The dataset was trained on multiple iterations, for example, 10, 20, 30, and 40.The number of epochs was selected after multiple training runs as more epochs will cause overfitting in the enhanced model.The proposed model rendered the maximum accuracy with a least loss per class at 40 epochs.The model generated 98.43 percent accuracy and a loss rate of 0.043.PDTLA model performed better in comparison with other models using different algorithms shown in the table.Seven exhibited less accuracy and more loss rate.Multiple parameters and layers were set according to problem and image dimensions.Table 4 displays the accuracy and miss classification rate at different epochs 10, 20, 30, and 40 on the proposed pneumonia detection system (PDTLA).At the ten epochs mark, the model accuracy was 70% with a high miss enhanced rate of 8.71%, 88% on 20 epochs.The model accuracy reached 98.23% with a miss classification rate of 0.0.520%.In the training's final phase, the model achieved maximum accuracy of 98.73% and a miss rate of 0.04179%.Figure 5 shows the results of labeled images of the validation dataset, with 18 as normal and two as pneumonia.The validated dataset results use mix classification for two of the classes.The proposed (PDTLA) system is tested on a single CPU maximum time taken of dataset trained method 140 minutes total iterations were 1240.Figure 8 display the minimization per class for the proposed model (PDTLA) on 40 iterations.Figure 9 shows the training progress throughout the 40 epochs.The total number of iterations per epochs was 30.Training results is displayed after 40 epochs.Initially the learning rate was low.Capable enhancing rate was set to 1e-4 to gain optimal results but the model converged slowly.

Comparative Analysis
Table 6 illustrates a comprehensive review of diverse research efforts considered in our analysis phase.Our study demonstrated notably higher performance compared to these alternative neural network models.We conducted an extensive comparative analysis with recent research endeavors (Dhar et al., 2021).Similar to research conducted in Iqbal et al. (2022)'s study.

Conclusion
Classification problems always require a lot of data, software, and hardware resources.These problems always cause difficulty to be fixed completely.In the latest updated work, the model will move towards a more enhanced system which does not depend on a single system.model that will embed cloud process servers to hold large containers of data to create a virtualized application with more classes.By the development of such a tool that uses deep learning to solve the fast detection of pneumonia will render help to the medical professionals to detect and treat the particular infection which the patient is suffering from.The smart detection system will be able to handle different types of non-colored and RGB images to detect pneumonia or normal chest X-ray images.The model created in our research uses a Convolutional network based AlexNet deep learning model to classify the images in to either normal or pneumonia.Our smart detection system leverages AlexNet as the foundational model for transfer learning.Following training on our dataset, the model achieved a remarkable accuracy of 98.43% on both the testing and validation datasets, surpassing the performance of other models.This proposed model holds potential to enhance clinical diagnosis by assisting in medical analysis, serving as a preliminary step in the detection process.confidential manner.

Figure 1 .
Figure 1.Chest X-ray samples representing normal and pneumonia images

Figure 2 .
Figure 2. Enhanced system application level model diagram

Figure 4 .
Figure 4. Preprocessed images form the dataset In the PDTLA model, the initial step involved cropping and resizing images to meet the requirements of the base model.The entire image in the binary classes underwent conversion to a height and width of 227*227.AlexNet is capable of detecting images in Red green blue color format.

Figure 5 .
Figure 5. Classification results by (PDTLA) proposed model Figure 6 displays the confusion matrix generated after training the proposed model (PDTLA).The dataset contains 5099 images of both class normal and pneumonia.4079 images were utilized for training the proposed model.1191 images were classified as normal 1191, and 1 image was classified as false positive.2879 images in the training phase were classified as pneumonia, with 8 images classified as a false negative.Figure7displays the enhanced (PDTLA) confusion matrix diagram in the validation phase.The total number of epochs is 40.A total of 1020 images were used for validation purposes.289 images were classified as true Figure 6 displays the confusion matrix generated after training the proposed model (PDTLA).The dataset contains 5099 images of both class normal and pneumonia.4079 images were utilized for training the proposed model.1191 images were classified as normal 1191, and 1 image was classified as false positive.2879 images in the training phase were classified as pneumonia, with 8 images classified as a false negative.Figure7displays the enhanced (PDTLA) confusion matrix diagram in the validation phase.The total number of epochs is 40.A total of 1020 images were used for validation purposes.289 images were classified as true

Table 1 .
Table 2 represents the validation dataset after preprocessing.Class representation for training

Table 2 .
Class representation for validation

Table 5 .
Performance evaluation metrics training and validation

Table 6 .
Analysis of proposed model validation accuracyTable 7 outlines the metrics employed to validate our study in comparison with other research endeavors.These metrics include specificity, sensitivity, precision, False positive rate (FPR), False negative rate (FNR), False discovery rate (FDR), and Matthews correlation coefficient (MCC).

Table 7 .
Depth analysis of proposed model with state art methods