A method for segmenting characteristic waves of electrocardiosignal and FS-Net model

By using the FS-Net model and adaptive waveform correction filter, the problem of difficult identification of ECG signal characteristic waves is solved, and efficient segmentation and enhancement of P wave, QRS wave and T wave are achieved, improving the accuracy and interpretability of ECG detection.

CN119074008BActive Publication Date: 2025-10-24HEBEI UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411379821.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-10-24
Estimated Expiration
2044-09-30

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively identify characteristic waves in electrocardiogram (ECG) signals, especially in disease conditions where the various changes in these characteristic waves increase the difficulty of identification.

Method used

The FS-Net model is combined with an adaptive waveform correction filter. Noise is removed through median filtering, Butterworth low-pass filtering, Pan-Tompkins algorithm and sliding window normalization. The characteristic waves of the ECG signal are corrected and enhanced. The encoder and decoder learn the dependency relationship between the characteristic waves. The characteristic wave segmentation is performed by combining self-attention and long short-term memory networks.

Benefits of technology

It improves the detection accuracy and interpretability of ECG signal characteristic waves, effectively segments and enhances P waves, QRS waves, and T waves, provides visualization of characteristic distribution and retrospection, and significantly improves the accuracy and feasibility of ECG detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119074008B_ABST
    Figure CN119074008B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of ECG feature wave segmentation method and FS-Net model, ECG feature wave segmentation method specifically includes the following steps: S1.ECG signal denoising;S2.Using Pan-Tompkins algorithm demarcation ECG signal R peak information, calculate RR interval information, then using sliding window to data normalization processing;S3.ECG signal waveform correction and feature enhancement: first, ECG signal is carried out smooth processing, then the QRS wave of ECG signal, P wave and T wave are corrected, finally feature enhancement is carried out;S4.FS-Net model is constructed;S5.ECG signal after processing in step S1-S3 is input into FS-Net model and is trained, realizes the segmentation to feature wave in ECG signal;S6.post-processing algorithm;S7.ECG signal segmentation: using the FS-Net model after training to the measured ECG signal is segmented.The present application is corrected and enhanced to ECG signal, effectively enhances the performance of P wave and T wave in electrocardiogram, improves the accuracy of feature wave detection.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to an electrocardiosignal analysis method, in particular to an electrocardiosignal feature wave segmentation method and an FS-Net model. BACKGROUND

[0002] Electrocardiogram detection has non-invasiveness and convenience, and 12-lead electrocardiogram has become an important method for detecting heart diseases. The detection of electrocardiogram feature waves has important clinical application value in the diagnosis, treatment decision, disease monitoring and prognosis evaluation of heart diseases. The morphology, interval and frequency of feature waves are direct reflections of cardiac electrical activity, and are crucial for the diagnosis of heart diseases. Different heart diseases can cause various changes in feature waves such as P wave, QRS segment and T wave, such as ST segment changes caused by myocardial ischemia and T wave inversion caused by myocardial infarction. These changes and the feature differences among leads in 12-lead electrocardiogram and among patients increase the difficulty of accurate identification of feature waves, making feature waves a challenge. SUMMARY

[0003] One of the purposes of the present application is to provide an electrocardiosignal feature wave segmentation method to solve the problem that feature waves are difficult to be effectively identified under disease conditions.

[0004] The second purpose of the present application is to provide an FS-Net model for segmenting electrocardiosignal feature waves to establish an effective model for segmenting electrocardiosignal feature waves.

[0005] One of the purposes of the present application is achieved as follows:

[0006] A method for segmenting electrocardiosignal feature waves, comprising the following steps:

[0007] S1. Electrocardiosignal denoising: using a median filter algorithm to correct the baseline drift of the electrocardiosignal, and using a third-order Butterworth low-pass filter to eliminate high-frequency noise in the electrocardiosignal;

[0008] S2. Electrocardiosignal peak normalization: using Pan-Tompkins algorithm to mark the R peak information of the denoised electrocardiosignal, calculating the RR interval information, and then selecting data using a sliding window and performing normalization processing on the data in the sliding window;

[0009] S3. Electrocardiosignal waveform correction and feature enhancement: first, performing smoothing processing on the normalized electrocardiosignal, then correcting the QRS wave, P wave and T wave of the electrocardiosignal, and finally performing feature enhancement on the P wave and T wave in the corrected electrocardiosignal;

[0010] S4. Model construction: constructing an FS-Net model for segmenting electrocardiosignal feature waves;

[0011] S5. Model training: input the electrocardiosignal processed by steps S1-S3 into the FS-Net model for training, so as to realize segmentation of P wave, QRS wave and T wave in the electrocardiosignal;

[0012] S6. Post-processing algorithm: correct the features of segmentation errors;

[0013] S7. Electrocardiosignal segmentation: use the trained FS-Net model to segment the feature waves of the measured electrocardiosignal.

[0014] Further, the low-pass cutoff frequency of the third-order Butterworth low-pass filter in step S1 is 0.5 hz.

[0015] Further, the size of the sliding window in step S2 is 1.1 times of the RR interval of 5s electrocardiosignal data near the current sampling point.

[0016] Further, the normalization formula is:

[0017]

[0018] Wherein, ECG nomalized represents an electrocardiosignal in a period of time, time1 is the start time of each sampling of the sliding window, time2 is the end time of each sampling of the sliding window, max is the maximum value of the amplitude of the electrocardiosignal in the sliding window, and abs is the absolute value of the amplitude of the electrocardiosignal corresponding to time1 to time2.

[0019] Further, the specific way of smoothing the electrocardiosignal in step S3 is:

[0020] The sliding window with a length of 60ms slides on the electrocardiosignal at a speed of 1 sampling point, the standard deviation of the data in each window is calculated, the point greater than the set threshold is taken as the feature wave, the amplitude of the electrocardiosignal less than the threshold is taken as 0, and the corrected electrocardiosignal is obtained, and the value of the set threshold is 1.2% of the maximum standard deviation;

[0021] Wherein, the calculation formula of smoothing is:

[0022]

[0023]

[0024] Wherein, ECG std represents the standard deviation of the electrocardiosignal, ECG amend (t) represents the corrected electrocardiosignal, ECG std (t) is the standard deviation of the sliding window at time t, max(ECG std ) is the maximum standard deviation of the sliding window at all times.

[0025] Further, the specific way of correcting the QRS wave of the electrocardio signal in step S3 is:

[0026] S3a-1. Taking absolute value of the amplitude of the electrocardio signal, and determining the QRS wave peak point of the electrocardio signal after taking absolute value by using Pan-Tompkins algorithm;

[0027] S3a-2. If the original amplitude corresponding to the QRS wave peak point is positive, it remains unchanged; if the original amplitude corresponding to the QRS wave peak point is negative, the original amplitude of the peak point is saved as its opposite number.

[0028] Further, the specific way of correcting the P wave and T wave in step S3 is:

[0029] S3b-1. Locating the position of T wave and P wave respectively, and calculating the mean value of T wave amplitude and P wave amplitude respectively;

[0030] S3b-2. When the mean value of T wave amplitude is negative, the T wave is inverted T wave; when the mean value of P wave amplitude is negative, the P wave is inverted P wave;

[0031] S3b-3. Counting the position of T wave twice zero-crossing point, and determining the inverted T wave according to the amplitude and vibration direction of T wave; counting the position of P wave twice zero-crossing point, and determining the inverted P wave according to the amplitude and vibration direction of P wave; if no zero-crossing point position appears, using statistical information to determine the inverted T wave and inverted P wave respectively;

[0032] S3b-4. Taking the absolute value of the amplitude of the inverted T wave and inverted P wave respectively.

[0033] Further, the specific way of enhancing the characteristics of P wave and T wave in step S3 is:

[0034] S3c-1. Moving the corrected electrocardio signal upward by 1mV, then the baseline of the electrocardio signal is 1mV;

[0035] S3c-2. Performing primary transformation on the moved electrocardio signal according to logarithmic function, and the transformation formula is:

[0036]

[0037] Wherein, ECG log (t) is the amplitude of the primary transformed electrocardio signal corresponding to time t;

[0038] S3c-3. Enhancing the transformed electrocardio signal, and the enhancement formula is:

[0039]

[0040] wherein, ECG enhance (t) is the enhanced amplitude of the corresponding electrocardio signal at time t;

[0041] S3c-4. The enhanced electrocardio signal is moved down by 1 mV, and the baseline of the electrocardio signal is 0 mV, and the electrocardio signal after moving down is processed by a Gaussian smoothing algorithm;

[0042] S3c-5. The R peak information of the Gaussian smoothed enhanced electrocardio signal is calibrated by using a Pan-Tompkins algorithm, the RR interval information is calculated, then the data is selected by using a sliding window, and the data in the sliding window is normalized;

[0043] S3c-6. The sliding window with a length of 60 ms is slid on the electrocardio signal at a speed of 1 sampling point, the standard deviation of the data in each window is calculated, the points greater than a set threshold are taken as feature waves, and the amplitudes of the electrocardio signals less than the threshold are taken as 0, to obtain a modified electrocardio signal, and the value of the set threshold is 3.5% of the maximum standard deviation;

[0044] S3c-7. Steps S3c-1-S3c-6 are executed for 6 times in a loop, and the final electrocardio signal is a feature enhanced electrocardio signal.

[0045] Further, the FS-Net model comprises:

[0046] an encoder connected with the decoder, used for learning the dependency relationship between feature waves; and

[0047] a decoder connected with the encoder, used for feature wave segmentation of the electrocardio signal;

[0048] the input of the encoder passes through 3 modules composed of a convolution layer and a normalization layer in sequence, then enters 8 modules composed of a multi-head attention layer, an Add layer, a normalization layer, a feedforward layer, an Add layer and a normalization layer in sequence, and is output to the decoder;

[0049] the input of the decoder passes through 4 modules composed of a bidirectional long short-term memory network and a Dropout, then passes through 2 time distribution based fully connected mapping networks again, and finally enters a Softmax layer and is output, and the time distribution based fully connected mapping network comprises a time distribution network and a feedforward layer.

[0050] The second purpose of the application is achieved as follows:

[0051] An FS-Net model for segmenting feature waves of an electrocardio signal comprises:

[0052] an encoder connected with the decoder, used for learning the dependency relationship between feature waves; and

[0053] A decoder is connected with the encoder, and is used for feature wave segmentation of the electrocardiosignal.

[0054] The input of the encoder passes through 3 modules composed of convolution layers and normalization layers in sequence, then enters 8 modules composed of multi-head attention layers, Add layers, normalization layers, feedforward layers, Add layers and normalization layers in sequence, and is output to the decoder.

[0055] The input of the decoder passes through 4 modules composed of bidirectional long short-term memory networks and Dropout, then passes through 2 time-distribution-based fully connected mapping networks again, finally enters a Softmax layer and is output, and the time-distribution-based fully connected mapping network comprises a time-distribution network and a feedforward layer.

[0056] Further, the time-distribution-based fully connected network maps a signal with a time length of m and a feature length of n at each time point into a signal with a time length of m and a feature length of n' at each time point, wherein n' is less than n.

