Atrial fibrillation identification system and method
By performing R-wave positioning and feature extraction of electrocardiogram data, combined with fusion network and classification network, the problem of low atrial fibrillation recognition accuracy in the prior art is solved, and higher recognition accuracy and distinction ability are achieved.
Patent Information
- Application Number
- CN202311848085.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-29
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2043-12-29
AI Technical Summary
The prior art has problems in the identification of atrial fibrillation with low accuracy, susceptibility to noise, and equipment differences, resulting in large discrimination errors.
By performing R-wave positioning of the received ECG data, intercepting the ECG data containing RRI, extracting multiple ECG features in the time domain, frequency domain and nonlinear domain, forming a feature matrix, and using a fusion network and classification network for atrial fibrillation identification.
It improves the accuracy of atrial fibrillation identification, reduces errors, and can effectively distinguish atrial fibrillation from other arrhythmias.
Smart Images

Figure CN117883095B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electrocardiogram detection, and in particular to an atrial fibrillation identification system and method. Background Art
[0002] Atrial fibrillation (AF) is the most common supraventricular arrhythmia in clinical practice, and its prevalence increases with age. According to statistics, one in four people in the world suffers from atrial fibrillation. The occurrence of atrial fibrillation is often accompanied by serious complications, such as heart failure, stroke, thromboembolism and other events. Heart surgery can also cause atrial fibrillation, thereby increasing mortality.
[0003] The prevention and control of atrial fibrillation is difficult to be effectively implemented. The main difficulty lies in the fact that the early onset of atrial fibrillation is short, the onset is sudden, the symptoms disappear quickly, and the symptoms are easily ignored. Some people even have no symptoms in the early stage of the disease. In clinical practice, doctors usually diagnose atrial fibrillation by manually observing the electrocardiogram, which is inefficient and subjective.
[0004] Currently, most technologies for identifying atrial fibrillation based on artificial intelligence still use the presence of P waves and the disorder of the RR interval as the standard. However, the P wave is easily affected by noise, and different devices have different collection positions, so the distorted electrocardiograms produced are different from the standard electrocardiograms, and the P wave may almost disappear, resulting in large discrimination errors.
[0005] Some people will use end-to-end deep neural networks to identify atrial fibrillation. Instead of extracting features from ECG signals, the collected signals are directly put into the deep neural network for learning to determine whether the patient has atrial fibrillation.
[0006] Another group of people will combine ECG features with machine learning. They will first extract features related to atrial fibrillation from the ECG and then put the extracted features into machine learning to achieve the effect of atrial fibrillation identification.
[0007] The P wave is easily affected by noise, and the performance characteristics of the P wave may vary from person to person, resulting in large errors in the judgment results. If the end-to-end deep neural network does not extract ECG features, the poor signal will have a greater impact on the results. Most judgments based on the combination of ECG features and machines simply extract features from a one-sided domain and do not exclude the impact of other diseases on the model. Summary of the invention
[0008] The purpose of the present invention is to provide an atrial fibrillation identification system and method, which improves the accuracy of atrial fibrillation identification.
[0009] To achieve the above object, the present invention provides the following solutions:
[0010] An atrial fibrillation identification system comprises: a main control module and a host computer; the host computer is connected to the main control module;
[0011] The main control module is used for:
[0012] Perform R wave positioning on the received ECG data, and extract ECG data containing a first set number of RRIs from the ECG data after R wave positioning; RRI is the horizontal coordinate difference between two adjacent R waves;
[0013] Extracting multiple ECG features from ECG data containing a first set number of RRIs, and forming a first feature matrix with the extracted multiple ECG features; the multiple ECG features include time domain features, frequency domain features, and nonlinear domain features; the time domain features include atrial fibrillation feature values determined in the ECG data based on the RRI and the RRI average value;
[0014] Inputting the first characteristic matrix into an atrial fibrillation identification model to obtain an atrial fibrillation identification result; the atrial fibrillation identification result is atrial fibrillation or non-atrial fibrillation; the atrial fibrillation identification model is obtained by training a neural network using a training set;
[0015] The neural network includes a fusion network and a classification network; the fusion network is used to obtain the fusion features of the first feature matrix according to the multi-scale convolution and multi-head attention mechanism; the classification network classifies the fusion features according to the long short-term memory network and the multi-layer perceptron to obtain the atrial fibrillation recognition result;
[0016] The host computer is used to display the atrial fibrillation identification result.
[0017] Optionally, the calculation process of the atrial fibrillation characteristic value is:
[0018] Subtract each RRI in the electrocardiogram data containing a first set number of RRIs from the average RRI value to obtain a difference value sequence;
[0019] According to the formula Get the array F(X); where D(X i ) represents the difference between the ith RRI and the average RRI, F(X i ) is the i-th value in array F(X);
[0020] A window of size 3 is used to traverse the array F(X). If all three values in the window are 1, the statistical window value is 1, otherwise the statistical window value is 0, and the number of statistical window values 1 is used as the atrial fibrillation characteristic value.
[0021] Optionally, the host computer is also used to input a first set quantity value; the first set quantity is greater than or equal to 9.
[0022] Optionally, the fusion network is used for:
[0023] Using a second set number of convolution kernels of different sizes to convolve the first feature matrix respectively to obtain a second set number of second feature matrices;
[0024] Initializing a second set number of first score matrices, each first score matrix corresponding to a second feature matrix;
[0025] The second set number of first score matrices are subjected to a multi-head attention mechanism to obtain a second score matrix corresponding to each second feature matrix;
[0026] Multiply each of the first feature matrices by the corresponding second score matrix to obtain a first multiplication matrix, and concatenate a second set number of the obtained first multiplication matrices to obtain a third feature matrix;
[0027] Initializing a second set number of third score matrices, each third score matrix corresponding to a second feature matrix;
[0028] The second set number of third score matrices are subjected to a multi-head attention mechanism to obtain a fourth score matrix corresponding to each second feature matrix;
[0029] Multiplying the third feature matrix and the fourth score matrix respectively to obtain a second set number of second multiplication matrices;
[0030] The obtained second set number of second multiplication matrices are concatenated to obtain a fourth feature matrix; the fourth feature matrix is the fusion feature.
[0031] Optionally, the second set number in the fusion network is 6, and the 6 convolution kernels of different sizes are 1*1, 2*2, 3*3, 4*4, 5*5, and 6*6 respectively.
[0032] Optionally, the classification network includes a first long short-term memory network, a second long short-term memory network, a multilayer perceptron and a classifier connected in sequence.
[0033] Optionally, the sample data in the training set includes input data and label data, the input data is the first feature matrix of a normal ECG sample signal, an atrial fibrillation sample signal, an atrial flutter sample signal or a premature beat sample signal, the label data corresponding to the normal ECG sample signal is normal, the label data corresponding to the atrial fibrillation sample signal is atrial fibrillation, and the label data corresponding to the atrial flutter sample signal or the premature beat sample signal is other arrhythmias.
[0034] Optionally, it also includes an ECG acquisition module, which is connected to the main control module. The ECG acquisition module is used to filter the collected ECG signals using a 0.3 Hz high-pass filter, a 50 Hz notch filter and a 50 Hz low-pass filter in sequence, and send the filtered ECG signals to the main control module.
[0035] Optionally, it further includes a communication module, which is used to send the atrial fibrillation identification result output by the main control module to the host computer by using WIFI, 4G or Bluetooth;
[0036] The host computer is a computer, a tablet or a mobile phone.
[0037] The present invention also discloses a method for identifying atrial fibrillation, comprising:
[0038] The main control module performs R wave positioning on the received ECG data, and intercepts the ECG data containing a first set number of RRIs from the ECG data after R wave positioning;
[0039] The main control module extracts a plurality of ECG features from the ECG data containing a first set number of RRIs, and forms a first feature matrix with the extracted plurality of ECG features; the plurality of ECG features include time domain features, frequency domain features and nonlinear domain features;
[0040] The main control module inputs the first feature matrix into an atrial fibrillation identification model to obtain an atrial fibrillation identification result; the atrial fibrillation identification result is atrial fibrillation or non-atrial fibrillation; the atrial fibrillation identification model is obtained by training a neural network using a training set;
[0041] The neural network includes a fusion network and a classification network; the fusion network is used to obtain the fusion features of the first feature matrix according to the multi-scale convolution and multi-head attention mechanism; the classification network classifies the fusion features according to the long short-term memory network and the multi-layer perceptron to obtain the atrial fibrillation recognition result;
[0042] The host computer displays the atrial fibrillation identification result.
[0043] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0044] The present invention extracts multiple ECG features from ECG data containing a first set number of RRIs, wherein the time domain features in the ECG features include atrial fibrillation feature values determined in the ECG data based on the RRI and the RRI average value, and the atrial fibrillation feature values have a large correlation with atrial fibrillation, thereby improving the accuracy of atrial fibrillation recognition. In addition, atrial fibrillation is identified by using a fusion network and a classification network to distinguish atrial fibrillation from ECG data of other arrhythmias, thereby further improving the accuracy of atrial fibrillation recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0046] Figure 1 A schematic diagram of the structure of an atrial fibrillation identification system provided by an embodiment of the present invention;
[0047] Figure 2 A schematic diagram of the process of constructing an atrial fibrillation identification model provided by an embodiment of the present invention;
[0048] Figure 3 A schematic diagram of the training process of an atrial fibrillation identification model provided by an embodiment of the present invention;
[0049] Figure 4 A schematic diagram of the fusion network principle provided by an embodiment of the present invention;
[0050] Figure 5 A schematic diagram of the principle of the self-attention mechanism provided by an embodiment of the present invention;
[0051] Figure 6 A schematic diagram of the principle of the multi-head attention mechanism provided by an embodiment of the present invention;
[0052] Figure 7 A schematic diagram of the classification network principle provided by an embodiment of the present invention;
[0053] Figure 8 A schematic diagram of judgment indicators of an atrial fibrillation identification model provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0055] The purpose of the present invention is to provide an atrial fibrillation identification system and method, which improves the accuracy of atrial fibrillation identification.
[0056] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0057] Example 1
[0058] The characteristics of atrial fibrillation signals are the disappearance of P waves and extremely irregular RR intervals. However, other arrhythmia signals may also have irregular RR intervals. Therefore, two signals that are similar to atrial fibrillation in RR interval performance are selected, namely atrial flutter signals and premature beat signals.
[0059] like Figure 1 As shown, this embodiment provides an atrial fibrillation identification system, which includes: a main control module and a host computer; the host computer is connected to the main control module.
[0060] The atrial fibrillation identification system described in this embodiment also includes an ECG acquisition module, which is connected to the main control module. The ECG acquisition module is used to filter the collected ECG signals using a 0.3 Hz high-pass filter, a 50 Hz notch filter, and a 50 Hz low-pass filter in sequence, and send the filtered ECG signals to the main control module.
[0061] The atrial fibrillation identification system described in this embodiment further includes a communication module, which is used to send the atrial fibrillation identification result output by the main control module to the host computer by using WIFI, 4G or Bluetooth.
[0062] The ECG acquisition module is also used to amplify the ECG signal before filtering the ECG signal.
[0063] The main control module is used for:
[0064] Perform R wave positioning on the received ECG data, and extract ECG data containing a first set number of RRIs from the ECG data after R wave positioning; RRI is the horizontal coordinate difference between two adjacent R waves.
[0065] Multiple ECG features are extracted from ECG data containing a first set number of RRIs, and the extracted multiple ECG features are combined into a first feature matrix; the multiple ECG features include time domain features, frequency domain features and nonlinear domain features; the time domain features include atrial fibrillation feature values determined in the ECG data based on RRI and the RRI average value.
[0066] The first characteristic matrix is input into an atrial fibrillation identification model to obtain an atrial fibrillation identification result; the atrial fibrillation identification result is atrial fibrillation or non-atrial fibrillation; the atrial fibrillation identification model is obtained by training a neural network using a training set.
[0067] The neural network includes a fusion network and a classification network; the fusion network is used to obtain the fusion features of the first feature matrix based on multi-scale convolution and multi-head attention mechanism; the classification network classifies the fusion features according to the long short-term memory network and the multi-layer perceptron to obtain the atrial fibrillation recognition result.
[0068] The host computer is used to display the ECG waveform collected by the ECG collection module and the atrial fibrillation recognition result.
[0069] The ECG acquisition module specifically collects ECG signals from the glove device, and uses a 0.3Hz high-pass filter to filter out baseline drift, a 50Hz notch filter to filter out power frequency interference, and a 50Hz low-pass filter to filter out myoelectric interference.
[0070] The host computer is also used to issue an alarm prompt message when the atrial fibrillation identification result is atrial fibrillation. The prompt function of the display function of the host computer is realized through a computer APP, a mobile phone APP, a tablet APP or a WeChat applet.
[0071] The atrial fibrillation identification system described in this embodiment further includes a power management module, which is used to supply power to the ECG acquisition module, the main control module, the communication module and the host computer.
[0072] The calculation process of the atrial fibrillation characteristic value is:
[0073] Subtract each RRI in the electrocardiogram data containing a first set number of RRIs from the average RRI value to obtain a difference sequence.
[0074] According to the formula Get the array F(X); where D(X i ) represents the difference between the ith RRI and the average RRI, F(X i ) is the i-th value in array F(X).
[0075] A window of size 3 is used to traverse the array F(X). If all three values in the window are 1, the statistical window value is 1, otherwise the statistical window value is 0, and the number of statistical window values 1 is used as the atrial fibrillation characteristic value.
[0076] The host computer is also used to input a first set quantity value; the first set quantity is greater than or equal to 9.
[0077] The sample data in the training set includes input data and label data, the input data is the first feature matrix of a normal ECG sample signal, an atrial fibrillation sample signal, an atrial flutter sample signal or a premature beat sample signal, the label data corresponding to the normal ECG sample signal is normal, the label data corresponding to the atrial fibrillation sample signal is atrial fibrillation, and the label data corresponding to the atrial flutter sample signal or the premature beat sample signal is other arrhythmias.
[0078] Other arrhythmias refer to arrhythmias other than atrial fibrillation, including atrial flutter and premature beats.
[0079] The host computer is a computer, a tablet or a mobile phone.
[0080] The overall process of building an atrial fibrillation identification model Figure 2 As shown, the atrial fibrillation identification model is used to identify atrial fibrillation signals from normal, atrial fibrillation, premature beats, and atrial flutter signals.
[0081] For the construction of the data set: normal signals were extracted from the MIT-BIH normal sinus rhythm database, the sampling rate of which was 128Hz; atrial fibrillation signals and atrial flutter signals were extracted from the MIT-BIH atrial fibrillation database, the sampling rate of which was 250Hz; atrial fibrillation signals were extracted from the CinC2017 atrial fibrillation challenge database, the sampling rate of which was 300Hz; premature beat signals were extracted from the MIT-BIH arrhythmia database, the sampling rate of which was 360Hz. A portable 12-lead ECG acquisition device was used to collect normal, premature beat, atrial fibrillation, and atrial flutter signals, the sampling rate of which was 500HZ.
[0082] When arrhythmia occurs, its RR interval has different manifestations in the time domain, frequency domain, and nonlinear domain of heart rate variability (HRV). In view of this feature, the first step is to distinguish normal signals from the three types of arrhythmias studied in this paper. According to different manifestations, 14 HRV features are extracted from HRV, namely, time domain feature MEAN RRI ,SDNN RRI 、RMSSD RRI NN50 RRI 、PNN50 RRI 、CV RRI ,SDSD RRI ; Frequency domain characteristics LFn RRI HFn RRI , LFn / HFn RRI ; Nonlinear domain feature SD1 RRI ,SD2 RRI 、SD1 / SD2 RRI , S RRI .
[0083] Before extracting these 14 HRV characteristics, the present invention preprocesses the signals of the four databases and the data collected by the glove device, using a 0.3Hz high-pass filter to filter out baseline drift, a 50Hz notch filter to filter out power frequency interference, and a 50Hz low-pass filter to filter out myoelectric interference. The code for anti-embedded positioning of R waves is written using MATLAB, which is simple to calculate and accurate in positioning. The time segments can be divided according to the number of located R waves, which can effectively avoid the situation of too many or too few collection segments due to inconsistent personal heart rates, and its universality is stronger. At the same time, in order to study the impact of the final judgment of atrial fibrillation when the divided time slices are gradually reduced, the time slice division of the present invention is reduced from 60 RRI to 5 RRI. Which time segment is used specifically can be issued from the host computer, and the length of the data to be judged can be input. Assuming that the data of 60RRI length is to be judged, the corresponding time segment is set on the host computer, and the ECG signal of the corresponding length is collected according to this time segment. The interception standard is to locate an R wave and then continue for a number of R waves plus 1, which must be 1 larger than the number of RR intervals finally obtained. At this time, the number of located RRIs can be obtained, and the 14 given features can be calculated respectively.
[0084] The R wave positioning in the main control module adopts the adaptive threshold method. First, a linear table with a capacity of 50 is set. The ECG signal is passed through once, and the maximum and minimum values are found in real time. At regular intervals, the threshold will be updated in proportion according to the maximum and minimum values. At the same time, the value in the middle of the linear table is compared in real time to see if it is larger than both sides. If it is satisfied, it is compared with the threshold to see if it is also larger than the threshold. If it is also satisfied, the R peak is found. The calculation is simple and the positioning is accurate. The time segment can be divided according to the number of located R waves. This can effectively avoid the situation of too many or too few collection segments due to inconsistent personal heart rates, and its universality is stronger. At the same time, in order to study the impact of the final judgment of atrial fibrillation when the divided time slices are gradually reduced, the time slice division of the present invention is reduced from 60 RRI to 5 RRI, where the interception standard is to locate an R wave and continue several R waves plus 1, which is 1 larger than the number of RR intervals finally obtained. At this time, the number of located RRIs can be obtained, and the 14 given features are calculated respectively.
[0085] The formula for RRI is as follows:
[0086] RRI i =R i+1 -R i ;
[0087] Among them, R i+1 is the horizontal coordinate value of the ith R wave, R i is the horizontal coordinate value of the i-1th R wave, RRI i is the i-th RRI value, where i is a positive integer greater than 1.
[0088] Each RR interval is normalized according to time according to different sampling rates, and the RR interval is converted into the time domain.
[0089]
[0090] T RRI The RR interval is converted to the time domain and the unit is milliseconds (ms). index is the number of sampling points corresponding to the RR interval, F S is the sampling rate of each database.
[0091] In T RRI Based on the above, 14 features of HRV are extracted. The formulas of these 14 features are as follows. RRI represents the average RRI, reflecting the average level of RR interval; SDNN RRI RMSSD stands for the standard deviation of RRI. Both sympathetic and parasympathetic nervous system activities have an impact on SDNN, reflecting the overall changes in HRV and the complexity of heart rate variability. RRI Indicates the activity of the sympathetic nervous system. When its value decreases, the vagus nerve function decreases, reflecting the fast-changing components in HRV. RRI Reflects a sudden change in RRI; PNN50 RRI It indicates the percentage of the number of adjacent RR intervals with a difference of more than 50ms in the length of the RR interval sequence, reflecting the activity of the parasympathetic nervous system. The lower its value, the lower the vagus nerve function; CV RRI A statistic used to measure the degree of variation of each value in HRV, indicating the magnitude of relative fluctuation. The larger the coefficient of variation, the larger the distribution range of its variables, and vice versa; SDSD RRI is the standard deviation of RRI, reflecting the change in adjacent RR intervals; LFn RRI Reflects the comprehensive regulation of sympathetic and parasympathetic nerves. The larger the value, the stronger the sympathetic nerve regulation. RRI Reflects the regulation of parasympathetic nerves; LFn RRI / HFn RRI Reflects the balance between sympathetic and parasympathetic nerves. The larger the value, the stronger the sympathetic nerve excitement; the smaller the value, the more dominant the parasympathetic nerve. RRI The semi-minor axis of the ellipse fitted to the Poincare scatter plot represents the degree of change in short-term heart rate variability; SD2 RRI The semi-major axis of the ellipse fitted to the Poincare scatter plot represents the degree of change in short-term heart rate variability; SD1 RRI / SD2 RRI The ratio of the semi-minor axis to the semi-major axis of the Poincare scatter plot fitting ellipse represents the balance between long-term and short-term changes in heart rate variability; SRRI Represents the area of the Poincare diagram fitting ellipse, indicating the dispersion of the RR interval. When the RRI gradually decreases, its frequency domain part will become invalid, so when collecting frequency domain features, it is necessary to interpolate its internal part to obtain the final frequency domain parameters.
[0092]
[0093]
[0094] RMSSD RRI =sqrt(mean((RRI i+1 -RRI i ) 2 ));
[0095] NN50 RRI = count(|RRI i+1 -RRI i |>50ms);
[0096]
[0097]
[0098]
[0099]
[0100]
[0101]
[0102]
[0103] S RRI =π*SD1 RRI *SD2 RRI ;
[0104] Where N represents the number of RRIs in the ECG data.
[0105] The above operations are data preprocessing operations. The correlation of these 14 features in distinguishing normal and other three types of arrhythmia signals is shown in Table 1 based on the analysis results of SPSS software.
[0106] Table 1 Correlation between normal and other three types of arrhythmia signals
[0107]
[0108] Among them, * represents whether there is significance, the number of * represents the strength of significance, and mean represents MEAN RRI, sdnn means SDNN RRI , rmssd represents RMSSD RRI , nn50 means NN50 RRI , pnn50 means PNN50 RRI ,hf represents HFn RRI , lf means LFn RRI , sd1 means SD1 RRI , sd2 means SD2 RRI , sd12 means SD1 / SD2 RRI , s represents S RRI ,cv means CV RRI , sdsd means SDSD RRI .
[0109] It can be seen that the 14 features are more significant in distinguishing normal from arrhythmic signals. The ability of distinguishing atrial fibrillation with the remaining 14 features is still compared with these 14 features, as shown in Table 2. RRI / HFn RRI The significance is weak.
[0110] Table 2 Correlation between atrial fibrillation and 14 characteristics
[0111]
[0112] In order to improve the overall significance, the present invention proposes a new feature (atrial fibrillation feature value) which can be significant in atrial fibrillation and other arrhythmia diseases.
[0113] Replace the LFn in the 14 features with the atrial fibrillation feature value RRI / HFn RRI , 14 new features are obtained. The present invention extracts multiple ECG features from the ECG data containing the first set number of RRIs as the new 14 features.
[0114] According to each divided time segment, taking 60RRI as an example, calculate the MEAN of the 60RRI segment at this time RRI , compare each of your RRI with MEAN RRI Make a difference to get a difference sequence D(X), and take the absolute value of each value in the difference sequence, where X i represents the i-th RRI.
[0115] D(X i )=|RRI i -MEAN RRI |;
[0116] At this time, the operation is performed on the three types of diseases, and three types of difference sequences are obtained. The normal distribution diagram of D(X) corresponding to each type of disease is drawn, and σ is used as the judgment threshold. It is found that D(X) of atrial flutter i ) ranges from 0 to 30.4442, and D(X i ) ranges from 29.6615 to 123.377, and the D(X i ) ranges from 125.8119 to 245.5123. Define this as D(X i ) is greater than 30 and less than 124, F(X i ) is 1; when D(X i ) is less than or equal to 30 or greater than 124, F(X i ) has a value of 0.
[0117]
[0118] At this time, an F(X) array will be obtained, which consists of 1 and 0. At this time, it is found that the F(X) composed of atrial fibrillation data will have continuous 1, while the F(X) of premature beat data will have 1 and 0 alternately, and the F(X) of atrial flutter data will have continuous 0. Use a continuous window of size 3 to count whether the value in the window is 1 (when all 3 values are 1, count 1). If it is 1, record the number of 1s, and the counted number is the final feature NUM (atrial fibrillation feature value). The new feature is statistically analyzed using SPSS software. The correlation between this feature and the other two types of arrhythmia diseases is 24.4%. The significance is **, and the correlation is significant.
[0119] In order to make the new 14 features play a better role in atrial fibrillation identification, the present invention builds a new deep model (atrial fibrillation identification model), which integrates a feature matrix composed of 14 features to make the final result more accurate.
[0120] The fusion network is used to:
[0121] A second set number of convolution kernels of different sizes are used to convolve the first feature matrix respectively to obtain a second set number of second feature matrices.
[0122] A second set number of first score matrices are initialized, each of which corresponds to a second feature matrix.
[0123] The second set number of first score matrices are subjected to the multi-head attention mechanism to obtain a second score matrix corresponding to each second feature matrix.
[0124] Each of the first feature matrices is multiplied by the corresponding second score matrix to obtain a first multiplication matrix, and a second set number of the obtained first multiplication matrices are concatenated to obtain a third feature matrix.
[0125] A second set number of third score matrices are initialized, each of which corresponds to a second feature matrix.
[0126] The second set number of third score matrices are subjected to a multi-head attention mechanism to obtain a fourth score matrix corresponding to each second feature matrix.
[0127] The third feature matrix is multiplied with the fourth score matrix respectively to obtain a second set number of second multiplication matrices.
[0128] The obtained second set number of second multiplication matrices are concatenated to obtain a fourth feature matrix; the fourth feature matrix is the fusion feature.
[0129] The second set number in the fusion network is 6, and the 6 convolution kernels of different sizes are 1*1, 2*2, 3*3, 4*4, 5*5, and 6*6 respectively.
[0130] The classification network includes a first long short-term memory network, a second long short-term memory network, a multi-layer perceptron and a classifier which are connected in sequence.
[0131] As a specific implementation method, according to the feature matrix composed of each different RR interval segment, 6 convolution kernels of different sizes are used, and the sizes of the convolution kernels are 1*1, 2*2, 3*3...6*6, respectively. After convolution with the first feature matrix composed of 14 features, 6 feature matrices A, B, C, D, E, F (second feature matrix) are obtained. Different sizes and multi-layer convolution layers, i.e. multi-scale convolution, are used to extract features more comprehensively; according to each second feature matrix, the corresponding initialization score matrix W1, W2, W3, W4, W5, W6 (first score matrix) is trained through a multi-head attention mechanism to obtain the score matrix W of each feature matrix 11 , W 21 , W 31 , W 41 , W 51 , W 61 (Second score matrix), the core focus of the attention mechanism is to make the network pay more attention to the places where it needs more attention, and to achieve a way of adaptive attention of the network. Multiply the feature matrices A, B, C, D, E, and F with the corresponding score matrices to obtain the new 6 matrices. After Concat, they are spliced in the third dimension to obtain the feature matrix G1 (third feature matrix). Repeat the above steps to initialize the score matrix W' (third score matrix). After the multi-head attention mechanism, the training score matrix W is obtained. 71(Fourth score matrix), the feature matrix G1 and the trained score matrix W 71 Multiply them together to get the new feature matrix (Fourth feature matrix), at this time the feature fusion ends, such as Figure 4 shown.
[0132] The input feature matrix composed of RR intervals is an n*14 feature matrix. After convolution with convolution kernels of different sizes, the six convolution kernels output six feature matrices A, B, C, D, E, and F after convolution. Due to the different sizes of the convolution kernels, the dimensions of the feature matrices after convolution are also different. In the process of convolution, judgment conditions are added to make the scales of A, B, C, D, E, and F the same.
[0133] And randomly initialize the corresponding score matrix W1, W2, W3, W4, W5, W6 for each feature matrix. The score matrix is trained by the multi-head attention mechanism. The attention mechanism can assign a weight coefficient to each element in the data sequence. These elements are usually stored in the form of (k, v). The addressing is completed by calculating the similarity between the query (query, q) and the key (keys, k), and the weight assigned to each value (values, v) is calculated. This weight is also called the attention score (score), which reflects the importance of the retrieved value. Finally, the attention value is obtained by weighted summation.
[0134] q, k, v are obtained through the self-attention mechanism. Assuming that the input is X i After embedding mapping to a i , followed by a i Through three transformation matrices W q , W k , W v Get the corresponding q i , k i , v i .W q , W k , W v With q i , k i , v i The relationship between them is shown as follows:
[0135] q i =a i W q ;
[0136] k i =a i W k ;
[0137] v i=a i W v ;
[0138] Among them, q i I will go to each k later i To match, k i Later, each k i Match, v i Represents from a i The information extracted from q i and k i The matching process can be understood as calculating the correlation between the two. The greater the correlation, the higher the corresponding v i The larger the weight, the greater the Transformer can be parallelized, so q i , k i , v i Can be combined into Q, K, V. Figure 5 Assume that the dimensions of the input Q and K are dk, and the dimension of V is d v , then calculate the dot product of Q and K and divide by Then apply the softmax function to calculate the weights, and the output matrix is:
[0139]
[0140] The multi-head attention mechanism can combine the information learned from different heads and further divide the obtained Q, K, and V into h parts according to the number of heads used. That is, the model is divided into multiple heads to form multiple subspaces, which allows the model to pay attention to different aspects of information and concat the results obtained by each head, such as Figure 6 As shown in the figure, the figure shows that it is divided into two heads and the spliced result is passed through W o (learnable parameters) are integrated and the formula is as follows:
[0141]
[0142] MultiHead(Q,K,V)=Concat(head1,…,head h )W o ;
[0143] Among them, head i is the i-th head.
[0144] The obtained feature matrix Input into the two-layer LSTM (Long Short-Term Memory Network) model and DNN (Multilayer Perceptron) model to obtain the feature matrix like Figure 7As shown. In order to obtain the characteristic relationship between the arrangement order of the 14 features, the LSTM model is used. LSTM can better capture the relationship between the current state and the next state, ignore the feature information of the previous moment, remember some current features, and merge the features of the previous moment with the features of the current moment to more completely reflect the implicit relationship between each feature. DNN can be used for dimensionality reduction. Since the number of features extracted previously is large, putting them into the model will affect the training speed due to the large number of features, so it is used here for dimensionality reduction to facilitate model training. At this time The feature is the feature for final classification. Using the final classifier of DNN, the final feature is first used for binary classification to distinguish normal signals from arrhythmia signals, and then atrial fibrillation signals and non-atrial fibrillation signals (premature beats, atrial flutter) are identified from arrhythmia signals, and finally atrial fibrillation signals are identified.
[0145] The ratio of the training set to the test set of the atrial fibrillation recognition model is 8:2. The data in the database is used as the training set, and the data collected by the glove is used as the test set. The judgment results of the model are based on the accuracy (ACC), precision (Precision), F1 score, and sensitivity (Se) as judgment indicators. Figure 8 shown.
[0146]
[0147]
[0148]
[0149]
[0150] TP is true positive, FP is false positive, FN is false negative, and TN is true negative. The present invention gradually reduces the longest acquisition time from 60RRI to 5RRI. On the one hand, it verifies that the accuracy of the final result is affected by the length of the input model time segment. As the time length decreases, the final score decreases. In the application of the device, if you want to quickly determine whether the patient has atrial fibrillation, you can set the minimum time segment. If you want to get a more accurate result, you can appropriately increase the time segment, which is more reliable.
[0151] In summary, the original 14 features are effective in distinguishing normal data from atrial fibrillation, premature beats, and atrial flutter data, but they are not effective in distinguishing atrial fibrillation from premature beats and atrial flutter data, and even the original features will affect the overall results. The new features added at this time are better in distinguishing atrial fibrillation from premature beats and atrial flutter data than the original 13 features (removing LFn RRI / HFn RRI ). The results are from Figure 8If the sampling time is gradually shortened, the accuracy of identifying atrial fibrillation will decrease. If you want to accurately detect whether atrial fibrillation exists, you can choose input with a longer RRI segment. If you want to quickly detect atrial fibrillation, you can choose data with a shorter RRI segment. At this time, the accuracy will decrease. Figure 8 The vertical axis in the middle is accuracy. Relevant features are manually extracted and fused to obtain a three-classification result. This can effectively avoid the probability of other arrhythmias being identified as atrial fibrillation, and its accuracy will be higher.
[0152] The present invention extracts 14 HRV features from the time domain, frequency domain and nonlinear domain based on the RR interval from the ECG fragments, and on this basis proposes new time domain features for premature beats and atrial flutter, performs signal fusion on the features, builds a signal fusion network and a classification network, learns the most effective features, and can more accurately identify atrial fibrillation signals.
[0153] Example 2
[0154] This embodiment provides a method for identifying atrial fibrillation, including:
[0155] The main control module performs R wave positioning on the received ECG data, and intercepts the ECG data containing a first set number of RRIs from the ECG data after R wave positioning.
[0156] The main control module extracts multiple ECG features from the ECG data containing a first set number of RRIs, and composes the extracted multiple ECG features into a first feature matrix; the multiple ECG features include time domain features, frequency domain features and nonlinear domain features.
[0157] The main control module inputs the first feature matrix into an atrial fibrillation identification model to obtain an atrial fibrillation identification result; the atrial fibrillation identification result is atrial fibrillation or non-atrial fibrillation; the atrial fibrillation identification model is obtained by training a neural network using a training set.
[0158] The neural network includes a fusion network and a classification network; the fusion network is used to obtain the fusion features of the first feature matrix based on multi-scale convolution and multi-head attention mechanism; the classification network classifies the fusion features according to the long short-term memory network and the multi-layer perceptron to obtain the atrial fibrillation recognition result.
[0159] The host computer displays the atrial fibrillation identification result.
[0160] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0161] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. An atrial fibrillation identification system, characterized in that: include: A main control module and a host computer; the host computer is connected to the main control module; The main control module is used for: Perform R wave positioning on the received ECG data, and extract ECG data containing a first set number of RRIs from the ECG data after R wave positioning; RRI is the horizontal coordinate difference between two adjacent R waves; the R wave positioning in the main control module adopts an adaptive threshold method, first set a linear table with a capacity of 50, go through the ECG data once, find the maximum and minimum values in real time, and at regular intervals, the threshold will be re-updated in proportion to the maximum and minimum values, and at the same time, compare in real time whether the value in the middle of the linear table is larger than both the left and right sides, if it meets the requirements, then compare with the threshold to see if it is also larger than the threshold, if it also meets the requirements, then find the R peak; Extracting multiple ECG features from ECG data containing a first set number of RRIs, and forming a first feature matrix with the extracted multiple ECG features; the multiple ECG features include time domain features, frequency domain features, and nonlinear domain features; the time domain features include atrial fibrillation feature values determined in the ECG data based on the RRI and the RRI average value; Inputting the first characteristic matrix into an atrial fibrillation identification model to obtain an atrial fibrillation identification result; the atrial fibrillation identification result is atrial fibrillation or non-atrial fibrillation; the atrial fibrillation identification model is obtained by training a neural network using a training set; The neural network includes a fusion network and a classification network; the fusion network is used to obtain the fusion features of the first feature matrix according to the multi-scale convolution and multi-head attention mechanism; the classification network classifies the fusion features according to the long short-term memory network and the multi-layer perceptron to obtain the atrial fibrillation recognition result; The host computer is used to display the atrial fibrillation identification result; The calculation process of the atrial fibrillation characteristic value is: Subtract each RRI in the electrocardiogram data containing a first set number of RRIs from the average RRI value to obtain a difference value sequence; According to the formula Get the array F(X); where D(X i ) represents the absolute value of the difference between the ith RRI and the average RRI, F(X i ) is the i-th value in array F(X); A window of size 3 is used to traverse the array F(X). If all three values in the window are 1, the statistical window value is 1, otherwise the statistical window value is 0, and the number of statistical window values 1 is used as the atrial fibrillation characteristic value.
2. The atrial fibrillation identification system according to claim 1, characterized in that: The host computer is also used to input a first set quantity value; the first set quantity is greater than or equal to 9.
3. The atrial fibrillation identification system according to claim 1, characterized in that: The fusion network is used to: Using a second set number of convolution kernels of different sizes to convolve the first feature matrix respectively to obtain a second set number of second feature matrices; Initializing a second set number of first score matrices, each first score matrix corresponding to a second feature matrix; The second set number of first score matrices are subjected to a multi-head attention mechanism to obtain a second score matrix corresponding to each second feature matrix; Multiply each of the first feature matrices by the corresponding second score matrix to obtain a first multiplication matrix, and concatenate a second set number of the obtained first multiplication matrices to obtain a third feature matrix; Initializing a second set number of third score matrices, each third score matrix corresponding to a second feature matrix; The second set number of third score matrices are subjected to a multi-head attention mechanism to obtain a fourth score matrix corresponding to each second feature matrix; Multiplying the third feature matrix and the fourth score matrix respectively to obtain a second set number of second multiplication matrices; The obtained second set number of second multiplication matrices are concatenated to obtain a fourth feature matrix; the fourth feature matrix is the fusion feature.
4. The atrial fibrillation identification system according to claim 3, characterized in that: The second set number in the fusion network is 6, and the 6 convolution kernels of different sizes are 1*1, 2*2, 3*3, 4*4, 5*5, and 6*6 respectively.
5. The atrial fibrillation identification system according to claim 1, characterized in that: The classification network includes a first long short-term memory network, a second long short-term memory network, a multi-layer perceptron and a classifier which are connected in sequence.
6. The atrial fibrillation identification system according to claim 1, characterized in that: The sample data in the training set includes input data and label data, the input data is the first feature matrix of a normal ECG sample signal, an atrial fibrillation sample signal, an atrial flutter sample signal or a premature beat sample signal, the label data corresponding to the normal ECG sample signal is normal, the label data corresponding to the atrial fibrillation sample signal is atrial fibrillation, and the label data corresponding to the atrial flutter sample signal or the premature beat sample signal is other arrhythmias.
7. The atrial fibrillation identification system according to claim 1, characterized in that: It also includes an ECG acquisition module, which is connected to the main control module. The ECG acquisition module is used to filter the collected ECG signals using a 0.3 Hz high-pass filter, a 50 Hz notch filter, and a 50 Hz low-pass filter in sequence, and send the filtered ECG signals to the main control module.
8. The atrial fibrillation identification system according to claim 1, characterized in that: It also includes a communication module, which is used to send the atrial fibrillation identification result output by the main control module to the host computer by using WIFI, 4G or Bluetooth; The host computer is a computer, a tablet or a mobile phone.
9. A method for identifying atrial fibrillation, characterized in that: include: The main control module performs R wave positioning on the received ECG data, and extracts ECG data containing the first set number of RRIs from the ECG data after R wave positioning; the R wave positioning in the main control module adopts an adaptive threshold method, firstly sets a linear table with a capacity of 50, goes through the ECG data once, and finds the maximum and minimum values in real time. At regular intervals, the threshold is re-updated in proportion to the maximum and minimum values, and at the same time, a real-time comparison is made to see whether the middle value in the linear table is larger than both sides. If it is satisfied, it is compared with the threshold to see whether it is also larger than the threshold. If it is also satisfied, the R peak is found; The main control module extracts a plurality of ECG features from the ECG data containing a first set number of RRIs, and forms a first feature matrix with the extracted plurality of ECG features; the plurality of ECG features include time domain features, frequency domain features and nonlinear domain features; The main control module inputs the first feature matrix into an atrial fibrillation identification model to obtain an atrial fibrillation identification result; the atrial fibrillation identification result is atrial fibrillation or non-atrial fibrillation; the atrial fibrillation identification model is obtained by training a neural network using a training set; The neural network includes a fusion network and a classification network; the fusion network is used to obtain the fusion features of the first feature matrix according to the multi-scale convolution and multi-head attention mechanism; the classification network classifies the fusion features according to the long short-term memory network and the multi-layer perceptron to obtain the atrial fibrillation recognition result; The host computer displays the atrial fibrillation identification result; The calculation process of the atrial fibrillation characteristic value is: Subtract each RRI in the electrocardiogram data containing a first set number of RRIs from the average RRI value to obtain a difference value sequence; According to the formula Get the array F(X); where D(X i ) represents the absolute value of the difference between the ith RRI and the average RRI, F(X i ) is the i-th value in array F(X); A window of size 3 is used to traverse the array F(X). If all three values in the window are 1, the statistical window value is 1, otherwise the statistical window value is 0, and the number of statistical window values 1 is used as the atrial fibrillation characteristic value.
Citation Information
Patent Citations
Method, system and apparatus for evaluating atrial fibrillation
CN109199343A
Motor imagery recognition method and system based on multi-scale convolution and Transform
CN117113269A