A machine learning-based electrocardiogram atrial fibrillation data detection method

By using a machine learning-based atrial fibrillation data detection method, a feature matrix K is constructed and classified using the irregular ECG data characteristics of atrial fibrillation. This solves the problem of inaccurate identification of R waves and P waves in traditional methods and achieves efficient atrial fibrillation identification.

CN119454045BActive Publication Date: 2026-01-02WUXI JIANWEI INSTR CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411480987.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-23
Publication Date
2026-01-02
Estimated Expiration
2044-10-23

AI Technical Summary

Technical Problem

In traditional atrial fibrillation identification algorithms, the accuracy of atrial fibrillation ECG data identification is low due to inaccurate identification of R waves and P waves.

Method used

A machine learning-based method for detecting atrial fibrillation (AF) data from electrocardiograms was adopted. This method involves segmenting and sampling the raw electrocardiogram data, constructing a feature matrix K, and then using a support vector machine model for classification. This avoids the need to identify R and P waves and directly utilizes the irregular features of the AF electrocardiogram data for classification.

Benefits of technology

It improved the accuracy of atrial fibrillation ECG data recognition, simplified the calculation process, and increased classification speed and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119454045B_ABST
    Figure CN119454045B_ABST
Patent Text Reader

Abstract

The application provides an electrocardiogram atrial fibrillation data detection method based on machine learning. The method utilizes the characteristics of unstable intervals between R waves of atrial fibrillation electrocardio data and no obvious single P wave, emphasizes waveform characteristics through sampling operation, constructs waveform characteristic data Distance, utilizes the characteristics of irregularity and low waveform repetition probability of atrial fibrillation electrocardio data, and constructs waveform characteristic data Similar. Through a machine learning algorithm, an electrocardio waveform classification model is constructed, and atrial fibrillation electrocardio data and normal electrocardio data are classified according to two waveform characteristic data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, specifically to a method for detecting atrial fibrillation data from electrocardiograms based on machine learning. Background Technology

[0002] Atrial fibrillation (AF) is a common heart rhythm disorder. The main risks of AF include a significantly increased risk of stroke, heart failure, deterioration of cardiac function, decreased quality of life, and increased risk of death, especially if left untreated or poorly managed. The presence of AF is usually determined based on electrocardiogram (ECG) data.

[0003] Atrial fibrillation (AF) is characterized by rapid and irregular electrical activity in the atria, causing them to be unable to contract effectively. This abnormal electrical activity propagates through the atrioventricular node to the ventricles, causing the ventricles to also beat irregularly and rapidly. Features of AF on an electrocardiogram (ECG) include:

[0004] 1. Disappearance of P waves: In atrial fibrillation, the traditional P wave disappears because the electrical activity in the atria is irregular and chaotic. Instead, small, irregular fluctuations can be seen, which are called "fibrillation waves" or "f waves".

[0005] 2. Irregular RR interval: The ventricular beats (QRS waves) become irregular, manifested as an irregular RR interval (the time interval between two R waves).

[0006] 3. Increased heart rate: Atrial fibrillation is usually accompanied by a rapid heart rate, that is, the ventricular rate is usually between 100-160 beats / minute, but it may be faster or slower.

[0007] like Figure 1 The image shows a comparison between normal ECG data and atrial fibrillation ECG data; Figure 1 In the electrocardiogram (ECG) graph, the horizontal axis represents the sampling points; the vertical axis represents voltage, in millivolts. Figure 1 The data shows that in a normal electrocardiogram, the interval between R waves is stable and there are obvious and stable P waves. In atrial fibrillation electrocardiograms, the interval between R waves is unstable and there are no obvious individual P waves. Instead, there are irregular wave-like fibrillation waves.

[0008] Traditional atrial fibrillation (AF) detection algorithms typically begin by identifying the R wave, calculating the RR intervals between all R waves, and assessing stability. Next, the P wave is identified, and the presence of multiple distinct and irregular waveforms between the R waves is assessed. Only through these two steps can an AF be confirmed. However, due to technological limitations, the identification of the R wave and P wave is often inaccurate, leading to AF detection failures. Summary of the Invention