[0057] Electrocardiogram feature wave recognition is a challenging task in electrocardiosignal analysis. To address the problem of feature wave changes caused by myocardial ischemia, the present application introduces an adaptive waveform correction filter, which effectively enhances the P wave and T wave in electrocardiogram and improves the accuracy of feature wave detection. The algorithm adaptively corrects the T wave morphology changes caused by myocardial ischemia and enhances the amplitude of P wave and T wave, achieving bidirectional matching of data and algorithm and improving the performance of neural network. The present application also proposes an interpretable end-to-end neural network model FS-Net, which can detect the feature waves of the corrected and enhanced 12-lead electrocardiogram and provide feature distribution and backtracking visualization, revealing the deep learning process. In addition, a post-processing algorithm is proposed to correct false positives and accurately classify feature waves. The proposed algorithm has made significant progress in electrocardiogram feature wave detection. These methods not only improve the accuracy of electrocardiogram detection, but also have interpretability and practicality. Future research can apply these methods to more extensive cardiac disease detection and further optimize them to enhance the effectiveness of electrocardiogram detection and the feasibility of clinical application. BRIEF DESCRIPTION OF DRAWINGS

[0058] Figure 1 is a flowchart of the method of the present application.

[0059] Figure 2 is an effect comparison chart before and after noise reduction in diseased individuals and healthy individuals respectively.

[0060] Figure 3 is an effect comparison chart before and after normalization in diseased individuals and healthy individuals respectively.

[0061] Figure 4 is the effect comparison chart before and after non-characteristic band smoothing in diseased individuals and healthy individuals respectively.

[0062] Figure 5 is the effect comparison chart before and after QRS direction correction in disease state and healthy individuals respectively.

[0063] Figure 6 is the effect comparison chart before and after characteristic wave enhancement of the original signals of T wave inversion and T wave depression respectively.

[0064] Figure 7 is the overall structure diagram of the FS-Net model.

[0065] Figure 8 is the structure diagram of the full connection mapping network based on time distribution.

[0066] Figure 9 is the visual comparison chart of gradient under different disease conditions. DETAILED DESCRIPTION

[0067] The present application will be further described below.

[0068] As shown in Figure 1 , the present application provides a method for segmenting characteristic waves of electrocardiosignal, which specifically comprises the following steps:

[0069] Firstly, the signal is preprocessed, and the preprocessing mainly removes noise and normalizes the signal, so that the signal is a pure and stable electrocardiosignal. Then the data is corrected, the characteristic wave deformation caused by disease is corrected, and the characteristic enhancement is performed, so that the FS-Net model can more effectively detect the electrocardiosignal. The signal after characteristic correction and enhancement is sent to the FS-Net model, the FS-Net model is used to analyze the data, and the result after analysis is corrected by the post-processing algorithm, thus the segmentation of the characteristic wave is completed.

[0070] S1. Electrocardiosignal denoising: the median filtering algorithm is used to correct the baseline drift of the electrocardiosignal, and the third-order Butterworth low-pass filter is used to eliminate the high-frequency noise in the electrocardiosignal.

[0071] As shown in Figure 2 , the electrocardiosignal is extremely susceptible to noise during collection, and the noise mainly includes power noise interference and electromyographic noise interference. The median filtering algorithm is used to correct the baseline drift of the electrocardiosignal, and the third-order Butterworth low-pass filter is used to eliminate the high-frequency noise in the signal, and the low-pass cutoff frequency of the filter is 0.5hz, to obtain the denoised electrocardiosignal.

[0072] Figure 2 The middle red line is the electrocardiosignal with noise, and the blue line is the electrocardiosignal after removing noise, Figure 2The left graph is the ECG signal of the sick individual before and after denoising, and the right graph is the ECG signal of the healthy individual before and after denoising. After removing the noise, the ECG signal is smoother, whether in sick individuals or healthy individuals.

[0073] S2. ECG signal peak normalization: the Pan-Tompkins algorithm is used to calibrate the R peak information of the denoised ECG signal, the RR interval information is calculated, then the data is selected by using a sliding window, and the data in the sliding window is normalized.

[0074] The collection of ECG signals is affected by the breathing rhythm of the subject, the difference in heartbeat and the collection device, resulting in differences in R peak height in the same lead in a single test of the same person. In the next step of P wave and T wave enhancement, statistical parameters such as mean and variance of the ECG signal are needed, so the stability of the data is crucial for the enhancement effect. The present application proposes an adaptive recursive filtering scheme to solve the problem of different R peak heights in collecting ECG signals, making the ECG signal stable.

[0075] As shown in Figure 3 , the Pan-Tompkins algorithm is used to calibrate the R peak information of the ECG signal, and the RR interval information, i.e. the length of adjacent R peaks, is calculated; then the data is selected by using a sliding window, and the data in the sliding window is normalized. The size of the sliding window is 1.1 times the RR interval of the most adjacent 5 seconds of ECG data, and the sliding speed is 10 sampling points each time. During the sliding process of the sliding window each time, the data in the sliding window is normalized recursively until the normalization operation in the window is completed for all sampling points. Figure 3 The R peak height in the ECG signal has been corrected, the R peak height is more uniform, and the difference between R peaks is smaller.

[0076] The normalization formula is:

[0077]

[0078] wherein ECG nomalized represents a period of time, time1 represents the start time, time2 represents the end time, ECG[time1:time2] is the amplitude of the ECG signal at each time point, max is the maximum value of the amplitude of the ECG signal in the sliding window, and abs is the absolute value of the amplitude of the ECG signal between time1 and time2.

[0079] S3. ECG signal waveform correction and feature enhancement: first, the normalized ECG signal is smoothed, then the QRS wave, P wave and T wave of the ECG signal are corrected, and finally the P wave and T wave in the corrected ECG signal are enhanced;

