Electrocardiogram anomaly detection method and system based on multi-scale signal recovery

By employing a multi-scale signal recovery method, the problem of balancing global and local abnormalities in electrocardiogram anomaly detection was solved, achieving more efficient anomaly detection and localization, and improving the interpretability and diagnostic accuracy of the algorithm.

CN116541791BActive Publication Date: 2025-12-23SHANGHAI JIAOTONG UNIV +2
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310540311.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-12
Publication Date
2025-12-23
Estimated Expiration
2043-05-12

AI Technical Summary

Technical Problem

Existing methods for detecting ECG abnormalities are unable to take into account different types of abnormalities in both global ECG signals and local heartbeat signals, and cannot accurately locate abnormal areas, leading to misjudgments and diagnostic logic that is inconsistent with that of professional doctors.

Method used

A multi-scale signal recovery method is adopted, which combines signal denoising, heartbeat segmentation, multi-scale coding, self-attention processing, signal trend generation and decoding with an anomaly assessment function to achieve multi-scale feature extraction and anomaly assessment of electrocardiogram signals.

Benefits of technology

It improves the accuracy and interpretability of ECG abnormality detection, enhances the ability to detect different types of abnormalities, and improves the performance of abnormality detection and localization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116541791B_ABST
    Figure CN116541791B_ABST
Patent Text Reader

Abstract

The application provides an electrocardiogram anomaly detection method and system based on multi-scale signal recovery, comprising: using filtering to eliminate signal noise of an electrocardiogram original signal to obtain a global signal; detecting an R peak of the global signal and using an adaptive dynamic threshold to obtain a local signal; realizing multi-scale signal feature coding on the global signal and the local signal; using a self-attention mechanism and a residual-based method on the multi-scale coding features to obtain global and local features; using a time scale smoothing on the global signal to obtain a smoothed signal trend; realizing signal trend coding on the smoothed signal trend; realizing multi-scale signal decoding on the global features and the local features; realizing signal trend decoding on the global features and the signal trend features; and using an anomaly evaluation function to realize electrocardiogram anomaly evaluation. The application improves the detection ability of the electrocardiogram anomaly detection algorithm for different anomaly types and improves the explainability of the electrocardiogram anomaly detection algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of medical artificial intelligence and signal processing, in particular to an electrocardiogram abnormality detection method and system based on multi-scale signal recovery. BACKGROUND

[0002] At present, the deep learning technology based on deep neural network has achieved remarkable achievements in the disease classification task of electrocardiogram signal data. This data-driven method usually needs a large amount of labeled data for training. However, in clinical diagnosis, the types of electrocardiogram abnormalities are complex and diverse, and there are also many rare diseases, and it is too costly to collect enough abnormal data for model training. At the same time, the electrocardiogram classification model trained according to the labeled data may not be able to identify the strange abnormal types that have not been encountered during training. On the other hand, the abnormality detection method uses normal healthy data for training, which can identify any potential abnormal state and avoid missing diagnosis of rare heart diseases.

[0003] The existing abnormality detection technology includes a single-class discrimination-based method, a reconstruction-based method and a self-supervised learning-based method, which assumes that a model trained only on normal data is difficult to handle abnormal data, and uses the difference in processing performance of the model on normal and abnormal electrocardiogram data as an abnormality detection detection index. However, the existing electrocardiogram signal abnormality detection method often does not conform to the diagnosis logic of professional doctors, and does not fully consider the data characteristics of the electrocardiogram signal itself; or cannot accurately complete the abnormal region positioning. In fact, in order to improve the electrocardiogram abnormality detection performance of the algorithm, improve the explainability of the electrocardiogram abnormality detection algorithm, and improve the electrocardiogram abnormality positioning ability, it is very important, but the existing abnormality detection algorithm often ignores this important task.

[0004] According to the search, the patent document with the Chinese invention patent publication number CN107440679A discloses a method and corresponding system for detecting electrocardiogram abnormalities. There are rhythm type abnormalities existing in the global electrocardiogram signal and morphological abnormalities existing in the local heartbeat signal in the electrocardiogram signal, and the existing technology does not consider both of these two different types of abnormalities, resulting in misdiagnosis of some abnormal samples. SUMMARY

[0005] In view of the defects in the prior art, the purpose of the present application is to provide an electrocardiogram abnormality detection method and system based on multi-scale signal recovery.

[0006] The electrocardiogram abnormality detection method based on multi-scale signal recovery provided by the present application comprises:

[0007] The signal denoising step: using filtering to eliminate signal noise on the electrocardiogram original signal to obtain a global signal;

[0008] heartbeat segmentation step: using R-peak detection and adaptive dynamic threshold on the global signal to obtain the local signal;

[0009] multi-scale signal encoding step: using deep convolutional neural network on the global signal and the local signal to realize multi-scale signal encoding to obtain multi-scale encoding features;

[0010] multi-scale self-attention step: using self-attention mechanism and residual-based method on the multi-scale encoding features to obtain global features and local features;

[0011] signal trend generation step: using time scale smoothing and difference on the global signal to obtain a smoothed signal trend;

[0012] signal trend encoding step: using deep convolutional neural network on the smoothed signal trend to realize signal trend encoding to obtain signal trend features;

[0013] multi-scale signal decoding step: using deep convolutional neural network on the global features and the local features to realize multi-scale signal decoding;

[0014] signal trend decoding step: using deep convolutional neural network on the global features and the signal trend features to realize signal trend decoding;

[0015] abnormality assessment step: using abnormality assessment function on the multi-scale signal decoding and the signal trend decoding to realize electrocardiogram abnormality assessment.

[0016] Preferably, in the signal denoising step:

[0017] using a Butterworth filter and a notch filter to remove high-frequency noise of the electrocardiogram original signal and eliminate baseline drift of the electrocardiogram original signal, the denoised global signal is denoted as x g ;

[0018] In the heartbeat segmentation step:

[0019] using a sliding window to adaptively calculate a dynamic threshold for detecting R-peak in the global signal x g , based on the detected R-peak position, segmenting the global signal to obtain local single heartbeat signals, denoted as x l ;

[0020] In the multi-scale signal encoding step:

[0021] using the global signal x g and the local signal x l as input, and adding randomly generated masks M g and M lThe network is trained to recover signals according to the characteristics of the adjacent uncovered areas, wherein a plurality of different areas are randomly covered to process global rhythm recovery, and a single continuous area is randomly covered to process detail recovery; a deep convolutional neural network is used to extract high-dimensional feature information of the multi-scale signals after adding a random mask, and the expression is:

[0022]

[0023]

[0024] wherein, and are the feature information obtained by encoding the global and local covered signals; ⊙ represents the corresponding element multiplication operation; the signal feature extraction network E g and E l is composed of several layers of convolution operations;

[0025] In the multi-scale self-attention step:

[0026] The feature information and are inputted, the electrocardiogram features of different scales are merged, and the merged feature information f ca is obtained by using a self-attention mechanism to process the merged feature information, wherein the self-attention mechanism is used to capture the correlation between global features and local features, and dynamically assign weights to different elements in the merged feature information, and is expressed as:

[0027]

[0028]

[0029] wherein, Q, K, and V are three input items of the self-attention mechanism; Attention(·) is a self-attention mechanism function; (·) T is a matrix transposition operation; softmax(·) is a normalized exponential function; represents the square root of the feature dimension used as a scaling factor; concat(·) represents the operation of splicing two tensors;

[0030] After obtaining the merged feature information f ca , the merged feature information is re-separated through two different fully connected networks to obtain new multi-scale electrocardiogram features, and the new multi-scale electrocardiogram features are connected with the input multi-scale electrocardiogram features in a residual manner, and the process is expressed as:

[0031]

[0032]

[0033] Where, φ g (·),φ l (·) represents two multilayer perceptron network structures containing two fully connected layers; ultimately, cross-fused multi-scale ECG features are obtained, with the global features denoted as . Local features are denoted as

[0034] Preferably, in the signal trend generation step:

[0035] For global signal x g The signal is smoothed using a moving average window over time. Then, adjacent signal points in the smoothed signal are subtracted and normalized to obtain the global ECG signal trend, which is denoted as x. t ;

[0036] In the signal trend encoding step:

[0037] For signal trend x t Using deep convolutional neural networks to extract high-dimensional feature information f of signal trends t That is, f t =E t (x t ), where the signal feature extraction network E t It consists of several layers of convolution operations.

[0038] Preferably, in the multi-scale signal decoding step:

[0039] With global features and local features As input, during the decoding process, a deep convolutional neural network is used to simultaneously generate reconstructed signals for the multi-scale signals. and uncertainty σ g ,σ l :

[0040]

[0041]

[0042] Among them, the global and local signal decoding and recovery network D g D l It consists of several layers of deconvolution operations; uncertainty is a tensor with the same scale as the recovered signal in the time dimension, used to measure the difficulty of recovering different signal points in the time dimension, avoiding misclassification of normal signals that are difficult to recover as abnormal signals; if the input is the features of the training signal, the output is the recovered training signal and uncertainty; if the input is the features of the signal to be tested, the output is the recovered test signal and uncertainty.

[0043] In the signal trend decoding step:

[0044] with high-dimensional feature information f of the signal trend t and global feature as input, the global electrocardiogram signal is reconstructed using a deep convolutional neural network after merging, and the mask occluded area is recovered to obtain a recovery signal based on the trend The expression is:

[0045]

[0046] wherein the signal decoding recovery network D t is composed of several layers of deconvolution operation; concat(·) represents the operation of splicing two tensors; if the input is a model training signal, the output is a recovery training signal; if the input is a signal to be tested, the output is a recovery test signal.

[0047] Preferably, in the abnormality assessment step:

[0048] For the model training electrocardiogram signal, the recovery training signal and the uncertainty and the recovery trend signal are compared with the model training signal, so as to calculate the following loss functions respectively:

[0049] Global electrocardiogram signal recovery loss function

[0050]

[0051] Local heartbeat signal recovery loss function

[0052]

[0053] Global recovery loss function based on trend

[0054]

[0055] wherein k represents different signal points in the time dimension, D represents the time length of the global electrocardiogram, and d represents the time length of the local heartbeat; the sum of the three loss functions is the final loss function for training;

[0056] For the electrocardiogram signal to be tested, the recovery test signal and the uncertainty and the recovery trend signal are compared with the model test signal, so as to calculate the following abnormality assessment function

[0057]

[0058] Wherein, m represents different heartbeats, remove the summation operation on different signal points in the time dimension, and then the abnormal positioning result of the test electrocardio signal is obtained, and the greater the abnormal evaluation function value is, the greater the possibility of abnormal signal is.

[0059] According to the application, a multi-scale signal recovery-based electrocardiogram abnormality detection system is provided, comprising:

[0060] A signal denoising module: using filtering to eliminate signal noise of the electrocardiogram original signal to obtain a global signal;

[0061] A heartbeat segmentation module: using R-peak detection and adaptive dynamic threshold to obtain a local signal from the global signal;

[0062] A multi-scale signal coding module: using a deep convolutional neural network to realize multi-scale signal coding on the global signal and the local signal to obtain multi-scale coding features;

[0063] A multi-scale self-attention module: using a self-attention mechanism and a residual-based method to obtain global features and local features from the multi-scale coding features;

[0064] A signal trend generation module: using time scale smoothing and difference to obtain a smoothed signal trend from the global signal;

