ECG signal denoising method and device, equipment and storage medium

By combining discrete waves transformation and frequency guiding multi -headed self -paying models and global channels and space enhanced convolution models, noise processing of the ECG signal solves the problem of poor exfoliating threats in the existing technology, and it has achieved better realization Noise and robustness.

CN119366932AActive Publication Date: 2025-01-28SUN YAT SEN UNIV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411644060.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2025-01-28
Estimated Expiration
2044-11-18

AI Technical Summary

Technical Problem

The existing ECG signal denoising methods are insensitive to noise intensity and are poorly robust, making it difficult to achieve accurate ECG signal denoising.

Method used

Based on the discrete wavelet transformation to extract low -frequency and high -frequency components, the frequency guide the multi -headed self -pay attention model and global channels and space enhanced convolution models, and the ECG signal is avoided.

Benefits of technology

Improved the desertation performance and robustness of the ECG signal, which can more effectively capture the time -frequency characteristics of the signal and the correlation between the belt, and reduce the overlapping noise of the spectrum.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119366932A_ABST
    Figure CN119366932A_ABST
Patent Text Reader

Abstract

The invention provides an ECG signal denoising method and device, equipment and a storage medium. The denoising method comprises the following steps: segmenting an ECG signal to be denoised into a plurality of segmented ECG signals; extracting a low-frequency component and a high-frequency component of each segmented ECG signal based on discrete wavelet transform; performing coding calculation on the segmented ECG signals to obtain a corresponding coding matrix; processing the low-frequency component, the high-frequency component and the coding matrix of the segmented ECG signal by using a frequency-guided multi-head self-attention model to obtain an attention result corresponding to each segmented ECG signal; de-noising the attention result corresponding to the segmented ECG signal by using a global channel and a spatial enhancement convolution model to obtain a de-noising result corresponding to each segmented ECG signal; and the denoising results corresponding to the segmented ECG signals are spliced, and the denoised ECG signals are obtained. The technical problems that an existing method is insensitive to noise intensity and poor in robustness are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of ECG signal processing, and in particular to an ECG signal denoising method, device, equipment and storage medium. Background Art

[0002] The electrocardiogram (ECG) is a comprehensive reflection of the electrophysiological activity of myocardial cell groups. ECG signals can reflect the physiological conditions of various parts of the heart to a certain extent and have been widely used in the clinical diagnosis of arrhythmias, myocardial infarction, and various cardiovascular diseases. The electrocardiogram (ECG) records the electrical signals passing through the heart and is often used clinically to further diagnose arrhythmias and other related diseases. The traditional ECG detection method is to use the hospital's electrocardiograph to collect the patient's short-term ECG signal, and the cardiologist manually diagnoses it through visual means.

[0003] However, ECG signals are easily affected by various interferences or additional activities of other parts of the heart, which may cause ECG signals to be distorted during the detection process, greatly reducing the accuracy of heart disease judgment. Therefore, denoising becomes the primary issue in ECG signal detection.

[0004] The ECG signal is essentially a non-stationary, nonlinear, quasi-periodic continuous signal. The existing technology mainly uses denoising methods based on time domain / frequency domain to denoise the ECG signal. However, these methods are insensitive to noise intensity and have poor robustness, making it difficult to achieve accurate ECG signal denoising. Summary of the invention

[0005] In view of the deficiencies in the prior art, the present invention provides a method, device, equipment and storage medium for denoising an ECG signal. The present invention has better denoising performance and more stable robustness.

[0006] The technical solution of the present invention is: a method for denoising an ECG signal, comprising the following steps:

[0007] S1), dividing the ECG signal to be denoised into several segmented ECG signals;

[0008] S2), extracting low-frequency components and high-frequency components of each segmented ECG signal based on discrete wavelet transform;

[0009] S3), performing coding calculation on each segmented ECG signal to obtain a coding matrix corresponding to each segmented ECG signal;

[0010] S4), using a preset frequency-guided multi-head self-attention model to process the low-frequency component, high-frequency component and encoding matrix of each segmented ECG signal to obtain the attention result corresponding to each segmented ECG signal;

[0011] S5), using the global channel and spatial enhancement convolution model to denoise the attention results corresponding to each segmented ECG signal, to obtain the denoising results corresponding to each segmented ECG signal;

[0012] S6), concatenating the denoising results corresponding to each segmented ECG signal to obtain a denoised ECG signal.

[0013] Preferably, in step S2), the step of extracting the low-frequency component and the high-frequency component of each segmented ECG signal based on discrete wavelet transform comprises the following steps:

[0014] S21), extracting low-frequency components of each segmented ECG signal through a low-pass filter and a convolution operation;

