close
Skip to main content
Log in

LDD-VTS: an AI-based framework for lung disease diagnosis using vision transformers and SHAP

  • Research
  • Published:
Health Information Science and Systems Aims and scope Submit manuscript

Abstract

Lung diseases, particularly lung cancer, pose significant global health challenges, leading to high morbidity and mortality rates. Early diagnosis is crucial for improving patient outcomes, yet traditional diagnostic methods often fall short in accuracy and timeliness. This study proposes a novel framework, named LDD-VTS, that uses Vision Transformers (ViTs) and SHAP (SHapley Additive exPlanations) to enhance the diagnosis and classification of lung diseases, including lung cancer, viral pneumonia, and lung opacity. The framework processes medical imaging data, such as chest X-rays and CT scans, to accurately identify abnormalities across multiple classes. The experimental results demonstrate that the P16-224-In21K model configuration achieves an impressive accuracy of 98.43% on the IQ-OTH/NCCD lung cancer dataset, alongside high precision and recall. Additionally, the integration of SHAP enhances interpretability, providing healthcare professionals with transparent insights into the model’s decision-making process. By identifying key image regions that influence predictions, the framework promotes trust and facilitates informed clinical decision-making. This study highlights the potential of AI-driven approaches to transform lung disease diagnostics, paving the way for improved early detection and personalized treatment strategies in clinical practice.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Subscribe and save

Springer+
from $39.99 /Month
  • Starting from 10 chapters or articles per month
  • Access and download chapters and articles from more than 300k books and 2,500 journals
  • Cancel anytime
View plans

Buy Now

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7

Similar content being viewed by others

Data availability

Data information is provided in the Materials Section.

Abbreviations

M :

Number of features extracted from the input image (e.g., patches or regions).

N :

Number of image blocks or patches processed by the Vision Transformer (ViT).

P :

Patch size used in the ViT model, representing the dimensions of each image patch (e.g., \(16 \times 16\) pixels).

D :

Dimensionality of the embedding space in the ViT model.

H :

Height of the input image in pixels.

W :

Width of the input image in pixels.

L :

Number of layers in the Vision Transformer architecture.

A :

Attention mechanism score matrix, which captures the relationships between image patches.

F :

Feature vector output from the ViT encoder, which represents high-level image features.

Y :

Predicted class label for the input image (e.g., normal, benign, malignant).

\(\mathcal {L}\) :

Loss function used during model training (e.g., cross-entropy loss).

S :

SHAP value assigned to each feature, indicating its contribution to the model’s prediction.

Adam:

Adaptive moment estimation (optimizer)

AUC:

Area under the curve

BAC:

Balanced accuracy

BCR:

Binary count ratio

CNN:

Convolutional neural network

CT:

Computed tomography

DeiT:

Data-efficient image transformer

FLOPs:

Floating point operations per second

FN:

False negative

FP:

False positive

GLCM:

Gray-level cooccurrence matrix

GPU:

Graphics processing unit

HOG:

Histogram of oriented gradients

IoU:

Intersection over union

MCC:

Matthews correlation coefficient

MHSA:

Multihead self-attention

NLST:

National lung screening trial

nnUNet:

No new-net (a medical image segmentation model)

PACS:

Picture archiving and communication system

ResNet:

Residual neural network

ROC:

Receiver operating characteristic

RSNA:

Radiological cociety of North America

SHAP:

SHapley Additive exPlanations

SOTA:

State-of-the-art

TN:

True negative

TP:

True positive

ViT:

Vision transformer

WHO:

World Health Organization

Yule:

Yule’s coefficient

Youden:

Youden’s index

GARD:

Global alliance against chronic respiratory diseases

