挂过科的爆米花 · 比尔·盖茨:人工智能变革前夜的展望 | ...· 2 周前 · |
聪明的小熊猫 · (转)优化时该用SGD,还是用Adam?—— ...· 4 月前 · |
深沉的牙膏 · C语言错误 BUG报错整理 - 寒魔影 - 博客园· 1 年前 · |
捣蛋的针织衫 · JavaScript 中 ...· 1 年前 · |
苦闷的生姜
1 月前 |
1 School of Electronic Science and Engineering, Nanjing University, Xianlin Campus, Nanjing, China
1 School of Electronic Science and Engineering, Nanjing University, Xianlin Campus, Nanjing, China
2 Nanjing General Hospital of Nanjing Military command, Nanjing, China
1 School of Electronic Science and Engineering, Nanjing University, Xianlin Campus, Nanjing, China
1 School of Electronic Science and Engineering, Nanjing University, Xianlin Campus, Nanjing, China
1 School of Electronic Science and Engineering, Nanjing University, Xianlin Campus, Nanjing, China
The overall block diagram for our proposed R-wave peak detection algorithm can be found in Fig 3 .
The basic strategy behind the algorithm is that when BP is not monitored, we detected the ECG R-wave peaks directly and output them as the final results; on the contrary, the fusion of ECG and BP respective detection results were used as an output. First, a threshold algorithm was used to determine whether BP is monitored. Take the threshold ‘a’ = 10 and ‘b’ = 2. If the peak value is less than or equal to threshold ‘a’ or the mean value of its absolute value is less than threshold ‘b’, BP is regarded as not being monitored.
In the following subsections, three blocks, including the ECG detection, BP detection and fusion, will be thoroughly explained.
The flowchart of ECG R-wave peak detection is shown in Fig 4 .
Preprocessing-ecg: The ECG preprocessing procedure can be seen in Fig 5 . To remove the 50 Hz interference, a notch filter (at 50 Hz) is used. To suppress the baseline wander, a two-order smooth filter (0.6 s window) is applied to ECG. Finally, a bandpass FIR filter between 0.5–80 Hz is used to further suppress the noise of the ECG.
Remove pacemaker pulse if it exists: The overall decision tree for removing pacemaker pulse is shown in Fig 6 .
This step aims to find all paced beats if they exist, and a peak detector based on the max search is applied (Sameni 2010 [ 14 ]). In this detector, the window length of max search is variable, and the smaller it is, the more peaks will be detected. After many tests, we set it to 0.2 s, which is small enough to detect all the possible pacemaker pulses.
Before detecting the wave peaks, we cut the signal into segments, with lengths set to 24 s, and then performed the peak detection above on each segment separately.
To determine whether the pacemaker pulse exists, the specific procedures are as follows.
After determining the ECG signal pacemaker pattern, mark the peaks whose correlation coefficients with P_template are higher than 0.8, and then set their voltage to 0.
After determining the ECG signal pacemaker pattern, mark the peaks whose correlation coefficients with P_template are higher than 0.8, and then set their voltage to 0.
Peak Detection: The detection accuracy of the ECG signal will surely affect the final result, especially when BP is not monitored. Therefore, besides the ECG preprocessing method shown in Fig 5 , we can use an additional preprocessing method called wavelet transformation to decrease the noise and interference. In this article, a CWT (continuous wavelet transform) was used. The wavelet basis is cmor1-1.5, and the wavelet scale is 120, when the sampling rate is 1000 Hz. When the sampling rate is ‘fs’, the wavelet scale calculation formula is as follows:
After obtaining the enhanced signal using CWT, we also cut it into segments with lengths set to 24 s. Then, the peak detection will be performed on each segment separately.
The peak detection is also based on the peak detector (Sameni 2010). However, the differences from the detection of pacemaker pulses are: (1) the max search window length is set to 0.4 s; (2) a threshold is applied. The method of obtaining the threshold is: (1) cut the current detected segment into 10 shorter segments and get the maximal value of each shorter segment first; (2) the threshold is just 1/2 as much as the minimum of all the maximal values. The peaks whose values are higher than the threshold will remain.
Peak modification-ecg: The modification of the ECG peak detection result is based on pattern recognition. The main steps are: (1) extracting two features of each detected R-wave peak, one is the correlation coefficient with the ECG template (the template is made with R-wave peak detection results), and the other is the normalized peak amplitude; (2) using linear discriminant analysis (LDA) to combine the two features into a new one (the combination vector has been calculated in advance); (3) setting a threshold, and if the value of the new feature is higher than the threshold, the corresponding R-wave peak will remain; otherwise, it will be deleted.
Modification is performed on each segment whose duration is set to 24 s. When modifying, after calculating the feature combination value for each detected peak, the threshold for selecting the R-wave peaks is adapted. Try different thresholds (from small to large) and select the threshold that corresponds to the smallest standard deviation value of the RR intervals as the final threshold.
The flowchart of BP wave peak detection is shown in Fig 7 .
Preprocessing-bp: The flowchart of BP preprocessing is shown in Fig 8 . To suppress the baseline wander, a two-order smooth filter (2s window) is applied to the BP.
Peak detection: Implementing the same peak detection based on the max search and threshold as ECG on the preprocessed BP signal, the BP detection results can be obtained.
Peak Modification-bp: The BP modification is based on the template method due to its simple and relatively stable waveform.
In this step, first cut the signals into shorter segments, and for each segment, when BP is monitored abnormally ( Fig 9A ), we can only output ECG initial detection results directly. When the BP waveform is better than the ECG waveform ( Fig 9B and 9C ), considering that the continuous BP signal features a simple waveform, which is easy-to-understand and shows periodic synchronization with ECG, the BP initial detection result can be used to help detect the ECG R-wave (taking the detected BP peak positions as a reference and searching for ECG R-wave peaks based on the ‘differ’ within the range of ‘thrm’, which is set to 0.1 s after a large number of tests). In contrast, when the ECG waveform is better ( Fig 9D ), we can ignore the BP and output ECG initial detection results directly. The flow diagram of the fusion can be seen in Fig 10 .
Compare the quality of ECG and BP: The template matching algorithm is used to compare the quality of the BP waveform and ECG waveform on each segment. Segments that are too short will make it difficult to establish a waveform template, while segments that are too long will lower the performance of the fusion step. Thus, first, we cut the ECG and BP signal into segments of 24 s in length and made templates for each segment. Then, each segment was cut into shorter segments of 4s in length, and the quality of ECG and BP on each shorter segment was compared. The specific steps are as follows:
The above algorithm is based on the condition of one ECG and one BP signal. However, there are 3 ECG signal leads for each record of the MGH/MF waveform database, so a special step is added when testing on this database.
This step, based on the template matching method, is used to pick out the best-quality ECG signal from the three ECG leads. For each ECG signal, we calculated its quality index name ‘Reecg’ and chose the lead with the highest ‘Reecg’ for further processing. The steps for calculating ‘Reecg’ are as follows:
First, we tested the algorithm with the 200 training records from the challenge database given by the official website and then compared this with the official ‘qrs’ marks from the ‘.atr’ files to get the final score. The details about the scoring rules can be found in Silva et al. [ 12 ]. In addition, Se (Sensitivity) = TP/(TP+FN) and PPV (Positive Predictivity) = TP/(FP+TP), where TP, FN, and FP represent the true positive (i.e., correct detected QRS), false negative (i.e., missed QRS) and false positive (i.e., extra detected QRS), respectively. Table 1 shows the results of the improved algorithm proposed in this paper and the recently published algorithms. The overall score of our algorithm is between the 1 st of Urška Pangerc et al.[ 15 ] and the 2 nd of Alistair E W Johnson et al.[ 16 ].
Algorithm |
Num. of
Records |
SE (%) | PPV (%) |
Score
(%) |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Min | Max | Ave. | σ | Gross | H | Min | Max | Ave. | σ | Gross | H | |||
Urška Pangerc et al. | 200 | - | - | 97.8 | - | 98.1 | - | - | - | 97.2 | - | 97.5 | - | 97.6 |
Alistair E W Johnson et al. | 200 | - | - | 96.5 | - | 96.9 | - | - | - | 95.1 | - | 94.2 | - | 95.6 |
M-code sample entry | 200 | - | - | 84.0 | - | 84.3 | - | - | - | 82.3 | - | 80.9 | - | 82.9 |
This paper for all Recordings | 200 | 37.6 | 100 | 96.5 | 7.23 | 96.7 | - | 40.1 | 100 | 97.8 | 6.84 | 98.3 | - | 97.3 |
This paper for Recordings with Pacemaker | 10 | 86.0 | 100 | 96.3 | 5.03 | 96.4 | 0 | 86.1 | 99.9 | 97.0 | 4.71 | 97.1 | 0 | 96.7 |
This paper for Recordings without Pacemaker | 190 | 37.6 | 100 | 96.6 | 7.34 | 96.7 | 0 | 40.1 | 100 | 97.8 | 6.94 | 98.3 | 0 | 97.4 |
Note: σmeans standard deviation, H means the result of the T-test, and them in tables below mean the same.
Similarly, we tested the algorithm with the MGH/MF waveform database and compared the score with that of Urška Pangerc et al. The overall comparative results are shown in Table 2 .
Algorithm |
Num. of
Records |
SE (%) | PPV (%) |
Score
(%) |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Min | Max | Ave. | σ | Gross | H | Min | Max | Ave. | σ | Gross | H | |||
Urška Pangerc et al. | 247 | - | - | 95.9 | - | 96.5 | - | - | - | 93.9 | - | 94.1 | - | 95.1 |
This paper for all Recordings | 247 | 42.3 | 100 | 96.2 | 6.04 | 96.3 | - | 25.5 | 100 | 96.9 | 8.97 | 97.0 | - | 96.6 |
This paper for Recordings with Pacemaker | 12 | 88.7 | 99.0 | 95.8 | 3.37 | 96.1 | 0 | 86.4 | 100 | 97.5 | 3.98 | 97.5 | 0 | 96.7 |
This paper for Recordings without Pacemaker | 235 | 42.3 | 100 | 96.2 | 6.15 | 96.3 | 0 | 25.5 | 100 | 96.9 | 9.15 | 97.0 | 0 | 96.6 |
The comparative scores show that our algorithm is superior to most competitors and comparable to the team (Urška Pangerc et al.) with the highest score.
Fig 11 shows our proposed fusion algorithm’s effectiveness. We can see that when the ECG waveform is in poor quality for noise interference, our fusion algorithm avoids some false and redundant detections and gets a better result. Fig 12 gives some other examples showing our algorithm’s effectiveness in detecting R-wave peaks.
From the test results, it has been shown that the detection accuracy and robustness of the proposed algorithm are both superior to the most competitors’ algorithms and very competitive with that of the best algorithm. Although fusion strategies are commonly used in the competitors’ works in the PhysioNet/Computing 2014 Cardiology Challenge [ 15 , 16 ], the fusion method proposed in this manuscript is different and seems more efficient. We also think that there are two main factors contributing to our algorithm’s effectiveness.
First is the setup of the offline pacemaker pulse template library in the training stage or pre-monitoring stage, which allows for the pacemaker pulses on the ECG to be detected and eliminated efficiently. From above Tables Tables1 1 and and2, 2 , we can know that the performance score of our algorithm is similar for recordings with and without artificial pacemaker pulses. We did T-test (α = 0.05) between recordings with artificial pacemaker and all recordings, also T-test (α = 0.05) between recordings without artificial pacemaker and all recordings, whose results are shown in Tables Tables1 1 and and2, 2 , indicating that our method has a good robustness to whether a data has pacemaker pulses or not.
Second is the R-wave judgment method. In the method, two features, excluding the RR intervals, are used, and their combination vector is determined using LDA at the training stage, which can improve the detection accuracy robustly. Since we do not use RR interval uniformity as a feature, the judgment method has good robustness in case of sudden RR-interval change. As seen in Fig 12C , when the RR-intervals show a sudden change, our algorithm still did not lead to false marks.
Further, we tested the independence of our algorithm from sudden changes in heart rate using all data in each database. We defined the heart rate variability of each data as its RMSSD, and assigned every data properly into one of 8 equal-number groups divided by RMSSD. After calculating the performance scores SE and PPV for each data, we statistically obtained their minimum, maximum, average and standard deviation σ, and the gross and overall performances for each divided group. After that, a T-test (α = 0.05) was performed on Se and PPV of each group of data and them of all data. Tables Tables3 3 and and4 4 have listed the tested results. Fig 13A and 13B are the graphs showing the overall performance score versus heart rate variability for two databases respectively.
RMSSD
(s) |
Num. of Records | SE (%) | PPV (%) |
Score
(%) |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Min | Max | Ave. | σ | Gross | H | Min | Max | Ave. | σ | Gross | H | |||
0–0.0243 | 25 | 37.6 | 100 | 94.7 | 13.2 | 95.8 | 0 | 40.1 | 100 | 97.1 | 11.93 | 98.9 | 0 | 96.6 |
0.0248–0.035 | 25 | 67.7 | 100 | 97.3 | 6.82 | 97.4 | 0 | 69.6 | 100 | 98.4 | 6.04 | 98.6 | 0 | 97.9 |
0.035–0.0423 | 25 | 85.0 | 100 | 98.9 | 3.00 | 98.8 | 1 | 82.1 | 100 | 99.0 | 3.52 | 99.0 | 0 | 98.9 |
0.0428–0.051 | 25 | 84.0 | 100 | 98.0 | 3.84 | 98.0 | 0 | 84.0 | 100 | 98.3 | 3.87 | 98.3 | 0 | 98.2 |
0.051–0.058 | 25 | 63.4 | 100 | 96.2 | 8.36 | 96.2 | 0 | 55.7 | 100 | 96.5 | 9.75 | 96.2 | 0 | 96.3 |
0.058–0.0686 | 25 | 83.7 | 100 | 97.3 | 4.12 | 97.1 | 0 | 83.1 | 100 | 98.7 | 3.48 | 99.3 | 0 | 98.1 |
0.0686–0.1062 | 25 | 80.8 | 100 | 97.8 | 4.00 | 97.7 | 0 | 80.9 | 99.9 | 98.9 | 3.76 | 99.1 | 0 | 98.4 |
0.1064–0.286 | 25 | 75.7 | 100 | 92.1 | 7.26 | 92.4 | 1 | 73.2 | 100 | 95.5 | 6.96 | 96.5 | 0 | 94.1 |
RMSSD
(s) |
Num. of Records | SE (%) | PPV (%) |
Score
(%) |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Min | Max | Ave. | σ | Gross | H | Min | Max | Ave. | σ | Gross | H | |||
0–0.040 | 31 | 67.2 | 100 | 97.7 | 6.02 | 97.3 | 0 | 64.3 | 100 | 97.1 | 6.81 | 97.8 | 0 | 97.5 |
0.040–0.054 | 31 | 70.4 | 99.7 | 97.2 | 5.31 | 97.3 | 0 | 79.8 | 100 | 97.8 | 4.95 | 98.1 | 0 | 97.6 |
0.054–0.065 | 31 | 42.3 | 100 | 96.0 | 10.26 | 95.6 | 0 | 44.8 | 100 | 97.1 | 10.01 | 97.1 | 0 | 96.4 |
0.065–0.0792 | 31 | 92.3 | 99.8 | 97.3 | 1.56 | 97.2 | 1 | 64.4 | 100 | 98.0 | 6.43 | 98.5 | 0 | 97.8 |
0.0798–0.0946 | 31 | 75.4 | 98.4 | 96.0 | 4.46 | 96.0 | 0 | 77.0 | 100 | 98.0 | 5.38 | 98.3 | 0 | 97.1 |
0.0955–0.1181 | 31 | 80.9 | 99.9 | 96.2 | 3.56 | 96.5 | 0 | 25.5 | 100 | 93.5 | 16.15 | 94.2 | 0 | 95.1 |
0.1181–0.145 | 31 | 67.1 | 99.8 | 95.2 | 5.63 | 95.3 | 0 | 53.4 | 100 | 97.2 | 8.53 | 97.1 | 0 | 96.2 |
0.152–0.292 | 30 | 59.4 | 98.9 | 94.0 | 7.36 | 94.2 | 0 | 58.4 | 100 | 96.4 | 8.47 | 96.8 | 0 | 95.4 |
Likewise, we tested the independence of our algorithm from the average heart rate size using all data in each database. We assigned every data into one of 10 pre-divided equal-bandwidth heart rate intervals, starting from 40 to 160 or 197 beats per minute. After calculating the performance scores SE and PPV for each data, we obtained the several statistic indexes and the gross and overall performance scores for each group, and the T-test (α = 0.05) was also performed. Their results for two databases are shown in Tables Tables5 5 and and6. 6 . Fig 13C and 13D are the curves of the performance score versus average heart rate for two databases.
Average HR
(Beats/Min) |
Num. of Records | SE (%) | PPV (%) |
Score
(%) |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Min | Max | Ave. | σ | Gross | H | Min | Max | Ave. | σ | Gross | H | |||
40–52 * | 1 | 98.7 | 98.7 | 98.7 | 0 | 98.7 | - | 98.4 | 98.4 | 98.4 | 0 | 98.4 | - | 98.6 |
52–64 | 11 | 80.8 | 98.9 | 91.0 | 6.56 | 91.7 | 1 | 73.2 | 98.7 | 90.9 | 8.79 | 92.7 | 1 | 91.6 |
64–76 | 17 | 67.7 | 99.6 | 91.0 | 10.07 | 90.7 | 1 | 69.6 | 100 | 93.4 | 9.62 | 92.9 | 0 | 92.0 |
76–88 | 26 | 37.6 | 100 | 94.6 | 12.71 | 95.8 | 0 | 40.1 | 100 | 96.1 | 11.98 | 97.5 | 0 | 96.0 |
88–100 | 45 | 86.2 | 100 | 98.4 | 3.01 | 98.3 | 1 | 94.7 | 100 | 99.5 | 0.83 | 99.5 | 1 | 98.9 |
100–112 | 50 | 85.0 | 100 | 98.6 | 3.03 | 98.4 | 1 | 82.1 | 100 | 99.3 | 2.53 | 99.3 | 1 | 98.9 |
112–124 | 27 | 77.8 | 100 | 97.2 | 5.13 | 96.5 | 0 | 94.1 | 100 | 99.4 | 1.17 | 99.4 | 1 | 98.1 |
124–136 | 18 | 63.4 | 100 | 97.4 | 8.50 | 97.5 | 0 | 55.7 | 100 | 97.3 | 10.39 | 97.2 | 0 | 97.3 |
136–148 * | 1 | 98.7 | 98.7 | 98.7 | 0 | 98.7 | - | 100 | 100 | 100 | 0 | 100 | - | 99.3 |
148–165 | 4 | 83.7 | 99.0 | 92.6 | 6.43 | 92.6 | 0 | 99.8 | 100 | 99.9 | 0.11 | 99.9 | 1 | 96.2 |
*: Unable to do T-test for the only one sample.
Average HR
(Beats/Min) |
Num. of
Records |
SE (%) | PPV (%) |
Score
(%) |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Min | Max | Ave. | σ | Gross | H | Min | Max | Ave. | σ | Gross | H | |||
40–52 | 6 | 94.7 | 99.4 | 96.3 | 2.11 | 96.3 | 0 | 94.5 | 100 | 98.0 | 2.04 | 98.1 | 0 | 97.2 |
52–64 | 7 | 88.7 | 100 | 95.7 | 7.32 | 95.7 | 0 | 91.3 | 100 | 97.5 | 3.23 | 97.5 | 0 | 96.6 |
64–76 | 30 | 67.1 | 100 | 95.6 | 6.36 | 95.5 | 0 | 53.4 | 100 | 97.2 | 8.59 | 96.7 | 0 | 96.2 |
76–88 | 42 | 82.5 | 99.8 | 96.9 | 5.57 | 96.9 | 0 | 93.2 | 100 | 99.4 | 1.29 | 99.5 | 1 | 98.2 |
88–100 | 37 | 88.9 | 100 | 97.5 | 3.44 | 97.5 | 1 | 85.8 | 100 | 99.0 | 2.49 | 99.1 | 1 | 98.3 |
100–112 | 41 | 42.3 | 99.3 | 95.9 | 9.12 | 96.0 | 0 | 44.8 | 100 | 98.0 | 8.66 | 98.1 | 0 | 97.0 |
112–124 | 19 | 80.9 | 99.9 | 96.7 | 1.66 | 97.4 | 0 | 25.5 | 100 | 95.3 | 16.97 | 96.6 | 0 | 96.5 |
124–136 | 11 | 92.9 | 99.7 | 97.5 | 4.08 | 97.6 | 0 | 81.0 | 100 | 97.6 | 5.63 | 97.8 | 0 | 97.6 |
136–148 | 3 | 95.2 | 99.0 | 96.9 | 13.51 | 96.9 | 0 | 94.1 | 100 | 98.0 | 3.35 | 98.2 | 0 | 97.5 |
148–197 | 4 | 86.5 | 97.4 | 92.8 | 3.85 | 92.8 | 0 | 98.7 | 99.8 | 99.4 | 0.47 | 99.4 | 1 | 96.1 |
In the above tables, H represents the T-test result, H = 0 represents that the group and the whole database pass the T-test at the level of α = 0.05, and the H 0 hypothesis is established, that is, we have sufficient confidence to say that there is no significant difference between the group and the population. Most of the H = 1 cases in the tables are caused by the concentration of the high scores (the average is high and the σ is small), and a small part is caused by the low scores caused by the poor signal in the sample (the average is low and the σ is large), which may be related to the fact that the data is not a standard normal distribution. Seemly, the scores are slightly reduced with the increase of HRV and average heart rate from the figures, but the T-test results show that this is not a significant trend. Therefore, generally speaking, the performance of our algorithm is not affected by the heart rate variability and average heart rate size.
Compared with the official reference annotations, our algorithm still has some false marks or missed detections. Fig 14A shows a missed detection case when the quality of the BP is better than the ECG, and Fig 14B shows a case of redundant detection in which the BP marks include a redundant mark. Fig 14C shows a hard case that the current ECG and BP segments are both of poor quality (data mgh122 of MGH/MF).
Interesting, in our experiment, we found a data that its official reference annotations may have too large R-peak position mark errors, resulting in our algorithm’s low score for it, shown in Fig 14D (data mgh026 of MGH/MF database).
Above we discuss how to do a fusion to improve the R-wave peaks marking in this paper, actually, our core algorithm may allow for synchronous extraction of RR interval and systolic blood pressure, which can be used for spontaneous baroreflex testing. The synchronous (beat-by-beat) extraction of RR intervals and systolic blood pressure values in the testing is not trivial, as the two time series may get out of synchronization if R-waves are missed but the systolic blood pressure peaks are still detected (or vice versa). We are interested in doing some work in adjusting our algorithm to adapt to spontaneous baroreflex testing better in the future. Positively, we must not use fusion of the detected peak results of the two kinds of series any more.
In this article, we put forward an algorithm to detect R-wave peaks with the help of the BP signal under the condition that the ECG and BP signal are recorded simultaneously. Experimental results show that this algorithm can surely improve the detection rate and robustness of the ECG R-wave peak detection. The algorithm is robust to ECG pacemaker pulses and sudden changes in heart rate.
The National Natural Science Foundation of China (No. 61271079) supported this paper. The URLs of the funders' website is http://www.nsfc.gov.cn/ . The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.
One database, called the challenge database, is provided by the PhysioNet/Computing in Cardiology Challenge 2014, and the other is the MGH/MF waveform database. Both of them can be downloaded from the Internet. ( https://www.physionet.org/physiobank/database/challenge/2014/ ). ( https://www.physionet.org/physiobank/database/mghdb/ ).
深沉的牙膏 · C语言错误 BUG报错整理 - 寒魔影 - 博客园 1 年前 |