DEV Community

outOfBounds
outOfBounds

Posted on

3 1

Let's fight Pneumonia with free compute from Kaggle

Pneumonia xray detector

xray

Let's use the power of machine learning to fight back against pneumonia.

We will fight pneumonia using 2 resources

  1. Kaggle.com
  2. "Deep Learning with Python" by Cholet

Kaggle

Let's use the awesome resources that Kaggle.com can provide us. We can use their GPU power, data sets, and awesome community support.

Check the code out here

Deep Learning with Python

I was able to do all this with just the examples from "Deep Learning with Python" by Francois Cholet,(the author of the Keras framework).

Step 1 Find a dataset to use

I went to kaggle and then to datasets and searched for pneumonia and picked this dataset. There are other better ones, but that's the one I started with.

Step 2 Write a classifier

accuracy

I went to page 132 in the book which has a cats-vs-dogs classifier. I basically the same code. (I actually moved some training images into the validation set because there were so few validation images).

I had this working and labelling healthy lungs as 0 and xrays with pneumonia with a 1. These are both classification problems (not "which of 10 categories is this" like MNIST).

Step 3 A score helps, a heat map helps more

heatmap

A score is not good enough, we can do better. Let's have the model make a heatmap so a human can see which part of the xray is more likely to be diseased. That is a much better diagnostic tool, I think.

I used the code on pages 174 and 175 to create a heatmap. This could tell a physician were to look in the xray for problems.

Now what?

Try to learn machine learning too! Use the high quality Kaggle datasets and their competitions to make it fun.

  • Doing this pneumonia classifier felt way more meaningful than another lame MNIST or dog-vs-cat classifier.
  • Creating more people with skills like this may lead to better medical outcomes and cheaper healthcare.
  • Show me what you got ML leaners!

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay