{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,6,11]],"date-time":"2026-06-11T16:42:23Z","timestamp":1781196143787,"version":"3.54.1"},"reference-count":63,"publisher":"Frontiers Media SA","license":[{"start":{"date-parts":[[2026,2,11]],"date-time":"2026-02-11T00:00:00Z","timestamp":1770768000000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"content-domain":{"domain":["frontiersin.org"],"crossmark-restriction":true},"short-container-title":["Front. Artif. Intell."],"abstract":"<jats:p>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.<\/jats:p>","DOI":"10.3389\/frai.2026.1727091","type":"journal-article","created":{"date-parts":[[2026,2,11]],"date-time":"2026-02-11T06:50:51Z","timestamp":1770792651000},"update-policy":"https:\/\/doi.org\/10.3389\/crossmark-policy","source":"Crossref","is-referenced-by-count":1,"title":["Transformer-based deep learning approach for obstructive sleep apnea detection using single-lead ECG"],"prefix":"10.3389","volume":"9","author":[{"given":"Malak Abdullah","family":"Almarshad","sequence":"first","affiliation":[{"name":"Computer Science Department, College of Computer and Information Sciences, Imam Mohammad Ibn Saud Islamic University (IMSIU)","place":["Riyadh, Saudi Arabia"]}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Saad","family":"Al-Ahmadi","sequence":"additional","affiliation":[{"name":"Computer Science Department, College of Computer and Information Sciences, King Saud University","place":["Riyadh, Saudi Arabia"]}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Saiful","family":"Islam","sequence":"additional","affiliation":[{"name":"Department of Computer Engineering, TED University","place":["Ankara, T\u00fcrkiye"]}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Adel","family":"Soudani","sequence":"additional","affiliation":[{"name":"Computer Science Department, College of Computer and Information Sciences, King Saud University","place":["Riyadh, Saudi Arabia"]}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Ahmed S.","family":"BaHammam","sequence":"additional","affiliation":[{"name":"The University Sleep Disorders Center, Department of Medicine, College of Medicine, King Saud University","place":["Riyadh, Saudi Arabia"]},{"name":"Strategic Technologies Program of the National Plan for Sciences and Technology and Innovation in the Kingdom of Saudi Arabia","place":["Riyadh, Saudi Arabia"]}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"1965","published-online":{"date-parts":[[2026,2,11]]},"reference":[{"key":"ref1","doi-asserted-by":"publisher","first-page":"105675","DOI":"10.1016\/j.cmpb.2020.105675","article-title":"Morphological autoencoders for apnea detection in respiratory gating radiotherapy","volume":"195","author":"Abreu","year":"2020","journal-title":"Comput. Methods Prog. Biomed."},{"key":"ref2","doi-asserted-by":"publisher","first-page":"7924","DOI":"10.3390\/s23187924","article-title":"Adoption of transformer neural network to improve the diagnostic performance of oximetry for obstructive sleep apnea","volume":"23","author":"Almarshad","year":"2023","journal-title":"Sensors"},{"key":"ref3","doi-asserted-by":"publisher","first-page":"1","DOI":"10.3390\/healthcare10030547","article-title":"Diagnostic features and potential applications of PPG signal in healthcare: a systematic review","volume":"10","author":"Almarshad","year":"2022","journal-title":"Healthc."},{"key":"ref4","doi-asserted-by":"publisher","DOI":"10.1016\/j.bspc.2021.102906","article-title":"Classification of obstructive sleep apnoea from single-lead ECG signals using convolutional neural and long short term memory networks","volume":"69","author":"Almutairi","year":"2021","journal-title":"Biomed. Signal Process. Control"},{"key":"ref5","doi-asserted-by":"publisher","first-page":"15","DOI":"10.1016\/j.mehy.2019.03.026","article-title":"A deep learning-based decision support system for diagnosis of OSAS using PTT signals","volume":"127","author":"Arslan","year":"2019","journal-title":"Med. Hypotheses"},{"key":"ref6","doi-asserted-by":"publisher","first-page":"1709","DOI":"10.2147\/nss.s390292","article-title":"Publicly available Health Research datasets: opportunities and responsibilities","volume":"14","author":"BaHammam","year":"2022","journal-title":"Nat. Sci. Sleep"},{"key":"ref7","doi-asserted-by":"publisher","first-page":"687","DOI":"10.1016\/S2213-2600(19)30198-5","article-title":"Estimation of the global prevalence and burden of obstructive sleep apnoea: a literature-based analysis","volume":"7","author":"Benjafield","year":"2019","journal-title":"Lancet Respir. Med."},{"key":"ref8","doi-asserted-by":"publisher","first-page":"1","DOI":"10.1038\/s41597-022-01272-y","article-title":"OSASUD: a dataset of stroke unit recordings for the detection of obstructive sleep apnea syndrome","volume":"9","author":"Bernardini","year":"2022","journal-title":"Sci Data"},{"key":"ref9","doi-asserted-by":"publisher","first-page":"102133","DOI":"10.1016\/j.artmed.2021.102133","article-title":"AIOSA: an approach to the automatic identification of obstructive sleep apnea events based on deep learning","volume":"118","author":"Bernardini","year":"2021","journal-title":"Artif. Intell. Med."},{"key":"ref10","doi-asserted-by":"crossref","first-page":"871","DOI":"10.1093\/aje\/kwf113","article-title":"Multi-ethnic study of atherosclerosis: objectives and design","volume":"156","author":"Bild","year":"2002","journal-title":"Am. J. Epidemiol."},{"key":"ref11","first-page":"556","article-title":"Leveraging Transformer Models for Accurate Detection of Obstructive Sleep Apnea from Single-Lead ECG Signals","volume-title":"Proceedings of the 3rd International Conference on Computing Advancements (ICCA \u201824)","author":"Biswas","year":"2025"},{"key":"ref12","doi-asserted-by":"publisher","DOI":"10.1080\/10641963.2023.2259132","article-title":"Body roundness index improves the predictive value of cardiovascular disease risk in hypertensive patients with obstructive sleep apnea: a cohort study","volume":"45","author":"Cai","year":"2023","journal-title":"Clin. Exp. Hypertens."},{"key":"ref13","doi-asserted-by":"publisher","DOI":"10.3390\/s20216067","article-title":"Portable sleep apnea syndrome screening and event detection using long short-term memory recurrent neural network","volume":"20","author":"Chang","year":"2020","journal-title":"Sensors"},{"key":"ref14","doi-asserted-by":"publisher","first-page":"1","DOI":"10.3390\/s20154157","article-title":"A sleep apnea detection system based on a one-dimensional deep convolution neural network model using single-lead electrocardiogram","volume":"20","author":"Chang","year":"2020","journal-title":"Sensors (Switzerland)"},{"key":"ref15","doi-asserted-by":"publisher","first-page":"123","DOI":"10.1016\/j.compbiomed.2018.06.028","article-title":"Real-time apnea-hypopnea event detection during sleep by convolutional neural networks","volume":"100","author":"Choi","year":"2018","journal-title":"Comput. Biol. Med."},{"key":"ref16","doi-asserted-by":"publisher","first-page":"377","DOI":"10.1016\/j.future.2019.01.049","article-title":"Evolution-based configuration optimization of a deep neural network for the classification of obstructive sleep apnea episodes","volume":"98","author":"De Falco","year":"2019","journal-title":"Futur. Gener. Comput. Syst."},{"key":"ref17","doi-asserted-by":"publisher","first-page":"1454","DOI":"10.1007\/s10618-020-00701-z","article-title":"Rocket: exceptionally fast and accurate time series classification using random convolutional kernels","volume":"34","author":"Dempster","year":"2020","journal-title":"Data Min. Knowl. Discov."},{"key":"ref18","volume-title":"Study of a transformer-inspired data-driven diagnostic algorithm for automatic detection of cardiac arrhythmia in 12-Lead","author":"Denker","year":"2022"},{"key":"ref19","doi-asserted-by":"publisher","first-page":"95","DOI":"10.1007\/s13534-017-0055-y","article-title":"Obstructive sleep apnoea detection using convolutional neural network based deep learning framework","volume":"8","author":"Dey","year":"2018","journal-title":"Biomed. Eng. Lett."},{"key":"ref20","doi-asserted-by":"publisher","DOI":"10.3390\/s21175858","article-title":"An lstm network for apnea and hypopnea episodes detection in respiratory signals","volume":"21","author":"Drzazga","year":"2021","journal-title":"Sensors"},{"key":"ref21","first-page":"1","article-title":"A guide to convolution arithmetic for deep learning","author":"Dumoulin","year":"2016"},{"key":"ref22","doi-asserted-by":"publisher","DOI":"10.1016\/j.cmpb.2019.105001","article-title":"Deep learning approaches for automatic detection of sleep apnea events from an electrocardiogram","volume":"180","author":"Erdenebayar","year":"2019","journal-title":"Comput. Methods Prog. Biomed."},{"key":"ref23","doi-asserted-by":"publisher","first-page":"106591","DOI":"10.1016\/j.knosys.2020.106591","article-title":"Accurate detection of sleep apnea with long short-term memory network based on RR interval signals","volume":"212","author":"Faust","year":"2021","journal-title":"Knowl.-Based Syst."},{"key":"ref24","volume-title":"Deep learning","author":"Goodfellow","year":"2016"},{"key":"ref25","doi-asserted-by":"publisher","first-page":"7084","DOI":"10.1016\/j.eswa.2012.01.037","article-title":"A mixture of experts for classifying sleep apneas","volume":"39","author":"Guijarro-berdi\u00f1as","year":"2012","journal-title":"Expert Syst. Appl."},{"key":"ref26","doi-asserted-by":"crossref","DOI":"10.1201\/b22464","volume-title":"Clinical atlas of polysomnography","author":"Gupta","year":"2018"},{"key":"ref27","article-title":"Obstructive Sleep Apnea (OSA)","author":"Halani","year":""},{"key":"ref28","volume-title":"St. Vincent\u2019s university hospital \/ University College Dublin sleep apnea database.","author":"Heneghan","year":"2011"},{"key":"ref29","doi-asserted-by":"publisher","DOI":"10.1109\/TIM.2022.3193169","article-title":"A hybrid transformer model for obstructive sleep apnea detection based on self-attention mechanism using single-lead ECG","volume":"71","author":"Hu","year":"2022","journal-title":"IEEE Trans. Instrum. Meas."},{"key":"ref30","doi-asserted-by":"publisher","first-page":"175","DOI":"10.1046\/j.1440-1819.1999.00527.x","article-title":"Development of the polysomnographic database on CD-ROM","volume":"53","author":"Ichimaru","year":"1999","journal-title":"Psychiatry Clin. Neurosci."},{"key":"ref31","doi-asserted-by":"publisher","first-page":"917","DOI":"10.1007\/s10618-019-00619-1","article-title":"Classification of ford motor data","volume":"33","author":"Ismail Fawaz","year":"2019","journal-title":"Data Min. Knowl. Discov."},{"key":"ref32","doi-asserted-by":"publisher","first-page":"102212","DOI":"10.1016\/j.smrv.2025.102212","article-title":"Artificial intelligence and sleep medicine II: a scoping review of applications, advancements, and future directions \u2606","volume":"85","author":"Jahrami","year":"2025","journal-title":"Sleep Med. Rev."},{"key":"ref33","doi-asserted-by":"publisher","first-page":"2594","DOI":"10.3390\/s20092594","article-title":"Recognition of patient groups with sleep related disorders using bio-signal processing and deep learning","volume":"20","author":"Jarchi","year":"2020","journal-title":"Sensors"},{"key":"ref34","doi-asserted-by":"publisher","first-page":"71","DOI":"10.1016\/j.sleep.2020.12.032","article-title":"Neural network analysis of nocturnal SpO2 signal enables easy screening of sleep apnea in patients with acute cerebrovascular disease","volume":"79","author":"Leino","year":"2021","journal-title":"Sleep Med."},{"key":"ref35","doi-asserted-by":"publisher","first-page":"94","DOI":"10.1016\/j.neucom.2018.03.011","article-title":"A method to detect sleep apnea based on deep neural network and hidden Markov model using single-lead ECG signal","volume":"294","author":"Li","year":"2018","journal-title":"Neurocomputing"},{"key":"ref36","author":"Loshchilov","year":"2019"},{"key":"ref37","first-page":"1","article-title":"The evaluation and management of bradycardia","volume":"342","author":"Mangrum","year":"2014","journal-title":"Prim. CARE Rev."},{"key":"ref38","doi-asserted-by":"publisher","first-page":"104532","DOI":"10.1016\/j.compbiomed.2021.104532","article-title":"SCNN: Scalogram-based convolutional neural network to detect obstructive sleep apnea using single-lead electrocardiogram signals","volume":"134","author":"Mashrur","year":"2021","journal-title":"Comput. Biol. Med."},{"key":"ref39","doi-asserted-by":"publisher","DOI":"10.3390\/s19224934","article-title":"A systematic review of detecting sleep apnea using deep learning","volume":"19","author":"Mostafa","year":"2019","journal-title":"Sensors"},{"key":"ref40","first-page":"1","article-title":"Ensemble of Deep Learning Models for sleep apnea detection: an experimental study","author":"Mukherjee","year":"2021","journal-title":"Sensors"},{"key":"ref41","doi-asserted-by":"publisher","first-page":"1","DOI":"10.1109\/access.2022.3201911","article-title":"On the generalization of sleep apnea detection methods based on heart rate variability and machine learning","volume":"10","author":"Padovano","year":"2022","journal-title":"IEEE Access"},{"key":"ref42","first-page":"255","article-title":"The apnea-ECG database","author":"Penzel","year":"2000","journal-title":"Comput. Cardiol."},{"key":"ref43","first-page":"1077","article-title":"The sleep heart health study: design, rationale, and methods","volume":"20","author":"Quan","year":"1997","journal-title":"Sleep"},{"key":"ref44","doi-asserted-by":"publisher","first-page":"6622","DOI":"10.3390\/app11146622","article-title":"Diagnosis of Obstructive Sleep Apnea from ECG Signals Using Machine Learning and Deep Learning Classifiers","volume":"11","author":"Sheta","year":"","journal-title":"Applied Sciences"},{"key":"ref45","article-title":"Applied sciences diagnosis of obstructive sleep apnea from ECG signals using machine learning and deep learning classifiers","author":"Sheta","year":""},{"key":"ref46","doi-asserted-by":"publisher","first-page":"1","DOI":"10.3390\/s20185037","article-title":"Deep recurrent neural networks for automatic detection of sleep apnea from Single Channel","volume":"20","author":"Signals","year":"2020","journal-title":"Sensors"},{"key":"ref47","doi-asserted-by":"publisher","DOI":"10.1142\/S021951941950026X","article-title":"A novel approach Osa detection using single-Lead Ecg Scalogram based on deep neural network","volume":"19","author":"Singh","year":"2019","journal-title":"J. Mech. Med. Biol."},{"key":"ref48","doi-asserted-by":"publisher","DOI":"10.1088\/1361-6579\/ac826e","article-title":"A systematic review of deep learning methods for modeling electrocardiograms during sleep","volume":"43","author":"Sun","year":"2022","journal-title":"Physiol. Meas."},{"key":"ref49","doi-asserted-by":"publisher","first-page":"110659","DOI":"10.1016\/j.mehy.2021.110659","article-title":"Prediction of obstructive sleep apnea using ensemble of recurrence plot convolutional neural networks (RPCNNs) from polysomnography signals","volume":"154","author":"Taghizadegan","year":"2021","journal-title":"Med. Hypotheses"},{"key":"ref50","doi-asserted-by":"publisher","first-page":"5346","DOI":"10.1016\/j.eswa.2010.10.022","article-title":"A new approach for estimation of obstructive sleep apnea syndrome","volume":"38","author":"Tagluk","year":"2011","journal-title":"Expert Syst. Appl."},{"key":"ref51","doi-asserted-by":"publisher","first-page":"4733","DOI":"10.1007\/s00521-018-3833-2","article-title":"Automatic detection of sleep-disordered breathing events using recurrent neural networks from an electrocardiogram signal","volume":"32","author":"Urtnasan","year":"2020","journal-title":"Neural Comput. & Applic."},{"key":"ref52","doi-asserted-by":"publisher","first-page":"065003","DOI":"10.1088\/1361-6579\/aac7b7","article-title":"Multiclass classification of obstructive sleep apnea\/hypopnea based on a convolutional neural network from a single-lead electrocardiogram","volume":"39","author":"Urtnasan","year":"2018","journal-title":"Physiol. Meas."},{"key":"ref53","first-page":"30","article-title":"Attention is all you need","author":"Vaswani","year":"2017","journal-title":"Adv. Neural Inf. Process. Syst"},{"key":"ref54","doi-asserted-by":"publisher","first-page":"1442","DOI":"10.1056\/nejmcp1816152","article-title":"Obstructive sleep apnea in adults","volume":"380","author":"Veasey","year":"2019","journal-title":"N. Engl. J. Med."},{"key":"ref55","doi-asserted-by":"crossref","DOI":"10.1007\/978-981-15-1100-4","volume-title":"Advancement of machine intelligence in interactive medical image analysis","author":"Verma","year":"2020"},{"key":"ref56","first-page":"6840","author":"Wang","year":"2020"},{"key":"ref57","doi-asserted-by":"publisher","first-page":"93","DOI":"10.1016\/j.cmpb.2019.05.002","article-title":"A RR interval based automated apnea detection approach using residual network","volume":"176","author":"Wang","year":"2019","journal-title":"Comput. Methods Prog. Biomed."},{"key":"ref58","first-page":"453","author":"Wang","year":"2022"},{"key":"ref59","first-page":"361","article-title":"Deep learning for diagnosis and classification of obstructive sleep apnea: A nasal airflow-based multi-resolution residual network","volume-title":"Nature and Science of Sleep","author":"Yue","year":"2021"},{"key":"ref60","doi-asserted-by":"publisher","DOI":"10.1016\/j.bspc.2021.103125","article-title":"Detection of sleep apnea using deep neural networks and single-lead ECG signals","volume":"71","author":"Zarei","year":"2022","journal-title":"Biomed. Signal Process. Control"},{"key":"ref61","first-page":"1","volume-title":"A better autoencoder for image: Convolutional autoencoder","author":"Zhang","year":"2015"},{"key":"ref62","doi-asserted-by":"publisher","first-page":"5594733","DOI":"10.1155\/2021\/5594733","article-title":"Automatic detection of obstructive sleep apnea events using a deep CNN-LSTM model","volume":"2021","author":"Zhang","year":"2021","journal-title":"Comput. Intell. Neurosci."},{"key":"ref63","doi-asserted-by":"publisher","first-page":"2671","DOI":"10.2147\/dmso.s469376","article-title":"J-shaped relationship between weight-adjusted- waist index and cardiovascular disease risk in hypertensive patients with obstructive sleep apnea: a cohort study","volume":"17","author":"Zhao","year":"2024","journal-title":"Diabetes Metab. Syndr. Obes."}],"container-title":["Frontiers in Artificial Intelligence"],"original-title":[],"link":[{"URL":"https:\/\/www.frontiersin.org\/articles\/10.3389\/frai.2026.1727091\/full","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2026,2,11]],"date-time":"2026-02-11T06:50:54Z","timestamp":1770792654000},"score":1,"resource":{"primary":{"URL":"https:\/\/www.frontiersin.org\/articles\/10.3389\/frai.2026.1727091\/full"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2026,2,11]]},"references-count":63,"alternative-id":["10.3389\/frai.2026.1727091"],"URL":"https:\/\/doi.org\/10.3389\/frai.2026.1727091","relation":{},"ISSN":["2624-8212"],"issn-type":[{"value":"2624-8212","type":"electronic"}],"subject":[],"published":{"date-parts":[[2026,2,11]]},"article-number":"1727091"}}