[0009] In order to solve the problem that the traditional atrial fibrillation recognition method is affected by the inaccurate recognition of R waves and P waves, the present application provides an electrocardiogram atrial fibrillation data detection method based on machine learning, which can recognize atrial fibrillation electrocardiogram data without recognizing R waves and P waves, thereby improving the recognition accuracy of atrial fibrillation electrocardiogram data.

[0010] The technical solution of the present application is as follows: an electrocardiogram atrial fibrillation data detection method based on machine learning, comprising the following steps:

[0011] S1: collecting original electrocardiogram data;

[0012] characterized in that it further comprises the following steps:

[0013] S2: segmenting the waveform ECG of the original electrocardiogram data;

[0014] According to the preset segmentation length, the original electrocardiogram data is segmented equally, and the obtained electrocardiogram picture segment is recorded as electrocardiogram picture segment one;

[0015] The number of the electrocardiogram picture segment one is recorded as x;

[0016] S3: performing continuous n times of different size sampling operations on each of the electrocardiogram picture segment one, to obtain the corresponding sampling operation result;

[0017] The sampling operation includes: sequentially performing one downsampling and one upsampling;

[0018] S4: counting the original data of each of the electrocardiogram picture segment one and the corresponding sampling operation result, and recording the distance at each sampling point as feature distance Distance;

[0019] S5: randomly selecting x points in the original electrocardiogram data as starting points, and cutting according to the segmentation length; cutting out x equal-length electrocardiogram picture segments two;

[0020] S6: obtaining each of the electrocardiogram picture segments two one by one, searching in the original electrocardiogram data to obtain similar segments, and counting the number of similar segments corresponding to each of the electrocardiogram picture segments two, recorded as similar number Similar;

[0021] S7: constructing an electrocardiogram feature matrix K based on the feature distance Distance and the similar number Similar;

[0022] K = [Distance; Similar], the matrix size of K is [2, x];

[0023] S8: Constructing an electrocardio wave classification model based on a machine learning algorithm model;

[0024] Based on the historical data, an electrocardio wave feature matrix K is constructed to form a training set, and the electrocardio wave classification model is trained to obtain a trained electrocardio wave classification model;

[0025] S9: Obtaining electrocardio data to be identified, calculating the corresponding electrocardio wave feature matrix K, and sending the electrocardio wave feature matrix K into the classification model for classification to obtain the identification result of the electrocardio data to be identified, and completing the detection of the electrocardio data reaching atrial fibrillation data.

[0026] It is further characterized in that:

[0027] The segmentation length is set to be greater than or equal to 2 seconds;

[0028] In step S3, the value of the sampling operation number n is: n≥5;

[0029] The number x of the electrocardio picture segments one and the electrocardio picture segments two satisfies the condition: x≥2;

[0030] In step S4, the calculation method of the feature distance Distance is:

[0031] Distance=[(ECG′1-ECG 1 1) 2 +(ECG′2-ECG 1 2) 2 +…+(ECG′ t -ECG 1 t ) 2 ];

[0032] Wherein, t is the horizontal coordinate of the electrocardio picture segment, including the total number of sampling points participating in the calculation, (ECG 1 1, ECG 1 2……ECG 1 t ) is the value at each sampling point in the electrocardio picture segment one; (ECG′1, ECG′2……ECG′ t ) is the value at each sampling point in the electrocardio picture segment of the sampling operation result;

[0033] In step S6, the judgment method of the similar segment is as follows:

[0034] a1: Obtaining each electrocardio picture segment two one by one, denoted as: a segment to be searched;

[0035] Initialize the corresponding similar number Similar to 0;

[0036] a2: read the first sampling point of the original electrocardio data, denoted as: starting point;

[0037] a3: based on the starting point, obtain electrocardiogram data of the segmentation length backward, denoted as: to-be-compared segment;

[0038] a4: calculate the feature distance Distance of the to-be-retrieved segment and the to-be-compared segment, denoted as: D;

[0039] a5: compare D and a preset similarity threshold S;

[0040] if D>S, it indicates that the two are not similar, and step a7 is executed;