[0080] To stabilize the characteristic wave band of the electrocardiogram, it is necessary to first determine the presence of the characteristic wave. Since the characteristic wave has a large difference in morphology, but when there is no characteristic wave, the electrocardiogram signal is stable near the baseline, and the amplitude changes slowly, the no-characteristic wave region is first calibrated, and then the characteristic wave region is determined. This calibration only needs to be roughly distinguished, and the detailed division is left to the electrocardiogram characteristic wave segmentation model. After determining the no-characteristic wave region, the electrocardiogram signal without characteristic waves will not change when the characteristic wave is enhanced.

[0081] As shown in Figure 4 , the present application proposes a non-characteristic wave band smoothing processing method based on a window function to calibrate the no-characteristic wave region and the characteristic wave region. The standard deviation of the amplitude of the electrocardiogram signal in a sliding window with a length of 60 ms is calculated, and each sample point is moved to determine whether a characteristic wave appears. The rapid change in amplitude caused by the characteristic wave will produce a large standard deviation, while the non-wave band is relatively stable, producing a small standard deviation. The point with an amplitude greater than the set threshold is considered to be a characteristic wave, and the point with an amplitude less than or equal to the set threshold is considered to be without a characteristic wave. Among the characteristic waves, the amplitude of the P wave is the smallest, and the selection of the set threshold is based on distinguishing the P wave band from the non-wave band. After distinguishing the P wave, other characteristic waves and non-wave bands are also distinguished, but it is not possible to determine the specific type of characteristic wave. The value of the set threshold is 1.2% of the maximum standard deviation. The formula for calculating the standard deviation and the threshold is:

[0082]

[0083]

[0084] where ECG std represents the variance of the signal, ECG amend represents the corrected signal, ECG std (t) is the standard deviation of the sliding window at time t, max(ECG std ) is the maximum standard deviation of the sliding window at all times, and max(ECG std ) x 0.012 is the set threshold.

[0085] For example, when the time corresponding to the sample point is 1s, time1 is 970s, and time2 is 1030s.

[0086] Figure 4 The left graph in the figure is the electrocardiogram signal of a sick individual before and after non-characteristic wave band smoothing processing, and the right graph is the electrocardiogram signal of a healthy individual before and after non-characteristic wave band smoothing processing. The T wave and P wave are processed by the non-characteristic wave band smoothing processing, and the noise has been filtered out.

[0087] The QRS wave direction correction of electrocardiogram signal, in the standard 12-lead system, the QRS wave segment morphology may change due to the difference of sampling position and the different types of diseases of the subjects. Even in the case of no disease, the electrocardiogram morphology is different, for example, in the normal condition, the QRS wave segment peak of I, II and III leads is usually upward, but the heart axis offset may change the peak direction. In order to adapt to the training requirement of the feature wave segmentation model to the same distribution data, the application proposes an adaptive algorithm to correct the QRS wave segment peak direction.

[0088] As shown in Figure 5 Since only the QRS wave segment peak direction needs to be corrected, the R peak position does not need to be accurately positioned, the absolute value of the amplitude corresponding to each point in the electrocardiogram signal is taken, and then the Pan-Tompkins algorithm is used to determine the peak point. Then, according to the original data corresponding to the point, the peak direction is judged: when the corresponding point information is positive, the signal is kept unchanged; if it is negative, the electrocardiogram signal is saved as its opposite number. In this way, the peak direction of the QRS wave segment is unified upward, and the same distribution data is helpful to optimize the training effect of the feature wave segmentation model.

[0089] Figure 5 The left graph in the middle is the electrocardiogram signal of the diseased individual before and after QRS wave direction correction, and the right graph is the electrocardiogram signal of the healthy individual before and after QRS wave direction correction, Figure 5 After QRS wave direction correction, the peak direction of the QRS wave segment is unified upward.

[0090] The electrocardiogram signal P wave and T wave direction correction algorithm, influenced by the lead difference and cardiogenic disease, the P wave and T wave may be deformed. In order to better realize the enhancement of the electrocardiogram feature wave, all P waves and T waves need to be corrected. First screening: inverted P wave and inverted T wave: calculate the mean value of T wave amplitude, if the T wave mean value information is negative, it is judged that the T wave is inverted T wave; if the P wave mean value information is negative, it is judged that the P wave is inverted P wave. Second screening: count the position of the first two zero-crossing points of T wave, take the absolute value to correct the inverted T wave; count the position of the two zero-crossing points of P wave, determine the inverted P wave according to the amplitude and vibration direction of P wave; when the amplitude is negative and the vibration direction is downward, it is an inverted feature wave; when no zero-crossing point information appears, directly correct the T wave direction with the statistical information. Among them, the statistical information is: the left of QRS wave is P wave, and the right of QRS wave is T wave.

[0091] The P wave and T wave of the electrocardiosignal are enhanced, in the standard 12-lead electrocardiogram, the energy of the QRS wave segment is usually higher than that of the P wave and T wave, the amplitude of the P wave is only 1 / 5 to 1 / 3 of the QRS wave segment, so that the P wave is easy to be covered in the electrocardiosignal. The characteristic wave segmentation is more sensitive to the rapid gradient change, so the energy enhancement of the P wave and T wave is helpful for the characteristic wave detection. The P wave and T wave in the original signal have small values, the values are improved after logarithmic transformation, but the QRS segment has higher values relative to the P wave and T wave, and the relative increment after logarithmic transformation is smaller. The logarithmic function has the characteristic that the growth rate decreases with the increase of the input value, so the electrocardiosignal is processed by using the characteristic.

[0092] The specific way of enhancing the P wave and T wave is as follows:

[0093] S3c-1. The modified electrocardiosignal is moved up by 1 mV, and the baseline of the electrocardiosignal is 1 mV.

[0094] S3c-2. The up-shifted electrocardiosignal is transformed by using the logarithmic function, and the transformation formula is:

[0095]

