P: ISSN No. 2394-0344 RNI No.  UPBIL/2016/67980 VOL.- IX , ISSUE- IV July  - 2024
E: ISSN No. 2455-0817 Remarking An Analisation
Medical Image Analysis using CNN for Detection of Pneumonia X-ray
Paper Id :  19071   Submission Date :  2024-07-10   Acceptance Date :  2024-07-21   Publication Date :  2024-07-25
This is an open-access research paper/article distributed under the terms of the Creative Commons Attribution 4.0 International, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
DOI:10.5281/zenodo.13761792
For verification of this paper, please visit on http://www.socialresearchfoundation.com/remarking.php#8
Suman Modak
Research Scholar
Bioinformatics
University Of North Bengal
Siliguri,Westbengal, india
India
Chiranjib Sarkar
Assistant Professor
Bioinformatics
University Of North Bengal
Siliguri, Westbengal, India
Abstract
This paper explores the utilization of Convolutional Neural Networks (CNNs) for pneumonia detection in chest X-ray images within the domain of medical image analysis. The importance of automated tools in aiding disease detection is emphasized, considering the significant progress CNNs have shown in disease detection and image segmentation. The CNN architecture effectively captures intricate features in medical images, leveraging large datasets and backpropagation algorithms to provide accurate predictions. Data augmentation techniques enhance model performance and generalization, while the methodology encompasses data collection, preprocessing, and CNN model selection. Model training and evaluation are facilitated by using the Adam optimizer and evaluation metrics like binary cross-entropy loss and accuracy. Python libraries including NumPy, Matplotlib, Keras, and TensorFlow play essential roles in data manipulation and model development, with Google Colab serving as a convenient platform for experiments. The study highlights the potential of CNNs in advancing healthcare diagnostics, with continued research promising more efficient automated tools for disease detection. Notably, CNNs excel in discerning patterns in medical images, particularly in pneumonia detection, contributing to the advancement of medical imaging and deep learning. The paper discusses the limitations of the study, such as the relatively small dataset used for training and evaluation, and suggests future directions, including collecting larger datasets and extending the CNN model to handle multi-class classification or severity estimation.
Keywords Pneumonia, Deep Learning, CNN, Disease detection, Google Colab.
Introduction

In the field of health care medical images are important for disease diagnosis and prognosis. The images are told about the patients’ health whether the particular Patient is infected by any disease or any other healthcare issue. In the medical field there are several categories of medical images is existed, some of the medical images are MRI, CT scan, X-ray, Ultrasonography and many more. The images are mainly interpreted by a professional radiologist or physician. Among these techniques, one of the oldest and most famous is X-ray imaging technology, which produces images of different dense body parts like broken bones, pneumonia, or COVID detection using ionizing radiation techniques. Doctors' ability to see inside the body to diagnose and treat a variety of illnesses has resulted in a revolution in medical imaging. Imaging techniques can be used to detect a variety of conditions without using invasive procedures, which also lessens the need for such procedures, but the manual detection of the disease through these images also has several issues. It takes lots of time, and each image must be examined carefully by the professional doctors. Sometimes the same image may be interpreted differently by different observers, which can cause discrepancies and possibly manual errors in diagnosis. Overall, the limitations of the manual analysis highlight the demand for automated and computer-added tools to decrease the chance of discrepancies. That’s why in this project we are using a deep learning algorithm for medical image analysis.

Deep learning, an artificial neural network comprising interconnected nodes and weights, utilizes computational methods across multiple processing layers to comprehend the complexity and dimensions of large-scale data. It encompasses probabilistic models, neural networks, and both supervised and unsupervised learning. Successfully applied in various fields such as computational biology, medical imaging, natural language processing, and computer vision, deep learning excels in medical image analysis. Its automated techniques for segmenting images and extracting features yield highly accurate predictions, particularly in disease detection and segmentation. Notably, deep learning models can recognize patterns in medical images that are challenging to discern manually, enhancing disease identification accuracy. In the analysis of X-ray images, deep learning employs large datasets of labeled images, such as pneumonia X-ray datasets sourced from platforms like Kaggle. For instance, a study utilized 5,863 X-ray images from pediatric patients aged one to five years, obtained from Guangzhou Women and Children’s Medical Center.

