Abstract :
Pneumonia is a leading cause of global mortality, especially among children and the elderly, and chest radiography (CXR) remains the most widely used modality for its diagnosis. While deep learning has reached or exceeded radiologist-level performance on this task, the resulting models are still treated as opaque black boxes, which is a critical barrier to clinical deployment. In this work, we present a comparative and interpretable computer-aided-diagnosis (CAD) framework for pneumonia detection that combines three modern image-recognition backbones—a convolutional ResNet-50, a Swin Transformer (Swin-T), and a modernised convolutional network (ConvNeXt-T)—with Gradient-weighted Class Activation Mapping++ (Grad-CAM++) explanations. The three backbones were fine-tuned on the public Kermany chest X-ray dataset using a class-balanced training subset, weighted cross-entropy and an early-stopping protocol, and then evaluated on the held-out test set of 624 images. The Swin-T backbone achieved the best overall performance with a test accuracy of 95.51%, an F1-score of 0.95 and only 11 false negatives out of 234 normal cases, outperforming both ResNet-50 (93.11%) and ConvNeXt-T (88.94%). Grad-CAM++ heatmaps generated from the convolutional and transformer feature maps consistently localised on the affected pulmonary regions, providing radiologically plausible visual evidence for each prediction. Compared with five recent state-of-the-art pneumonia detectors, our Swin-T-based pipeline reaches a competitive accuracy while delivering layer-faithful visual explanations, supporting its use as a transparent decision-support tool in clinical workflows.
Keywords :
Chest X-ray, Computer-aided diagnosis., ConvNeXt, Deep learning, Explainable AI, Grad- CAM, Pneumonia detection, ResNet, Swin TransformerReferences :
- Al Reshan, Mana Saleh, Khaled Hammed Gill, Vatsala Anand, et al. 2023. “Detection of Pneumonia from Chest X-Ray Images Utilizing MobileNet Model.” Healthcare 11 (11): 1561.
- Alghamdi, Abdulaziz, Abdulaziz Alshaibani, Ahmad Alfaqehi, and Hossam Meshref. 2025. “Using LSTM Machine Learning Models to Foretell Stock Market Prices.” 2025 1st Future International Conference on Artificial Intelligence and Cybersecurity (FICAC).
- Aljuaid, Khalid, Ziyad Albaqami, and Hossam Meshref. 2025. “Optimizing Pneumonia Detection Accuracy Through CNN-Based Analysis of Patients’ Data.” 2025 International Mobile, Intelligent, and Ubiquitous Computing Conference (MIUCC), 481–88. https://doi.org/10.1109/MIUCC66482.2025.11196775.
- Alqudah, Ali Mohammad, Shoroq Qazan, and Ihssan S. Masad. 2021. “Artificial Intelligence Framework for Efficient Detection and Classification of Pneumonia Using Chest Radiography Images.” Journal of Medical and Biological Engineering 41: 599–609.
- Ayan, Enes, and Halil Murat Unver. 2019. “Diagnosis of Pneumonia from Chest X-Ray Images Using Deep Learning.” 2019 Scientific Meeting on Electrical-Electronics & Biomedical Engineering and Computer Science (EBBT), 1–5.
- Chattopadhay, Aditya, Anirban Sarkar, Prantik Howlader, and Vineeth N. Balasubramanian. 2018. “Grad-CAM++: Generalized Gradient-Based Visual Explanations for Deep Convolutional Networks.” 2018 IEEE Winter Conference on Applications of Computer Vision (WACV), 839–47.
- Chothani, Aaryan, Bharti Khemani, Sachin Malave, Mit Jain, and Jaya Gupta. 2024. “Pneumonia Detection in Chest X-rays Using CNN.” 2024 3rd International Conference for Innovation in Technology (INOCON), 1–4. https://doi.org/10.1109/INOCON60754.2024.10512113.
- Dosovitskiy, Alexey, Lucas Beyer, Alexander Kolesnikov, et al. 2021. “An Image Is Worth 16×16 Words: Transformers for Image Recognition at Scale.” Conf. On Learning Representations (ICLR).
- Ghuse, Namrata D., and Sandeep Monga. 2024. “A Review on Pneumonia Detection Using Artificial Intelligence Techniques.” 2024 2nd International Conference on Artificial Intelligence and Machine Learning Applications: Healthcare and IoT (AIMLA), 1–5. https://doi.org/10.1109/AIMLA59606.2024.10531467.
- Hashmi, Mohammad Farukh, Satyarth Katiyar, Avinash G. Keskar, Neeraj Dhanraj Bokde, and Zong Woo Geem. 2020. “Efficient Pneumonia Detection in Chest Xray Images Using Deep Transfer Learning.” Diagnostics 10 (6): 417.
- He, Kaiming, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. 2016. “Deep Residual Learning for Image Recognition.” IEEE Conf. On Computer Vision and Pattern Recognition (CVPR), 770–78.
- Ibrahim, Abdullahi Umar, Mehmet Ozsoz, Sertan Serte, Fadi Al-Turjman, and Polycarp Shizawaliyi Yakoi. 2021. “Pneumonia Classification Using Deep Learning from Chest X-ray Images During COVID-19.” Cognitive Computation, 1–13.
- Joseph, Honey, and J. Anitha. 2024. “Enhanced Pneumonia Detection Through Advanced AI-Driven Hybrid Models: A Comparative Study of Deep Learning Architectures.” 2024 1st International Conference on Trends in Engineering Systems and Technologies (ICTEST), 01–05. https://doi.org/10.1109/ICTEST60614.2024.10576088.
- Kermany, Daniel S., Michael Goldbaum, Wenjia Cai, et al. 2018. “Identifying Medical Diagnoses and Treatable Diseases by Image-Based Deep Learning.” Cell 172 (5): 1122–31.
- Khan, Wasif, Nazar Zaki, and Luqman Ali. 2021. “Intelligent Pneumonia Identification from Chest X-Rays: A Systematic Literature Review.” IEEE Access 9: 51747–71.
- Krishnan, K. Sripath, and K. Santhi Krishnan. 2022. “Vision Transformer Based COVID-19 Detection Using Chest X-rays.” 2022 Int. Conf. On Computer Communication and Informatics (ICCCI), 1–6.
- Kundu, Rohit, Ritacheta Das, Zong Woo Geem, Gi-Tae Han, and Ram Sarkar. 2021. “Pneumonia Detection in Chest X-ray Images Using an Ensemble of Deep Learning Models.” PLOS ONE 16 (9): e0256630.
- Liang, Gaobo, and Lixin Zheng. 2020. “A Transfer Learning Method with Deep Residual Network for Pediatric Pneumonia Diagnosis.” Computer Methods and Programs in Biomedicine 187: 104964.
- Litjens, Geert, Thijs Kooi, Babak Ehteshami Bejnordi, et al. 2017. “A Survey on Deep Learning in Medical Image Analysis.” Medical Image Analysis 42: 60–88.
- Liu, Ze, Yutong Lin, Yue Cao, et al. 2021. “Swin Transformer: Hierarchical Vision Transformer Using Shifted Windows.” IEEE/CVF Int. Conf. On Computer Vision (ICCV), 10012–22.
- Liu, Zhuang, Hanzi Mao, Chao-Yuan Wu, Christoph Feichtenhofer, Trevor Darrell, and Saining Xie. 2022. “A ConvNet for the 2020s.” IEEE/CVF Conf. On Computer Vision and Pattern Recognition (CVPR), 11976–86.
- Mahmud, Tanvir, Md Awsafur Rahman, and Shaikh Anowarul Fattah. 2020. “CovXNet: A Multi-Dilation Convolutional Neural Network for Automatic COVID-19 and Other Pneumonia Detection from Chest X-ray Images with Transferable Multi-Receptive Feature Optimization.” Computers in Biology and Medicine 122: 103869.
- Mondal, Arnab Kumar, Arnab Bhattacharjee, Parag Singla, and A. P. Prathosh. 2022. “xViTCOS: Explainable Vision Transformer Based COVID-19 Screening Using Radiography.” IEEE Trans. On Engineering Management 70 (8): 2787–99.
- Mooney, Paul. 2018. Chest X-Ray Images (Pneumonia). Kaggle dataset. [Online]. Available: https://www.kaggle.com/datasets/paultimothymooney/chest-xray-pneumonia.
- Nahiduzzaman, Md, Md Omaer Faruq Goni, Rakibul Hassan, et al. 2023. “A Novel Method for Multivariant Pneumonia Classification Based on Hybrid CNN-PCA Based Feature Extraction Using Extreme Learning Machine with CXR Images.” IEEE Access 11: 98151–70.
- Okolo, Gabriel Iluebe, Stamos Katsigiannis, and Naeem Ramzan. 2022. “IEViT: An Enhanced Vision Transformer Architecture for Chest X-ray Image Classification.” Computer Methods and Programs in Biomedicine 226: 107141.
- Park, Sangjoon, Gwanghyun Kim, Yujin Oh, et al. 2022. “Self-Evolving Vision Transformer for Chest X-ray Diagnosis Through Knowledge Distillation.” Nature Communications 13 (1): 3848.
- Rahman, Tawsifur, Muhammad E. H. Chowdhury, Amith Khandakar, et al. 2020. “Transfer Learning with Deep Convolutional Neural Network (CNN) for Pneumonia Detection Using Chest X-ray.” Applied Sciences 10 (9): 3233.
- Rajpurkar, Pranav, Jeremy Irvin, Kaylie Zhu, et al. 2017. “CheXNet: Radiologist-Level Pneumonia Detection on Chest X-Rays with Deep Learning.” arXiv Preprint arXiv:1711.05225.
- Roy, Ayush, Anurag Bhattacharjee, Diego Oliva, Oscar Ramos-Soto, Francisco J. Alvarez-Padilla, and Ram Sarkar. 2024. “FA-Net: A Fuzzy Attention-Aided Deep Neural Network for Pneumonia Detection in Chest X-Rays.” 2024 IEEE 37th International Symposium on Computer-Based Medical Systems (CBMS), 338–43. https://doi.org/10.1109/CBMS61543.2024.00063.
- Selvaraju, Ramprasaath R., Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. 2017. “Grad-CAM: Visual Explanations from Deep Networks via Gradient-Based Localization.” IEEE Int. Conf. On Computer Vision (ICCV), 618–26.
- Sharma, Shivansh, and Kalpna Guleria. 2023. “A Systematic Literature Review on Deep Learning Approaches for Pneumonia Detection Using Chest X-Ray Images.” Multimedia Tools and Applications.
- Shrimali, Samyak. 2024. “Optimizing Chest X-ray Analysis for Pneumonia Detection Through Comparative Evaluation of Transfer Learning CNN Architectures.” 2024 IEEE 9th International Conference for Convergence in Technology (I2CT), 1–5. https://doi.org/10.1109/I2CT61223.2024.10543957.
- Singh, Amitojdeep, Sourya Sengupta, and Vasudevan Lakshminarayanan. 2020. “Explainable Deep Learning Models in Medical Image Analysis.” Journal of Imaging 6 (6): 52.
- Singla, Muskan, Kanwarpartap Singh Gill, Sonal Malhotra, and Swati Devliyal. 2024. “Chest X-ray Image Pneumonia Detection Using Transfer Learning and Xception CNN Model.” 2024 International Conference on Intelligent Systems for Cybersecurity (ISCS), 1–5. https://doi.org/10.1109/ISCS61804.2024.10581194.
- Sirazitdinov, Ilyas, Maksym Kholiavchenko, Tamerlan Mustafaev, Yuan Yixuan, Ramil Kuleev, and Bulat Ibragimov. 2019. “Deep Neural Network Ensemble for Pneumonia Localization from a Large-Scale Chest X-Ray Database.” Computers & Electrical Engineering 78: 388–99.
- Stephen, Okeke, Mangal Sain, Uchenna J. Maduh, and Do-Un Jeong. 2019. “An Efficient Deep Learning Approach to Pneumonia Classification in Healthcare.” Journal of Healthcare Engineering 2019: 1–7.
- Tjoa, Erico, and Cuntai Guan. 2021. “A Survey on Explainable Artificial Intelligence (XAI): Toward Medical XAI.” IEEE Transactions on Neural Networks and Learning Systems 32 (11): 4793–813.
- Trivedi, Mihir, and Anand Gupta. 2022. “A Lightweight Deep Learning Architecture for the Automatic Detection of Pneumonia Using Chest X-ray Images.” Multimedia Tools and Applications 81 (4): 5515–36.
- Tyagi, Kanika, Ganga Pathak, Rahul Nijhawan, and Ankush Mittal. 2024. “Swin-Transformer-Based Architecture for Multi-Class Pneumonia Detection in Chest X-Ray Images.” Multimedia Tools and Applications.
- Velden, Bas H. M. van der, Hugo J. Kuijf, Kenneth G. A. Gilhuijs, and Max A. Viergever. 2022. “Explainable Artificial Intelligence (XAI) in Deep Learning-Based Medical Image Analysis.” Medical Image Analysis 79: 102470.
- Wang, Xiaosong, Yifan Peng, Le Lu, Zhiyong Lu, Mohammadhadi Bagheri, and Ronald M. Summers. 2017. “ChestX-ray8: Hospital-Scale Chest X-Ray Database and Benchmarks on Weakly-Supervised Classification and Localization of Common Thorax Diseases.” IEEE Conf. On Computer Vision and Pattern Recognition (CVPR), 2097–106.
- World Health Organization. 2022. Pneumonia in Children. Https://www.who.int/news-room/fact-sheets/detail/pneumonia.

