American Journal of Biomedical Engineering

p-ISSN: 2163-1050    e-ISSN: 2163-1077

2024;  12(1): 1-6

doi:10.5923/j.ajbe.20241201.01

Received: May 21, 2024; Accepted: Jun. 8, 2024; Published: Jun. 20, 2024

 

COVID-19, Pneumonia, and Healthy Lungs Classification Using CNN and Transfer Learning Model Using Chest X-Ray

A.H.M. Zadidul Karim, Tanima Tasmin Chowdhury, Kazi Bil Oual Mahmud, Fahmida Khanam, Khondaker Md. Abdur Rahman, Rafatul Alam Fahima

Department of Electrical & Electronic Engineering, University of Asia Pacific (UAP), Dhaka, Bangladesh (UAP)

Correspondence to: Kazi Bil Oual Mahmud, Department of Electrical & Electronic Engineering, University of Asia Pacific (UAP), Dhaka, Bangladesh (UAP).

Email:

Copyright © 2024 The Author(s). Published by Scientific & Academic Publishing.

This work is licensed under the Creative Commons Attribution International License (CC BY).
http://creativecommons.org/licenses/by/4.0/

Abstract

The Coronavirus 2019 (COVID-19) is a member of a large virus family that causes a variety of health conditions, including the common cold, fever, wheezing, and respiratory difficulties. The study uses machine learning techniques like Label Binarizer to encode chest X-ray images, transform them into categorical forms using Python, and develop a deep learning detection model using CNNs, VGG19, AveragePooling2D, dropout, flatten, dense, and input. The model predicts pneumonia, COVID-19, and respiratory health, reducing training loss and improving accuracy. The proposed deep learning technique enhances the precision of existing state- of-the-art techniques and can be used by medical personnel to assess patients. The framework was trained and validated using 4417 images of exposed chest X-rays (which are irregular in shape and require image preprocessing) and compared to existing methods. In order to identify COVID-19 at an early stage, three separate investigations were done using raw X-ray scans. Our experimental study focused on classifying three distinct categories: COVID-19, pneumonia, and ordinary cases. The approach employed in our study achieved an highest accuracy rate of 96.89%. Using X-ray images, the method represents a potential solution for promptly detecting positive COVID-19 cases.

Keywords: Image Processing, Deep Learning, CNN Models, Alexnet, Xception, Neural Network, Covid-19 Detection Using X- Ray Image

Cite this paper: A.H.M. Zadidul Karim, Tanima Tasmin Chowdhury, Kazi Bil Oual Mahmud, Fahmida Khanam, Khondaker Md. Abdur Rahman, Rafatul Alam Fahima, COVID-19, Pneumonia, and Healthy Lungs Classification Using CNN and Transfer Learning Model Using Chest X-Ray, American Journal of Biomedical Engineering, Vol. 12 No. 1, 2024, pp. 1-6. doi: 10.5923/j.ajbe.20241201.01.

1. Introduction

COVID-19 is a recently identified strain of coronavirus responsible for contagious illnesses, including respiratory infections like the common cold. The novel coronavirus (nCoV) is an unidentified virus in the human body, while MERS-CoV is a zoonotic virus capable of inter-species transmission between animals and humans. The pathogen is zoonotic. Multiple investigations have demonstrated that direct or indirect contact with dromedary camels that have been infected infects humans. MERS-CoV has been identified in several Middle Eastern, South Asian, and African nations. A coronavirus related to SARS induces severe acute respiratory syndrome. Late in February 2003, it was first identified in China during an outbreak. The disease then spread to four other nations. The SARS pathogen is airborne. It can spread through microscopic salivary droplets, much like the common cold and influenza. COVID-19 patients often experience mild to moderate respiratory symptoms, which can be managed without specialized intervention. Serious illnesses are often due to advanced age and underlying medical conditions like cardiovascular, chronic, diabetes, and cancer. COVID-19 is an infectious disease primarily affecting the respiratory system, particularly the lungs. It can cause mild to severe respiratory complications, with severity heightened in elderly and pre-existing medical conditions. The virus enters the body through mucous membranes and invades healthy host cells, generating novel viral components. The severity of symptoms may be heightened in elderly individuals and those with pre-existing medical conditions. It replicates, and new viruses infect adjacent cells. The new coronavirus is capable of infecting either the upper or lower respiratory tract. Air travel via our airways. The mucous membrane is susceptible to irritation and inflammation [1]– [5].
In certain instances, the infection may reach the alveoli. Approximately 80% of COVID-19 patients exhibit modest or moderate symptoms. Some individuals may experience a dry cough or irritated larynx. Some individuals develop dry socket pneumonia.
A chest X-ray or CT scan can reveal indications of airway inflammation to physicians. Doctors may observe "ground glass opacity" on a chest CT scan because it resembles shower door ground glass.

