MobileNet-driven detection of bacterial and viral pneumonia with Grad-CAM heatmap insights

(1) * Yuri Pamungkas Mail (Institut Teknologi Sepuluh Nopember, Indonesia)
(2) Adrian Jaleco Forca Mail (Guimaras State University, Philippines)
(3) Muhammad Nur Afnan Uda Mail (Universiti Malaysia Sabah, Malaysia)
(4) Uda Hashim Mail (Universiti Malaysia Sabah, Malaysia)
*corresponding author

Abstract


Pneumonia is a major cause of childhood illness and death, and chest X-rays remain the most accessible diagnostic tool. Differentiating bacterial from viral pneumonia, however, is difficult because of overlapping radiographic patterns. This study explores MobileNet architectures combined with Grad-CAM visualization to provide efficient and interpretable pneumonia classification. The main contribution of this research is to demonstrate that MobileNet combined with Grad-CAM not only produces accurate predictions but also highlights radiologically meaningful regions of the lungs, thereby improving transparency and trust in automated diagnosis. A dataset of 5,842 pediatric chest X-rays from Guangzhou Women and Children’s Medical Center was used, including bacterial, viral, and normal cases. MobileNet and MobileNetV2 were trained with stochastic gradient descent, categorical cross-entropy, 20 epochs, and batch size of 32, and validated through 10-fold cross-validation. Grad-CAM was applied to generate heatmaps for model interpretability. Results indicated that MobileNet outperformed MobileNetV2. MobileNet achieved 79.32% accuracy, 81.02% precision, 78.15% recall, 77.82% F1-score, and 89.49% specificity. Its AUC-ROC reached 94.64% (macro) and 90.52% (micro). MobileNetV2 obtained 76.44% accuracy, 74.45% F1-score, and 93.61% macro AUC-ROC. Grad-CAM confirmed that both models attended to pneumonia-related lung regions, with MobileNet producing sharper localized activations and MobileNetV2 showing broader patterns. In conclusion, MobileNet with Grad-CAM provides an accurate, efficient, and interpretable framework for pneumonia detection, making it suitable for deployment in resource-limited clinical settings.

Keywords


MobileNet; MobileNetV2; Pneumonia Classification; Chest X-ray; Grad-CAM

   

DOI

https://doi.org/10.26555/ijain.v12i2.2212
      

Article metrics

Abstract views : 262 | PDF views : 8

   

Cite

   

Full Text

Download

References


[1] Y. Ma, S. Fan, and J. Xi, “Recent updates regarding the management and treatment of pneumonia in pediatric patients: a comprehensive review,” Infection, vol. 53, no. 6, pp. 2341–2359, Dec. 2025, doi: 10.1007/s15010-025-02605-w.

[2] M. Zhu et al., “Antibiotic de-escalation patterns and outcomes in critically ill patients with suspected pneumonia as informed by bronchoalveolar lavage results,” Eur. J. Clin. Microbiol. Infect. Dis., vol. 44, no. 8, pp. 1861–1871, Aug. 2025, doi: 10.1007/s10096-025-05144-2.

[3] K. R. Balmuri, S. Konda, K. kumar Mamidala, M. Gunda, and S. Rani B, “Automated and reliable detection of multi-diseases on chest X-ray images using optimized ensemble transfer learning,” Expert Syst. Appl., vol. 246, p. 122810, Jul. 2024, doi: 10.1016/j.eswa.2023.122810.

[4] Y. Akhter, R. Singh, and M. Vatsa, “AI-based radiodiagnosis using chest X-rays: A review,” Front. Big Data, vol. 6, pp. 1–27, Apr. 2023, doi: 10.3389/fdata.2023.1120989.

[5] R. R. Watkins, “Using Precision Medicine for the Diagnosis and Treatment of Viral Pneumonia,” Adv. Ther., vol. 39, no. 7, pp. 3061–3071, Jul. 2022, doi: 10.1007/s12325-022-02180-8.

[6] J. Rabbah, M. Ridouani, and L. Hassouni, “Improving pneumonia diagnosis with high-accuracy CNN-Based chest X-ray image classification and integrated gradient,” Biomed. Signal Process. Control, vol. 101, p. 107239, Mar. 2025, doi: 10.1016/j.bspc.2024.107239.

[7] S. Singh, M. Kumar, A. Kumar, B. K. Verma, and S. Shitharth, “Pneumonia detection with QCSA network on chest X-ray,” Sci. Rep., vol. 13, no. 1, p. 9025, Jun. 2023, doi: 10.1038/s41598-023-35922-x.

