Pneumonia Detection from Chest X-Rays Using Deep Convolutional Neural Networks with Class Imbalance Mitigation
- Published
- 18 June 2026
- Venue
- —
- DOI
- —
Abstract
Pneumonia remains a leading cause of mortality worldwide, particularly affecting children and the elderly. Early and accurate diagnosis is critical for effective treatment and improved patient outcomes. Chest X-ray (CXR) imaging is the most common diagnostic tool, but its interpretation can be subjective and time-consuming, leading to inter-observer variability. This paper presents a deep learning-based approach for automated pneumonia detection from chest X-ray images. We employ a pre-trained ResNet-18 architecture fine-tuned on a publicly available dataset of 5,856 chest X-ray images (NORMAL and PNEUMONIA classes). To address the inherent class imbalance in medical imaging datasets, we implement a weighted loss function and a weighted random sampler during training. Our data augmentation pipeline incorporates random cropping, horizontal flipping, rotation, and color jittering to enhance model generalization. The model achieves a training accuracy of 94.27% and a validation accuracy of 93.30% after a single epoch, with a validation loss of 0.2519. The final model, after applying early stopping and model checkpointing, attains a validation accuracy of 95.11% and a validation loss of 0.2354. Comprehensive eval uation metrics, including precision, recall, F1-score, and ROC AUC, demonstrate the model’s robustness and clinical potential. This research highlights the efficacy of transfer learning and imbalance mitigation techniques in developing reliable computer aided diagnosis systems for pneumonia detection.