2. Background Study

2.1. COVID-19 Pneumonia

COVID-19 pneumonia affects bilateral lung function, causing respiratory distress, coughing, and symptoms. Post- resolution, lung injury can lead to prolonged challenges that may take months to improve. While most individuals recover without lasting pulmonary impairment, pneumonia resulting from COVID-19 can be a serious condition. Pneumonia is caused by various infectious pathogens, including viruses, bacteria, and fungus. Common viral infections include influenza, RSV, HPIV, rhinoviruses, measles, varicella- zoster, HMPV, adenovirus, and coronavirus, which can lead to severe respiratory infections [6]. Viral pneumonia is less severe than bacterial pneumonia, and individuals with viral pneumonia are more susceptible to developing bacterial pneumonia, according to an NIH Reliable Source. Treatment is a major distinction between viral and bacterial pneumonia. Antibiotics do not treat viral infections. The majority of cases of viral pneumonia can be treated with at-home care, although antivirals may be prescribed on occasion [7], [8].

2.2. X-RAY

COVID-19 pneumonia affects bilateral lung function, causing reduced oxygen transportation and symptoms like dyspnea and coughing. Post-resolution, lung damage can lead to prolonged respiratory challenges, requiring several months for improvement. While most recover without lasting impairment, severe pneumonia from COVID-19 can still be severe [9].

2.3. Neural Network

Neural networks are algorithms that emulate the cognitive processes of the human brain, allowing them to uncover latent associations within a dataset. They are used in both organic and artificial neural systems, and their inception can be traced back to artificial intelligence. Artificial Neural Networks (ANNs) are designed to resemble the human brain structure, featuring interconnected nodes called neurons. These networks are composed of numerous artificial neurons, known as processing units, which consist of input and output units. The input unit receives information in various forms and structures, determined by the internal weighing system. The neural network uses backpropagation, or backward propagation of error, to enhance the quality of their output outcomes. In the initial training phase, the network identifies patterns in data and compares its output data with the desired output data, adjusting the discrepancy between the two outcomes [10]-[12].

2.4. Convolution Neural Network

A convolutional neural network is a three-dimensional array of neurons that only processes data from a small portion of the visual field. The input functions are retrieved in stages, and the network understands the images in part. The processing includes converting the image from RGB or HSI to grayscale, optimizing pixel values to detect edges, and categorizing the images. Applications of Convolutional Neural Networks (CNNs) include Image Processing, Computer Vision, Speech Recognition, and Machine Translation [11].
Advantages: The number of parameters to be learned in the fully linked layer is more in comparison to the reduced number of parameters in the alternative layer.
Disadvantages: Designing and maintaining the aforementioned system presents a higher level of complexity in comparison to other systems, and its performance is considerably slower.
Figure 1. Basic CNN model

3. Research Methodology

We divide our methodology in different parts. Fig 3 represents our work flow where we used three different known transfer learning models and three cnn models for evaluating result. Finally we enhance our result by combining our two best result and achieve a highest result of 96.89% accuracy.

3.1. Dataset

COVID-19 X-ray samples were collected from kaggle [20]. The dataset, organized into two directories, "train" and "test", contained 6432 x-ray images, with 20% designated as test data. However, there was a significant disparity in samples for the three train classes, leading to potential overfitting. We handle this issue by applying augmentation technique describe in 3.2. Fig 3 represents data samples from our dataset.
Figure 2. a) Covid-19 infected lungs X-RAY b) Healthy Lungs X-RAY c) Pneumonia infected lungs X-RAY

3.2. Data Augmentation

Data augmentation refers to the practice of generating more training data by employing specialized procedures within a certain subject. The prevalent kind of data augmentation is picture data augmentation, wherein photos within the training dataset are altered to generate variations that remain within the same class as the original image [13]:
• The image can be flipped horizontally or vertically using the horizontal flip and vertical flip variables.
• The manipulation of image rotations is governed by the rotation range parameter.
• The luminance of an image, as determined by the brightness range parameter.
• The zoom range option enables the adjustment of image zoom.