[0015] S22), extracting the high-frequency components of each segmented ECG signal through a high-pass filter and convolution operation.

[0016] Preferably, in step S2), before extracting the low-frequency component and the high-frequency component of each segmented ECG signal, each segmented ECG signal needs to be normalized.

[0017] Preferably, in step S3), the encoding matrix includes a query matrix, a key matrix and a value matrix.

[0018] Preferably, in step S3), the coding calculation of the coding matrix corresponding to each segmented ECG signal specifically includes the following steps:

[0019] S31), based on a preset query matrix calculation formula, encoding and calculating each of the segmented ECG signals to obtain a query matrix corresponding to each of the segmented ECG signals, wherein the query matrix calculation formula is:

[0020] [Q 1 ,Q 2 ,...,Q h ]=s·W q ;

[0021] In the formula, [Q 1 ,Q 2 ,...,Q h ] is the query matrix; h is the number of heads in the frequency-guided multi-head self-attention model; s is the segmented ECG signal; W q is the projection mapping of the query matrix;

[0022] S32), based on a preset key matrix calculation formula, encoding and calculating each of the segmented ECG signals to obtain a key matrix corresponding to each of the segmented ECG signals, wherein the key matrix calculation formula is:

[0023] [K1 ,K 2 ,...,K h ]=Concat(s L ,s H )·W k

[0024] In the formula, [K 1 ,K 2 ,...,K h ] is the key matrix; Concat(s L ,s H ) is the concatenation operation of the low-frequency component and the high-frequency component of the segmented ECG signal; s L is the low frequency component; s H is the high frequency component; W k is the projection map of the key matrix;

[0025] S33), based on a preset value matrix calculation formula, encoding and calculating each of the segmented ECG signals to obtain a value matrix corresponding to each of the segmented ECG signals, wherein the value matrix calculation formula is:

[0026] [V 1 ,V 2 ,...,V h ]=s·W v

[0027] In the formula, [V 1 ,V 2 ,...,V h ] is the value matrix; W v is the projection map of the value matrix.

[0028] Preferably, in step S4), the low-frequency components, high-frequency components and encoding matrices of each segmented ECG signal are used as input signals of a frequency-guided multi-head self-attention model. The frequency-guided multi-head self-attention model uses a softmax function to calculate the attention scores and signal features corresponding to each segmented ECG signal, and calculates the attention results based on the attention scores and signal features.

[0029] Preferably, in step S5), the global channel and spatial enhanced convolution model processes the attention results of the segmented ECG signal using channel attention and spatial attention to obtain comprehensive features;

[0030] Then, the inter-band relationship of the comprehensive features is calculated through a one-dimensional convolutional layer; and the comprehensive features and inter-band relationship are processed through a spatial enhanced convolutional network to obtain the denoising results corresponding to each segmented ECG signal.

[0031] Preferably, the present invention further provides an ECG signal denoising device, comprising:

[0032] A segmentation module, used for segmenting the ECG signal to be denoised into a plurality of segmented ECG signals;

[0033] A high-frequency and low-frequency transformation module is used to extract low-frequency components and high-frequency components of each segmented ECG signal using discrete wavelet transform;

[0034] The coding module is used to perform coding calculation on each segmented ECG signal to obtain a coding matrix corresponding to each segmented ECG signal;

[0035] A multi-head self-attention module is used to calculate the attention result of the segmented ECG signal according to the low-frequency component, high-frequency component and encoding matrix of the segmented ECG signal;

[0036] A denoising module, for denoising the segmented ECG signals by inputting the attention results of each segmented ECG signal into a global channel and spatial enhancement convolution model;

[0037] The splicing module is used to splice the denoised segmented ECG signals to obtain a denoised ECG signal.

[0038] Preferably, the present invention further provides an ECG signal denoising device, the device comprising a processor and a memory; the memory is used to store program codes and transmit the program codes to the processor;

[0039] The processor is used to execute the ECG signal denoising method according to the instructions in the program code.

[0040] Preferably, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store program code, and the program code is used to execute the ECG signal denoising method.

[0041] The beneficial effects of the present invention are:

[0042] 1. The present invention utilizes a frequency-guided multi-head self-attention model that extracts intra-band correlations and a global channel and spatial enhancement convolution model that captures inter-band correlations to denoise the ECG signal to be denoised, with better denoising performance and more stable robustness, solving the technical problem that the existing denoising methods based on time domain / frequency domain are insensitive to noise intensity and have poor robustness;

[0043] 2 The present invention divides the ECG signal into multiple segments, so that each segment covers all important features of the ECG signal;