Pneumonia, characterized by fever and respiratory symptoms, impacts mortality rates, particularly in children under five. It manifests as bacterial or viral/fungal pneumonia, with bacterial pneumonia being more severe. Streptococcus pneumoniae is a common cause of community-acquired pneumonia (CAP). Other bacteria like Haemophilus influenza and viruses such as influenza and COVID-19 also contribute. X-rays aid in pneumonia detection, with radiologists employing computer-aided diagnosis (CAD) for analysis using advanced image processing and deep learning algorithms.

Deep learning, a branch of artificial intelligence inspired by the human brain, utilizes multi-layered artificial neural networks to address complex problems in various fields (figure1). Also referred to as representational learning (RL), it demonstrates proficiency in applications such as image classification, text mining, and spam detection. Recent advancements in deep learning, particularly in areas like Natural Language Processing (NLP) and Speech Recognition, have exhibited significant performance improvements. In the realm of image analysis, Convolutional Neural Networks (CNNs) are widely employed, comprising layers of filters. These filters progressively identify intricate features within images, starting from basic edges to intricate forms and textures. For example, in our research focusing on pneumonia detection, CNNs are employed. They excel in discerning relevant patterns within medical images, assisting in the precise diagnosis of conditions like pneumonia. CNNs learn to recognize increasingly sophisticated characteristics through the layers of filters, enhancing their efficacy in image analysis tasks.


Objective of study

1. Preprocessing the X-ray dataset collected from the Kaggle database.

2. Applying data augmentation techniques such as horizontal flips and random zooming to enhance the training data.

3. Constructing a CNN model architecture using TensorFlow and Keras API for accurate pneumonia detection.

4. Compiling the model with the Adam optimizer and binary cross-entropy loss function.

5. Training the model on the available dataset and assessing its performance through evaluation.

6. Testing the trained model on new X-ray images to ensure its accuracy and reliability.

