Blog post

Just Take a Deep Breath

Projects
By Nick Bild
Just Take a Deep Breath

Respiratory illnesses like chronic obstructive pulmonary disease, asthma, and influenza are a major cause of morbidity and mortality worldwide. According to the World Health Organization, 235 million people suffer from a respiratory illness, and each year four million deaths are attributed to these diseases. When lung problems are diagnosed early, treatment plans can be initiated that slow disease progression and improve long-term patient outcomes. But early diagnosis requires relatively expensive equipment like spirometers, and trained technicians in clinical settings to perform the testing procedure. For this reason, most lung diseases are not diagnosed until they have already reached an advanced stage, which means that crucial opportunities for early treatment are missed.

SpiroMask system overview

A number of alternative approaches have been suggested to help fill this gap in respiratory monitoring availability. One technique leveraged the microphone in a typical smartphone to capture breathing sounds, then use those sounds as a proxy for spirometry measurements. This is convenient, to be sure, but unfortunately, smartphone spirometry is susceptible to inaccuracies caused by the way a user holds their phone, environmental conditions, or even the model of the device being used.  Another approach leveraged the accelerometer found in a smartphone, which is placed on the chest to capture precise motion information as the user takes breaths. While this also holds some promise as a better path forward, it does require users to place the device in a specific location on their chest and conduct the testing in a controlled environment.

Other attempts have been made to create the perfect respiration monitor, but they all have their own issues with accuracy or practicality that will prevent their widespread adoption. A team of researchers at IIT Gandhinagar, Stony Brook University, and the University of Washington has approached this problem from a new angle that promises to provide both accurate measurements and a high degree of practicality. They built a small device, called SpiroMask, consisting of a microphone and an Arduino Nano 33 BLE Sense development board that fit inside of a standard, off-the-shelf cloth or N95 face mask. The audio data collected by the microphone is analyzed by machine learning models created with Edge Impulse Studio that can derive vital lung parameters and also continually monitor rate of respiration.

Arduino Nano 33 BLE Sense in a protective case

Lung parameter measurements are captured by SpiroMask when a wearer breathes in their full lung volume, then forcefully exhales. The audio from this event is preprocessed by a pipeline created with Edge Impulse that extracts the most important features in the data. Specifically, mel-frequency cepstral coefficients are calculated, which have been used in previous research efforts to classify abnormal lung sounds. Next, the features were fed into a trio of regression models —  linear regression, random forest, and support vector regression. Each of the models is capable of predicting continuous values for several lung function parameters measured by a spirometer.

Whereas spirometry requires an intentional deep breath to be taken, respiratory rate must be measured while breathing normally. Since this function is intended to run continually, the team’s first task was to distinguish normal breathing from other sounds. To accomplish this, they designed a convolutional neural network with Edge Impulse Studio to classify data from the microphone to determine if it is normal breathing, speaking, or noise. Knowing when the wearer is breathing normally, it is relatively simple to look for peaks in that data and measure the distance between them to calculate their respiratory rate.

Off-the-shelf cloth mask with SpiroMask hardware installed

A study was conducted with 48 participants to determine how effective the SpiroMask system is in practice. The hardware was fitted into a N95 mask and each participant was asked to perform a forced exhalation, much like what would be done with a spirometer. Lung function parameters were predicted using the machine learning algorithm, and a spirometer was also used to capture ground truth measurements. The random forest regression model was found to be the most accurate of the three models that were developed. In fact, the variability between measurements taken with the spirometer and SpiroMask was well within the guidelines established by the American Thoracic Society for lung function measurements taken in a short period of time.

Respiration rate predictions were validated in a similar study. The algorithm that recognizes normal breathing sounds was found to have an average classification accuracy of 94.7%. The rate calculation algorithm was then run on the normal breathing samples, and it was found that a mean absolute error of 0.49 had been achieved when using a N95 face mask. It was also found that the method was robust to microphone placement within the mask, which bodes well for the development of a practical system in which users install the device in their own mask.

With the help of Edge Impulse, the researchers were able to develop a highly accurate system to detect abnormal lung conditions and respiration rate in both healthy and ill patients. This was accomplished using inexpensive hardware that can run the machine learning models on-device to protect the privacy of the wearers. Most importantly, SpiroMask does not require a controlled environment or trained professionals to operate. This is a fantastic example of how machine learning on edge devices can transform fields and make a big difference in real peoples’ lives.


Want to see Edge Impulse in action? Schedule a demo today.

Comments

Subscribe

Are you interested in bringing machine learning intelligence to your devices? We're happy to help.

Subscribe to our newsletter