[0044] 3. The frequency-guided multi-head self-attention model FG-MSA of the present invention guides the time-domain attention process by introducing frequency domain information by combining time-frequency analysis and MSA, effectively captures the intra-band dependency, effectively combines the advantages of time-frequency analysis and attention mechanism, and improves the denoising ability; at the same time, frequency information is effectively utilized through discrete wavelet transform;

[0045] 4. The present invention reduces spectrum overlapping noise through global channel and spatial enhanced convolution GCSC; and GCS can also adaptively adjust the weight ratio of different frequency bands and signal parts to better capture the correlation between frequency bands. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 Schematic diagram of the process of the denoising method in Embodiment 1 of the present invention;

[0047] Figure 2 Schematic diagram of the structure of the frequency-guided multi-head self-attention model in Example 1 of the present invention;

[0048] Figure 3 Schematic diagram of the structure of the global channel and spatial enhancement convolution model in Example 1 of the present invention;

[0049] Figure 4 Schematic diagram of the denoising effect of each method in Example 2 of the present invention;

[0050] Figure 5 Schematic diagram of the framework of the denoising device in Example 3 of the present invention. DETAILED DESCRIPTION

[0051] The specific implementation of the present invention will be further described below in conjunction with the accompanying drawings:

[0052] Example 1

[0053] like Figure 1 As shown, this embodiment provides a method for denoising an ECG signal, comprising the following steps:

[0054] S1), dividing the ECG signal to be denoised into several segmented ECG signals;

[0055] like Figure 2 As shown, the ECG signal is mainly affected by four types of noise, such as baseline drift (BW), electrode motion (EM), muscle artifact (MA) and their mixture (Mix).

[0056] Different types of noise have different characteristics. For example, BW noise is mainly generated by the unconscious autonomous movement of the human body. It is a low-frequency noise of about 0.05 to 1 Hz, characterized by deviation of the baseline, fluctuating up and down. EM noise is caused by changes in human skin impedance and potential, and exhibits large amplitude and strong randomness. MA noise is a high-frequency noise with a frequency range of 5 to 2000 Hz, caused by tremors caused by human muscle contraction, and manifests as irregular and rapidly changing waveforms. Compared with BW noise and MA noise, EM noise is more difficult to remove. Its spectrum is mainly in the range of 1 to 10 Hz, and has a large overlap with the spectrum of the ECG signal.

[0057] Due to the potential length of the original electrocardiogram, long-term denoising brings huge time and resource costs. The present embodiment segments the ECG signal to be denoised to avoid the iterative error caused by the detection algorithm. It is understandable that in order to further ensure the accuracy of the calculation, the present embodiment segments the ECG signal to be denoised into segments of fixed length (for example, each segment can be 1024 sampling points). Since the sampling rate is 360Hz, the typical electrocardiogram cardiac cycle is about 0.5 seconds to 1 second. Such segmentation can make each segment have at least 2 complete electrocardiogram cardiac cycles. Each segment covers all the important features of the ECG signal, such as P wave, QRS complex, T wave and U wave.

[0058] S2), extracting low-frequency components and high-frequency components of each segmented ECG signal based on discrete wavelet transform;

[0059] In this embodiment, discrete wavelet transform is embedded in the multi-head self-attention operation, and the perception field is increased by combining frequency features and time features, and fine-grained prediction changes are provided. Specifically, the following steps are included:

[0060] S21), normalizing the segmented ECG signal to obtain a normalized segmented ECG signal, the data amplitude range is 0 to 1; wherein the calculation formula for the normalization processing is:

[0061]

[0062] In the formula, s min 、s max are the minimum and maximum values ​​of the segmented ECG signal, s i is the i-th segment ECG signal; Norm(s i ) is the i-th segment ECG signal after normalization;

[0063] S22), based on discrete wavelet transform and a preset low-frequency component calculation formula, extract the low-frequency component of each segmented ECG signal, the low-frequency component calculation formula is:

[0064] sL =(s*g)↓2;

[0065] In the formula, s L is the low-frequency component of the segmented ECG signal, s is the segmented ECG signal, g is the low-pass filter, * is the convolution operation, ↓2 is the downsampling operation with a step size of 2;

[0066] S23), based on discrete wavelet transform and a preset high-frequency component calculation formula, extract the high-frequency component of each segmented ECG signal, the high-frequency component calculation formula is:

[0067] s H =(s*h)↓2;

[0068] In the formula, s H is the high frequency component of the segmented ECG signal, and h is the high-pass filter.

[0069] S3), performing coding calculation on each segmented ECG signal to obtain a coding matrix corresponding to each segmented ECG signal;

