International Peer-Reviewed Publisher
Serving Researchers Since 2012

Interpretable Ai For Accurate Lung Pathology Identification Across CT And X-Ray Modalities

DOI : https://doi.org/10.5281/zenodo.18848590
Download Full-Text PDF Cite this Publication

Text Only Version

Interpretable Ai For Accurate Lung Pathology Identification Across CT And X-Ray Modalities

Reshma Davis

Department of Computer Science and Engineering, Nehru College of Engineering and Research Centre, Thrissur 680588.

Jeeva R

MTech in Computer Science,

Nehru College of Engineering and Research Centre, Thrissur 680588

Mrs Betsy Joy

Assistant Professor

Department of Computer Science and Engineering, Nehru College of Engineering and Research Centre, Thrissur 680588

Anusha K

MTech in Cyber,

Nehru College of Engineering and Research Centre, Thrissur 680588.

Abstract – Early and accurate diagnosis of lung pathologies is essential to prevent deaths and enhance diagnostic processes in the clinical environment. In this paper, a proposal is made to have an interpretable deep learning framework in the automated detection of lung abnormalities in both the chest CT and X-rays modalities. The system also includes state-of-the-art preprocessing methods, as well as, lightweight convolutional neural networks models to conduct binary (Normal vs. Abnormal) and multi-class classification of diseases, including, COVID-19, Tuberculosis, and Lung Cancer. In order to make clinical transparency, the framework incorporates explainable AI methods, namely Grad-CAM, to create heatmaps indicating areas that have a major impact on the decisions made by the model. It is a web application made of Django, which allows real- time uploading of images, prediction generation, and visualization of interpretability outputs. The system has a high classification accuracy and localization of pathological features as shown in experimental analysis, which proves the system is a worthy decision-support tool in the hands of radiologists. The suggested interpretable AI design is expected to increase the confidence in the diagnoses, facilitate the early detection, and also lead to creating reliable medical imaging solutions.

