Multi-instance based abnormal heartbeat localization method
Through the abnormal heart beat positioning model based on multiple examples, combined with the R peak positioning point and the heart beat duration, the accuracy and completeness of abnormal heart beat positioning in the prior art is solved, and automatic positioning and real-time early warning in long-term electrocardiogram signals are realized.
Patent Information
- Application Number
- CN202310666679.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-06
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2043-06-06
AI Technical Summary
The prior art is susceptible to extreme values and noise in abnormal heart beat positioning, and the model fails to effectively combine context information, resulting in the completeness and accuracy of heart beat.
The abnormal heart beat positioning model based on multiple examples is adopted, and the training data is constructed by obtaining the R peak position point, determining the duration of the heart beat, and segmenting the electrocardiogram signal sequence. The multi-scale feature extraction module, feature fusion module and multi-example anomaly marking module are used for training to achieve automatic positioning of the abnormal heart beat.
It improves the accuracy and completeness of abnormal heart beat positioning, can capture abnormalities in long-term electrocardiogram signals, realize real-time early warning and auxiliary diagnosis, and has a certain explanatory nature.
Smart Images

Figure CN116821827B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of automatic detection of abnormal heartbeats. Specifically, it relates to a method for locating abnormal heartbeats based on multi-instance learning. Background Art
[0002] An electrocardiogram (ECG) signal is a curve that can reflect the electrical activity of the heart and is recorded by an electrocardiograph through electrode patches placed on the body surface. It is a physiological signal with low signal-to-noise ratio and non-stationary characteristics, featuring low amplitude, low frequency, and strong randomness. The ECG signal changes periodically, and one heartbeat constitutes one cardiac cycle. A complete cardiac cycle consists of main characteristic waves such as the P wave, QRS complex, and T wave. When there are abnormalities in the rhythm, frequency, or conduction process of the heart, arrhythmia will occur, and different arrhythmias will correspond to different abnormal waveforms, which are abnormal heartbeats corresponding to each heartbeat. Clinically, the abnormal changes in ECG signals are important indicators for doctors to diagnose heart diseases. Therefore, the accurate location of abnormal heartbeats has very important diagnostic value. However, on the one hand, for wearable monitoring devices, real-time warning needs to be achieved, and it is necessary to be able to identify abnormal heartbeats. On the other hand, for long-term ECG signal recordings, relying solely on doctors for diagnosis is a boring, time-consuming, and laborious task. In addition, the serious imbalance of medical resources will bring a series of problems such as difficult access to medical treatment and high treatment costs.
[0003] With the rapid development of advanced frontier technologies such as big data, artificial intelligence, and mobile Internet, researchers have begun to focus on the research of intelligent analysis and processing of medical data, and have proposed some research ideas and methods to address the above problems, which can solve the problem of abnormal heartbeat location to a certain extent. In previous work, researchers designed a multi-instance neural network model to locate abnormal heartbeats while detecting abnormal ECG signals. However, this model only considered the information of the signal points themselves and did not combine the context, so it was easily affected by extreme values, and noise points had a great impact on the model's performance. Moreover, in the experiment, a heartbeat was segmented into small segments, which destroyed the integrity of the heartbeat and had no practical significance. Summary of the Invention
[0004] To overcome at least one deficiency in the prior art, this application provides a method for locating abnormal heartbeats based on multi-instance learning.
[0005] In a first aspect, a method for constructing a multi-instance abnormal heartbeat location model is provided, including:
[0006] Obtain a plurality of ECG signal sequences;
[0007] For each ECG signal sequence, obtain the R-peak position points;
[0008] Determine the duration of the heartbeat according to the R-peak position points, and segment the electrocardiogram (ECG) signal sequence according to the duration of the heartbeat to obtain the heartbeats of the ECG signal sequence.
[0009] Construct training data based on the heartbeats of all ECG signal sequences.
[0010] Train the multi-instance abnormal heartbeat localization model based on the training data to obtain the trained multi-instance abnormal heartbeat localization model; the multi-instance abnormal heartbeat localization model includes a multi-scale feature extraction module, a feature fusion module, and a multi-instance abnormal marking module.
[0011] In one embodiment, for each ECG signal sequence, obtaining the R-peak position points includes:
[0012] Input the ECG signal sequence into the R-peak detection model to obtain the prediction probability P of whether each sampling point belongs to the R-peak candidate point.
[0013] If the prediction probability P corresponding to the sampling point is greater than the set value, the sampling point belongs to the R-peak candidate point.
[0014] Set a sliding window. During the sliding process of the sliding window for the ECG signal sequence, determine the R-peak position points within the sliding window according to the number of R-peak candidate points within the sliding window.
[0015] The R-peak position points corresponding to all sliding windows constitute the R-peak position points of the ECG signal sequence.
[0016] In one embodiment, the method for obtaining the R-peak detection model is:
[0017] Perform R-peak position point marking on the ECG signal sequence.
[0018] Set labels according to the R-peak position point marking to obtain the labeled ECG signal sequence.
[0019] Train the R-peak detection model based on the labeled ECG signal sequence. The R-peak detection model is a Bi-LSTM model.
[0020] In one embodiment, determining the duration of the heartbeat according to the R-peak position points and segmenting the ECG signal sequence according to the duration of the heartbeat to obtain the heartbeats of the ECG signal sequence includes:
[0021] Determine the duration of the heartbeat according to the length of the ECG signal sequence and the number of R-peak position points, using the following formula:
[0022]
[0023] where t is the duration of the heartbeat, L is the length of the ECG signal sequence, and the number of R-peaks is the number of R-peak position points.
[0024] For each R-peak position point, 3 / 8 of the duration is intercepted before the R-peak position point, and 5 / 8 of the duration is intercepted after the R-peak position point, constituting a heartbeat corresponding to the R-peak position point.
[0025] The heartbeats corresponding to all R-peak position points constitute the heartbeats of the electrocardiogram signal sequence.
[0026] In one embodiment, training data is constructed based on the heartbeats of all electrocardiogram signal sequences, including:
[0027] The training data is denoted as B, B = {B 1 , B 2 , … B i …, B m}, B i = (X i , y i ), B i is the i-th package, m is the number of packages, X i = {X i1 , X i2 , … X ij …, B in}, X i is the set of heartbeats of the electrocardiogram signal sequence corresponding to the i-th package, x ij is the j-th heartbeat in X i ; n is the number of heartbeats in the i-th package; y i is the label of the i-th package.
[0028] In one embodiment, the multi-scale feature extraction module is used to extract the embedding features of each heartbeat of the electrocardiogram signal sequence for each electrocardiogram signal sequence in the training data;
[0029] The feature fusion module is used to determine the weight feature of each heartbeat and the feature of each package according to the embedding feature of each heartbeat; the weight feature of each heartbeat is used to locate the abnormal heartbeat in the electrocardiogram signal sequence;
[0030] The multi-instance anomaly marking module is used to determine the prediction probability value of each package according to the weight feature of each heartbeat and the feature of each package; the prediction probability value of each package is used to construct the loss function.
[0031] In one embodiment, the following formula is used to calculate the weight feature of each heartbeat:
[0032]
[0033] Where α ij is the weight feature of the j-th heartbeat in the i-th package, W 1 and W 2They are the weights of two linear layers respectively, n is the number of heartbeats in the i-th packet, and F ij is the embedded feature of the j-th heartbeat in the i-th packet.
[0034] The feature F of the i-th packet i is calculated using the following formula:
[0035]
[0036] In one embodiment, the predicted probability value of each packet is calculated using the following formula:
[0037] p i = αp i '+ βp i ″
[0038] where p i is the predicted probability value of the i-th packet, α and β are weights, and p i ' is the predicted probability value from the packet feature, and p i ″ is the aggregated result of the probability prediction values from the heartbeats;
[0039]
[0040] where F i is the feature of the i-th packet;
[0041]
[0042] where r is a constant, n is the number of heartbeats in the i-th packet, and p ij is the probability prediction value of the j-th heartbeat in the i-th packet.
[0043] In one embodiment, the loss function is expressed using the following formula:
[0044]
[0045] where J is the loss function, y i is the label of the i-th packet, m is the number of packets, and p i is the predicted probability value of the i-th packet.
[0046] Second, a method for abnormal heartbeat localization based on multi-instance is provided, including:
[0047] For the electrocardiogram signal sequence to be detected, obtain the R peak position points;
[0048] Determine the duration of the heartbeat according to the R peak position points, and segment the electrocardiogram signal sequence to be detected according to the duration of the heartbeat to obtain the heartbeats of the electrocardiogram signal sequence to be detected;
[0049] Construct packet-form data D=(X, y) according to the heartbeat structure of the electrocardiogram signal sequence to be detected, where X={x 1 , x 2 , …, x n}, X is the heartbeat set, x i is the i-th heartbeat, and y is the label;
[0050] Input the packet-form data D into the anomaly heartbeat localization model based on multi-instance learning to obtain the weight features of each heartbeat; the anomaly heartbeat localization model based on multi-instance learning is obtained according to the above-mentioned construction method of the anomaly heartbeat localization model based on multi-instance learning;
[0051] Locate the anomaly heartbeat according to the magnitude of the weight feature of each heartbeat.
[0052] Compared with the prior art, the present application has the following beneficial effects:
[0053] 1. The present application considers the importance of anomaly heartbeat localization from a new perspective, adopts a weakly supervised multi-instance learning method, and predicts the fine label of the heartbeat through the coarse label of the signal sequence, which can capture anomalies in the long-term electrocardiogram signal and realize the automatic localization of anomaly heartbeats.
[0054] 2. In view of the temporal characteristics of the electrocardiogram signal, the present application uses the sequence model Transformer as the feature extractor, which can effectively obtain the forward and backward dependence relationships between heartbeats and between sampling points, thereby improving the accuracy of the model, and using the heartbeat probability value to mark anomalies, making the model have a certain interpretability.
[0055] 3. The present application starts from the signal sequence containing multiple heartbeats, determines the position of the anomaly heartbeat among many heartbeats, ensures the integrity and coherence of the heartbeat, and provides important value for real-time early warning and auxiliary diagnosis. Description of the Drawings
[0056] The present application can be better understood by referring to the description given in the following text in conjunction with the accompanying drawings. The drawings, together with the following detailed description, are included in this specification and form a part of this specification. In the drawings:
[0057] Figure 1 Shows a schematic diagram of the characteristic waves of the electrocardiogram signal;
[0058] Figure 2 Shows a flowchart of the construction method of the anomaly heartbeat localization model based on multi-instance learning according to an embodiment of the present application;
[0059] Figure 3 Shows the original noisy electrocardiogram signal;
[0060] Figure 4Shows the electrocardiogram signal sequence after removing power frequency interference;
[0061] Figure 5 Shows the electrocardiogram signal sequence after removing baseline drift;
[0062] Figure 6 Shows the electrocardiogram signal after removing electromyogram interference;
[0063] Figure 7 Shows the schematic diagram of obtaining the R peak position points;
[0064] Figure 8 Shows the schematic diagram of the heartbeat segmentation process;
[0065] Figure 9 Shows the result diagram of heartbeat segmentation;
[0066] Figure 10 Shows the structural block diagram of the abnormal heartbeat localization model based on multiple instances;
[0067] Figure 11 Shows the display diagram of the SPB abnormal heartbeat localization result;
[0068] Figure 12 Shows the display diagram of the PVC abnormal heartbeat localization result. Detailed implementation manners
[0069] In the following, exemplary embodiments of the present application will be described in conjunction with the accompanying drawings. For the sake of clarity and conciseness, not all features of the actual embodiments are described in the specification. However, it should be understood that many embodiment-specific decisions may be made during the development of any such actual embodiment to achieve the specific goals of the developer, and these decisions may vary with different embodiments.
[0070] Here, it should also be noted that in order to avoid obscuring the present application with unnecessary details, only the device structures closely related to the solution of the present application are shown in the drawings, while other details less related to the present application are omitted.
[0071] It should be understood that the present application is not limited to the described embodiments only due to the following description with reference to the drawings. In this document, where feasible, embodiments can be combined with each other, features can be replaced or borrowed between different embodiments, and one or more features can be omitted in one embodiment.
[0072] Figure 1 Shows the schematic diagram of the characteristic waves of the electrocardiogram signal, see Figure 1, The QRS complex is a group of closely connected waves composed of three waves: a downward Q wave, an upward R wave, and a downward S wave, with a time width of 0.06 - 0.1 s. The R wave is the first tall positive wave in the QRS complex, and the R peak is the peak value of the R wave; the S wave is the first negative wave after the R wave, and the S peak is the peak value of the S wave.
[0073] The T wave is a blunt, rounded wave with a lower amplitude and longer width after the R wave, representing the repolarization of the ventricles. The time width of the T wave is 0.05 s - 0.25 s, and the voltage amplitude is not less than 1 / 10 of the R wave in the same lead.
[0074] Baseline drift frequency distribution range: 0.15 Hz - 2 Hz, mainly distributed at 0.15 Hz; power frequency interference frequency distribution range: 50 / 60 Hz; electromyogram interference: 5 - 2000 hz.
[0075] The embodiment of the present application provides a method for constructing an abnormal heartbeat localization model based on multi - instance. Figure 2 The flowchart showing the method for constructing an abnormal heartbeat localization model based on multi - instance according to the embodiment of the present application is shown in Figure 2 , The method includes:
[0076] Step S1, obtaining a plurality of electrocardiogram signal sequences.
[0077] Step S2, for each electrocardiogram signal sequence, obtaining the R - peak position points.
[0078] Here, the electrocardiogram signal sequence can be first denoised to obtain the denoised electrocardiogram signal sequence. To improve the denoising performance, different methods are respectively adopted for power frequency interference, baseline drift, and electromyogram interference in the present application. The signal - to - noise ratio (SNR) and mean square error (MSE) are used as evaluation indexes to select the best denoising method for denoising respectively. Specifically, Butterworth filtering can be used for the electrocardiogram signal sequence to remove power frequency interference; discrete wavelet transform can be used to remove baseline drift; weighted window filtering can be used to remove electromyogram interference to obtain the denoised electrocardiogram signal sequence. Figure 3 Shows the original noisy electrocardiogram signal, Figure 4 Shows the electrocardiogram signal sequence after removing power frequency interference, Figure 5 Shows the electrocardiogram signal sequence after removing baseline drift, Figure 6 Shows the electrocardiogram signal after removing electromyogram interference. Then, for the denoised electrocardiogram signal sequence, the R - peak position points are obtained.
[0079] Step S3, determining the duration of the heartbeat according to the R - peak position points, and segmenting the electrocardiogram signal sequence according to the duration of the heartbeat to obtain the heartbeats of the electrocardiogram signal sequence.
[0080] Step S4, construct training data based on the heartbeats of all electrocardiogram signal sequences.
[0081] Step S5, train the multi-instance based abnormal heartbeat localization model based on the training data to obtain the trained multi-instance based abnormal heartbeat localization model; the multi-instance based abnormal heartbeat localization model includes a multi-scale feature extraction module, a feature fusion module, and a multi-instance abnormal labeling module.
[0082] This application considers the importance of abnormal heartbeat localization from a new perspective, adopts a weakly supervised multi-instance learning method, predicts the fine labels of heartbeats through the coarse labels of signal sequences, can capture abnormalities in long-term electrocardiogram signals, and realizes the automatic localization of abnormal heartbeats.
[0083] In one embodiment, in step S2, for each electrocardiogram signal sequence, obtaining the R-peak position points may include:
[0084] Step S21, input the electrocardiogram signal sequence into the R-peak detection model to obtain the prediction probability P of whether each sampling point belongs to the R-peak candidate point.
[0085] Here, the R-peak detection model can be pre-trained, specifically:
[0086] First, mark the R-peak position points for the electrocardiogram signal sequence. Here, the electrocardiogram signal sequence is different from the electrocardiogram signal sequence in step S1;
[0087] Then, set labels according to the R-peak position point markings to obtain the labeled electrocardiogram signal sequence; here, two sampling points can be extended on both sides of the marked R-peak position point to a total of 5 sample points as the label of the signal;
[0088] Finally, train the R-peak detection model based on the labeled electrocardiogram signal sequence. The R-peak detection model is a Bi-LSTM model.
[0089] Step S22, if the prediction probability P corresponding to the sampling point is greater than the set value, then the sampling point belongs to the R-peak candidate point; where the set value is selected as needed, for example, it can be set to 0.5.
[0090] Step S23: Set a sliding window. During the sliding process of the sliding window for the electrocardiogram (ECG) signal sequence, determine the R-peak position points within the sliding window according to the number of R-peak candidate points in the sliding window. Here, the length of the sliding window is 200 and the step size is 100. If the number of R-peak candidate points in each sliding window is less than 5, there are no R-peak position points in this sliding window. If the number of R-peak candidate points in each sliding window is equal to or greater than 5, determine all the maximum value points within the sliding window. If there is 1 maximum value point, this maximum value point is the determined R-peak position point. If there are more than 1 maximum value points, determine the largest maximum value point as the R-peak position point.
[0091] Step S24: The R-peak position points corresponding to all sliding windows form the R-peak position points of the ECG signal sequence. Figure 7 The schematic diagram of obtaining the R-peak position points is shown.
[0092] In one embodiment, in step S3, determine the duration of each heartbeat according to the R-peak position points, and segment the ECG signal sequence according to the duration of each heartbeat to obtain the heartbeats of the ECG signal sequence, including:
[0093] Step S31: Determine the duration of each heartbeat according to the length of the ECG signal sequence and the number of R-peak position points, using the following formula:
[0094]
[0095] where t is the duration of each heartbeat, L is the length of the ECG signal sequence, and the number of R-peaks is the number of R-peak position points.
[0096] Step S32: For each R-peak position point, intercept 3 / 8 of the duration before the R-peak position point and 5 / 8 of the duration after the R-peak position point to form a heartbeat corresponding to the R-peak position point; Figure 8 The schematic diagram of the heartbeat segmentation process is shown.
[0097] Step S33: The heartbeats corresponding to all R-peak position points form the heartbeats of the ECG signal sequence. Figure 9 The result diagram of the heartbeat segmentation is shown.
[0098] In one embodiment, in step S4, construct training data based on all the heartbeats of the ECG signal sequence, including:
[0099] The training data is represented by B, B = {B 1 , B 2 , … B i …, B m}, B i = (X i , y i ), B iFor the i-th packet, m is the number of packets, and x i ={X i1 , X i2 , … X ij …, B in}}, x i is the set of heartbeats of the electrocardiogram signal sequence corresponding to the i-th packet, and x ij is the j-th heartbeat in x i , and n is the number of heartbeats in the i-th packet; y i is the label of the i-th packet, and the label here can include abnormal types such as SPB and PVC. Here, one packet corresponds to one electrocardiogram signal sequence, and a heartbeat can also be called an example.
[0100] In one embodiment, Figure 10 shows a structural block diagram of an abnormal heartbeat localization model based on multi-instance, see Figure 10 . The abnormal heartbeat localization model based on multi-instance includes a multi-scale feature extraction module, a feature fusion module, and a multi-instance abnormal labeling module. The multi-scale feature extraction module extracts features from each heartbeat signal, and the feature fusion model fuses the features of each heartbeat, and weights them through an Attention function to highlight the contribution degree of each heartbeat. The abnormal labeling model mainly performs abnormal labeling through the prediction of example labels and packet labels and uses the predicted values.
[0101] The multi-scale feature extraction module includes an embedding layer, a position encoding layer, a multi-scale convolutional attention layer, and a linear layer, and is used to extract the embedding feature F ij of each heartbeat of the electrocardiogram signal sequence for each electrocardiogram signal sequence in the training data, and F ij is the embedding feature of the j-th heartbeat in the i-th packet (electrocardiogram signal sequence). Here, the multi-scale feature extraction module uses the Encoder network of Transformer, and the Encoder adopts a multi-scale convolution method with convolution kernels of 4, 6, and 8, and then uses a structure with two convolutional layers, two regularization layers, and a global max pooling to complete feature extraction.
[0102] The feature fusion module includes an attention mechanism with two linear layers, and is used to determine the weight feature of each heartbeat and the feature of each packet according to the embedding feature of each heartbeat; the weight feature of each heartbeat is used to locate the abnormal heartbeat in the electrocardiogram signal sequence; here, the weight feature of each heartbeat is calculated by the following formula:
[0103]
[0104] where α ij is the weight feature of the j-th heartbeat in the i-th packet, W 1 and W 2They are the weights of two linear layers respectively, n is the number of heartbeats in the i-th packet, and F ij is the embedded feature of the j-th heartbeat in the i-th packet.
[0105] The feature F of the i-th packet i is calculated using the following formula:
[0106]
[0107] The multi-instance anomaly marking module is used to determine the predicted probability value of each packet according to the weight feature of each heartbeat and the feature of each packet; the predicted probability value of each packet is used to construct a loss function. The multi-instance anomaly marking module is obtained by predicting the values of examples and the features of packets, and consists of two parts. One part is a feature prediction module including a fully connected layer and a Softmax activation function layer, and the Softmax activation function layer outputs the packet probability value pi; the other part comes from the result of the example prediction layer. The example prediction layer predicts the features of the examples and obtains the predicted probability value p of the packet through an aggregation function i ′, and then weights the probability values from different sources to finally obtain the classification result of the packet. Specifically, the predicted probability value of each packet is calculated using the following formula:
[0108] p i = αp i ′ + βp i ″
[0109] where p i is the predicted probability value of the i-th packet, α and β are weights, p i ′ is the predicted probability value from the packet feature, and p i ″ is the aggregation result of the probability prediction values from the heartbeats;
[0110]
[0111] where F i is the feature of the i-th packet;
[0112]
[0113] where r is a constant, n is the number of heartbeats in the i-th packet, and p ij is the probability prediction value of the j-th heartbeat in the i-th packet.
[0114] In one embodiment, the predicted probability value of each packet is used to construct a loss function, and the loss function is represented by the following formula:
[0115]
[0116] Among them, J is the loss function, y i is the label of the i-th bag, m is the number of bags, and p i is the predicted probability value of the i-th bag.
[0117] Specifically, when training the R-peak detection model and the multi-instance based abnormal heartbeat localization model, the method of stochastic gradient descent is adopted. The optimizer uses the Adam optimizer, the initial learning rate is 0.0001, and the weight decay coefficient is 0.0001. During the process of training the R-peak detection model, the value of batch size is 32, and during the process of training the multi-instance based abnormal heartbeat localization model, the value of batch size is 1.
[0118] The embodiment of the present application also provides a multi-instance based abnormal heartbeat localization method, including:
[0119] Step S110, for the electrocardiogram signal sequence to be detected, obtain the R-peak position points; the specific implementation manner is the same as that of step S2.
[0120] Step S111, determine the duration of the heartbeat according to the R-peak position points, and segment the electrocardiogram signal sequence to be detected according to the duration of the heartbeat to obtain the heartbeats of the electrocardiogram signal sequence to be detected; the specific implementation manner is the same as that of step S3.
[0121] Step S112, construct the bag-form data D=(X, y) according to the heartbeats of the electrocardiogram signal sequence to be detected, X={x 1 , x 2 , …, x n}, X is the heartbeat set, x i is the i-th heartbeat, and y is the label.
[0122] Step S113, input the bag-form data D into the multi-instance based abnormal heartbeat localization model to obtain the weight features of each heartbeat; the multi-instance based abnormal heartbeat localization model is obtained according to the multi-instance based abnormal heartbeat localization model construction method in the above embodiment.
[0123] Step S114, locate the abnormal heartbeats according to the magnitudes of the weight features of each heartbeat. Here, the larger the weight feature, the greater the probability that the heartbeat belongs to an abnormal heartbeat. Figure 11 shows the display diagram of the SPB abnormal heartbeat localization result, Figure 12 shows the display diagram of the PVC abnormal heartbeat localization result, Figure 11 and Figure 12 The localization result is presented in the form of a heat map. The color ranges from blue to red. The closer the color is to red, the larger the weight feature, that is, the greater the possibility of the heartbeat being abnormal.
[0124] In summary, the present application has the following technical effects:
[0125] 1. This application considers the importance of abnormal heartbeat localization from a new perspective. By adopting a weakly supervised multi-instance learning method and predicting the fine labels of heartbeats through the coarse labels of signal sequences, it can capture abnormalities in long-term electrocardiogram signals and achieve automatic localization of abnormal heartbeats.
[0126] 2. In view of the temporal characteristics of electrocardiogram signals, this application uses the sequence model Transformer as a feature extractor, which can effectively obtain the forward and backward dependencies between heartbeats and between sampling points, thereby improving the accuracy of the model. In addition, it uses the heartbeat probability value to mark abnormalities, making the model interpretable to a certain extent.
[0127] 3. This application starts from signal sequences containing multiple heartbeats, determines the positions of abnormal heartbeats among numerous heartbeats, ensures the integrity and coherence of heartbeats, and provides important value for real-time early warning and auxiliary diagnosis.
[0128] The above are only various embodiments of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed by this application can easily think of changes or substitutions, which should be covered within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.
Claims
1. A method for constructing an abnormal heartbeat localization model based on multi-instance, characterized in that, it includes: Obtain multiple electrocardiogram signal sequences; For each of the electrocardiogram signal sequences, obtain the R-peak position points; Determine the duration of the heartbeat according to the R-peak position points, and segment the electrocardiogram signal sequence according to the duration of the heartbeat to obtain the heartbeats of the electrocardiogram signal sequence; Construct training data based on the heartbeats of all the electrocardiogram signal sequences; Train the abnormal heartbeat localization model based on multi-instance using the training data to obtain the trained abnormal heartbeat localization model based on multi-instance; the abnormal heartbeat localization model based on multi-instance includes a multi-scale feature extraction module, a feature fusion module, and a multi-instance abnormal marking module; The method for obtaining the R-peak detection model is: Mark the R-peak position points for the electrocardiogram signal sequence; Set labels according to the R-peak position point markings to obtain the labeled electrocardiogram signal sequence; Train the R-peak detection model based on the labeled electrocardiogram signal sequence, and the R-peak detection model is a Bi-LSTM model; The multi-scale feature extraction module is used to extract the embedding features of each heartbeat of each electrocardiogram signal sequence in the training data; The feature fusion module is used to determine the weight feature of each heartbeat and the feature of each bag according to the embedding feature of each heartbeat; The weight feature of each heartbeat is used to locate the abnormal heartbeat in the electrocardiogram signal sequence; The multi-instance abnormal marking module is used to determine the prediction probability value of each bag according to the weight feature of each heartbeat and the feature of each bag; the prediction probability value of each bag is used to construct a loss function; The following formula is used to calculate the weight feature of each heartbeat: Among them, α ij is the weighted feature of the j-th heartbeat in the i-th packet, W 1 and W 2 are the weights of two linear layers respectively, n is the number of heartbeats in the i-th packet, F ij is the embedded feature of the j-th heartbeat in the i-th packet; Feature F of the i-th packet i , which is calculated using the following formula: The prediction probability value of each bag is calculated using the following formula: p i = αp i ′ + βp i ″ where p i is the predicted probability value of the i-th packet, α and β are weights, and p i ′ is the predicted probability value from the packet feature, and p i ′ is the aggregation result of the probability prediction values from heartbeats; Among them, F i is the feature of the i-th packet; where r is a constant, n is the number of heartbeats in the i-th packet, and p ij is the probability prediction value of the j-th heartbeat in the i-th packet.
2. The method according to claim 1, characterized in that, For each of the electrocardiogram signal sequences, obtaining the R-peak position points includes: Input the electrocardiogram signal sequence into the R-peak detection model to obtain the prediction probability P of whether each sampling point belongs to the R-peak candidate point; If the prediction probability P corresponding to the sampling point is greater than the set value, the sampling point belongs to the R-peak candidate point; Set a sliding window, and during the sliding of the sliding window for the electrocardiogram signal sequence, determine the R-peak position points within the sliding window according to the number of R-peak candidate points within the sliding window; The R-peak position points corresponding to all the sliding windows constitute the R-peak position points of the electrocardiogram signal sequence.
3. The method according to claim 1, characterized in that, wherein, Determining the duration of the heartbeat according to the R-peak position points, and segmenting the electrocardiogram signal sequence according to the duration of the heartbeat to obtain the heartbeats of the electrocardiogram signal sequence includes: Determine the duration of the heartbeat according to the length of the electrocardiogram signal sequence and the number of R-peak position points, using the following formula: where t is the duration of the heartbeat, L is the length of the electrocardiogram signal sequence, and the number of R-peaks is the number of R-peak position points; For each R-peak position point, 3 / 8 of the duration is intercepted before the R-peak position point, and 5 / 8 of the duration is intercepted after the R-peak position point to form a heartbeat corresponding to the R-peak position point. The heartbeats corresponding to all R-peak position points constitute the heartbeats of the electrocardiogram signal sequence.
4. The method according to claim 1, characterized in that, wherein, Constructing training data based on all the heartbeats of the electrocardiogram signal sequence, including: The training data is denoted by B, where B = {B 1 , B 2 , … B i …, B m}, and B i = (X i , y i ). Here, B i is the i-th packet, m is the number of packets, X i = {X i1 , X i2 , … X ij …, B in}, X i is the set of heartbeats in the electrocardiogram signal sequence corresponding to the i-th packet, x ij is the j-th heartbeat in X i , and n is the number of heartbeats in the i-th packet; y i is the label of the i-th packet.
5. The method according to claim 1, characterized in that, The loss function is represented by the following formula: Among them, J is the loss function, y i is the label of the i-th package, m is the number of packages, p i is the predicted probability value of the i-th package.
6. A method for abnormal heartbeat localization based on multi-instance, characterized in that, including: For the electrocardiogram signal sequence to be detected, obtain the R-peak position points; Determine the duration of the heartbeat according to the R-peak position points, and segment the electrocardiogram signal sequence to be detected according to the duration of the heartbeat to obtain the heartbeats of the electrocardiogram signal sequence to be detected; Construct packet-form data D=(X, y) according to the heartbeat of the electrocardiogram signal sequence to be detected, where X={x 1 , x 2 , …, x n}, X is a heartbeat set, x i is the i-th heartbeat, and y is a label; Input the packet-form data D into the multi-instance-based abnormal heartbeat localization model to obtain the weight features of each heartbeat; The multi-instance-based abnormal heartbeat localization model is obtained by the multi-instance-based abnormal heartbeat localization model construction method according to any one of claims 1 to 5; Locate the abnormal heartbeat according to the magnitude of the weight features of each heartbeat.
Citation Information
Patent Citations
Electrocardiosignal classification method and device, electronic equipment and storage medium
CN111488793A
Electrocardiosignal anomaly prediction method and system based on LSTM auto-encoder
CN113995417A