Pneumonia detection

By Rob Zwetsloot. Posted

Pneumonia is a respiratory condition that results from any number of viral or bacterial infections in people. It can also be fatal, which makes it very dangerous. Diagnosis is usually done via symptoms, and one of the more common ways of confirming it is via an X-ray. Young maker Arijit has been creating a device that scans these X-rays so it can more accurately detect it.

“My project Pneumonia Detection is a complete open-source system that uses a Raspberry Pi accompanied with a Raspberry Pi Camera to run a state-of-the-art embedded machine learning model,” Arijit explains. “[This] allows the device to scan chest X-rays and let the user know the amount of viral or bacterial pneumonia present in the chest of the patient. The entire system kit would cost you less than $100, including all of the hardware and the software needed, and it can practically run anywhere.”

Over the last two years, there have been more cases of pneumonia, and a great need for a low-cost system that could quickly and accurately detect it.

“There was also a massive number of people above the age of 60 who were affected by pneumonia [which] even caused death due to delay in detection,” Arijit mentions.

Machine learning and X-rays

For this project, Arijit decided Raspberry Pi was the way forward due to it being easily powered by a mobile battery, as well as the software support.

“The system consists of a Raspberry Pi 4, along with a Raspberry Pi Camera,” he says. “From the software side of things, we have two Docker containers running the balenaCAM and the Edge Impulse machine learning model on top of balenaOS running on Raspberry Pi. The user just has to place a chest X-ray or an image of it in front of the camera and open up http://localhost:4912 in a [browser]. After two-three seconds, the live camera feed will appear in the dashboard and show what type of pneumonia has the person [contracted] with percentages!”

The model was trained with over 3700 images of bacterial and viral pneumonia, which leads to an 80% accuracy in detections. According to a pulmonologist Arijit spoke to, human doctors only have about a 30% accuracy rate when looking at X-rays themselves.

Positive science

“My Twitter and LinkedIn feed was blasted out on the day I released this project publicly,” Arijit tells us. “People have shown very much interest in this. I’ve even been asked for a doing a health camp in my local hospital, which we did and it was great as well. We compared the results laid out by the project [with] the reports given by the doctor, and to my surprise not a single result given by the model was wrong. So, it turns out the ML model has been trained well!”

With more testing and learning, the accuracy of the system will only increase, hopefully resulting in cheaper and more accessible pneumonia detectors.

“The project is completely open-sourced,” Arijit adds. “There are a lot of places wherein you can change and add a new feature to the project. It’s now up to the community to contribute and upgrade its features!”

From The MagPi store

Subscribe

Subscribe to the newsletter

Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.