[0065] A signal trend coding module: using a deep convolutional neural network to realize signal trend coding on the smoothed signal trend to obtain signal trend features;

[0066] A multi-scale signal decoding module: using a deep convolutional neural network to realize multi-scale signal decoding on the global features and the local features;

[0067] A signal trend decoding module: using a deep convolutional neural network to realize signal trend decoding on the global features and the signal trend features;

[0068] An abnormality evaluation module: using an abnormality evaluation function to realize electrocardiogram abnormality evaluation on the multi-scale signal decoding and the signal trend decoding.

[0069] Preferably, in the signal denoising module:

[0070] The noisy electrocardiogram original signal is input, a Butterworth filter and a notch filter are used to remove high-frequency noise of the electrocardiogram original signal and eliminate baseline drift of the electrocardiogram original signal, and the global signal after denoising is denoted as x g ;

[0071] In the heartbeat segmentation module:

[0072] The global signal x g, a dynamic threshold is adaptively calculated using a sliding window to minimize the standard deviation between consecutive differences, for detecting R peaks in the global signal, based on the detected R peak positions, the global signal is segmented to obtain local single heartbeat signals, denoted as x l ;

[0073] In the multi-scale signal encoding module:

[0074] The global signal x g and the local signal x l are inputted, and random generated masks M g and M l are added to train the network, and the signal is recovered according to the features of the adjacent unmasked areas, wherein a plurality of different areas of the global signal are randomly masked to process the global rhythm recovery, and a single continuous area of the local signal is randomly masked to process the detail recovery; a deep convolutional neural network is used to extract high-dimensional feature information of the multi-scale signal after adding the random mask, and the expression is:

[0075]

[0076]

[0077] wherein, and are the feature information of the global and local masked signals obtained by encoding; ⊙ represents the corresponding element multiplication operation; the signal feature extraction network E g and E l are composed of a plurality of convolutional operations;

[0078] In the multi-scale self-attention module:

[0079] The feature information and are inputted, the electrocardiogram features of different scales are combined, and the combined feature information f ca is obtained by processing the combined feature information using a self-attention mechanism, the self-attention mechanism is used to capture the correlation between global features and local features, and dynamically allocate weights to different elements in the fused feature, and is expressed as:

[0080]

[0081]

[0082] wherein, Q, K, and V are three input items of the self-attention mechanism; Attention(·) is a self-attention mechanism function; (·) T is a matrix transposition operation; softmax(·) is a normalized exponential function; The square root of the dimension of the feature is used as a scaling factor; concat(·) represents the operation of splicing two tensors;

[0083] The fusion feature information f is obtained ca Then, the fusion feature information is separated by two different fully connected networks to obtain new multi-scale ECG features, and the input multi-scale ECG features are connected in residual, and the process is represented as:

[0084]

[0085]

[0086] Wherein, φ g (·), φ l (·) are two multi-layer perception network structures containing two layers of fully connected layers; finally, the cross-fused multi-scale ECG features are obtained, and the global feature is denoted as The local feature is denoted as

[0087] Preferably, in the signal trend generation module:

[0088] The global signal x g is smoothed using a sliding average window in the time dimension, and then the adjacent signal points in the smoothed signal are subtracted and normalized to obtain the signal trend of the global ECG, and the signal trend is denoted as x t ;

[0089] In the signal trend encoding module:

[0090] The signal trend x t is used to extract high-dimensional feature information f of the signal trend using a deep convolutional neural network t , that is, f t = E t (x t ), wherein the signal feature extraction network E t is composed of several layers of convolution operations.

[0091] Preferably, in the multi-scale signal decoding module:

[0092] The global feature and the local feature are input, and in the decoding process, a deep convolutional neural network is used to generate a restored signal and an uncertainty σ g ,σ l :

[0093]

[0094]

[0095] wherein the global and local signal decoding recovery network D g ,D l is composed of several deconvolutional operations; the uncertainty is a tensor with the same scale as the recovered signal in the time dimension, which is used to measure the difficulty of recovering different signal points in the time dimension, so as to avoid misjudging normal signals as abnormal signals; wherein, if the input is the training signal feature, the output is the recovered training signal and the uncertainty; if the input is the signal feature to be tested, the output is the recovered test signal and the uncertainty;

[0096] In the signal trend decoding module:

[0097] the high-dimensional feature information f t and the global feature of the signal trend are inputted, merged and then reconstructed into the global ECG signal using a deep convolutional neural network, and the mask occluded area is recovered to obtain the recovered signal based on the trend The expression is:

[0098]

[0099] wherein the signal decoding recovery network D t is composed of several deconvolutional operations; concat(·) represents the operation of splicing two tensors; if the input is the model training signal, the output is the recovered training signal; if the input is the signal to be tested, the output is the recovered test signal.

[0100] Preferably, in the abnormality assessment module:

[0101] For the model training ECG signal, the recovered training signal and the uncertainty and the recovered trend signal are compared with the model training signal, so as to calculate the following loss functions respectively:

[0102] Global ECG signal recovery loss function

[0103]

[0104] Local heartbeat signal recovery loss function

[0105]

[0106] Global recovery loss function based on trend

[0107]

[0108] Wherein, k represents different signal points in time dimension, D represents the time length of global electrocardio, d represents the time length of local heartbeat, and the sum of the three loss functions is used as the final loss function of training.

[0109] For the electrocardio signal to be tested, the recovered test signal and the uncertainty and the recovery trend signal are compared with the model test signal, so as to calculate the following anomaly evaluation function

[0110]

[0111] Wherein, m represents different heartbeats, and after removing the summation operation of different signal points in time dimension, the anomaly positioning result of the electrocardio signal to be tested is obtained, and the greater the anomaly evaluation function value is, the greater the possibility of abnormal signal is.

