Print

发布时间: 2020-10-25
摘要点击次数:
全文下载次数:
DOI: 10.11834/jig.200203
2020 | Volume 25 | Number 10




    研究应用    




  <<上一篇 




  下一篇>> 





TSCNN:面向可穿戴心电信号监测与分析的卷积神经网络
expand article info 孟琭1, 葛康1, 宋阳2, 杨东溟3
1. 东北大学信息科学与工程学院, 沈阳 110819;
2. 北京瑞尔视景科技有限公司, 北京 100000;
3. 盘锦市中心医院, 盘锦 124000

摘要

目的 可穿戴设备能够长时间实时监测人体心脏状况,其在心电信号监测领域应用广泛。但目前仍没有公开的来自可穿戴设备的心电数据集,大部分心电信号分析算法都是针对医院设备所采集的心电数据。因此,本文使用IREALCARE 2.0柔性远程心电贴作为心电信号监测和采集设备制作了可穿戴设备的心电数据集。针对可穿戴心电数据干扰多、数据量大等特点,本文提出了一种针对可穿戴设备获得的心电信号进行自动分类的深层卷积神经网络,称之为时空卷积神经网络(time-spatial convolutional neural networks,TSCNN)。方法 将原始的长时间心电信号分割为单个的心搏并与滤波后不同频段的心搏数据组合成十通道的数据输入到TSCNN中。TSCNN对每个心搏使用时间卷积和空间滤波来提取丰富的特征。采用小卷积核级联卷积的方式提高分类性能,并降低网络的参数量和计算量。结果 在本文制作的心电数据集上进行了测试,并与其他4种心电分类算法:CNN(convolutional neural networks)、RNN(recurrent neural networks)、1-DCNN(1-dimensional convolution neural networks)和DCN(dense convolutional networks)进行了比较。实验结果显示,本文方法的分类准确率达到91.16%,优于其他4种方法。结论 本文方法面向可穿戴心电数据,获得了较好的分类性能,可以有效监控穿戴者是否出现了心电异常情况。

关键词

可穿戴设备; 可穿戴心电数据集; 心脏监测; 卷积神经网络; 空间滤波

TSCNN: a convolutional neural network for the monitoring and analysis of the electrical signals of the heart from wearable devices
expand article info Meng Lu1, Ge Kang1, Song Yang2, Yang Dongming3
1. College of Information Science and Engineering, Northeastern University, Shenyang 110819, China;
2. Beijing Irealcare Technology Pte., Ltd., Beijing 100000, China;
3. Panjin Central Hospital, Panjin 124000, China
Supported by: National Natural Science Foundation of China (61973058); Fundamental Research Funds for the Central Universities (N2004020)

Abstract

Objective Wearable devices are expanding in terms of electrocardiograms (ECG) because they can portably monitor the heart condition of a human for a long time. The key for wearable devices to monitor heart conditions in real time is to be able to process the collected ECG data automatically. Therefore, an efficient and reliable classification algorithm for ECG data from wearable devices should be designed. Many ECG classification algorithms have been proposed in recent years. They are mainly divided into two categories: one is based on handcrafted features, and the other is based on deep learning. Classification methods based on artificial features need to design various features manually, and many useful features are often ignored. The deep learning method can automatically extract features, and it has achieved good performance in image classification, object recognition, and natural language processing. However, no ECG data set from wearable devices is publicly available. Most ECG analysis algorithms are aimed at ECG data collected using hospital equipment. The ECG signal collected using wearable devices is susceptible to various interferences due to the body movement of people and changes in the surrounding environment, resulting in various noises in the signal. Therefore, many methods that perform well in ECG data sets collected using hospital equipment cannot achieve accurate classification of ECG data from wearable devices. In this study, we used IREALCARE 2.0 flexible cardiac monitor patch as the wearable device to collect ECG signals and make ECG data sets. It has the characteristics of small size, lightweight, and accurate and reliable measurement. The ECG data set came from 38 subjects and mainly included five types of heartbeats: normal, ventricular premature beat (VPB), supraventricular premature beat (SPB), atrial fibrillation (AF), and interference. In accordance with the characteristics of ECG data from wearable devices, such as considerable interference and large amount of data, this study proposed a deep convolutional neural network (CNN) named time-spatial CNN (TSCNN) for the automatic classification and analysis of ECG signals from wearable devices. Method TSCNN consisted of seven convolutional layers, four pooling layers, and one fully connected layer. It also comprised a convolution-pooling block, three convolution-convolution-pooling blocks, and a classification layer. First, the original long-term ECG signals were divided into separate heartbeats. We regarded the 600 data points around R-wave coordinates as one heartbeat, combined them with filtered heartbeat data of different frequency bands into 10 channels of data, and input them into TSCNN. Second, we applied convolution over time and spatial filtering for each heartbeat, which could effectively expand the receptive field of the network to extract abundant features. Lastly, cascaded convolution with a small convolution kernel was applied to improve classification performance and reduce the amount of network parameters and computation. In accordance with the input data size of each layer, we adopted three convolution kernels of different sizes. The convolution kernels in the three convolution-convolution-pooling blocks were 10×1, 5×1, and 3×1 in sequence with stride 1×1. The fully connected layer was used as the classification layer. Some regularized methods, such as dropout and batch normalization, were adopted to avoid overfitting. The batch normalization layer was placed after the convolutional layer and before the nonlinear layer, which made the input value of the nonlinear transformation function fall into a region sensitive to the input, to avoid the problem of gradient disappearance. Dropout randomly set some hidden layer nodes to zero during each iteration, which could reduce the interaction among hidden layer nodes. Result The proposed method was evaluated on the ECG data set produced in this paper and compared with four other ECG classification algorithms: CNN, recurrent neural network, 1D CNN (1-DCNN), and dense convolutional network (DCN). We used 10 records containing 138 853 heartbeats as the training set, and the test data were collected from 28 subjects, which contained 241 896 heartbeats. Results showed that the method in this paper achieved an overall accuracy of 91.16%, and the accuracies of normal, VPB, SPB, AF, and interference were 89.17%, 92.99%, 62.03%, 91.56%, and 94.89%, respectively. Comparative experiments indicated that our method was better than the four other methods in overall accuracy and the accuracies of normal, VPB, SPB, and AF and achieved a great improvement. Compared with 1-DCNN, the proposed method demonstrated increased overall accuracy by 7.25% and increased accuracies of normal, VPB, SPB, and AF by 18.13%, 12.67%, 9.29%, and 23.96%, respectively. Compared with DCN, the proposed method exhibited increased overall accuracy by 5.88% and increased accuracies of normal, VPB, SPB, and AF by 16.88%, 8.41%, 11.73%, and 20.32%, respectively. In addition, the classification results of our method were balanced, and the recognition capability for each class was similar. We also conducted a comparative experiment with and without spatial filtering. The experimental results demonstrated that spatial filtering could improve the classification performance of the network, and the overall accuracy increased from 88.17% to 91.16%. We further trained and evaluated deep networks that use cascaded convolution with a small convolution kernel and shallow networks that do not use it. The comparative experiment results showed that using cascaded convolution with a small convolution kernel could improve the classification capability of the network, in which the overall accuracy was increased by 1.56%; it also effectively reduced the amount of network parameters and calculations, thus increasing the processing speed. Conclusion In this study, we proposed TSCNN to classify ECG signals from wearable devices. The experimental results indicated that the proposed method can achieve good classification performance for ECG data from wearable devices and effectively monitor whether the wearer has abnormal ECG.

