DOI : 10.17577/IJERTCONV14IS040054- Open Access

- Authors : Ketan Singh, Ankit, Smita Singh, Anmol Saxena, Jitendra
- Paper ID : IJERTCONV14IS040054
- Volume & Issue : Volume 14, Issue 04, ICTEM 2.0 (2026)
- Published (First Online) : 24-05-2026
- ISSN (Online) : 2278-0181
- Publisher Name : IJERT
- License:
This work is licensed under a Creative Commons Attribution 4.0 International License
Pneumonia and Tuberculosis DetectionUsing Deep Learning
1Ketan singh, 2Ankit, 3Smita Singh, 4Anmol Saxena, 5Jitendra 1,2,3,4,5Dr. A.P.J Abdul Kalam Technical University (AKTU), India
Ketan9949@gmail.com, Ankitmasih505@gmail.com, smitasinghdcep@gmail.com, saxenaanmol2003@gmail.com, jitendra.1ril@gmail.com
Abstract
Pneumonia and Tuberculosis (TB) are among the most severe respiratory diseases affecting millions of people globally, particularly in developing and densely populated regions. Both diseases primarily impact the lungs and can become life-threatening if not diagnosed and treated at an early stage. Chest X-ray imaging is one of the most widely used diagnostic tools for detecting these diseases due to its affordability and availability. However, traditional diagnosis relies heavily on manual interpretation by radiologists, which is time-consuming, subjective, and prone to human error, especially in regions with limited medical expertise.
This research paper presents a deep learningbased automated system for the detection and classification of Pneumonia and Tuberculosis using chest X-ray images. The proposed approach employs Convolutional Neural Networks (CNNs) combined with transfer learning models such as VGG16, ResNet, and DenseNet to classify X-ray images into three categories: Normal, Pneumonia, and Tuberculosis. Image preprocessing and data augmentation techniques are applied to improve model generalization and performance. The system is evaluated using standard metrics such as accuracy, precision, recall, F1-score, and confusion matrix analysis. Additionally, Grad-CAM visualization is used to enhance model explainability by highlighting important regions in X-ray images that influence predictions. The proposed system demonstrates high accuracy and reliability, offering a cost-effective and efficient decision-support tool for healthcare professionals, especially in resource-limited and rural healthcare environments.
Keywords Deep Learning, Pneumonia Detection, Tuberculosis Detection, Chest X-ray, CNN, Transfer Learning, Medical Imaging
-
INTRODUCTION
Respiratory diseases continue to pose significant challenges to global healthcare systems. Pneumonia and Tuberculosis (TB) are two of the most common and deadly lung-related diseases, particularly affecting children, elderly individuals, and immunocompromised patients. Pneumonia causes inflammation of the lung alveoli, leading to fluid or pus accumulation that restricts oxygen exchange. Tuberculosis, caused by Mycobacterium tuberculosis, is a contagious bacterial infection that spreads through airborne droplets and remains a major public health issue in many developing countries.
Early and accurate diagnosis plays a crucial role in reducing mortality rates and preventing disease transmission. Chest X-rays are widely used as the primary diagnostic tool for both Pneumonia and TB due to their low cost and rapid availability. However, manual examination of X-ray images requires trained radiologists and is often limited by subjectivity, fatigue, and uneven access to expertise. In rural and underdeveloped regions, the shortage of skilled professionals further worsens diagnostic delays.
The rapid growth of Artificial Intelligence (AI) and Deep Learning has opened new possibilities for automated medical image analysis. Convolutional Neural Networks (CNNs) have shown exceptional performance in extracting complex visual features from images and have been successfully applied in disease detection, classification, and segmentation tasks. By leveraging deep learning techniques, it is possible to develop automated systems that assist radiologists by providing fast, accurate, and consistent diagnostic support.
This research focuses on designing a deep learningbased system capable of automatically detecting Pneumonia and Tuberculosis from chest X-ray images, thereby reducing diagnostic errors, improving efficiency, and enhancing accessibility to quality healthcare.
-
RELATED WORK
Numerous studies have explored the application of deep learning techniques in medical imaging, particularly for chest X-ray analysis. Early approaches relied on traditional image processing and handcrafted feature extraction methods, which showed limited performance due to their inability to capture complex patterns in medical images.
With the emergence of CNNs, researchers began using deep learning architectures for Pneumonia detection. Several studies reported accuracy levels exceeding 90% using CNN- based binary classification models to distinguish Pneumonia from normal X-ray images. However, these models often failed to generalize well across different datasets.
For Tuberculosis detection, various deep learning models have been proposed using chest X- ray datasets such as the NIH and Montgomery TB datasets. Transfer learning approaches using pre-trained networks like VGG, ResNet, and DenseNet have significantly improved performance by leveraging learned features from large-scale image datasets.
Despite promising results, many existing systems focus on detecting only a single disease and lack multi-class classification capabilities. Furthermore, explainability remains a challenge, as medical professionals require transparent AI systems to trust automated predictions. This research addresses these gaps by proposing a multi-class classification framework with explainable deep learning models.
-
PROPOSED METHODOLOGY
-
Dataset Collection
The proposed system uses publicly available chest X-ray datasets obtained from reliable sources such as Kaggle and the NIH database. The dataset includes three categories: Normal, Pneumonia, and Tuberculosis. The collected data is divided into training, validation, and testing sets to ensure unbiased performance evaluation.
-
Data Preprocessing
Preprocessing plays a critical role in improving model accuracy. All X-ray images are resized to a fixed resolution and normalized to standardize pixel values. Data augmentation techniques such as rotation, flipping, zooming, and contrast adjustment are applied to increase dataset diversity and reduce overfitting. Class imbalance is handled by ensuring an equal representation of each category.
-
Model Architecture
The system employs CNN-based transfer learning models including VGG16, ResNet50, and DenseNet121. Pre-trained weights from ImageNet are used to initialize the models, enabling efficient feature extraction. Custom fully connected layers are added for multi-class classification. The models use categorical cross-entropy as the loss function and optimizers such as Adam and SGD for training.
-
Training and Evaluation
The models are trained on the prepared dataset and evaluated using standard performance metrics including accuracy, precision, recall, F1-score, and confusion matrix analysis. These metrics provide a comprehensive understanding of classification performance across all classes.
-
Explainability Using Grad-CAM
To enhance transparency, Grad-CAM (Gradient-weighted Class Activation Mapping) is applied to visualize important regions in X-ray images that influence the models predictions. This helps medical professionals understand and trust the systems decisions.
-
-
RESULTS AND DISCUSSION
Experimental results demonstrate that the proposed deep learning models achieve high classification accuracy, exceeding 90% across all classes. DenseNet-based models show superior performance due to efficient feature reuse and deeper architecture. Confusion matrix analysis indicates strong differentiation between Pneumonia and Tuberculosis cases.
Grad-CAM visualiztions confirm that the model focuses on clinically relevant lung regions, validating its reliability. The system also exhibits robust performance across varying image qualities and lighting conditions.
-
CHEST X-RAY EXAMPLES (NORMAL, PNEUMONIA, TUBERCULOSIS)
Chest X-ray imaging plays a crucial role in the diagnosis of respiratory diseases such as Pneumonia and Tuberculosis. In this study, three distinct categories of chest X-ray images are considered: Normal, Pneumonia-infected, and Tuberculosis-infected images. Each category exhibits unique visual characteristics that are leveraged by deep learning models for accurate classification.
Normal chest X-ray images typically show clear lung fields with uniform radiolucency, well- defined rib structures, and no visible opacities or abnormal patterns. The lung regions appear symmetrical, and there are no signs of fluid accumulation, consolidation, or lesions. These images serve as the baseline reference for healthy lungs.
Pneumonia-affected X-ray images display visible abnormalities such as patchy or diffuse opacities within the lung regions. These opacities occur due to inflammation of the alveoli, which become filled with fluid or pus. Depending on the severity, Pneumonia may appear as localized consolidation in one lung or widespread infiltrates across both lungs. These visual cues are often subtle and may overlap with other lung conditions, making automated detection highly beneficial.
Tuberculosis X-ray images commonly exhibit irregular patterns such as nodules, cavities, fibrotic changes, or consolidation, especially in the upper lobes of the lungs. In active TB cases, cavities formed by tissue destruction are frequently observed. Latent TB may show less pronounced abnormalities, which increases the complexity of accurate diagnosis. The visual similarity between TB and Pneumonia in certain cases highlights the importance of deep learning models capable of learning fine-grained features.
By training CNN models on diverse chest X-ray examples across these three categories, the system learns to distinguish between healthy lungs and disease-specific patterns, significantly improving diagnostic accuracy.
-
CNN ARCHITECTURE EXAMPLE
Convolutional Neural Networks (CNNs) form the backbone of the proposed Pneumonia and Tuberculosis detection system. CNNs are specifically designed to process visual data by automatically learning hierarchical features from raw images. The architecture typically consists of multiple convolutional layers, pooling layers, and fully connected layers.
In the initial convolutional layers, low-level features such as edges, textures, and shapes are extracted from the chest X-ray images. As the network depth increases, higher-level features such as lung opacity patterns, lesion boundaries, and structural irregularities are learned. Pooling layers are used to reduce spatial dimensions while retaining essential information, thereby improving computational efficiency and reducing overfitting.
The proposed system utilizes transfer learning models such as VGG16, ResNet50, and DenseNet121. These architectures are pre-trained on large-scale datasets like ImageNet and have proven effective in medical image analysis. By fine-tuning these networks with chest X- ray data, the model adapts learned visual features to the medical domain.
Custom fully connected layers are added at the end of the architecture to perform multi-class classification into Normal, Pneumonia, and Tuberculosis categories. The use of activation functions such as ReLU and Softmax ensures non-linearity and probabilistic output distribution. This CNN-based architecture enables efficient feature extraction and robust classification performance.
-
CONFUSION MATRIX AND ACCURACY GRAPH
Performance evaluation is a critical aspect of any medical diagnostic system. In this study, the performance of the deep learning models is assessed using a confusion matrix and accuracy graphs to provide a detailed analysis of classification results.
The confusion matrix represents the number of correctly and incorrectly classified samples for each class. It provides insights into true positives, true negatives, false positives, and false negatives for Normal, Pneumonia, and Tuberculosis classes. A well-performing model exhibits high values along the diagonal of the confusion matrix, indicating accurate predictions.
Analysis of the confusion matrix reveals that the proposed system achieves strong differentiation between Normal and diseased cases. Minor misclassifications are observed between Pneumonia and Tuberculosis, which is expected due to overlapping radiographic features. However, the overall classification accuracy remains high, exceeding 90% across all classes.
Accuracy graphs plotted over training and validation epochs demonstrate consistent improvement in model performance. The convergence of training and validation accuracy curves indicates effective learning and minimal overfitting. Loss curves further confirm stable training behavior, validating the robustness of the proposed approach.
-
GRAD-CAM HEATMAP EXAMPLE
Explainability is essential in medical AI systems to ensure trust and acceptance by healthcare professionals. To address this requirement, Gradient-weighted Class Activation Mapping (Grad-CAM) is employed to visualize the decision-making process of the CNN models.
Grad-CAM generates heatmaps that highlight the regions of chest X-ray images that contribute most significantly to the models predictions. In Pneumonia cases, Grad-CAM visualizations emphasize areas of lung consolidation and opacities. For Tuberculosis cases, the heatmaps focus on cavities, nodular patterns, and upper lung regions commonly associated with TB infection.
These visual explanations help radiologists understand why the model classified an image as Pneumonia or Tuberculosis. The alignment of highlighted regions with clinically relevant lung abnormalities validates the reliability of the model. Grad-CAM not only improves transparency but also increases confidence in deploying AI-based diagnostic tools in real clinical settings.
-
APPLICATIONS OF PNEUMONIA AND TUBERCULOSIS DETECTION AI
The proposed deep learningbased detection system has wide-ranging applications across healthcare and medical research domains.
One of the primary applications is early disease diagnosis in hospitals and diagnostic centers. Automated X-ray analysis can significantly reduce diagnosis time, enabling faster treatment initiation and improving patient outcomes.
In rural and resource-limited regions, where access to trained radiologists is limited, the system can act as a decision-support tool for healthcare workers. By providing reliable predictions, the system enhances diagnostic accessibility and reduces healthcare disparities.
The system is also highly suitable for telemedicine platforms, allowing remote diagnosis and consultation. Patients in remote areas can upload X-ray images and receive AI-assisted diagnostic feedback, minimizing the need for physical travel.
Additionally, the proposed solution can be integrated into public health screening programs, particularly in TB-prevalent regions. Large-scale screening using automated AI systems can help identify cases early and control disease spread.
From a research perspective, the system supports continuous learning and improvement by incorporating new datasets and expanding to detect additional lung diseases such as COVID- 19, lung cancer, and fibrosis.
-
CONCLUSION
This research presents a deep learningbased automated system for detecting Pneumonia and Tuberculosis using chest X-ray images. By leveraging CNNs, transfer learning, and explainable AI techniques, the proposed system provides accurate, fast, and reliable diagnostic suport. The solution reduces dependency on manual interpretation, improves diagnostic accessibility, and supports healthcare professionals in early disease detection. Future work will focus on integrating real-time clinical data, expanding datasets, and deploying the system as a web or mobile application for real-world healthcare use.
REFERENCES
-
Rajpurkar, P., Irvin, J., Zhu, K., et al.
CheXNet: Radiologist-Level Pneumonia Detection on Chest X-Rays with Deep Learning.
Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
-
Lakhani, P., & Sundaram, B.
Deep Learning at Chest Radiography: Automated Classification of Pulmonary Tuberculosis.
Radiology, Vol. 284, No. 2, 2017, pp. 574582.
-
Hwang, S., Kim, H. E., Jeong, J., & Kim, H. J.
A Novel Approach for Tuberculosis Screening Based on Deep Convolutional Neural Networks.
IEEE Transactions on Medical Imaging, 2016.
-
Simonyan, K., & Zisserman, A.
Very Deep Convolutional Networks for Large-Scale Image Recognition.
International Conference on Learning Representations (ICLR), 2015.
-
He, K., Zhang, X., Ren, S., & Sun, J.
Deep Residual Learning for Image Recognition.
Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
-
Selvaraju, R. R., Cogswell, M., Das, A., et al.
Grad-CAM: Visual Explanations from Deep Networks via Gradient-Based Localization.
IEEE International Conference on Computer Vision (ICCV), 2017.
-
Shin, H. C., Roth, H. R., Gao, M., et al.
Deep Convolutional Neural Networks for Computer-Aided Detection: CNN Architectures, Dataset Characteristics and Transfer Learning.
IEEE Transactions on Medical Imaging, 2016.
-
Kermany, D. S., Goldbaum, M., Cai, W., et al.
Identifying Medical Diagnoses and Treatable Diseases by Image-Based Deep Learning.
Cell, Vol. 172, Issue 5, 2018.
-
World Health Organization (WHO).
Global Tuberculosis Report.
World Health Organization, Geneva, Switzerland.
-
Esteva, A., Kuprel, B., Novoa, R. A., et al.
-
Dermatologist-level Classification of Skin Cancer with Deep Neural Networks.
Nature, 2017.