3.3. Image Pre-processing

Since, the dimensions of the images in the Dataset were not uniform, all images were resized to 400 x 400 dimensions prior to data augmentation. As we used our data for three different know models (VGG, XCEPTION AND ALEXNET) which require a fixed size, we also resize our data according to each models requirement.
Figure 3. Overall system architecture of the diagnosis of COVID 19, Pneumonia and Normal Chest X-Ray framework

3.4. Development of CNN Architecture

The study aimed to evaluate the effectiveness of Convolutional Neural Networks (CNN) on a picture database, comparing it with other models based on image statistical properties. The trials were divided into two categories: CNN experiments without transfer learning and those with transfer learning, aiming to provide valuable insights for image classification. We applied three feed forward CNN models (CNN1, CNN2, CNN3). In CNN1 and CNN2 we used 3 convolution layer with different filter and in CNN3 we used 4 layer. Table 1 represents our CNN details. After applying convolution we used global average pooling layer and a dense layer for classification followed by softmax activation.
Table 1. Architectural Properties of 3 CNN
     

3.5. Fine Tuning of Model

Extraction of features – A pre-trained model can be utilized for feature extraction. One possible approach is to exclude the output layer, which consists of the classification probabilities for each of the 1000 classes. Instead, we can utilize the entire network as a static feature extractor for the new dataset. Utilize the Model's Architecture – The model's architecture can be utilized by randomly initializing all the weights and subsequently retraining the model using our dataset [14], [15]. The training process involves deciding which layers should be trained and which to keep frozen. A pre-trained model can be used through partial training, preserving initial layer weights by retraining higher layers. Experimentation helps determine the optimal number of layers to be frozen and trained, and various strategies are used to enhance model precision.

3.6. Pre-trained Model

A pre-trained model is a model trained to address similar issues, often used by prominent technology companies or scholars. Researchers use large-scale datasets like ImageNet or Wikipedia Corpus to identify pre-trained models and in tegrate their knowledge into their computational framework. These models are digital repositories of essential data. Three pre-trained neural networks were used for computer vision tasks, including image transfer, classification, generation, picture captioning, and anomaly detection. Popular convolutional neural network architectures include VGG19, Xception, and AlexNet [16].

3.7. Model Compilation and Training

We used same compilation method for our all CNN and Pre-trained models. We used Adam optimizer with .0001 learning rate and accuracy matrixs for accuracy. As we dealt with multiclass problem we used categorical cross entropy as loss function. We applied 80% data for training and 20% for testing with a batch size of 32.

4. Data Analysis and Findings

4.1. Experimental Condition

Models can be assessed using a range of metrics, including as precision in classification, sensitivity (also known as the true positive rate), specificity, and the area under the receiver operating characteristic curve (ROC AUC). However, relying solely on accuracy or a sensitivity/specificity criterion is inadequate, especially when dealing with imbalanced data. This is because while one measure may yield better scores, other metrics may produce lower results. In the context of medical applications, it may be inferred that the model exhibiting a higher Receiver Operating Characteristic Area Under the Curve (AUC) score possesses superior discriminatory capability in distinguishing individuals afflicted with COVID-19 from those unaffected by the disease. The model's outputs, also known as categorization predictions, elicit "positive" and "negative" outcomes as their respective replies. The terms "True" and "False" are used to denote the data. The subsequent equations represent the mathematical expressions utilized for the computation of precision, sensitivity, and specificity. The model with a higher ROC AUC score is better at distinguishing between COVID-19 patients and non-infected ones. The terms "positive" and "negative" represent outcomes, while "true" and "false" represent factual information. Accuracy, sensitivity, and specificity are calculated using equations.
(1)
(2)
(3)
(4)
Where, TP stands for True Positive
TN stands for True Negative
FP stands for False Positive
FN stands for False Negative
Therefore, all the above-mentioned criteria were taken into consideration during the evaluation of the models.

4.2. Result Analysis

