Sleep apnoea affects up to 7% of people. University of Auckland researchers are using NeSI computing resources to enhance the tools used to help detect sleep apnoea, which could lead to improved methods of diagnosis. Photo: Gregory Pappas, Unsplash.

A neural network to conquer sleep apnoea

Using NeSI allowed us to take the approach of gathering lots of data, then train and test it remotely as opposed to trying to do it all on a local machine."

The Challenge:
Sleep apnoea affects millions of people globally but diagnosis relies on multiple biological signals. This means long wait times, high costs and overnight stays to monitor sleeping. Easily portable systems using single-channel EEGs could monitor patients in their own home if a reliable tool is developed to interpret the data.

The Solution:
A University of Auckland duo used NeSI’s Tesla P100 GPU cores to train a neural network. This network interpreted single-channel EEG recordings to identify sleep apnoea. The pair drew from a variety of large, publically available datasets, including the Sleep Heart Health Study.

The Outcome:
The neural network was able to detect sleep apnoea using single-channel EEG readings with 69.9% accuracy. The network’s decision framework is transparent, so researchers and healthcare providers can use and repeat the network architecture. It is a promising early step towards cheap, portable sleep apnoea diagnosis.

 

Sleep apnoea affects up to 7% of people and increases the risk of workplace and vehicular accidents. Specialists use multi-channel biological recordings to diagnose sleep apnoea, but the waitlist for these machines is long. To reduce the burden on healthcare providers and improve diagnosis of sleep aponea, specialists need new methods.

At the University of Auckland, in the Department of Mechanical and Mechatronics Engineering, PhD student Kevin Lee and software engineer Lachlan Barnes performed this work alongside Dr. Luke Hallum, an experienced electrophysiologist and biomedical engineer. Lachlan and Kevin used NeSI's HPC platform to train a convolutional neural network to detect sleep apnoea using single-channel EEG recordings.

Both multi-channel and single-channel EEGs record brainwaves via electrodes attached to a sleeping patient’s head. The main difference is the number of channels used to record brainwaves, and therefore the complexity of the information recorded.

While single-channel EEG recordings convey less information, patients can perform them at home using portable devices, instead of requiring overnight visits to sleep centres. A reliable method of converting single-channel EEG recordings into diagnosis could, ultimately help millions have a better night’s sleep. This could help reduce the public health burden associated with sleep issues.

“We took a data-driven approach, using data from the Sleep Heart Health Study,” said Kevin. “That’s where NeSI came in, because it offered a lot of computation, especially in terms of random-access memory, how much we can have online running each time and the amount of computational power.”

The pair ran their neural network through the training data 40 times using NeSI’s Tesla P100 GPUs. Each training sample took 112 microseconds to compute and 40 microseconds to test. With millions of datapoints, this would have been difficult, if not impossible, using local desktops.

“We were working with several datasets which including de-identified recordings from several thousand patients. Using NeSI allowed us to take the approach of gathering lots of data, then train and test it remotely as opposed to trying to do it all on a local machine,” said Lachlan.

“Each training episode took about 10-to-12 hours. That was running on NeSI. If we were to do that at home, this time requirement would have grown exponentially,” said Kevin.

The pair needed to ensure the network’s mechanisms of operation were transparent. Neural networks can easily become convoluted and their internal decision-making obscured. For open science and the concern of future patients, every step of the decision-making process needed to interpretable by researchers and clinicians looking to to make use of study the pair’s network.

“Quite a large amount of the work was creating an algorithm which is explainable, which is quite important in healthcare. And because you don't want a black box, we opted for a simpler machine learning algorithm. That allowed us to explain the computational mechanisms of it. We could explain how it was computing its predictions and show that it was able to, in some cases, predict in a similar way to how experts make their predictions,” said Lachlan.

One of the main advantages Kevin and Lachlan cited while using NeSI was their access to training resources. This gave them a starting point to submit and partition jobs that they could then tweak to increase efficiency. This was important, as neither had used HPC resources previously.

“We looked through the NeSI Wiki to learn how to submit our first HPC job. Then we used the GPU job template and applied it to our own work, modifying it to suit us better. We started off with the recommended set-up and then just tried out all sorts of things to fit our NeSI interaction and our workflow better,” said Lachlan.

This still left the question of how long to allot run-time for tasks. If a task did not have enough time to compile, the session would expire before it had completed. This would waste hours of work. On the other hand, too much time would result in a waste of resources. NeSI’s onboarding provided some help for the delicate balancing act, though the pair still relied mostly on trial and error.

“Because this is a kind of a neural network task. We weren't quite sure on the training time. That was always a big challenge, to estimate the correct amount of time to allocate each task within each job on the servers. We approached it by gathering an estimation based on how long these tasks were generally taking and leaving a bit of extra time in case anything went wrong.” Kevin.

The completed neural network was able to autonomously detect sleep apnoea using single-channel EEG with an accuracy of 69.9%. While this was too low for industry diagnosis, the availability of portable single-band EEG monitors makes it a promising first step.

 

Reference:

  • Barnes, L. D., Lee, K., Kempa-Liehr, A. W., & Hallum, L. E. (2022). Detection of sleep apnea from single-channel electroencephalogram (EEG) using an explainable convolutional neural network (CNN). PLOS ONE, 17(9). https://doi.org/10.1371/journal.pone.0272167

 


Do you have an example of how NeSI platforms or support advanced your research? We’re always looking for projects to feature as a case study. Get in touch by emailing support@nesi.org.nz.

 

Next Case Study

Example image of the cubed-sphere mesh used by the next generation climate and weather forecasting code LFRic.

Diving deeper into earth data analysis

"We are in a better position to make informed decisions about how to work with data in these next generation models and now have access to tools which go beyond previous existing capabilities."