Emily Zeiberg

Using Machine Learning to Detect Pneumonia in Chest X-rays

My Project

I trained a neural network to look at patients' x-rays and determine if the patient has pneumonia or not.

Why I Chose This Project

I first learned about machine learning after hearing about the research that my brother is doing for school. I was very interested in this idea, so I started to learn more about it independently. After seeing the many applications that machine learning is used in, I knew I wanted to try to train a neural network on my own, and I thought the capstone program would be a great chance to do this. I specifically chose to focus on the medical applications of machine learning because my father is a radiologist, and he told me about how his company uses similar software to check patients scans, and I wanted to learn more about this process.

Learning How to Code

Before this project, I had very little programming experience, so the first step in this project was to learn Python, which is a common programming language used in machine learning applications. Through a course offered by the website Codecademy, I learned the basics of Python and was guided through the development of several computer programs. My favorite of these programs was learning how to create a battleship game that a user could play against the computer (shown on the left).


Resources to Learn About Machine Learning

Learning About Machine Learning and Neural Networks

After practicing my new programming skills, I moved on to researching more about the field of machine learning, which focuses on developing mathematical models that are used to analyze large sets of data. One of these models is called a neural network. We interact with neural networks every day on the web, such as when we search for answers on Google or view recommendations on Netflix. To gain a more comprehensive understanding, I watched a machine learning course offered by the website fast.ai, which explained how to train neural networks for image classification.

About the Neural Network in My Project

The neural network in my project learns to analyze an x-ray and make a prediction. Like any image, an x-ray can be represented by a grid of numbers representing the color of each pixel, just like the pixels on a TV. The neural network is made up of stacks of layers which apply mathematical operations to the image. These layers are defined by a set of numbers, known as weights, which determine how the layer transforms the data that is given. After the network is fed an image, it outputs a prediction that labels the picture, in this case whether the x-ray shows pneumonia. As the neural network is shown more data, the weights in each layer are adjusted, making the model’s predictions more accurate over time.



This video gives a brief overview of the code and explains what each line does.


This video shows how the neural network can be used to predict if a specific image has Pneumonia or not.

Future Goals and Impact

In the future, I plan on training this model more so that it can learn the difference between bacterial and viral pneumonia since this distinction has to be made in order to properly treat the patient. Models like the one in my project are already used in the medical field; however, doctors still need to look over the scan in order to ensure the network is accurate because this software is so new. Also, they have to look for other medical conditions the patient may have that the neural network does not look for. For example, a patient's scan may show evidence of cancer, but since the neural network is only looking for Pneumonia, it will not point out that the patient has another problem. Machine learning is a rapidly changing field with new discoveries and improvements being made constantly, so it is important to continue training a neural network. When neural networks are used in medicine, they can help speed up processes by pointing out a patient's problem to the doctor, and eventually in the future, these networks will be accurate enough to take over some of a doctor’s responsibilities.

My Project Experience

My project was very challenging but very rewarding in the end. Because I had so little prior knowledge, I had to do a lot of research before I could start working on the product. I used many resources to learn more about Python and neural networks so that I could thoroughly understand how the code works. The goal of my project remained the same throughout the process, but the steps I took to meet the goal changed. I originally planned on using only Codecademy to learn how to train a network, but I quickly realized I needed to use other resources in order to fully understand the information. Once I finished the project, I was happy with my results and found the whole process very gratifying.


Advice to Juniors

  • Make sure to choose a topic that you are passionate about because the project requires a lot of work

  • Stay on top of deadlines

  • Take advantage of the time you have during the summer


Thank you to my Capstone advisor, Mrs. Barna, for helping me throughout my project!

Works Cited

"A.I. Experiments: Quick, Draw!" YouTube, www.youtube.com/watch?v=X8v1GWzZYJ4&feature=emb_logo.

Accessed 10 Jan. 2021.

Codecademy. www.codecademy.com. Accessed 10 Jan. 2021.

fast.ai. www.fast.ai. Accessed 10 Jan. 2021.

Google Colab. colab.research.google.com/notebooks/intro.ipynb. Accessed 10 Jan. 2021.

Mooney, Paul. "Chest X-Ray Images (Pneumonia)." Kaggle, www.kaggle.com/

paultimothymooney/chest-xray-pneumonia. Accessed 10 Jan. 2021.

Quick, Draw! quickdraw.withgoogle.com/#. Accessed 10 Jan. 2021.

Rashid, Tariq. Make Your Own Neural Network. Kindle ed.