Keywords – Deep Learning, Lung Pathology, CT, X-ray, CNN, Transfer Learning, Explainable AI, Grad-CAM, Classification, Medical Imaging.

  1. INTRODUCTION

    Tuberculosis, COVID-19, and Lung Cancer are lung diseases that continue to play a significant role in the number of morbidities and deaths in the world. X-ray and CT-scans are essential medical imaging techniques that can be used to detect and monitor such disorders at an early stage. These images however, are subject to manual interpretation and, therefore, demand the services of trained radiologists and are subject to subjectivity, exhaustion and inter-observer error. As the digital medical datasets have become more available and computational power has increased, deep learning has become a formidable tool in the medical analysis of images. CNNs have shown excellent success in feature extraction and classification of images in numerous areas of medical imaging. Moreover, the increase in explainable AI (XAI) methods creates the possibilities to improve the levels of transparency and trust in automated diagnostic systems. With the

    combination of deep learning and medical imaging and interpretability models, the potential of enhancing the efficiency, accuracy, and clinical decision-making is high. Although the system of AI-driven medical imaging has made a great progress, there are still a number of limitations that exist in the available lung disease classification systems. The existing models are mostly trained on one of the imaging modalities (CT scans or X-rays), which limits their broad applicability in a clinical setting. Besides, most frameworks are based on binary classification: Normal vs. Abnormal and do not suggest further analysis of particular diseases like COVID-19, Tuberculosis, or Lung Cancer. The other important gap is interpretability, as deep learning models can be highly accurate, but they are considered black boxes that do not provide much insight into the logic that underlies predictions. This transparency void diminishes the clinical trust and makes it difficult to deploy in the field. In addition, not many studies incorporate their models in tools that are easy to use by radiologists. Therefore, it is undoubtedly necessary to have a cross-modality, multi-class, explainable, and deployable AI framework that can close these gaps and help face real-time diagnostics in hospitals and screening centers. The interest behind this study is due to the increasing demand of fast, trustworthy, and interpretable diagnostics in the healthcare industry. The COVID-19 pandemic has increased the need to improve medical imaging demand, and it was reported that manual radiological assessment has weaknesses and needs automated support systems.

    Fig 1. CNN Architecture

    The detection of lung abnormalities early leads to much better treatment results and lowered the hospitalization time and allowed allocating medical resources more effectively. In low- resource and rural environments with radiologists as a limited resource, an intelligent diagnostic assistant will be life-saving. Also, medical workers are becoming more and more interested in AI systems that are not only precise but explainable to facilitate safe decision-making. The visualization of disease- relevant areas with the help of heatmaps helps clinicians build confidence in the outputs produced by AI. These are important requirements that can be met by creating a strong, cross- modality lung pathology identification system that incorporates interpretability and runs in real time, which has become a powerful incentive to undertake the current research. An interpretable AI based on the detection of lung pathology has several issues. Resolution, quality, and accuracy of annotation of medical image datasets can vary making model training and generalization more difficult. Balanced datasets on several diseases (COVID-19, Tuberculosis, and Lung Cancer) are challenging to collect because of the lack of data and privacy. Also, cross-modality model design is more complicated because CT and X-ray modalities have different visual features. The other issue with deep learning models is their tendency to overfit in cases of small medical datasets. The other significant issue is to be able to ensure model interpretability; when using Grad-CAM to produce heatmaps, they need to indicate significant clinical areas, as opposed to random activations. Moreover, when deploying the trained model into the real-time web application, it is necessary to optimize it in terms of speed, compatibility, and reliability. Lastly, acceptance in the clinical setting requires that the validation is strict, the determinability of the model in a wide range of imaging conditions, and the high confidence of predictive and explanatory power of the model.

    Fig 2. Chest CT Scan

    Fig 3. Chest X-ray

    The proposed project is aimed at creating a very high-quality and understandable AI framework to detect lung abnormalities using a CT and X-ray of the chest. The area of scope also encompasses the development of an entire pipeline that tackles image preprocessing, deep learning-based classification, as well as explanation with the help of Grad-CAM visualization. The system also has a binary classification (Normal vs. Abnormal) and multi-class diagnosis of the COVID-19, Tuberculosis, and Lung Cancer. It is executed with the help of TensorFlow and PyTorch, which makes it flexible and performance-oriented. The project also has deployment as a Django-based web application to support real-time uploading, prediction, and heatmap visualization to help users with real world use. It is restricted to classification and interpretability: it does nt involve treatment recommendation, segmentation or 3D volumetric CT reconstruction. The project will develop a rapid, dependable, and clinically understandable diagnostic helper to supplement radiologists and enhance the detection of diseases at the inception.

  2. LITERATURE SURVEY

    The Deep learning is an established method in the process of automated detection of lung disease based on chest X-ray and CT images. Some of the previous studies have tested the transfer learning, lightweight CNN designs, augmented preprocessing, and explainable AI to enhance the accuracy and interpretability of the diagnostic process. The use of transfer learning-based CNNs has been demonstrated to work well in detecting tuberculosis based on the chest x-ray as was demonstrated in [1], which presented an automated TB detection method that was able to extract discriminative lung patterns. In the same light, an intermediate deep learning framework that integrates convolutional networks with gated recurrent units was introduced in [2], which allows better detection of the presence of abnormalities in the lungs due to the increased representations of both time and space features.

    Detection of COVID-19 has also been widely researched based on CT and X-ray images. The authors in [3] presented a model of transfer learning complemented with stationary wavelet decomposition to achieve a better result in the extraction of texture-level features by using CT-based COVID-19 analysis. Additional advancements in lightweight and computationally efficient architectures were also shown in [4], that proposed a multi-disease detector on COVID-19, pneumonia, and tuberculosis based on optimized deep learning methods. In [5], a more ultralight CNN model was introduced that demonstrated a high accuracy, low cost to run, and efficient detection of infectious pulmonary abnormality.

    In the recent medical AI research, interpretability and explainability have become a popular topic. The presented model in [6] used a more advanced version of the DenseNet architecture with explicable mechanisms, which allows visualizing areas of interest in a decision-making process of the lungs in detail. This direction aids the clinical need of interpretable AI models in the clinical diagnostic setting. In [7], deep learning and decision-support systems have been used to detect multiple diseases, especially lung cancer, and have shown better capability to identify malignant features in

    different X-ray data sets. A more comprehensive multi- classification model was outlined in [8], in which a CNN- based neural network was trained to distinguish COVID-19, lung cancer, pneumothorax, tuberculosis, and pneumonia.

    The efficacy of CNN-based methods in diagnosis of chest infection has been also studied in [9] and has proven that deep learning is capable of separating prevalent thoracic infections. Strong classification of COVID-19, pneumonia and tuberculosis with the help of transfer learning based architectures was also shown in [10] with a focus on stable performance between different image sources. The idea of explainable lung disease was investigated in [11], in which visualization methods were combined with deep learning to promote model transparency to various types of abnormalities. This is in line with the necessity of interpretable AI in vital medical environments.

    In [12], state-of-the-art methods that combine segmentation, visualization, and deep learning to identify tuberculosis were introduced, which shows the importance of lung-region segmentation as a method to enhance classification accuracy. The idea of multi-modal investigation of COVID-19 pneumonia based on X-ray and CT images was considered in [13], revealing that a combination of multiple imaging modalities increases diagnostic strength. The use of transfer learning to detect COVID-19 in X-ray images was also reported in [14], and it was demonstrated that properly trained CNN networks can be used to generate high generalization to unknown data. Lastly, [15] provided a comprehensive assessment of deep CNNs, which are based on transfer learning, and developed within the context of multiple lung pathologies (COVID-19, pneumonia, tuberculosis, and lung cancer) and highlights the promise of unified diagnostic systems.

    On the whole, the existing body of literature proves that models based on deep learning will be effective to classify various pulmonary pathologies in both CT and X-ray images. Nevertheless, the vast majority of research is concerned with performance and not interpretability and little research has been done to combine real-time deployment and realistic user interfaces. The current literature has shown good performance in classification but usually does not provide clear explanation of prediction and multi-modal combination. These weaknesses lead to the creation of an explainable, precise, and clinically usable system that will assist radiologists in making explainable decisions in both imaging modalities.

  3. PROBLEM STATEMENT

    COVID-19, Tuberculosis, and Lung Cancer remain the key diseases that have caused a considerable number of deaths in the world, and the diagnosis of these diseases early in the case depends largely on the skill of the experts in interpreting the chest CT and X-ray films. Radiological assessment however is time consuming, subjective and may be constrained by availability of trained experts particularly in resource limited set ups. Current AI-based diagnostic systems are mostly single-modality image based, do not have a multi-class mode of operation, and are black-box models that do not have easy

    interpretability. The lack of open and credible decision support minimizes clinical confidence and limits the implementation in reality. Thus, a single, precise, and explainable AI framework to analyze both CT and X-ray images and categorize various lung diseases with additional visual support of its predictions is required. The issue that has been covered in this work is to create such an interpretable deep learning system that would boost diagnostic confidence and aid clinicians in the early detection of lung pathologies.

  4. EXISTING SYSTEM

    In the previous methods of detecting the abnormality in the lungs, the diagnosis of the problem is highly reliant on the manual review of the chest X-rays and CT scans by radiologists. This is a lengthy process that needs a lot of technical skills and is also likely to be subject to variation because it is subject to human interpretation. Despite the introduction of a number of AI-based methods, the majority of them are limited to the idea of binary classification, determining whether an image is Normal or Abnormal. These systems do not tend to categorize various illness like COVID- 19, Tuberculosis and Lung Cancer. Moreover, existing models tend to be black-box networks that do not explain in images to justify their forecasts, having limited clinical confidence. Most solutions available also lack real time deployment as well as integration with hospital processes. The limitations of the existing systems render the systems to be inadequate in giving accurate, explainable and multi-class lung abnormality detection which would be required in practical application in the clinic.

  5. METHODOLOGY

    Fig 4. Working Flow

    1. Image Preprocessing

      The original CT or X-ray image is initially made quality and pre-processed to be used in the model inference. Images are resized, the pixel values are normalized, the noise is removed, and the contrast is enhanced with the help of Python libraries OpenCV and NumPy. Further details, including histogram equalization and augmentation of data, are implemented to increase the strength of the model to changes in light, orientation, and quality of scans. The preprocessed images are then made in standardized forms as tensors that can be used in deep learning models.

    2. Processing with Deep Learning Model.

      Once the image has been pre-processed, it is subjected to a deep learning architecture, which is a Convolutional Neural Networks (CNNs) improved by transfer learning. Two levels of classification are conducted on the model. The system in the initial step forecasts either it is a Normal image or an Abnormal image. The second stage classifies in multi-class to detect COVID-19, Tuberculosis, or Lung Cancer, in case of abnormality. Neural networks like the TensorFlow and PyTorch are programmed to run, validate and optimize model weights based on large annotated datasets. The trained model provides probability scores of each of the classes.

    3. Explainability Module

      The system will use an explainable AI module based on Grad- CAM and make the system transparent and gain clinical trust. This method underlines important areas of the image that are considered by the model to produce a heatmap that superimposes on the original X-ray or CT scan. The explainability output will enable radiologists to graphically examine why a certain prediction was implemented so that the model is targeting medically significant regions like lesions, nodules, or opacities.

    4. Web Application Deployment

      The last step will be to incorporate the whole pipeline into a web application based on Django and provide real-time diagnostics support. Users are allowed to submit an image in the form of JPG or PNG, and the system does the preprocessing, inference, and heatmap automatically. The web interface shows the classification probabilities (e.g., Normal 10%), COVID-19 19.5% Tuberculosis 85% with the relevant Grad-CAM heatmap. The system can be used with clinical environments, screening facilities, and telemedicine due to the provision of instant feedback through the deployment of the system.

      Fig 5. Proposed Model Flow

      1. RESULT AND DISCUSSION

        The production of the proposed interpretable AI system in the identification of lung pathology includes the use of sophisticated deep learning, systematic pre-processing, and a simple web-based deployment line. It starts with the preparation of a multifarious dataset comprising of chest CT and X-ray images of the leading categories as normal, COVID-19, Tuberculosis, and Lung Cancer.

  6. PROPOSED SYSTEM

