Design and Implementation of A Model for Detection, Classification and Grading Stages of Pneumonia Disease using Deep Learning Technique

DOI : 10.17577/IJERTV14IS050088

Download Full-Text PDF Cite this Publication

Text Only Version

Design and Implementation of A Model for Detection, Classification and Grading Stages of Pneumonia Disease using Deep Learning Technique

Sangareddy B. Kurtakoti Assistant professor Department of CS& E Adichunchanagiri institute of

technology chikamagalur 577-101

Darshan M A

Department of CS&E Adichunchanagiri institute of technology

chikamagalur 577-101

Deeksha Sagar A M

Department of CS&E Adichunchanagiri institute of

technology chikamagalur 577-101

Manoj N

Department of CS&E Adichunchanagiri institute of technology

chikamagalur 577-101

Sagar G

Department of CS&E Adichunchanagiri institute of

technology chikamagalur 577-101

Saritha N

Assistant professor Department of CS& E

Adichunchanagiri institute of technology chikamagalur 577-101

Abstract- Pneumonia is a severe respiratory disease that significantly affects morbidity and mortality rates globally. Conventional diagnostic techniques, like radiologists' Chest X- ray examinations are often subjective and time-consuming. In this work, a deep learning-based method for automatically identifying and classifying pneumonia from chest X-ray pictures using convolutional neural networks (CNNs) is presented. In order to quantify severity, the model is trained to classify images into four groups: no pneumonia, stage 1, stage 2. To improve model performance, a variety of picture preprocessing methods are used, including data augmentation, normalization, and segmentation. Metrics like accuracy, precision, recall, and F1-score are used to assess the suggested approach, which shows notable gains over conventional diagnostic techniques.

Key words : medical imaging, image processing, convolutional neural networks, deep learning, and pneumonia detection.

  1. INTRODUCTION

    Pneumonia is a life-threatening lung infection affecting millions worldwide, particularly children, the elderly, and immunocompromised individuals. Early detection is crucial for timely medical intervention. Traditional diagnostic techniques involve X-ray interpretation by experts, which may be inconsistent due to human subjectivity. methods for deep learning (DL) and machine learning (ML), especially CNNs, offer a promising solution by automating pneumonia detection with high accuracy. An end-to-end deep learning pipeline for the identification and classification of pneumonia is presented in this research.

  2. LITERATURE SURVEY

    K Shah et al. (2022) [1] investigated pneumonia detection using X-ray images, leveraging AI-based techniques to improve diagnosis efficiency. Similarly, Pawashe et al. (2020) [2] proposed a committee machine-based approach for pneumonia detection, integrating multiple classifiers to enhance performance and reduce misclassification errors.

    Comparative studies have also been conducted to evaluate the effectiveness of different learning methodologies. Latta et al. (2021) [3] compared supervised learning techniques, such as feedforward backpropagation, with unsupervised learning methods like radial basis functions. Their findings suggested that supervised models exhibit higher accuracy because of their capacity to pick up intricate patterns

    During the discovery of pneumonia and the COVID-19 pandemic gained significant attention, resulting in the creation of customized models. The application of deep learning and transfer learning methods to identify COVID- 19-related pneumonia was investigated by Ali et al. (2024) [4].highlighting the efficacy of these models in distinguishing between different pneumonia levels. Similarly, Alhasan and Hasaneen (2021) [5] reviewed various digital imaging and AI applications utilized in medical imaging during the pandemic.

    Deep learning architectures have played a crucial role in improving pneumonia detection accuracy. Fernandes et al. (2021) [6] introduced a The diagnosis of pediatric pneumonia using the Bayesian convolutional neural network (CNN) model,demonstrating high sensitivity and specificity. Manickam et al. (2021) [7] further investigated different optimization algorithms and transfer learning approaches to automate pneumonia detection on CXR images, showing

    that transfer learning significantly enhances model performance.

    The role of CNN-based feature extraction in pneumonia detection has also been explored. Varshni et al. (2019) [8] employed CNNs for feature extraction and classification, demonstrating their robustness in medical image analysis. Similarly, Ibrahim et al. (2024) [9] proposed a deep learning framework for pneumonia classification during the COVID- 19 pandemic, emphasizing the importance of high-quality datasets and preprocessing techniques.

    Techniques for ensemble learning have been used to increase accuracy even more. An ensemble of deep CNN models was built by Mabrouk et al. (2022) [10], demonstrating that integrating different architectures can improve the overall classification performance of pneumonia detection algorithms.

  3. METHEDOLOGY