[0070] In this embodiment, the encoding matrix includes a query matrix, a key matrix and a value matrix. The calculation of each matrix is ​​as follows:

[0071] S31), based on a preset query matrix calculation formula, encoding and calculating each of the segmented ECG signals to obtain a query matrix corresponding to each of the segmented ECG signals, wherein the query matrix calculation formula is:

[0072] [Q 1 ,Q 2 ,...,Q h ]=s·W q ;

[0073] In the formula, [Q 1 ,Q 2 ,...,Q h ] is the query matrix; h is the number of heads in the frequency-guided multi-head self-attention model; s is the segmented ECG signal; W q is the projection mapping of the query matrix;

[0074] S32), based on a preset key matrix calculation formula, encoding and calculating each of the segmented ECG signals to obtain a key matrix corresponding to each of the segmented ECG signals, wherein the key matrix calculation formula is:

[0075] [K 1 ,K 2 ,...,K h ]=Concat(s L ,s H )·W k

[0076] In the formula, [K 1 ,K 2 ,...,K h ] is the key matrix; Concat(s L ,s H ) is the concatenation operation of the low-frequency component and the high-frequency component of the segmented ECG signal; s L is the low frequency component; s H is the high frequency component; W k is the projection map of the key matrix;

[0077] S33), based on a preset value matrix calculation formula, encoding and calculating each of the segmented ECG signals to obtain a value matrix corresponding to each of the segmented ECG signals, wherein the value matrix calculation formula is:

[0078] [V 1 ,V 2 ,...,V h ]=s·W v

[0079] In the formula, [V 1 ,V 2 ,...,V h ] is the value matrix; W v is the projection map of the value matrix.

[0080] S4), using a preset frequency-guided multi-head self-attention model to process the low-frequency component, high-frequency component and encoding matrix of each segmented ECG signal to obtain the attention result corresponding to each segmented ECG signal;

[0081] like Figure 2 As shown, this embodiment proposes a frequency-guided multi-head self-attention model FG-MSA. The frequency-guided multi-head self-attention model FG-MSA guides the time domain attention process by combining time-frequency analysis and MSA to introduce frequency domain information and further capture intra-band dependencies.

[0082] In this embodiment, the frequency-guided multi-head self-attention model FG-MSA can automatically distinguish and filter out noise in ECG signals, effectively combining the advantages of time-frequency analysis and attention mechanism, and improving the denoising ability of the method of this embodiment.

[0083] In this embodiment, the low-frequency component, high-frequency component and encoding matrix of each segmented ECG signal are used as the input signal of the frequency-guided multi-head self-attention model, and the frequency-guided multi-head self-attention model uses the softmax function to calculate the attention score and signal characteristics corresponding to each segmented ECG signal. The calculation expression of the attention score of the frequency-guided multi-head self-attention model FG-MSA is:

[0084]

[0085] In the formula, AttentionScore i The attention score of the i-th head; Q i is the query matrix of the i-th head, The transposed matrix of the key matrix of the i-th head, T represents the transposed operation; d k is the dimension of the key matrix; softmax represents the softmax function.

[0086] The attention result is calculated based on the attention score and signal characteristics, specifically:

[0087]

[0088]

[0089] In the formula, is the attention calculation result of the i-th head, V i is the value matrix of the i-th head, is the attention calculation result of the segmented ECG signal, is the concatenation of the calculation results of h different attention heads, W L×L is the projection map of the segmented ECG signal with both input and output length L.

[0090] S5), using the global channel and spatial enhancement convolution model to denoise the attention results corresponding to each segmented ECG signal, to obtain the denoising results corresponding to each segmented ECG signal;

[0091] In this embodiment, the global channel and spatial enhanced convolution model uses channel attention and spatial attention to process the attention results of the segmented ECG signal to obtain comprehensive features;

[0092] Then, the inter-band relationship of the comprehensive features is calculated through a one-dimensional convolutional layer; and the comprehensive features and inter-band relationship are processed through a spatial enhanced convolutional network to obtain the denoising results corresponding to each segmented ECG signal.

[0093] In this embodiment, Figure 3 As shown, the global channel and spatial enhanced convolution model combines a lightweight attention module LA and a 1-D convolution layer to adjust the weight ratio of different frequency bands and signal parts; the two lightweight attention modules LA are executed in different dimensions while sharing the same structure, and the lightweight attention modules LA are deployed for the channel attention LA of the key frequency bands respectively. c and spatial attention LA of the key part of the signal sSpecifically, for channel attention, this embodiment first applies average pooling and maximum pooling operations in the spatial dimension to obtain feature maps, and then this embodiment connects the two pooling results in the channel dimension and applies 1-D convolution to extract the inter-band relationship. Finally, the sigmoid function is used to generate the weight of the channel attention. In this embodiment, the channel attention LA c The expression is as follows:

[0094]

[0095]

[0096] Where AP c AP c (·) and MP c Respectively represent the average pooling and maximum pooling operations of channel attention in the spatial dimension, is the result of channel attention average pooling, is the result of the maximum pooling of channel attention, Z c is the input of the channel attention module, is the weight of the channel attention, σ is the sigmoid function, W k=1 is a 1-D convolution, k represents the convolution kernel size, It is the concatenation operation of the channel attention average pooling and maximum pooling results.

[0097] Similar to channel attention, it operates on different dimensions with channel attention LA c Spatial attention LA sharing the same structure s The expression is as follows:

[0098]

[0099]

[0100] Where AP s and MP s are the average pooling and maximum pooling operations representing spatial attention in the spatial dimension, is the result of spatial attention average pooling, is the result of the maximum pooling of spatial attention, Z s is the input of the spatial attention module, is the weight of spatial attention, W k=7 is a 1-D convolution, It is the concatenation operation of the spatial attention average pooling and maximum pooling results.

[0101] After the above two attention processes, this embodiment obtains the fine features of the frequency band and further elaborates the representation of the signal time series. Finally, this embodiment obtains the inter-band correlation by applying a 1-D convolution layer, thereby combining the important parts of frequency and time features.

[0102] Z c =Z g +LA c (Z g )·Z g

[0103] Z s =Z c +LA s (Z c )·Z c

[0104]

[0105] Where LA c and LA s They represent the channel attention module and the spatial attention module respectively, and Z c is the output of the channel attention module, Z g is the input of the global channel and spatial enhancement convolutional model, Z g is the output of the spatial attention module, Comprehensive features of the output of the global channel and spatial enhanced convolutional model.

[0106] S6), concatenating the denoising results corresponding to each segmented ECG signal to obtain a denoised ECG signal.

[0107] Example 2

[0108] This embodiment uses the MIT-BIH arrhythmia and QT database as the clean electrocardiogram ground truth (Origin), while the MIT-BIH noise stress test database is the noisy data (Noisy).

[0109] Among them, the MIT-BIH arrhythmia database is a widely used electrocardiogram arrhythmia classification database, which can also be used as a pure signal for ECG denoising. It includes 48 ECG signal recordings from different patients with 11-bit resolution in the 10mV range. The sampling subjects include 25 males aged between 32 and 89 years and 22 females aged between 23 and 89 years. All recordings contain two channels, with the MLII lead appearing the most in the recordings. Each ECG recording is 30 minutes long and sampled at 360Hz.

[0110] The QT database contains 105 records with two channels created from seven different databases. Each record contains the onset, peak, and excursion markets of the P wave, QRS complex, T wave, and U wave, which contain 30 to 50 selected beats. Each ECG record is 15 minutes long and sampled at a frequency of 250 Hz. Since its data source is a sample from other databases, the QT database lacks statistical analysis of lead type, gender, and age distribution.

[0111] The MIT-BIH Noise Stress Test Database is an ECG noise database based on the MIT-BIH Arrhythmia Database, including 12 half-hour ECG records. and 3.5 hours of typical noise, all sampled at 360Hz. The noise records include baseline drift (BW), electrode movement (EM) and muscle artifact (MA). Mixing them in proportion based on these baseline noises is called mixed noise.

[0112] This example compares the method of Example 1 with WT, improved DAE, FCN-DAE, SCED-Net+LNC, SRD and ADnCNN methods, which are specially designed for ECG denoising.

[0113] In this embodiment, the number of embedding feature dimensions C is set to 32, and the depth N of the model is set to 3. In order to evaluate the robustness of the model of the method of Example 1 under different noise intensities, three different signal-to-noise ratio levels (-1dB, 3dB, 7dB) were selected for training, and another three levels (0dB, 1.25dB, 5dB) were used for testing. Following the same settings as the baseline method, a noisy signal was generated by adding randomly sampled additive noise to the clean ECG signal to obtain a training pair. During the training process, the Adam optimizer was used, and the learning rate was initially set to 1. 10-3 An adaptive training strategy is used to automatically reduce the learning rate based on the loss metric. Specifically, if the loss does not decrease for 10 consecutive epochs, the learning rate is reduced to half of the previous value. The total training epochs are set to 300.