[0041] otherwise, it indicates that the two are similar, and step a6 is executed;

[0042] a6: add one to the similar number Similar corresponding to the to-be-retrieved segment, and then execute step a7;

[0043] a7: obtain the next sampling point, denoted as: starting point, and execute steps a4-a5 cyclically until all sampling points in the original electrocardio data participate in calculation;

[0044] The electrocardio wave classification model is constructed based on a support vector machine model.

[0045] The method provided by the application is based on machine learning, and utilizes the characteristics of unstable interval between R waves of atrial fibrillation electrocardio data and no obvious single P wave. The waveform features are emphasized through sampling operation, and waveform feature data Distance is obtained. The irregular atrial fibrillation electrocardio data and the low waveform repetition probability are utilized to construct waveform feature data Similar. The electrocardio wave classification model is constructed based on a machine learning algorithm, and the atrial fibrillation electrocardio data and normal electrocardio data are classified according to two waveform feature data. In the waveform recognition process of the method, R wave and P wave recognition in the electrocardiogram waveform is not required, a large amount of calculation process is avoided, specific waveform features of the atrial fibrillation electrocardio data are not required to be described, image recognition of specific atrial fibrillation electrocardio waveform is not required, and the normal electrocardio waveform data and the atrial fibrillation electrocardiogram waveform data are classified based on the waveform difference points of the atrial fibrillation electrocardio waveform and the normal electrocardio data. The overall classification idea is simple, conforms to the irregular characteristics of the atrial fibrillation electrocardio waveform, the classification speed is fast, and the method is extremely practical. BRIEF DESCRIPTION OF DRAWINGS

[0046] Figure 1 is a comparison diagram of normal electrocardio data and atrial fibrillation electrocardio data;

[0047] Figure 2 is an atrial fibrillation electrocardiogram resampling example;

[0048] Figure 3 For normal ECG resampling example;

[0049] Figure 4 For ECG similar segment example 1;

[0050] Figure 5 For ECG similar segment example 2;

[0051] Figure 6 For ECG similar segment example 3;

[0052] Figure 7 The present application is based on the flowchart of the machine learning ECG atrial fibrillation data detection method. DETAILED DESCRIPTION

[0053] As Figure 1 The comparison chart of normal ECG data and atrial fibrillation ECG data can be observed that the interval between R waves of normal ECG is stable, and there is a clear and stable P wave, the interval between R waves of atrial fibrillation ECG is unstable, and there is no clear P wave, instead of irregular wavy shape of fibrillation wave. In the traditional atrial fibrillation recognition algorithm, P wave, R wave, and the waveform between P wave and R wave need to be recognized, and whether the to-be-recognized ECG is atrial fibrillation data is judged based on the recognition result of the waveform. The recognition result is related to the waveform recognition result of the P wave and R wave. If the recognition of R wave and P wave is not very accurate, it will cause the failure of atrial fibrillation recognition. The present application is a method for detecting atrial fibrillation without recognizing R wave and P wave, which avoids a large amount of calculation process of waveform recognition, and can also improve the recognition accuracy.

[0054] As Figure 7 The present application includes a machine learning-based ECG atrial fibrillation data detection method, which includes the following steps.

[0055] S1: Collecting original ECG data.

[0056] S2: Segmenting the waveform ECG of the original ECG data;

