Predicting the Presence of Pneumonia in Chest X-rays Using Deep Learning with Convolutional Neural Networks
CSEF · 2019 Computational Systems & Analysis (Senior Division Only)
Overview
Objectives Pneumonia is an infection that causes lung inflammation. In the US, 1 million people with pneumonia are hospitalized annually resulting in 50,000 deaths. A 2017 Stanford ChexNet study suggested that radiologists have a 95% accuracy in detecting pneumonia from chest X-rays. My goal is to train a Convolutional Neural Network (CNN) to meet or exceed this threshold. Methods - 8000 chest pre-classified (NORMAL, PNEUMONIA) X-rays from Kaggle. - The resnet set (resnet34, resnet50) of CNN's from fastai pretrained on regular (non-medical) images, - Linux hardware with a Nvidia GPU from Paperspace - Software utilities: FastAI a framework for fast training CNN s, Python, Jupyter Notebook. 1. Pre-process the X--rays, randomly separating them into training (80%) and validation (20%) sets. 2. Select and train the resnet34 CNN to recognize X-rays that have pneumonia: - Measure the prediction accuracy of the pre-trained network, - Train the outer layers; re-measure the accuracy and loss rates 3. Improve the accuracy of the pre-trained model. - Identify a good learning rate. - Unfreeze the hidden layers and retrain the network. 4. Use input and test time data augmentation to improve the prediction accuracy 5. Repeat steps 2-4 to see if a deeper CNN s (resnet50) can provide better accuracy. 6. Validate results on random chest X-rays and correlate results with practicing radiologists. Results By training the outer layers only, I achieved a prediction accuracy of 95.6%. Using a graph of learning rate versus validation loss, I selected a learning rate of 0.05. With this learning rate, the prediction accuracy decreased marginally to 95.3%. With the addition of data augmentation and training the network for 3 epochs, the prediction accuracy increased to 97.1%. Furthermore, unfreezing the hidden layers and adding a differential learning rate yielded an accuracy of 98.1%. Conclusions CNN's can be used to predict the presence of pneumonia in a chest X-ray with > 98% accuracy. After tuning, false negatives were under 2% and false positives were 1%.
Summary statement
I developed a Convolutional Neural Network that accurately predicts the pressence of pneumonia in chest X-rays.
Help received
Erik Perkins is my project advisor at school. Dhar Rawal mentored me and provided me with the machine learning knowledge to help me to successfully undertake this project.
Competition history
- CSEF 2019
Resources
Related projects
CSEF · 2019
Detection of Pneumonia on CXR Image Using Convolutional Neural Networks with an Emphasis on Minimizing False Negatives
ISEF · 2025
Convolutional Clarity: Accurate, Reliable, Explainable CNNs by Evaluating the Impact of Data Augmentation on Chest X-Ray Pneumonia Classification
CWSF · 2026
An Efficient AI-Driven Tool for Pediatric Pneumonia Detection
AJAS · 2022
The Effectiveness of Deep Learning Models on the Detection of Pneumonia
ISEF · 2022
COVID-19 Detection on Chest X-Ray Using an Enhanced Neural Network Model: Impact of Network Architecture Complexity, Data Augmentation, and Transfer Learning on Model
ISEF · 2021
Smartphone Capable Lightweight Convolutional Neural Network Model for Detecting COVID-19 in Chest X-rays: Addressing the Need of Resource-strapped Locations
ISEF · 2025
Evaluating Convolutional Neural Networks for Multi-Label Chest X-ray Diagnosis: Model Complexity, Hardware Efficiency, and Radiologist Comparison
ISEF · 2020
Using Machine Learning for Pneumonia Diagnosis
Closest projects by meaning, across every fair and year in the corpus.
Browse more like this
Source: California Science & Engineering Fair public projects