[0114] Three indicators are used to evaluate the denoising performance, namely the signal-to-noise ratio (SNR), root mean square error, and root mean square difference (PRD) percentage. The signal-to-noise ratio is used to quantify the power ratio of the signal. The higher the SNR value, the better the signal quality. RMSE describes the error between the clean signal and the denoised signal of the ECG. A smaller value indicates excellent denoising performance. PRD measures the similarity between the clean signal and the denoised signal of the ECG. A smaller value reflects a closer signal.

[0115] In order to evaluate the performance of the method of Example 1, this embodiment performed four different noise types (BW, EM, MA and Mix), of which six noise intensities ranged from (-1db to 7db). The denoising results are shown in Tables 1 and 2. As can be seen from Tables 1 and 2, the method of Example 1 has achieved excellent denoising performance under different input signal-to-noise ratios and noise types. This is because Example 1 combines the traditional wavelet transform with the attention network to effectively learn the time domain and frequency domain features of the ECG signal. Specifically, for the MIT-BIH arrhythmia database, the output signal-to-noise ratio of the method of this application example is as high as 38.01dB, the minimum RMSE is 0.0036, and the minimum PRD is 1.342%. For the QT database, the signal-to-noise ratio is as high as 38.14dB, and the RMSE and PRD are as low as 0.0049 and 1.341%. In addition, compared with other noises, the denoising performance of MA noise is slightly worse, which is due to its high-frequency characteristics with strong randomness. Despite this, the method of Example 1 still achieves satisfactory denoising performance. In general, as the input SNR increases, the denoising changes under various indicators are not obvious, which further proves the robustness of the model in this application example.

[0116] Table 1 - Denoising comparison of different methods under different noise types and intensities in the MIT-BIH arrhythmia database

[0117]

[0118]

[0119] Table 2 Denoising comparison of different methods under different noise types and intensities on the QT database

[0120]

[0121] As can be seen from the table, as expected, the method of this embodiment 1 outperforms all other baseline methods on four noises of different intensities. ADnCNN achieves suboptimal denoising effects due to the combination of adversarial training strategies and convolutional neural networks - this work introduces frequency domain loss in model training. However, the combination of frequency and loss functions is not an effective approach because the frequency domain contains key information that is beneficial to the ECG denoising process itself. In the method of embodiment 1, time-frequency analysis is fused into the attention process to capture long-range dependencies and multimodal information in the denoising process. In addition, channel and spatial enhanced convolutions are introduced to further improve the ability to capture inter-band correlations, thereby eliminating spectral overlapping noise. Compared with ADnCNN, the method of embodiment 1 improves the average output signal-to-noise ratio by 2.21dB and 5.977dB on the MIT-BIH arrhythmia and QT databases, respectively, and reduces the average RMSE by 0.0022 and 0.00698, respectively. The results of the comparative experiments prove the effectiveness of our method.

[0122] in addition, Figure 4 The denoising effect diagram of the method in Example 1 and the WT, improved DAE, FCN-DAE, SCED-Net+LNC, SRD and ADnCNN methods, with visualization results under different noise types (the first to fourth columns from left to right represent BW, EM, MA and Mix noise) and intensities (the first to third rows from top to bottom represent 0dB, 1.25dB and 5dB) of different databases, where "Origin" represents the ground truth, "Noisy" represents the noisy ECG signal, and "Ours" represents the denoising result of our method. As can be seen from the figure, red represents the ECG signal denoised by the method in Example 1, and sky blue and blue represent the clean ECG signal and the ECG signal polluted by noise, respectively. It can be observed intuitively that the sky blue is almost invisible in the figure because it is almost completely covered by red. This means that the method in Example 1 achieves excellent denoising performance, which is very close to the ground truth. In summary, the experimental results show that the method in Example 1 has good performance in denoising ability for four different noise types and multi-level noise intensities on different databases.

[0123] Example 3

[0124] like Figure 5 As shown, this embodiment provides an ECG signal denoising device, comprising:

[0125] A segmentation module, used for segmenting the ECG signal to be denoised into a plurality of segmented ECG signals;

[0126] A high-frequency and low-frequency transformation module is used to extract low-frequency components and high-frequency components of each segmented ECG signal using discrete wavelet transform;

[0127] The coding module is used to perform coding calculation on each segmented ECG signal to obtain a coding matrix corresponding to each segmented ECG signal;

[0128] A multi-head self-attention module is used to calculate the attention result of the segmented ECG signal according to the low-frequency component, high-frequency component and encoding matrix of the segmented ECG signal;

[0129] A denoising module, for denoising the segmented ECG signals by inputting the attention results of each segmented ECG signal into a global channel and spatial enhancement convolution model;