References

  1. World Health Organization et al. Global alliance against chronic respiratory diseases (GARD): report of the general meeting, Geneva, 10–11 May 2005. Technical report, World Health Organization (2006).

  2. Lebrett MB, Crosbie EJ, Smith MJ, Woodward ER, Gareth Evans D, Crosbie PAJ. Targeting lung cancer screening to individuals at greatest risk: the role of genetic factors. J Med Genet. 2021;58(4):217–26.

    Article  Google Scholar 

  3. Dela Cruz CS, Tanoue LT, Matthay RA. Lung cancer: epidemiology, etiology, and prevention. Clin Chest Med. 2011;32(4):605–44.

    Article  Google Scholar 

  4. Türk F, Kökver Y. Detection of lung opacity and treatment planning with three-channel fusion cnn model. Arab J Sci Eng. 2024;49(3):2973–85.

  5. Seguin L, Durandy M, Feral CC. Lung adenocarcinoma tumor origin: a guide for personalized medicine. Cancers. 2022;14(7):1759.

    Article  Google Scholar 

  6. Siddiqui F, Vaqar S, Siddiqui AH. Lung Cancer. [Updated 2023 May 8]. In: StatPearls [Internet]. Treasure Island (FL): StatPearls Publishing; 2025 Jan. Available from: https://www.ncbi.nlm.nih.gov/books/NBK482357/

  7. Popper HH. Progression and metastasis of lung cancer. Cancer Metastasis Rev. 2016;35:75–91.

    Article  Google Scholar 

  8. McDonald F, De Waele M, Hendriks LEL, Faivre-Finn C, Dingemans A-MC, Van Schil PE. Management of stage I and II nonsmall cell lung cancer. Eur Respir J 2017;49(1).

  9. Boiselle PM. Computed tomography screening for lung cancer. JAMA. 2013;309(11):1163–70.

    Article  Google Scholar 

  10. Cleveland Clinic. Pneumonia. https://my.clevelandclinic.org/health/diseases/4471-pneumonia. Accessed 23 July (2024).

  11. Knight SB, Crosbie PA, Balata H, Chudziak J, Hussell T, Dive C. Progress and prospects of early detection in lung cancer. Open Biol. 2017;7(9):170070.

    Article  Google Scholar 

  12. Huang S, Yang J, Shen N, Xu Q, Zhao Q. Artificial intelligence in lung cancer diagnosis and prognosis: current application and future perspective. Semin Cancer Biol. 2023;89:30–7.

    Article  Google Scholar 

  13. Bardoni C, Spaggiari L, Bertolaccini L. Artificial intelligence in lung cancer. Ann Transl Med 2024;12(4).

  14. Deepa V, Mohamed Fathimal P. Deep-shrimp net fostered lung cancer classification from CT images. Int J Image Graph Signal Process. 2023;15(4):59–68.

    Google Scholar 

  15. Zafar S, Ahmad J, Mubeen Z, Mumtaz G. Enhanced lung cancer detection and classification with MRMR-based hybrid deep learning model. J Comput Biomed Info 2024;7(2).

  16. Qadir AM, Abdalla PA, Abd DF. A hybrid lung cancer model for diagnosis and stage classification from computed tomography images. Iraqi J. Electr. Eng. 2024;20(2).

  17. Saechueng S, Suttapakti U. Binary count ratio for lung cancer classification in computerized tomography scan images. In: 2024 International Conference on Artificial Intelligence in Information and Communication (ICAIIC). IEEE; 2024. p. 070–4.

    Chapter  Google Scholar 

  18. Sajed S, Sanati A, Garcia JE, Rostami H, Keshavarz A, Teixeira A. The effectiveness of deep learning vs. traditional methods for lung disease diagnosis using chest X-ray images: a systematic review. Appl Soft Comput 2023;147:110817.

  19. Bhatt R, Yadav S, Sarvaiya JN. Convolutional neural network based chest X-ray image classification for pneumonia diagnosis. In Emerging technology trends in electronics, communication and networking: third international conference, ET2ECN 2020, Surat, 7–8 Feb 2020. Revised Selected Papers 3. Springer; 2020. p. 254–66

  20. Bharati S, Podder P, Mondal MRH. Hybrid deep learning for detecting lung diseases from X-ray images. Inform Med Unlocked. 2020;20:100391.

    Article  Google Scholar 

  21. Azam MT, Balaha HM, Ali KM, Mekky NE, Hikal NA, Ghazal M, Gondim DD, Mistry A, El-Baz A. A novel ViT-based multi-scaled and rotation-invariance approach for precise differentiation between meningioma and solitary fibrous tumor. In: 2024 IEEE International Symposium on Biomedical Imaging (ISBI). IEEE; 2024. p. 1–4.

    Google Scholar 

  22. Badawy M, Almars AM, Balaha HM, Shehata M, Qaraad M, Elhosseini M. A two-stage renal disease classification based on transfer learning with hyperparameters optimization. Front Med. 2023;10:1106717.

    Article  Google Scholar 

  23. Badawy M, Balaha HM, Maklad AS, Almars AM, Elhosseini MA. Revolutionizing oral cancer detection: an approach using Aquila and Gorilla algorithms optimized transfer learning-based cnns. Biomimetics. 2023;8(6):499.

    Article  Google Scholar 

  24. Raghu M, Unterthiner T, Kornblith S, Zhang C, Dosovitskiy A. Do vision transformers see like convolutional neural networks? Adv Neural Inf Process Syst. 2021;34:12116–28.

    Google Scholar 

  25. Cao Y-H, Yu H, Wu J. Training vision transformers with only 2040 images. In: European conference on computer vision. Springer; 2022. p. 220–37.

    Google Scholar 

  26. Ali H, Mohsen F, Shah Z. Improving diagnosis and prognosis of lung cancer using vision transformers: a scoping review. BMC Med Imaging. 2023;23(1):129.

    Article  Google Scholar 

  27. Vaswani A. Attention is all you need. Adv Neural Inform Process Syst. 2017;30.

  28. Gai L, Xing M, Chen W, Zhang Y, Qiao X. Comparing CNN-based and transformer-based models for identifying lung cancer: which is more effective? Multimedia Tools Appl. 2024;83(20):59253–69.

    Article  Google Scholar 

  29. Kim Y, Kim Y. Explainable heat-related mortality with random forest and Shapley additive explanations (SHAP) models. Sustain Cities Soc. 2022;79:103677.

    Article  Google Scholar 

  30. Aljadani A, Alharthi B, Farsi MA, Balaha HM, Badawy M, Elhosseini MA. Mathematical modeling and analysis of credit scoring using the lime explainer: a comprehensive approach. Mathematics. 2023;11(19):4055.

    Article  Google Scholar 

  31. Wani NA, Kumar R, Bedi J. Harnessing fusion modeling for enhanced breast cancer classification through interpretable artificial intelligence and in-depth explanations. Eng Appl Artif Intell. 2024;136:108939.

    Article  Google Scholar 

  32. Balaha HM, Shaban AO, El-Gendy EM, Saafan MM. Prostate cancer grading framework based on deep transfer learning and Aquila optimizer. Neural Comput Appl. 2024;36(14):7877–902.

    Article  Google Scholar 

  33. Sharaby I, Alksas A, Nashat A, Balaha HM, Shehata M, Gayhart M, Mahmoud A, Ghazal M, Khalil A, Abouelkheir RT, et al. Prediction of Wilms’ tumor susceptibility to preoperative chemotherapy using a novel computer-aided prediction system. Diagnostics. 2023;13(3):486.

    Article  Google Scholar 

  34. Balaha HM, Ayyad SM, Alksas A, Shehata M, Elsorougy A, Badawy MA, El-Ghar MA, Mahmoud A, Alghamdi NS, Ghazal M, et al. Precise prostate cancer assessment using IVIM-based parametric estimation of blood diffusion from DW-MRI. Bioengineering. 2024;11(6):629.

    Article  Google Scholar 

  35. Wu B, Xu C, Dai X, Wan A, Zhang P, Yan Z, Tomizuka M, Gonzalez J, Keutzer K, Vajda P. Visual transformers: token-based image representation and processing for computer vision. 2020. arXiv preprint. arXiv:2006.03677

  36. Deng J, Dong W, Socher R, Li L-J, Li K, Fei-Fei L. Imagenet: a large-scale hierarchical image database. In: 2009 IEEE conference on computer vision and pattern recognition. IEEE; 2009. p. 248–55.

    Chapter  Google Scholar 

  37. Alyasriy H, Al-Huseiny M. The IQ-OTH/NCCD lung cancer dataset. 2023. https://data.mendeley.com/datasets/bhmdr45bh2/4 or https://www.kaggle.com/datasets/hamdallak/the-iqothnccd-lung-cancer-dataset

  38. Kareem HF, Sai-Husieny M, Mohsen FY, Khalil EA, Hassan ZS. Evaluation of SVM performance in the detection of lung cancer in marked CT scan dataset. Indo J Electr Eng Comput Sci. 2021;21(3):1731.

    Google Scholar 

  39. Al-Yasriy HF, Al-Husieny MS, Mohsen FY, Khalil EA, Hassan ZS. Diagnosis of lung cancer based on CT scans using CNN. IOP Conf Ser Mater Sci Eng. 2020;928:022035.

    Article  Google Scholar 

  40. Mehrparvar F. Lung disease. 2024. https://www.kaggle.com/datasets/fatemehmehrparvar/lung-disease

  41. Solyman S, Schwenker F. Lung tumor detection and recognition using deep convolutional neural networks. In: Pan African conference on artificial intelligence. Springer; 2022. p. 79–91.

    Google Scholar 

  42. Al-Huseiny MS, Sajit AS. Transfer learning with Googlenet for detection of lung cancer. Indo J Electr Eng Comput Sci. 2021;22(2):1078–86.

    Google Scholar 

  43. Das S, Kumar P, Pal S, Majumder S. Automated prediction of lung cancer using deep learning algorithms. In: Applied artificial intelligence. CRC Press; 2023. p. 93–120.

    Chapter  Google Scholar 

  44. Gupta A, Kumar A, Rautela K. Udct: lung cancer detection and classification using u-net and darts for medical CT images. Multimedia Tools and Appl 2024;84(18):19065–85.

  45. Deepika R, Shanmugam P, Moorthi K, Manoj Kumar PK, Swarna SL, et al. Optimized transfer learning model for lung cancer stage classification using computed tomography images. In: 2024 International Conference on IoT Based Control Networks and Intelligent Systems (ICICNIS). IEEE; 2024. p. 912–7.

    Chapter  Google Scholar 

  46. Ravindranathan MK, Rajagopalan N, et al. Pulmonary prognosis: predictive analytics for lung cancer detection. In: 2024 2nd International Conference on Recent Advances in Information Technology for Sustainable Development (ICRAIS). IEEE; 2024. p. 261–5.

    Chapter  Google Scholar 

Download references

Funding

No funding was received for this work (i.e., study).

Author information

Authors and Affiliations

Authors

Contributions

We confirm that the manuscript has been read and approved by all named authors. We confirm that the order of authors listed in the manuscript has been approved by all named authors.

Corresponding author

Correspondence to Hossam Magdy Balaha.

Ethics declarations

Conflict of interest

No Conflict of interest exists.

Ethical approval

The current study does not contain any studies with human participants and/or animals performed by any of the authors.

Consent to participate

There is no informed consent for the current study.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Balaha, H.M., Ahmed, R.A. & Balaha, M.H. LDD-VTS: an AI-based framework for lung disease diagnosis using vision transformers and SHAP. Health Inf Sci Syst 13, 47 (2025). https://doi.org/10.1007/s13755-025-00363-5

Download citation

  • Received:

  • Accepted:

  • Published:

  • Version of record:

  • DOI: https://doi.org/10.1007/s13755-025-00363-5

Keywords

Profiles

  1. Hossam Magdy Balaha
  2. Magdy Hassan Balaha