Table 2 represents results of different transfer learning models. From table 2 it is clear that VGG19 got best result between transfer learning models. Table 3 represents results of our three CNN model where we get best result with CNN3. In fig. 5. from the bar graph, it demonstrates validation of accuracy. From this CNN-1, CNN-2, CNN-3, Xception and VGG19 have validation accuracy more than 90%. In the case of AlexNet the validation accuracy is above 80%.
Table 2. Results of Xception, VGG19, and AlexNet
     
Table 3. Classification report of the CNN prediction model without transfer learning
     
The accuracy is higher in VGG-19 and lower in AlexNet. CNN-1 and CNN-2 and CNN-3 validation accuracy is respectively 95.09, 95.76, 95.98.
Validation accuracy from bar-graph fig. 5. depicts the validation accuracy of every model that we have examined. AlexNet has the lowest validation accuracy with around 84% where VGG19 shows the highest validation accuracy with around 96%. Overall, VGG19 and CNN-3 outperforms other models in terms of validation accuracy and F1 score. Fig. 4 and Fig. 5 represent F1 score and accuracy comparison of our six used models. Here we get best result with CNN3 and VGG19. We enhance our result by combining our two best result and got highest accuracy of 96.89%.
Figure 4. Figure Comparison of F1 score of different CNN
Figure 5. Validation Accuracy of different Models

5. Conclusions

This research report presents a novel strategy for the automatic identification of COVID-19 pneumonia using a convolutional neural network (CNN) based transfer learning technique. Three convolutional neural network (CNN)-based deep learning techniques, which have been widely used and extensively studied, were utilised to train, validate, and evaluate their effectiveness in classifying persons with normal circumstances. The present study examines the correlation between COVID-19 infection and pneumonia through the analysis of chest X-ray images. Three CNN models were trained using stochastic gradient descent with a momentum optimizer, with a learning rate of 10-3, momentum update of 0.9, and a mini-batch size of 32 pictures, and Back Propagation algorithm iterations ranging from 20 to 100. Furthermore, through the utilization of a vast database and the implementation of image augmentation techniques, it has been observed that deep networks exhibit superior performance compared to external networks, particularly in the classification of standard and viral images. This is primarily due to the fact that a significant number of networks demonstrate a heightened ability to accurately identify COVID-19 with a notable level of sensitivity. The VGG19 and CNN3 model achieved high classification precision, recall, and F1- score for COVID-19, normal cases, and viral pneumonia pictures, with accuracy and recall values, indicating significant heterogeneity in X-ray input pictures. We enhance our result by combining our two best result and got highest accuracy of 96.89%. Artificial intelligence algorithms trained on a large dataset can efficiently categorize COVID-19 pneumonia, potentially improving the effectiveness and accuracy of screening protocols for individuals with positive test results. For future work we think if we get more data set and proper setup which can compute more complex network , we will be able to get better model.

References