[0130] The splicing module is used to splice the denoised segmented ECG signals to obtain a denoised ECG signal.

[0131] In this embodiment, the high-frequency and low-frequency conversion module further performs normalization processing on each segmented ECG signal before extracting the low-frequency component and the high-frequency component.

[0132] Example 4

[0133] This embodiment provides an ECG signal denoising device, the device comprising a processor and a memory; the memory is used to store program codes and transmit the program codes to the processor;

[0134] The processor is used to execute the ECG signal denoising method according to the instructions in the program code.

[0135] In this embodiment, the memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The processor is coupled to the memory and is used to execute the computer program in the memory.

[0136] Example 5

[0137] This embodiment provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store program codes, and the program codes are used to execute the ECG signal denoising method.

[0138] The above embodiments and descriptions are only for illustrating the principles and best embodiments of the present invention. Without departing from the spirit and scope of the present invention, the present invention may be subject to various changes and improvements, all of which fall within the scope of the present invention to be protected.

Claims

1. A method for denoising an ECG signal, characterized in that: The following steps are involved: S1), dividing the ECG signal to be denoised into several segmented ECG signals; S2), extracting low-frequency components and high-frequency components of each segmented ECG signal based on discrete wavelet transform; S3), performing coding calculation on each segmented ECG signal to obtain a coding matrix corresponding to each segmented ECG signal; S4), using a preset frequency-guided multi-head self-attention model to process the low-frequency component, high-frequency component and encoding matrix of each segmented ECG signal to obtain the attention result corresponding to each segmented ECG signal; S5), using the global channel and spatial enhancement convolution model to denoise the attention results corresponding to each segmented ECG signal, to obtain the denoising results corresponding to each segmented ECG signal; S6), concatenating the denoising results corresponding to each segmented ECG signal to obtain a denoised ECG signal.

2. The ECG signal denoising method according to claim 1, characterized in that: The extraction of the low-frequency component and the high-frequency component is specifically as follows: S21), extracting the low-frequency components of each segmented ECG signal through a low-pass filter and a convolution operation; the low-frequency component calculation formula is: s L =(s*g)↓2; In the formula, s L is the low-frequency component of the segmented ECG signal, s is the segmented ECG signal, g is the low-pass filter, * is the convolution operation, ↓2 is the downsampling operation with a step size of 2; S22), extracting the high-frequency components of each segmented ECG signal through a high-pass filter and a convolution operation, wherein the high-frequency component calculation formula is: s H =(s*h)↓2; In the formula, s H is the high frequency component of the segmented ECG signal, and h is the high-pass filter.

3. The ECG signal denoising method according to claim 2, characterized in that: In step S3), the encoding matrix includes a query matrix, a key matrix and a value matrix, and the encoding calculation of the encoding matrix specifically includes the following steps: S31), based on a preset query matrix calculation formula, encoding and calculating each of the segmented ECG signals to obtain a query matrix corresponding to each of the segmented ECG signals, wherein the query matrix calculation formula is: [Q1,Q2,...,Q h ]=s·W q ; In the formula, [Q1,Q2,...,Q h ] is the query matrix; h is the number of heads in the frequency-guided multi-head self-attention model; s is the segmented ECG signal; W q is the projection mapping of the query matrix; S32), based on a preset key matrix calculation formula, encoding and calculating each of the segmented ECG signals to obtain a key matrix corresponding to each of the segmented ECG signals, wherein the key matrix calculation formula is: [K1,K2,...,K h ]=Concat(s L ,s H )·W k In the formula, [K1,K2,...,K h ] is the key matrix; Concat(s L ,s H ) is the concatenation operation of the low-frequency component and the high-frequency component of the segmented ECG signal; s L is the low frequency component; s H is the high frequency component; W k is the projection mapping of the key matrix; S33), based on a preset value matrix calculation formula, encoding and calculating each of the segmented ECG signals to obtain a value matrix corresponding to each of the segmented ECG signals, wherein the value matrix calculation formula is: [V1,V2,...,V h ]=s·W v Where [V1,V2,...,V h ] is the value matrix; W v is the projection map of the value matrix.

4. The ECG signal denoising method according to claim 3, characterized in that: In step S4), the low-frequency component, high-frequency component and encoding matrix of each segmented ECG signal are used as input signals of the frequency-guided multi-head self-attention model. The frequency-guided multi-head self-attention model uses a softmax function to calculate the attention score and signal feature corresponding to each segmented ECG signal, and calculates the attention result based on the attention score and signal feature. The calculation of the attention result is specifically as follows: In the formula, AttentionScore i is the attention score of the i-th head; is the attention calculation result of the i-th head, V i is the value matrix of the i-th head, is the attention calculation result of the segmented ECG signal, is the concatenation of the calculation results of h different attention heads, W L×L is the projection map of the segmented ECG signal with both input and output length L.

