鄭雅純 鄭和裕 林美娜
開發(fā)設(shè)計
基于加法網(wǎng)絡(luò)和自注意力機制的OSA檢測方法
鄭雅純 鄭和裕 林美娜
(廣東工業(yè)大學(xué)自動化學(xué)院,廣東 廣州 510006)
為實現(xiàn)準(zhǔn)確率高且計算復(fù)雜度低的阻塞性睡眠呼吸暫停(OSA)檢測,根據(jù)血氧飽和度(SpO2)提出一種基于加法網(wǎng)絡(luò)和自注意力機制的OSA檢測方法。該方法引入加法網(wǎng)絡(luò)用于SpO2的特征提取,以降低計算復(fù)雜度;采用自注意力機制調(diào)整采樣點間的特征權(quán)重,以提高檢測精度。在數(shù)據(jù)集Apnea-ECG上實現(xiàn)了敏感性94.56%、特異性96.91%的檢測性能,且浮點運算數(shù)量為2.88 K FLOPs,比卷積操作減小了40%。實驗結(jié)果表明:該方法在獲得較高檢測精度的同時,可以保持較低的計算復(fù)雜度。
血氧飽和度;阻塞性睡眠呼吸暫停檢測;加法網(wǎng)絡(luò);自注意力機制
阻塞性睡眠呼吸暫停(obstructive sleep apnea, OSA)表現(xiàn)為睡眠期間患者的呼吸氣流減少或呼吸受阻[1]。研究表明,長期OSA會增加人們患高血壓、冠心病、中風(fēng)等疾病的風(fēng)險[2-4]。2019年,柳葉刀呼吸醫(yī)學(xué)雜志報告顯示:全球30~69歲人群中約9.36億人患有OSA[5]。因此,盡早發(fā)現(xiàn)和治療OSA具有重要意義。血氧飽和度(oxygen saturation, SpO2)是表征OSA事件的參考信號之一[6]。其采集設(shè)備脈搏血氧計具有廉價、簡單和非侵入式等特點[1]。因此,本文采用SpO2作為OSA檢測的參考信號。
過去十幾年間,研究人員提出了許多基于SpO2經(jīng)驗特征的OSA檢測方法。如BURGOS等采用2種時域特征并結(jié)合決策樹實現(xiàn)OSA檢測[7]。MOSTAFA等利用遺傳算法、最小冗余最大相關(guān)性算法等特征選擇算法和人工神經(jīng)網(wǎng)絡(luò)(artificial neural network, ANN)、支持向量機(support vector machine, SVM)等分類器實現(xiàn)OSA檢測[8-9]。BEHAR等利用數(shù)據(jù)特征、患者信息,并結(jié)合邏輯回歸算法檢測OSA[10]。上述方法雖然有效實現(xiàn)OSA檢測,但嚴(yán)重依賴經(jīng)驗參數(shù),且未能很好地提取SpO2潛在的復(fù)雜特征。近年來,不少研究人員將卷積神經(jīng)網(wǎng)絡(luò)應(yīng)用于OSA檢測。如CHAW等構(gòu)建一個具有10個卷積層,32 614個參數(shù)的深度卷積神經(jīng)網(wǎng)絡(luò)檢測OSA[11];VAQU- ERIZO-VILLAR等構(gòu)建基于卷積神經(jīng)網(wǎng)絡(luò)和貝葉斯優(yōu)化方法的網(wǎng)絡(luò)模型預(yù)測兒童OSA的嚴(yán)重程度[12];MOSTAFA等開發(fā)具有自動網(wǎng)絡(luò)結(jié)構(gòu)及超參數(shù)選擇能力的一維卷積網(wǎng)絡(luò)(one dimensional convolutional neural network, CNN1D)檢測OSA[1]。上述方法都取得了顯著成果,但存在以下問題尚未討論:1)卷積網(wǎng)絡(luò)運算量大,運算復(fù)雜度高,不利于在移動設(shè)備,如手表、手機上部署;2)SpO2采集過程中,由于被測者肢體運動產(chǎn)生的大量運動偽跡造成SpO2的非平穩(wěn)變化,影響OSA的檢測精度[13]。
為減少偽跡干擾,提高檢測性能,同時降低模型運算復(fù)雜度,本文提出一種基于加法網(wǎng)絡(luò)(AdderNet)和自注意力機制的OSA檢測方法。同時,構(gòu)建并訓(xùn)練可以準(zhǔn)確識別含有呼吸暫停事件的SpO2片段的網(wǎng)絡(luò)模型,從而實現(xiàn)基于SpO2的OSA檢測。其中,加法網(wǎng)絡(luò)采用L1距離運算代替卷積操作,提取SpO2的波形特征,以降低計算復(fù)雜度[14];自注意力機制用于調(diào)整不同時間采樣點特征的權(quán)重,以適應(yīng)偽跡干擾帶來SpO2的非平穩(wěn)變化。
1.2.1 特征提取
為降低網(wǎng)絡(luò)模型的計算復(fù)雜度,用加法網(wǎng)絡(luò)代替卷積操作,實現(xiàn)SpO2形態(tài)特征的提取。加法網(wǎng)絡(luò)是由CHEN等提出的一種僅含加法計算的網(wǎng)絡(luò),其加法層利用只具有加法的距離度量函數(shù)L1距離,代替卷積神經(jīng)網(wǎng)絡(luò)中的卷積計算,以實現(xiàn)更高的速度和更低的能耗[14]。
1.2.2 特征權(quán)重調(diào)整
為適應(yīng)偽跡干擾帶來的SpO2非平穩(wěn)變化,提高檢測精度,利用自注意力機制生成含有相鄰樣本點間時序關(guān)系的掩碼,以自適應(yīng)調(diào)整特征權(quán)重。自注意力機制是由VASWANI等提出的一種注意力機制,廣泛應(yīng)用于文本識別、機器翻譯等領(lǐng)域[17]。
自注意力機制的數(shù)學(xué)計算過程如下:
1.2.3 基于加法網(wǎng)絡(luò)和自注意力機制的網(wǎng)絡(luò)模型
基于加法網(wǎng)絡(luò)和自注意力機制的網(wǎng)絡(luò)模型(neu- ral network based on AdderNet and Seft-attention, A-S- NN)主要包括輸入層、加法層、自注意力機制、全連接層及Sigmoid激活函數(shù),如圖1所示。
基于加法網(wǎng)絡(luò)和自注意力機制的網(wǎng)絡(luò)的具體數(shù)學(xué)計算如下:
5)特征向量通過全連接層及Sigmoid激活函數(shù)輸出預(yù)測值。
本文采用來自Physionet的公開數(shù)據(jù)集呼吸暫停-心電圖數(shù)據(jù)庫(Apnea-ECG database, AED)中的SpO2數(shù)據(jù)進行實驗[18-19]。AED中有8個含有SpO2數(shù)據(jù)的記錄,這些記錄持續(xù)時間為7 ~10 h。醫(yī)生給出每分鐘的注釋,若該分鐘出現(xiàn)呼吸暫停則標(biāo)注為A,否則標(biāo)注為N。SpO2的采樣頻率為100 Hz。
為適應(yīng)網(wǎng)絡(luò)輸入,去除異常數(shù)據(jù),對原始SpO2數(shù)據(jù)進行預(yù)處理:
1)將采樣頻率降為1 Hz;
2)將數(shù)據(jù)切為1 min的片段;
3)剔除含有異常值的片段,即SpO2低于50%的片段[20]。
根據(jù)受試者不同,將8個記錄劃分為四折交叉驗證對結(jié)果進行評估,具體劃分如表1所示。
表1 四折交叉驗證的數(shù)據(jù)劃分
實驗采用的深度學(xué)習(xí)框架為Pytorch,服務(wù)器CPU為Intel(R) Core(TM) i7-9750H CPU @ 2.60 GHz,內(nèi)存為16 GB。
A-S-NN網(wǎng)絡(luò)的參數(shù)設(shè)置如表2所示。
表2 A-S-NN網(wǎng)絡(luò)參數(shù)設(shè)置
模型訓(xùn)練采用的優(yōu)化器為Adam,迭代步數(shù)為500,學(xué)習(xí)率(learning rate, LR)為
式中,為當(dāng)前已迭代的步數(shù)。
利用靈敏度(sensitivity, Se)、特異性(specificity, Sp),平衡錯誤率(balanced error rate, Ber)來評估模型的檢測性能。
同時,使用浮點運算量(amount of floating point arithmetics, FLOPs)、乘加次數(shù)(amount of multiply- adds, MAdd)和內(nèi)存使用來評估模型所需的算力及其他計算資源,這3個指標(biāo)均由torchstat工具包計算得出。
為驗證本文采用的加法層及自注意力機制的有效性,構(gòu)建以下4種網(wǎng)絡(luò)模型:
1)卷積網(wǎng)絡(luò)(neural network based on convolution, C-NN);
2)卷積及自注意力機制網(wǎng)絡(luò)(neural network based on CNN and Seft-attention, C-S-NN);
3)加法網(wǎng)絡(luò)(neural network based on AdderNet, A-NN);
4)基于加法網(wǎng)絡(luò)和自注意力機制的網(wǎng)絡(luò)(neural network based on AdderNet and Seft-attention, A-S- NN)。
卷積層與加法層的參數(shù)設(shè)置一致,如表2所示。4種網(wǎng)絡(luò)模型的OSA檢測性能對比如表3所示,其中、、為跨被試四折交叉驗證的平均結(jié)果。
表3 4種網(wǎng)絡(luò)模型的OSA檢測性能對比
由表3可以看出:
1)C-S-NN和A-S-NN的檢測性能分別高于C-NN和A-NN,說明自注意力機制能有效減小運動偽跡的干擾,提高檢測性能;
2)A-S-NN與A-NN的浮點運算量、乘加次數(shù)及內(nèi)存使用均小于C-S-NN與C-NN,說明加法層可有效減少計算量;
3)A-S-NN與A-NN的浮點運算量和內(nèi)存使用相等,表明自注意力機制幾乎不增加模型的運算復(fù)雜度。
A-S-NN與其他OSA檢測方法的性能對比如表4所示。
表4 A-S-NN與其他OSA檢測方法的性能對比
由表4可以看出:
1)ANN方法取得最好的檢測性能,但其采用非跨被試方法,即被測者的數(shù)據(jù)同時存在于訓(xùn)練集與測試集,但在實際檢測時,需要先采集新患者數(shù)據(jù)并重新學(xué)習(xí)模型參數(shù),顯然是不合理的;
2) A-S-NN、CNN1D取得了比SVM更好的檢測性能,說明深度學(xué)習(xí)方法更能從數(shù)據(jù)中學(xué)習(xí)到有效信息;
3)與CNN1D相比,A-S-NN的提高了2.7%,提高了1.2%。
為減少SpO2中的運動偽跡干擾,提高OSA檢測性能,同時降低模型運算復(fù)雜度,本文提出一種基于加法網(wǎng)絡(luò)和自注意力機制的OSA檢測方法,并在公開數(shù)據(jù)集AED上獲得較高的OSA檢測精度(: 94.56%,: 96.91%)。首先,與CNN1D相比,、分別提高了2.7%和1.2%;然后,與A-NN相比,提高了0.9%,說明應(yīng)用自注意力機制可有效提高模型的檢測性能;最后,A-S-NN的浮點運算量僅為2.88K FLOPs,比C-S-NN小了約40%,說明加法層可有效降低計算復(fù)雜度。因此,本文提出的A-S-NN能夠在保持較低計算復(fù)雜度的同時,實現(xiàn)較高的OSA檢測性能,適合部署在算力及其他計算資源配置較低的設(shè)備上。
[1] MOSTAFA S S, MENDON?A F, RAVELO-GARCIA A G, et al. Multi-objective hyperparameter optimization of convolu- tional neural network for obstructive sleep apnea detection[J]. IEEE Access, 2020,8:129586-129599.
[2] GROTE L, PLOCH T, HEITMANN J, et al. Sleep-related breathing disorder is an independent risk factor for systemic hypertension[J]. Journal of Hypertension, 2000,18(6):679-685.
[3] MOOE T, FRANKLIN K A, HOLMSTROM K, et al. Sleep-disordered breathing and coronary artery disease: long- term prognosis[J]. American journal of Respiratory and Critical Care Medicine, 2001, 164(10):1910-1913.
[4] MOHSENIN V. Sleep-related breathing disorders and risk of stroke[J]. Stroke, 2001, 32(6):1271-1276.
[5] BENJAFIELD A, AYAS N, EASTWOOD P, et al. Estimation of the global prevalence and burden of obstructive sleep apnoea: a literature-based analysis[J]. The Lancet Respiratory Medicine, 2019, 7(8):687-698.
[6] QUAN S F, GILLIN J C, LITTNER M R, et al. Sleep-related breathing disorders in adults: Recommendations for syndrome definition and measurement techniques in clinical research. editorials[J]. Sleep (New York, NY), 1999, 22(5):667-689.
[7] BURGOS A, GONI A, ILLARRAMENDI A, et al. Real-time detection of apneas on a PDA[J]. IEEE Transactions on Infor- mation Technology in Biomedicine, 2009,14(4):995-1002.
[8] MOSTAFA S S, CARVALHO J P, MORGADO-DIAS F, et al. Optimization of sleep apnea detection using SpO2and ANN[C]//2017 XXVI International Conference On Informa- tion, Communication and Automation Technologies (ICAT). IEEE, 2017:1-6.
[9] MOSTAFA S S, MORGADO-DIAS F, RAVELO-GARCíA A G. Comparison of SFS and mRMR for oximetry feature selection in obstructive sleep apnea detection[J]. Neural Computing and Applications, 2018:1-21.
[10] BEHAR J A, PALMIUS N, LI Q, et al. Feasibility of single channel oximetry for mass screening of obstructive sleep apnea[J]. EClinicalMedicine, 2019, 11:81-88.
[11] CHAW H T, KAMOLPHIWONG S, WONGSRITRANG K. Sleep apnea detection using deep learning[J]. Tehni?ki Glasnik, 2019, 13(4):261-266.
[12] VAQUERIZO-VILLAR F, ALVAREZ D, KHEIRANDIS H -GOZAL L, et al. A convolutional neural network architecture to enhance oximetry ability to diagnose pediatric obstructive sleep apnea[J]. IEEE Journal of Biomedical and Health Informatics, 2021 (99):1-11.
[13] 閆佳運.可穿戴式睡眠監(jiān)護設(shè)備中若干關(guān)鍵技術(shù)研究[D]. 北京:北京工業(yè)大學(xué),2016.
[14] CHEN H, WANG Y, XU C, et al. AdderNet: Do we really need multiplications in deep learning?[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020: 1468-1477.
[15] YAN L, DODIER R H, MOZER M, et al. Optimizing classifier performance via an approximation to the Wilcoxon-Mann-Whitney statistic[C]//Proceedings of the 20th International Conference on Machine Learning (ICML- 03), Washington DC, 2003: 848-855.
[16] RUOPP M D, PERKINS N J, WHITCOMB B W, et al. Youden Index and optimal cut-point estimated from observations affected by a lower limit of detection[J]. Biometrical Journal: Journal of Mathematical Methods in Biosciences, 2008, 50(3): 419-430.
[17] VASWANI A, SHAZEER N, PARMAR N, et al. Attention is all you need[J]. arXiv preprint arXiv:1706.03762, 2017.
[18] GOLDBERGER A L, AMARAL L A N, GLASS L, et al. PhysioBank, PhysioToolkit, and PhysioNet: components of a new research resource for complex physiologic signals[J]. Circulation, 2000,101(23):215-220.
[19] PENZEL T, MOODY G B, MARK R G, et al. The apnea- ECG database[C]//Computers in Cardiology 2000, IEEE, 2000: 255-258.
[20] XIE B, MINN H. Real-time sleep apnea detection by classifier combination[J]. IEEE Transactions on Information Technology in Biomedicine, 2012,16(3):469-477.
OSA Detection Method Based on Additive Network and Self-attention Mechanism
Zheng Yachun Zheng Heyu Lin Meina
(School of Automation, Guangdong University of Technology, Guangzhou 510006, China)
In order to achieve obstructive sleep apnea (OSA) detection with high accuracy and low computational complexity, according to blood oxygen saturation (SpO2) proposes an OSA detection method based on additive network and self-attention mechanism. In this method, additive network is introduced for SpO2feature extraction to reduce the computational complexity; self-attention mechanism is used to adjust the feature weight between sampling points to improve the detection accuracy. The detection performance of sensitivity 94.56%, specificity 96.91% and floating-point operation are realized on data set Apnea-ECG. The number is 2.88 K flops, which is 40% less than the convolution operation. The experimental results show that this method can obtain high detection accuracy and maintain low computational complexity.
oxygen saturation; obstructive sleep apnea detection; AdderNet; Seft-attention mechanism
鄭雅純,女,1996年生,碩士研究生,主要研究方向:模式識別,機器學(xué)習(xí),生物信號處理。E-mail: zheng_yachun@163.com
鄭和裕,男,1996年生,碩士研究生,主要研究方向:模式識別,機器學(xué)習(xí),生物信號處理。E-mail: zheng_hy1209@qq.com
林美娜,女,1997年生,碩士研究生,主要研究方向:模式識別,生物信號處理。E-mail: meina.lin@mail.gdut.edu.cn
TP391
A
1674-2605(2021)06-0008-06
10.3969/j.issn.1674-2605.2021.06.008