International Scientific Platform
Serving Researchers Since 2012

A HYBRID DEEP LEARNING FRAMEWORK FOR AUTOMATED LUNG DISEASE DETECTION USING IMAGE PROCESSING AND DENSENET-121

DOI : 10.17577/IJERTCONV14IS030012
Download Full-Text PDF Cite this Publication

Text Only Version

A HYBRID DEEP LEARNING FRAMEWORK FOR AUTOMATED LUNG DISEASE DETECTION USING IMAGE PROCESSING AND DENSENET-121

Assistant Professor

Department of Computer Science and Engineering

Jayaraj Annapackiam Csi College of Engineering Nazareth, India

abamilarachel@gmail.com

Abstract Lung diseases are medical conditions that affect the lungs and interfere with normal breathing. They can be caused by infections, smoking, pollution, or genetic factors and may reduce the lungs ability to supply oxygen to the body. Lung disease detection from medical images. First, the input dataset consists of lung images, usually collected datasets. These images contain important visual information about the lungs and possible abnormalities. Next, the preprocessing stage is applied to improve image quality. In this step, Histogram Equalization is used to enhance contrast and make important structures in the lung image more visible. After preprocessing, the segmentation stage is performed using Canny Edge Detection. This technique identifies the edges and boundaries of important regions in the lung image. Segmentation helps separate the lung area from the background and highlights potential disease regions. Once the important regions are identified, the process moves to feature extraction. In this step, the Local Binary Pattern (LBP) method extracts texture features from the lung image. These features represent patterns that help distinguish between normal and abnormal lung tissues. After extracting the features, the classification stage is performed using the deep learning model DenseNet121. This model analyzes the extracted features and learns patterns related to different lung diseases. Finally, the system generates the prediction output, which indicates whether the lung image is normal or shows signs of disease. This pipeline improves the accuracy and efficiency of automated lung disease detection. The Project implemented by Python.

