🔗?运行环境:Matlab
🚩?撰写作者:左手の明天
🥇?精选专栏:《python》
🔥??推荐专栏:《算法研究》
🔐####?防伪水印——左手の明天?####🔐
💗 大家好🤗🤗🤗,我是左手の明天!好久不见💗
💗今天分享Matlab深度学习——波形分割💗
📆? 最近更新:2024 年 01 月 14 日,左手の明天的第?311?篇原创博客
📚?更新于专栏:matlab
🔐####?防伪水印——左手の明天?####🔐
本文主要说明如何使用matlab递归深度学习网络和时频分析来分割人体心电图 (ECG) 信号。?
人类的心电图活动可以作为远离基线信号的振幅序列来测量。对于单个正常心跳周期,ECG 信号可分为以下几种心跳形态:
P 波 - 表示心房去极化的 QRS 复波前的小偏移
QRS 复波 - 心跳的最大振幅部分
T 波 - 表示心室复极化的 QRS 复波后的小偏移
ECG 波形的这些区域的分割可作为基础测量数据用于评估人类心脏整体健康和异常状况。手动注释 ECG 信号的每个区域可能是一项乏味且耗时的任务。信号处理和深度学习方法有助于简化注释并自动对感兴趣的区域进行注释。
此示例使用来自公开可用的 QT 数据库的 ECG 信号。这些数据由总共 105 名患者大约 15 分钟的 ECG 录音片段组成,采样率为 250 Hz。为了获得每个录音片段,检查人员将两个电极放置在患者胸部的不同位置,以产生双通道信号。该数据库提供由自动专家系统生成的信号区域标签。此示例旨在使用深度学习解决方案根据采样所在的区域为每个 ECG 信号采样提供标签。这种对信号中的感兴趣区域加标签的过程通常称为波形分割。
为了训练深度神经网络来对信号区域分类,可以使用长短期记忆 (LSTM) 网络。此示例说明如何使用信号预处理方法和时频分析来提高 LSTM 分割性能。具体而言,此示例使用傅里叶同步压缩变换来表示 ECG 信号的非平稳行为。
105 个双通道 ECG 信号的每个通道由自动专家系统独立标注并独立处理,总共 210 个 ECG 信号,它们与区域标签一起存储在 210 个 MAT 文件中。这些文件可在以下位置获得:https://www.mathworks.com/supportfiles/SPT/data/QTDatabaseECGData.zip。
将数据文件下载到临时目录中,临时目录的位置由 MATLAB 的?tempdir
?命令指定。如果要将数据文件放在不同于?tempdir
?的文件夹中,请在后续说明中更改目录名称。
% Download the data
dataURL = 'https://www.mathworks.com/supportfiles/SPT/data/QTDatabaseECGData1.zip';
datasetFolder = fullfile(tempdir,'QTDataset');
zipFile = fullfile(tempdir,'QTDatabaseECGData.zip');
if ~exist(datasetFolder,'dir')
websave(zipFile,dataURL);
unzip(zipFile,tempdir);
end
unzip
?操作会在临时目录中创建?QTDatabaseECGData?
文件夹,其中包含 210 个 MAT 文件。每个文件在变量?ecgSignal
?中包含一个 ECG 信号,在变量?signalRegionLabels
?中包含一个区域标签表。每个文件还在变量?Fs
?中包含信号的采样率。在此示例中,所有信号的采样率均为 250 Hz。
创建一个信号数据存储来访问文件中的数据。此示例假设数据集已存储在临时目录中的?QTDatabaseECGData
?文件夹下。如果不是这样,请更改下面代码中数据的路径。使用?SignalVariableNames
?参数指定要从每个文件中读取的信号变量名称。
sds = signalDatastore(datasetFolder,'SignalVariableNames',["ecgSignal","signalRegionLabels"])
sds = signalDatastore with properties: Files:{ '/tmp/QTDataset/ecg1.mat'; '/tmp/QTDataset/ecg10.mat'; '/tmp/QTDataset/ecg100.mat' ... and 207 more } Folders: {'/tmp/QTDataset'} AlternateFileSystemRoots: [0×0 string] ReadSize: 1 SignalVariableNames: ["ecgSignal" "signalRegionLabels"] ReadOutputOrientation: "column"
每次调用?read
?函数时,数据存储都会返回一个包含 ECG 信号和区域标签表的二元素元胞数组。使用数据存储的?preview
?函数,可以看到第一个文件的内容是长度为 225000 个采样的 ECG 信号和一个包含 3385 个区域标签的表。
data = preview(sds)
data=2×1 cell array {225000×1 double} { 3385×2 table }
查看区域标签表的前几行,注意每行都包含区域范围索引和区域类值(P、T 或 QRS)。
head(data{2})
ROILimits Value __________ _____ 83 117 P 130 153 QRS 201 246 T 285 319 P 332 357 QRS 412 457 T 477 507 P 524 547 QRS
使用?signalMask
?对象可视化前 1000 个采样的标签。
M = signalMask(data{2});
plotsigroi(M,data{1}(1:1000))
通常的机器学习分类过程如下:
将数据库分成训练数据集和测试数据集。
使用训练数据集训练网络。
使用经过训练的网络对测试数据集进行预测。
用 70% 的数据对网络进行训练,用其余的 30% 对网络进行测试。
为了获得可重现的结果,请重置随机数生成器。使用?dividerand
?函数获得随机索引来对文件进行乱序处理,使用?signalDatastore
?的?subset
?函数将数据分成训练数据存储和测试数据存储。
rng default
[trainIdx,~,testIdx] = dividerand(numel(sds.Files),0.7,0,0.3);
trainDs = subset(sds,trainIdx);
testDs = subset(sds,testIdx);
在此分割问题中,LSTM 网络的输入是 ECG 信号,输出是与输入信号长度相同的标签序列或标签掩膜。网络任务将用信号采样所属区域的名称来标注每个信号采样。因此,有必要将数据集中的区域标签变换为包含针对每个信号采样的各个标签的序列。使用变换后的数据存储和?getmask
?辅助函数来变换区域标签。getmask
?函数添加一个标签类别?"n/a"
,用于标注不属于任何感兴趣区域的采样。
type getmask.m
function outputCell = getmask(inputCell)
%GETMASK Convert region labels to a mask of labels of size equal to the
%size of the input ECG signal.
%
% inputCell is a two-element cell array containing an ECG signal vector
% and a table of region labels.
%
% outputCell is a two-element cell array containing the ECG signal vector
% and a categorical label vector mask of the same length as the signal.
% Copyright 2020 The MathWorks, Inc.
sig = inputCell{1};
roiTable = inputCell{2};
L = length(sig);
M = signalMask(roiTable);
% Get categorical mask and give priority to QRS regions when there is overlap
mask = catmask(M,L,'OverlapAction','prioritizeByList','PriorityList',[2 1 3]);
% Set missing values to "n/a"
mask(ismissing(mask)) = "n/a";
outputCell = {sig,mask};
end
预览变换后的数据存储,观察它是否返回长度相等的一个信号向量和一个标签向量。绘制分类封装向量的前 1000 个元素。
trainDs = transform(trainDs, @getmask);
testDs = transform(testDs, @getmask);
transformedData = preview(trainDs)
transformedData=1×2 cell array {224993×1 double} {224993×1 categorical}
plot(transformedData{2}(1:1000))
?
将非常长的输入信号传入 LSTM 网络会导致估计性能下降和内存使用量过多。为了避免这些影响,请使用变换后的数据存储和?resizeData
?辅助函数来拆分 ECG 信号及其对应的标签掩膜。辅助函数创建尽可能多的包含 5000 个采样的信号段,并丢弃其余采样。变换后的数据存储的输出预览显示,第一个 ECG 信号及其标签掩膜分成了若干包含 5000 个采样的信号段。请注意,变换后的数据存储的预览仅显示 8 个元素,它们是在我们调用数据存储?read
?函数时会生成的包含?floor(224993/5000)
?= 44 个元素的元胞数组的前 8 个元素。
trainDs = transform(trainDs,@resizeData);
testDs = transform(testDs,@resizeData);
preview(trainDs)
ans=8×2 cell array
{[ 0 0 0 0 0 0 1 1 1 1 1 1 0 1 2 1 1 2 2 2 3 4 6 8 11 15 18 18 17 17 17 16 14 12 8 4 2 1 0 -1 -2 -1 0 0 0 1 2 2 2 2 1 0 -1 -1 -2 -3 -3 -2 -2 -2 -1 0 4 5 5 3 2 0 -1 -1 0 2 3 5 5 3 4 8 15 25 36 50 63 73 83 90 97 99 98 88 74 58 42 30 22 19 15 10 5 1 -1 -2 -2 -3 -4 -5 -6 -7 -9 -9 -10 -12 -13 -13 -12 -13 -14 -15 -15 -16 -18 -19 -20 -21 -22 -21 -22 -23 -24 -25 -25 -26 -27 -28 -29 -29 -28 -26 -25 -24 -23 -21 -19 -18 -16 -14 -12 -11 -9 -7 -6 -5 -5 -3 -3 -3 -3 -2 -2 -2 -2 -1 -1 -2 -2 -1 -1 -1 -1 0 0 0 -1 0 1 2 3 5 7 8 11 13 13 13 12 11 9 6 2 0 -2 -3 -5 -7 -8 -8 -7 -5 -4 -5 -4 -3 -4 -4 -5 -5 -6 -8 -9 -9 -8 -9 -9 -8 -6 -6 -4 -2 -3 -4 -5 -6 -7 -8 -8 -7 -6 -5 -6 -8 -7 -5 2 12 24 36 48 58 66 72 78 83 82 75 61 46 30 18 11 9 6 0 -4 -8 -9 -11 -12 -12 -13 -13 -14 -14 -15 -17 -17 -17 -17 -18 -18 -18 -19 -21 -22 -23 -23 -25 -25 -26 -26 -27 -28 -29 -30 -31 -32 -32 -33 -33 -34 -34 -34 -34 -32 -31 -30 -29 -27 -25 -23 -22 -19 -17 -15 -15 -14 -12 -11 -11 -9 -8 -8 -8 -8 -9 -9 -8 -8 -8 -8 -9 -8 -7 -7 -8 -8 -7 -7 -7 -6 -5 -3 -3 -1 2 4 5 6 7 6 5 4 2 -2 -5 -7 -7 -8 -10 -10 -10 -10 -9 -9 -7 -7 -6 -5 -5 -6 -8 -10 -11 -12 -12 -11 -11 -11 -10 -9 -7 -6 -5 -6 -7 -9 -11 -13 -14 -14 -14 -12 -11 -10 -11 -10 -6 0 10 22 35 47 58 68 76 80 83 78 67 51 36 22 12 6 3 -1 -6 -10 -12 -13 -14 -16 -17 -17 -17 -18 -18 -18 -19 -20 -20 -20 -20 -20 -19 -19 -20 -21 -22 -23 -25 -26 -26 -26 -26 -27 -27 -28 -28 -29 -28 -29 -28 -28 -29 -28 -27 -25 -25 -23 -22 -21 -19 -17 -15 -14 -12 -10 -9 -8 -7 -6 -5 -5 -5 -5 -5 -5 -5 -4 -4 -4 -3 -3 -3 -4 -3 -3 -3 -3 -4 -3 -4 -4 -2 -1 0 2 4 8 10 10 10 10 9 8 6 4 0 -3 -5 -5 -7 -9 -9 -8 -7 -8 -8 -7 -7 -7 -6 -6 -6 -7 -9 -9 -10 -11 -11 -11 -10 -10 -9 -7 -5 -3 -4 -5 -7 -9 -10 -11 -9 -8 -6 -4 -3 -4 -6 -5 0 6 16 27 40 51 60 68 75 82 81 77 66 52 39 27 17 10 6 2 -2 -6 -10 -12 -13 -14 -15 -16 -15 -16 -16 -17 -17 -17 -18 -18 -18 -17 -17 -16 -17 -17 -18 -19 -19 -20 -20 -21 -22 -23 -24 -25 -26 -26 -26 -26 -27 -26 -26 -26 -25 -24 -23 -22 -21 -19 -18 -16 -14 -11 -9 -8 -7 -5 -4 -4 -3 -2 -1 -1 -1 -1 -1 -2 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 5 7 10 14 16 17 15 14 13 12 11 8 5 1 0 0 -2 -4 -4 -3 -3 -2 -1 0 0 0 -1 -2 -3 -5 -5 -5 -6 -6 -5 -5 -5 -4 -2 0 1 2 1 0 -3 -5 -5 -5 -4 -2 0 0 -1 -1 1 7 14 26 39 53 63 73 81 87 90 87 80 65 51 38 26 18 12 8 3 -2 -6 -8 -9 -10 -11 -12 -12 -12 -14 -13 -12 -12 -13 -13 -14 -15 -16 -17 -16 -17 -18 -18 -17 -18 -20 -21 -22 -22 -24 -24 -24 -24 -24 -24 -23 -24 -24 -24 -23 -22 -21 -19 -16 -14 -13 -11 -9 -7 -5 -3 0 0 1 2 3 4 4 4 6 6 6 6 7 8 7 7 7 7 6 6 8 8 8 8 9 9 9 10 11 12 12 14 15 17 19 22 25 27 27 27 27 25 22 19 15 13 11 11 10 9 8 7 8 8 8 9 9 10 10 9 9 7 5 5 6 6 5 5 5 6 6 9 12 13 11 9 6 4 1 1 4 6 7 9 9 8 9 14 23 34 48 62 77 86 96 103 109 110 103 92 76 61 45 34 29 25 19 11 6 2 0 0 -1 -3 -5 -6 -6 -6 -7 -7 -7 -7 -8 -8 -8 -9 -10 -11 -11 -11 -12 -14 -15 -15 -16 -17 -17 -18 -19 -20 -21 -21 -22 -22 -21 -21 -20 -19 -18 -16 -15 -13 -11 -9 -7 -4 -1 1 2 4 5 6 7 8 9 9 9 9 9 9 9 8 9 10 10 11 12 12 11 11 11 11 10 11 11 12 13 14 15 15 15 17 20 24 28 29 30 29 28 28 27 24 20 16 14 13 12 11 10 9 8 9 9 9 9 10 11 11 10 9 8 7 7 6 6 6 6 7 7 8 10 12 13 11 8 5 3 1 0 2 5 6 6 5 4 6 12 22 35 50 62 77 88 97 103 108 110 104 94 78 62 45 34 29 26 21 14 9 5 3 1 0 -1 -2 -3 -4 -4 -5 -6 -6 -5 -6 -8 -8 -8 -8 -9 -10 -10 -12 -13 -14 -15 -15 -16 -17 -17 -19 -21 -22 -22 -23 -24 -24 -23 -24 -24 -22 -20 -19 -17 -14 -12 -10 -9 -7 -5 -4 -3 -1 1 3 4 5 7 7 7 8 8 8 7 7 8 7 7 7 7 5 5 5 5 5 5 6 7 7 7 7 8 9 10 11 13 16 18 20 21 20 20 19 18 15 12 9 7 6 4 3 2 2 2 2 3 2 1 2 3 4 3 3 2 1 0 0 -1 -1 -2 -2 -1 0 1 2 2 0 -3 -5 -8 -9 -9 -8 -6 -5 -6 -6 -5 -1 7 20 35 49 62 74 84 92 99 105 103 94 77 58 39 25 19 16 12 6 0 -3 -6 -9 -11 -12 -12 -14 -14 -14 -14 -15 -15 -16 -17 -17 -18 -17 -17 -18 -18 -19 -20 -22 -23 -23 -24 -26 -27 -28 -29 -30 -31 -30 -31 -31 -33 -33 -33 -32 -30 -30 -28 -27 -25 -22 -20 -18 -16 -13 -10 -8 -6 -4 -2 -2 -2 -1 0 -1 0 0 0 0 0 1 0 0 0 1 1 1 0 1 2 2 2 3 3 3 4 5 6 7 9 13 16 19 19 19 18 18 17 16 13 9 6 4 3 1 0 -2 -2 -2 -1 0 0 1 1 1 1 0 0 0 -2 -3 -3 -2 -3 -3 -4 -2 -1 0 1 1 0 -2 -5 -6 -9 -9 -7 -5 -3 -1 -1 0 2 8 18 32 46 59 71 83 94 101 107 106 98 83 65 49 35 27 23 21 15 7 2 0 0 -2 -4 -4 -6 -7 -8 -8 -9 -9 -9 -8 -9 -9 -10 -9 -10 -11 -11 -11 -12 -13 -14 -15 -16 -18 -18 -19 -20 -21 -22 -23 -24 -24 -24 -24 -24 -24 -23 -21 -19 -17 -16 -14 -11 -9 -7 -5 -2 -1 1 2 2 2 3 4 4 4 4 4 4 4 5 5 4 3 4 5 5 4 4 4 4 5 5 7 6 6 6 7 8 9 12 15 19 20 21 19 18 18 18 16 12 8 5 4 4 2 1 0 0 0 1 3 3 3 4 4 4 3 2 1 1 0 0 1 1 0 1 1 2 3 3 3 1 0 -1 -3 -5 -5 -3 -1 0 0 0 1 4 10 21 34 47 60 71 82 89 97 100 100 93 80 66 47 34 26 23 19 13 7 3 1 -1 -2 -3 -4 -6 -7 -6 -6 -6 -6 -6 -6 -7 -8 -9 -9 -9 -10 -10 -11 -12 -14 -15 -16 -17 -18 -19 -19 -21 -21 -22 -23 -24 -25 -25 -24 -23 -23 -21 -20 -19 -18 -16 -12 -10 -7 -5 -4 -3 -2 -1 0 1 1 2 2 2 1 1 1 0 0 1 1 0 0 1 1 1 1 2 3 4 3 3 3 3 4 5 7 7 8 11 13 15 16 16 16 15 14 12 10 7 4 3 2 0 0 0 1 0 0 0 1 1 2 3 3 1 0 0 -1 -2 -3 -2 -2 -1 -1 0 0 1 2 2 1 -1 -4 -6 -7 -7 -6 -5 -4 -4 -5 -3 0 5 14 27 42 56 67 79 87 96 101 105 101 87 71 53 39 29 24 22 16 10 5 2 1 0 -1 -2 -3 … ]} {[n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a … ]}
{[ -34 -34 -33 -32 -31 -30 -28 -26 -24 -22 -20 -17 -15 -12 -10 -8 -6 -6 -5 -3 -3 -2 0 1 1 0 1 2 2 2 2 2 2 2 2 3 4 4 5 6 6 7 7 8 10 12 15 18 20 21 21 20 20 18 17 13 8 4 2 2 0 -2 -2 -1 0 -1 -1 0 0 1 1 1 0 -2 -3 -3 -3 -3 -3 -2 -2 -1 -1 1 3 5 6 4 2 -1 -3 -5 -6 -6 -4 -1 0 -1 -2 0 5 13 26 41 56 69 80 92 99 107 109 107 96 79 62 43 28 20 17 13 6 0 -3 -5 -6 -7 -8 -9 -11 -13 -13 -12 -11 -11 -12 -12 -14 -15 -16 -17 -17 -18 -19 -19 -19 -21 -23 -24 -26 -27 -28 -28 -28 -29 -30 -31 -31 -32 -33 -33 -32 -32 -31 -29 -27 -25 -23 -20 -18 -16 -14 -11 -8 -6 -5 -3 -1 0 1 2 2 1 2 2 2 2 3 3 4 4 3 3 3 3 4 4 5 5 6 8 8 8 11 14 17 19 20 21 20 19 18 17 13 8 6 5 4 2 0 0 0 0 1 1 1 0 0 1 1 0 -2 -3 -4 -4 -4 -3 -4 -4 -4 -3 -2 0 1 1 0 -3 -7 -9 -11 -11 -9 -5 -3 -4 -6 -5 -2 5 17 31 44 58 69 79 87 91 97 94 86 71 55 39 22 12 8 5 0 -6 -9 -12 -13 -14 -15 -15 -17 -19 -19 -19 -20 -20 -19 -19 -20 -21 -21 -22 -23 -24 -25 -25 -26 -28 -30 -31 -33 -35 -35 -35 -36 -37 -38 -39 -40 -40 -39 -39 -40 -39 -38 -37 -36 -35 -33 -30 -27 -26 -23 -21 -20 -19 -16 -15 -13 -12 -12 -12 -13 -13 -13 -13 -12 -12 -12 -11 -11 -12 -11 -11 -11 -12 -12 -12 -13 -13 -13 -12 -12 -12 -11 -10 -8 -5 -2 0 0 0 0 -1 -3 -6 -9 -11 -12 -14 -16 -18 -19 -20 -19 -18 -17 -17 -17 -16 -16 -17 -18 -18 -19 -20 -21 -22 -22 -22 -22 -21 -20 -20 -19 -17 -15 -17 -19 -21 -24 -26 -27 -27 -25 -24 -23 -24 -26 -28 -24 -16 -6 5 19 31 43 51 57 63 66 65 57 46 30 13 0 -8 -12 -14 -18 -22 -26 -28 -29 -30 -30 -31 -31 -32 -31 -33 -34 -34 -34 -34 -35 -35 -36 -37 -38 -39 -39 -41 -41 -43 -43 -45 -46 -46 -47 -48 -50 -50 -50 -51 -52 -51 -51 -52 -51 -49 -47 -47 -45 -43 -41 -39 -38 -35 -34 -32 -30 -28 -27 -26 -24 -23 -21 -21 -21 -21 -21 -23 -23 -22 -22 -22 -22 -21 -21 -22 -23 -24 -24 -24 -23 -22 -21 -20 -20 -19 -17 -15 -13 -11 -11 -11 -10 -11 -13 -17 -20 -22 -23 -24 -25 -26 -28 -28 -27 -26 -25 -26 -25 -23 -23 -24 -25 -26 -27 -28 -29 -29 -29 -30 -31 -30 -31 -30 -28 -26 -25 -26 -28 -31 -33 -36 -37 -37 -36 -34 -35 -35 -37 -36 -32 -24 -14 -2 10 22 32 40 47 54 58 57 51 38 23 6 -7 -14 -17 -20 -24 -29 -32 -34 -35 -36 -38 -40 -41 -41 -42 -41 -42 -43 -44 -45 -44 -45 -46 -47 -47 -47 -48 -48 -49 -50 -52 -52 -53 -53 -54 -55 -55 -57 -56 -58 -57 -58 -57 -58 -58 -57 -57 -54 -54 -51 -50 -47 -44 -41 -38 -38 -36 -35 -32 -32 -31 -29 -30 -30 -30 -30 -31 -31 -31 -30 -31 -31 -30 -30 -30 -31 -30 -29 -30 -29 -28 -26 -26 -25 -25 -23 -21 -18 -16 -15 -15 -15 -15 -15 -17 -19 -22 -25 -27 -27 -28 -29 -31 -31 -30 -30 -30 -31 -30 -30 -30 -31 -31 -31 -33 -33 -34 -34 -35 -35 -35 -34 -33 -32 -29 -27 -27 -29 -31 -33 -36 -37 -38 -36 -37 -36 -35 -36 -36 -33 -25 -17 -5 8 22 34 44 54 64 71 72 65 51 35 18 4 -4 -9 -12 -18 -24 -28 -31 -32 -34 -35 -36 -36 -37 -37 -37 -37 -37 -38 -39 -39 -39 -38 -39 -38 -40 -40 -43 -44 -44 -44 -45 -46 -46 -47 -47 -48 -48 -50 -52 -52 -52 -51 -52 -50 -50 -49 -47 -45 -42 -41 -39 -38 -35 -34 -33 -32 -30 -29 -28 -26 -25 -24 -24 -23 -22 -22 -22 -22 -21 -21 -21 -20 -19 -19 -19 -19 -18 -17 -16 -15 -13 -11 -11 -9 -5 -3 -2 0 3 3 2 2 2 2 0 -4 -7 -9 -11 -12 -14 -16 -17 -16 -14 -14 -14 -13 -12 -12 -13 -13 -15 -16 -17 -17 -16 -16 -16 -17 -16 -16 -15 -13 -10 -7 -8 -9 -11 -13 -16 -17 -15 -13 -10 -9 -9 -10 -10 -7 0 10 21 34 48 59 69 77 84 89 87 81 68 53 38 24 16 11 6 1 -4 -8 -11 -11 -12 -13 -14 -14 -14 -15 -16 -17 -16 -16 -17 -18 -18 -18 -19 -20 -21 -22 -23 -23 -23 -24 -25 -26 -27 -28 -30 -30 -30 -30 -32 -33 -34 -35 -35 -35 -33 -32 -30 -28 -26 -25 -23 -20 -17 -14 -12 -10 -9 -8 -6 -4 -4 -3 -3 -1 -1 -2 -2 -2 -1 -1 0 1 1 0 1 3 3 3 3 5 6 8 11 14 16 17 18 18 18 18 15 13 9 6 5 5 3 1 0 0 1 1 1 2 2 2 2 2 1 0 0 -1 -1 -2 -2 0 0 0 0 2 5 7 8 8 7 4 2 0 0 0 2 4 4 2 1 1 5 12 23 37 51 64 74 85 92 99 102 98 89 75 60 44 31 23 22 19 14 8 3 1 0 0 0 0 -1 -3 -4 -4 -4 -5 -6 -6 -8 -8 -9 -10 -11 -13 -14 -15 -16 -18 -19 -20 -22 -24 -26 -27 -29 -30 -30 -30 -29 -30 -30 -29 -28 -27 -25 -23 -22 -20 -17 -15 -13 -10 -7 -5 -4 -2 -1 -1 0 0 1 2 3 2 3 2 2 3 4 5 5 5 6 5 5 5 5 5 6 6 9 12 15 16 18 18 17 17 16 14 10 8 7 6 4 2 0 0 1 2 2 2 1 1 1 1 1 1 0 0 -2 -1 -1 0 -1 -1 -1 0 1 3 5 5 3 0 -1 -2 -4 -4 -2 0 0 -1 -3 -3 -1 3 12 25 35 46 56 66 74 81 88 90 88 78 67 52 37 27 23 21 16 10 6 3 2 2 2 1 0 -1 -2 -2 -2 -2 -2 -2 -3 -5 -6 -7 -8 -9 -9 -10 -11 -12 -13 -14 -15 -16 -17 -17 -18 -18 -19 -20 -21 -21 -20 -19 -19 -18 -17 -14 -13 -13 -11 -10 -10 -9 -7 -4 -2 -1 0 0 0 2 4 4 4 4 5 5 5 5 5 6 6 6 6 5 5 6 8 9 10 12 14 16 19 20 21 21 19 19 19 18 16 13 11 9 7 6 6 7 8 8 8 8 8 10 10 10 9 9 9 9 9 9 9 9 8 8 9 10 11 13 14 14 12 10 8 7 6 6 9 11 13 13 12 13 17 27 39 53 65 78 89 102 112 119 124 119 109 91 75 59 48 43 39 34 27 22 20 19 17 16 15 13 11 10 10 10 9 7 6 4 2 1 0 0 -1 -2 -2 -2 -4 -6 -7 -9 -9 -9 -8 -8 -9 -11 -12 -13 -13 -12 -10 -9 -7 -6 -5 -4 -4 0 2 5 6 9 11 13 14 15 17 19 20 20 21 21 21 22 22 22 21 22 22 24 24 25 26 25 25 26 28 29 32 35 39 42 44 45 45 45 44 44 42 41 38 34 32 29 28 28 28 28 28 28 29 29 29 28 27 25 24 23 24 24 24 24 24 23 23 25 27 30 31 32 31 29 27 25 26 27 29 32 35 34 33 33 36 43 53 66 79 93 102 113 122 129 134 133 129 115 102 87 73 63 58 56 50 45 38 34 32 30 28 27 26 25 24 23 23 23 … ]} {[T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T … ]}
{[12 11 10 9 7 7 6 4 4 4 4 3 2 2 2 1 0 0 -1 -2 -4 -5 -7 -9 -10 -11 -11 -12 -12 -13 -14 -15 -16 -16 -17 -17 -17 -17 -17 -17 -16 -14 -12 -10 -7 -4 -1 1 3 6 9 11 13 14 15 16 16 17 18 19 19 20 20 20 21 21 22 22 22 23 23 23 24 25 27 28 30 32 35 38 40 40 41 40 40 40 39 37 33 30 26 23 21 22 22 23 23 22 22 21 22 21 22 22 20 19 18 18 17 17 17 17 17 18 21 24 25 25 24 21 18 15 15 15 16 18 21 22 20 19 22 30 40 53 69 83 96 107 117 126 131 132 124 110 90 69 51 39 35 34 31 26 20 17 16 15 13 11 10 10 8 6 6 5 5 4 4 4 2 0 -3 -5 -6 -5 -4 -4 -6 -9 -11 -13 -15 -17 -18 -19 -21 -21 -21 -20 -21 -25 -27 -25 -21 -20 -18 -15 -14 -13 -12 -8 -7 -5 -2 0 3 3 3 4 4 6 7 6 5 5 7 7 7 8 10 11 10 9 8 9 10 11 14 15 17 18 22 26 28 30 31 32 31 30 29 28 25 22 19 15 14 14 15 15 14 12 13 13 14 13 13 12 10 9 9 9 9 8 7 6 7 8 10 14 15 14 14 13 11 8 6 6 8 10 14 15 14 11 12 18 27 39 54 69 82 92 98 105 109 109 102 86 68 48 32 21 17 16 13 9 5 2 1 0 0 -1 -2 -3 -4 -5 -7 -7 -8 -9 -10 -9 -11 -12 -12 -14 -14 -15 -15 -17 -18 -20 -21 -22 -24 -25 -26 -26 -26 -27 -27 -27 -27 -27 -26 -25 -23 -21 -19 -16 -14 -11 -10 -7 -5 -3 0 3 5 7 8 8 8 8 9 10 11 11 12 13 13 13 14 15 15 16 17 18 19 19 22 24 27 29 33 34 35 35 36 36 34 32 30 27 24 21 20 19 19 19 20 19 18 18 18 19 19 19 18 17 15 14 14 15 15 15 16 17 18 20 23 24 23 21 20 19 17 17 18 20 21 21 20 18 19 23 32 45 57 69 80 91 97 104 110 116 117 111 102 85 68 53 44 41 40 36 30 25 21 19 18 17 16 16 16 15 14 11 11 11 11 11 10 9 7 6 5 5 4 3 2 1 0 -2 -3 -3 -4 -5 -6 -6 -7 -8 -7 -7 -7 -6 -5 -2 -1 0 2 4 6 8 10 13 16 18 21 23 24 25 26 27 28 28 30 30 31 31 32 33 34 34 34 34 34 35 36 39 40 40 42 45 48 50 53 52 51 50 50 51 49 48 44 42 39 36 36 36 37 36 37 37 37 36 36 36 34 34 34 35 35 34 34 34 33 33 35 36 38 39 39 39 39 38 35 33 31 31 32 34 36 35 34 34 37 43 53 67 79 92 103 115 123 132 138 139 134 118 103 86 73 65 61 58 50 44 39 38 35 34 34 32 30 28 28 27 27 26 25 25 24 22 21 20 19 18 17 16 14 13 12 11 11 9 8 8 6 4 3 3 3 4 4 5 5 6 7 8 10 11 13 15 18 19 21 24 25 26 27 29 30 31 32 32 33 32 33 34 35 35 36 37 36 36 35 36 36 36 39 40 42 44 47 49 52 52 52 51 50 49 46 46 43 40 36 34 32 31 32 32 32 31 31 31 31 30 29 28 26 25 25 25 24 24 25 26 27 28 30 32 31 29 28 26 24 22 22 23 24 25 25 24 22 24 31 41 52 66 78 92 100 109 115 122 123 116 105 87 71 57 50 46 42 36 29 25 21 20 18 17 16 15 14 13 11 10 11 10 8 7 7 5 4 3 2 1 0 -1 -2 -3 -4 -6 -8 -9 -10 -11 -11 -12 -13 -13 -12 -13 -13 -13 -12 -10 -9 -7 -5 -4 -3 -1 0 1 3 5 7 8 9 9 10 10 10 10 10 10 10 11 11 12 11 12 12 12 11 13 14 15 17 20 23 25 27 28 28 27 26 26 25 23 19 17 13 10 9 9 9 9 8 8 8 7 7 7 6 4 3 3 2 1 0 0 0 1 2 3 5 7 7 7 4 2 -1 -2 -2 -1 0 2 3 1 1 3 8 16 27 41 54 66 75 85 91 97 97 92 81 64 49 34 23 18 16 13 7 2 -1 -2 -3 -5 -7 -8 -9 -10 -11 -12 -13 -14 -15 -15 -17 -18 -18 -18 -18 -20 -21 -22 -23 -25 -26 -28 -29 -30 -31 -31 -32 -33 -34 -34 -35 -35 -34 -33 -32 -32 -30 -28 -26 -24 -21 -18 -15 -14 -12 -9 -7 -6 -5 -3 -2 -2 -2 -1 -1 -1 0 0 0 0 0 2 2 2 2 3 3 5 7 9 11 14 16 16 17 16 16 16 15 13 10 7 3 0 -1 -1 -2 -2 -1 -1 -1 -2 -2 -1 -2 -4 -5 -5 -6 -6 -5 -5 -5 -5 -5 -3 -1 0 2 2 0 -2 -4 -6 -7 -6 -5 -3 -3 -5 -6 -6 -2 6 19 33 47 58 68 79 85 92 94 95 85 71 54 35 21 14 13 10 4 0 -3 -5 -6 -8 -10 -12 -12 -12 -14 -15 -15 -15 -15 -16 -18 -19 -19 -18 -19 -21 -22 -23 -23 -24 -25 -27 -29 -29 -30 -31 -34 -35 -35 -35 -34 -34 -34 -33 -33 -33 -31 -29 -27 -25 -22 -19 -17 -15 -14 -12 -11 -8 -6 -5 -4 -3 -2 -2 -2 -1 -1 -1 -2 -1 -1 0 0 0 0 1 1 1 2 3 5 6 10 13 15 16 16 16 15 15 13 10 7 4 2 0 -1 -2 -1 -1 -2 -2 -1 -1 -1 -1 -1 -2 -4 -4 -4 -5 -4 -4 -4 -3 -3 -2 0 2 3 3 2 0 -2 -5 -6 -5 -4 -1 1 0 0 0 6 14 26 41 57 71 82 94 100 107 107 104 90 74 57 40 28 22 20 15 7 1 0 0 0 -1 -2 -3 -6 -8 -9 -8 -8 -10 -13 -15 -15 -14 -15 -16 -18 -20 -21 -22 -22 -24 -25 -27 -30 -31 -29 -29 -32 -36 -37 -36 -35 -34 -33 -34 -33 -31 -28 -27 -27 -25 -22 -18 -16 -15 -17 -18 -18 -15 -11 -7 -7 -9 -9 -8 -8 -9 -9 -8 -7 -7 -6 -5 -6 -7 -6 -5 -5 -4 -1 1 4 6 8 9 7 7 7 5 1 -3 -5 -7 -9 -12 -12 -12 -12 -12 -12 -11 -11 -11 -10 -8 -8 -9 -11 -13 -16 -17 -16 -18 -18 -17 -16 -16 -17 -16 -13 -11 -11 -12 -13 -15 -17 -17 -16 -14 -13 -14 -16 -16 -13 -7 1 14 29 43 57 67 75 81 84 85 76 65 50 35 20 8 3 1 -3 -10 -15 -16 -16 -17 -20 -23 -24 -25 -26 -30 -32 -32 -31 -31 -32 -33 -34 -33 -34 -36 -38 -39 -40 -41 -42 -43 -45 -45 -45 -46 -49 -52 -54 -53 -53 -53 -52 -51 -51 -50 -47 -46 -44 -43 -40 -38 -37 -34 -32 -29 -28 -27 -26 -24 -23 -23 -22 -21 -20 -20 -20 -21 -21 -20 -19 -18 -18 -17 -17 -16 -16 -16 -14 -12 -9 -6 -2 0 0 0 0 0 0 -1 -3 -5 -8 -10 -12 -13 -14 -14 -12 -12 -12 -13 -12 -11 -12 -13 -13 -14 -15 -15 -15 -15 -15 -16 -15 -15 -15 -12 -9 -7 -8 -9 -11 -12 -14 -14 -13 -11 -10 -9 -8 -10 -8 -3 6 18 31 44 58 67 76 84 91 94 88 78 60 44 27 15 9 8 4 0 -6 -9 -12 -13 -13 -14 -15 -15 -15 -16 -18 -19 -20 -20 -21 -21 -21 -22 -24 -24 -25 -26 -27 -27 -29 -31 -32 -33 -34 -35 -36 -36 -37 -37 -38 -38 -38 -38 -37 -36 -34 -33 -30 -28 -25 -24 -22 -20 -18 -15 -14 -12 -10 -8 -8 -7 -6 -5 -5 -3 -2 -2 -2 -1 -1 -1 0 0 0 0 1 2 3 4 6 9 11 13 14 15 15 15 14 11 7 3 2 1 0 -2 -2 -1 -2 -2 -2 -2 -2 -2 -1 -1 … ]} {[n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a … ]}
{[ -2 -1 -1 0 0 -1 -1 -1 -2 -3 -3 -4 -4 -4 -3 -2 -2 -2 -1 1 3 2 1 0 -3 -6 -8 -9 -8 -8 -7 -4 -4 -5 -3 4 14 27 42 60 74 86 96 106 115 116 110 92 73 52 37 27 22 17 10 4 0 -2 -3 -3 -5 -7 -7 -7 -7 -8 -9 -10 -10 -11 -12 -12 -13 -14 -15 -14 -14 -15 -17 -17 -19 -20 -22 -22 -24 -25 -26 -27 -27 -29 -30 -30 -30 -30 -30 -28 -27 -25 -24 -22 -21 -21 -20 -18 -16 -14 -11 -9 -8 -8 -7 -5 -4 -5 -6 -6 -7 -6 -5 -5 -5 -6 -6 -6 -6 -6 -6 -5 -4 -5 -5 -4 -4 -3 -2 0 2 5 7 9 10 9 8 7 6 3 0 -2 -4 -7 -9 -9 -10 -10 -9 -8 -8 -8 -8 -9 -9 -11 -13 -13 -14 -15 -16 -15 -14 -15 -14 -14 -12 -12 -10 -7 -5 -6 -8 -10 -13 -16 -17 -17 -15 -15 -14 -15 -16 -16 -12 -5 7 22 37 51 64 75 85 92 99 98 88 73 56 40 24 16 12 7 0 -6 -10 -13 -15 -16 -15 -15 -16 -18 -18 -20 -22 -23 -22 -21 -21 -23 -23 -24 -26 -26 -27 -27 -29 -30 -31 -34 -35 -37 -36 -38 -39 -40 -41 -40 -42 -41 -42 -41 -42 -42 -40 -38 -35 -34 -31 -30 -28 -26 -23 -19 -18 -15 -13 -11 -12 -13 -12 -11 -10 -10 -10 -9 -9 -9 -9 -9 -9 -9 -7 -6 -6 -6 -5 -5 -5 -4 -2 0 1 3 7 10 11 11 10 9 9 10 8 6 2 0 -2 -4 -6 -6 -4 -5 -5 -5 -4 -3 -4 -4 -5 -6 -7 -8 -8 -9 -9 -10 -8 -8 -8 -7 -5 -3 -2 -2 -3 -5 -7 -9 -10 -12 -13 -12 -9 -8 -9 -10 -8 -3 5 17 32 46 56 65 73 81 87 90 86 74 58 42 27 15 9 7 3 -2 -7 -10 -10 -11 -13 -14 -13 -14 -15 -15 -16 -16 -17 -18 -18 -19 -20 -21 -22 -22 -23 -24 -23 -25 -27 -29 -29 -29 -30 -30 -31 -31 -32 -33 -33 -33 -33 -34 -32 -31 -31 -31 -30 -28 -26 -24 -22 -18 -16 -15 -14 -13 -12 -10 -8 -7 -6 -6 -4 -4 -4 -4 -4 -3 -3 -3 -2 -2 -2 -1 -1 -1 -1 -1 0 1 2 3 6 9 12 14 15 15 14 14 13 12 9 6 3 1 0 -2 -2 -1 0 0 1 2 1 1 1 1 0 0 0 0 -1 -2 -2 -2 -2 -2 0 1 3 4 6 5 4 2 0 0 -1 -1 0 0 0 -1 -2 -2 0 8 18 30 42 54 64 74 81 88 93 94 88 75 59 42 28 22 20 19 12 8 5 3 1 0 0 -1 -2 -2 -2 -2 -4 -5 -5 -6 -8 -8 -7 -8 -8 -10 -11 -12 -13 -14 -15 -16 -17 -17 -18 -18 -19 -20 -21 -22 -24 -24 -23 -23 -23 -22 -21 -19 -19 -16 -14 -11 -9 -6 -4 -2 -1 0 1 2 3 3 5 4 4 4 4 4 4 4 4 5 4 5 5 5 4 5 7 8 9 10 12 15 18 21 22 22 20 21 20 19 16 13 10 8 5 4 4 4 5 6 6 5 4 6 7 7 6 6 5 3 3 3 3 2 2 3 3 4 7 10 10 8 7 5 2 1 1 3 3 3 3 3 2 4 11 23 35 51 65 81 92 101 110 118 120 110 95 75 55 40 32 28 22 15 8 5 4 2 2 1 0 -2 -3 -4 -5 -5 -6 -5 -6 -7 -8 -9 -10 -10 -11 -12 -14 -16 -17 -17 -19 -20 -21 -22 -24 -25 -25 -25 -25 -27 -26 -26 -26 -25 -23 -21 -20 -19 -18 -16 -14 -12 -9 -4 -2 -1 0 2 4 4 5 5 4 3 4 5 5 5 6 7 7 7 7 7 7 7 8 9 10 11 12 13 14 16 20 24 27 28 26 25 24 22 20 17 15 12 10 7 5 4 5 6 5 4 5 6 7 8 7 6 4 1 1 1 1 1 2 2 3 4 6 9 10 10 9 7 3 0 0 1 3 5 7 7 4 3 5 13 25 40 55 72 86 97 107 114 121 119 113 97 79 62 46 36 30 27 20 14 9 7 5 4 4 2 2 2 1 0 -1 -2 -4 -5 -5 -6 -7 -8 -9 -9 -10 -11 -11 -12 -13 -15 -17 -18 -18 -20 -21 -21 -21 -22 -23 -22 -22 -22 -22 -21 -20 -20 -18 -16 -14 -12 -9 -5 -1 0 1 3 4 5 6 8 9 9 10 11 11 11 11 12 12 12 12 13 14 13 13 14 15 15 16 18 19 20 22 26 29 31 32 33 33 32 31 29 25 20 17 17 17 16 14 14 15 15 14 15 15 15 15 15 15 14 13 13 12 11 10 12 13 14 14 15 17 18 21 21 21 19 17 15 14 12 13 15 15 15 13 12 14 21 31 45 60 73 87 98 110 117 125 127 121 108 89 72 54 44 40 38 32 25 20 18 16 15 13 13 12 11 10 10 9 7 6 5 5 5 5 5 3 1 0 0 -1 -2 -3 -4 -5 -6 -7 -8 -10 -11 -11 -12 -12 -12 -12 -12 -11 -10 -9 -7 -6 -4 -2 0 1 3 5 8 10 11 14 15 16 16 17 18 18 19 19 20 20 20 20 21 21 21 21 22 23 22 23 24 26 28 31 36 38 39 39 39 38 36 35 32 28 26 25 25 23 22 21 22 22 22 22 23 23 23 24 23 22 20 19 19 19 19 18 19 19 19 20 22 25 26 27 26 25 22 20 18 17 18 19 21 21 21 19 22 27 37 49 64 79 91 104 115 126 132 134 130 115 99 81 67 55 49 45 40 33 28 25 23 22 20 18 17 17 16 15 15 15 13 12 12 12 10 9 9 8 7 6 5 4 2 1 0 0 -1 -2 -2 -3 -4 -5 -6 -7 -8 -7 -6 -5 -5 -4 -2 0 0 2 4 6 8 10 12 14 15 17 18 19 20 20 21 21 21 20 20 20 20 21 22 22 22 22 23 24 24 24 26 29 31 34 38 39 38 37 37 36 33 30 27 25 23 22 21 19 17 17 19 20 19 19 19 19 17 16 15 14 13 11 12 12 12 12 12 13 13 15 17 20 20 19 17 14 12 9 10 11 12 13 15 14 13 14 21 32 44 58 71 85 95 106 114 120 122 115 102 83 66 51 42 37 34 28 21 17 14 12 11 10 8 7 6 4 3 2 1 0 0 0 -1 -2 -4 -5 -5 -6 -6 -8 -9 -10 -12 -14 -15 -15 -16 -18 -19 -20 -21 -21 -21 -22 -22 -21 -20 -18 -16 -14 -12 -10 -9 -7 -5 -2 0 1 3 3 3 4 5 6 7 6 6 7 7 7 7 8 9 9 8 8 8 8 10 11 12 12 15 17 20 21 22 23 22 22 20 19 15 11 9 7 6 4 3 3 3 3 3 4 3 2 3 3 3 2 1 0 -1 -1 0 0 -1 -2 -1 0 1 3 6 6 5 3 1 -1 -3 -4 -4 -2 -1 0 0 0 1 7 17 30 43 56 68 80 88 94 101 102 95 81 65 48 33 24 21 19 14 8 4 1 0 -2 -3 -5 -6 -7 -8 -8 -10 -11 -11 -12 -13 -14 -14 -15 -16 -17 -18 -19 -21 -22 -23 -24 -26 -26 -27 -29 -30 -31 -31 -32 -32 -33 -33 -33 -33 -32 -31 -29 -27 -24 -22 -20 -19 -16 -13 -11 -9 -7 -5 -5 -5 -4 -2 -2 -3 -2 -2 -3 -4 -3 -2 -2 -2 -1 0 0 0 0 1 1 2 5 9 12 13 13 13 12 10 9 6 3 0 -2 -2 -4 -5 -6 -7 -7 -7 -7 -6 -6 -6 -5 -4 -5 -6 -8 -8 -9 -9 -9 -8 -8 -9 -9 -9 -7 -5 -2 0 -1 -4 -7 -9 -11 -12 -11 -8 -6 -5 -5 -6 -4 -1 7 20 36 51 66 80 92 101 109 113 107 92 74 56 39 27 22 17 11 3 -1 -3 -4 -5 -7 -8 -9 -11 -11 -12 -12 -14 -14 -14 -15 -17 -18 -18 -19 -20 -21 -22 -22 -24 -25 -26 -27 -28 -30 -30 -31 -31 -32 -32 -32 -32 -33 -32 -31 -30 -29 -27 -25 -24 -21 -19 -16 -14 -12 -10 -8 -6 -5 -5 -4 … ]} {[n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS … ]}
{[52 62 69 78 84 87 86 77 65 49 34 22 15 14 12 8 2 -1 -3 -4 -4 -4 -4 -4 -5 -6 -5 -4 -5 -7 -8 -8 -8 -8 -8 -8 -9 -10 -10 -10 -11 -12 -12 -13 -15 -16 -18 -18 -19 -19 -20 -21 -22 -22 -20 -19 -18 -18 -16 -14 -14 -12 -9 -6 -6 -6 -5 -1 0 0 1 1 1 0 1 2 3 4 5 4 3 3 4 4 5 5 5 5 6 5 6 6 6 6 7 10 11 14 17 19 18 16 15 17 18 18 15 11 7 4 4 4 3 1 2 3 4 4 5 6 7 6 5 5 5 5 4 3 2 1 1 1 1 1 1 3 5 6 7 7 6 3 1 -1 -2 -3 -3 0 0 -1 -3 -2 0 6 15 28 40 51 62 71 81 87 94 95 87 75 58 43 29 21 17 13 8 3 0 -1 -2 -4 -4 -5 -6 -7 -6 -5 -4 -4 -6 -7 -8 -9 -10 -9 -9 -10 -11 -12 -12 -14 -16 -18 -19 -21 -22 -22 -22 -23 -25 -26 -28 -28 -28 -27 -27 -27 -26 -26 -25 -24 -22 -21 -20 -18 -14 -13 -12 -12 -11 -9 -7 -6 -5 -5 -6 -7 -6 -5 -5 -6 -6 -6 -6 -6 -7 -7 -8 -8 -7 -8 -8 -7 -5 -3 -3 -3 -1 1 3 3 4 4 3 1 0 -2 -6 -9 -10 -11 -12 -13 -14 -15 -16 -16 -16 -15 -16 -16 -16 -15 -17 -19 -19 -19 -19 -20 -18 -18 -18 -19 -19 -19 -19 -17 -16 -16 -17 -18 -20 -24 -27 -30 -29 -28 -27 -27 -27 -27 -27 -23 -16 -5 7 22 39 54 63 73 81 90 88 77 60 39 20 6 0 -1 -6 -12 -18 -22 -25 -26 -26 -28 -29 -30 -29 -29 -31 -33 -34 -34 -35 -34 -34 -35 -36 -38 -40 -43 -45 -45 -44 -44 -46 -48 -49 -49 -50 -51 -53 -55 -55 -56 -55 -55 -54 -53 -51 -50 -49 -48 -47 -44 -43 -40 -37 -34 -34 -33 -31 -31 -29 -29 -27 -28 -29 -29 -28 -27 -27 -26 -26 -25 -25 -25 -25 -26 -27 -27 -26 -26 -25 -23 -21 -21 -19 -17 -14 -13 -13 -12 -12 -12 -11 -11 -13 -17 -21 -23 -25 -26 -27 -29 -30 -30 -29 -28 -28 -27 -26 -25 -24 -26 -27 -27 -26 -27 -28 -28 -28 -28 -28 -27 -27 -26 -25 -23 -21 -22 -24 -26 -27 -30 -32 -32 -30 -28 -27 -27 -27 -26 -22 -13 -1 12 28 44 59 72 81 90 95 91 80 62 45 26 12 4 0 -3 -10 -16 -20 -23 -25 -25 -25 -25 -27 -27 -28 -28 -28 -28 -29 -30 -31 -32 -31 -32 -33 -34 -34 -36 -38 -38 -39 -39 -41 -42 -43 -43 -43 -45 -44 -46 -46 -46 -45 -45 -45 -43 -43 -40 -39 -36 -34 -32 -29 -27 -23 -21 -19 -19 -17 -15 -15 -14 -13 -12 -13 -13 -12 -11 -10 -9 -8 -7 -8 -9 -8 -7 -7 -8 -6 -5 -4 -3 -2 0 1 4 7 9 9 10 11 11 10 7 4 1 -1 -2 -3 -5 -5 -5 -5 -3 -3 -3 -3 -2 -1 0 0 -1 -3 -5 -6 -6 -6 -5 -4 -3 -3 -4 -3 0 3 4 2 0 -3 -4 -5 -4 -5 -4 -2 -1 -2 -2 0 6 15 28 43 58 71 82 94 103 110 111 106 93 76 60 44 32 26 23 18 12 8 7 7 5 4 4 5 4 3 2 2 2 1 0 0 -1 -1 -2 -2 -3 -4 -4 -4 -5 -7 -8 -8 -9 -10 -11 -11 -12 -13 -14 -14 -14 -15 -14 -13 -12 -12 -11 -8 -6 -4 -1 2 4 6 8 10 12 14 14 15 16 16 17 18 18 18 19 20 21 21 21 22 22 22 22 22 23 24 25 26 27 27 28 31 34 37 38 40 39 40 40 39 36 31 28 26 26 24 23 22 22 22 24 25 25 25 25 27 26 25 24 23 22 20 20 21 22 21 22 24 25 27 28 30 30 29 27 25 23 21 21 21 23 23 24 22 22 23 30 41 54 68 81 93 104 113 121 127 129 121 108 92 74 58 48 46 43 39 32 29 26 24 23 23 23 21 20 19 18 18 17 18 17 16 15 15 14 13 13 12 11 10 9 10 11 10 8 7 7 7 7 7 6 4 3 3 4 4 5 6 8 9 10 13 16 18 20 22 24 24 25 27 29 30 30 30 31 30 31 32 32 32 31 33 35 35 33 33 34 35 37 37 38 37 38 41 43 46 46 47 47 46 45 45 43 38 35 33 33 31 30 29 30 30 30 31 32 32 32 33 33 32 30 29 29 29 29 29 29 28 28 28 29 30 31 33 34 33 31 29 27 25 25 27 28 29 29 28 27 29 34 44 56 68 80 89 100 107 116 121 123 117 105 91 74 60 52 51 47 42 36 34 33 32 32 30 29 27 25 25 24 22 21 22 22 22 20 20 20 19 19 19 19 18 17 15 14 12 10 10 10 9 7 7 7 6 5 7 8 8 8 9 10 12 13 15 17 19 21 23 26 28 29 30 31 30 31 31 32 32 33 33 33 34 33 34 34 34 34 34 36 36 36 36 37 37 39 41 43 46 45 46 46 47 47 45 43 39 36 34 34 32 30 29 29 30 30 30 30 31 32 33 33 33 32 30 29 28 29 29 29 28 27 27 28 29 30 31 31 30 29 27 26 24 23 23 25 26 27 27 26 28 32 40 51 63 75 84 97 104 112 115 115 108 95 81 64 51 43 42 41 36 31 26 25 23 22 19 18 17 14 15 15 14 13 12 11 9 8 7 7 6 5 5 5 5 3 2 1 0 0 -1 -2 -3 -3 -3 -4 -4 -5 -6 -6 -6 -7 -5 -2 0 0 2 5 7 8 10 12 13 13 13 15 15 16 16 17 18 18 20 21 20 18 19 20 19 18 17 18 18 19 20 21 23 24 26 28 29 30 31 33 32 29 26 22 19 17 17 15 13 12 13 13 13 13 13 14 14 14 13 13 12 12 12 12 11 10 9 9 8 8 10 12 13 14 14 13 10 7 5 4 4 4 6 6 4 2 2 6 13 23 35 48 58 69 79 89 95 101 100 90 76 58 43 30 22 19 16 12 6 3 2 0 0 -1 -2 -4 -5 -6 -7 -8 -9 -10 -11 -11 -12 -14 -14 -15 -16 -18 -17 -17 -18 -20 -21 -22 -23 -24 -25 -25 -26 -27 -28 -28 -29 -29 -27 -26 -25 -24 -23 -21 -19 -18 -17 -15 -14 -12 -10 -8 -6 -5 -4 -3 -3 -2 -1 -1 -1 -1 0 1 1 1 0 0 0 -1 0 1 2 2 2 3 5 6 9 11 11 10 10 12 12 11 8 5 3 1 1 0 -1 -2 -1 0 -1 -2 -1 0 1 1 1 1 0 -1 -2 -2 -3 -3 -3 -3 -3 -3 -1 1 3 4 3 2 0 -3 -6 -7 -7 -7 -7 -6 -6 -6 -2 2 10 20 32 45 55 67 76 86 94 97 95 81 65 46 30 20 15 12 7 1 -2 -4 -5 -6 -8 -9 -8 -9 -10 -11 -11 -11 -13 -13 -14 -14 -15 -17 -17 -17 -18 -18 -19 -19 -20 -21 -22 -24 -25 -26 -26 -27 -29 -29 -29 -29 -28 -29 -28 -27 -27 -26 -24 -21 -20 -18 -16 -14 -13 -12 -10 -8 -7 -6 -4 -4 -4 -2 0 0 0 0 1 1 0 0 0 0 0 1 2 1 1 2 3 4 5 6 9 11 13 14 15 15 15 15 14 10 7 4 4 3 2 1 1 3 3 3 3 3 3 5 6 6 5 5 4 2 1 1 2 3 3 3 3 4 4 6 8 9 7 7 6 4 2 0 0 0 0 1 1 1 3 9 19 31 43 56 69 81 92 102 113 112 105 88 69 50 35 28 24 20 14 9 6 4 2 1 1 0 -1 -2 -3 -4 -4 -4 -5 -6 -7 -8 -7 -7 -8 -9 -9 -10 -12 -12 -13 -14 -15 -16 -18 -19 -20 -20 -19 -20 -20 -20 -20 -20 -21 -19 -18 -16 -15 -12 -9 -8 -7 -5 -3 -1 0 1 3 4 4 4 5 5 5 6 6 7 … ]} {[QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T … ]}
{[ 7 7 7 7 8 8 8 8 8 8 9 9 9 9 9 10 11 12 13 14 15 16 18 22 26 27 26 25 25 23 21 18 15 12 11 10 8 6 5 6 7 8 9 10 10 10 10 10 9 8 6 5 5 5 6 7 8 8 7 8 11 14 15 15 13 11 7 6 6 8 9 11 12 11 10 12 20 29 42 57 72 86 96 107 113 119 115 106 91 72 57 44 36 30 25 18 12 7 5 5 4 2 0 0 0 -1 -2 -3 -3 -3 -4 -4 -5 -7 -9 -10 -10 -11 -12 -13 -14 -16 -18 -19 -20 -21 -23 -23 -24 -25 -25 -26 -26 -26 -25 -24 -22 -21 -20 -18 -16 -14 -12 -9 -8 -7 -5 -2 -1 0 1 2 2 1 2 2 2 2 3 4 3 4 4 5 4 4 4 5 6 6 7 8 9 10 14 18 20 21 21 21 20 18 16 12 7 4 3 3 1 -1 -2 -3 -3 -2 0 0 0 0 0 0 0 -1 -2 -2 -3 -4 -3 -2 -2 -1 0 1 2 4 5 4 3 0 -3 -5 -4 -3 -1 1 0 0 0 2 7 16 30 45 58 70 80 90 97 102 102 94 81 63 47 32 22 18 15 9 1 -3 -5 -7 -8 -9 -9 -10 -11 -11 -11 -11 -12 -13 -12 -13 -14 -17 -17 -18 -19 -19 -20 -20 -21 -23 -24 -25 -27 -28 -28 -28 -28 -29 -30 -31 -31 -32 -31 -31 -31 -28 -26 -24 -23 -22 -20 -17 -15 -13 -11 -9 -8 -7 -5 -3 -3 -2 -2 -1 -1 -1 -1 0 0 -1 0 0 1 1 2 2 1 0 1 1 3 4 6 8 9 12 15 17 18 17 17 16 13 10 8 4 3 2 2 1 0 -1 -1 0 1 2 3 5 4 3 2 1 1 0 0 0 0 0 0 0 0 1 2 4 7 7 5 4 2 0 -2 -3 -3 -2 -1 0 -1 -3 -2 4 13 24 36 51 63 73 82 90 98 101 97 86 69 52 36 26 21 18 15 10 4 1 0 -1 -2 -2 -2 -3 -3 -4 -5 -5 -5 -6 -6 -7 -7 -8 -9 -9 -10 -11 -11 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -20 -19 -19 -19 -19 -17 -16 -15 -14 -12 -9 -8 -5 -4 -2 -2 0 3 5 6 7 7 8 8 8 8 8 7 8 9 9 9 9 10 10 10 11 11 11 11 11 12 14 14 15 17 19 20 22 24 25 24 24 23 22 19 15 13 10 10 9 9 7 8 9 10 10 9 10 11 11 10 11 11 10 9 9 9 8 8 9 10 10 10 12 14 16 16 15 14 11 7 5 4 4 4 5 7 6 6 7 13 22 32 46 61 74 86 96 108 114 116 110 96 78 61 49 40 35 30 25 19 13 10 8 7 6 6 6 6 5 4 4 4 3 3 3 3 2 1 0 0 -1 -2 -2 -3 -3 -5 -5 -6 -7 -9 -10 -10 -11 -12 -13 -13 -13 -13 -12 -12 -11 -10 -8 -5 -3 -2 -1 0 2 4 7 10 12 13 14 14 13 13 12 12 12 12 12 11 11 11 10 11 11 10 9 9 8 7 8 10 12 13 15 17 20 22 24 24 22 21 20 20 17 13 9 8 8 6 4 2 0 1 4 6 6 4 2 2 2 2 2 1 1 1 0 0 0 0 0 0 1 1 4 7 8 7 5 2 0 -4 -4 -3 -2 -1 0 1 0 0 5 16 28 43 58 74 87 99 109 117 121 115 103 83 66 50 39 34 28 21 13 8 6 3 2 1 0 -1 -2 -2 -2 -3 -4 -4 -5 -6 -7 -7 -7 -7 -8 -9 -10 -12 -13 -13 -15 -16 -17 -17 -18 -19 -20 -22 -23 -24 -25 -26 -26 -26 -25 -24 -22 -21 -20 -18 -15 -13 -11 -7 -5 -4 -2 -1 0 1 1 1 2 2 3 3 4 3 3 5 4 4 3 4 4 4 4 3 3 3 3 4 6 7 7 9 13 16 17 17 17 17 17 16 14 10 5 0 -1 -1 -3 -5 -6 -6 -6 -7 -5 -5 -5 -6 -4 -3 -4 -7 -8 -9 -10 -9 -8 -8 -9 -9 -10 -10 -9 -7 -4 -2 -2 -4 -7 -10 -14 -16 -16 -14 -13 -12 -12 -13 -11 -5 5 19 36 53 72 87 102 111 121 123 112 95 72 52 34 24 20 14 6 -2 -7 -9 -10 -10 -11 -13 -15 -16 -16 -17 -18 -18 -18 -18 -19 -20 -21 -22 -23 -24 -25 -26 -28 -29 -29 -30 -31 -34 -36 -37 -38 -38 -39 -39 -41 -42 -44 -44 -43 -42 -40 -38 -38 -36 -32 -29 -27 -24 -21 -20 -19 -17 -15 -12 -12 -10 -9 -9 -9 -9 -8 -8 -9 -8 -7 -7 -7 -7 -6 -7 -9 -9 -8 -7 -7 -5 -3 -2 -1 0 3 6 9 12 13 12 11 11 10 6 1 -3 -5 -7 -9 -10 -11 -12 -12 -11 -10 -10 -9 -8 -7 -8 -9 -9 -9 -10 -11 -11 -10 -10 -11 -10 -9 -9 -8 -5 -3 -3 -5 -6 -9 -12 -13 -14 -13 -12 -10 -8 -7 -7 -3 6 19 31 47 63 77 89 99 109 112 112 101 85 66 46 32 24 20 14 8 1 -2 -5 -6 -6 -7 -8 -8 -8 -8 -10 -11 -11 -11 -12 -13 -13 -14 -15 -15 -15 -16 -17 -18 -18 -19 -20 -20 -20 -22 -24 -26 -25 -26 -26 -26 -26 -27 -27 -26 -25 -23 -22 -19 -17 -15 -14 -12 -10 -8 -6 -4 -2 -1 0 0 1 2 2 3 4 4 3 3 4 4 5 5 6 6 6 6 6 6 6 7 8 9 9 10 13 15 17 20 23 25 24 23 23 22 20 17 13 10 8 8 7 4 2 2 3 4 5 5 5 5 5 6 6 4 3 3 3 3 3 3 3 3 4 4 6 8 10 11 9 6 2 0 -1 -2 -1 0 1 2 0 0 2 10 19 31 46 60 72 82 92 99 102 103 93 80 64 48 34 26 23 20 14 8 4 3 2 1 0 0 0 -1 -2 -2 -2 -2 -3 -3 -3 -3 -4 -5 -5 -5 -6 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -16 -16 -16 -17 -17 -16 -16 -14 -12 -10 -9 -7 -4 -2 0 1 3 5 7 8 9 11 12 12 13 13 13 13 13 13 12 12 13 13 13 13 13 14 14 14 14 15 15 16 18 20 21 23 26 29 30 31 31 30 29 26 23 18 14 13 12 12 9 8 8 9 10 11 11 10 10 10 11 11 10 9 8 8 7 6 7 7 7 8 10 11 12 13 14 12 10 8 6 4 4 4 5 6 5 4 6 10 17 29 43 56 69 79 90 97 102 106 106 99 85 69 51 38 30 27 25 18 12 8 7 7 5 5 5 5 4 4 4 3 2 2 2 1 0 0 0 0 -1 -1 -2 -4 -5 -5 -6 -7 -9 -9 -10 -11 -13 -13 -13 -14 -15 -15 -15 -15 -14 -13 -11 -9 -7 -5 -4 -2 0 2 4 5 6 8 10 10 10 11 11 11 10 11 12 12 12 12 13 12 11 12 13 13 13 14 15 16 16 17 18 19 23 26 29 29 29 29 29 27 24 21 17 14 11 10 9 7 7 7 9 9 9 10 11 10 9 9 9 8 7 7 7 6 6 5 6 6 6 8 10 12 13 12 11 8 5 2 1 0 0 2 3 3 2 4 8 15 26 41 57 71 84 96 107 115 119 116 104 85 66 49 38 31 28 23 16 10 6 5 4 2 2 2 2 1 0 0 -1 -2 -3 -2 -2 -2 -3 -3 -5 -6 -7 -8 -8 -10 -11 -12 -13 -13 -15 -16 -18 -19 -20 -19 -19 -18 -18 -18 -17 -16 -15 -13 -11 -9 -7 -4 -1 1 2 4 7 8 10 12 13 13 13 14 14 14 14 15 15 14 13 13 14 15 15 15 16 16 16 16 18 18 19 20 22 24 26 28 30 31 31 31 31 30 28 24 21 18 17 15 14 12 11 13 15 16 15 15 16 16 15 15 15 14 13 11 12 12 12 12 13 13 13 13 15 18 19 18 17 15 12 10 9 8 8 8 8 8 7 7 13 21 30 43 57 71 81 91 102 108 113 109 99 84 67 52 40 35 30 26 20 14 11 9 10 9 8 7 7 6 5 5 4 4 3 3 3 2 1 1 1 0 0 -1 -1 -2 -4 -4 -4 -5 -7 -8 -8 -9 -10 -11 -11 -11 -12 -11 -9 -7 -7 -5 -3 -2 -1 1 4 5 7 10 12 12 13 14 16 16 15 15 16 16 16 17 … ]} {[T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P P n/a n/a … ]}
由于数据集很大,每个网络的训练过程可能需要几分钟。如果同时有 GPU 和 Parallel Computing Toolbox?,则 MATLAB 会自动使用 GPU 以加快训练速度。否则将使用 CPU。
可以跳过训练步骤,使用以下选择下载预训练网络。如果要像示例中那样训练网络,请选择“Train Networks”。如果要跳过训练步骤,请选择“Download Networks”,一个文件(其中包含所有三个预训练网络 -?rawNet
、filteredNet
?和?fsstNet-
)将下载到临时目录中。如果要将下载的文件放在不同于?tempdir
?的文件夹中,请在后续说明中更改目录名称。
actionFlag = "Train networks";
if actionFlag == "Download networks"
% Download the pre-trained networks
dataURL = 'https://ssd.mathworks.com/supportfiles/SPT/data/QTDatabaseECGSegmentationNetworks.zip'; %#ok<*UNRCH>
modelsFolder = fullfile(tempdir,'QTDatabaseECGSegmentationNetworks');
modelsFile = fullfile(modelsFolder,'trainedNetworks.mat');
zipFile = fullfile(tempdir,'QTDatabaseECGSegmentationNetworks.zip');
if ~exist(modelsFolder,'dir')
websave(zipFile,dataURL);
unzip(zipFile,fullfile(tempdir,'QTDatabaseECGSegmentationNetworks'));
end
load(modelsFile)
end
下载的网络和新训练的网络之间的结果可能略有不同,因为网络是使用随机初始权重训练的。
首先,使用来自训练数据集的原始 ECG 信号训练 LSTM 网络。
在训练前定义网络架构。指定大小为 1 的?sequenceInputLayer
,以接受一维时间序列。用?'sequence'
?输出模式指定一个 LSTM 层,以便为信号中的每个采样提供分类。使用 200 个隐含节点以获得最佳性能。指定输出大小为 4 的?fullyConnectedLayer
,对每个波形类指定一个层。添加一个?softmaxLayer
?和一个?classificationLayer
?以输出估计的标签。
layers = [ ...
sequenceInputLayer(1)
lstmLayer(200,'OutputMode','sequence')
fullyConnectedLayer(4)
softmaxLayer
classificationLayer];
为训练过程选择选项,以确保获得良好的网络性能。
options = trainingOptions('adam', ...
'MaxEpochs',10, ...
'MiniBatchSize',50, ...
'InitialLearnRate',0.01, ...
'LearnRateDropPeriod',3, ...
'LearnRateSchedule','piecewise', ...
'GradientThreshold',1, ...
'Plots','training-progress',...
'shuffle','every-epoch',...
'Verbose',0,...
'DispatchInBackground',true);
由于整个训练数据集可放入内存,因此,如果 Parallel Computing Toolbox? 可用,可以使用数据存储的?tall
?函数以并行方式变换数据,然后将其收集到工作区中。神经网络训练是迭代进行的。在每次迭代中,数据存储从文件中读取数据,变换数据,然后更新网络系数。如果数据可放入计算机的内存中,将数据导入工作区可以加快训练速度,因为数据只需读取和变换一次。请注意,如果数据无法放入内存,您必须将数据存储传递给训练函数,并且在每轮训练中执行变换。
为训练集和测试集创建 tall 数组。
tallTrainSet = tall(trainDs);
Starting parallel pool (parpool) using the 'Processes' profile ... Connected to the parallel pool (number of workers: 8).
tallTestSet = tall(testDs);
现在调用 tall 数组的?gather
?函数来计算整个数据集上的变换,并获得具有训练和测试信号及标签的元胞数组。
trainData = gather(tallTrainSet);
Evaluating tall expression using the Parallel Pool 'Processes': - Pass 1 of 1: Completed in 10 sec Evaluation completed in 11 sec
trainData(1,:)
ans=1×2 cell array
{[0 0 0 0 0 0 1 1 1 1 1 1 0 1 2 1 1 2 2 2 3 4 6 8 11 15 18 18 17 17 17 16 14 12 8 4 2 1 0 -1 -2 -1 0 0 0 1 2 2 2 2 1 0 -1 -1 -2 -3 -3 -2 -2 -2 -1 0 4 5 5 3 2 0 -1 -1 0 2 3 5 5 3 4 8 15 25 36 50 63 73 83 90 97 99 98 88 74 58 42 30 22 19 15 10 5 1 -1 -2 -2 -3 -4 -5 -6 -7 -9 -9 -10 -12 -13 -13 -12 -13 -14 -15 -15 -16 -18 -19 -20 -21 -22 -21 -22 -23 -24 -25 -25 -26 -27 -28 -29 -29 -28 -26 -25 -24 -23 -21 -19 -18 -16 -14 -12 -11 -9 -7 -6 -5 -5 -3 -3 -3 -3 -2 -2 -2 -2 -1 -1 -2 -2 -1 -1 -1 -1 0 0 0 -1 0 1 2 3 5 7 8 11 13 13 13 12 11 9 6 2 0 -2 -3 -5 -7 -8 -8 -7 -5 -4 -5 -4 -3 -4 -4 -5 -5 -6 -8 -9 -9 -8 -9 -9 -8 -6 -6 -4 -2 -3 -4 -5 -6 -7 -8 -8 -7 -6 -5 -6 -8 -7 -5 2 12 24 36 48 58 66 72 78 83 82 75 61 46 30 18 11 9 6 0 -4 -8 -9 -11 -12 -12 -13 -13 -14 -14 -15 -17 -17 -17 -17 -18 -18 -18 -19 -21 -22 -23 -23 -25 -25 -26 -26 -27 -28 -29 -30 -31 -32 -32 -33 -33 -34 -34 -34 -34 -32 -31 -30 -29 -27 -25 -23 -22 -19 -17 -15 -15 -14 -12 -11 -11 -9 -8 -8 -8 -8 -9 -9 -8 -8 -8 -8 -9 -8 -7 -7 -8 -8 -7 -7 -7 -6 -5 -3 -3 -1 2 4 5 6 7 6 5 4 2 -2 -5 -7 -7 -8 -10 -10 -10 -10 -9 -9 -7 -7 -6 -5 -5 -6 -8 -10 -11 -12 -12 -11 -11 -11 -10 -9 -7 -6 -5 -6 -7 -9 -11 -13 -14 -14 -14 -12 -11 -10 -11 -10 -6 0 10 22 35 47 58 68 76 80 83 78 67 51 36 22 12 6 3 -1 -6 -10 -12 -13 -14 -16 -17 -17 -17 -18 -18 -18 -19 -20 -20 -20 -20 -20 -19 -19 -20 -21 -22 -23 -25 -26 -26 -26 -26 -27 -27 -28 -28 -29 -28 -29 -28 -28 -29 -28 -27 -25 -25 -23 -22 -21 -19 -17 -15 -14 -12 -10 -9 -8 -7 -6 -5 -5 -5 -5 -5 -5 -5 -4 -4 -4 -3 -3 -3 -4 -3 -3 -3 -3 -4 -3 -4 -4 -2 -1 0 2 4 8 10 10 10 10 9 8 6 4 0 -3 -5 -5 -7 -9 -9 -8 -7 -8 -8 -7 -7 -7 -6 -6 -6 -7 -9 -9 -10 -11 -11 -11 -10 -10 -9 -7 -5 -3 -4 -5 -7 -9 -10 -11 -9 -8 -6 -4 -3 -4 -6 -5 0 6 16 27 40 51 60 68 75 82 81 77 66 52 39 27 17 10 6 2 -2 -6 -10 -12 -13 -14 -15 -16 -15 -16 -16 -17 -17 -17 -18 -18 -18 -17 -17 -16 -17 -17 -18 -19 -19 -20 -20 -21 -22 -23 -24 -25 -26 -26 -26 -26 -27 -26 -26 -26 -25 -24 -23 -22 -21 -19 -18 -16 -14 -11 -9 -8 -7 -5 -4 -4 -3 -2 -1 -1 -1 -1 -1 -2 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 5 7 10 14 16 17 15 14 13 12 11 8 5 1 0 0 -2 -4 -4 -3 -3 -2 -1 0 0 0 -1 -2 -3 -5 -5 -5 -6 -6 -5 -5 -5 -4 -2 0 1 2 1 0 -3 -5 -5 -5 -4 -2 0 0 -1 -1 1 7 14 26 39 53 63 73 81 87 90 87 80 65 51 38 26 18 12 8 3 -2 -6 -8 -9 -10 -11 -12 -12 -12 -14 -13 -12 -12 -13 -13 -14 -15 -16 -17 -16 -17 -18 -18 -17 -18 -20 -21 -22 -22 -24 -24 -24 -24 -24 -24 -23 -24 -24 -24 -23 -22 -21 -19 -16 -14 -13 -11 -9 -7 -5 -3 0 0 1 2 3 4 4 4 6 6 6 6 7 8 7 7 7 7 6 6 8 8 8 8 9 9 9 10 11 12 12 14 15 17 19 22 25 27 27 27 27 25 22 19 15 13 11 11 10 9 8 7 8 8 8 9 9 10 10 9 9 7 5 5 6 6 5 5 5 6 6 9 12 13 11 9 6 4 1 1 4 6 7 9 9 8 9 14 23 34 48 62 77 86 96 103 109 110 103 92 76 61 45 34 29 25 19 11 6 2 0 0 -1 -3 -5 -6 -6 -6 -7 -7 -7 -7 -8 -8 -8 -9 -10 -11 -11 -11 -12 -14 -15 -15 -16 -17 -17 -18 -19 -20 -21 -21 -22 -22 -21 -21 -20 -19 -18 -16 -15 -13 -11 -9 -7 -4 -1 1 2 4 5 6 7 8 9 9 9 9 9 9 9 8 9 10 10 11 12 12 11 11 11 11 10 11 11 12 13 14 15 15 15 17 20 24 28 29 30 29 28 28 27 24 20 16 14 13 12 11 10 9 8 9 9 9 9 10 11 11 10 9 8 7 7 6 6 6 6 7 7 8 10 12 13 11 8 5 3 1 0 2 5 6 6 5 4 6 12 22 35 50 62 77 88 97 103 108 110 104 94 78 62 45 34 29 26 21 14 9 5 3 1 0 -1 -2 -3 -4 -4 -5 -6 -6 -5 -6 -8 -8 -8 -8 -9 -10 -10 -12 -13 -14 -15 -15 -16 -17 -17 -19 -21 -22 -22 -23 -24 -24 -23 -24 -24 -22 -20 -19 -17 -14 -12 -10 -9 -7 -5 -4 -3 -1 1 3 4 5 7 7 7 8 8 8 7 7 8 7 7 7 7 5 5 5 5 5 5 6 7 7 7 7 8 9 10 11 13 16 18 20 21 20 20 19 18 15 12 9 7 6 4 3 2 2 2 2 3 2 1 2 3 4 3 3 2 1 0 0 -1 -1 -2 -2 -1 0 1 2 2 0 -3 -5 -8 -9 -9 -8 -6 -5 -6 -6 -5 -1 7 20 35 49 62 74 84 92 99 105 103 94 77 58 39 25 19 16 12 6 0 -3 -6 -9 -11 -12 -12 -14 -14 -14 -14 -15 -15 -16 -17 -17 -18 -17 -17 -18 -18 -19 -20 -22 -23 -23 -24 -26 -27 -28 -29 -30 -31 -30 -31 -31 -33 -33 -33 -32 -30 -30 -28 -27 -25 -22 -20 -18 -16 -13 -10 -8 -6 -4 -2 -2 -2 -1 0 -1 0 0 0 0 0 1 0 0 0 1 1 1 0 1 2 2 2 3 3 3 4 5 6 7 9 13 16 19 19 19 18 18 17 16 13 9 6 4 3 1 0 -2 -2 -2 -1 0 0 1 1 1 1 0 0 0 -2 -3 -3 -2 -3 -3 -4 -2 -1 0 1 1 0 -2 -5 -6 -9 -9 -7 -5 -3 -1 -1 0 2 8 18 32 46 59 71 83 94 101 107 106 98 83 65 49 35 27 23 21 15 7 2 0 0 -2 -4 -4 -6 -7 -8 -8 -9 -9 -9 -8 -9 -9 -10 -9 -10 -11 -11 -11 -12 -13 -14 -15 -16 -18 -18 -19 -20 -21 -22 -23 -24 -24 -24 -24 -24 -24 -23 -21 -19 -17 -16 -14 -11 -9 -7 -5 -2 -1 1 2 2 2 3 4 4 4 4 4 4 4 5 5 4 3 4 5 5 4 4 4 4 5 5 7 6 6 6 7 8 9 12 15 19 20 21 19 18 18 18 16 12 8 5 4 4 2 1 0 0 0 1 3 3 3 4 4 4 3 2 1 1 0 0 1 1 0 1 1 2 3 3 3 1 0 -1 -3 -5 -5 -3 -1 0 0 0 1 4 10 21 34 47 60 71 82 89 97 100 100 93 80 66 47 34 26 23 19 13 7 3 1 -1 -2 -3 -4 -6 -7 -6 -6 -6 -6 -6 -6 -7 -8 -9 -9 -9 -10 -10 -11 -12 -14 -15 -16 -17 -18 -19 -19 -21 -21 -22 -23 -24 -25 -25 -24 -23 -23 -21 -20 -19 -18 -16 -12 -10 -7 -5 -4 -3 -2 -1 0 1 1 2 2 2 1 1 1 0 0 1 1 0 0 1 1 1 1 2 3 4 3 3 3 3 4 5 7 7 8 11 13 15 16 16 16 15 14 12 10 7 4 3 2 0 0 0 1 0 0 0 1 1 2 3 3 1 0 0 -1 -2 -3 -2 -2 -1 -1 0 0 1 2 2 1 -1 -4 -6 -7 -7 -6 -5 -4 -4 -5 -3 0 5 14 27 42 56 67 79 87 96 101 105 101 87 71 53 39 29 24 22 16 10 5 2 1 0 -1 -2 -3 … ]} {[n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a P P P P P P P P P P P P P P P P P P P P n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS QRS n/a n/a n/a n/a n/a n/a n/a n/a T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T n/a n/a n/a n/a n/a n/a n/a n/a … ]}
testData = gather(tallTestSet);
Evaluating tall expression using the Parallel Pool 'Processes': - Pass 1 of 1: Completed in 2.9 sec Evaluation completed in 3 sec
使用?trainNetwork
?命令训练 LSTM 网络。
if actionFlag == "Train networks"
rawNet = trainNetwork(trainData(:,1),trainData(:,2),layers,options);
end
图窗中的训练准确度和损失子图跟踪所有迭代的训练进度。使用原始信号数据,网络将大约 77% 的采样正确分类为属于 P 波、QRS 复波、T 波或不带标签的区域?"n/a"
。
使用经过训练的 LSTM 网络和?classify
?命令对测试数据进行分类。指定小批量大小为 50 以匹配训练选项。
predTest = classify(rawNet,testData(:,1),'MiniBatchSize',50);
混淆矩阵提供了一种直观的分类性能可视化方式。使用?confusionchart
?命令计算用于测试数据预测的总体分类准确度。对于每个输入,将分类标签的元胞数组转换为行向量。指定行归一化显示,以每个类的采样百分比形式查看结果。
confusionchart([testData{:,2}],[predTest{:}],'Normalization','row-normalized');
使用原始 ECG 信号作为网络输入,则只有大约 60% 的 T 波采样、40% 的 T 波采样和 60% 的 QRS 复波采样是正确的。为了提高性能,请在输入到深度学习网络之前应用一些 ECG 信号特性的知识,例如由患者呼吸运动引起的基线漂移。
这三种心跳形态占据不同频带。QRS 复波的典型频谱以大约 10-25 Hz 为中心频率,并且其分量低于 40 Hz。发生 P 波和 T 波的频率甚至更低:P 波分量低于 20 Hz,T 波分量低于 10 Hz 。
基线漂移是由患者呼吸运动引起的低频 (< 0.5 Hz) 振荡。这种振荡与心跳形态无关,不会提供有意义的信息 。
设计一个通带频率范围为 [0.5, 40] Hz 的带通滤波器,以消除漂移和任何高频噪声。消除这些分量可改进 LSTM 训练,因为网络不会学习不相关特征。对 tall 数据元胞数组使用?cellfun
?以并行方式对数据集进行滤波。
% Bandpass filter design
hFilt = designfilt('bandpassiir', 'StopbandFrequency1',0.4215,'PassbandFrequency1', 0.5, ...
'PassbandFrequency2',40,'StopbandFrequency2',53.345,...
'StopbandAttenuation1',60,'PassbandRipple',0.1,'StopbandAttenuation2',60,...
'SampleRate',250,'DesignMethod','ellip');
% Create tall arrays from the transformed datastores and filter the signals
tallTrainSet = tall(trainDs);
tallTestSet = tall(testDs);
filteredTrainSignals = gather(cellfun(@(x)filter(hFilt,x),tallTrainSet(:,1),'UniformOutput',false));
Evaluating tall expression using the Parallel Pool 'Processes': - Pass 1 of 1: Completed in 11 sec Evaluation completed in 11 sec
trainLabels = gather(tallTrainSet(:,2));
Evaluating tall expression using the Parallel Pool 'Processes': - Pass 1 of 1: Completed in 3.3 sec Evaluation completed in 3.7 sec
filteredTestSignals = gather(cellfun(@(x)filter(hFilt,x),tallTestSet(:,1),'UniformOutput',false));
Evaluating tall expression using the Parallel Pool 'Processes': - Pass 1 of 1: Completed in 2.4 sec Evaluation completed in 2.5 sec
testLabels = gather(tallTestSet(:,2));
Evaluating tall expression using the Parallel Pool 'Processes': - Pass 1 of 1: Completed in 1.9 sec Evaluation completed in 2.1 sec
对一种典型情况下的原始信号和滤波后的信号绘图。
trainData = gather(tallTrainSet);
Evaluating tall expression using the Parallel Pool 'Processes': - Pass 1 of 1: Completed in 3.8 sec Evaluation completed in 4.1 sec
figure
subplot(2,1,1)
plot(trainData{95,1}(2001:3000))
title('Raw')
grid
subplot(2,1,2)
plot(filteredTrainSignals{95}(2001:3000))
title('Filtered')
grid
?尽管滤波信号的基线可能会使习惯于在医疗设备上进行传统 ECG 测量的医生感到困惑,但实际上网络将受益于漂移消除。