Method and System for Identifying Electrocardiogram Abnormal Events
Through the ECG representation learning model and window division strategy, combined with self-supervised and supervised loss function training, the problem of insufficient accuracy of the existing ECG analysis software is solved, and the efficient identification of ECG abnormal events is achieved, and the accuracy and efficiency of ECG interpretation and cardiovascular disease diagnosis is improved.
Patent Information
- Application Number
- CN202411015793.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2044-07-26
AI Technical Summary
The existing electrocardiogram analysis software is insufficient in identifying electrocardiogram abnormal events, which makes it difficult for doctors to review and correct results, which is difficult to meet clinical needs.
The ECG representation learning model, the heart beat recognition model and the ECG event recognition model are used to train through weighted summation of the self-supervised loss function and the supervised loss function, combined with the full convolutional structure and data augmentation technology, the ECG signal is unified into a general representation tensor, and the ECG event recognition is used using a window-based strategy based on the heart beat.
It improves the accuracy and calculation efficiency of ECG abnormal events recognition, can be compatible with multiple lead settings and ECG data in a wide range, reduces the workload of doctors, and improves the accuracy and efficiency of ECG interpretation and cardiovascular disease diagnosis.
Smart Images

Figure CN118845035B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular, to a method and system for identifying electrocardiogram (ECG) abnormal events. Background Art
[0002] Cardiovascular diseases are one of the main diseases threatening human life and health, and their incidence and mortality rates have been remaining high. How to strengthen the prevention and treatment of cardiovascular diseases has become a worldwide problem. Electrocardiogram can represent the myocardial potential changes generated during the periodic contraction and relaxation of the heart, and contains a large amount of information related to physiological diseases. It is an important diagnostic tool for cardiovascular diseases. Clinically, doctors usually rely on electrocardiogram automatic analysis software to interpret electrocardiograms. However, the existing software has insufficient accuracy and is difficult to meet the clinical use requirements. Doctors still need to spend a lot of time reviewing and correcting the results to form the final electrocardiogram interpretation report. If the accuracy of the electrocardiogram analysis method for identifying electrocardiogram abnormal events can be improved, it will greatly reduce the workload of doctors, help improve the efficiency of electrocardiogram interpretation, and further improve the accuracy and efficiency of cardiovascular disease diagnosis based on electrocardiograms. Summary of the Invention
[0003] To solve the above technical problems, the present disclosure provides a method and system for identifying electrocardiogram abnormal events.
[0004] In a first aspect of the embodiments of the present disclosure, a method for identifying electrocardiogram abnormal events is provided. The method includes:
[0005] Obtaining an electrocardiogram signal of a target object;
[0006] Sampling the electrocardiogram signal of the target object to a preset frequency, and filling it to a preset duration and a preset number of leads to obtain a to-be-evaluated electrocardiogram signal;
[0007] Based on the to-be-evaluated electrocardiogram signal, using an electrocardiogram representation learning model to determine an electrocardiogram representation tensor, wherein the electrocardiogram representation learning model is trained based on a target function using historical electrocardiogram signals and historical electrocardiogram signals after data augmentation, and the target function is a weighted sum of a self-supervised loss function and a supervised loss function;
[0008] Based on the electrocardiogram representation tensor, using a heart beat recognition model to determine a heart beat prediction result;
[0009] Based on the heart beat prediction result, windowing the electrocardiogram representation tensor to obtain heart beat windows of the same length centered on each heart beat, and all the heart beat windows form an electrocardiogram representation sequence;
[0010] Based on the electrocardiogram (ECG) representation sequence, an ECG event recognition model is used to determine the ECG event prediction results for each heartbeat window, and the start and end points of the occurrence of the ECG event are obtained based on the ECG event prediction results for each heartbeat window.
[0011] Optionally, the ECG representation learning model includes a plurality of parallel dilated convolution modules. Each dilated convolution module is composed of a series connection of a plurality of basic dilated convolution modules. Each basic dilated convolution module includes a one-dimensional dilated convolution, and the gaps of the one-dimensional dilated convolutions included in each basic dilated convolution module are different. Among them, the step of determining the ECG representation tensor by using the ECG representation learning model based on the ECG signal to be evaluated includes: inputting the ECG signal to be evaluated into the first, second,... Kth dilated convolution modules respectively, and outputting the first, second,... Kth feature tensors;
[0012] The first, second,... Kth feature tensors are concatenated together along the channel dimension to obtain the ECG representation tensor, where K is the number of dilated convolution modules.
[0013] Optionally, the heartbeat recognition model is a multi-layer perceptron, including a multi-layer linear fully connected neural network. For the multi-layer linear fully connected neural network, the number of neurons in each layer of the network is set to 2 n ,2 n-1 ,…2 n-m where m < n. The step of determining the heartbeat prediction result by using the heartbeat recognition model based on the ECG representation tensor includes:
[0014] Inputting the ECG representation tensor into the first linear fully connected neural network to output the first heartbeat recognition vector;
[0015] Inputting the first heartbeat recognition vector into the second linear fully connected neural network to output the second heartbeat recognition vector;
[0016] Until the (Q - 1)th heartbeat recognition vector is input into the Qth linear fully connected neural network to output the heartbeat prediction result, where Q = m + 1.
[0017] Optionally, the electrocardiogram event recognition model includes an encoder and a classifier. Based on the electrocardiogram representation sequence, using the electrocardiogram event recognition model to determine the electrocardiogram event prediction result of each heartbeat window, and obtaining the start and end points of the electrocardiogram event occurrence based on the electrocardiogram event prediction result of each heartbeat window, including: inputting the electrocardiogram representation sequence into the encoder to obtain an electrocardiogram event prediction intermediate vector, inputting the electrocardiogram event prediction intermediate vector into the classifier to obtain an electrocardiogram event prediction result, the electrocardiogram event prediction result includes the electrocardiogram event prediction result of each heartbeat window, comparing the electrocardiogram event prediction result of each heartbeat window with a preset threshold, obtaining the heartbeat window where the electrocardiogram event prediction result is higher than the preset threshold for the first time, and setting it as the start point of the electrocardiogram event; obtaining the heartbeat window where the electrocardiogram event prediction result is lower than the preset threshold, and setting it as the end point of the electrocardiogram event, so as to obtain the start and end points of the electrocardiogram event occurrence on the heartbeat scale.
[0018] Optionally, before obtaining the electrocardiogram signal to be evaluated, the method further includes:
[0019] Obtaining a historical electrocardiogram signal;
[0020] Sampling the historical electrocardiogram signal to a preset frequency, and filling it to a preset duration and a preset number of leads to obtain a processed historical electrocardiogram signal;
[0021] Performing data augmentation on the processed historical electrocardiogram signal to obtain the historical electrocardiogram signal after data augmentation;
[0022] Inputting the processed historical electrocardiogram signal into a preset electrocardiogram representation learning model framework, and outputting a first electrocardiogram representation tensor corresponding to the processed historical electrocardiogram signal;
[0023] Inputting the historical electrocardiogram signal after data augmentation into a preset electrocardiogram representation learning model framework, and outputting a second electrocardiogram representation tensor corresponding to the historical electrocardiogram signal after data augmentation;
[0024] Inputting the first electrocardiogram representation tensor into a preset self-supervised model framework, and outputting a first self-supervised result vector;
[0025] Inputting the second electrocardiogram representation tensor into a preset self-supervised model framework, and outputting a second self-supervised result vector;
[0026] Calculating a self-supervised loss function based on the first and second self-supervised result vectors;
[0027] Obtaining a first electrocardiogram abnormal event label and a heartbeat label corresponding to the processed historical electrocardiogram signal;
[0028] Input the first electrocardiogram (ECG) representation tensor into a preset supervised task model framework to output a first supervised result vector, and calculate a first supervised loss function based on the first supervised result vector and the first ECG abnormality event label;
[0029] Input the first ECG representation tensor into a preset heartbeat recognition model framework to output a second supervised result vector, and calculate a second supervised loss function based on the second supervised result vector and the heartbeat label;
[0030] Calculate an ECG representation learning loss function based on the self-supervised loss function, the first supervised loss function, and the second supervised loss function:
[0031] L = w1L self-supervised + w2L supervised-1 + w3L supervised-2 ,
[0032] where w1, w2, and w3 are the first, second, and third weights, L self-supervised is the self-supervised loss function, L supervised-1 is the first supervised loss function, L supervised-2 is the second supervised loss function;
[0033] Optimize the ECG representation learning model, the heartbeat recognition model, the supervised task model, and the self-supervised task model based on the ECG representation learning loss function to obtain the trained ECG representation learning model and the heartbeat recognition model.
[0034] Optionally, the self-supervised loss function is calculated based on the first and second self-supervised result vectors in the following way:
[0035]
[0036] where: and are intermediate functions defined as follows:
[0037] ;
[0038] where N is the amount of original ECG data, z i is the first self-supervised result vector corresponding to the i-th historical ECG signal in the first self-supervised result vector, is the second self-supervised result vector corresponding to the i-th historical ECG signal after data augmentation in the second self-supervised result vector, z k is the first self-supervised result vector corresponding to the k-th historical ECG signal in the first self-supervised result vector, Here, it is the second self-supervised result vector corresponding to the k-th historical electrocardiogram signal after data augmentation, exp is the exponential function, sim represents the calculation of the cosine similarity of vectors, and τ is the temperature variable. It is an indicator function, with a function value of 1 when the condition is true and 0 otherwise.
[0039] Optionally, the first supervised loss function is calculated based on the first supervised result vector and the first electrocardiogram abnormality event label in the following way:
[0040]
[0041] where J represents the first electrocardiogram abnormality event label vector and the first supervised result vector The length of, j represents the first electrocardiogram abnormality event label vector and the first supervised result vector Element index of Indicates the j-th component in the first electrocardiogram abnormality event label vector Indicates the th component in the first supervised result vector.
[0042] Optionally, the second supervised loss function is calculated based on the second supervised result vector and the heartbeat label in the following way:
[0043]
[0044] where J' represents the heartbeat label vector and the second supervised result vector The length of, and J' = J, j' represents the heartbeat label vector and the second supervised result vector Element index of Indicates the In the heartbeat label vector, the j'-th component Indicates the j'-th component in the second supervised result vector.
[0045] Optionally, the method further includes:
[0046] Obtain the second electrocardiogram abnormality event label, input the electrocardiogram representation sequence into the electrocardiogram event recognition model framework, output the electrocardiogram event recognition prediction vector, and calculate the electrocardiogram event recognition loss function based on the electrocardiogram event recognition prediction vector and the second electrocardiogram abnormality event label. The loss function is as follows:
[0047] ;
[0048] Wherein, M represents the amount of electrocardiogram data, and P represents the second electrocardiogram abnormal event label vector and the length of the electrocardiogram event recognition and prediction vector p represents the element index of the second electrocardiogram abnormal event label vector and the electrocardiogram event recognition and prediction vector ; represents the p-th component of the second electrocardiogram abnormal event label vector ; represents the p-th component of the electrocardiogram event recognition and prediction vector ;
[0049] The second aspect of the embodiments of the present disclosure provides an electrocardiogram abnormal event recognition system, including:
[0050] An electrocardiogram acquisition module, configured to acquire the electrocardiogram signal of a target object;
[0051] A preprocessing module, configured to sample the electrocardiogram signal of the target object to a preset frequency, and fill it to a preset duration and a preset number of leads to obtain an electrocardiogram signal to be evaluated;
[0052] An electrocardiogram representation module, configured to determine an electrocardiogram representation tensor based on the electrocardiogram signal to be evaluated by using an electrocardiogram representation learning model, wherein the electrocardiogram representation learning model is trained based on a target function by using historical electrocardiogram signals and historical electrocardiogram signals after data augmentation, and the target function is a weighted sum of a self-supervised loss function and a supervised loss function;
[0053] A heartbeat recognition module, configured to determine a heartbeat prediction result based on the electrocardiogram representation tensor by using a heartbeat recognition model;
[0054] A windowing module, configured to window the electrocardiogram representation tensor based on the heartbeat prediction result to obtain heartbeat windows of the same length centered on each heartbeat, and all the heartbeat windows form an electrocardiogram representation sequence;
[0055] An electrocardiogram event recognition module, configured to determine an electrocardiogram event prediction result for each heartbeat window based on the electrocardiogram representation sequence, and obtain the start and end points of the occurrence of the electrocardiogram event on the heartbeat scale.
[0056] The third aspect of the embodiments of the present disclosure provides a non-volatile storage medium, which stores multiple instructions, and the instructions are suitable for being loaded and executed by a processor to execute the electrocardiogram abnormal event recognition method according to any one of claims 1-9.
[0057] A fourth aspect of the embodiments of the present disclosure provides an electronic device, including one or more processors and a memory for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the electrocardiogram (ECG) abnormality event recognition method described in any one of the above.
[0058] The technical solutions provided by the embodiments of the present disclosure have the following advantages compared with the prior art:
[0059] The ECG abnormality event recognition method and system provided by the embodiments of the present disclosure can fill the ECG signal of a target object into a preset frequency, duration, and lead, and based on a representation learning model with a fully convolutional structure, can convert ECG inputs with any duration and any lead setting into a unified general ECG representation tensor, compatible with multiple lead methods and unequal-length ECG data. This method and system use a windowing strategy based on heartbeats, combined with the general ECG representation tensor, to improve the accuracy and computational efficiency of detecting the start and end of ECG abnormality events at different lengths. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure and, together with the specification, are used to explain the principles of the present disclosure.
[0061] To more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0062] Figure 1 is a schematic diagram of an optional ECG abnormality event recognition method provided by the embodiments of the present disclosure;
[0063] Figure 2 is a schematic diagram of the operation of an optional ECG representation learning model provided by the embodiments of the present disclosure;
[0064] Figure 3 is a schematic diagram of the operation of an optional ECG event recognition model provided by the embodiments of the present disclosure;
[0065] Figure 4 is a schematic diagram of the training of an optional ECG representation learning model and a heartbeat recognition model provided by the embodiments of the present disclosure;
[0066] Figure 5 is a schematic diagram of an optional ECG abnormality event recognition system provided by the embodiments of the present disclosure;
[0067] Figure 6Schematic diagram of an optional electronic device provided by the present disclosure example; Detailed implementation manners
[0068] In order to more clearly understand the above objects, features and advantages of the present disclosure, the solutions of the present disclosure will be further described below. It should be noted that, without conflict, the embodiments of the present disclosure and the features in the embodiments may be combined with each other.
[0069] In the following description, many specific details are set forth in order to fully understand the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only a part of the embodiments of the present disclosure, rather than all of the embodiments.
[0070] It should be understood that the steps recorded in the method implementation manners of the present disclosure may be executed in different orders and / or executed in parallel. In addition, the method implementation manners may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this regard.
[0071] Cardiovascular diseases are one of the main diseases threatening human life and health, and their incidence and mortality rates have been remaining high. How to strengthen the prevention and treatment of cardiovascular diseases has become a worldwide problem. Electrocardiogram can represent the myocardial potential changes generated during the periodic contraction and relaxation of the heart, and contains a large amount of information related to physiological diseases. It is an important diagnostic tool for cardiovascular diseases. Clinically, doctors usually rely on electrocardiogram automatic analysis software to interpret electrocardiograms. However, the existing software has insufficient accuracy and is difficult to meet the clinical use requirements. Doctors still need to invest a lot of time in reviewing and correcting the results to form a final electrocardiogram interpretation report. If the recognition accuracy of electrocardiogram analysis methods for electrocardiogram abnormal events can be improved, the workload of doctors will be greatly reduced, which will help to improve the accuracy and efficiency of electrocardiogram interpretation and cardiovascular disease diagnosis based on electrocardiogram.
[0072] Currently, the electrocardiogram abnormal event recognition algorithm based on deep learning has a higher recognition accuracy than traditional methods. However, when training the model, it is necessary to preset the lead setting and signal length in advance, and it does not support multiple lead settings, resulting in limited application.
[0073] Figure 1 It is a flowchart of a method for recognizing electrocardiogram abnormal events, and the method includes:
[0074] Step S101, obtaining the electrocardiogram signal of the target object;
[0075] Optionally, the target object in the embodiments of the present disclosure is a patient who needs to be recognized for electrocardiogram abnormal events.
[0076] Optionally, the electrocardiogram (ECG) signal of the target object can be collected, but not limited to, through a data buffer, an ECG sensor, or other means.
[0077] Step S102: Sample the ECG signal of the target object to a preset frequency, and fill it to a preset duration and a preset number of leads to obtain the ECG signal to be evaluated.
[0078] Optionally, since the ECG signals of the target object obtained through different methods may have different lead settings, frequencies, and durations, it is necessary to unify their lead settings, frequencies, and durations for further processing. Specifically, collect the ECG signal of the target object, resample the collected ECG signal of the target object to a preset frequency, and fill the resampled ECG signal of the target object with blank data to a preset duration and a preset number of leads. For example, resample the ECG signal of the target object collected in step S101 to a preset frequency of 500 Hz, and fill it with blank data to a preset duration of 10 s and a preset number of leads of 18. For the lead data in the ECG data that exceeds the preset lead range, directly delete it; for the ECG data that is longer than the preset duration, the ECG data can be intercepted multiple times with the preset duration until the entire ECG data is intercepted. The preset frequency, preset duration, and preset number of leads are set according to needs, where the preset frequency is 250 - 1000 Hz, the preset duration is 10 - 30 s, and the preset number of leads is 1 - 18. In this embodiment, a preset frequency of 500 Hz, a preset duration of 10 s, and a preset number of leads of 18 are selected respectively.
[0079] By sampling to a preset frequency and filling it to a preset duration and a preset number of leads, the ECG signal of the target object can be unified into an ECG signal of the target object with the same frequency, duration, and number of leads. The ECG signal of the target object with the same frequency, duration, and number of leads is used as the ECG signal to be evaluated.
[0080] Step S103: Based on the ECG signal to be evaluated, use an ECG representation learning model to determine an ECG representation tensor. The ECG representation learning model is trained based on an objective function using historical ECG signals and historical ECG signals after data augmentation. The objective function is a weighted sum of a self-supervised loss function and a supervised loss function. Optionally, based on the ECG signal to be evaluated, use an ECG representation learning model to determine an ECG representation tensor, including inputting the ECG signal to be evaluated into the ECG representation learning model, and processing the ECG signal to be evaluated by the ECG representation learning model to obtain the ECG representation tensor. This step can convert the ECG signals with the same lead settings into similar ECG representation tensors for further heartbeat prediction.
[0081] The training process of the ECG representation learning model will be described in detail later and will not be elaborated here.
[0082] Step S104: Based on the electrocardiogram representation tensor, use a heartbeat recognition model to determine the heartbeat prediction result;
[0083] Optionally, based on the electrocardiogram representation tensor, using a heartbeat recognition model to determine the heartbeat prediction result includes inputting the electrocardiogram representation tensor into the heartbeat recognition model, and the heartbeat recognition model processes the electrocardiogram representation tensor to obtain the heartbeat prediction result. The heartbeat prediction result includes the positions of multiple heartbeats in the electrocardiogram representation tensor, which is used to characterize the positions of the heartbeats in the electrocardiogram signal to be evaluated.
[0084] Step S105: Based on the heartbeat prediction result, window the electrocardiogram representation tensor to obtain heartbeat windows of the same length centered on each heartbeat. All the heartbeat windows form an electrocardiogram representation sequence;
[0085] Optionally, based on the heartbeat prediction result, window the electrocardiogram representation tensor to obtain heartbeat windows of the same length centered on each heartbeat. All the heartbeat windows form an electrocardiogram representation sequence, specifically including: The heartbeat prediction result includes the positions of multiple heartbeats in the electrocardiogram representation tensor. Centered on each heartbeat, select J seconds before and after the heartbeat on the electrocardiogram representation tensor, with a total of 2J seconds as the heartbeat window, where J is set as needed and can be half of the duration of an average RR interval (heartbeat interval). All the heartbeat windows form an electrocardiogram representation sequence..
[0086] Step S106: Based on the electrocardiogram representation sequence, use an electrocardiogram event recognition model to determine the electrocardiogram event prediction result of each heartbeat window, and obtain the start and end points of the occurrence of the electrocardiogram event based on the electrocardiogram event prediction result of each heartbeat window.
[0087] Optionally, based on the electrocardiogram representation sequence, using an electrocardiogram event recognition model to determine the electrocardiogram event prediction result of each heartbeat window, and obtaining the start and end points of the occurrence of the electrocardiogram event based on the electrocardiogram event prediction result of each heartbeat window includes: Inputting the electrocardiogram representation sequence into the electrocardiogram event recognition model to determine the electrocardiogram event prediction result of each heartbeat window in the electrocardiogram representation sequence. When the electrocardiogram event prediction result is greater than a preset value, it is determined as the start point of the electrocardiogram event. When the electrocardiogram event prediction result is less than the preset value for the first time after the start point of the electrocardiogram event, it is determined as the end point of the electrocardiogram event.
[0088] In an alternative embodiment, as Figure 2 shown, the electrocardiogram representation learning model includes multiple parallel atrous convolution modules. Each atrous convolution module is composed of multiple atrous convolution basic modules connected in series (not shown in the figure). Each atrous convolution basic module includes a one-dimensional atrous convolution, and the gaps of the one-dimensional atrous convolutions included in each atrous convolution basic module are different. Among them, based on the electrocardiogram signal to be evaluated, using the electrocardiogram representation learning model to determine the electrocardiogram representation tensor includes:
[0089] The to-be-evaluated electrocardiogram (ECG) signals are respectively input into the first, second, …, and K dilated convolution modules, and first, second, …, and K feature tensors are output;
[0090] The first, second, …, and K feature tensors are concatenated together along the channel dimension to obtain an ECG representation tensor, where K is the number of dilated convolution modules.
[0091] Optionally, each dilated convolution module has the same operator size and number of channels. The operator size is 5 - 11; the number of channels is 16 - 64. The difference is that each dilated convolution module is composed of multiple basic dilated convolution modules connected in series. Each basic dilated convolution module includes a one-dimensional dilated convolution, and the gaps of the one-dimensional dilated convolutions included in each basic dilated convolution module are different. The gap of the dilated convolution is 1 - 64. For example, the first dilated convolution module includes 6 first basic dilated convolution modules. The first basic dilated convolution module includes a first one-dimensional dilated convolution, a BN layer, and a pooling layer, where the gaps of the first one-dimensional dilated convolution are 1, 1, 1, 1, 1, 1. The second dilated convolution module includes 6 second basic dilated convolution modules. The second basic dilated convolution module includes a second one-dimensional dilated convolution, and the gaps of the second one-dimensional dilated convolution are 2, 2, 4, 8, 8, 8. The third dilated convolution module includes 6 third basic dilated convolution modules. The third basic dilated convolution module includes a third one-dimensional dilated convolution, and the gaps of the third one-dimensional dilated convolution are 4, 4, 8, 16, 32, 64. The three dilated convolution modules are connected in parallel and respectively output first, second, and third tensors. Finally, the outputs of the three dilated convolution modules are concatenated together along the channel dimension to obtain the representation learning tensor output by the ECG representation learning network.
[0092] Through the ECG representation learning model, the to-be-evaluated ECG signals can be converted into ECG representation tensors. Since the ECG representation learning model is a fully convolutional structure, it can process to-be-evaluated ECG signals of any length and output ECG representation tensors of the corresponding length.
[0093] Optionally, the heartbeat recognition model is a multi-layer perceptron, including a multi-layer linear fully connected neural network. For the multi-layer linear fully connected neural network, the number of neurons in each layer of the network is respectively set to 2 n , 2 n-1 , … 2 n-m , where m < n. Based on the ECG representation tensor, using the heartbeat recognition model to determine the heartbeat prediction result includes:
[0094] Input the ECG representation tensor into the first linear fully connected neural network, and output a first heartbeat recognition vector;
[0095] Input the first heartbeat recognition vector into the second linear fully connected neural network, and output a second heartbeat recognition vector;
[0096] Until the (Q-1)th heartbeat recognition vector is input into the Qth linear fully-connected neural network to output a heartbeat prediction result, where Q = m + 1.
[0097] The electrocardiogram representation tensor sequentially passes through the first linear fully-connected neural network, the first linear fully-connected neural network to the Qth linear fully-connected neural network to obtain the Qth heartbeat recognition vector, and the Qth heartbeat recognition vector is used as the heartbeat prediction result.
[0098] Optionally, a heartbeat prediction result is obtained. The heartbeat prediction result includes the positions of multiple heartbeats in the electrocardiogram representation tensor, and is used to characterize the positions of the heartbeats in the electrocardiogram signal to be evaluated.
[0099] In an alternative embodiment, as Figure 3 shown, the electrocardiogram event recognition model includes an encoder and a classifier. Based on the electrocardiogram representation sequence, the electrocardiogram event recognition model is used to determine the electrocardiogram event prediction result of each heartbeat window. Based on the electrocardiogram event prediction results of each heartbeat window, the start and end points of the occurrence of the electrocardiogram event are obtained, including:
[0100] Step S201: Input the electrocardiogram representation sequence into the encoder to obtain an intermediate electrocardiogram event prediction vector;
[0101] Step S202: Input the intermediate electrocardiogram event prediction vector into the classifier to obtain an electrocardiogram event prediction result. The electrocardiogram prediction result includes the electrocardiogram event prediction results of each heartbeat window;
[0102] Step S203: Compare the electrocardiogram event prediction results of each heartbeat window with a preset threshold. Obtain the heartbeat window where the electrocardiogram event prediction result is higher than the preset threshold for the first time and set it as the start point of the electrocardiogram event; obtain the heartbeat window where the electrocardiogram event prediction result is lower than the preset threshold and set it as the end point of the electrocardiogram event, and obtain the start and end points of the occurrence of the electrocardiogram event on the heartbeat scale.
[0103] Optionally, the electrocardiogram event recognition model includes an encoder and a classifier. The encoder is a bidirectional LSTM model with a hidden layer size of 96 and 3 layers. The classifier is a Squeeze Excitation module and a one-dimensional convolutional module with an operator size of 1. Input the electrocardiogram representation sequence, that is, multiple heartbeat windows included in the electrocardiogram representation sequence, into the bidirectional LSTM model to obtain an electrocardiogram event prediction intermediate vector. Input the electrocardiogram event prediction intermediate vector into the Squeeze Excitation module and the one-dimensional convolutional module to obtain an electrocardiogram event prediction result. The electrocardiogram event prediction result is an electrocardiogram event probability value. The electrocardiogram event prediction result includes the electrocardiogram event prediction result of each heartbeat window. Compare the electrocardiogram event prediction result of each heartbeat window with a preset threshold, obtain the heartbeat window when the electrocardiogram event prediction result is higher than the preset threshold for the first time, and set it as the starting point of the electrocardiogram event; obtain the heartbeat window when the electrocardiogram event prediction result is lower than the preset threshold, and set it as the ending point of the electrocardiogram event, so as to obtain the starting and ending points of the electrocardiogram event occurrence on the heartbeat scale.
[0104] As Figure 4 shown, in an optional embodiment, before acquiring the electrocardiogram signal to be evaluated, the method further includes:
[0105] Acquire historical electrocardiogram signals;
[0106] Optionally, the historical electrocardiogram signals in the embodiments of the present disclosure can be understood as the pre-collected electrocardiogram data of historical patients used as model training samples.
[0107] Optionally, the historical electrocardiogram signals can be acquired, but not limited to, through a data buffer, an electrocardiogram sensor or other means.
[0108] Sample the historical electrocardiogram signals to a preset frequency, and fill them to a preset duration and a preset number of leads to obtain processed historical electrocardiogram signals;
[0109] The processing method is the same as that in the application process and will not be elaborated here.
[0110] Perform data augmentation on the processed historical electrocardiogram signals to obtain historical electrocardiogram signals after data augmentation;
[0111] The specific methods of data augmentation include: covering some leads of the original electrocardiogram data with 0; covering some time periods of the original electrocardiogram signal with 0; adding Gaussian noise to the original electrocardiogram data; translating the original electrocardiogram data along the time axis and performing truncation and zero padding.
[0112] Input the historical electrocardiogram signals into a preset electrocardiogram representation learning model framework, and output the first electrocardiogram representation tensor corresponding to the historical electrocardiogram signals;
[0113] The first electrocardiogram (ECG) representation tensor is used to characterize the features of the unprocessed historical ECG signals.
[0114] Input the historical ECG signals after data augmentation into a preset ECG representation learning model framework, and output the second ECG representation tensor corresponding to the historical ECG signals after data augmentation;
[0115] The second ECG representation tensor is used to characterize the features of the historical ECG signals after data augmentation.
[0116] Input the first ECG representation tensor into a preset self-supervised model framework, and output the first self-supervised result vector;
[0117] Input the second ECG representation tensor into a preset self-supervised model framework, and output the second self-supervised result vector;
[0118] Calculate the self-supervised loss function based on the first and second self-supervised result vectors;
[0119] The ECG representation learning model uses the historical ECG signal x i and the historical ECG signals after data augmentation for self-supervised training, which can narrow the distance between the ECG representation tensors of the historical ECG signal and the same historical ECG signal after data augmentation, and increase the distance between the ECG representation tensors of the historical ECG signal and other historical ECG signals after data augmentation, so that the ECG representation learning model can transform the projections of the same ECG data with different lead settings into similar ECG representation tensors, achieving the purpose of being compatible with multiple lead settings.
[0120] Obtain the first ECG abnormality event label and heartbeat label corresponding to the historical ECG signal;
[0121] The first ECG abnormality event label includes: the abnormal area of the ECG signal, represented by (0,1), where 0 represents the normal area and 1 represents the abnormal area; the heartbeat label specifically includes: the heartbeat position, represented by (0,1), where 1 represents the position of the R peak in the heartbeat and 0 represents other positions;
[0122] Input the first ECG representation tensor into a preset supervised task model framework, output the first supervised result vector, and calculate the first supervised loss function based on the first supervised result vector and the first ECG abnormality event label;
[0123] Input the first ECG representation tensor into a preset heartbeat recognition model framework, output the second supervised result vector, and calculate the second supervised loss function based on the second supervised result vector and the heartbeat label;
[0124] Calculate the ECG representation learning loss function based on the self-supervised loss function, the first supervised loss function, and the second supervised loss function:
[0125] L = w1L self-supervised + w2L supervised-1 + w3L supervised-2 ,
[0126] where w1, w2, and w3 are the first, second, and third weights, and L self-supervised is the self-supervised loss function, and L supervised-1 is the first supervised loss function, and L supervised-2 is the second supervised loss function;
[0127] Optimize the electrocardiogram (ECG) representation learning model, heartbeat recognition model, supervised task model, and self-supervised task model based on the ECG representation learning loss function to obtain the trained ECG representation learning model and heartbeat recognition model.
[0128] In this embodiment, the self-supervised training of the ECG representation learning model is performed, so that the ECG representation learning model can transform the projections of the same ECG data set with different lead settings into similar ECG representation tensors, achieving the purpose of being compatible with multiple lead settings; the supervised training of the ECG representation learning model is performed to guide the ECG representation learning model to learn the features useful for downstream tasks, so that the ECG representation learning model can effectively extract the information related to subsequent downstream tasks. At the same time, the heartbeat recognition model, supervised task model, and self-supervised task model are trained using the ECG representation learning loss function obtained based on the self-supervised loss function, the first supervised loss function, and the second supervised loss function, which simplifies the training process.
[0129] Optionally, the self-supervised loss function is calculated based on the first and second self-supervised result vectors, and the calculation is performed in the following manner:
[0130] ;
[0131] where 、 are intermediate functions, and are defined as follows:
[0132] ;
[0133] where N is the amount of original ECG data, and z i is the first self-supervised result vector corresponding to the i-th historical ECG signal in the first self-supervised result vector, is the second self-supervised result vector corresponding to the i-th historical ECG signal after data augmentation in the second self-supervised result vector, and z k is the first self-supervised result vector corresponding to the k-th historical ECG signal in the first self-supervised result vector, is the second self-supervised result vector corresponding to the k-th historical electrocardiogram signal after data augmentation, exp is the exponential function, sim represents the cosine similarity calculation of vectors, and τ is the temperature variable. is the indicator function, whose function value is 1 when the condition is true and 0 otherwise.
[0134] Optionally, the first supervised loss function is calculated based on the first supervised result vector and the first electrocardiogram abnormality event label in the following way:
[0135]
[0136] where J represents the first electrocardiogram abnormality event label vector and the first supervised result vector The length of, j represents the first electrocardiogram abnormality event label vector and the first supervised result vector The element index of, represents the j-th component in the first electrocardiogram abnormality event label vector, represents the first in the first supervised result vector component;
[0137] Optionally, the second supervised loss function is calculated based on the second supervised result vector and the heartbeat label in the following way:
[0138]
[0139] where J' represents the heartbeat label vector and the second supervised result vector The length of, and J’ = J, j' represents the heartbeat label vector and the second supervised result vector The element index of, represents the heartbeat label vector In, the j'-th component, represents the j'-th component in the second supervised result vector.
[0140] Optionally, the method further includes:
[0141] Obtain the second electrocardiogram abnormality event label, where the second electrocardiogram abnormality event label includes: the abnormal area of the electrocardiogram signal, represented by (0,1), 0 represents that the area is normal, and 1 represents that the area is abnormal; input the electrocardiogram representation sequence into the electrocardiogram event recognition model framework, output the electrocardiogram event recognition prediction vector, and calculate the electrocardiogram event recognition loss function based on the electrocardiogram event recognition prediction vector and the second electrocardiogram abnormality event label. The loss function is as follows:
[0142]
[0143] Among them, M represents the amount of electrocardiogram data, and P represents the second electrocardiogram abnormal event label vector and the electrocardiogram event recognition and prediction vector The length of, p represents the second electrocardiogram abnormal event label vector and the electrocardiogram event recognition and prediction vector The element index of represents the p-th component of the second electrocardiogram abnormal event label vector represents the p-th component of the electrocardiogram event recognition and prediction vector
[0144] The second aspect of the embodiments of the present disclosure provides an electrocardiogram abnormal event recognition system, as Figure 5 shown, including:
[0145] An electrocardiogram acquisition module for acquiring the electrocardiogram signal of the target object;
[0146] A preprocessing module for sampling the electrocardiogram signal of the target object to a preset frequency, and filling it to a preset duration and a preset number of leads to obtain an electrocardiogram signal to be evaluated;
[0147] An electrocardiogram representation module for determining an electrocardiogram representation tensor based on the electrocardiogram signal to be evaluated by using an electrocardiogram representation learning model, wherein the electrocardiogram representation learning model is trained based on a target function by using historical electrocardiogram signals and historical electrocardiogram signals after data augmentation, and the target function is a weighted sum of a self-supervised loss function and a supervised loss function; A heartbeat recognition module for determining a heartbeat prediction result based on the electrocardiogram representation tensor by using a heartbeat recognition model;
[0148] A windowing module for windowing the electrocardiogram representation tensor based on the heartbeat prediction result to obtain heartbeat windows of the same length centered on each heartbeat, and all the heartbeat windows form an electrocardiogram representation sequence;
[0149] An electrocardiogram event recognition module for determining an electrocardiogram event prediction result for each heartbeat window based on the electrocardiogram representation sequence by using an electrocardiogram event recognition model, and obtaining the start and end points of the occurrence of the electrocardiogram event on the heartbeat scale.
[0150] The beneficial effect of this system is that: through the filling strategy and the representation learning model with a fully convolutional structure, the electrocardiogram input with any lead setting and any duration is converted into a unified general electrocardiogram representation tensor; combined with the general electrocardiogram representation tensor, a windowing strategy based on heartbeats is used to improve the accuracy and computational efficiency of the start and end detection of electrocardiogram abnormal events on electrocardiogram signals of different lengths.
[0151] A third aspect of the embodiments of the present disclosure provides a non-volatile storage medium storing a plurality of instructions adapted to be loaded and executed by a processor to perform any one of the electrocardiogram abnormality event recognition methods.
[0152] A fourth aspect of the embodiments of the present disclosure provides an electronic device, as Figure 6 shown, comprising one or more processors and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any one of the electrocardiogram abnormality event recognition methods.
[0153] It should be noted that in this document, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.
[0154] The above are only specific embodiments of the present disclosure, enabling those skilled in the art to understand or implement the present disclosure. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for identifying electrocardiogram abnormal events, characterized in that, Including: Obtain the electrocardiogram (ECG) signal of the target object; Sample the ECG signal of the target object to a preset frequency, and fill it to a preset duration and a preset number of leads to obtain the ECG signal to be evaluated; Based on the ECG signal to be evaluated, use an ECG representation learning model to determine an ECG representation tensor, where the ECG representation learning model is trained based on a target function using historical ECG signals and historical ECG signals after data augmentation, and the target function is a weighted sum of a self-supervised loss function and a supervised loss function; Based on the ECG representation tensor, use a heartbeat recognition model to determine the heartbeat prediction result; Based on the heartbeat prediction result, window the ECG representation tensor to obtain heartbeat windows of the same length centered on each heartbeat, and all the heartbeat windows form an ECG representation sequence; Based on the ECG representation sequence, use an ECG event recognition model to determine the ECG event prediction result of each heartbeat window, and obtain the start and end points of the occurrence of the ECG event based on the ECG event prediction result of each heartbeat window.
2. The method according to claim 1, wherein The ECG representation learning model includes a plurality of parallel dilated convolution modules, each dilated convolution module is composed of a plurality of dilated convolution basic modules connected in series, each dilated convolution basic module includes a one-dimensional dilated convolution, and the gaps of the one-dimensional dilated convolutions included in each dilated convolution basic module are different. Among them, the step of using the ECG representation learning model based on the ECG signal to be evaluated to determine the ECG representation tensor includes: Input the ECG signal to be evaluated into the first, second... Kth dilated convolution modules respectively, and output the first, second... Kth feature tensors; Concatenate the first, second... Kth feature tensors along the channel dimension to obtain an ECG representation tensor, where K is the number of dilated convolution modules.
3. The method according to claim 1, wherein The heartbeat recognition model is a multi-layer perceptron, including a multi-layer linear fully connected neural network. For the multi-layer linear fully connected neural network, the number of neurons in each layer is set to 2 n , 2 n-1 , … 2 n-m , where m < n. Based on the electrocardiogram representation tensor, using the heartbeat recognition model to determine the heartbeat prediction result, including: Input the ECG representation tensor into the first linear fully connected neural network to output the first heartbeat recognition vector; Input the first heartbeat recognition vector into the second linear fully connected neural network to output the second heartbeat recognition vector; Until the (Q - 1)th heartbeat recognition vector is input into the Qth linear fully connected neural network to output the heartbeat prediction result, where Q = m + 1.
4. The method according to claim 1, wherein The ECG event recognition model includes an encoder and a classifier. The step of using the ECG event recognition model based on the ECG representation sequence to determine the ECG event prediction result of each heartbeat window and obtaining the start and end points of the occurrence of the ECG event based on the ECG event prediction result of each heartbeat window includes: input the ECG representation sequence into the encoder to obtain an intermediate vector for ECG event prediction, input the intermediate vector for ECG event prediction into the classifier to obtain the ECG event prediction result, the ECG event prediction result includes the ECG event prediction result of each heartbeat window, compare the ECG event prediction result of each heartbeat window with a preset threshold, obtain the heartbeat window when the ECG event prediction result is higher than the preset threshold for the first time, and set it as the start point of the ECG event; obtain the heartbeat window when the ECG event prediction result is lower than the preset threshold, and set it as the end point of the ECG event, and obtain the start and end points of the occurrence of the ECG event on the heartbeat scale.
5. The method according to claim 1, characterized in that Before obtaining the ECG signal to be evaluated, the method further includes: Obtain historical ECG signals; Sample the historical electrocardiogram (ECG) signal to a preset frequency, and pad it to a preset duration and a preset number of leads to obtain the processed historical ECG signal; Perform data augmentation on the processed historical ECG signal to obtain the historical ECG signal after data augmentation; Input the processed historical ECG signal into a preset ECG representation learning model framework, and output the first ECG representation tensor corresponding to the processed historical ECG signal; Input the historical ECG signal after data augmentation into a preset ECG representation learning model framework, and output the second ECG representation tensor corresponding to the historical ECG signal after data augmentation; Input the first ECG representation tensor into a preset self-supervised model framework, and output the first self-supervised result vector; Input the second ECG representation tensor into a preset self-supervised model framework, and output the second self-supervised result vector; Calculate the self-supervised loss function based on the first and second self-supervised result vectors; Obtain the first ECG abnormality event label and heartbeat label corresponding to the processed historical ECG signal; Input the first ECG representation tensor into a preset supervised task model framework, output the first supervised result vector, and calculate the first supervised loss function based on the first supervised result vector and the first ECG abnormality event label; Input the first ECG representation tensor into a preset heartbeat recognition model framework, output the second supervised result vector, and calculate the second supervised loss function based on the second supervised result vector and the heartbeat label; Calculate the ECG representation learning loss function based on the self-supervised loss function, the first supervised loss function, and the second supervised loss function: L = w1L self-supervised + w2L supervised-1 + w3L supervised-2 , where w1, w2, and w3 are the first, second, and third weights, and L self-supervised is the self-supervised loss function, and L supervised-1 is the first supervised loss function, and L supervised-2 is the second supervised loss function; Optimize the ECG representation learning model, the heartbeat recognition model, the supervised task model, and the self-supervised task model based on the ECG representation learning loss function to obtain the trained ECG representation learning model and the heartbeat recognition model.
6. The method according to claim 5, characterized in that, The self-supervised loss function is calculated based on the first and second self-supervised result vectors in the following way: Wherein: is an intermediate function, defined as follows: where N is the amount of original electrocardiogram data, z i is the first self-supervised result vector in the first self-supervised result vectors corresponding to the i-th historical electrocardiogram signal, is the second self-supervised result vector in the second self-supervised result vectors corresponding to the i-th historical electrocardiogram signal after data augmentation, z k is the first self-supervised result vector in the first self-supervised result vectors corresponding to the k-th historical electrocardiogram signal, is the second self-supervised result vector in the second self-supervised result vectors corresponding to the k-th historical electrocardiogram signal after data augmentation, exp is the exponential function, sim represents the calculation of the cosine similarity of vectors, τ is the temperature variable, is the indicator function, whose function value is 1 when the condition is true and 0 otherwise.
7. The method according to claim 5, characterized in that, The first supervised loss function is calculated based on the first supervised result vector and the first ECG abnormality event label in the following way: Where J represents the first electrocardiogram abnormality event label vector l e_i and the length of the first supervised result vector y e_i j represents the first electrocardiogram abnormality event label vector l e_i and the element index of the first supervised result vector y e_i The element index, represents the j-th component in the first electrocardiogram abnormality event label vector, represents the j-th component in the first supervised result vector, and N is the amount of original electrocardiogram data.
8. The method according to claim 5, characterized in that, The second supervised loss function is calculated based on the second supervised result vector and the heartbeat label in the following way: where J’ represents the heartbeat label vector l b-i and the length of the second supervised result vector y b_i and J’ = J, j′ represents the element index of the heartbeat label vector l b_i and the second supervised result vector y b_i The element index of, represents the j′-th component in the heartbeat label vector l b_i in the middle, the j′-th component, represents the j′-th component in the second supervised result vector, and N is the amount of original electrocardiogram data.
9. The method according to claim 4, wherein The method further includes: Obtain the second ECG abnormality event label, input the ECG representation sequence into the ECG event recognition model framework, output the ECG event recognition prediction vector, and calculate the ECG event recognition loss function based on the ECG event recognition prediction vector and the second ECG abnormality event label. The loss function is as follows: Where M represents the amount of electrocardiogram data, and P represents the length of the second electrocardiogram abnormal event label vector l s_a and the electrocardiogram event recognition and prediction vector y s_a ; p represents the element index of the second electrocardiogram abnormal event label vector l s_a and the electrocardiogram event recognition and prediction vector y s_a ; denotes the p-th component of the second electrocardiogram abnormal event label vector l s_a ; denotes the p-th component of the electrocardiogram event recognition and prediction vector y s_a .
10. An electrocardiogram abnormal event recognition system, characterized in that, It includes: An ECG acquisition module for acquiring the ECG signal of the target object; A preprocessing module for sampling the ECG signal of the target object to a preset frequency and padding it to a preset duration and a preset number of leads to obtain the ECG signal to be evaluated; An electrocardiogram representation module, configured to determine an electrocardiogram representation tensor based on the electrocardiogram signal to be evaluated by using an electrocardiogram representation learning model, where the electrocardiogram representation learning model is trained based on a target function by using historical electrocardiogram signals and augmented historical electrocardiogram signals, and the target function is a weighted sum of a self-supervised loss function and a supervised loss function; A heartbeat recognition module, configured to determine a heartbeat prediction result based on the electrocardiogram representation tensor by using a heartbeat recognition model; A windowing module, configured to window the electrocardiogram representation tensor based on the heartbeat prediction result to obtain heartbeat windows of the same length centered on each heartbeat, and all the heartbeat windows form an electrocardiogram representation sequence; An electrocardiogram event recognition module, configured to determine an electrocardiogram event prediction result for each heartbeat window based on the electrocardiogram representation sequence by using an electrocardiogram event recognition model, and obtain the start and end points of the occurrence of an electrocardiogram event on the heartbeat scale.
11. A non-volatile storage medium, characterized in that, The non-volatile storage medium stores a plurality of instructions, and the instructions are adapted to be loaded and executed by a processor to perform the electrocardiogram abnormality event recognition method according to any one of claims 1-9.
12. An electronic device, characterized in that, Comprising one or more processors and a memory, the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the electrocardiogram abnormality event recognition method according to any one of claims 1-9.
Citation Information
Patent Citations
Cardiac beat classification method and device, wearable equipment and storage medium
CN111723622A
Heartbeat classification method and device for multi-tag ECG signal labeling
US20230342595A1