5. The ECG signal denoising method according to claim 4, characterized in that: In step S5), the global channel and spatial enhanced convolution model processes the attention results of the segmented ECG signal using channel attention and spatial attention to obtain comprehensive features; Then, the inter-band relationship of the comprehensive features is calculated through a one-dimensional convolutional layer; and the comprehensive features and inter-band relationship are processed through a spatial enhanced convolutional network to obtain the denoising results corresponding to each segmented ECG signal.

6. The ECG signal denoising method according to claim 5, characterized in that: In step S5), the global channel and spatial enhanced convolution model integrates the lightweight attention module LA and the 1-D convolution layer to adjust the weight ratio of different frequency bands and signal parts; the two lightweight attention modules LA are executed in different dimensions while sharing the same structure, and the lightweight attention modules LA are respectively deployed for the channel attention LA of the key frequency bands. c and spatial attention LA of the key part of the signal s .

7. The ECG signal denoising method according to claim 6, characterized in that: In step S5), for channel attention, firstly, average pooling and maximum pooling operations are applied in the spatial dimension to obtain feature maps, then the two pooling results are connected in the channel dimension, and 1-D convolution is applied to extract the inter-band relationship; finally, the sigmoid function is used to generate the weight of the channel attention; channel attention LA c The expression is as follows: Where AP c AP c (·) and MP c Respectively represent the average pooling and maximum pooling operations of channel attention in the spatial dimension, is the result of channel attention average pooling, is the result of the maximum pooling of channel attention, Z c is the input of the channel attention module, is the weight of the channel attention, σ is the sigmoid function, W k=1 is a 1-D convolution, k represents the convolution kernel size, It is the concatenation operation of the channel attention average pooling and maximum pooling results; Channel attention LA when operating in different dimensions c Spatial attention LA sharing the same structure s The expression is as follows: Where AP s and MP s are the average pooling and maximum pooling operations representing spatial attention in the spatial dimension, is the result of spatial attention average pooling, is the result of the maximum pooling of spatial attention, Z s is the input of the spatial attention module, is the weight of spatial attention, W k=7 is a 1-D convolution, It is the concatenation operation of the spatial attention average pooling and maximum pooling results; Then, a 1-D convolutional layer is used to obtain inter-band correlations, thereby combining the important parts of frequency and time features; WITH c =Z g +LA c (WITH g )·WITH g WITH s =Z c +LA s (WITH c )·WITH c Where LA c and LA s They represent the channel attention module and the spatial attention module respectively, and Z c is the output of the channel attention module, Z g is the input of the global channel and spatial enhancement convolutional model, Z g is the output of the spatial attention module, Comprehensive features of the output of the global channel and spatial enhanced convolutional model.

8. A denoising device for ECG signals, characterized in that: The denoising device is used in the denoising method according to any one of claims 1 to 7, and the denoising device comprises: A segmentation module, used for segmenting the ECG signal to be denoised into a plurality of segmented ECG signals; A high-frequency and low-frequency transformation module is used to extract low-frequency components and high-frequency components of each segmented ECG signal using discrete wavelet transform; The coding module is used to perform coding calculation on each segmented ECG signal to obtain a coding matrix corresponding to each segmented ECG signal; A multi-head self-attention module is used to calculate the attention result of the segmented ECG signal according to the low-frequency component, high-frequency component and encoding matrix of the segmented ECG signal; A denoising module, for denoising the segmented ECG signals by inputting the attention results of each segmented ECG signal into a global channel and spatial enhancement convolution model; The splicing module is used to splice the denoised segmented ECG signals to obtain a denoised ECG signal.

9. A denoising device for ECG signals, characterized in that: The denoising device is used to execute the denoising method according to any one of claims 1 to 7, and the device comprises a processor and a memory; the memory is used to store program code and transmit the program code to the processor; The processor is used to execute the denoising method according to any one of claims 1 to 7 according to the instructions in the program code.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program codes, and the program codes are used to execute the denoising method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Unsupervised multi-mode electrocardiogram anomaly detection method based on attention mechanism

    CN115944302A

  • Wavelet two-channel single-lead electrocardio denoising method based on coding and decoding structure

    CN116942172A

  • Arrhythmia classification method based on SincNet and multi-head attention mechanism

    CN117653135A

  • Adaptive ECG triggering in an ablation system

    US20210322086A1

  • System and method using machine learning algorithm for vital sign data analysis

    WO2023056507A1