Review of Literature
Data set Literature: Kermany et al., 2018 Creating a tool for screening of the patients with common blinding retinal diseases and also demonstrated the general applicability of the AI system on the X-ray of pneumonia. For this they used transfer learning techniques which trains the neural network conventional approaches.
Manual Detection: Bourcier et al. 2014 The use of bedside lung ultrasound by emergency physicians for the diagnosis of acute pneumonia is the focus of this study. The authors conducted an observational single-center study involving 144 adult patients and compared the ultrasound examination performed by trained emergency physicians with chest radiography interpreted by a radiologist. The results revealed a higher sensitivity (95%) for lung ultrasound compared to chest X-ray (60%), particularly within the first 24 hours of pneumonia onset. When CT scans were used in cases of diagnostic difficulty, lung ultrasound demonstrated a 100% performance in diagnosing acute pneumonia. These findings suggest the potential of lung ultrasound as a first-line imaging modality for pneumonia diagnosis, with comparable results to previously published studies. However, limitations include false-positive results and the challenge of detecting deep alveolar lesions. To improve accuracy, combining lung ultrasound with transthoracic cardiac ultrasound or evaluating for thrombosis has been proposed. Overall, the study emphasizes the superiority of lung ultrasound over chest X-ray and proposes its integration into the diagnostic algorithm for acute pneumonia in the emergency department setting.
CNN Researches: Gulshan et al., 2016 this study presents an important contribution to the field of medical imaging and diabetic retinopathy detection. The authors focus on developing a deep learning algorithm specifically designed to identify signs of diabetic retinopathy through retinal fundus photographs. The strength of this research lies in the thoroughness of the development and validation process. The study meticulously detail the steps taken to train and fine-tune their deep learning model using a large dataset of retinal fundus photographs, including appropriate data augmentation techniques and model optimization strategies. The rigorous evaluation of the algorithm's performance on an independent test set adds to the credibility of the study. The dataset they are used that are obtained from the United States and 3 eye hospitals in India (Aravind Eye Hospital, Sankara Nethralaya, and Narayana Nethralaya). Institute of Electrical and Electronics Engineers, n.d, 2018 in this study they used 163 infected patients CT scan images and 372 non infected images. demonstrates a well-designed methodology that combines the power of Convolutional Neural Networks (CNN) and Regions with CNN Features (R-CNN) for accurate detection and classification of lung abnormalities. By leveraging the strength of CNNs in feature extraction and R-CNNs in localizing regions of interest, the proposed approach achieves impressive results in terms of both sensitivity and specificity. Rahman et al., 2020 The research paper titled "Transfer Learning with Deep Convolutional Neural Network (CNN) for Pneumonia Detection Using Chest X-ray" explores the application of transfer learning and deep convolutional neural networks (CNN) in the context of pneumonia detection from chest X-ray images. This study aim to enhance the accuracy and efficiency of pneumonia diagnosis, which is of great significance in healthcare. for this study the dataset divided into 3 category Normal, Viral pneumonia, Bacterial pneumonia. For train, evaluate and testing the data they used MATLAB(2019a). such as AlexNet,ResNet18, DenseNet201, and SqueezeNet. Sharmah et al., n.d, 2020 this study was work on the classification and feature extraction of the chest X-ray using deep learning. For this study they are using chest X-ray from publicly available database Keggle. The data consist of 5863 images of chest X-ray. The developed CNN model in this work that is from scratch to detect pneumonia from the chest X-ray. L. Chen et al., n.d, 2018 Convolutional neural networks (CNNs) have had a significant impact on medical image analysis, with the UNet architecture being widely recognized for its success in semantic segmentation tasks. However, standard convolution layers struggle to capture distinctive features when differences among categories are subtle. To address this challenge, the proposed Dense-Res-Inception Net (DRINet) introduces three blocks: a dense connection block, a residual Inception block, and an unpooling block. Evaluation on a benchmark dataset shows that the DRINet outperforms the UNet in terms of dice scores, sensitivity, and Hausdorff distances. The combination of the three blocks offers a trade-off between false negatives (FNs) and false positives (FPs), resulting in improved overall performance. The DRINet achieves better segmentation results compared to other CNN architectures, such as Res-U-Net, particularly in terms of sensitivity, specificity, and Hausdorff distances. O’Shea & Nash et al., 2015 this paper investigates the application of image-based computer- aided algorithms for the differential diagnosis of lung abnormalities, such as lung nodules and diffuse lung diseases. The study proposes the use of convolutional neural networks (CNN) and regions with CNN features (R-CNN) for image-based computer-aided diagnosis (CADx) and detection (CADe) of these abnormalities. The results show promising capabilities of CNNbased CADx in effectively distinguishing different types of lung abnormalities and R-CNNbased CADe in successfully detecting these abnormalities. These algorithms eliminate the need for explicit feature extractors, making them valuable tools for radiologists in diagnosing lung conditions. Wolz et al., 2013 This study automatic segmentation of multi organ of human body. It is crucial for laparoscopy surgery and computer aided diagnosis. For perform this study they used computer tomography images. The methods are based on registration and weighting scheme of hierarchical atlas that generate prior specific target. X. Chen et al., 2012 this study work on a strategic combination of the active appearance model (AAM), LW, GCs for 3D organ segmentation. The proposed work is divided into three part model building, object recognition, and delineation. This model takes only 5 minutes for one organ segmentation. And it is more practical clinical application. L. Chen et al., 2019 this study work on classification, localization, and segmentation. They used computer tomography images, 2D ultrasound images, and brain tumors in multi-modal MR images for this study. it is a compelling research contribution in the field of medical image analysis. The novel combination of self-supervised learning and image context restoration techniques shows promise for addressing the limited annotated data challenge in the medical domain. The study clear explanation, thorough evaluation, and insightful discussions make it a valuable resource. Multilevel Feature Extraction and X-Ray Image Classification, n.d et al., 2007 The classification of the x-ray images. The worked method includes texture feature, shape feature, combine visual feature, support vectors machine, k nearest neighbors. The used data is a 9000 training images and 1000 test images. This the unique method for automated classification of medical Images.
Methodology
This study aims to develop an effective approach for pneumonia detection in X-ray images using convolutional neural networks (CNN). The dataset used for this research is collected from the Kaggle database, which contains a large number of X-ray images of patients diagnosed with pneumonia. The methodology encompasses data preprocessing, model architecture selection, training, and evaluation to achieve accurate and reliable results and also use google colab as interface for python.
Data collection: The dataset used for this study has been downloaded from the Kaggle database. The dataset contains 5,863 X-ray images of retrospective cohorts of pediatric patients that were validated and submitted to the Kaggle database by Guangzhou Women and Children’s Medical Centre, Guangzhou. The images are divided into three categories Train data, Test data, validation data.
Data augmentation: The data augmentation is to enhance the diversity and robustness of the training and test dataset. Data augmentation technique was applied using the ImageDataGenerator class from the keras library. The training data was augmented by performed horizontal flips and applied random zooming with a range of 0.2. Training data was generated in batches using flow_from_directory function, specify the target size of images, batch size, and binary class mode. Data augmentation helps in increasing the variability of the training samples, enabling the CNN model to learn more generalizable features and improve its performance.
Create the model: CNN Model Architecture: In this research the CNN model was implemented using Tenserflow and keras API in python. The model was defined as a sequential, indicating that the layers are stacked sequentially. This model architecture was consisting of Convolution layer, Maxpool layer, Flatten layer, Dense layer with ReLu activation function, But the last layer which is called Dense layer have 1 unit and sigmoid activation function because of the classification between pneumonia and normal (figure 2).
Fig.2. CNN Model
Model compilation & summary: The compiled model utilizes the Adam optimizer, a widely used algorithm for neural network training. It adjusts the learning rate dynamically, enhancing the model's weight updates efficiency. Binary cross-entropy serves as the chosen loss function, apt for binary classification tasks like distinguishing pneumonia cases from non-pneumonia in X-ray images. Accuracy is the metric employed to assess the model's performance, indicating the proportion of correctly classified samples. The model summary offers a succinct depiction of the CNN architecture and its parameters, presenting a layer-wise breakdown along with the trainable parameters count in each layer. This summary aids in grasping the model's complexity and structure, facilitating the identification of potential optimization areas or issues.
Model Training and Evaluation: The model was train by using the training dataset that are obtain from the Kaggle database. model is trained iteratively over a specified number of epochs, with the training data fed in batches to the model. For training the CNN model we was using the model.fit() function on the preprocess dataset that was stored in the train_data variable. The epochs parameters was set in 10. That means the number of step (Batches) process of each epoch during the training. This value may depend on the dataset size and computational resources and the validation steps parameters was set at 25, it was represented number of steps to be processed in validation after each epoch. The performance of the trained model can be assessed by various matrices such us accuracy, precision, recall. This matrices provided ability the model to correctly classify the pneumonia cases. The confusion matrix, was to visualizes the number of true positives, true negatives, false positives, and false negatives, for further assess the model's performance and identity any potential issues. The training and evaluation process is repeatedly performed for the specified number of epochs, for improving the model's performance over the time.
Test the model: After creating and trained the model test the model to checked its property working or nor for this the model was loaded and initialized, leveraging a pre-trained weights file. The image was preprocessed by resizing them to a suitable size and normalized the pixel value. The loaded image was passed through the trained model and give us the prediction that the image was infected by pneumonia or not. And we were also using the Matplotlib visualization tool to saw the x-ray image.
Result and Discussion
Performance Evaluation: The CNN model developed for pneumonia detection in X-ray images achieved promising results in terms of accuracy and reliability. During testing, the model demonstrated a high accuracy rate, indicating its effectiveness in classifying pneumonia cases accurately. Overall, the model exhibited a good balance between correctly identifying pneumonia cases and minimizing false positives (figure 3).