Key words

wearable devices; wearable ECG dataset; cardiac monitoring; convolutional neural network(CNN); spatial filtering

0 引言

心血管疾病是一种高危疾病。根据世界卫生组织(World Health Organization)的数据,心血管疾病每年在全世界造成1 500多万人死亡,在所有死因中排名第1,其对人类的健康构成了极大威胁。心电图(electrocardiogram, ECG)在心血管疾病的诊断中起着重要的作用。心电图记录的是心脏在每一个心动周期(心跳)中人体生理电信号的变化情况。通过分析心电图波形,可以发现心律失常的异常情况(Li等,2018)。不同类型的心律失常对应不同形状的心电图波形,医生可以通过心电图来判断病人的心脏是否健康。但通常获得的心电数据量很大,仅仅依靠医生人工分析工作量太大。因此,利用计算机辅助诊断(computer-aided diagnosis, CAD)技术实现心电图的自动分类是有必要的。

一些心血管疾病的发作具有偶然性、突发性,因此对人体心脏进行实时监测对心血管疾病的防治具有重要意义。可穿戴设备在这方面具有很大的应用价值(Carrera等,2019),可以24 h监测心脏,通过分析获得的心电图了解心脏的健康状况,如果出现心跳异常等情况,可以在第一时间反馈给患者和医生。可穿戴设备实时监测心脏的关键是能够自动处理采集到的心电图,而无需人为参与。因此,设计一种高效、可靠的用于可穿戴心脏监护设备的心电信号分类算法具有重要的实际意义。

对可穿戴心电信号进行自动分类是一项具有挑战性的课题。因为人们在佩戴可穿戴设备时是移动的,周围环境不断变化,所以容易受到各种干扰,测得的心电图比在医院中测得的心电图存在更多的噪声。除此之外,不同类型的心电信号出现频率不同,有的疾病频繁出现,有的疾病很少出现,导致训练数据的不平衡,从而影响系统的性能。

一般来说,心电信号的分析主要有4个步骤:1)数据预处理;2)心电信号分割;3)特征提取;4)分类(Li等,2018)。数据预处理通常包括去除高频噪声和去除基线。心电信号分割是将一个长时间的心电信号序列分割成多个心搏,这通常是通过检测QRS波来完成的(Mondéjar-Guerra等,2019)。国内外学者提出的一些心电信号分割算法,都取得了良好的效果(Yeh和Wang,2008Li等,2014Li和Wang,2013)。特征提取和分类是准确识别心血管疾病的关键步骤,因此本文重点研究了这两个部分。

许多学者对心电信号分类算法进行了探索和研究,主要分为两类:基于人工特征的分类方法和基于深度学习的分类方法。基于人工特征的方法需要从心电信号中计算出各种特征(Bouaziz等,2014Lin和Yang,2014),并将其输入到分类器中进行分类。然而,由于心血管疾病的多样性和不同患者个体之间存在差异,人工设计的特征往往忽略了许多潜在的有用特征。深度学习方法能够自动提取特征,在图像分类(Zuo等,2015Lopes等,2017)、自然语言处理(Giménez等,2020)和文本识别(He等,2016)等方面取得了良好效果。因此,目前有许多基于卷积神经网络(convolutional neural network,CNN)的心电分类方法(Ji等,2019Al Rahhal等,2018Pourbabaee等,2018),但这些方法使用的数据是公开的心电数据集,而不是可穿戴设备采集到的心电数据。针对这些问题,本文制作了可穿戴心电数据集并提出了一种基于CNN的可穿戴心电信号分类方法。首先将长时间的心电信号分成许多单个的心搏(如图 1所示),并将这些心搏信号输入到网络中。然后对每个心搏信号先随着时间轴进行卷积,再进行空间滤波(Schirrmeister等,2017)。这样,网络可以提取到更广泛的特征,并且降低了计算量。同时采用小卷积核级联卷积(卷积—卷积—池化)的方式,降低了网络参数量和计算复杂度。该网络被称为时空卷积神经网络(time-spatial convolutional neural networks, TSCNN)。

图 1 一个心搏由一个P波、一个QRS波和一个T波构成
Fig. 1 A heartbeat consists of a P wave, a QRS complex and a T wave

本文的主要工作和贡献为:

1) 使用IREALCARE 2.0柔性远程心电贴采集心电数据,并制作了心电数据集。截止目前还没有公开的来自可穿戴设备的心电图数据集。

