Electrocardiogram feature point positioning method based on double U-Net fused long and short range context information
By using a dual U-Net-based method, combined with data enhancement and cross-level dual gating modules, the robustness problem of ECG signal feature point detection under noise and individual distortion is solved, and feature point positioning with higher accuracy and stronger generalization ability is achieved.
Patent Information
- Application Number
- CN202511100731.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-07
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-08-07
AI Technical Summary
Existing ECG signal feature point detection algorithms are not robust enough under noise interference and individual disease distortion, and lack the utilization of long- and short-range contextual information, resulting in unsatisfactory positioning accuracy and generalization ability.
A dual U-Net-based method is adopted to segment the ECG signal into single-beat and multi-beat segments. Combined with data enhancement technology, two U-Nets are used to extract local and global semantic features respectively. These features are fused through a cross-level dual gating module to generate purified fusion features, and finally the feature points of the ECG signal are located.
The accuracy and robustness of ECG signal feature point positioning are improved, which can better resist noise interference and individual differences and improve the generalization ability of the model.
Smart Images

Figure CN120585349A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of electrocardiogram feature point positioning, and in particular relates to an electrocardiogram feature point positioning method based on dual U-Net fusion of long-range and short-range context information. Background Art
[0002] Electrocardiogram (ECG) analysis can be used to screen and diagnose cardiological diseases. Accurate feature point detection of ECG signals is fundamental to cardiovascular disease diagnosis. ECG feature point detection algorithms face several challenges: First, ECG signals are inevitably subject to noise interference during acquisition, which is difficult to completely eliminate, thus affecting feature extraction. Furthermore, for some heartbeats, the characteristic wave morphology may be distorted due to individual medical conditions, making it particularly difficult to locate feature points based on the morphology of a single heartbeat. These challenges contribute to the complexity of ECG feature point detection. Therefore, developing a flexible and accurate ECG feature point localization algorithm is crucial.
[0003] The research field of ECG signal feature point localization algorithms has made significant progress, demonstrating both technical diversity and innovation. Jimenez et al. transferred the U-Net network from image segmentation to one-dimensional ECG signal processing. By adjusting the convolution kernel dimension and introducing regularization techniques such as spatial dropout, they achieved efficient feature point localization. Combining improved structures such as multi-scale upsampling and ultra-dense connections, Jimenez et al. effectively alleviated the overfitting problem of the localization model through a two-layer U-Net structure and feature skipping. To address the strong dependence of deep learning models on labeled data, Avetisyan et al. proposed synthetic data technology to expand the diversity of training samples. They extracted basic waveform segments such as P, QRS, and T from an existing database and constructed synthetic ECG signals by combining probabilistic rules with expert knowledge. Pre-training on synthetic data significantly improved the model's generalization ability to signals of different morphologies. Chen et al. achieved feature point localization for single heartbeats using a 1D U-Net and pre- and post-processing methods that were independent of R-peak position. The shortcomings of existing technologies are as follows: First, current ECG localization methods are limited to single-beat localization. Single-beat localization methods do not fully utilize long-sequence context guidance and the low-rank characteristics of ECG signals. They lack the correlation information of "context dependence" between heartbeats and cannot correct local noise interference through long-range context, resulting in insufficient robustness of the model to noise interference and abnormal heartbeats. Second, existing methods lack a guidance mechanism for the extraction of underlying features using global high-level semantics of multiple heartbeats, resulting in insufficient robustness in the localization of key feature points. On the one hand, the extracted high-level semantic features of multiple heartbeats cannot be used as guidance signals to directionally regulate the extraction process of local underlying features; on the other hand, there is a lack of a secondary purification mechanism for the fusion of long- and short-range heartbeat features, which cannot effectively play the role of "purification-enhancement" of the global semantics of multiple heartbeats on the local information of single heartbeats, ultimately resulting in unsatisfactory feature point positioning accuracy and generalization ability. Summary of the Invention
[0004] To solve the above technical problems, the present invention proposes an ECG feature point localization method based on dual U-Net fusing long-range and short-range context information to improve the accuracy and robustness of feature point localization.
[0005] To achieve the above objectives, the present invention provides an ECG feature point localization method based on dual U-Net fusion of long-range and short-range context information, comprising: Preprocessing the ECG signal, including resampling to a uniform sampling rate and removing noise interference; Segment the ECG signal into single beat segments and adjacent multi-beat segments based on the R-peak position; Apply data augmentation operations to the segmented heart beat segments; Use dual U-Net to extract features, including the first U-Net extracting local semantic features of single heart beat segments, and the second U-Net extracting global semantic features of multi-heart beat segments; The local semantic features and the global semantic features are fused through a cross-level dual gating module to generate a purified fused feature; The characteristic points of the ECG signal are located based on the fusion features, including the positions of the P wave, QRS complex and T wave.
[0006] Optionally, noise interference removal includes: Baseline drift was processed using a median filter with a window width of 200 ms and 600 ms; An IIR digital band-stop filter is used to remove power frequency interference, with the lower and upper cutoff frequencies of the stop band being 49 Hz and 51 Hz respectively; The wavelet basis function is used for decomposition, and the signal is reconstructed through inverse wavelet transform to remove myoelectric interference.
[0007] Optionally, segmenting the ECG signal includes: The R peak position was located based on the Pan-Tompkins algorithm; The single beat segment was cut with the R peak position as the center and the RR interval as the cutting window width; Cut the multi-beat segment based on the R peak position and the two beats adjacent to the R peak position, a total of five beats; Single beat segments and multi beat segments were resampled to the same length according to the RR interval.
[0008] Optionally, apply data augmentation operations including: Perform time shift enhancement probabilistically, with the shift length being 0-10% of the total signal length; Perform signal reversal enhancement probabilistically; Add Gaussian noise to the signal with probability; Perform random occlusion enhancement with probability, randomly selecting areas to fill; Synchronously adjust the label position to keep the signal aligned with the label.
[0009] Optionally, using dual U-Net to extract features includes: The first U-Net and the second U-Net both contain an encoder and a decoder; The encoder receives the signal and performs data compression and feature extraction through the downsampling module. Each downsampling module contains a convolution layer, a batch normalization layer, an activation layer, and a pooling layer. The decoder performs upsampling through upsampling modules, each of which contains a deconvolution layer, a batch normalization layer, and an activation layer; The encoder and decoder fuse multi-scale information through skip connections.
[0010] Optionally, a cross-level dual-gating module fusion includes: Perform cross-attention calculation on the input features to generate attention map features; Perform multi-scale convolution operations on the attention map features and use different convolution kernel sizes to extract multi-receptive field representations; Modulate the original input features through gating weights; Concatenate the modulation features and attention features, and generate the gating weights through Sigmoid activation; The weighted summation outputs the fused features and adds a residual connection.
[0011] Optionally, the characteristic points of the ECG signal may include: Based on the fusion feature input task head, the positioning prediction probability is obtained; after post-processing, the final accurate positioning position is obtained; the mean square loss function is used to calculate the positioning error.
[0012] Optionally, the mean square loss function is used: Calculate the mean square error between the predicted QRS complex position sequence and the true sequence; Calculate the mean square error between the predicted P wave position sequence and the true sequence; Calculate the mean square error between the predicted T wave position sequence and the true sequence; Reconstruction loss of joint single heartbeat signal and multi-heartbeat signal.
[0013] Technical effect of the invention: The present invention discloses an ECG feature point positioning method based on dual U-Net fusing long- and short-range contextual information. The multi-beat U-net captures the correlation information between heartbeats, provides contextual information guidance for the single-beat U-net, combines long- and short-range correlation semantic information, guides local feature extraction through high-level semantic information, and improves the accuracy and robustness of feature point positioning. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The accompanying drawings, which constitute part of this application, are intended to provide a further understanding of this application. The exemplary embodiments and descriptions of this application are intended to explain this application and do not constitute an improper limitation on this application. In the accompanying drawings: Figure 1 Schematic diagram of the process of the ECG feature point localization method based on dual U-Net fusion of long-range and short-range context information according to an embodiment of the present invention; Figure 2 Schematic diagram of the overall network framework in the ECG feature point localization method based on dual U-Net fusion of long-range and short-range context information according to an embodiment of the present invention; Figure 3 Schematic diagram of a cross-level dual gating module according to an embodiment of the present invention. DETAILED DESCRIPTION
[0015] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0016] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0017] like Figure 1 As shown, this embodiment provides an ECG feature point positioning method based on dual U-Net fusion of long-range and short-range context information, including: Preprocessing the ECG signal, including resampling to a uniform sampling rate and removing noise interference; Segment the ECG signal into single beat segments and adjacent multi-beat segments based on the R-peak position; Apply data augmentation operations to the segmented heart beat segments; Use dual U-Net to extract features, including the first U-Net extracting local semantic features of single heart beat segments, and the second U-Net extracting global semantic features of multi-heart beat segments; The local semantic features and the global semantic features are fused through a cross-level dual gating module to generate a purified fused feature; The characteristic points of the ECG signal are located based on the fusion features, including the positions of the P wave, QRS complex and T wave.
[0018] Specifically, the implementation process of this embodiment includes the following steps: Step 1: Data Preparation: Step 1.1: Prepare the dataset: The ECG database contains 200 12-lead ECG recordings lasting 10 seconds. Two board-certified cardiologists manually annotated the onsets, endpoints, and peaks of the P wave, T wave, and QRS complex in these 200 recordings. The data was divided into training, validation, and test sets in a 6:2:2 ratio. To ensure data independence and to ensure that ECG segments in the training, validation, and test sets did not overlap, the data in each set originated from ECG recordings of different subjects.
[0019] Step 1.2: Resampling: The sampling rate of all ECG data was unified to 500 Hz by resampling.
[0020] Step 1.3: ECG signal denoising: ECG signals generally contain three common types of noise: baseline drift, power frequency interference, and myoelectric interference. To ensure the performance of the ECG feature point detection algorithm, the original ECG signal must be denoised.
[0021] (1) Two median filters were used on the signal with window widths of 200 milliseconds and 600 milliseconds respectively to deal with the baseline drift problem. (2) An IIR digital band-stop filter was designed using the bilinear transformation method. The lower and upper cutoff frequencies of the stop band are , , used to remove power frequency interference. (3) "Bior4.4" was selected as the wavelet basis function, and a total of 5 layers of decomposition were performed. The processed signal was reconstructed through inverse wavelet transform, effectively removing the myoelectric interference.
[0022] Step 2: Heartbeat segmentation: Preprocess the data after step 1.
[0023] Step 2.1: ECG signal cutting: After denoising the ECG signal, it needs to be segmented into single beat segments and adjacent beat segments based on the R-peak location. The Pan-Tompkins algorithm is used to determine the R-peak location, and the RR interval is calculated based on the R-peak labels in the dataset. Single beat segments are segmented using the R-peak location obtained by the Pan-Tompkins algorithm as the center and the RR interval as the width of the segmentation window. Similarly, a signal segment consisting of five beats, including the R-peak location and two of its neighbors, is used as the adjacent beat segment. After segmentation, the data is uniformly resampled to a length of 128 for single beat sequences and 512 for multiple adjacent beat sequences, based on the RR intervals of the different data. The sampling rate is also adjusted accordingly.
[0024] Step 2.2: Heartbeat data enhancement: To simulate the complex conditions of actual acquisition scenarios, such as noise interference, signal morphology variation, and position offset, and to improve the model's robustness and generalization capabilities to non-ideal signals, various data augmentations were performed on the training set data for the task of locating ECG signal feature points.
[0025] (1) Time shift enhancement. A single heartbeat signal is shifted left and right with a 50% probability: the shift length is 0-10% of the total signal length, simulating fluctuations in the heartbeat's position on the time axis (such as signal offset caused by breathing and movement). After the shift, the label position is adjusted synchronously to ensure alignment between the signal and the label.
[0026] (2) Signal inversion enhancement. Single heartbeat signals are inverted with a probability of 20%, and the same operation is performed on adjacent heartbeat signals. This operation simulates signal polarity reversal (e.g., switching between positive and negative waves) caused by different lead acquisition or device differences, enhancing the model's adaptability to changes in signal direction.
[0027] (3) Noise injection enhancement. Gaussian noise is added to the single heartbeat signal with a probability of 20%. The noise intensity is controlled by the signal-to-noise ratio. A function is used to generate noise that matches the signal and superimpose it. This operation simulates power frequency interference, myoelectric noise, and other noises in the actual acquisition environment, improving the model's anti-interference ability in noisy environments.
[0028] (4) Random occlusion enhancement. A single heartbeat signal is partially occluded with a probability of 10%. Two regions are randomly selected, each with a length of 0.8%-1.0% of the total signal length, and the occluded region is filled with a constant. This operation simulates local loss or severe interference (such as poor electrode contact) during signal acquisition, forcing the model to learn contextual information from the unoccluded region, thereby enhancing its tolerance to local anomalies.
[0029] Step 3: ECG localization framework based on dual U-Net and long and short heartbeat information: The proposed network architecture is as follows Figure 2 As shown in the figure, it is mainly divided into two parts: the long and short heartbeat information feature extraction stage and the context global-local semantic information purification stage.
[0030] In the feature extraction stage of long and short heartbeat information, two 1D U-net networks of different sizes are used to extract features of neighboring heartbeat information and short-time heartbeat information. The model inputs heartbeat data of different time lengths into the encoder. The model uses the 1D-Unet network to extract ECG features and outputs semantic information of different length inputs. The output of the encoding and decoding network after the decoder is used for the auxiliary task of reconstructing the original signal.
[0031] During the contextual global-local information purification phase, the single-beat and multi-beat semantic features output by the encoder-decoder network are first deconvolved, upsampled, and dimensionally aligned. A cross-layer dual-gated attention module is then used to obtain weighted fusion features. This is then input into the task head to obtain the predicted positioning probability. Finally, post-processing is performed to obtain the final accurate positioning position.
[0032] Step 4: Construction of dual U-net long and short ECG feature extraction network: Step 4.1: Build a long and short heartbeat feature extraction network: The feature extraction network consists of two U-net networks at different levels. Each U-net consists of an encoder and a decoder. The encoder extracts multi-scale ECG signal features. The decoding process then combines the information from different scales for decoding and upsampling. The encoder receives the original signal and passes it through a downsampling module for data compression and feature extraction. Each downsampling module consists of two 3×3 convolutional layers, a batch normalization layer, a Reinforced Luminance (ReLU) activation layer, and a 2×2 max pooling layer. During the decoding phase, the feature map to be decoded is concatenated with the feature map of the corresponding encoder layer and then fed into the decoder for upsampling through an upsampling module. Each downsampling module consists of two 3×3 deconvolutional layers, a batch normalization layer, and a Reinforced Luminance (ReLU) activation layer. Finally, the network reconstructs the input signal back to the original signal and outputs the fused features at all levels.
[0033] Step 4.2: Construct a cross-level dual-gating module: The module first extracts relevant information at different time scales through a standard cross-attention mechanism, then uses the relevant information to purify the original input features, adds the purified main path and branch path features, and then performs gated weighting with high-level global semantic information. are the input features of the main road and branch road respectively, is the number of feature channels, is the feature dimension. First, use As Query, Perform cross attention as Key and Value to obtain attention mapping features: (1); in, is the cross attention output without residual connection. Input the feedforward neural network (FFN) to obtain a linearly transformed and activated representation: (2); in, for Feature representation after the feedforward network; For the feedforward network ; is the cross attention output without residual connection; It is the element-by-element Sigmoid function operation; is the linear weight of the feedforward network; is the nonlinear bias of the feedforward network; Then the above attention results The multi-scale convolution kernel is used to represent the features of multiple receptive fields, where Indicates different convolution kernel sizes: (3); Then pass through two different 1×3 convolutional layers to obtain the gate weights and Used to modulate the original input features and : (4); in Represents element-by-element multiplication. Then, the modulated input is concatenated, and and Splicing: (5); in represents splicing along the channel dimension. and Splicing is performed on the channel dimension to obtain fusion features And after a layer of channel compression linear transformation and Sigmoid activation function to generate gated weights: (6); (7); in, Represents the element-by-element Sigmoid function operation, is the weight matrix, is the gating weight, To fusion features, is the weight matrix of the channel compression linear transformation layer, is the bias of the channel compression linear transformation layer, is the number of fusion feature channels, is the fusion feature dimension; use this weight to and Perform a weighted sum: (8); in, Represents element-by-element multiplication. After a layer of 1×1 convolution compression channel, the final output is is the feature representation after fusion.
[0034] Finally, the output result is the sum of the multi-layer information fusion features and the residual connection cross attention output: (9); Step 4.3: Design and optimize the localization network loss function The loss function is the mean square loss function, which is calculated as follows: (10); in, are trainable network parameters, is the total number of training samples, , , are the predicted position sequences of QRS complex, P wave and T wave, , , represents the true sequence of the corresponding positions. and Respectively represent The reconstructed single heartbeat signal and the original single heartbeat signal, and Respectively represent The present invention adopts AdamW optimizer and propagates parameters through reverse gradient.
[0035] The long and short heartbeat feature extraction network based on dual U-net includes step 4.1, such as Figure 2 As shown in the figure, by using U-net encoder-decoder networks of different sizes and combining them with the auxiliary task of heartbeat reconstruction, effective long and short sequence heartbeat feature extraction is achieved.
[0036] Cross-module gated fusion module, including step 4.2, modules such as Figure 3 As shown in the figure, this module first uses cross-attention to obtain the deep semantic association information of long- and short-range ECGs and generate fused features. It then uses the fused features as the gating signal and uses sigmoid activation to purify the original semantic features of long and short heartbeats. Next, it performs secondary gating on the purified semantic features in combination with high-level global semantics, and outputs purified features that combine local semantic information with global high-level semantic information.
[0037] Single heartbeat signals are susceptible to noise interference, resulting in feature distortion and poor positioning accuracy. Existing single heartbeat positioning methods rely solely on the local waveform features of a single heartbeat and are unable to utilize the low-rank regularity of the ECG signal for noise correction, resulting in a significant increase in feature point positioning errors in noisy scenarios. The present invention proposes a long-short heartbeat feature extraction architecture based on dual U-net, which captures high-level semantic information through long-sequence multi-heartbeat input and retains local semantic information through single heartbeat input. It combines feature extraction with heartbeat reconstruction auxiliary task constraints to improve the model's positioning robustness to single heartbeat noise and the generalization ability of feature extraction. In order to effectively utilize high-level global semantic information to guide low-level feature extraction. The present invention proposes a dual-gated purification module, which first uses fused semantic information to purify primary semantic information, and then performs secondary gating on the purified primary semantic information in combination with global fused semantic information, achieving feature purification of "global semantic guidance-local detail purification-cross-level fusion".
[0038] Single-beat and multi-beat feature extractors can use other encoder / decoder models, such as Transformer, ResNet, and NN U-Net. Fusion methods are not restricted and can use any feature fusion method, such as various attention mechanisms or convolutional modulation.
[0039] The above are merely preferred embodiments of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. An ECG feature point localization method based on dual U-Net fusion of long-range and short-range context information, characterized by: include: Preprocessing the ECG signal, including resampling to a uniform sampling rate and removing noise interference; Segment the ECG signal into single beat segments and adjacent multi-beat segments based on the R-peak position; Apply data augmentation operations to the segmented heart beat segments; Use dual U-Net to extract features, including the first U-Net extracting local semantic features of single heart beat segments, and the second U-Net extracting global semantic features of multi-heart beat segments; The local semantic features and the global semantic features are fused through a cross-level dual gating module to generate a purified fused feature; The characteristic points of the ECG signal are located based on the fusion features, including the positions of the P wave, QRS complex and T wave.
2. The ECG feature point positioning method based on dual U-Net fusion of long-range and short-range context information as claimed in claim 1, characterized in that: Noise interference removal includes: Baseline drift was processed using a median filter with a window width of 200 ms and 600 ms; An IIR digital band-stop filter is used to remove power frequency interference, with the lower and upper cutoff frequencies of the stop band being 49 Hz and 51 Hz respectively; The wavelet basis function is used for decomposition, and the signal is reconstructed through inverse wavelet transform to remove myoelectric interference.
3. The ECG feature point positioning method based on dual U-Net fusion of long-range and short-range context information as claimed in claim 1, characterized in that: Segmentation of ECG signals includes: The R peak position was located based on the Pan-Tompkins algorithm; The single beat segment was cut with the R peak position as the center and the RR interval as the cutting window width; Cut the multi-beat segment based on the R peak position and the two beats adjacent to the R peak position, a total of five beats; Single beat segments and multi beat segments were resampled to the same length according to the RR interval.
4. The ECG feature point positioning method based on dual U-Net fusion of long-range and short-range context information as claimed in claim 1, characterized in that: Applying data augmentation operations includes: Perform time shift enhancement probabilistically, with the shift length being 0-10% of the total signal length; Perform signal reversal enhancement probabilistically; Add Gaussian noise to the signal with probability; Perform random occlusion enhancement with probability, randomly selecting areas to fill; Synchronously adjust the label position to keep the signal aligned with the label.
5. The ECG feature point positioning method based on dual U-Net fusion of long-range and short-range context information as claimed in claim 1, characterized in that: Features extracted using dual U-Net include: The first U-Net and the second U-Net both contain an encoder and a decoder; The encoder receives the signal and performs data compression and feature extraction through the downsampling module. Each downsampling module contains a convolution layer, a batch normalization layer, an activation layer, and a pooling layer. The decoder performs upsampling through upsampling modules, each of which contains a deconvolution layer, a batch normalization layer, and an activation layer; The encoder and decoder fuse multi-scale information through skip connections.
6. The ECG feature point positioning method based on dual U-Net fusion of long-range and short-range context information as claimed in claim 1, characterized in that: The cross-level dual-gating module fusion includes: Perform cross-attention calculation on the input features to generate attention map features; Perform multi-scale convolution operations on the attention map features and use different convolution kernel sizes to extract multi-receptive field representations; Modulate the original input features through gating weights; Concatenate the modulation features and attention features, and generate the gating weights through Sigmoid activation; The weighted summation outputs the fused features and adds a residual connection.
7. The ECG feature point positioning method based on dual U-Net fusion of long-range and short-range context information as claimed in claim 1, characterized in that: The characteristic points of locating ECG signals include: Based on the fusion feature input task head, the positioning prediction probability is obtained; after post-processing, the final accurate positioning position is obtained; the mean square loss function is used to calculate the positioning error.
8. The ECG feature point positioning method based on dual U-Net fusion of long-range and short-range context information as claimed in claim 7, characterized in that: The mean square loss function includes: Calculate the mean square error between the predicted QRS complex position sequence and the true sequence; Calculate the mean square error between the predicted P wave position sequence and the true sequence; Calculate the mean square error between the predicted T wave position sequence and the true sequence; Reconstruction loss of joint single heartbeat signal and multi-heartbeat signal.
Citation Information
Patent Citations
Electrocardiosignal classification method combining band extraction and multi-feature fusion
CN113133767A
Feature extraction network and feature extraction method for semantic segmentation
CN116580205A
Electrocardio identity authentication method based on feature fusion
CN119513848A
Single tree detection method and system based on pre-training large model and ladder side tuning strategy
CN119904752A
Electrocardiosignal processing method and system
CN120227040A