[0112] Compared with the prior art, the present application has the following beneficial effects:

[0113] (1) The present application introduces multi-scale electrocardio signals, and proposes an electrocardio anomaly detection and anomaly positioning method and system suitable for clinical diagnosis scenarios through a multi-scale signal recovery training method, thereby improving the detection ability of the anomaly detection algorithm for different abnormal types, and achieving good performance in anomaly detection and anomaly positioning tasks.

[0114] (2) The present application improves the explainability of the anomaly detection algorithm by introducing multi-scale electrocardio signal analysis, thereby improving the algorithm performance of electrocardiogram anomaly detection. BRIEF DESCRIPTION OF DRAWINGS

[0115] Other features, objects and advantages of the present application will become more apparent from the following detailed description of non-limiting embodiments with reference to the following drawings:

[0116] Figure 1 The method flowchart in an embodiment of the present application is shown in the figure.

[0117] Figure 2 The system principle diagram in an embodiment of the present application is shown in the figure. DETAILED DESCRIPTION

[0118] The present application will be described in detail below with reference to specific embodiments. The following embodiments will help those skilled in the art to further understand the present application, but do not limit the present application in any form. It should be pointed out that, for those skilled in the art, without departing from the concept of the present application, a number of changes and improvements can be made. These all belong to the protection scope of the present application.

[0119] Example 1:

[0120] As Figure 1The application provides an electrocardiogram abnormality detection method based on multi-scale signal recovery, comprising:

[0121] A signal denoising step: filtering the original electrocardiogram signal to remove signal noise and obtain a global signal;

[0122] Specifically, in the signal denoising step:

[0123] The noisy original electrocardiogram signal is used as input, and a Butterworth filter and a notch filter are used to remove high-frequency noise of the original electrocardiogram signal and eliminate baseline drift of the original electrocardiogram signal. The denoised global signal is denoted as x g .

[0124] A heartbeat segmentation step: using R-peak detection and adaptive dynamic threshold to obtain a local signal from the global signal obtained in the signal denoising step;

[0125] Specifically, in the heartbeat segmentation step:

[0126] The global electrocardiogram signal x g obtained in the signal denoising step is used to adaptively calculate a dynamic threshold by using a sliding window to minimize the standard deviation between consecutive differences, for detecting R-peak in the global electrocardiogram signal. Based on the detected R-peak position, the global electrocardiogram signal is segmented to obtain a local single heartbeat signal, which is denoted as x l .

[0127] A multi-scale signal encoding step: using a deep convolutional neural network to realize multi-scale signal encoding on the global signal obtained in the signal denoising step and the local signal obtained in the heartbeat segmentation step, to obtain multi-scale encoding features;

[0128] Specifically, in the multi-scale signal encoding step:

[0129] The multi-scale electrocardiogram signals x g and x l obtained in the signal denoising step and the heartbeat segmentation step are used as input, and randomly generated masks M g and M l are added to train the network to perform signal recovery based on features of adjacent unmasked areas. The purpose of adding the mask is to reduce the influence of individual differences on abnormality detection. Among them, multiple different areas of the global electrocardiogram signal are randomly masked to process global rhythm recovery, and a single continuous area of the local heartbeat signal is randomly masked to process detail recovery. A deep convolutional neural network is used to extract high-dimensional feature information from the multi-scale signal with random masks added:

[0130]

[0131]

[0132] wherein, and are the feature information of the global and local occlusion signals obtained by the encoding step, denotes the multiplication operation of corresponding elements, and the signal feature extraction network E g and E l is composed of several layers of convolution operations.

[0133] Multi-scale self-attention step: using the self-attention mechanism and the residual-based method to obtain global features and local features on the multi-scale encoded features obtained by the multi-scale signal encoding step;

[0134] Specifically, in the multi-scale self-attention step:

[0135] The multi-scale electrocardio features obtained by the multi-scale signal encoding step and are inputted, the electrocardio features of different scales are merged, and the merged feature information f ca is obtained by processing the merged feature information using the self-attention mechanism. The self-attention mechanism is used to capture the correlation between global features and local features, and dynamically assigns weights to different elements in the fused features, which can be represented as:

[0136]

[0137]

[0138] wherein Q, K, and V are three input items of the self-attention mechanism, Attention(·) is the self-attention mechanism function, and (·) T is the matrix transposition operation, and softmax(·) is the normalization exponential function, denotes the square root of the feature dimension used as a scaling factor, and concat(·) denotes the concatenation operation of two tensors.

[0139] The fused feature information f ca is obtained, and then two different fully connected networks are used to separate the fused feature information to obtain new multi-scale electrocardio features, and the new multi-scale electrocardio features are connected in residual with the input multi-scale electrocardio features, and the process can be represented as:

[0140]

[0141]

[0142] wherein φ g (·), φ l(·) represents two multilayer perceptron network structures containing two fully connected layers. Ultimately, cross-fused multi-scale ECG features are obtained, with the global features denoted as... Local features are denoted as

[0143] Signal trend generation step: The global signal obtained from the signal denoising step is smoothed and subtracted using a time scale to obtain a smoothed signal trend;

[0144] Specifically, in the signal trend generation step:

[0145] The global electrocardiogram signal x obtained from the signal denoising step g The signal is smoothed using a moving average window over time. Then, adjacent signal points in the smoothed signal are subtracted and normalized to obtain the global ECG signal trend, which is denoted as x. t .

[0146] Signal trend encoding step: The smooth signal trend obtained in the signal trend generation step is encoded using a deep convolutional neural network to obtain signal trend features;

[0147] Specifically, in the signal trend encoding step:

[0148] The signal trend x obtained from the signal trend generation step t Using deep convolutional neural networks to extract high-dimensional feature information f of signal trends t That is, f t =E t (x t ), where the signal feature extraction network E t It consists of several layers of convolution operations.

[0149] Multi-scale signal decoding steps: Using a deep convolutional neural network, the global and local features obtained from the multi-scale self-attention step are used to perform multi-scale signal decoding;

[0150] Specifically, in the multi-scale signal decoding step:

[0151] Multiscale ECG features obtained using the aforementioned multiscale self-attention steps and As input, during the decoding process, a deep convolutional neural network is used to simultaneously generate reconstructed signals for the multi-scale signals. and uncertainty σ g ,σ l :

[0152]

[0153]

[0154] wherein the global and local signal decoding recovery network D g ,D l is composed of several layers of deconvolution operations. The uncertainty is a tensor with the same scale as the recovered signal in the time dimension, which is used to measure the difficulty of recovering different signal points in the time dimension, so as to avoid misjudging normal signals as abnormal signals. Wherein, if the input is the training signal feature, the output is the recovered training signal and the uncertainty, if the input is the signal to be tested, the output is the recovered test signal and the uncertainty.

[0155] Signal trend decoding step: using a deep convolutional neural network to realize signal trend decoding on the global features obtained by the multi-scale self-attention step and the signal trend features obtained by the signal trend encoding step.

[0156] Specifically, in the signal trend decoding step:

[0157] The signal trend features f t obtained by the signal trend encoding step and the global signal features obtained by the multi-scale attention step are input, merged and then reconstructed into a global electrocardiogram signal using a deep convolutional neural network, and the mask occluded area is recovered to obtain a trend-based recovered signal

[0158]

[0159] wherein the signal decoding recovery network D t is composed of several layers of deconvolution operations, and concat(·) represents the operation of splicing two tensors. Wherein, if the input is a model training signal, the output is a recovered training signal, and if the input is a signal to be tested, the output is a recovered test signal.

[0160] Abnormality assessment step: according to the multi-scale signal decoding step and the signal trend decoding step, using an abnormality assessment function to realize electrocardiogram abnormality assessment.

[0161] Specifically, in the abnormality assessment step:

[0162] For the model training electrocardiogram signal, the recovered training signal and the uncertainty obtained by the multi-scale signal decoding step and the recovered trend signal obtained by the signal trend decoding step are compared with the model training signal, so as to calculate the following loss functions respectively.

[0163] Global electrocardiogram signal recovery loss function

[0164]

[0165] local heartbeat signal recovery loss function

[0166]

[0167] trend-based global recovery loss function

[0168]

[0169] wherein k represents different signal points in the time dimension, D represents the time length of the global electrocardiogram, and d represents the time length of the local heartbeat. The sum of the three loss functions serves as the final loss function for training.

[0170] For the electrocardiogram signal to be tested, the recovered test signal and the uncertainty obtained by the multi-scale signal decoding step are compared with the recovered trend signal obtained by the signal trend decoding step and the model test signal, so as to calculate the following anomaly evaluation function

[0171]

[0172] wherein m represents different heartbeats obtained by the heartbeat segmentation step. If the summation operation on different signal points in the time dimension is removed, the anomaly positioning result of the electrocardiogram signal to be tested can be obtained. The greater the anomaly evaluation function value is, the more likely it is an abnormal signal.

[0173] Embodiment 2:

[0174] The application also provides an electrocardiogram anomaly detection system based on multi-scale signal recovery, which can be realized by executing the process steps of the electrocardiogram anomaly detection method based on multi-scale signal recovery, that is, the electrocardiogram anomaly detection method based on multi-scale signal recovery can be understood by those skilled in the art as the preferred embodiment of the electrocardiogram anomaly detection system based on multi-scale signal recovery.

[0175] As Figure 2 According to the electrocardiogram anomaly detection system based on multi-scale signal recovery provided by the application, the electrocardiogram anomaly detection system based on multi-scale signal recovery comprises:

[0176] The signal denoising module is used for filtering and removing signal noise of the original electrocardiogram signal to obtain a global signal.

[0177] Specifically, in the signal denoising module,

[0178] The noisy electrocardiogram original signal is input, a Butterworth filter and a notch filter are used to remove the high-frequency noise of the electrocardiogram original signal and eliminate the baseline drift of the electrocardiogram original signal, and the global signal after denoising is denoted as x g .

[0179] The heartbeat segmentation module: using R-peak detection and adaptive dynamic threshold, the global signal obtained by the signal denoising module is obtained as a local signal;

[0180] Specifically, in the heartbeat segmentation module:

[0181] The global electrocardiogram signal x g obtained by the signal denoising module is used to adaptively calculate a dynamic threshold for detecting R-peak in the global electrocardiogram signal by using a sliding window to minimize the standard deviation between consecutive differences. Based on the detected R-peak position, the global electrocardiogram signal is segmented to obtain a local single heartbeat signal, which is denoted as x l .

[0182] The multi-scale signal coding module: using a deep convolutional neural network, the global signal obtained by the signal denoising module and the local signal obtained by the heartbeat segmentation module are implemented to realize multi-scale signal coding, and multi-scale signal features are obtained;

[0183] Specifically, in the multi-scale signal coding module:

[0184] The multi-scale electrocardiogram signals x g and x l obtained by the signal denoising module and the heartbeat segmentation module are input, and random masks M g and M l are added to train the network to recover the signal according to the features of the adjacent unmasked areas. The purpose of adding the mask is to reduce the influence of individual differences on anomaly detection. Among them, a plurality of different areas of the global electrocardiogram signal are randomly masked to process global rhythm recovery, and a single continuous area of the local heartbeat signal is randomly masked to process detail recovery. A deep convolutional neural network is used to extract high-dimensional feature information of the multi-scale signal after adding the random mask:

[0185]

[0186]

[0187] wherein, and are the feature information of the global and local masked signals obtained by the coding module, and represents the corresponding element multiplication operation, and the signal feature extraction network E g and E l is composed of a plurality of convolutional operations.

[0188] Multi-scale self-attention module: using self-attention mechanism and residual-based method to obtain global features and local features from the multi-scale signal features obtained by the multi-scale signal encoding module;

[0189] Specifically, in the multi-scale self-attention module:

[0190] The multi-scale ECG features obtained by the multi-scale signal encoding module And As input, the ECG features of different scales are merged, and the merged feature information is processed by using the self-attention mechanism to obtain the fusion feature information f ca The self-attention mechanism is used to capture the correlation between global features and local features, and dynamically assign weights to different elements in the fusion features, which can be represented as:

[0191]

[0192]

[0193] Where Q, K, and V are three input items of the self-attention mechanism, Attention(·) is the self-attention mechanism function, and (·) T is the matrix transpose operation, and softmax(·) is the normalization exponential function, sqrt(·) represents the square root of the feature dimension used as a scaling factor, and concat(·) represents the operation of splicing two tensors.

[0194] The fusion feature information f ca is obtained, and then the fusion feature information is re-separated by two different fully connected networks to obtain new multi-scale ECG features, and the input multi-scale ECG features are connected by residual connection, which can be represented as:

[0195]

[0196]

[0197] Where φ g (·), φ l (·) are two multi-layer perceptron network structures containing two fully connected layers. Finally, the cross-fused multi-scale ECG features are obtained, and the global features are denoted as and the local features are denoted as

[0198] Signal trend generation module: using time scale smoothing and difference to obtain a smooth signal trend from the global signal obtained by the signal denoising module;

[0199] Specifically, in the signal trend generation module:

[0200] The global electrocardio signal x obtained by the signal denoising module g , the signal trend obtained by the signal trend generation module is denoted as x t .

[0201] The signal trend encoding module: the smoothed signal trend obtained by the signal trend generation module is encoded using a deep convolutional neural network to obtain signal trend features;

[0202] Specifically, in the signal trend encoding module:

[0203] The signal trend x obtained by the signal trend generation module t is encoded using a deep convolutional neural network to extract high-dimensional feature information f t of the signal trend, i.e. t f t = E t (x t ), wherein the signal feature extraction network E g is composed of several layers of convolution operations.

[0204] The multi-scale signal decoding module: the global features and local features obtained by the multi-scale self-attention module are decoded using a deep convolutional neural network;

[0205] Specifically, in the multi-scale signal decoding module:

[0206] The multi-scale electrocardio features obtained by the multi-scale self-attention module are inputted into the multi-scale signal decoding module, and during the decoding process, a deep convolutional neural network is used to generate recovered signals and uncertainty for the multi-scale signals respectively. g ,σ l :

[0207]

[0208]

[0209] wherein the global and local signal decoding recovery networks D g ,D lIt consists of several layers of deconvolution operations. Uncertainty is a tensor with the same scale as the recovered signal in the time dimension, used to measure the difficulty of recovering different signal points in the time dimension, avoiding misclassification of normal signals that are difficult to recover as abnormal signals. Specifically, if the input is training signal features, the output is the recovered training signal and uncertainty; if the input is the signal features to be tested, the output is the recovered test signal and uncertainty.

[0210] Signal trend decoding module: The signal trend is decoded using a deep convolutional neural network on the global features obtained by the multi-scale self-attention module and the signal trend features obtained by the signal trend encoding module.

[0211] Specifically, in the signal trend decoding module:

[0212] The signal trend feature f is obtained using the signal trend encoding module. t Global signal features obtained from multi-scale attention modules Using the input as the basis, the signals are merged and then reconstructed using a deep convolutional neural network. The masked regions are then recovered to obtain a trend-based recovered signal.

[0213]

[0214] Among them, the signal decoding and recovery network D t It consists of several layers of deconvolution operations, and concat(·) represents the operation of concatenating two tensors. Specifically, if the input is the model training signal, the output is the recovered training signal; if the input is the test signal, the output is the recovered test signal.

[0215] Anomaly assessment module: Based on the multi-scale signal decoding module and the signal trend decoding module, the anomaly assessment function is used to assess electrocardiogram anomalies.

[0216] Specifically, in the anomaly assessment module:

[0217] For the ECG signal used in model training, the recovered training signal and uncertainty obtained by the multi-scale signal decoding module and the recovered trend signal obtained by the signal trend decoding module are compared with the model training signal to calculate the following loss functions respectively.

[0218] Global ECG signal recovery loss function

[0219]

[0220] Local heartbeat signal recovery loss function

[0221]

[0222] Trend-based global recovery loss function

[0223]

[0224] where k represents different signal points in time dimension, D represents the time length of global ECG, and d represents the time length of local heartbeat. The sum of the three loss functions is used as the final loss function for training.

[0225] For the ECG signal to be tested, the recovered test signal and uncertainty obtained by the multi-scale signal decoding module and the recovered trend signal obtained by the signal trend decoding module are compared with the model test signal, so as to calculate the following anomaly evaluation function

[0226]

[0227] where m represents different heartbeats obtained by the heartbeat segmentation module. If the summation operation on different signal points in the time dimension is removed, the anomaly positioning result of the ECG signal to be tested can be obtained. The greater the anomaly evaluation function value is, the more likely it is an abnormal signal.

[0228] Those skilled in the art know that, in addition to implementing the system, device and each module thereof provided by the present application in the form of pure computer readable program code, the same program can also be realized by logically programming the method steps in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers and embedded microcontrollers. Therefore, the system, device and each module thereof provided by the present application can be considered as a hardware component, and the modules included therein for implementing various programs can also be considered as structures within the hardware component. The modules for implementing various functions can also be considered as both software programs for implementing methods and structures within hardware components.

