This project aims to develop a deep learning model to predict pneumonia from chest X-ray images. Pneumonia is an inflammatory condition of the lung affecting primarily the small air sacs known as alveoli. It can be caused by various factors including infections with viruses or bacteria.
The dataset comprises X-ray images obtained from pediatric patients aged one to five years old from Guangzhou Women and Children’s Medical Center. The images are organized into three folders: train, test, and validation. Each folder contains subfolders for Pneumonia and Normal cases.
The deep learning model is built using the Keras Sequential API with the following architecture:
- Convolutional layers (Conv2D)
- Batch normalization layers (BatchNormalization)
- Max-pooling layers (MaxPool2D)
- Dropout layers (Dropout)
- Flatten layer
- Dense layers (Dense)
- Images are resized to a standard dimension (150x150).
- Grayscale normalization is applied.
- Data augmentation techniques such as rotation, zooming, and flipping are used to increase dataset diversity.
- The model is trained using mini-batch gradient descent with the RMSprop optimizer.
- Learning rate reduction is implemented to dynamically adjust the learning rate during training.
- The model is trained for 12 epochs.
- Model performance is evaluated on the test dataset using metrics like accuracy, loss, precision, recall, and F1-score.
- Confusion matrix is generated to visualize model predictions against true labels.
- Training and validation accuracy/loss curves are plotted for analysis.
The developed model demonstrates reasonable performance in pneumonia detection from chest X-ray images. Further improvements can be made by fine-tuning hyperparameters and exploring advanced techniques.