Fig.3.Test accuracy of the model

Interpretation of Results: Our CNN model it is use for automated pneumonia detection by analyzing the features. We found that oust model focus on the identifying specific regions of the lungs that exhibited characteristic patterns associated with pneumonia. This indicates that our CNN model is successfully learned discriminative features for pneumonia detection.
Limitations and Future Directions: Our study has certain limitations. Firstly, the dataset used for training and evaluation was relatively small, which may affect the generalizability of the model. Future work should aim to collect larger datasets to enhance the model's performance and robustness. Secondly, our study focused on classifying binary pneumonia cases (pneumonia vs. normal), but pneumonia can have different subtypes or severity levels. Extending the CNN model to handle multi-class classification or severity estimation would be valuable for clinical applications. This study focuses on utilizing Convolutional Neural Networks (CNNs) for medical image analysis, specifically pneumonia detection in chest X-ray images. It emphasizes the importance of automated tools in aiding disease detection. CNNs have shown significant progress in disease detection and image segmentation within the medical field. The CNN architecture effectively captures intricate features in medical images. By utilizing large datasets and backpropagation algorithms, CNNs can provide accurate predictions. Data augmentation techniques were used to improve model performance and generalization. The methodology involved collecting data, preprocessing, and selecting a suitable CNN model. Efficient model training and evaluation were facilitated by using the Adam optimizer and evaluation metrics like binary cross-entropy loss and accuracy. Python libraries like NumPy, Matplotlib, Keras, and TensorFlow were essential for data manipulation and model development. Google Colab served as a convenient platform for experiments. The application of CNNs in medical image analysis holds promise for advancing healthcare diagnostics. Continued research could lead to more efficient automated tools for disease detection, benefiting patient outcomes and medical science. In summary, this study provides insights into CNNs' role in medical image analysis, particularly in pneumonia detection, contributing to the advancement of medical imaging and deep learning.
Conclusion