[0057] According to the preset segmentation length, the original ECG data is segmented equally, and the obtained ECG picture segment is recorded as: ECG picture segment one (ECG'1, ECG'2…ECG'x). x The number of ECG picture segment one is recorded as x.

[0058] In the implementation, the segmentation length is set according to the total length of the original ECG data. In order to ensure that there is enough data in the subsequent feature matrix K, the value of the segmentation length should ensure that the value of the number of ECG picture segment one x meets the condition: x≥2, and in order to ensure that the ECG segment includes enough data features, the segmentation length meets the condition: segmentation length≥2 seconds.

[0059] This application is attached Figures 1 to 6 The sampling frequency is 128, and the horizontal axis represents the time sampling point. In this embodiment, the segmentation length is set to 2 seconds; it is assumed that the original data is segmented based on 2 seconds, resulting in two ECG segments, i.e., x = 2. The original ECG data in this embodiment is atrial fibrillation ECG data, and the segmented fragments include both fragments with atrial fibrillation ECG data characteristics and fragments of normal ECG data. It is assumed that after this segmentation, the two ECG segments obtained include one normal ECG data and one atrial fibrillation ECG data.

[0060] S3: Perform n consecutive sampling operations of different sizes on all ECG image segments to obtain the corresponding sampling operation results;

[0061] The sampling operation includes: one downsampling and one upsampling performed sequentially.

[0062] S4: Calculate the raw data and corresponding sampling results for each ECG image segment, and denote the distance at each sampling point as: Feature Distance. e .

[0063] In this method, the feature distance Distanc e The calculation method is as follows:

[0064] Distance = [(ECG′1-ECG)] 1 1) 2 +(ECG′2-ECG 1 2) 2 +…+(ECG′ t -ECG 1 t ) 2 )];

[0065] Where t represents the sampling point of the abscissa of the electrocardiogram (ECG). 1 1. ECG 1 2...ECG 1 t (ECG′1, ECG′2, ..., ECG′) represents the value at each sampling point in segment one of the electrocardiogram; t ) represents the value at each sampling point in the electrocardiogram segment resulting from the sampling operation.

[0066] That is, such as Figure 2 The atrial fibrillation ECG data shown includes over three thousand sampling points. Based on a 2-second interval... Figure 2 The electrocardiogram data is segmented and divided into... x = 12 ECG segments, each individual ECG segment includes t = 256 sampling points.

[0067] Distance 房颤 = [Distance1, Distance2,..., Distance 12 ];

[0068] Then, the feature distance Distanc e e of the individual electrocardio data is calculated specifically.