[0229] The specific embodiments of the present application are described above. It should be understood that the present application is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essential content of the present application. The embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily without conflict.

Claims

1. A method for detecting electrocardiogram abnormalities based on multi-scale signal recovery, characterized in that, include: Signal denoising steps: Filter the raw ECG signal to eliminate signal noise and obtain the global signal; Heartbeat segmentation steps: Use R-peak detection and adaptive dynamic thresholding on the global signal to obtain the local signal; Multi-scale signal encoding steps: Use a deep convolutional neural network to encode the global and local signals at multiple scales to obtain multi-scale encoded features; Multi-scale self-attention step: Encode features at multiple scales, and use a self-attention mechanism and a residual-based method to obtain global and local features; Signal trend generation steps: Apply time-scale smoothing and subtraction to the global signal to obtain a smoothed signal trend; Signal trend encoding steps: Use a deep convolutional neural network to encode the smooth signal trend to obtain signal trend features; Multi-scale signal decoding steps: Use a deep convolutional neural network to decode global and local features; Signal trend decoding steps: Decode the signal trend using a deep convolutional neural network for both global features and signal trend features; Anomaly assessment steps: Decode multi-scale signals and signal trends, and use anomaly assessment functions to assess ECG anomalies; In the signal denoising step: Using a noisy raw electrocardiogram (ECG) signal as input, a Butterworth filter and a notch filter are used to remove high-frequency noise and eliminate baseline drift. The denoised global signal is denoted as... ; In the heartbeat segmentation step: For global signals Using a sliding window to adaptively calculate a dynamic threshold with the goal of minimizing the standard deviation between consecutive differences, an R-peak is detected in the global signal. Based on the detected R-peak position, the global signal is segmented to obtain a local single-beat signal, which is denoted as... ; In the multi-scale signal coding step: With global signals and local signals Use it as input and add a randomly generated mask. and The network is trained to recover signals based on features of neighboring uncovered regions. This involves randomly covering multiple different regions of the global signal to handle global rhythm recovery, and randomly covering a single continuous region of the local signal to handle detail recovery. A deep convolutional neural network is used to extract high-dimensional feature information from the multi-scale signal after adding random masks, expressed as: in, and Feature information obtained by encoding global and local masking signals; This represents element-wise multiplication; signal feature extraction network. and It consists of several layers of convolutional operations; In the multi-scale self-attention step: With feature information and As input, ECG features at different scales are merged, and the merged feature information is processed using a self-attention mechanism to obtain fused feature information. The self-attention mechanism is used to capture the correlation between global and local features, dynamically assigning weights to different elements in the fused features, as follows: in, These are the inputs for three self-attention mechanisms; For self-attention mechanism functions; This is a matrix transpose operation; It is a normalized exponential function; The square root of the feature dimension is used as a scaling factor; This represents the operation of concatenating two tensors; Obtain fused feature information Then, the fused feature information is separated again through two different fully connected networks to obtain new multi-scale ECG features, which are then residually connected with the input multi-scale ECG features. This process is represented as follows: in, This involves two multilayer perceptron network structures, each containing two fully connected layers; ultimately, cross-fused multi-scale ECG features are obtained, with the global features denoted as... Local features are denoted as ; In the signal trend generation step: For global signals The signal is smoothed using a moving average window over time. Then, adjacent signal points in the smoothed signal are subtracted and normalized to obtain the global ECG signal trend. This signal trend is denoted as... ; In the signal trend encoding step: Signal trends Using deep convolutional neural networks to extract high-dimensional feature information of signal trends ,Right now Among them, the signal feature extraction network It consists of several layers of convolutional operations; In the multi-scale signal decoding step: With global features and local features As input, during the decoding process, a deep convolutional neural network is used to simultaneously generate reconstructed signals for the multi-scale signals. and uncertainty : Among them, global and local signal decoding and recovery networks It consists of several layers of deconvolution operations; uncertainty is a tensor with the same scale as the recovered signal in the time dimension, used to measure the difficulty of recovering different signal points in the time dimension, avoiding misclassification of normal signals that are difficult to recover as abnormal signals; if the input is the features of the training signal, the output is the recovered training signal and uncertainty; if the input is the features of the signal to be tested, the output is the recovered test signal and uncertainty. In the signal trend decoding step: High-dimensional feature information of signal trends and global features Using the input as the basis, the signals are merged and then reconstructed using a deep convolutional neural network. The masked regions are then recovered to obtain a trend-based recovered signal. The expression is: Among them, signal decoding and recovery network It consists of several layers of deconvolution operations; This indicates an operation that concatenates two tensors; if the input is the model training signal, the output is the recovered training signal; if the input is the test signal, the output is the recovered test signal.

2. The electrocardiogram abnormality detection method based on multi-scale signal recovery according to claim 1, characterized in that, In the anomaly assessment step: For the ECG signal used in model training, the recovered training signal, uncertainty, and recovery trend signal are compared with the model training signal to calculate the following loss functions: Global ECG signal recovery loss function : Local heartbeat signal recovery loss function : Trend-based global recovery loss function : in, Representing different signal points in the time dimension, Indicates the duration of the global electrocardiogram. The duration of a local heartbeat is represented by the sum of the three loss functions, which serve as the final loss function for training. For the ECG signal to be tested, the recovered test signal, uncertainty, and recovery trend signal are compared with the model test signal to calculate the following anomaly assessment function. : in, Representing different heartbeats, by removing the summation operation of different signal points in the time dimension, we obtain the abnormal location result of the ECG signal to be tested. The larger the abnormality assessment function value, the greater the probability that it is an abnormal signal.