Improved Accuracy and Generalization:

Future research can focus on improving the accuracy and generalization capabilities of CNN models for pneumonia detection. This can be achieved by incorporating more diverse and representative datasets, including cases from different demographics and populations. Additionally, exploring advanced CNN architectures and optimization techniques, such as transfer learning and ensemble methods, may lead to enhanced performance and robustness.

Explainability and Interpretability:

CNNs are often considered black-box models, lacking transparency and interpretability. Future research can focus on developing methods to explain and interpret the decisions made by CNNs in pneumonia detection. Techniques such as attention mechanisms, saliency mapping, and visualization of learned features can provide insights into the important regions and features used by the models for diagnosis.

Real-Time Diagnosis:

Real-time diagnosis of pneumonia using CNNs can significantly impact clinical practice by enabling rapid and early detection. Future research can explore the deployment of CNN models on edge devices or cloud-based platforms to provide real-time diagnosis, facilitating timely intervention and treatment.

Integration with Clinical Decision Support Systems:

Integration of CNN-based pneumonia detection models with clinical decision support systems can assist radiologists and healthcare professionals in making accurate and efficient diagnoses. By combining the power of AI-driven image analysis with clinical expertise, these systems can improve diagnostic accuracy, reduce workload, and enhance patient outcomes.

By exploring these future prospects, we can continue to advance the field of medical image analysis using CNNs for the detection of pneumonia in X-ray images, ultimately improving diagnosis, treatment, and patient care.

References
  1. Bourcier, J. E., Paquet, J., Seinger, M., et al. Performance comparison of lung ultrasound and chest x-ray for the diagnosis of pneumonia in the ED. 32(2), 115-118;doi: 10.1016/j.ajem.2013.10.003
  2. Chen, L., Bentley, P., Mori, K., Misawa, K., et al. DRINet for medical image segmentation. 37(11), 2453-2462; doi: 10.1109/TMI.2018.2835303
  3. Chen, L., Bentley, P., Mori, K., et al. Self-supervised learning for medical image analysis using image context restoration. Medical image analysis, 58, 101539; doi: 10.1016/j.media.2019.101539
  4. Chen, X., Udupa, J. K., Bagci, et al. Medical image segmentation by combining graph cuts and oriented active appearance models. IEEE transactions on image processing, 21(4), 2035-2046; doi: 10.1109/TIP.2012.2186306
  5. Gulshan, V., Peng, et al. Development and validation of a deep learning algorithm for detection of diabetic retinopathy in retinal fundus photographs. jama, 316(22), 2402-2410; doi: 10.1001/jama.2016.17216
  6. Kermany, D. S., Goldbaum, et al. Identifying medical diagnoses and treatable diseases by image-based deep learning, 172(5), 1122-1131; doi: 10.1016/j.cell.2018.02.010
  7. O’Shea, K., & Nash, R. (2015). An Introduction to Convolutional Neural Networks; doi: 10.48550/arXiv.1511.08458
  8. Rahman, T., Chowdhury, et al.Transfer learning with deep convolutional neural network (CNN) for pneumonia detection using chest X-ray. Applied Sciences, doi: 10.3390/app10093233
  9. Wolz, R., Chu, C., Misawa, Automated abdominal multi-organ segmentation with subjectspecific atlas generation. IEEE transactions on medical imaging, doi: 10.1109/TMI.2013.2265805
  10. Shen, D., Wu, G., & Suk, H. I. Deep learning in medical image analysis. Annual review of biomedical engineering, doi: 10.1146/annurev-bioeng-071516-044442