Using cutting-edge machine learning techniques, this technology employs a sequential flow to detect pneumonia in X-ray pictures. To increase precision and effectiveness, the suggested models make use of automated detection techniques and deep learning architectures like Convolutional Neural Networks (CNN).

  • Accuracy, F1 score, recall, accuracy, and precision are utilized for assessment.

Algorithm: Pneumonia Detection Using ResNet-50 1: Begin

2: Import necessary libraries: TensorFlow, Keras, NumPy, OpenCV

3: Load and preprocess dataset:

  1. Resize images to (224 × 224)

  2. Normalize pixel values to range [0,1]

  3. Split dataset into training and testing sets

4: Load pre-trained ResNet-50 model (excluding fully connected layers)

5: Modify the model architecture:

  1. Add Layer of Global Average Pooling (GAP)

  2. Include a sigmoid-activated dense output layer. 6: Assemble the model using:

  1. The Adam optimizer

  2. Binary cross-entropy loss function

  3. The evaluation metric is accuracy.

7: Use data augmentation to train the model on the dataset. 8: Use the F1-score, recall, accuracy, and precision to assess the model's performance.

9: Use `model. Predict(I)` to forecast the class label \( C \) for a new input image \( I \).

10: Deploy the trained model for real-world applications 11: End

IV RESULT

This section presents a detailed description of the Pneumonia Detection dataset utilized for training, extensive evaluation results, performance metrics.

Fig 1 : Pneumonia detection and classification of stages

  1. Data Collection and Preprocessing

    • Dataset:

      • The Chest x ray images.

    • Image Preprocessing:

      • Images are resized to 150×150 pixels, normalized to the range [0,1], and augmented to enhance model generalization.

    • Feature Extraction Preparation:

      • Image data are aligned to facilitate multimodal fusion.

  2. Feature Extraction and Model rocessing

    • Image Feature Extraction:

      • Deep visual characteristics are extracted from the X- ray pictures using a pre-trained ResNet model.

  3. Model Prediction and Output Interpretation

    • Final Classification:

      • The system predicts whether the provided chest x-ray shows normal or pneumonia.

  4. Evaluation and Optimization

    • Loss Function:

      • Binary cross-entropy minimizes classification error.

    • Performance Metrics:

  1. Key Features:

    • Size: The dataset contains thousands of labeled chest X-ray images, ensuring a balanced and varied training and testing environment.

  2. Data Preprocessing:

    • To comply with ResNet input specifications, images were scaled to 150×150 pixels and normalized to a [0,1] range.

    1. Image Data Preprocessing:

      • Resizing & Normalization: To comply with ResNet input specifications, images were shrunk to 150×150 pixels and normalized to a [0, 1] range.

      • Data Augmentation: To enhance the diversity of the dataset, methods like rotation, flipping, and random cropping were used.

2.3 Model Training Data Split:

  • Training Set: 80% for model training.

  • Test Set: 20% reserved for final evaluation. Training Process:

  1. Feature Extraction:

    • Images: A pre-trained ResNet model extracted visual features from images.

  2. Classification:

    • Fully connected layers with ReLU activations and dropout were applied to prevent overfitting.

    • The final output layer used a sigmoid activation to predict the real/fake probability.

  3. Optimization:

    • Loss Function: Binary Cross-Entropy

    • Batch Size: 32

    • Epochs: 15, with early stopping. Training Parameters:

Table 2: Training Parameters

Parameter

Value

Training Set

80%

Test Set

20%

Batch Size

32

Epochs

15

  1. Model Testing And Evaluation

    To ensure an objective assessment, the model was tested using the 10% reserved test set, which was not used for either training or validation.

    Evaluation Metrics:

    Table 3: Evaluation Metrics

    Metric

    Value

    Accuracy

    90%

    Precision

    90%

    Recall

    89%

    F1-Score

    90%

    Confusion Matrix:

    Fig 2: Confusion Matrix

  2. Model Interpretation And Explainability

    • ResNet's convolutional layers automatically pick up on pertinent pneumonia characteristics from chest X- ray pictures, like aberrant textures, lung opacity patterns, and afflicted areas.

    • Heatmaps illustrating the key regions of the X-ray that went into classifying the pneumonia were produced using Grad-CAM, or gradient-weighted class activation mapping.

      • Results:

        Feature map and Grad-CAM visualizations confirm that the model focuses on meaningful pneumonia-related regions, ensuring trustworthy and clinically relevant predictions.

  3. Model Deployment

    A user-friendly interface was created to enable medical professionals and non-technical users to upload chest X-ray images and receive instant classification results

    The trained model was implemented in a real-time environment, enabling instant predictions of the existence of pneumonia from chest X-ray pictures.

  4. Accuracy and Loss Graph

