This project uses a custom Convolutional Neural Network (CNN) to identify pneumonia in chest X-ray images. The model is trained on the "paultimothymooney/chest-xray-pneumonia" dataset from Kaggle and achieves approximately 90% accuracy on test data.
The model uses the Chest X-Ray Images (Pneumonia) dataset from Kaggle:
- Training samples: 5,216 images
- Test samples: 624 images
- Validation samples: 16 images
- Classes: PNEUMONIA, NORMAL
The model consists of:
- 5 Convolutional layers with increasing filters (32, 64, 64, 128, 256)
- Batch normalization after each convolutional layer
- Max pooling layers for dimensionality reduction
- Dropout layers (rates: 0.1, 0.2) for regularization
- Fully connected layers with 128 units and sigmoid output
Total parameters: 1,246,401
- Test Accuracy: 90.54%
- Test Loss: 0.266
Classification metrics:
- PNEUMONIA: Precision 0.95, Recall 0.90, F1-score 0.92
- NORMAL: Precision 0.85, Recall 0.91, F1-score 0.88
- numpy
- pandas
- matplotlib
- seaborn
- tensorflow
- scikit-learn
- opencv-python
- kagglehub
- Install dependencies
- Download the dataset using kagglehub
- Run the notebook to train and evaluate the model
- The trained model is saved as "pneumonia_classifier_model.keras"
- Image preprocessing and normalization
- Data augmentation (rotation, zoom, shifts, flips)
- Learning rate reduction on plateau
- Confusion matrix and classification reports
- Single image prediction capability