[8] A. Gupta, P. Sheth, and P. Xie, “Neural architecture search for pneumonia diagnosis from chest X-rays,” Sci. Rep., vol. 12, no. 1, p. 11309, Jul. 2022, doi: 10.1038/s41598-022-15341-0.

[9] S. Singh, M. Kumar, A. Kumar, B. K. Verma, K. Abhishek, and S. Selvarajan, “Efficient pneumonia detection using Vision Transformers on chest X-rays,” Sci. Rep., vol. 14, no. 1, p. 2487, Jan. 2024, doi: 10.1038/s41598-024-52703-2.

[10] D. J. Alapat, M. V. Menon, and S. Ashok, “A Review on Detection of Pneumonia in Chest X-ray Images Using Neural Networks,” J. Biomed. Phys. Eng., vol. 12, no. 6, pp. 551–558, Dec. 2022, doi: 10.31661/jbpe.v0i0.2202-1461.

[11] A. Shavkatovich Buriboev, A. Abduvaitov, and H. S. Jeon, “Binary Classification of Pneumonia in Chest X-Ray Images Using Modified Contrast-Limited Adaptive Histogram Equalization Algorithm,” Sensors, vol. 25, no. 13, p. 3976, Jun. 2025, doi: 10.3390/s25133976.

[12] M. Mujahid, F. Rustam, R. Álvarez, J. Luis Vidal Mazón, I. de la T. Díez, and I. Ashraf, “Pneumonia Classification from X-ray Images with Inception-V3 and Convolutional Neural Network,” Diagnostics, vol. 12, no. 5, p. 1280, May 2022, doi: 10.3390/diagnostics12051280.

[13] K. Vijayakumar, M. N. H. Maziz, S. Ramadasan, S. Kadry, and S. Arunmozhi, “Classification of chest radiographs into healthy/pneumonia using Harris-Hawks Algorithm optimized deep-features,” Discov. Comput., vol. 28, no. 1, p. 115, Jun. 2025, doi: 10.1007/s10791-025-09629-8.

[14] R. Ochoa-Ornelas, A. Gudiño-Ochoa, J. A. García-Rodríguez, and S. Uribe-Toscano, “Enhancing early lung cancer detection with MobileNet: A comprehensive transfer learning approach,” Franklin Open, vol. 10, p. 100222, Mar. 2025, doi: 10.1016/j.fraope.2025.100222.

[15] A. Jovic, N. Frid, K. Brkic, and M. Cifrek, “Interpretability and accuracy of machine learning algorithms for biomedical time series analysis – a scoping review,” Biomed. Signal Process. Control, vol. 110, p. 108153, Dec. 2025, doi: 10.1016/j.bspc.2025.108153.

[16] M. S. Vani, R. V. Sudhakar, A. Mahendar, S. Ledalla, M. Radha, and M. Sunitha, “Personalized health monitoring using explainable AI: bridging trust in predictive healthcare,” Sci. Rep., vol. 15, no. 1, p. 31892, Aug. 2025, doi: 10.1038/s41598-025-15867-z.

[17] B. Priego-Torres, D. Sanchez-Morillo, E. Khalili, M. Á. Conde-Sánchez, A. García-Gámez, and A. León-Jiménez, “Automated engineered-stone silicosis screening and staging using Deep Learning with X-rays,” Comput. Biol. Med., vol. 191, p. 110153, Jun. 2025, doi: 10.1016/j.compbiomed.2025.110153.

[18] P. Dusza, T. Banzato, S. Burti, M. Bendazzoli, H. Müller, and M. Wodzinski, “Comparative evaluation of CAM methods for enhancing explainability in veterinary radiography,” Sci. Rep., vol. 15, no. 1, p. 29690, Aug. 2025, doi: 10.1038/s41598-025-14060-6.

[19] P. Radočaj and G. Martinović, “Interpretable Deep Learning for Pediatric Pneumonia Diagnosis Through Multi-Phase Feature Learning and Activation Patterns,” Electronics, vol. 14, no. 9, p. 1899, May 2025, doi: 10.3390/electronics14091899.

[20] G. A. P. Rodrigues, A. L. M. Serrano, G. D. Bispo, G. P. R. Filho, V. P. Gonçalves, and R. I. Meneguette, “IHRAS: Automated Medical Report Generation from Chest X-Rays via Classification, Segmentation, and LLMs,” Bioengineering, vol. 12, no. 8, p. 795, Jul. 2025, doi: 10.3390/bioengineering12080795.

