As pneumonia still tops the list of the world’scausesofdeath,accuracyandtimelydiagnosisarestillvital. For pneumonia detection from large chest X-ray datasets, we presentacomputer-aidedmedicalimagediagnosissystemwith a three-layer detection Convolutional Neural Network (CNN) architecture. With hierarchical features through various layers, the proposed system enhances the diagnostic accuracy and classifies healthy and disease lungs according to the diagnosis appropriately. For enhanced usability, we integrate Stream lit with an interface that can handle real-time image uploading, modelprediction,andvisualizationofpneumoniadetectedareas. Our approach is more accurate than traditional deep learning architectures and thus real-clinical-practice deployable. Stream- lit based visualization makes the approach more end-user inter- activeandreadable.ThissupportsAI-basedmedicaldiagnosisaswellasfacilitatespneumoniadetectionwithscalableandefficient modeling .
Introduction
Pneumonia, a serious respiratory disease affecting people worldwide, especially children and the elderly, requires early and accurate detection for effective treatment. Traditional diagnostic methods like X-ray analysis by radiologists can be slow and prone to errors. Deep learning, particularly convolutional neural networks (CNNs), has greatly improved automated pneumonia detection from chest X-ray images by extracting multiple layers of feature representations, leading to higher accuracy and robustness when trained on large datasets.
This paper proposes a three-layer CNN model for pneumonia detection, enhanced with real-time feedback and an intuitive user interface built using Streamlit. This interface allows users (e.g., doctors) to upload chest X-rays, receive predictions, and visualize pneumonia-affected regions, improving diagnostic speed and accuracy.
The paper also reviews various recent deep learning approaches for pneumonia diagnosis, including models using transfer learning (ResNet, Inception), ensemble methods, feature pyramid networks, privacy-preserving federated learning, and advanced image preprocessing techniques. These methods demonstrate high accuracy, improved localization of pneumonia in X-rays, and efficient model training.
CNNs outperform other machine learning techniques like ANN and SVM in image-based pneumonia detection due to automatic feature extraction and scalability. The methodology section explains CNN architecture components such as convolutional layers (for feature extraction), activation functions (ReLU), pooling layers (dimensionality reduction), and fully connected layers (classification), alongside image preprocessing and augmentation to optimize training.
The model’s performance is evaluated using metrics such as accuracy, precision, recall, and F1-score, ensuring balanced and reliable pneumonia detection. Streamlit is utilized to create a user-friendly, interactive web application for deploying the trained CNN model, enabling real-time analysis of chest X-rays without requiring complex web development.
Conclusion
With an accuracy of 90 percent, the CNN-based pneumo- nia detection model showed great diagnostic potential. The model successfully diagnoses pneumonia cases, lowering the possibilityoffalsenegatives,asseenbythehighrecall (97.18 percent). The precision (90 percent) indicates some false positives, though, and could be raised with more data augmentation or fine-tuning. Using chest X-ray images, the modeloffersaquickandautomatedmethodtohelpmedical professionals diagnose pneumonia. Further optimization, such as hyperparameter tuning and controlling data imbalance, can boost its performance.
The training curve(fig:2) of CNN across several training epochs is shown in the Model Accuracy Graph. The machine is learning data patterns correctly when the training accuracy (blue line) is increasing smoothly. The model is overfitting when the model performs well on training data but cannot generalize to new data since the validation accuracy (orange line)alsogrowsbutisalwayssmallerthanthetraining one. This disparity shows that the model can be in need of regularization methods like data augmentation or dropout to enhance generalization in learning.
The CNN reduces errors during training, as shown in fig:3 by the Model Loss Graph. As the model learns and improves its predictions, the training loss (blue line) gradually drops. The validation loss (orange line), on the other hand, varies a lot, which may indicate overfitting or instability, in which the modelretainstrainingdataratherthanadaptingwelltonoveL situations.
References
[1] Scott, J. a. G., Brooks, W. A., Peiris, J. M., Holtzman,D.,andMulhollan,E.K.(2008).Pneumoniaresearch to reduce childhood mortality in the developing world.Journal of Clinical Investigation, 118(4), 1291–1300. https://doi.org/10.1172/jci33947 2. Usman, C., Rehman, S.U., Ali, A., Khan, A. M., and Ahmad, B. (2025). Pneumonia disease detection using chest X-Rays and machine learning. Algorithms,18(2),82.https://doi.org/10.3390/a18020082
[2] Rehman, M. U., Shafique, A., Khan, K. H., Khalid, S., Alotaibi,A.A.,Althobaiti,T.,Ramzan,N.,Ahmad,J.,Shah,
[3] S. A., and Abbasi, Q. H. (2022b). Novel Privacy Preserving Non-Invasive Sensing-Based diagnoses of pneumoniaDiseaseleveragingdeepnetworkmodel. Sensors,22(2), 461. https://doi.org/10.3390/s22020461
[4] Sirazitdinov, I., Kholiavchenko, M., Mustafaev, T., Yixuan, Y., Kuleev, R., and Ibragimov, B. (2019b). Deep neural network ensembleforpneumonialocalizationfromalarge-scalechestx- ray database. Computers and Electrical Engineering, 78, 388–399.https://doi.org/10.1016/j. compeleceng.2019.08.004
[5] Manickam, A., Jiang, J., Zhou, Y., Sagar, A., Soundrapandiyan, R., and Samuel, R. D. J. (2021b). AutomatedpneumoniadetectiononchestX-rayimages: Adeeplearningapproach withdifferentoptimizers and transfer learning architectures. Measurement, 184, 109953.https://doi.org/1 0.1016/j.measurement .2021.109953
[6] Chouhan, V., Singh, S.K., Khamparia, A., Gupta, D.,Tiwari,P.,Moreira,C.,Damas?evic?ius,R.anddeAlbuquerque, V.H.C. (2020). A Novel Transfer Learning Based Approach for Pneumonia Detection in Chest X-ray Images. Applied Sciences,10(2),p.559.https://doi.org/10.3390/app10020559
[7] Kareem,A.,Liu,H.,andSant,P.(2022).Review on Pneumonia Image Detection: A Machine Learning Approach.Human-CentricIntelligentSystems,2(1–2),31–43. https://doi.org/10.1007/s44230-022-00002-2
[8] Harsono, I.W., Liawatimena, S., and Cenggoro, T. W. (2020). Lung nodule detection and classification from Thorax CT-scanusingRetina Netwithtransferlearning.JournalofKing SaudUniversity-ComputerandInformationSciences, 34(3),567–577.https://doi.org/10.1016/j.jksuci.2020.03.013
[9] Bateman,R.M.,Sharpe,M.D.,Jagger,J.E.,Ellis,C. G., Sole´-Viola´n, J., Lo´pez-Rodr´?guez, M., Herrera-Ramos, E., Ru´?z-Herna´ndez,J.,Border´?as,L.,Horcajada, J.,Gonza´lez- Quevedo, N., Rajas, O., Briones, M., De Castro, F. R., Gallego,C.R.,Esen,F.,Orhun,G.,Ozcan, P.E.,Senturk, E.,...Prandi,E.(2016b).36thInternational Symposium on Intensive Care and Emergency Medicine. Critical Care, 20(S2). https://doi.org/10.1186/s13054-016-1208-6
[10] Li,Y., Zhang, Z., Dai, C., Dong, Q., and Badrigilan, S. (2020). Accuracyofdeeplearningforautomateddetectionof pneumonia using chest X-Ray images: A systematic review and meta-analysis. Computers in Biology and Medicine, 123, 103898.https://doi.org/10.1016/j.compbiomed.2020.103898
[11] Islam, R., and Tarique, M. (2022). DiscriminatingCOVID-19 from Pneumonia using Machine Learning Algorithms and Chest X-ray Images. 2022 IEEE International Conference on Industrial Technology (ICIT), 1–6. https://doi.org/10.1109/icit48603.2022.10002758
[12] Al Mamlook,R.E.,Chen,S.andBzizi,H.F.(2020).Investigation of the performance of Machine Learning Classifiers for Pneumonia Detection in Chest X-ray Images. 2020 IEEE International Conference on Electro Information Technology (EIT). https://doi.org/10.1109/eit48999.2020.9208232
[13] Alharbi, A. H., and Mahmoud, H. a. H. (2022).PneumoniaTransferLearningDeepLearningModelfromSegmentedX-rays.Healthcare,10(6),987. https://doi.org/10.3390/healthcare1006098714.Zhang,D.,Ren,F.,Li,Y.,Na,L.,andMa,Y.(2021).
[14] PneumoniaDetectionfromChestX-rayImagesBased on Convolutional Neural Network. Electronics, 10(13), 1512. https://doi.org/10.3390/electronics10131512
[15] Kundu, R., Das, R., Geem, Z. W., Han, G., and Sarkar, R. (2021). Pneumonia detection in chest X-ray images using anensemble of deep learning models. PLoS ONE, 16(9), e0256630. https://doi.org/10.1371/journal.pone.0256630