Keywords Lung Disease Detection, Medical Image Processing, Histogram Equalization, Image Segmentation, Canny Edge Detection, Feature Extraction, Local Binary Pattern (LBP), Deep Learning, DenseNet-121, Image Classification, Computer-Aided Diagnosis, Ultrasound / Medical Imaging, Python Implementation.

  1. INTRODUCTION

    Lung diseases are among the most common and serious health conditions affecting people worldwide. These diseases impact the normal functioning of the lungs and reduce the body's ability to exchange oxygen and carbon dioxide efficiently. Common lung diseases include pneumonia, tuberculosis, chronic obstructive pulmonary disease (COPD), and lung cancer. Early detection of these diseases is essential to prevent severe complications and improve patient survival rates.

    Medical imaging plays a vital role in diagnosing lung diseases. Techniques such as X-rays, CT scans, and ultrasound imaging provide detailed visual information

    PG Student

    Department of Computer Science and Engineering

    Jayaraj Annapackiam Csi College of Engineering,

    Nazareth, India jmuthu1310@gmail.com

    about lung structures. However, manual analysis of these images by radiologists can be time-consuming and prone to human error. This creates a need for automated systems that can assist in accurate and efficient diagnosis.

    In recent years, image processing and deep learning techniques have gained significant attention in the field of medical diagnosis. These methods can analyze large volumes of medical data and identify patterns that may not be easily visible to the human eye. Automated lung disease detection systems aim to improve diagnostic accuracy and reduce the workload of healthcare professionals.

    The proposed system focuses on detecting lung diseases from medical images using a combination of image processing and deep learning techniques. Initially, the input dataset consists of lung images collected from standard medical datasets. These images may contain noise, low contrast, and irrelevant information that can affect analysis.

    To address these challenges, preprocessing techniques such as histogram equalization are applied to enhance image quality and improve contrast. This step makes important features in the lung images more visible and suitable for further processing. Following preprocessing, segmentation is performed using Canny edge detection to identify the boundaries of lung regions and highlight areas of interest.

    Feature extraction is then carried out using the Local Binary Pattern (LBP) method, which captures texture information from the images. These extracted features help differentiate between normal and abnormal lung tissues. After feature extraction, the DenseNet-121 deep learning model is used for classification. This model learns complex patterns and accurately predicts the presence of lung diseases.

    Finally, the system generates an output indicating whether the lung image is normal or abnormal. The implementation of this project is carried out using Python, providing flexibility and efficiency in processing medical image data. The proposed approach aims to improve the accuracy, reliability, and speed of lung disease detection systems.

  2. RELATED WORK

    Several research studies have been carried out for lung disease detection using medical image analysis techniques. Traditional methods mainly relied on manual feature extraction and machine learning algorithms such as Support Vector Machine (SVM) and k-Nearest Neighbors (KNN) for classification. These approaches achieved moderate accuracy but required careful feature selection. With the advancement of deep learning, Convolutional Neural Networks (CNNs) have been widely used for automatic feature extraction and classification of lung diseases. Models like VGGNet, ResNet, and DenseNet have shown improved performance in detecting abnormalities from chest X-ray and CT images. Some researchers have applied image preprocessing techniques such as histogram equalization and noise filtering to enhance image quality. Segmentation methods, including thresholding and edge detection, have also been used to isolate lung regions. Texture-based feature extraction techniques like Local Binary Pattern (LBP) have proven effective in capturing important patterns. Hybrid models combining traditional image processing with deep learning have further improved classification accuracy. Despite these advancements, challenges such as data imbalance and variability in image quality still exist. Therefore, more efficient and robust automated systems are required for accurate lung disease detection.

  3. PROPOSED METHODOLOGY

    The overall architecture of the proposed lung disease detection system is shown in Fig. 1.

    Fig.1. Proposed Densenet-121 based Lung Fibrosis Detection Framework

    Fig. 1 illustrates the proposed DenseNet-121 based lung fibrosis detection framework. The process begins with the input lung image dataset, followed by preprocessing using histogram equalization to enhance image quality. Next, segmentation is performed using Canny edge detection to identify important lung regions. Feature extraction is then carried out using the Local Binary Pattern (LBP) method to capture texture details. Finally, the DenseNet-121 model classifies the features and produces the prediction output indicating the presence of lung disease.

    The proposed system for lung disease detection follows a structured pipeline, as illustrated below:

    Step 1: Input Dataset (Lung Images)

    The process begins with collecting lung images from standard medical datasets. These images (X-ray, CT, or ultrasound) contain important visual information about

    lung structure and possible abnormalities. The quality and diversity of the dataset play a crucial role in model performanc.

    Step 2: Preprocessing Histogram Equalization

    In this stage, image preprocessing is applied to improve image quality. Histogram Equalization enhances the contrast of the lung images, making hidden details more visible. It helps in highlighting important structures and reduces the effect of poor lighting and noise.

    Step 3: Segmentation Canny Edge Detection

    After preprocessing, segmentation is performed using Canny Edge Detection. This technique detects edges and boundaries within the image. It helps to clearly separate lung regions from the background and identify areas that may contain disease.

    Step 4: Feature Extraction Local Binary Pattern (LBP)

    Once the important regions are identified, feature extraction is carried out using the Local Binary Pattern method. LBP captures texture features from the lung images by analyzing pixel patterns. These features help in distinguishing between normal and abnormal tissues.

    Step 5: Classification DenseNet-121

    The extracted features are then passed to the DenseNet-121 deep learning model. This model learns complex patterns from the data and performs classification. It determines whether the lung image is normal or affected by disease based on learned features.

    Step 6: Prediction Output

    Finally, the system generates the output result. The prediction indicates whether the input lung image is normal or contains signs of disease. This automated output assists doctors in making faster and more accurate decisions.

  4. EXPERIMENTAL SETUP AND EQUATIONS

    1. Experimental Setup

      The proposed system is implemented using Python. The dataset consists of lung images collected from standard medical sources. The images are divided into training and testing sets to evaluate the model performance.

      • Preprocessing is applied using Histogram Equalization to improve image quality and contrast. Then, Canny Edge Detection is used for segmentation to identify important regions in the lung images.

      • Feature extraction is performed using the Local Binary Pattern (LBP) method to capture texture information. These features are given as input to the DenseNet-121 model for classification.

      • The model is trained using labeled data and tested using unseen images. Finally, the system predicts whether the lung image is normal or diseased.The

        dataset was split into training (80%) and testing (20%) sets.

    2. Equations

    1. Preprocessing Stage

      Output image after enhancement

      I_p = f_{1}(I) (1)

      where I = input image, Ip = preprocessed image

    2. Segmentation Stage

      Extracted region from image

      I_s = f_{2}(I_p) (2)

      where Is = segmented image

    3. Feature Extraction:

      Features from segmented image

      F = f_{3}(I_s) (3)

      where F = extracted features

    4. Classification Final prediction

      Y = f_{4}(F) (4)

      where Y = output (Normal / Diseased)

    5. Final Combined Equation

    Y = f_{4}(f_{3}(f_{2}(f_{1}(I)))) (5)

  5. RESULTS AND DISCUSSION

    The proposed lung disease detection system achieved an overall accuracy of approximately 92% on the test dataset. The confusion matrix shows that most predictions are concentrated along the diagonal, indicating correct classification across all classes. The classification report demonstrates high precision, recall, and F1-score, confirming the effectiveness of the model. The use of preprocessing and feature extraction techniques improved the models ability to distinguish between different lung diseases. Overall, the results indicate that the proposed method is reliable and efficient for automated lung disease detection.

    Lung disease detection often relies on medical imaging like chest X-rays to visualize the internal structures of the chest. Radiologists analyze these images for abnormalities such as infiltrates, masses, or fluid accumulation within the lungs. Image processing techniques can enhance features, making subtle signs of disease more apparent for diagnosis. For instance, inverting image colors, like converting to BGR, can sometimes highlight variations that might be less obvious in the original input. This visual analysis helps in identifying various respiratory conditions, from pneumonia and tuberculosis to more serious illnesses.

    Fig. 2. Comparison of Chest X-ray Images: Original vs. BGR Inversion

    This fig 3 shows the difference between BGR and RGB image formats used in lung disease detection. The BGR image is the default format in OpenCV, while RGB is commonly used for visualization and deep learning models. Converting BGR to RGB ensures accurate color interpretation and improves model performance. Proper color format handling is important during preprocessing of chest X-ray images. This step helps in enhancing feature extraction and classification accuracy in lung disease detection systems.

    Fig. 3. Comparison of BGR and RGB Image Representations for Lung Disease Analysis

    This fig 4 illustrates the conversion of an RGB chest X- ray image into a grayscale image. Grayscale representation reduces computational complexity by removing color information while preserving important structural details. This step is widely used in medical image preprocessing with tools like OpenCV. It helps in highlighting lung patterns such as abnormalities and textures more clearly. Grayscale images improve the efficiency and accuracy of feature extraction in lung disease classification models.

    Fig. 4. Conversion of RGB Image to Grayscale for Lung Disease Detection

    This fig 5 presents a grayscale chest X-ray image alongside its histogram equalized version. Histogram equalization enhances the contrast of the image, making hidden features more visible. This technique is commonly applied using OpenCV during preprocessing. It improves the visibility of lung structures such as tissues and

    abnormalities. This enhancement step helps in better feature extraction and increases the performance of lung disease detection models.

    Fig. 5. Grayscale Image and Histogram Equalization for Lung Disease Analysis

    1. Histogram Equalization and Edge Detection

      To improve the diagnostic quality and feature extraction capabilities of the chest X-ray images, a two-stage pre- processing pipeline was implemented. As illustrated in Fig. 5, the raw digital radiographs underwent Contrast Limited Adaptive Histogram Equalization (CLAHE) followed by Canny edge detection.

    2. Histogram Equalization (HE)

      The initial phase utilizes Histogram Equalization to adjust the image intensity and enhance contrast. This process redistributes the probability density function of the grayscale levels, effectively broadening the dynamic range of the thoracic structures. This enhancement is critical for visualizing subtle density variations in the lung parenchyma and mediastinum that may be obscured in low-contrast original captures.

    3. Canny Edge Detection

      Subsequent to contrast enhancement, the Canny edge detection algorithm is applied to extract structural boundaries. This multi-stage process includes:

      • Noise Reduction: Application of a Gaussian filter to smooth the image.

      • Gradient Calculation: Identifying regions with high first-order derivatives.

      • Non-Maximum Suppression: Thinning the edges to single-pixel widths.

      • Hysteresis Thresholding: Utilizing dual thresholds to preserve strong edges while filtering out noise.

    Fig. 6. Histogram Equalization Image to Canny Edge Detection

  6. Texture-Based Feature Extraction

    1. Structual and Local Pattern Analysis

      Following the initial enhancement, the system utilizes a hybrid approach for feature extraction by combining

      structural information from edge detection with local texture patterns. This dual-representation strategy ensures that both the macroscopic skeletal structure and microscopic textural variances are captured for the classification model.

    2. Comparison of Canny Edge and Local Binary Patterns (LBP)

      As illustrated in Fig. 6, the transition from edge detection to texture analysis provides a comprehensive feature map:

      • Canny Edge Detection (Left): This stage focuses on the high-frequency structural components. It effectively isolates the skeletal boundaries and pleural linings, which are essential for identifying displacement or structural abnormalities in the thoracic cavity.

      • Local Binary Pattern (LBP) Image (Right): The LBP operator is applied to encode local texture information. By thresholding the neighborhood of each pixel against its center value and converting the result into a binary number, the LBP image highlights fine-grained surface variations. This is particularly useful for identifying subtle textural changes in the lung parenchyma that might indicate the presence of opacities or infiltrates.

        Fig. 7. Canny Edge Detection Image to LBP Image

    3. Multi-Class Diagnostic Evaluation

      The final classification stage categorized the processed radiographs into five clinically significant groups: Bacterial Pneumonia, Corona Virus Disease (COVID-19), Normal, Tuberculosis, and Viral Pneumonia. The resulting confusion matrix, depicted in Fig. 4, illustrates the model's high degree of sensitivity and specificity across all diagnostic categories.

    4. Quantitative Distribution

    The model exhibits a strong diagonal orientation, indicating a high rate of successful identification for each pathology.

    Fig. 8. Classification Performance Analysis

  7. ACKNOWLEDGMENT

