Your new experience awaits. Try the new design now and help us make it even better

ORIGINAL RESEARCH article

Front. Artif. Intell.

Sec. Medicine and Public Health

Transformer-based Deep Learning Approach for Obstructive Sleep Apnea Detection Using Single-lead ECG

Provisionally accepted
  • 1Imam Muhammad ibn Saud Islamic University, Riyadh, Saudi Arabia
  • 2King Saud University, Riyadh, Saudi Arabia
  • 3TED Universitesi, Ankara, Türkiye

The final, formatted version of the article will be published soon.

Obstructive sleep apnea (OSA) results from repeated collapses of the upper airway during sleep, which can lead to serious health complications. Although polysomnography (PSG) is the diagnostic gold standard, it is costly, labor-intensive, and associated with long waiting times. With the rapid evolution of automated scoring solutions and the emergence of machine learning (ML) and deep learning (DL) in many disciplines, there is a need for tools that use fewer signals and can provide accurate diagnoses. DL models can an process large amounts of data and often generalize effectively to new instances. This makes them a suitable choice for classifying continuous time series data. This study introduces a transformer-based deep learning approach using a single-lead electrocardiogram (ECG) for OSA detection. The proposed architecture, designed to handle raw signals with high sampling rates, preserves temporal continuity over unlimited durations. Without any preprocessing, the model tolerates high-noise raw data. The model is tested with different positional embedding techniques. Additionally, a novel positional encoding technique using an autoencoder is introduced. The proposed approach achieves a high F1 score, outperforming other published work by an average margin of more than 13%. In addition, the model classifies apnea episodes at one-second intervals, providing clinicians with nuanced insights.

Keywords: Artificial intelligence (AI), Autoscoring, deep learning (DL), electrocardiogram (ECG), healthcare, Obstructive sleep apnea (OSA), polysomnography (PSG), Time-Series Classification (TSC)

Received: 17 Oct 2025; Accepted: 23 Jan 2026.

Copyright: © 2026 Almarshad, Al-Ahmadi, Islam, Soudani and BaHammam. This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) or licensor are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.

* Correspondence: Malak Almarshad

Disclaimer: All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article or claim that may be made by its manufacturer is not guaranteed or endorsed by the publisher.