A comparison table highlights the superior performance of our proposed model against three other models across key evaluation metrics: F1-score, recall, accuracy, and precision.

Accuracy Graph

Fig 3: Accuracy Graph

This accuracy graph shows the performance of a ResNet- based deepfake face detection model. The model achieves high accuracy (~90%) for both training and validation, indicating effective learning. The rapid convergence in early epochs suggests efficient feature extraction, while the minimal gap between training and validation accuracy implies low overfitting. The model remains stable after a few epochs, making it reliable for real-world deepfake detection.

Fig 4: Loss Graph

The loss graph would illustrate how well the model is able to minimize classification errors over time. Steadily decreasing training loss means the model is learning well. When validation loss is also decreasing and is very close to the training loss, then that's good generalization. However, when validation loss increases while training loss continues to decrease, then there is a sign of overfitting. Ideally, both should stabilize at a low value to ensure a well-balanced deepfake detection model.

V CONCLUSION

The goal of this project was to use deep learning to create a system for detecting pneumonia. Real-time implementation, evaluation, and model training were among the goals. CNN and ResNet were utilized to extract features from the Chest X-ray dataset. To avoid overfitting, the model used early halting and binary cross-entropy loss. In identifying pneumonia cases, it attained great recall, accuracy, and precision. Last but not least, a real-time deployment system was created that offers a prompt diagnosis of pneumonia together with an interactive user interface (UI) that medical practitioners can easily use.

REFERENCES

  1. K. Shah, V. Patel, I. Sarmalkar, and S. Gaikwad, "Pneumonia Detection Using X-Ray," 2022 International Conference on Recent Advances in Artificial Intelligence (ICRAAI), 2022

  2. S. Pawashe, N. Prasad, V. Phondekar, and R. Shintre, "Detecting Pneumonia from Chest X-Ray Images using Committee Machine," 2020 International Conference on Intelligent Computing and Control Systems (ICICCS), 2020.

  3. A. Latta, S. Avhad, D. Mahajan, and R. Shintre, "Comparative Study of Pneumonia Detection Using Supervised Learning (Feed Forward Back Propagation) and Unsupervised Learning (Radial Basis Function)," 2021 International Conference on Machine Learning and Data Science (ICMLDS), 2021.

  4. Ali, A.M., Ghafoor, K., Mulahuwaish, A., Maghdid, H.: Covid-19 pneumonia level detection using deep learning algorithm and transfer learning. Evolutionary Intelligence 17(2), 10351046 (2024)

  5. Alhasan, M., Hasaneen, M.: Digital imaging, technologies and artificial intelli gence applications during covid-19 pandemic. Computerized Medical Imaging and Graphics 91, 101933 (2021)

  6. Fernandes, V., Junior, G.B., Paiva, A.C., Silva, A.C., Gattass, M.: Bayesian convolutional neural network estimation for pediatric pneumonia detection and diagnosis. Computer Methods and Programs in Biomedicine 208, 106259 2021)

  7. Manickam, A., Jiang, J., Zhou, Y., Sagar, A., Soundrapandiyan, R., Samuel, R.D.J.: Automated pneumonia detection on chest x-ray

    images: A deep learn ing approach with different optimizers and transfer learning architectures. Measurement 184, 109953 (2021)

  8. Varshni, D., Thakral, K., Agarwal, L., Nijhawan, R., Mittal, A.: Pneumonia detec tion using cnn based feature extraction. In: 2019 IEEE International Conference on Electrical, Computer and Communication Technologies (ICECCT), pp. 17 (2019).

  9. Ibrahim, A.U., Ozsoz, M., Serte, S., Al-Turjman, F., Yakoi, P.S.: Pneumonia clas sification using deep learning from chest x-ray images during covid-19. Cognitive computation 16(4), 15891601 (2024)

  10. Mabrouk, A., Diaz Redondo, R.P., Dahou, A., Abd Elaziz, M., Kayed, M.: Pneu monia detection on chest x-ray images using ensemble of deep convolutional neural networks. Applied Sciences 12(13), 6448 (2022)