2) 设计了一种针对可穿戴心电信号的深度卷积神经网络,由7个卷积层、4个池化层和1个全连接层组成。本文将原始的单通道心电信号进行滤波得到不同频段的心电信号,然后与原始心电信号组合成十通道的数据作为TSCNN的输入。在第1层中,应用了时间卷积和空间滤波,时间卷积提取时间轴上的心电信号特征,空间滤波提取空间上各个通道之间的心电信号特征,这样既提取到时间域上的特征又能提取到不同频段上的特征,从而提高了网络对心电信号分类的能力。同时为了避免过拟合,采用了Dropout和批量标准化等正则化方法。

3) 采用小卷积核级联卷积的方式。并且实验对比了使用小卷积核级联卷积的深层网络和使用大尺寸卷积核的浅层网络。实验结果表明深层网络具有更好的表现和更少的网络参数。

4) 本文方法通过将长时间心电信号分割成单个心搏信号、降低网络参数和计算量等方式,提高了网络的处理速度,使其更适合处理可穿戴心电数据。

1 相关工作

心电图分类研究一直是人们关注的热点。随着科学技术的发展,许多新方法被提出。根据获取特征方式的不同主要分为两类:基于人工特征的方法和基于深度学习的方法。

1.1 基于人工特征的方法

传统的心电分类方法分为特征提取和分类两个阶段。人们提出了多种特征提取技术来揭示心电信号中所包含的有用信息。最常用的是P-QRS-T波中包含的复合特征,主要包括心电信号的幅度、持续时间、位置和形状(Yeh等,2009Korürek和Doǧan,2010Bouaziz等,2014)。此外,QRS波之间的某些间隔也可用来作为特征,例如R-R间隔(Lin和Yang,2014Raj和Ray,2017Chen等,2017)。平均值、最大值、最小值和标准差等统计特征是近年来广泛使用的特征之一(Ergin等,2014Fayn,2011)。形态特征也常用于各种心电信号分类方法中(Mazomenos等,2012Islam和Alajlan,2013),小波变换是一种流行的特征提取技术,因此一些方法利用了基于小波变换得到的特征(Karthikeyan等,2012Li等,2017)。这些特征可以通过简单的计算得到,但在心电信号中有许多更抽象的特征,为了提取这些特征,人们采用了一些特征变换方法。例如主成分分析(principal component analysis,PCA)和线性判别分析(linear discriminant analysis,LDA),都是常用的降维方法,可以将高维空间转化为低维子空间,从而从低维空间中提取特征(Castells等,2007Tantawi等,2013)。而分类则是通过分类器实现,常用的分类器有支持向量机(support vector machine, SVM)、人工神经网络(artificial neural networks, ANN)、K近邻(K nearest neighbor, KNN)和贝叶斯分类器等。Mondéjar-Guerra等人(2019)提出了针对每一类特征训练特定的支持向量机模型。Shadmand和Mashoufi(2016)采用基于块的神经网络(block-based neural network, BBNN)作为分类器,从心电信号中提取隐函数系数和时间特征作为BBNN的输入向量。Kutlu和Kuntalp(2011)提出了一种基于K近邻算法的心电信号自动分类系统。Martis等人(2013)用独立成分分析(independent component analysis, ICA)的权重作为朴素贝叶斯和高斯混合模型(Gaussian mixture model, GMM)分类的特征。传统的心电信号分类方法需要研究人员手工设计各种特征,再进行分类。然而,手工设计的特征难免会引入人的主观性,也很难判断哪种特征是可行的,并且会忽略一些有价值的特征。

1.2 深度学习方法

深度学习技术发展迅速,在心电分类中也得到了广泛应用。该方法具有较强的自主学习能力,在心电信号分类方面取得了良好的效果。

Pourbabaee等人(2018)提出了一种将大量原始心电数据作为卷积神经网络输入的方法。它使用带有一个全连接层的CNN直接从大的时域心电信号中学习特征。Kiranyaz等人(2016)应用1维卷积神经网络在MIT_BIH(Massachusetts Institute of Technology Beth Israel Hospital)数据库上取得了良好的表现。Zhang等人(2017)使用循环神经网络(recurrent neural networks, RNN)学习心电图的形态学特征。Yildirim等人(2019)用长—短期记忆网络(long-short term memory, LSTM)自动识别心律失常。由于患者个体的差异,一些学者提出了针对特定患者的算法。例如,Li等人(2018)在常用的心电图数据库上训练CNN模型,然后采集特定病人的几分钟时长的心电信号输入到模型中进行训练来发现其个性特征。Wang等人(2019)提出了一种基于循环神经网络和主动学习的全局可更新系统。利用主动学习对训练集进行动态更新。当输入新样本时,选择信息量最大的样本并将其添加到训练集中,然后对全局模型进行优化。CNN将传统分类方法的特征提取和分类相结合,由于其具有强大的特征提取能力,提高了ECG分类的准确性。

1.3 面向可穿戴心电数据

可穿戴设备可以24 h实时监测心脏,被越来越多人使用。许多学者提出了针对可穿戴设备的心电信号分类算法。Carrera等人(2019)提出了一种在线心电监护方案。每个特定用户的正常心跳由字典进行建模,产生稀疏表示,然后计算心跳与字典之间的距离,不符合此模型的心搏被检测为异常。Sopic等人(2018)提出了基于随机森林的实时事件驱动分类方法,该方法使用了与置信度相关的决策过程。

上述针对可穿戴设备的心电分类算法是基于传统的机器学习方法,需要手工提取特征,这增加了计算复杂度。深度学习方法通过对大量的心电数据进行训练,能够自动有效地学习高层次特征,因此,本研究针对可穿戴设备的特点,设计了一种基于卷积神经网络的心电信号分类方法。

2 可穿戴设备

