PNEUMONIA CLASSIFICATION FROM CHEST X-RAY IMAGES USING A CUSTOM CONVOLUTIONAL NEURAL NETWORK AND MOBILENETV2
Keywords:
Pneumonia; Chest X-ray; CNN; MobileNetV2; Transfer Learning; Medical Image Classification.Abstract
This study compares a custom convolutional neural network (CNN) trained from scratch with an ImageNet-pretrained MobileNetV2 model for binary classification of chest X-ray images into NORMAL and PNEUMONIA classes. The experimental setup included 5,216 training images, 16 validation images, and 624 test images. Images were resized to 224 × 224 pixels; custom CNN training used rotation, zoom, and horizontal-flip augmentation. Both models were trained for five epochs using class weights. On the test set, the custom CNN achieved 86.86% accuracy, 0.8615 precision, 0.9410 recall, and 0.4210 loss. MobileNetV2 achieved 85.42% accuracy, 0.8201 precision, 0.9821 recall, 0.5149 loss, and an ROC-AUC of 0.9576. The study selected the custom CNN using an accuracy-based rule. Its confusion matrix contained 175 true NORMAL predictions, 59 false positives, 23 false negatives, and 367 true PNEUMONIA predictions. MobileNetV2 had higher pneumonia recall, showing a trade-off between overall accuracy and sensitivity. The very small validation set and undocumented dataset provenance limit generalizability. These experimental models are not clinical diagnostic devices.