[21] D. Kermany, K. Zhang, and M. Goldbaum, “Labeled Optical Coherence Tomography (OCT) and Chest X-Ray Images for Classification,” Mendeley Data, 2018. [Online]. Available at: https://data.mendeley.com/datasets/rscbjbr9sj/2.

[22] A. Shah and M. Shah, “Advancement of deep learning in pneumonia/Covid‐19 classification and localization: A systematic review with qualitative and quantitative analysis,” Chronic Dis. Transl. Med., vol. 8, no. 3, pp. 154–171, Sep. 2022, doi: 10.1002/cdt3.17.

[23] E. Yanar, F. Hardalaç, and K. Ayturan, “PELM: A Deep Learning Model for Early Detection of Pneumonia in Chest Radiography,” Appl. Sci., vol. 15, no. 12, p. 6487, Jun. 2025, doi: 10.3390/app15126487.

[24] B. E. Dedeoglu, A. R. Tanner, N. J. Brendish, H. E. Moyses, and T. W. Clark, “Comparison of two rapid host-response tests for distinguishing bacterial and viral infection in adults with acute respiratory infection,” J. Infect., vol. 89, no. 6, p. 106360, Dec. 2024, doi: 10.1016/j.jinf.2024.106360.

[25] D. Rickard, M. A. Kabir, and N. Homaira, “Machine learning-based approaches for distinguishing viral and bacterial pneumonia in paediatrics: A scoping review,” Comput. Methods Programs Biomed., vol. 268, p. 108802, Aug. 2025, doi: 10.1016/j.cmpb.2025.108802.

[26] S. A. El-Ghany, M. Elmogy, M. A. Mahmood, and A. A. Abd El-Aziz, “A Robust Tuberculosis Diagnosis Using Chest X-Rays Based on a Hybrid Vision Transformer and Principal Component Analysis,” Diagnostics, vol. 14, no. 23, p. 2736, Dec. 2024, doi: 10.3390/diagnostics14232736.

[27] M. Z. Hoque, A. Keskinarkaus, P. Nyberg, and T. Seppänen, “Stain normalization methods for histopathology image analysis: A comprehensive review and experimental comparison,” Inf. Fusion, vol. 102, p. 101997, Feb. 2024, doi: 10.1016/j.inffus.2023.101997.

[28] T. Islam, M. S. Hafiz, J. R. Jim, M. M. Kabir, and M. F. Mridha, “A systematic review of deep learning data augmentation in medical imaging: Recent advances and future research directions,” Healthc. Anal., vol. 5, p. 100340, Jun. 2024, doi: 10.1016/j.health.2024.100340.

[29] P. R, G. Gajendran, S. Boulaaras, and S. S. Tantawy, “PediaPulmoDx: Harnessing cutting edge preprocessing and explainable AI for pediatric chest X-ray classification with DenseNet121,” Results Eng., vol. 25, p. 104320, Mar. 2025, doi: 10.1016/j.rineng.2025.104320.

[30] S. C. Pereira, J. Rocha, A. Campilho, and A. M. Mendonça, “Distribution-based detection of radiographic changes in pneumonia patterns: A COVID-19 case study,” Heliyon, vol. 10, no. 16, p. e35677, Aug. 2024, doi: 10.1016/j.heliyon.2024.e35677.

[31] H. Thunold, M. Riegler, A. Yazidi, and H. Hammer, “A Deep Diagnostic Framework Using Explainable Artificial Intelligence and Clustering,” Diagnostics, vol. 13, no. 22, p. 3413, Nov. 2023, doi: 10.3390/diagnostics13223413.

[32] M. A. Khan, H. Park, and J. Chae, “A Lightweight Convolutional Neural Network (CNN) Architecture for Traffic Sign Recognition in Urban Road Networks,” Electronics, vol. 12, no. 8, p. 1802, Apr. 2023, doi: 10.3390/electronics12081802.

[33] D. Ngo, H.-C. Park, and B. Kang, “Edge Intelligence: A Review of Deep Neural Network Inference in Resource-Limited Environments,” Electronics, vol. 14, no. 12, p. 2495, Jun. 2025, doi: 10.3390/electronics14122495.

[34] M. Li, Y. Jiang, Y. Zhang, and H. Zhu, “Medical image analysis using deep learning algorithms,” Front. Public Heal., vol. 11, no. November, pp. 1–28, 2023, doi: 10.3389/fpubh.2023.1273253.