[0069] Distance1= [(ECG'1-ECG 1 1) 2 +(ECG'2-ECG 1 2) 2 ... (ECG'- ECG 256 - ECG 1 256 ) 2 ].

[0070] Since the atrial fibrillation waveform has a large number of irregular and chaotic fibrillation waves, and the position of the R wave is uncertain; in contrast, the normal electrocardio wave is more regular and smoother. The up-sampling process after down-sampling is equivalent to predicting the current data with surrounding data. In this application, the features in the electrocardio picture segment are strengthened by using the operation, so that the features are more prominent. Therefore, after multiple down-sampling and up-sampling of different sizes, the atrial fibrillation wave is more distorted, and the normal electrocardio wave is restored to be closer to the original data. Thus, the Distance of the normal electrocardio is smaller, and the Distance of the atrial fibrillation wave is larger. The value of the sampling operation number n is set to ensure that the electrocardio wave data features are strengthened to meet the calculation needs, and the value of n satisfies: n≥5. In this embodiment, n is set to 7.

[0071] In this embodiment, the ECG segment is subjected to seven sampling operations (down-sampling first and then up-sampling), and the sampling frequencies are set to 2, 2, 3, 5, 3, 2, and 5, respectively. The comparison chart of the atrial fibrillation data re-sampled waveform obtained after 7 sampling operations on the atrial fibrillation electrocardio data and the original atrial fibrillation electrocardio is shown in Figure 2 The comparison chart of the normal data re-sampled waveform obtained after 7 sampling operations on the normal electrocardio data and the original normal electrocardio is shown in Figure 3 After strengthening the features, the data difference is calculated at each sampling point on the original data and the data after down-sampling and up-sampling.

[0072] Suppose that the original electrocardio data is segmented into two electrocardio segments, and the feature distances obtained after calculation are Distance 房颤1 and Distance 正常; assuming that the feature distance Distance of the atrial fibrillation electrocardiogram is 5.42, and the feature distance Distance of the normal electrocardiogram is 1.16. The feature distance Distance of the original electrocardiogram data is expressed as: Distance = [Distance 房颤1 , Distance 正常 )] = [5.42, 1.16].

[0073] S5: In order to ensure that the final constructed electrocardiogram feature matrix K, the number of electrocardiogram image segments two is kept consistent with the number of electrocardiogram image segments one. In the original electrocardiogram data, x points are randomly selected as starting points, and cutting is performed according to the segmentation length; x electrocardiogram image segments two (ECG 2 1, ECG 2 2... ECG 2 x ) are cut out.

[0074] S6: Each electrocardiogram image segment two is obtained one by one, searched in the original electrocardiogram data, similar segments are obtained, and the number of similar segments corresponding to each electrocardiogram image segment two is counted, denoted as: Similar.

[0075] In step S6, the following steps are included in detail:

[0076] a1: Each electrocardiogram image segment two is obtained one by one, denoted as: to-be-searched segment;

[0077] The corresponding number of similar segments Similar is initialized to 0;

[0078] a2: The first sampling point of the original electrocardiogram data is read, denoted as: starting point;

[0079] a3: The electrocardiogram data of the segmentation length is obtained based on the starting point, denoted as: to-be-compared segment;

[0080] a4: The feature distance Distance of the to-be-searched segment and the to-be-compared segment is calculated, denoted as: D;

[0081] a5: D and the preset similarity threshold S are compared;

[0082] If D > S, it means that the two are not similar, and step a7 is executed;

[0083] Otherwise, it means that the two are similar, and step a6 is executed;

[0084] a6: The number of similar segments Similar corresponding to the to-be-searched segment is incremented by one, and then step a7 is executed;

[0085] a7: Obtain the next sampling point, denoted as: start point, and execute steps a4-a5 in a loop until all sampling points in the original ECG data participate in the calculation.

[0086] wherein the similarity threshold S is obtained according to historical data statistics, and in the embodiment, the similarity threshold S takes a value of 2.64. All the similarity numbers Similar corresponding to the original ECG data are denoted as: Similar = (S1, S2,..., S x ). For specific embodiments of similar ECG data, refer to the Figure 4 、 Figure 5 and Figure 6 of the accompanying drawings.

[0087] Generally, since the normal ECG R-wave position is stable, the overall ECG does not have irregular waveforms, therefore, the normal ECG can find multiple similar segments, and the atrial fibrillation ECG cannot find similar segments, i.e., the corresponding S takes a value of 0 or a smaller value. In the method, based on the difference between the atrial fibrillation ECG and the normal ECG, another feature parameter is used to distinguish between the two types of ECG data.

[0088] S7: Construct an ECG wave feature matrix K based on Distance and Similar.

[0089] K = [Distance; Similar], and the matrix size of K is [2, x].

[0090] When x is equal to 2, the matrix size of K is [2, 2], i.e., K = [Distance1, Distance2; S1, S2].

[0091] In a specific embodiment, when x = 2, the two-dimensional matrix of the atrial fibrillation ECG data is [5.42, 6.18; 0, 0], and the two-dimensional matrix of the normal ECG data is [1.16, 0.95; 5, 6].

[0092] S8: Construct an ECG wave classification model based on a machine learning algorithm model.

[0093] The ECG wave classification model can be implemented based on any classification model in the machine learning algorithm model in the prior art. The ECG wave classification model in the embodiment is constructed based on a support vector machine model.

[0094] Based on the ECG wave feature matrix K of the historical data, a training set is constructed, labels are constructed for the normal ECG and the atrial fibrillation ECG data respectively, and then the ECG wave classification model is trained based on the training set to obtain a trained ECG wave classification model.

[0095] S9: obtaining the to-be-identified electrocardiogram data, calculating the corresponding electrocardiogram feature matrix K of the to-be-identified electrocardiogram data, sending the electrocardiogram feature matrix K into the classification model for classification, obtaining the identification result of the to-be-identified electrocardiogram data, and completing the detection of the electrocardiogram atrial fibrillation data.

[0096] After the technical solution of the present application is used, the to-be-identified electrocardiogram data is segmented, and the data characteristics of the electrocardiogram segment of the to-be-identified electrocardiogram are strengthened, so that the specific waveform of the to-be-identified electrocardiogram does not need to be identified, and the identification of the atrial fibrillation electrocardiogram data can be realized based on the unique irregular characteristics of the atrial fibrillation electrocardiogram data and the difference between the atrial fibrillation electrocardiogram data and normal electrocardiogram data; the present method has small calculation amount and high identification efficiency.

Claims

1. A method for detecting electrocardiogram (ECG) atrial fibrillation data based on machine learning, comprising the following steps: S1: collecting original ECG data; characterized in that it further comprises the following steps: S2: segmenting the original ECG data into waveforms; segmenting the original ECG data into equal-length segments according to a preset segmentation length, and recording the obtained ECG image segments as ECG image segment 1; the number of ECG image segments 1 is recorded as x; S3: performing continuous n times of different size sampling operations on each of the ECG image segment 1 to obtain the corresponding sampling operation results; the sampling operation comprises: sequentially performing one downsampling and one upsampling; S4: counting the original data of each ECG image segment 1 and the corresponding sampling operation results, and recording the distance at each sampling point as a feature distance Distance; in step S4, the calculation method of the feature distance Distance is as follows: Distance=[(ECG'1-ECG 1 1 ) 2 + (ECG'2-ECG 1 2) 2 +…+(ECG' t -ECG 1 t ) 2 )] wherein t is the horizontal coordinate of the ECG picture segment, including the total number of sampling points involved in the calculation, (ECG 1 1,ECG 1 2……ECG 1 t ) is the value at each sampling point in the ECG picture segment; (ECG'1,ECG'2……ECG' t ) is the value at each sampling point in the ECG picture segment resulting from the sampling operation; S5: randomly selecting x points in the original ECG data as starting points, and cutting according to the segmentation length; cutting out x equal-length ECG image segments 2; S6: obtaining each of the ECG image segments 2 one by one, searching in the original ECG data to obtain similar segments, and counting the number of similar segments corresponding to each of the ECG image segments 2, recorded as Similar; in step S6, the judgment method of the similar segment is as follows: a1: obtaining each of the ECG image segments 2 one by one, recorded as a to-be-searched segment; initializing the corresponding similar number Similar to 0; a2: reading the first sampling point of the original ECG data, recorded as a starting point; a3: obtaining the ECG data of the segmentation length based on the starting point, recorded as a to-be-compared segment; a4: calculating the feature distance Distance between the to-be-searched segment and the to-be-compared segment, recorded as D; a5: comparing D and a preset similarity threshold S; if D>S, it means that they are not similar, and step a7 is executed; otherwise, it means that they are similar, and step a6 is executed; a6: adding 1 to the similar number Similar corresponding to the to-be-searched segment, and then executing step a7; a7: obtaining the next sampling point, recorded as a starting point, and executing steps a4-a5 in a loop until all sampling points in the original ECG data are involved in the calculation; S7: constructing an ECG wave feature matrix K based on the feature distance Distance and the similar number Similar; K=[Distance; Similar], the matrix size of K is [2, x]; S8: constructing an ECG wave classification model based on a machine learning algorithm model; constructing a training set based on the ECG wave feature matrix K of the historical data, training the ECG wave classification model, and obtaining the trained ECG wave classification model; S9: obtaining to-be-identified ECG data, calculating the corresponding ECG wave feature matrix K, inputting the ECG wave feature matrix K into the classification model for classification, obtaining the identification result of the to-be-identified ECG data, and completing the detection of the ECG atrial fibrillation data.

2. The method of claim 1, wherein the method is based on machine learning. The segmentation length is set to be greater than or equal to 2 seconds. 3.The machine learning based electrocardiogram atrial fibrillation data detection method of claim 1, wherein: In step S3, the value of the sampling operation times n is: n >= 5. 4.The machine learning based electrocardiogram atrial fibrillation data detection method of claim 1, wherein: The value of the number x of the electrocardio picture segment one and the electrocardio picture segment two satisfies the condition: x >= 2.

5. The machine learning based electrocardiogram atrial fibrillation data detection method of claim 1, wherein: The electrocardio wave classification model is constructed based on a support vector machine model.

Citation Information

Patent Citations

  • System for creating composite map

    CN114269272A

  • Method of processing electrocardiogram signal

    US20240008791A1