[1]  “Covid-19 Lung Damage.” Johns Hopkins Medicine, February 28, 2022. https://www.hopkinsmedicine.org/health/conditions-and-diseases/coronavirus/what-coronavirus-does-to- the-lungs.
[2]  Health products policy and standards. Accessed May 21, 2024. https://www.who.int/teams/health-product-policy-and-standards/overview.
[3]  Hou, Chia-Yi. “‘mild’ Cases of Coronavirus May Have Serious Long-Term and Recurring Effects.” The Hill, July 10, 2020. https://thehill.com/changing-america/well-being/prevention-cures/506752-mild-cases-of- coronavirus-may-not-be-as-mild-as/.
[4]  “Severe Acute Respiratory Syndrome (SARS).” World Health Organization. Accessed May 21, 2024. https://www.who.int/health-topics/severe-acute-respiratory-syndrome.
[5]  Chowdhury, Muhammad EH, Tawsifur Rahman, Amith Khandakar, Rashid Mazhar, Muhammad Abdul Kadir, Zaid Bin Mahbub, Khandakar Reajul Islam et al. "Can AI help in screening viral and COVID-19 pneumonia?." Ieee Access 8 (2020): 132665-132676.
[6]  Apostolopoulos, Ioannis D., and Tzani A. Mpesiana. “COVID-19: Automatic Detection from X-Ray Images Utilizing Transfer Learning with Convolutional Neural Networks.” Physical and Engineering Sciences in Medicine 43, no. 2 (April 3, 2020): 635–40. https://doi.org/10.1007/s13246-020-00865-4.
[7]  Bukhari, Syed Usama, Syed Safwan Bukhari, Asmara Syed, and Syed Sajid Shah. The diagnostic evaluation of Convolutional Neural Network (CNN) for the assessment of chest X-ray of patients infected with COVID-19, March 31, 2020. https://doi.org/10.1101/2020.03.26.20044610.
[8]  Goel, Tripti, R. Murugan, Seyedali Mirjalili, and Deba Kumar Chakrabartty. “OptCoNet: An Optimized Convolutional Neural Network for an Automatic Diagnosis of COVID-19.” Applied Intelligence 51, no. 3 (September 21, 2020): 1351–66. https://doi.org/10.1007/s10489-020-01904-z.
[9]  Goyal, Shimpy, and Rajiv Singh. “Detection and Classification of Lung Diseases for Pneumonia and Covid-19 Using Machine and Deep Learning Techniques.” Journal of Ambient Intelligence and Humanized Computing 14, no. 4 (September 18, 2021): 3239–59. https://doi.org/10.1007/s12652-021-03464-7.
[10]  Islam, Md. Milon, Fakhri Karray, Reda Alhajj, and Jia Zeng. “A Review on Deep Learning Techniques for the Diagnosis of Novel Coronavirus (COVID-19).” IEEE Access 9 (2021): 30551–72. https://doi.org/10.1109/access.2021.3058537.
[11]  Kong, Lingzhi, and Jinyong Cheng. “Classification and Detection of COVID-19 X-Ray Images Based on DenseNet and VGG16 Feature Fusion.” Biomedical Signal Processing and Control 77 (August 2022): 103772. https://doi.org/10.1016/j.bspc.2022.103772.
[12]  Normandin, Bree. “Everything You Need to Know about Pneumonia.” Healthline, February 8, 2023. https://www.healthline.com/health/pneumonia.
[13]  “Pneumococcal Disease Diagnosis, Treatment and Causes.” Pfizer. Accessed May 21, 2024. https://www.pfizer.com/science/focus-areas/vaccines/Pneumococcal-Disease.
[14]  Ucar, Ferhat, and Deniz Korkmaz. “Covidiagnosis-Net: Deep Bayes-Squeezenet Based Diagnosis of the Coronavirus Disease 2019 (COVID-19) from X-Ray Images.” Medical Hypotheses 140 (July 2020): 109761. https://doi.org/10.1016/j.mehy.2020.109761.
[15]  Wang, Tao, Yongguo Zhao, Lin Zhu, Guangliang Liu, Zhengguang Ma, and Jianghua Zheng. “Lung CT Image Aided Detection Covid-19 Based on Alexnet Network.” 2020 5th International Conference on Communication, Image and Signal Processing (CCISP), November 2020. https://doi.org/10.1109/ccisp51026.2020.9273512.
[16]  Aslan, Muhammet Fatih, Muhammed Fahri Unlersen, Kadir Sabanci, and Akif Durdu. "CNN-based transfer learning–BiLSTM network: A novel approach for COVID-19 infection detection." Applied Soft Computing 98 (2021): 10691.
[17]  Polsinelli, Matteo, Luigi Cinque, and Giuseppe Placidi. "A light CNN for detecting COVID-19 from CT scans of the chest." Pattern recognition letters 140 (2020): 95-100.
[18]  Reshi, Aijaz Ahmad, Furqan Rustam, Arif Mehmood, Abdulaziz Alhossan, Ziyad Alrabiah, Ajaz Ahmad, Hessa Alsuwailem, and Gyu Sang Choi. "An efficient CNN model for COVID-19 disease detection based on X-ray image classification." Complexity 2021 (2021): 1-12. Thakur, Samritika, and Aman Kumar. "X-ray and CT-scan-based automated detection and classification of covid-19 using convolutional neural networks (CNN)." Biomedical Signal Processing and Control 69 (2021): 102920.
[19]  Babukarthik, R. G., V. Ananth Krishna Adiga, G. Sambasivam, D. Chandramohan, and Jayavel Amudhavel. "Prediction of COVID-19 using genetic deep learning convolutional neural network (GDCNN)." Ieee Access 8 (2020): 177647-177666.
[20]  Patel, Prashant. “Chest X-Ray (Covid-19 & Pneumonia).” Kaggle, September 17, 2020. https://www.kaggle.com/datasets/prashant268/chest-xray-covid19-pneumonia.