本文使用IREALCARE2.0柔性远程心电贴片作为可穿戴设备,用于监测心脏状况并收集心电信号,它具有体积小、重量轻以及测量数据准确可靠的特点。

IREALCARE 2.0的整体外观如图 2(a)(b)所示。它非常小巧和轻便,大小为8 cm(长)×3.1 cm(宽)×0.8 cm(厚),重量仅为13 g,因此长时间佩戴也不会感到不适。图 2(c)(d)显示了IREALCARE 2.0的组成结构。IREALCARE 2.0的核心组件是印刷电路板(printed circuit board, PCB)(图 2(e))。心电信号测量芯片和蓝牙模块集成在PCB上。其中心电信号测量芯片为ADS1291,这是一种用于生物电势测量的低功耗2通道24位的模拟前端。它集成了低噪声的可编程增益放大器(programmable gain amplifier, PGA)和高分辨率的模数转换器(analog to digital converter, ADC)。其功能是采集和放大心电信号, 并将模拟信号转换为数字信号。由于体积小、功耗低、集成度高和性能优异,已广泛用于医疗测量仪器、信号采集等方面。蓝牙芯片使用的是nrf52832,它具有功能强大、高度灵活、低功耗等特点。

图 2 IREALCARE2.0柔性远程心电贴片
Fig. 2 IREALCARE2.0 flexible cardiac monitor patch
((a) overall appearance; (b) side view; (c) structure diagram; (d) internal structure diagram (e) printed circuit board)

IREALCARE2.0主要工作流程如图 3所示。ADS1291芯片用于采集心电信号,并对心电信号进行滤波和放大,然后将模拟信号转换为数字信号。

图 3 IREALCARE2.0的工作流程图
Fig. 3 Workflow diagram of IREALCARE 2.0

最后,通过蓝牙将其传输到服务器上进行后续处理。在服务器中,本文算法会对心电信号进行分析和分类,并将结果传输给用户和医生。

3 可穿戴心电信号分类方法

本文算法主要分为以下3个部分:心电数据,网络架构和优化方法。

3.1 心电数据

本文使用的心电数据是由38个受试者通过长时间佩戴IRALECARE 2.0采集得到的,IRALECARE 2.0的采样频率为250 Hz,一共得到38条心电数据,每条心电数据中包含大量的心搏数,最少的有71 085个,最多的有134 513个。表 1显示了数据集中每条心电数据的各类心搏数。

表 1 训练集中的每条心电数据包含的各类心搏数
Table 1 Number of heartbeats per record in the training set

下载CSV
编号 N VPB SPB AF I 合计
01 106 830 794 1 0 1 155 108 780
02 64 196 15 25 534 0 555 90 300
03 90 244 7 259 0 0 1 188 98 691
04 72 905 38 7 0 7 047 79 997
05 63 447 6 854 0 0 23 164 93 465
06 0 844 0 87 206 398 88 448
07 87 152 37 017 0 0 1 880 126 049
08 82 478 235 0 0 9 623 92 336
09 90 198 459 18 0 1 515 92 190
10 94 274 1 952 0 0 7 747 103 973
11 112 739 7 546 787 7 911 280 129 263
12 107 043 293 2 0 408 107 746
13 69 617 146 58 0 1 264 71 085
14 65 464 48 0 0 26 441 91 953
15 86 277 241 9 0 4 101 90 628
16 92 968 9 856 34 0 333 103 191
17 107 892 373 4 0 771 109 040
18 77 851 1 586 0 0 2 112 81 549
19 100 723 2 626 3 0 46 103 398
20 95 957 3 544 0 0 3 207 102 708
21 100 983 13 18 0 4 513 105 527
22 67 762 25 698 0 0 170 93 630
23 84 805 0 2 0 49 706 134 513
24 101 825 312 8 0 61 102 206
25 94 450 398 5 0 1 149 96 002
26 78 406 8 931 616 0 136 88 089
27 108 847 2 592 120 0 99 111 658
28 83 939 18 120 0 0 136 102 195
29 84 773 205 4 0 476 85 458
30 122 411 266 10 0 288 122 975
31 101 994 88 0 0 2 172 104 254
32 77 007 10 210 0 0 2 015 89 232
33 99 503 14 6 0 137 99 660
34 91 763 8 785 66 0 1 349 101 963
35 90 829 0 9 107 0 606 100 542
36 68 820 33 6 157 0 3 287 78 297
37 95 851 87 1 220 0 209 97 367
38 120 999 20 1 034 0 836 122 889
总计 3 343 222 157 498 44 830 95 117 160 580 3 801 247

每个心搏都由临床专家进行了标注,一共分为以下5个类别:正常(normal,N),室性早搏(ventricular premature beat,VPB),室上性早搏(supraventricular premature beat, SPB),房颤(atrial fibrillation, AF)和干扰(interruption, I)。同时,训练时对应的标签设置为0,1,2,3,4。图 4显示了不同类别心电图的形态特征。室性早搏的特征是QRS波形比正常QRS波形要宽,并且RR间隔与正常RR间隔相比减少了约20%。SPB的特征是P波出现较早,与正常RR间隔相比,SPB的RR间隔减少了20%以上。AF的特征则没有P波。

图 4 5种类型心电图的形态特征
Fig. 4 The morphological features of 5 classes of ECG
((a) normal ECG waveform; (b) ventricular premature beat; (c) supraventricular premature beat; (d) atrial fibrillation; (e) interruption)

原始心电图是一个长时间序列信号。首先将长时间的心电数据分割为单独的心搏(P-QRS-T波)。然后请临床专家标注出心电图中R波的位置坐标,最后根据R波的坐标来分割出每一个心搏。本文以R波的位置坐标为中心,前后分别各截取300个数据点,共计600个数据点作为一个心搏(如图 5所示)。

图 5 心电数据分割
Fig. 5 ECG data segmentation