3. An electrocardiogram (ECG) abnormality detection system based on multi-scale signal recovery, characterized in that, include: Signal denoising module: Uses filtering to eliminate signal noise from the raw ECG signal to obtain the global signal; Heartbeat segmentation module: Uses R-peak detection and adaptive dynamic thresholding on the global signal to obtain the local signal; Multi-scale signal encoding module: Uses deep convolutional neural networks to encode global and local signals at multiple scales to obtain multi-scale encoded features; Multi-scale self-attention module: Encodes features at multiple scales, using a self-attention mechanism and a residual-based method to obtain global and local features; Signal trend generation module: Smooths and subtracts the global signal using a time scale to obtain a smoothed signal trend; Signal trend encoding module: Uses a deep convolutional neural network to encode the smooth signal trend and obtain the signal trend features; Multi-scale signal decoding module: Uses deep convolutional neural networks to decode global and local features at multiple scales. Signal trend decoding module: Uses a deep convolutional neural network to decode signal trends based on global features and signal trend features; Anomaly assessment module: Decodes multi-scale signals and signal trends, and uses anomaly assessment functions to assess ECG anomalies; In the signal denoising module: Using a noisy raw electrocardiogram (ECG) signal as input, a Butterworth filter and a notch filter are used to remove high-frequency noise and eliminate baseline drift. The denoised global signal is denoted as... ; In the heartbeat segmentation module: For global signals Using a sliding window to adaptively calculate a dynamic threshold with the goal of minimizing the standard deviation between consecutive differences, an R-peak is detected in the global signal. Based on the detected R-peak position, the global signal is segmented to obtain a local single-beat signal, which is denoted as... ; In the multi-scale signal encoding module: With global signals and local signals Use it as input and add a randomly generated mask. and The network is trained to recover signals based on features of neighboring uncovered regions. This involves randomly covering multiple different regions of the global signal to handle global rhythm recovery, and randomly covering a single continuous region of the local signal to handle detail recovery. A deep convolutional neural network is used to extract high-dimensional feature information from the multi-scale signal after adding random masks, expressed as: in, and Feature information obtained by encoding global and local masking signals; This represents element-wise multiplication; signal feature extraction network. and It consists of several layers of convolutional operations; In the multi-scale self-attention module: With feature information and As input, ECG features at different scales are merged, and the merged feature information is processed using a self-attention mechanism to obtain fused feature information. The self-attention mechanism is used to capture the correlation between global and local features, dynamically assigning weights to different elements in the fused features, as follows: in, These are the inputs for three self-attention mechanisms; For self-attention mechanism functions; This is a matrix transpose operation; It is a normalized exponential function; The square root of the feature dimension is used as a scaling factor; This represents the operation of concatenating two tensors; Obtain fused feature information Then, the fused feature information is separated again through two different fully connected networks to obtain new multi-scale ECG features, which are then residually connected with the input multi-scale ECG features. This process is represented as follows: in, This involves two multilayer perceptron network structures, each containing two fully connected layers; ultimately, cross-fused multi-scale ECG features are obtained, with the global features denoted as... Local features are denoted as ; In the signal trend generation module: For global signals The signal is smoothed using a moving average window over time. Then, adjacent signal points in the smoothed signal are subtracted and normalized to obtain the global ECG signal trend. This signal trend is denoted as... ; In the signal trend encoding module: Signal trends Using deep convolutional neural networks to extract high-dimensional feature information of signal trends ,Right now Among them, the signal feature extraction network It consists of several layers of convolutional operations; In the multi-scale signal decoding module: With global features and local features As input, during the decoding process, a deep convolutional neural network is used to simultaneously generate reconstructed signals for the multi-scale signals. and uncertainty : Among them, global and local signal decoding and recovery networks It consists of several layers of deconvolution operations; uncertainty is a tensor with the same scale as the recovered signal in the time dimension, used to measure the difficulty of recovering different signal points in the time dimension, avoiding misclassification of normal signals that are difficult to recover as abnormal signals; if the input is the features of the training signal, the output is the recovered training signal and uncertainty; if the input is the features of the signal to be tested, the output is the recovered test signal and uncertainty. In the signal trend decoding module: High-dimensional feature information of signal trends and global features Using the input as the basis, the signals are merged and then reconstructed using a deep convolutional neural network. The masked regions are then recovered to obtain a trend-based recovered signal. The expression is: Among them, signal decoding and recovery network It consists of several layers of deconvolution operations; This indicates an operation that concatenates two tensors; if the input is the model training signal, the output is the recovered training signal; if the input is the test signal, the output is the recovered test signal.

4. The electrocardiogram abnormality detection system based on multi-scale signal recovery according to claim 3, characterized in that, In the anomaly assessment module: For the ECG signal used in model training, the recovered training signal, uncertainty, and recovery trend signal are compared with the model training signal to calculate the following loss functions: Global ECG signal recovery loss function : Local heartbeat signal recovery loss function : Trend-based global recovery loss function : in, Representing different signal points in the time dimension, Indicates the duration of the global electrocardiogram. The duration of a local heartbeat is represented by the sum of the three loss functions, which serve as the final loss function for training. For the ECG signal to be tested, the recovered test signal, uncertainty, and recovery trend signal are compared with the model test signal to calculate the following anomaly assessment function. : in, Representing different heartbeats, by removing the summation operation of different signal points in the time dimension, we obtain the abnormal location result of the ECG signal to be tested. The larger the abnormality assessment function value, the greater the probability that it is an abnormal signal.

Citation Information

Patent Citations

  • Method For The Detecting Electrocardiogram Anomalies And Corresponding System

    CN107440679A

  • Emotion monitoring technology for intelligent old-age care

    CN113796862A

  • Arrhythmia classification method based on continuous test time adaptation

    CN115982624A