Pneumonia remains a significant cause of morbidity and mortality worldwide, particularly in vulnerable populations such as children and the elderly. Early detection through chest X-ray analysis plays a crucial role in timely treatment; however, reliance on radiologists can lead to variability, delays, and diagnostic errors. This paper presents a convolutional neural network (CNN) designed to automate pneumonia diagnosis from chest X-ray images, addressing the need for faster and more consistent diagnostic solutions. The model was trained and validated on a publicly available dataset containing chest X-ray images labeled as either pneumonia or normal. Data augmentation techniques, such as rotation, scaling, and flipping, were applied to enhance generalization and mitigate class imbalance. The architecture consists of multiple convolutional layers, batch normalization, max pooling, and dropout layers to extract and classify image features effectively. The CNN achieved an accuracy of 90.22% and an AUC score of 0.96 on the test set. Precision, recall, and F1-score metrics demonstrate the model’s robust performance, with a recall of 96% for pneumonia cases, indicating a low rate of false negatives. The receiver operating characteristic (ROC) curve and confusion matrix further validate the model’s efficacy in distinguishing pneumonia from normal cases. This study highlights the potential of AI-driven diagnostic tools to improve pneumonia detection, particularly in resource-limited settings. The proposed model can assist radiologists by providing rapid and reliable interpretations, ultimately enhancing patient outcomes and reducing the burden on healthcare systems. Future work will focus on expanding datasets and refining the architecture for even greater accuracy and stability.
Cite this paper
Foysal, A. A. and Sultana, S. (2025). AI-Driven Pneumonia Diagnosis Using Deep Learning: A Comparative Analysis of CNN Models on Chest X-Ray Images. Open Access Library Journal, 12, e2899. doi: http://dx.doi.org/10.4236/oalib.1112899.
Mani, C.S. (2018) Acute Pneumonia and Its Complications. In: Long, S.S., Prober, C.G. and Fischer, M., Eds., Principles and Practice of Pediatric Infectious Diseases, Elsevier, 238-249.e4. https://doi.org/10.1016/b978-0-323-40181-4.00034-7
Nascimento-Carvalho, C.M. (2020) Community-Acquired Pneumonia among Children: The Latest Evidence for an Updated Management. Jornal de Pediatria, 96, 29-38. https://doi.org/10.1016/j.jped.2019.08.003
Eshwara, V.K., Mukhopadhyay, C. and Rello, J. (2020) Community-Acquired Bacterial Pneumonia in Adults. Indian Journal of Medical Research, 151, 287-302. https://doi.org/10.4103/ijmr.ijmr_1678_19
Jean, S., Chang, Y., Lin, W., Lee, W., Hsueh, P. and Hsu, C. (2020) Epidemiology, Treatment, and Prevention of Nosocomial Bacterial Pneumonia. Journal of Clinical Medicine, 9, Article 275. https://doi.org/10.3390/jcm9010275
Baldo, V., Cocchio, S., Baldovin, T., Buja, A., Furlan, P., Bertoncello, C., et al. (2014) A Population-Based Study on the Impact of Hospitalization for Pneumonia in Different Age Groups. BMC Infectious Diseases, 14, Article No. 485. https://doi.org/10.1186/1471-2334-14-485
Abdelwanis, M., Alarafati, H.K., Tammam, M.M.S. and Simsekler, M.C.E. (2024) Exploring the Risks of Automation Bias in Healthcare Artificial Intelligence Applications: A Bowtie Analy-sis. Journal of Safety Science and Resilience, 5, 460-469. https://doi.org/10.1016/j.jnlssr.2024.06.001
Najjar, R. (2023) Redefining Radiology: A Review of Artifi-cial Intelligence Integration in Medical Imaging. Diagnostics, 13, Article 2760. https://doi.org/10.3390/diagnostics13172760
Pillai, A.S. (2021) Utilizing Deep Learning in Medical Image Analysis for Enhanced Diagnostic Accuracy and Patient Care: Challenges, Opportunities, and Ethical Implications. Journal of Deep Learning in Genomic Data Analysis, 1, 1-17.
Anwar, S.M., Majid, M., Qayyum, A., Awais, M., Alnowami, M. and Khan, M.K. (2018) Medical Image Analysis Using Convolu-tional Neural Networks: A Review. Journal of Medical Systems, 42, Article No. 226. https://doi.org/10.1007/s10916-018-1088-1
Sarvamangala, D.R. and Kulkarni, R.V. (2021) Convolutional Neural Networks in Medical Image Understanding: A Sur-vey. Evolutionary Intelligence, 15, 1-22. https://doi.org/10.1007/s12065-020-00540-3
Szepesi, P. and Szilágyi, L. (2022) Detection of Pneumonia Using Convolutional Neural Networks and Deep Learning. Biocybernetics and Biomedical Engineering, 42, 1012-1022. https://doi.org/10.1016/j.bbe.2022.08.001
Nessipkhanov, D., Davletova, V., Kurmanbekkyzy, N. and Omarov, B. (2023) Deep CNN for the Identification of Pneumonia Respiratory Disease in Chest X-Ray Imagery. International Journal of Ad-vanced Computer Science and Applications, 14, Article 2023. https://doi.org/10.14569/ijacsa.2023.0141069
Wang, X., Peng, Y., Lu, L., Lu, Z., Bagheri, M. and Summers, R.M. (2017) ChestX-ray8: Hospital-Scale Chest X-Ray Database and Benchmarks on Weakly-Supervised Classification and Localiza-tion of Common Thorax Diseases. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, 21-26 July 2017, 3462-3471. https://doi.org/10.1109/cvpr.2017.369
Rajpurkar, P., Irvin, J., Zhu, K., Yang, B., Mehta, H., Duan, T. and Ng, A. Y. (2018) CheXNet: Radiologist-Level Pneumonia Detection on Chest X-Rays with Deep Learning. arXiv: 1711.05225.
Shorten, C. and Khoshgoftaar, T.M. (2019) A Survey on Image Data Augmentation for Deep Learning. Journal of Big Data, 6, Article No. 60. https://doi.org/10.1186/s40537-019-0197-0
Khosla, C. and Saini, B.S. (2020) Enhancing Performance of Deep Learning Models with Different Data Augmentation Techniques: A Survey. 2020 International Conference on Intelligent Engineering and Management (ICIEM), London, 17-19 June 2020, 79-85. https://doi.org/10.1109/iciem48762.2020.9160048
Taylor, L. and Nitschke, G. (2018. Improving Deep Learning with Generic Data Augmentation. 2018 IEEE Sympo-sium Series on Computational Intelligence (SSCI), Bangalore, 18-21 November 2018, 1542-1547. https://doi.org/10.1109/ssci.2018.8628742
Liu, B., Wang, X., Dixit, M., Kwitt, R. and Vasconcelos, N. (2018) Feature Space Transfer for Data Augmenta-tion. 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, Salt Lake City, 18-23 June 2018, 9090-9098. https://doi.org/10.1109/cvpr.2018.00947
Li, P., Li, D., Li, W., Gong, S., Fu, Y. and Hospedales, T.M. (2021) A Simple Feature Augmentation for Domain Generaliza-tion. 2021 IEEE/CVF International Conference on Computer Vision (ICCV), Montreal, 10-17 October 2021, 8866-8875. https://doi.org/10.1109/iccv48922.2021.00876
Hauberg, S., Freifeld, O., Lindbo Larsen, A.B., Fisher, J. and Hansen, L. (2016) Dreaming More Data: Class-Dependent Distributions over Diffeomorphisms for Learned Data Augmentation. arXiv: 1510.02795.
Huang, L., Qin, J., Zhou, Y., Zhu, F., Liu, L. and Shao, L. (2023) Normalization Techniques in Training DNNs: Methodology, Analysis and Application. IEEE Transactions on Pattern Analysis and Machine Intelligence, 45, 10173-10196. https://doi.org/10.1109/tpami.2023.3250241
Fan, C., Chen, M., Wang, X., Wang, J. and Huang, B. (2021) A Review on Data Preprocessing Techniques toward Efficient and Reliable Knowledge Discovery from Building Operational Data. Frontiers in Energy Research, 9, Article 652801. https://doi.org/10.3389/fenrg.2021.652801
Alexandropoulos, S.N., Kotsiantis, S.B. and Vrahatis, M.N. (2019) Data Preprocessing in Predictive Data Mining. The Knowledge Engineering Review, 34, e1. https://doi.org/10.1017/s026988891800036x
Habib, M. and Okayli, M. (2024) Evaluating the Sensitivity of Machine Learning Models to Data Preprocessing Tech-nique in Concrete Compressive Strength Estimation. Arabian Journal for Science and Engineering, 49, 13709-13727. https://doi.org/10.1007/s13369-024-08776-2
An, Q., Chen, W. and Shao, W. (2024) A Deep Convolutional Neural Network for Pneu-monia Detection in X-Ray Images with Attention Ensemble. Diagnostics, 14, Article 390. https://doi.org/10.3390/diagnostics14040390
Akbar, W., Soomro, A., Hussain, A., Hussain, T., Ali, F., Haq, M.I.U., et al. (2024) Pneumonia Detection: A Comprehensive Study of Diverse Neural Network Architectures Using Chest X-Rays. International Journal of Applied Mathematics and Computer Science, 34, 679-699. https://doi.org/10.61822/amcs-2024-0045
Jia, G., Lam, H. and Xu, Y. (2021) Classification of COVID-19 Chest X-Ray and CT Images Using a Type of Dynamic CNN Modification Method. Computers in Biology and Medicine, 134, Article ID: 104425. https://doi.org/10.1016/j.compbiomed.2021.104425
Yu, Y., Adu, K., Tashi, N., Anokye, P., Wang, X. and Ayidzoe, M.A. (2020) RMAF: Relu-Memristor-Like Activation Function for Deep Learning. IEEE Access, 8, 72727-72741. https://doi.org/10.1109/access.2020.2987829
Karnewar, A., Ritschel, T., Wang, O. and Mitra, N. (2022) ReLU Fields: The Little Non-Linearity That Could. Special Interest Group on Computer Graphics and Interactive Techniques Conference Proceedings, Vancouver, 7-11 August 2022, 1-9. https://doi.org/10.1145/3528233.3530707
Dubey, S.R., Singh, S.K. and Chaudhuri, B.B. (2022) Activation Functions in Deep Learning: A Comprehensive Survey and Benchmark. Neurocomputing, 503, 92-108. https://doi.org/10.1016/j.neucom.2022.06.111
Qiao, S.Y., Wang, H.Y., Liu, C.X., Shen, W. and Yuille, A. (2019) Micro-Batch Training with Batch-Channel Nor-malization and Weight Standardization. arXiv: 1903.10520.
Shao, J., Hu, K., Wang, C.H., Xue, X.Y. and Raj, B. (2020) Is Normalization Indispensable for Training Deep Neural Network? Advances in Neural Information Processing Systems, 33, 13434-13444.
Zafar, A., Saba, N., Arshad, A., Alabrah, A., Riaz, S., Suleman, M., et al. (2024) Convolutional Neural Networks: A Comprehensive Evaluation and Benchmarking of Pooling Layer Variants. Symmetry, 16, Article 1516. https://doi.org/10.3390/sym16111516
Noel, D. (2023) An Investigation of Methods for Improving Spatial Invariance of Convolutional Neural Networks for Im-age Classification. Ph.D. Thesis, Nova South-eastern University.
Musthafa, M.M., T R, M., V, V.K. and Guluwadi, S. (2024) Enhanced Skin Cancer Diagnosis Using Optimized CNN Architecture and Checkpoints for Automated Dermatological Lesion Classification. BMC Medical Imaging, 24, Article No. 201. https://doi.org/10.1186/s12880-024-01356-8
Mahamud, E., Fahad, N., Assaduz-zaman, M., Zain, S.M., Goh, K.O.M. and Morol, M.K. (2024) An Explainable Artifi-cial Intelligence Model for Multiple Lung Diseases Classification from Chest X-Ray Images Using Fine-Tuned Transfer Learning. Decision Analytics Journal, 12, Article ID: 100499. https://doi.org/10.1016/j.dajour.2024.100499
Huang, G., Liu, Z., Van Der Maaten, L. and Weinberger, K.Q. (2017) Densely Connected Convolutional Networks. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, 21-26 July 2017, 2261-2269. https://doi.org/10.1109/cvpr.2017.243
Tayara, H. and Chong, K.T. (2018) Object Detection in Very High-Resolution Aerial Images Using One-Stage Densely Connected Feature Pyramid Network. Sensors, 18, Article 3341. https://doi.org/10.3390/s18103341
Francis, M. and Deisy, C. (2019) Disease Detection and Classification in Agricultural Plants Using Convolutional Neural Net-works—A Visual Understanding. 2019 6th International Conference on Signal Pro-cessing and Integrated Networks (SPIN), Noida, 7-8 March 2019, 1063-1068. https://doi.org/10.1109/spin.2019.8711701
Khan, S.H., Hayat, M. and Porikli, F. (2019) Regularization of Deep Neural Networks with Spectral Dropout. Neural Net-works, 110, 82-90. https://doi.org/10.1016/j.neunet.2018.09.009
Bejani, M.M. and Ghatee, M. (2021) A System-atic Review on Overfitting Control in Shallow and Deep Neural Networks. Artificial Intelligence Review, 54, 6391-6438. https://doi.org/10.1007/s10462-021-09975-1
Kong, L. and Cheng, J. (2021) Based on Improved Deep Convolutional Neural Network Model Pneumonia Image Classification. PLOS ONE, 16, e0258804. https://doi.org/10.1371/journal.pone.0258804
El Asnaoui, K., Chawki, Y. and Idri, A. (2021) Automated Methods for Detection and Classification Pneumonia Based on X-Ray Images Using Deep Learning. In: Maleh, Y., Baddi, Y., Alazab, M., Tawal-beh, L. and Romdhani, I., Eds., Artificial Intelligence and Blockchain for Future Cy-bersecurity Applications, Springer, 257-284. https://doi.org/10.1007/978-3-030-74575-2_14
Shao, Y. and Lunetta, R.S. (2012) Comparison of Support Vector Machine, Neural Network, and CART Algorithms for the Land-Cover Classification Using Limited Training Data Points. ISPRS Journal of Photogrammetry and Remote Sensing, 70, 78-87. https://doi.org/10.1016/j.isprsjprs.2012.04.001
LeBaron, B. and Weigend, A.S. (1998) A Bootstrap Evaluation of the Effect of Data Splitting on Financial Time Series. IEEE Transactions on Neural Networks, 9, 213-220. https://doi.org/10.1109/72.655043
Dogo, E.M., Afolabi, O.J., Nwulu, N.I., Twala, B. and Aigbavboa, C.O. (2018) A Comparative Analysis of Gradient Descent-Based Optimization Algorithms on Convolutional Neural Networks. 2018 International Conference on Computational Techniques, Electronics and Me-chanical Systems (CTEMS), Belgaum, 21-22 December 2018, 92-99. https://doi.org/10.1109/ctems.2018.8769211
Zaheer, M., Reddi, S., Sachan, D., Kale, S. and Kumar, S. (2018) Adaptive Methods for Nonconvex Optimization. Pro-ceedings of the 32nd International Conference on Neural Information Processing Sys-tems, Montréal, 3 December 2018, 9815-9825.
Wu, Y., Liu, L., Bae, J., Chow, K., Iyengar, A., Pu, C., et al. (2019) Demystifying Learning Rate Policies for High Accuracy Training of Deep Neural Networks. 2019 IEEE International Conference on Big Data (Big Data), Los Angeles, 9-12 December 2019, 1971-1980. https://doi.org/10.1109/bigdata47090.2019.9006104
Porter, E., Solis, D., Bruck-meier, P., Siddiqui, Z.A., Zamdborg, L. and Guerrero, T. (2021) Effect of Loss Func-tions in Deep Learning-Based Segmentation. In: Yang, J.Z., Sharp, G.C. and Gooding, M.J., Eds., Auto-Segmentation for Radiation Oncology, CRC Press, 133-150. https://doi.org/10.1201/9780429323782-12
Niederman, M.S., Torres, A. and Summer, W. (1994) Invasive Diagnostic Testing Is Not Needed Routinely to Manage Suspected Ventilator-Associated Pneumonia. American Journal of Respiratory and Critical Care Medicine, 150, 565-569. https://doi.org/10.1164/ajrccm.150.2.8049849
Brusselaers, N., Labeau, S., Vo-gelaers, D. and Blot, S. (2012) Value of Lower Respiratory Tract Surveillance Cultures to Predict Bacterial Pathogens in Ventilator-Associated Pneumonia: Systematic Review and Diagnostic Test Accuracy Meta-Analysis. Intensive Care Medicine, 39, 365-375. https://doi.org/10.1007/s00134-012-2759-x
Wardle, J. and Pope, R. (1992) The Psychological Costs of Screening for Cancer. Journal of Psychosomatic Research, 36, 609-624. https://doi.org/10.1016/0022-3999(92)90051-3
Wakefield, J.C. (2010) Misdiagnosing Normality: Psychiatry’s Failure to Address the Problem of False Posi-tive Diagnoses of Mental Disorder in a Changing Professional Environment. Journal of Mental Health, 19, 337-351. https://doi.org/10.3109/09638237.2010.492418
Webb, G.I. and Zheng, Z. (2004) Multistrategy Ensemble Learning: Reducing Error by Combining Ensemble Learning Techniques. IEEE Transactions on Knowledge and Data Engineering, 16, 980-991. https://doi.org/10.1109/tkde.2004.29
Alammar, Z., Alzubaidi, L., Zhang, J., Li, Y., Lafta, W. and Gu, Y. (2023) Deep Transfer Learning with Enhanced Feature Fu-sion for Detection of Abnormalities in X-Ray Images. Cancers, 15, Article 4007. https://doi.org/10.3390/cancers15154007
Ashraf, A., Naz, S., Shirazi, S.H., Raz-zak, I. and Parsad, M. (2021) Deep Transfer Learning for Alzheimer Neurological Dis-order Detection. Multimedia Tools and Applications, 80, 30117-30142. https://doi.org/10.1007/s11042-020-10331-8
Siddiqi, R. and Javaid, S. (2024) Deep Learning for Pneumonia Detection in Chest X-Ray Images: A Comprehensive Survey. Journal of Imaging, 10, Article 176. https://doi.org/10.3390/jimaging10080176
Feng, Y., Yang, X., Qiu, D., Zhang, H., Wei, D. and Liu, J. (2022) Pcxrnet: Pneumonia Diagnosis from Chest X-Ray Im-ages Using Condense Attention Block and Multiconvolution Attention Block. IEEE Journal of Biomedical and Health Informatics, 26, 1484-1495. https://doi.org/10.1109/jbhi.2022.3148317
Cui, L., Li, D., Yang, X., Liu, C. and Yan, X. (2024) A Unified Approach Addressing Class Imbalance in Magnetic Reso-nance Image for Deep Learning Models. IEEE Access, 12, 27368-27384. https://doi.org/10.1109/access.2024.3365544
Zhang, M., Fan, B., Zhang, N., Wang, W. and Fan, W. (2021) Mining Product Innovation Ideas from Online Reviews. Information Processing & Management, 58, Article ID: 102389. https://doi.org/10.1016/j.ipm.2020.102389