由于不同类型的心搏出现的概率不同,因此每条心电数据中5种类别心搏的数据量是不同的,例如,正常心搏的个数远远大于其他类。训练数据的不平衡会影响模型的性能,导致识别准确率下降。因此,针对此问题,调整了训练集(由10个受试者的数据组成)中不同类别心搏的数量。减少了正常心搏的数量,随机选择了大约2%的正常心搏放入训练集,通过调整使得5个类别的心搏数在同一数量级上(如表 2所示)。

表 2 调整后训练集中的每条心电数据包含的各类心搏数
Table 2 Number of heartbeats per record in the training set after adjustment

下载CSV
编号 N VPB SPB AF I 合计
01 2 143 359 1 0 583 3 086
02 1 263 8 25 534 0 277 27 082
03 1 806 3 625 0 0 580 6 011
04 1 459 20 7 0 3 484 4 970
05 1 270 3 401 0 0 11 561 16 232
06 0 427 0 43 618 178 44 233
07 1 749 18 384 0 0 939 21 072
08 1 650 114 0 0 4 825 6 589
09 1 808 221 18 0 786 2 833
10 1 887 974 0 0 3 894 6 755
总计 15 035 27 533 25 560 43 618 27 107 138 853

为了解心电信号在各频段上的信息,本文使用傅里叶变换对心电信号进行了频谱分析,可穿戴心电设备的采样频率为250 Hz,根据香农采样定理,对在0.1~125 Hz频率范围内的心电信号进行了频谱分析,结果如图 6所示。发现心电信号的频谱主要集中在0.1~40 Hz和100~125 Hz范围内,其低频部分是心脏的生理电信号所产生的,高频部分主要是由噪声和干扰引起的。

图 6 心电信号的频率分析
Fig. 6 Spectrum analysis of the ECG signals

本文使用的心电数据是由单通道传感器收集的,因此得到的心电信号是1维数据。为了将1维数据转换为2维数据,本文对不同频率范围内的原始心电信号进行了滤波以获得多通道数据。根据频率分析的结果,设计10个通道:将原始心电信号用做通道#1,将滤波后的心电信号按0.1~5 Hz,5~10 Hz,10~15 Hz,15~20 Hz,20 ~25 Hz,25~30 Hz,30~35 Hz,35~40 Hz,100~125 Hz分为9组,并作为通道#2,#3,#4,#5,#6,#7,#8,#9,#10。因此,原始的心电信号传感器可以看做被转换为10个虚拟传感器(virtual sensor),这些虚拟传感器可以视为一个传感器组,每个虚拟传感器采集不同频段的心电信号,这意味着各个频段的特征信息都被提取到了。然后,可以在10通道的心电数据上使用2维空间滤波,而不是仅仅使用1维卷积,从而获得更丰富的特征。

3.2 网络架构

网络的总体架构如图 7所示(“25,50,100,200”表示的是特征图的数量),一共由7个卷积层、4个池化层和1个全连接层构成,其中包含1个“卷积—池化层”,3个“卷积—卷积—池化层”和1个输出层。以R波坐标为中心的前后各300个数据点视为一个心搏,然后将原始的心搏数据和经过滤波后各个频段的心搏数据组合在一起,共10个通道输入到网络中。首先对每个心搏随着时间轴进行卷积(卷积核为10×1),然后对获得的所有特征图随着空间轴进行卷积(卷积核为1×10)。紧接着是常规的卷积层和池化层,即:每两个卷积层之后接一个池化层。最后,全连接层作为分类层输出结果,根据心电数据的类别数量,输出节点设置为5个。

图 7 TSCNN的网络结构图
Fig. 7 The overall architecture of TSCNN

根据每一层的输入数据大小,网络中采用了3种不同大小的卷积核。3个“卷积—卷积—池化层”中的卷积核分别为10×1、5×1、3×1,步长为1×1。其中池化层使用的是最大池化,核大小为3×1,步长为3×1。网络中的激活函数使用的是ELUs (exponential linear units) (Clevert等,2016),ELUs激活函数与ReLU(rectified linear unit)函数一样都是不带参数的,而且收敛速度比ReLU函数更快。

在训练过程中,使用交叉熵函数作为损失函数,其已广泛应用于各种分类任务中。交叉熵函数定义为

$ H(p, q) = \sum\limits_x p (x)\log q(x) $ (7)

式中,$p$$q$分别表示真实标签和预测的概率分布。

交叉熵函数计算的是标签的概率分布与预测的概率分布之间的距离。训练时选择Adam作为优化器来更新模型参数。

3.3 优化方法

为了提高模型分类的准确性和泛化能力,本文采用了Dropout和批量标准化等正则化方法。批量标准化将网络各层的输入标准化为均值为0、方差为1的标准正态分布,这使得非线性变换函数的输入值落入对输入敏感的区域,从而避免了梯度消失的问题。在每次训练迭代过程中,Dropout会将一些隐藏层节点随机设置为零,从而减少隐藏层节点之间的交互,避免过拟合。

此外,本文还采用了小卷积核级联卷积的方式。级联卷积能够扩展感受野,多个小卷积核级联卷积和单个大卷积核卷积的特征提取能力是相同的,例如,使用3×3卷积核连续卷积2次和5×5卷积核卷积1次的提取特征能力是相同的。并且使用小卷积核级联卷积能够减少网络参数和降低计算量(例如:2个3×3卷积核级联卷积代替1个5×5卷积核可以减少28%的参数量和计算量),从而提高了网络的训练速度和处理速度。小卷积核级联卷积具有更多的非线性激活层,增加了判别能力,从而提高了网络的分类效果。

4 实验

4.1 实验设置

网络采用PyTorch框架进行搭建。实验过程是在NVIDIA GeForce GTX 1080 GPU上进行的,内存为16 GB,显存为8 GB。其中batch设置为128,Dropout的比率设置为0.5。训练的迭代次数设置为100。为了避免网络参数的初始设置(随机)等其他客观因素对训练效果的影响,本文进行了大量的训练实验,最终选择效果较好的模型进行测试。