[0096] Wherein, ECG log (t) is the amplitude of the corresponding electrocardiosignal after the initial transformation at time t.

[0097] S3c-3. The transformed electrocardiosignal is enhanced, and the enhancement formula is:

[0098]

[0099] Wherein, ECG enhance (t) is the amplitude of the corresponding electrocardiosignal after the enhancement at time t.

[0100] S3c-4. The enhanced electrocardiosignal is moved down by 1 mV, and the baseline of the electrocardiosignal is 0 mV. The down-shifted electrocardiosignal is processed by using the Gaussian smoothing algorithm.

[0101] S3c-5. The R peak information of the down-shifted and enhanced electrocardiosignal is calibrated by using the Pan-Tompkins algorithm, the RR interval information is calculated, then the data is selected by using the sliding window, and the data in the window is normalized by using the formula (1).

[0102] S3c-6. The sliding window with a length of 60 ms slides on the electrocardiosignal at a speed of 1 sampling point, the standard deviation of the data in each window is calculated, the points greater than the set threshold are taken as the characteristic wave, and the amplitude of the electrocardiosignal less than the threshold is taken as 0 to obtain the modified electrocardiosignal. The value of the set threshold is 3.5% of the maximum standard deviation. The formula for calculating the standard deviation is formula (2).

[0103]

[0104] wherein, ECG amend1 (t) is the corrected electrocardiosignal.

[0105] S3c-7. The steps S3c-1-S3c-6 are executed cyclically for 6 times, and the final electrocardiosignal is the electrocardiosignal after feature enhancement.

[0106] In order to obtain obvious effect, a total of 6 times of cyclic enhancement is performed, and the final enhanced electrocardiosignal is obtained.

[0107] As shown in FIG. 6, after feature wave enhancement, the P wave and the T wave of the electrocardiosignal have obvious enhancement, regardless of T wave inversion or T wave depression. Figure 6

[0108] After the electrocardiosignal is enhanced, in order to adapt to the FS-Net model, the original data is segmented into single heartbeat intervals. Each heartbeat is mainly composed of a P wave, a QRS complex and a T wave, and the rest is a non-wave segment. The division of the heartbeat is to take the midpoint between the end of the current heartbeat T wave and the beginning of the next heartbeat P wave (about 58% of the RR interval) as the statistical reference. After segmentation, the data is uniformly adjusted to a length of 500 sampling points, and the original length is recorded for final calculation.

[0109] S4. Model construction: constructing an FS-Net model for segmenting feature waves of an electrocardiosignal.

[0110] As shown in FIG. 7, the FS-Net model for segmenting feature waves of an electrocardiosignal in the application includes an encoder and a decoder to realize the segmentation of feature waves of an electrocardiosignal. Figure 7 The FS-Net encoder considers the time correlation of the electrocardiosignal, and the reciprocal contraction of the atrium and the ventricle forms the periodicity of the P wave, the QRS wave and the T wave. Therefore, the encoder of the application mainly adopts a self-attention module to learn the dependency relationship between the feature waves. Before being input into the encoder, in order to make the self-attention module more effectively learn the potential information in the electrocardiosignal, the application expands the feature dimension of the feature wave through a convolution module.

[0111] As shown in Table 1, the model input is first expanded to 64 through a three-layer convolutional neural network. The feature channel of 64 dimensions has enough electrocardiosignal semantic information. By using the self-attention mechanism, the network learns the correlation of the information before and after the electrocardiogram, so that the network has the ability to observe the global, and fully learns the information of the P wave, the QRS wave and the T wave at the time points before and after the appearance.

[0112]

[0113] ​​The input signal first passes through three modules composed of convolutional layers and first normalization layers in turn, and then enters eight standard self-attention modules in turn. The input of the self-attention module is divided into two paths, one of which passes through the multi-head attention network to the first stacking layer, and the other of which directly enters the first stacking layer. After addition in the stacking layer, it passes through the second normalization layer. The output of the second normalization layer is divided into two paths, one of which passes through the feedforward layer to the second stacking layer, and the other of which directly enters the second stacking layer. After addition in the second stacking layer, it enters the third normalization layer. The outputs of the first, second, third, fourth, fifth, sixth and seventh self-attention modules in the third normalization layer all enter the next layer of self-attention module. The output of the third normalization layer in the eighth self-attention module enters the encoder.

[0114] The expanded data input eight layers of standard self-attention modules, and in order for the network to better learn the time sequence of the data, position encoding information is added in the first layer. The number of heads used in the self-attention module is 4, and then the features are nonlinearly mapped through the feedforward network to enhance the modeling ability of the model. To prevent overfitting, the connection random disconnection layer is connected with a coefficient of 0.1.

[0115] The input of the encoder passes through three modules composed of convolutional layers and normalization layers in turn, and then enters eight modules composed of multi-head attention layers, Add layers, normalization layers, feedforward layers, Add layers and normalization layers in turn, and outputs to the decoder.

[0116] The signal after being encoded by the FS-Net decoder still contains time sequence information, which is decoded using a time sequence decoder. The first four layers use bidirectional long short-term memory modules for dimension reduction, and the last two layers use time distribution-based fully connected mapping networks to complete decoding, realizing the start and end point calibration of the characteristic wave.

[0117] The input of the decoder passes through four modules composed of bidirectional long short-term memory networks and Dropout in turn, and then passes through two time distribution-based fully connected mapping networks again, and finally enters the Softmax layer and outputs. The time distribution-based fully connected mapping network includes a time distribution network and a feedforward layer.

[0118] The decoder is responsible for the feature wave segmentation of the electrocardiogram signal. The result of the self-attention module encoding is first reduced in the feature channel. The encoding result contains time sequence information, so a bidirectional long short-term memory network (Bi-LSTM) is used for feature decoding, and four layers of Bi-LSTM are used to reduce the dimension to 16.

