MobileNet-driven detection of bacterial and viral pneumonia with Grad-CAM heatmap insights - Yuri Pamungkas; Adrian Jaleco Forca; Muhammad Nur Afnan Uda; Uda Hashim (International Journal of Advances in Intelligent Informatics, 2026)
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.