The authors would like to thank the Department of Computer Science and Engineering, Anna University, for providing the necessary resources and support to carry out this research. The authors also acknowledge the developers of Python, OpenCV, NumPy, and Scikit-learn libraries, which were used in the implementation of the proposed system.

REFERENCES

  1. [1] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton, ImageNet classification with deep convolutional neural networks, Advances in Neural Information Processing Systems, vol. 25, pp. 10971105, 2012.

  2. [2] Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian

    Q. Weinberger, Densely connected convolutional networks, in Proc. IEEE Conf. Computer Vision and Pattern Recognition (CVPR), 2017, pp. 47004708.

  3. [3] Daniel S. Kermany, Michael Goldbaum, and Kang Zhang, Identifying medical diagnoses and treatable diseases by image- based deep learning, Cell, vol. 172, no. 5, pp. 11221131, 2018.

  4. [4] Joseph Redmon and Ali Farhadi, YOLOv3: An incremental improvement, arXiv:1804.02767, 2018.

  5. [5] Pranav Rajpurkar, Jeremy Irvin, Kaylie Zhu, et al., CheXNet: Radiologist-level pneumonia detection on chest X-rays with deep learning, arXiv:1711.05225, 2017.

  6. [6] World Health Organization, Global surveillance, prevention and control of chronic respiratory diseases, WHO Report, 2020.