[0119] After Bi-LSTM decoding, the dimension is reduced to 16, and further reduced to 2 to mark the presence or absence of the characteristic wave.

[0120] As Figure 8The final decoding is performed based on the time-distribution-based fully connected mapping network. The specific decoding method is as follows: the features of each time point are processed using a fully connected network, that is, the fully connected network is applied to each time step of the sequence. The time length of the signal is m, and the feature length of each time point is n. After the fully connected mapping of the time step, the time length is still m, but the feature length of each time point becomes n'. Wherein, n' is less than n. Parameters are shared between each time step, and the decoding process uses a two-layer network with dimensions of 64 and 2. Finally, the output layer applies a softmax function to complete decoding.

[0121] Table 1: Network model parameter description

[0122] Layers Type Number of neurons output Quantity 1 Conv1DPack (batch, 500, 64) 3 2 Encoder (batch, 500, 64) 8 3 BiLSTM (batch, 500, 32) 4 4 TimeDistrubute (batch, 500, 2) 2

[0123] Considering that the electrocardio signal is a time series signal and the characteristic wave has periodic changes, a neural network structure sensitive to time series is selected. The encoder mainly uses a time-based self-attention network, and the decoder combines a long short-term memory network (LSTM) and a time series description module, so that the model can effectively capture the time sequence dependence between the characteristic waves.

[0124] S5. Model training: input the electrocardio signal processed in steps S1-S3 into the FS-Net model for training, to realize segmentation of the P wave, QRS wave and T wave in the electrocardio signal.

[0125] The electrocardio signal processed in steps S1-S4 is input into the FS-Net model constructed for training. The focal loss is used as the loss function in the present application, so that the difficult-to-segment edge information has a better correct rate formula expression as follows.

[0126]

[0127] When training the neural network, it is hoped that the network will converge quickly in the early stage. The learning rate is 0.001 in the early stage of training, and when the correct rate exceeds 90%, the learning rate is reduced to 0.00005, until the correct rate of the training set no longer improves.

[0128] S6. Post-processing algorithm: correct the segmented features.

[0129] The characteristic wave segmentation model performs characteristic wave segmentation. Under normal circumstances, one heart beat contains three characteristic waves, but diseases may cause false detection of noise.

[0130] Segmentation of feature bands using neural networks, in normal cases, a heartbeat contains three feature bands. However, diseases may cause noise to be detected as a feature wave. In the case of multiple detections, the edge of the false segment and the short period will be removed. In the case of missing detection of feature waves, the missing P wave or T wave needs to be completed according to the position of the R wave.

[0131] In the case of multiple detections, remove the edge and short-time false wave band. In the case of missing detection, complete the missing P wave or T wave according to the position of the R peak.

[0132] Since each heartbeat has been adjusted to 500 sampling points in length before the electrocardiogram signal is identified by the FS-Net model, the length of the minimum wave band is determined as 4% of the length of the heartbeat, and all the wave bands calibrated by the FS-Net model are traversed; the R peak is determined by using the Pan-Tompkins algorithm, and the wave band where the R peak is located is the QRS wave band, and the index of the QRS wave band, i.e. the time corresponding to the QRS wave band, is recorded.

[0133] 4% of the length of the heartbeat is taken as the minimum wave band length, and wave bands with a length less than the minimum wave band length are filtered out.

[0134] Again, traverse the wave band containing the R wave, i.e. the QRS wave band, and record its index.

[0135] When the number of wave bands of a heartbeat is 3, and the R wave is in the middle wave band, the three wave bands are retained; when the number of wave bands is 3, and the R wave is in the first wave band, the T wave band is merged, i.e. the start time of the second wave is taken as the start time of the T wave band, and the end time of the third wave band is taken as the end time of the T wave; when the number of wave bands is 3, and the R wave is in the third wave band, the P wave band is merged, i.e. the start time of the first wave is taken as the start time of the P wave band, and the end time of the second wave band is taken as the end time of the P wave.

[0136] When the number of wave bands of a heartbeat is greater than 3, the wave band to the left of the R wave is merged into the P wave band, and the wave band to the right of the R wave is merged into the T wave band.

[0137] When the number of wave bands of a heartbeat is less than 2, the missed wave band is supplemented, and whether the missed wave band is a P wave or a T wave is determined according to the position of the R wave. According to the wave bands of all the detected heartbeats, the distance between the P wave and the R wave is calculated, and the average value of the distance between the P wave and the R wave in all the heartbeats is taken as the reference value of the distance between the P wave and the R wave. The distance between the T wave and the R wave is calculated, and the average value of the distance between the T wave and the R wave in all the heartbeats is taken as the reference value of the distance between the T wave and the R wave.

[0138] When there is no wave band to the left of the R wave, the P wave band is supplemented according to the reference value of the distance between the P wave and the R wave; when there is no wave band to the right of the R wave, the T wave band is supplemented according to the reference value of the distance between the T wave and the R wave.

[0139] Since the individual conditions of the measured electrocardiosignal are different, the reference value of the distance between the P wave and the R wave is determined according to the distance between the P wave and the R wave in all heartbeats of the individual, and the reference value of the distance between the T wave and the R wave is determined according to the distance between the T wave and the R wave in all heartbeats of the individual, and the supplementary P wave and T wave are more accurate.

[0140] S7. Electrocardiosignal segmentation: the feature waves of the measured electrocardiosignal are segmented by using the trained FS-Net model.

[0141] For the measured electrocardiosignal, before segmentation using the FS-Net model, it also needs to be processed through steps S1-S3, and after segmentation, it is processed through step S6.

[0142] S8. Model evaluation: the modified FS-Net model is used to segment the LUDB feature wave band under different tolerances, and the modified FS-Net model is evaluated according to the segmentation results.