The suggested system offers a fast, precise, and understandable AI-based system of automated lung abnormality detection of chest X-ray and CT scan images. It uses deep learning models, mainly Convolutional Neural Networks (CNNs) with transfer learning, to both classify normally and abnormally and to classify diseases (COVID-19, Tuberculosis, and Lung Cancer, among others). It uses Python packages such as NumPy, Pandas, and OpenCV to perform the preprocessing of the data and image optimization, and it uses the TensorFlow and PyTorch to perform the training and optimization of the model. To guarantee transparency in the decision making process, the framework adopts explicable AI methods like Grad-CAM to produce heatmaps that show the areas that are affecting the model prediction. The whole pipeline is implemented as a Django-based web application which also allows uploading of real-time images in formats (JPG or PNG) and delivers the classification prediction and probability scores and visual interpretations. The proposed system would help radiologists to minimize diagnostic errors and enhance clinical decision-making through the combination of performance, interpretability, and easy deployment.

Fig 6. Account Creation

Every image is subjected to requisite preprocessing procedures of resizing, contrast normalization, noise minimization and data augmentation to achieve regular quality and further model resilience. The system uses lightweight convolutional neural network (CNN) architectures to be optimised by transfer learning and therefore permits efficient training whilst preserving high accuracy in both modalities of imaging.