[35] T. Öznacar and N. Varol Kayapunar, “Advanced skin cancer prediction with medical image data using MobileNetV2 deep learning and optimized techniques,” Sci. Rep., vol. 15, no. 1, p. 28962, Aug. 2025, doi: 10.1038/s41598-025-14963-4.

[36] J. Lee, J. Park, and Y. Lee, “Toward Efficient Cancer Detection on Mobile Devices,” IEEE Access, vol. 13, pp. 34613–34626, 2025, doi: 10.1109/ACCESS.2025.3543838.

[37] M. Ennab and H. Mcheick, “Advancing AI Interpretability in Medical Imaging: A Comparative Analysis of Pixel-Level Interpretability and Grad-CAM Models,” Mach. Learn. Knowl. Extr., vol. 7, no. 1, p. 12, Feb. 2025, doi: 10.3390/make7010012.

[38] D. Muhammad and M. Bendechache, “Unveiling the black box: A systematic review of Explainable Artificial Intelligence in medical image analysis,” Comput. Struct. Biotechnol. J., vol. 24, pp. 542–560, Dec. 2024, doi: 10.1016/j.csbj.2024.08.005.

[39] J. Manoharan and Y. Sivagnanam, “A Novel Human Action Recognition Model by Grad-CAM Visualization with Multi-level Feature Extraction Using Global Average Pooling with Sequence Modeling by Bidirectional Gated Recurrent Units,” Int. J. Comput. Intell. Syst., vol. 18, no. 1, p. 118, May 2025, doi: 10.1007/s44196-025-00848-x.

[40] M. R. Hasan, S. M. Azmat Ullah, and S. M. Rabiul Islam, “Recent advancement of deep learning techniques for pneumonia prediction from chest X-ray image,” Med. Reports, vol. 7, p. 100106, Oct. 2024, doi: 10.1016/j.hmedic.2024.100106.

[41] E. Hildt, “What Is the Role of Explainability in Medical Artificial Intelligence? A Case-Based Approach,” Bioengineering, vol. 12, no. 4, p. 375, Apr. 2025, doi: 10.3390/bioengineering12040375.

[42] T. Huang, X. Huang, and H. Yin, “Deep learning methods for improving the accuracy and efficiency of pathological image analysis,” Sci. Prog., vol. 108, no. 1, pp. 1–34, Jan. 2025, doi: 10.1177/00368504241306830.

[43] S. Kundu, S. Mukhopadhyay, R. Talukdar, D. Kaplun, A. Voznesensky, and R. Sarkar, “Deep learning model for grading carcinoma with Gini-based feature selection and linear production-inspired feature fusion,” Sci. Rep., vol. 15, no. 1, p. 21225, Jul. 2025, doi: 10.1038/s41598-025-00217-w.

[44] E. Mahamud, N. Fahad, M. Assaduzzaman, S. M. Zain, K. O. M. Goh, and M. K. Morol, “An explainable artificial intelligence model for multiple lung diseases classification from chest X-ray images using fine-tuned transfer learning,” Decis. Anal. J., vol. 12, p. 100499, Sep. 2024, doi: 10.1016/j.dajour.2024.100499.

[45] R. Ochoa-Ornelas, A. Gudiño-Ochoa, J. A. García-Rodríguez, and S. Uribe-Toscano, “A robust transfer learning approach with histopathological images for lung and colon cancer detection using EfficientNetB3,” Healthc. Anal., vol. 7, p. 100391, Jun. 2025, doi: 10.1016/j.health.2025.100391.

[46] M. Aasem and M. Javed Iqbal, “Toward explainable AI in radiology: Ensemble-CAM for effective thoracic disease localization in chest X-ray images using weak supervised learning,” Front. Big Data, vol. 7, pp. 1–14, May 2024, doi: 10.3389/fdata.2024.1366415.

[47] K. D. Reddy and A. Patil, “CXR-MultiTaskNet a unified deep learning framework for joint disease localization and classification in chest radiographs,” Sci. Rep., vol. 15, no. 1, p. 32022, Aug. 2025, doi:




Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

___________________________________________________________
International Journal of Advances in Intelligent Informatics
ISSN 2442-6571  (print) | 2548-3161 (online)
Organized by UAD and ASCEE Computer Society
Published by Universitas Ahmad Dahlan
W: http://ijain.org
E: info@ijain.org (paper handling issues)
 andri.pranolo.id@ieee.org (publication issues)

View IJAIN Stats

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0