[0143] The feature wave segmentation evaluation index is the segmentation accuracy of the feature wave band, and the mean and variance of the comparison error between the predicted feature wave start and end points and the label, the mean reflects the average deviation of the model prediction, and the variance reflects the stability of the model.

[0144] Table 2: LUDB feature wave band segmentation performance

[0145]

[0146] The LUDB contains standard 12-lead electrocardiogram signals of 200 subjects, each signal lasts 10 seconds, and the sampling frequency is 500Hz. These signals are manually labeled by cardiologists, and the present application uses all the data of 183 of them, a total of 14480 heartbeats. The other 17 people have atrial fibrillation or no P wave labeling, and the P wave in the electrocardiogram of the atrial fibrillation patient disappears, which can be diagnosed by heart rate. The present application focuses on the detection of feature wave full waveform, so the data of the 17 people is not used.

[0147] As shown in Table 2, the feature wave segmentation results under 40ms, 70ms and 150ms tolerances are shown. When using a model trained with both the original electrocardiosignal and the electrocardiosignal processed through steps S1-S3, the model performs better. The algorithm proposed in the present application has a standard tolerance of 150 milliseconds, and the detection results of the start and end points of each wave band in the LUDB have a sensitivity close to 100%, and when the model is trained while inputting the original signal and the enhanced signal, the electrocardiosignal feature wave segmentation model of the present application can capture more effective information, the mean and variance of the feature wave detection error are well controlled, and the electrocardiosignal feature wave segmentation model of the present application shows excellent stability.

[0148] The electrocardiosignal segmentation effect of the application is evaluated by comparing the application with other schemes.

[0149] Table 3: Comparison of results of the application and other schemes

[0150]

[0151] As shown in Table 3, the application can produce better performance based on the results of the LUDB and the deep learning method based on the 150 ms tolerance by comparing with other schemes on the LUDB dataset and the QTDB dataset. Wang et al. used a residual network to analyze the structure and position of the wave synchronously, and the sensitivity to highlight the QRS complex reached 100%, but it was noted that the detection performance of the smaller amplitude P wave decreased. Wang et al., Sereda and Chen et al. used a method based on the U-Net network to capture more detailed details, and the P wave detection rate was increased by 2% to 99.5%. However, since the electrocardiosignal is a time series signal, it is essential to understand the time relationship. These methods use LSTM networks. The IT-Net of the application also uses time series modeling, enhances the feature representation of the PT wave by filtering, improves the understanding of the time sequence logic by using the attention mechanism, and prevents time sequence overlap by using the time distribution layer, thereby showing excellent performance in the mean and variance of the start and end point error. Compared with the scheme of Chen et al., the average error of the application is reduced by 2 ms, and the variance is reduced by 5 ms, further improving the stability.

[0152] As can be seen from Table 3, the detection sensitivity of the two datasets to P wave and QRS wave is similar, both of which are more than 99%, but the division error of LUDB is less than that of QTDB. The test results of the QTDB dataset show that the deep learning methods of Jimenez, Peimankar and Chen have generally higher line division errors than the digital processing methods of Martinez, Bote and Kalyakulina. Compared with the digital processing method, the variance of the application in the P wave and QRS complex is about 5 ms, and the variance in the T wave is about 20 ms. The LUDB dataset annotated by experts contains 14480 heartbeats, which is about five times the 2845 heartbeats of the QTDB dataset. The digital processing method for feature extraction can more effectively capture the threshold information of the feature wave start and offset, so the digital processing method performs better on the QTDB dataset. On this dataset, the sensitivity of the application and other deep learning methods to P wave and QRS complex is more than 99%. Since the QTDB data is small, the generalization ability is poor, therefore, the application uses LUDB for pre-training and achieves better results.

[0153] The main reason for the poor performance of deep learning models on QTDB is the quality and quantity of annotation information. Deep learning models rely on data-driven training, and the presence of abnormal annotations, inaccurate or inconsistent labels in the QTDB database can severely impact the performance of deep learning models. For example, the lack of starting point markers in some T-wave signals is an abnormal annotation that can affect the convergence direction of the IT-Net model and become a key factor that prevents the model from effectively identifying T-waves. In addition, the QTDB dataset only provides information from two random leads, resulting in data imbalance. This imbalance can cause the model to favor common feature wave types during learning and prediction. Although most deep learning methods perform worse on QTDB than digital processing methods, they generally achieve more accurate results when trained using LUDB, as LUDB has more accurate annotations and a larger data volume, especially when the lead information is fixed. Subsequently, training the model on the QTDB dataset after training on the LUDB dataset also achieves good results.

[0154] S9. Model feature wave feature extraction visualization.

[0155] As shown in Figure 9 , the gradient visualization information of the model proposed by the present application for the change of four different attribute feature waves is presented by the CAM method, corresponding to P-wave inversion, T-wave inversion, T-wave high, and overall abnormal wave shape, respectively. These visualizations show that the model's focus is still concentrated on the feature wave band. Thanks to the data modification and enhancement of the filter proposed by the present application, the model exhibits the same degree of attention to different types of heart diseases. Through the color of the visualization, it can be observed that the class activation shows red for the peaks of P-wave, QRS-wave, and T-wave, indicating that these regions have similar degrees of activation. This indicates that the model maintains the same segmentation accuracy when processing different diseases.

Claims