实验数据通过可穿戴设备IRALECARE 2.0采集得到。训练数据和测试数据都来自不同的受试者,这样能更好地反映出模型的泛化能力。本文使用了来自10名受试者,共138 853个心搏的心电数据作为训练集,表 3展示了每类(N,VPB,SPB,AF,I)的心搏数。测试数据来自28名受试者,一共包含了241 896个心搏,各类别(N、VPB、SPB、AF、I)的心搏数如表 4所示,其中AF和SPB两类的受试者人数较少,因此AF和SPB的心搏数远小于干扰和VPB的心搏数。

表 3 训练集中各类的心搏数
Table 3 Number of heartbeats in the training set

下载CSV
N VPB SPB AF I 总计
数量 15 035 27 533 25 560 43 618 27 107 138 853
占比/% 10.83 19.83 18.41 31.41 19.52 100

表 4 测试集中各类的心搏数
Table 4 Number of heartbeats in the test set

下载CSV
N VPB SPB AF I 总计
数量 21 032 94 345 17 518 7 911 101 090 241 896
占比/% 8.69 39 7.24 3.27 41.79 100

4.2 实验结果

4.2.1 实验结果与其他算法对比

在测试集上对本文方法进行了实验,得到预测结果的总体准确率和每一个类别的准确率。总体准确率表示的是对所有5种心搏类型的识别准确率,而单类准确率表示的是对某一种心搏类型的识别准确率。预测结果见表 5。同时,在同一数据集上测试了CNN (Pyakillya等,2017)、RNN (Pyakillya等,2017)、1-DCNN (1-dimensional convolutional neural networks)(Kiranyaz等,2016)和DCN(dense convolutional networks)(Al Rahhal等,2019)等几种方法。其中CNN和RNN的程序是从GitHub(https://GitHub.com/ismorphism/DeepECG)获取,1-DCNN和DCN是根据其论文描述构建的。为了避免客观条件的影响,所有实验的硬件条件是相同的。实验结果如表 5所示。

表 5 实验结果及与其他算法对比
Table 5 Experimental results and comparison with other algorithms  

下载CSV
/%
方法 总体 N VPB SPB AF I
CNN 81.39 81.37 71.75 41.28 58.74 99.14
RNN 74.25 80.98 66.86 8.01 8.25 95.85
1-D CNN 83.91 71.04 80.32 52.74 67.6 96.62
DCN 85.28 72.29 84.58 50.30 71.24 97.88
TSCNN(本文) 91.16 89.17 92.99 62.03 91.56 94.89
注:加粗字体为每列最优值。

表 5所示,本文方法在4个类别(N, VPB, SPB, AF)的单项准确率中取得了最好表现,因此在总体的准确率表现上本文算法取得了第1。与DCN相比,总体准确率提高了5.88%,VPB、SPB和AF的准确率分别提高了8.41%、11.73%和20.32%。与1-DCNN相比,总体准确率提高了7.25%,SPB的准确率提高了9.29%。与CNN相比,正常心搏的识别准确率提高了7.8%。从表 5可以看出,本文方法的分类结果比较均衡,对每一类的识别能力相当,而其他4种方法侧重某一类别。结果显示这4种方法对SPB的识别率都较低。主要原因如下:SPB患者人数少,训练集中的样本主要来自1~2名受试者,而测试集中的样本来自其他受试者。由于个体间存在差异,所以识别效果较差。另外,可穿戴设备容易受到干扰,导致心电数据中出现大量的杂波,使波形与其他类型的波形相似。CNN、RNN、1-DCNN、DCN在干扰的识别上优于本文方法,但这些方法容易将其他类别误认为干扰,而本文方法能更好地消除干扰的影响。

4.2.2 空间滤波对结果的影响

为了提取更丰富的特征,本文使用了空间滤波的方法,可以得到描述不同通道心电数据之间的关联特征。为了验证空间滤波对识别准确率的影响,图 7(TSCNN)和图 8(TCNN(temporal comolutional neural network))中分别展示了有无空间滤波的两种网络结构。两种网络的输入和网络参数都相同,区别在于TSCNN不仅进行时间卷积,还进行了空间滤波,而TCNN没有空间滤波。在同一实验环境下分别训练和测试了这两种网络。实验结果见表 6。可以观察到空间滤波提高了模型的性能。总体准确率提高2.99%,正常(N)、VPB、SPB和AF的单项准确率分别提高0.55%、4.78%、6.16%和16.51%。

图 8 TCNN的网络结构图(无空间滤波)
Fig. 8 The overall architecture of TCNN (without spatial filtering)

表 6 实验对比结果
Table 6 Experimental comparison results  

下载CSV
/%
方法 总体 N VPB SPB AF I
TSCNN 91.16 89.17 92.99 62.03 91.56 94.89
TCNN 88.17 88.62 88.21 55.87 75.05 95.28

4.2.3 小卷积核级联卷积对结果的影响

为了提高TSCNN的分类性能,本文采用了小卷积核级联卷积的方式,在本文提出的深层网络(deep network)中有3个“卷积—卷积—池化块”。为了说明小卷积核级联卷积的优点,本文还设计了一个由4个“卷积—池化块”和1个全连接层组成的使用大尺寸卷积核的浅层网络(shallow network)。第1个“卷积—池化层”和最后一个全连接层的结构与图 7中的深层网络相同,只是将深层网络的“卷积—卷积—池化块”改为常用的“卷积—池化块”。同时,为了使网络的感受野与深层网络相同,将3个“卷积—池化块”的卷积核大小分别设置为19×1、9×1和5×1。其他的网络参数与深层网络相同。

采用同样的方法训练和测试了深层网络和浅层网络。图 9是实验结果的直方图, 可以看出,深层网络的性能优于浅层网络。总体准确率从89.6%(浅层网络)提高到91.16%(深层网络),表明采用小卷积核级联卷积可以提高网络的分类能力,因为深层网络具有更多的非线性激活层,提高了识别能力。实验中保存了两个网络的模型参数。深层网络和浅层网络的参数文件大小分别为7.1 MB和7.7 MB。因此,可以看出使用小卷积核级联卷积可以降低网络参数。

图 9 深层网络和浅层网络的对比实验
Fig. 9 Comparative experiment of deep network and shallow network

5 结论

针对目前没有公开的可穿戴心电数据集,通过使用可穿戴设备IREALCARE 2.0采集心电信号并制作了可穿戴心电数据集。针对可穿戴心电信号干扰多、数据量大的问题,提出了一种基于卷积神经网络的可穿戴心电信号分类方法。通过对心电信号进行滤波得到不同频段的心电信号,并同时在时间和空间上对心电信号进行卷积,从而提取到更丰富的特征。通过将长时间的心电信号分割为单个心搏,并采用小卷积核级联卷积的方式降低网络参数,使其更适合于可穿戴设备。实验结果表明,本文方法与CNN、RNN、1-DCNN和DCN相比,取得了最佳和最均衡的表现。同时,通过对比实验验证了空间滤波和级联卷积可以有效地提高分类准确率。该方法虽然取得了很好的效果,但仍存在不足。例如,数据集中的SPB和AF样本数少于其他类,可能会影响模型的性能。在之后的研究工作中,将采集更多的可穿戴心电数据,并对其他的心律失常类别进行识别。

参考文献

  • Al Rahhal M M, Bazi Y, Al Zuair M, Othman E, BenJdira B. 2018. Convolutional neural networks for electrocardiogram classification. Journal of Medical and Biological Engineering, 38(6): 1014-1025 [DOI:10.1007/s40846-018-0389-7]
  • Al Rahhal M M, Bazi Y, Almubarak H, Alajlan N, Al Zuair M. 2019. Dense convolutional networks with focal loss and image generation for electrocardiogram classification. IEEE Access, 7: 182225-182237 [DOI:10.1109/ACCESS.2019.2960116]
  • Bouaziz F, Boutana D, Benidir M. 2014. Multiresolution wavelet-based QRS complex detection algorithm suited to several abnormal morphologies. IET Signal Processing, 8(7): 774-782 [DOI:10.1049/iet-spr.2013.0391]
  • Carrera D, Rossi B, Fragneto P, Boracchi G. 2019. Online anomaly detection for long-term ECG monitoring using wearable devices. Pattern Recognition, 88: 482-492 [DOI:10.1016/j.patcog.2018.11.019]
  • Castells F, Laguna P, Sörnmo L, Bollmann A, Roig J M. 2007. Principal component analysis in ECG signal processing. EURASIP Journal on Advances in Signal Processing, 2007: 074580 [DOI:10.1155/2007/74580]
  • Chen S S, Hua W, Li Z, Li J, Gao X J. 2017. Heartbeat classification using projected and dynamic features of ECG signal. Biomedical Signal Processing and Control, 31: 165-173 [DOI:10.1016/j.bspc.2016.07.010]
  • Clevert D A, Unterthiner T and Hochreiter S. 2016. Fast and accurate deep network learning by exponential linear units (ELUs)[EB/OL].[2020-03-10]. https://arxiv.org/pdf/1511.07289.pdf
  • Ergin S, Uysal A K, Gunal E S, Gunal S and Gulmezoglu M B. 2014. ECG based biometric authentication using ensemble of features//Proceedings of the 2014 9th Iberian Conference on Information Systems and Technologies (CISTI). Barcelona: IEEE: 1-6[DOI:10.1109/CISTI.2014.6877089]
  • Fayn J. 2011. A classification tree approach for cardiac ischemia detection using spatiotemporal information from three standard ECG leads. IEEE Transactions on Biomedical Engineering, 58(1): 95-102 [DOI:10.1109/TBME.2010.2071872]
  • Giménez M, Palanca J, Botti V. 2020. Semantic-based padding in convolutional neural networks for improving the performance in natural language processing. A case of study in sentiment analysis. Neurocomputing, 378: 315-323 [DOI:10.1016/j.neucom.2019.08.096]
  • He P, Huang W L, Qiao Y, Loy C C and Tang X O. 2016. Reading scene text in deep convolutional sequences//Proceedings of the 30th AAAI Conference on Artificial Intelligence. Phoenix: AAAI Press: 3501-3508
  • Islam M S, Alajlan N. 2013. A morphology alignment method for resampled heartbeat signals. Biomedical Signal Processing and Control, 8(3): 315-324 [DOI:10.1016/j.bspc.2012.11.006]
  • Ji Y S, Zhang S, Xiao W D. 2019. Electrocardiogram classification based on faster regions with convolutional neural network. Sensors, 19(11): 2558 [DOI:10.3390/s19112558]
  • Karthikeyan P, Murugappan M, Yaacob S. 2012. ECG signal denoising using wavelet thresholding techniques in human stress assessment. International Journal on Electrical Engineering and Informatics, 4(2): 306-319 [DOI:10.15676/ijeei.2012.4.2.9]
  • Kiranyaz S, Ince T, Gabbouj M. 2016. Real-time patient-specific ECG classification by 1-D convolutional neural networks. IEEE Transactions on Biomedical Engineering, 63(3): 664-675 [DOI:10.1109/TBME.2015.2468589]
  • Korürek M, Doǧan B. 2010. ECG beat classification using particle swarm optimization and radial basis function neural network. Expert Systems with Applications, 37(12): 7563-7569 [DOI:10.1016/j.eswa.2010.04.087]
  • Kutlu Y, Kuntalp D. 2011. A multi-stage automatic arrhythmia recognition and classification system. Computers in Biology and Medicine, 41(1): 37-45 [DOI:10.1016/j.compbiomed.2010.11.003]
  • Li H Q, Wang X F. 2013. Detection of electrocardiogram characteristic points using lifting wavelet transform and Hilbert transform. Transactions of the Institute of Measurement and Control, 35(5): 574-582 [DOI:10.1177/0142331212460720]
  • Li H Q, Wang X F, Chen L, Li E B. 2014. Denoising and R-Peak detection of electrocardiogram signal based on EMD and improved approximate envelope. Circuits, Systems, and Signal Processing, 33(4): 1261-1276 [DOI:10.1007/s00034-013-9691-3]
  • Li H Q, Yuan D Y, Ma X D, Cui D Y, Cao L. 2017. Genetic algorithm for the optimization of features and neural networks in ECG signals classification. Scientific Reports, 7: 41011 [DOI:10.1038/srep41011]
  • Li Y Z, Pang Y W, Wang J, Li X L. 2018. Patient-specific ECG classification by deeper CNN from generic to dedicated. Neurocomputing, 314: 336-346 [DOI:10.1016/j.neucom.2018.06.068]
  • Lin C C, Yang C M. 2014. Heartbeat classification using normalized RR intervals and morphological features. Mathematical Problems in Engineering, 2014: 712474 [DOI:10.1155/2014/712474]
  • Lopes A T, De Aguiar E, De Souza A F, Oliveira-Santos T. 2017. Facial expression recognition with convolutional neural networks:coping with few data and the training sample order. Pattern Recognition, 61: 610-628 [DOI:10.1016/j.patcog.2016.07.026]
  • Martis R J, Acharya U R, Prasad H, Chua C K, Lim C M. 2013. Automated detection of atrial fibrillation using Bayesian paradigm. Knowledge-Based Systems, 54: 269-275 [DOI:10.1016/j.knosys.2013.09.016]
  • Mazomenos E B, Chen T, Acharyya A, Bhattacharya A, Rosengarten J and Maharatna K. 2012. A time-domain morphology and gradient based algorithm for ECG feature extraction//Proceedings of 2012 IEEE International Conference on Industrial Technology. Athens: IEEE: 117-122[DOI:10.1109/ICIT.2012.6209924]
  • Mondéjar-Guerra V, Novo J, Rouco J, Penedo M G, Ortega M. 2019. Heartbeat classification fusing temporal and morphological information of ECGs via ensemble of classifiers. Biomedical Signal Processing and Control, 47: 41-48 [DOI:10.1016/j.bspc.2018.08.007]
  • Pourbabaee B, Roshtkhari M J, Khorasani K. 2018. Deep convolutional neural networks and learning ECG features for screening paroxysmal atrial fibrillation patients. IEEE Transactions on Systems, Man, and Cybernetics:Systems, 48(12): 2095-2104 [DOI:10.1109/TSMC.2017.2705582]
  • Pyakillya B, Kazachenko N, Mikhailovsky N. 2017. Deep learning for ECG classification. Journal of Physics:Conference Series, 913: 012004 [DOI:10.1088/1742-6596/913/1/012004]
  • Raj S, Ray K C. 2017. ECG signal analysis using DCT-based DOST and PSO optimized SVM. IEEE Transactions on Instrumentation and Measurement, 66(3): 470-478 [DOI:10.1109/TIM.2016.2642758]
  • Schirrmeister R T, Springenberg J T, Fiederer L D J, Glasstetter M, Eggensperger K, Tangermann M, Hutter F, Burgard W, Ball T. 2017. Deep learning with convolutional neural networks for EEG decoding and visualization. Human Brain Mapping, 38(11): 5391-5420 [DOI:10.1002/hbm.23730]
  • Shadmand S, Mashoufi B. 2016. A new personalized ECG signal classification algorithm using block-based neural network and particle swarm optimization. Biomedical Signal Processing and Control, 25: 12-23 [DOI:10.1016/j.bspc.2015.10.008]
  • Sopic D, Aminifar A, Aminifar A, Atienza D. 2018. Real-time event-driven classification technique for early detection and prevention of myocardial infarction on wearable systems. IEEE Transactions on Biomedical Circuits and Systems, 12(5): 982-992 [DOI:10.1109/TBCAS.2018.2848477]
  • Tantawi M M, Revett K, Salem A, Tolba M F. 2013. Fiducial feature reduction analysis for electrocardiogram (ECG) based biometric recognition. Journal of Intelligent Information Systems, 40(1): 17-39 [DOI:10.1007/s10844-012-0214-7]
  • Wang G J, Zhang C S, Liu Y P, Yang H Z, Fu D P, Wang H Q, Zhang P. 2019. A global and updatable ECG beat classification system based on recurrent neural networks and active learning. Information Sciences, 501: 523-542 [DOI:10.1016/j.ins.2018.06.062]
  • Yeh Y C, Wang W J. 2008. QRS complexes detection for ECG signal:the difference operation method. Computer Methods and Programs in Biomedicine, 91(3): 245-254 [DOI:10.1016/j.cmpb.2008.04.006]
  • Yeh Y C, Wang W J, Chiou C W. 2009. Cardiac arrhythmia diagnosis method using linear discriminant analysis on ECG signals. Measurement, 42(5): 778-789 [DOI:10.1016/j.measurement.2009.01.004]
  • Yildirim O, Baloglu U B, Tan R S, Ciaccio E J, Acharya U R. 2019. A new approach for arrhythmia classification using deep coded features and LSTM networks. Computer Methods and Programs in Biomedicine, 176: 121-133 [DOI:10.1016/j.cmpb.2019.05.004]
  • Zhang C S, Wang G J, Zhao J W, Gao P F, Lin J P and Yang H Z. 2017. Patient-specific ECG classification based on recurrent neural networks and clustering technique//Proceedings of the 2017 13th IASTED International Conference on Biomedical Engineering (BioMed). Innsbruck: IEEE: 63-67[DOI:10.2316/P.2017.852-029]
  • Zuo Z, Wang G, Shuai B, Zhao L F, Yang Q X. 2015. Exemplar based deep discriminative and shareable feature learning for scene image classification. Pattern Recognition, 48(10): 3004-3015 [DOI:10.1016/j.patcog.2015.02.003]