Fig 7. Login Page

The binary model is used to distinguish between the cases of Normality and Abnormality, whereas the multi-class classifier is used to distinguish among the three diseases of interest. Grad-CAM is used to provide explainability, where visualisation of discriminative lung regions with direct influence on model predictions can be seen. It uses a deployment of a web application written in Django, which allows clinicians to upload images, get predictions, see probability scores, and read explanations of heatmap in real time. Such an implementation guarantees a computationally effective clinically pertinent system that can be applied in a variety of diagnostic settings.

There was some confusion between Tuberculosis and Lung Cancer because of a similar visual pattern but then the reliability of the model was high. The probability-based outputs offered a very detailed view of the classification confidence enhancing the interpretability of the borderline cases. Grad-CAM images confirmed that the model paid attention to clinically significant areas of the lungs, including ground-glass opacities in COVID-19 or tumor in lung cancer, which contributes to the transparency of decision-making.

Fig 8. Home Page

The experimental findings show that the suggested system is strong in terms of binary or multi-class classification in the identification of lung pathology. The binary classifier was very accurate with a good separation of the normal and Abnormal images with few false negative which is very important in clinical screening where false negative may be very damaging. The system was also consistent even with changes in image quality, differences in modality, or patient demographics. In the case of multi-class prediction, the model was able to correctly distinguish between COVID-19, Tuberculosis and Lung Cancer with high accuracy in terms of precision, recall and F1-score.

Fig 10. Result 1

The deployed Django web application had a low degree of response time and served efficiently by uploading CT or X-ray images and providing results within a few seconds. These findings confirm the ability of the system to provide radiologists and clinicians with accurate, interpretable and real time diagnostic support.

Fig 9. Uploading Page

Fig 11. Result 2

The discussion has provided strength, reliability and clinical value of the proposed interpretable AI system towards the detection of lung disease. The two-step classification method with the introduction of a binary screening and multi-class diagnosis can largely decrease the ambiguity of the diagnosis and guarantee the correct recognition of disease-specific patterns.

Future developments can be made by incorporating additional heterogeneous clinical data, more disease coverage, noise- removal techniques and federated learning to conduct privacy- preserving training. Altogether, the system has a high potential as a reliable clinical decision aid with regard to the timely and precise detection of lung pathology.

Fig 12. Visualization

In comparison to traditional models, the lightweight CNNs with transfer learning perform better in terms of generalization and lower computational load, which makes the system applicable both in the hospital setting and in remote healthcare. One of the essential innovations is the implementation of explainable AI through Grad-CAM that gives visual explanation of each prediction. This interpretability is a direct response to the black-box nature of deep learning systems, which enhances the level of trust clinicians have in it and promotes its use in the real world.