1. A method of segmenting a characteristic wave of an electrocardiosignal, characterized by, Comprising the following steps: S1. ECG signal denoising: using a median filter algorithm to correct the baseline drift of the ECG signal, using a third-order Butterworth low-pass filter to eliminate high-frequency noise in the ECG signal; S2. ECG signal peak normalization: using the Pan-Tompkins algorithm to calibrate the R peak information of the denoised ECG signal, calculating the RR interval information, and then selecting data using a sliding window and normalizing the data in the sliding window; S3. ECG signal waveform correction and feature enhancement: first, smooth the normalized ECG signal, then correct the QRS wave, P wave and T wave of the ECG signal, and finally enhance the P wave and T wave in the corrected ECG signal; S4. Model construction: construct a FS-Net model for segmenting ECG signal characteristic waves; S5. Model training: input the ECG signal processed by steps S1-S3 into the FS-Net model for training, to segment the P wave, QRS wave and T wave in the ECG signal; S6. Post-processing algorithm: correct the features of the segmentation error; S7. ECG signal segmentation: use the trained FS-Net model to segment the characteristic waves of the measured ECG signal; The specific way of enhancing the P wave and T wave in step S3 is: S3c-1. Move the corrected ECG signal up by 1mV, then the baseline of the ECG signal is 1mV; S3c-2. Perform a preliminary transformation on the moved ECG signal according to the logarithmic function, the transformation formula is: wherein, is the amplitude of the first transformed electrocardiosignal corresponding to the time t; S3c-3. Enhance the transformed ECG signal, the enhancement formula is: wherein, is the enhanced amplitude of the corresponding electrocardiosignal at time t; S3c-4. Move the enhanced ECG signal down by 1mV, then the baseline of the ECG signal is 0mV, and perform Gaussian smoothing algorithm processing on the moved ECG signal; S3c-5. Use the Pan-Tompkins algorithm to calibrate the R peak information of the Gaussian smoothed enhanced ECG signal, calculate the RR interval information, and then select data using a sliding window and normalize the data in the sliding window; S3c-6. Slide the sliding window with a length of 60ms on the ECG signal at a speed of 1 sampling point, calculate the standard deviation of the data in each window, and take the points greater than the set threshold as the characteristic wave, and take the amplitude of the ECG signal less than the threshold as 0, to obtain the corrected ECG signal, the value of the set threshold is 3.5% of the maximum standard deviation; S3c-7. Repeat steps S3c-1-S3c-6 for 6 times, and the final ECG signal is the feature enhanced ECG signal.

2. The method of claim 1, wherein, The low-pass cutoff frequency of the third-order Butterworth low-pass filter in step S1 is 0.5hz.

3. The method of claim 1, wherein, The size of the sliding window in step S2 is 1.1 times the RR interval of the current 5s ECG data.

4. The method of claim 1, wherein, The normalization formula is: wherein, represents the electrocardiosignal in a period of time, time1 is the start time of each sampling of the sliding window, time2 is the end time of each sampling of the sliding window, is the maximum value of the amplitude of the electrocardiosignal in the sliding window, is the absolute value of the amplitude of the electrocardiosignal corresponding to the time interval from time1 to time2.

5. The method of claim 1, wherein, The specific way of smoothing the ECG signal in step S3 is: A sliding window with a length of 60 ms slides on the electrocardiosignal at a speed of 1 sample point, the standard deviation of the data in each window is calculated, the point greater than the set threshold is taken as a feature wave, and the amplitude of the electrocardiosignal less than the threshold is taken as 0 to obtain a modified electrocardiosignal, and the value of the set threshold is 1.2% of the maximum standard deviation; The calculation formula of the smoothing processing is: wherein, denotes the standard deviation of the electrocardiogram signal, denotes the modified electrocardiogram signal, is the standard deviation of the sliding window at time t, is the maximum standard deviation of the sliding window at all times.

6. The method of claim 1, wherein, The specific way of modifying the QRS wave of the electrocardiosignal in step S3 is: S3a-1. Taking the absolute value of the amplitude of the electrocardiosignal, determining the QRS wave peak point of the electrocardiosignal after taking the absolute value by using the Pan-Tompkins algorithm; S3a-2. If the original amplitude corresponding to the QRS wave peak point is positive, it remains unchanged; if the original amplitude corresponding to the peak point is negative, the original amplitude of the peak point is saved as its opposite number.

7. The method of claim 1, wherein, The specific way of modifying the P wave and T wave in step S3 is: S3b-1. Locating the T wave position and P wave position respectively, and calculating the mean value of the T wave amplitude and P wave amplitude respectively; S3b-2. When the mean value of the T wave amplitude is negative, the T wave is an inverted T wave; when the mean value of the P wave amplitude is negative, the P wave is an inverted P wave; S3b-3. Statistics the position of the zero-crossing point of the T wave twice, and determines the inverted T wave according to the amplitude and vibration direction of the T wave; statistics the position of the zero-crossing point of the P wave twice, and determines the inverted P wave according to the amplitude and vibration direction of the P wave; if no zero-crossing point position appears, use the statistical information to determine the inverted T wave and inverted P wave respectively; S3b-4. Taking the absolute value of the amplitude of the inverted T wave and the inverted P wave respectively.

8. The method of claim 1, wherein, The FS-Net model comprises: An encoder connected with the decoder, used for learning the dependency relationship between feature waves; and A decoder connected with the encoder, used for feature wave segmentation of the electrocardiosignal; The input of the encoder passes through 3 modules composed of convolutional layers and normalization layers in turn, enters 8 modules composed of multi-head attention layers, Add layers, normalization layers, feedforward layers, Add layers and normalization layers in turn, and is output to the decoder; The input of the decoder passes through 4 modules composed of bidirectional long short-term memory networks and Dropout, passes through 2 time distribution-based fully connected mapping networks again, and finally enters a Softmax layer and is output, wherein the time distribution-based fully connected mapping network comprises a time distribution network and a feedforward layer.

Citation Information

Patent Citations

  • Cardioelectric characteristic extracting process based on evolutive wavelet wiener deconvolution

    CN101088456A

  • Retrieval method of electrocardiogram signal

    CN110169767A