Fig 13. Prediction Probability Chart

The web-based deployment is more accessible and usable, allowing quick diagnostic support by providing predictions immediately and heatmap visualization. There are however limitations to the system such as the reliance on publicly available datasets and the possibility of misclassifications of visually similar diseases.

Fig 14. AI Interpretation

Fig 15. CT Scan Result

    1. CONCLUSION

The suggested interpretable AI system is efficient at automating the process of detecting abnormalities in the lungs using lightweight CNN models, powerful preprocessing, and Grad-CAM explainability on both CT and X-ray modalities. The system is very effective in diagnosing the normal, COVID-19, Tuberculosis, and Lung Cancer cases and also provides clear visual reasons that increase clinical confidence. It can be deployed on Django and provides real-time image upload, prediction display, and interpretability visualization, which makes it appropriate to use in a real-life diagnostic setting. In the future, the framework can be generalized using larger multi-institutional datasets to enhance generalization and reliability. The clinical applicability will be broadened further by incorporating other lung diseases like pneumonia, COPD and fibrosis. Adding more sophisticated architectures such as Vision Transformer or hybrid CNN-ViT can be useful in improving performance on complicated cases. The future work can further investigate federated learning to train on privacy and implement the system in the hospital PACS/RIS processes which can be smoothly extended to integrate the system into any real-world clinical environment.

REFERENCES

[1]. Showkatian, E., et al. Deep learning-based automatic detection of tuberculosis from chest radiographs using transfer learning. PMC Articles (2022).

[2]. Islam, M.K., et al. Enhancing lung abnormalities detection and

classification using DCNN-GRU. ScienceDirect (2023).

[3]. Ahuja, S., et al. Deep transfer learning-based automated detection of COVID-19 using CT scan images with stationary wavelet decomposition. PMC (2020).

[4]. Kabir, M.M., et al. Detection of COVID-19, pneumonia, and tuberculosis from chest X-ray using a lightweight deep learning- based approach. Heliyon (2024).

[5]. Alqaissi, E., et al. A novel and ultralight convolutional neural network model to detect pulmonary abnormalities in the lung from infectious diseases using X-ray. Digital Health (2025).

[6]. Mahamud, E., et al. An explainable artificial intelligence model for multiple lung diseases from X-ray images using an enhanced DenseNet201 model. ScienceDirect (2024).

[7]. Meeradevi, T., Sasikala, S., Murali, L., Manikandan, N., & Ramaswamy, K. Lung cancer detection with machine learning classifiers with multi-attribute decision-making system and deep learning model. Scientific Reports (2025).

[8]. Malik, H., et al. CDC_Net: multi-classification convolutional neural network for detecting COVID-19, lung cancer, pneumothorax, tuberculosis, and pneumonia from chest X-ray images. Springer Journal of Multimedia Tools and Applications (2023).

[9]. A CNN-Based Chest Infection Diagnostic Model (2023).

Wiley Journal (2023).

[10].Mamalakis, M., Swift, A. J., Vorselaars, B., Ray, S., Weeks, S., Ding, W., Clayton, R. H., Mackenzie, L. S., & Banerjee, A. DenResCov-19: A deep transfer learning network for robust automatic classification of COVID-19, pneumonia, and tuberculosis from X-rays. arXiv preprint (2021).

[11].Ifty, T. T., Shafin, S. A., Shahriar, S. M., & Towhid, T. Explainable Lung Disease Classification from Chest X-Ray Images Utilizing Deep Learning and XAI. arXiv preprint (2024).

[12].Rahman, T., Khandakar, A., Kadir, M. A., Islam, K. R., Islam,

K. F., Mazhar, R., Hamid, T., Islam, M. T., Mahbub, Z. B., Ayari, M. A., & Chowdhury, M. E. H. Reliable Tuberculosis Detection using Chest X-ray with Deep Learning, Segmentation and Visualization. arXiv preprint (2020).

[13].Maghdid, H. S., Asaad, A. T., Ghafoor, K. Z., Sadiq, A. S., & Khan, M. K. Diagnosing COVID-19 Pneumonia from X-Ray and CT Images using Deep Learning and Transfer Learning Algorithms. arXiv preprint (2020).

[14].Apostolopoulos, I. D., & Mpesiana, T. A. COVID-19: automatic detection from X-ray images utilizing transfer learning with convolutional neural networks. Physics in Engineering and Science in Medicine (2020).

[15].Pal, V., et al. Leveraging Transfer Learning with Deep Convolutional Neural Networks for detection of lung diseases including COVID-19, pneumonia, tuberculosis and lung cancer: A review. Open Bioinformatics Journal (2024).