Prediction method and system for paroxysmal atrial fibrillation, medium and equipment
By applying the combination of self -encoder and logical regression models in the single -guided joint ECG test, an artificial intelligence -driven automatic prediction and diagnostic model has been developed, which solves the problem that the existing technology cannot accurately predict paroxysmal atrial fibrillation. Improve the accuracy of prediction and the reliability of clinical decision -making.
Patent Information
- Application Number
- CN202411519355.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-01-28
AI Technical Summary
The prior art cannot accurately predict paroxysmal atrial fibrillation (AF), resulting in a lack of accurate basis during clinical treatment and recovery.
Using a single -guided connected ECG test, through the combination of the self -encoder and logical regression model, it develops a end -to -end automatic prediction and diagnostic model for artificial intelligence -based to predict the occurrence of paroxysmal AF.
It improves the predictive accuracy of paroxysmal AF, and provides a reliable basis for clinical prediction, diagnosis and decision -making.
Smart Images

Figure CN119366934A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of medical detection technology, and in particular to a prediction method, system, medium and device for paroxysmal atrial fibrillation. Background Art
[0002] Atrial fibrillation (AF) is one of the most common arrhythmias, which causes blood clots in the atria, leading to serious symptoms such as pulmonary embolism, cerebral embolism (stroke), myocardial infarction, and limb artery embolism. The longer AF lasts, the more serious the harm and the higher the risk.
[0003] Electrocardiogram (ECG) is the most basic and reliable detection method for diagnosing AF. However, the existing technology for analyzing ECG is mainly used to distinguish various cardiac symptoms, such as AF, normal heart rhythm, supraventricular tachycardia, premature beats, etc.
[0004] Since AF can be divided into different types according to the duration, for example, AF can be divided into different types such as paroxysmal AF, persistent AF and permanent AF. Paroxysmal AF refers to the ability to restore sinus rhythm on its own within 7 days, usually lasting no more than 48 hours; persistent AF refers to the duration of more than 7 days, requiring medication or electric shock to convert to sinus rhythm; permanent AF refers to the inability to convert to sinus rhythm or recurrence within 24 hours after conversion. Existing technology for analyzing electrocardiograms can only simply distinguish AF from other arrhythmia symptoms, and cannot accurately predict different types of AF. For example, the problem of AF prediction in a cohort of patients with paroxysmal AF is crucial for timely treatment and better recovery under clinical conditions. However, there are still limitations for paroxysmal AF, and paroxysmal AF cannot be accurately predicted, thus failing to provide an accurate basis for clinical prediction, diagnosis and decision-making. Summary of the invention
[0005] In order to solve the technical problem that paroxysmal atrial fibrillation (AF) cannot be accurately predicted, the present invention provides a prediction method, system, medium and device for paroxysmal atrial fibrillation, uses a single-lead ECG test to predict and diagnose patients with paroxysmal AF, and develops an end-to-end artificial intelligence-based automatic prediction and diagnosis model, aiming to provide an effective, high-precision, practical and comprehensive ECG automatic prediction framework, which can be used as a reliable tool in the clinical prediction, diagnosis and decision-making process of paroxysmal AF.
[0006] In order to solve the above technical problems, the first aspect of the present invention discloses a prediction method for paroxysmal atrial fibrillation, the method comprising:
[0007] Obtaining a dynamic electrocardiogram (ECG) from a cardiac patient;
[0008] Cutting the dynamic electrocardiogram ECG to obtain a plurality of ECG segments containing R peaks;
[0009] Inputting the plurality of ECG segments into an autoencoder to mine hidden features, and outputting feature parameters corresponding to the plurality of ECG segments;
[0010] Inputting the characteristic parameters corresponding to the plurality of ECG segments into the trained logistic regression model for processing, and obtaining the probability of occurrence of paroxysmal atrial fibrillation (AF) in each of the plurality of ECG segments; wherein the probability is limited between 0 and 1, 0 indicates that paroxysmal AF does not occur, and 1 indicates that paroxysmal AF occurs, and the greater the probability, the greater the possibility of occurrence of paroxysmal AF;
[0011] Based on the probability of occurrence of paroxysmal AF in each of the plurality of ECG segments, predicting the occurrence of paroxysmal AF in the cardiac patient;
[0012] The autoencoder and the logistic regression model are mainly trained using ECG samples diagnosed as paroxysmal AF.
[0013] Optionally, before cutting the dynamic electrocardiogram ECG to obtain a plurality of ECG segments containing R peaks, the method further includes:
[0014] The dynamic electrocardiogram (ECG) is processed by using a discrete wavelet transform algorithm to obtain actual noise of the dynamic electrocardiogram (ECG); the actual noise is one or more of baseline drift, flat line, and high-frequency noise;
[0015] A scoring mechanism is introduced to score the actual noise, and the dynamic electrocardiogram ECG whose noise score is within a set scoring range is retained.
[0016] Optionally, the structure of the autoencoder includes: an encoder and a decoder; wherein,
[0017] The encoder is used to map the input x to a hidden variable space with a lower dimension than the input x, and obtain a low-dimensional variable h, with the following structure:
[0018]
[0019] Among them, input x refers to the ECG segment, Conv represents the convolution operation, and Residual.a * n1 Indicates that the residual block a is used to perform the operation, n1 and n2 represent the different numbers of residual blocks a, * indicates that the residual block contains more than one convolutional layer, maxpool represents the maximum pooling operation, Residual.b * Indicates that the residual block b is used to perform the operation, and Flatten indicates the flattening operation;
[0020] The decoder is used to reversely map the low-dimensional variable h to the original data space to obtain the original dimensional data y, and the structure is as follows:
[0021]
[0022] Among them, Reshape represents a reshaping operation, Upsample represents an upsampling operation, and n3 and n4 represent different numbers of residual blocks a.
[0023] Optionally, the residual block a and the residual block b are constructed into a bottleneck structure using convolutional layers; in the bottleneck structure, two convolutional layers with a core size of 1 are applied before and after a functional convolutional layer with a core size of 3.
[0024] Optionally, the training process of the autoencoder is as follows:
[0025] Collect the original input sample x i , represents a matrix, k×1 is the dimension of the original input sample, 1 represents the number of channels; the original input sample x i ECG samples belonging to patients diagnosed with paroxysmal AF;
[0026] The original input sample x i Transformed into damaged samples in, is the damaged ECG segment affected by noise ∈, ∈∈N(0,σ), the noise obeys the normal distribution, σ is the scale range;
[0027] The encoder in the autoencoder transforms the damaged sample Hidden variables h mapped to low-dimensional space i , the decoder in the autoencoder converts the hidden variable h i Output samples y that are reverse-mapped to the original dimensions i ;
[0028] Take the original input sample x i and the output sample y i The minimum mean square error of is used as the loss function, and the autoencoder is trained by iterative gradient descent method until the loss function converges.
[0029] Optionally, the training process of the logistic regression model is as follows:
[0030] The original input sample x i Marking is performed; wherein the original input sample x i Labeled as 0 or 1, 0 represents sinus rhythm samples and 1 represents AF samples;
[0031] Process the original input sample x using the autoencoder i , and obtain the corresponding output sample;
[0032] The output sample is input into the logistic regression model and combined with the original input sample x i The label and the set loss function are used to train the logistic regression model using an iterative gradient descent method until the set loss function converges;
[0033] If the output of the logistic regression model is higher than a preset threshold, an alarm will be issued indicating that paroxysmal AF is about to occur.
[0034] Optionally, the method further includes: adjusting the preset threshold according to the AF attack start time presented by the ECG sample.
[0035] A second aspect of the present invention discloses a prediction system for paroxysmal atrial fibrillation, comprising:
[0036] An acquisition unit, used for acquiring a dynamic electrocardiogram (ECG) of a heart patient;
[0037] A cutting unit, used for cutting the dynamic electrocardiogram ECG to obtain a plurality of ECG segments containing R peaks;
[0038] An autoencoder processing unit, used for processing the plurality of ECG segments to mine hidden features and outputting feature parameters corresponding to the plurality of ECG segments;
[0039] A model processing unit, used for inputting the characteristic parameters corresponding to the plurality of ECG segments into the trained logistic regression model for processing, so as to obtain the probability of occurrence of paroxysmal atrial fibrillation (AF) in each of the plurality of ECG segments; wherein the probability is limited between 0 and 1, 0 indicates that paroxysmal AF does not occur, 1 indicates that paroxysmal AF occurs, and the greater the probability, the greater the possibility of occurrence of paroxysmal AF;
[0040] A prediction unit, configured to predict the occurrence of paroxysmal AF in the cardiac patient based on the probability of occurrence of paroxysmal AF in each of the plurality of ECG segments;
[0041] The autoencoder and the logistic regression model are mainly trained using ECG samples diagnosed as paroxysmal AF.
[0042] According to a third aspect of the present invention, a computer-readable storage medium is disclosed, on which a computer program is stored, and when the program is executed by a processor, the steps of the above method are implemented.
[0043] In a fourth aspect of the present invention, a prediction device for paroxysmal atrial fibrillation is disclosed, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the program.
[0044] Through one or more technical solutions of the present invention, the present invention has the following beneficial effects or advantages:
[0045] The present invention discloses a prediction method, system, medium and device for paroxysmal atrial fibrillation, which first obtains a dynamic electrocardiogram (ECG) of a heart patient; cuts the dynamic electrocardiogram (ECG) to obtain several ECG segments containing R peaks; inputs the several ECG segments into an autoencoder to mine hidden features, and outputs feature parameters corresponding to the several ECG segments; then inputs the feature parameters corresponding to the several ECG segments into a trained logistic regression model for processing, and obtains the probability of paroxysmal atrial fibrillation (AF) occurring in each of the several ECG segments, and based on the probability of paroxysmal AF occurring in each of the several ECG segments, predicts the occurrence of paroxysmal AF in the heart patient. In this solution, the autoencoder and the logistic regression model are mainly trained with ECG samples diagnosed as paroxysmal AF. By combining the autoencoder and the logistic regression model to build an ECG automatic prediction framework for prediction and diagnosis of paroxysmal AF patients, the prediction of paroxysmal AF can be improved, providing an accurate basis for clinical prediction, diagnosis and decision-making.
[0046] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0048] Figure 1 A flowchart of a prediction method for paroxysmal atrial fibrillation according to an embodiment of the present invention is shown;
[0049] Figure 2 A schematic diagram of the structure of an autoencoder according to an embodiment of the present invention is shown;
[0050] Figure 3 A schematic diagram of a feature space generated by an autoencoder model according to an embodiment of the present invention is shown;
[0051] Figure 4 A logical schematic diagram of screening patients and extracting effective samples to train and test models according to one embodiment of the present invention is shown;
[0052] Figure 5 A schematic diagram showing the probability of atrial fibrillation according to an embodiment of the present invention is shown;
[0053] Figure 6 A schematic diagram of a prediction system for paroxysmal atrial fibrillation according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0054] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.
[0055] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.
[0056] In the first aspect, an embodiment of the present invention provides a prediction method for paroxysmal atrial fibrillation, which uses a single-lead ECG test to predict and diagnose patients with paroxysmal AF, and develops an end-to-end artificial intelligence-based prediction tool for paroxysmal atrial fibrillation in combination with an autoencoder and a logistic regression model. The autoencoder and the logistic regression model are mainly trained using ECG samples diagnosed as paroxysmal AF, aiming to provide an effective, high-precision, practical, and comprehensive ECG automatic prediction framework, which can be used as a reliable tool in the clinical prediction, diagnosis, and decision-making process of paroxysmal AF.
[0057] like Figure 1 As shown, the prediction method for paroxysmal atrial fibrillation provided by the embodiment of the present invention at least comprises the following steps:
[0058] S101, obtaining a dynamic electrocardiogram (ECG) of a heart patient.
[0059] The dynamic electrocardiogram (ECG) includes but is not limited to a 24-hour 12-lead dynamic ECG.
[0060] Since ECG data is collected dynamically and continuously without any interruption, the interference of muscle movement and ECG collector will cause noise and artifacts in ECG data, which not only interferes with the R peak detection algorithm, but also affects the accuracy of the subsequent AI model. For this reason, in this embodiment, it is necessary to evaluate the signal quality of the dynamic electrocardiogram ECG, including but not limited to evaluating it using a discrete wavelet transform algorithm combined with a scoring mechanism.
[0061] Specifically, the dynamic electrocardiogram ECG is processed by a discrete wavelet transform algorithm to obtain the actual noise of the dynamic electrocardiogram ECG. Among them, the discrete wavelet transform algorithm mainly decomposes one or more of the baseline drift, flat line, and high-frequency noise of the actual noise dynamic electrocardiogram ECG as the actual noise, and then introduces a scoring mechanism to score the actual noise, eliminating ECG data with noise scores outside the set scoring range, thereby eliminating ECG data carrying the three main noises, and retaining the dynamic electrocardiogram ECG with noise scores within the set scoring range to ensure the accuracy of subsequent model evaluation. Currently, other common ECG noises do not affect the R peak detection algorithm, so they are not included in the signal quality evaluation.
[0062] S102, cutting the dynamic electrocardiogram ECG to obtain a plurality of ECG segments containing R peaks.
[0063] During the cutting process, a fixed-length window is used to slide on the time series data of the dynamic electrocardiogram ECG. For example, the time window is 5 seconds, but it does not form a restriction. When an R peak is encountered, it is cut into ECG segments to obtain several ECG segments containing R peaks. This cutting strategy improves the accuracy of subsequent AI models and reduces the dimension of feature extraction. In order to determine the position of each heartbeat, the R peak extraction algorithm involved in this embodiment adopts the classic real-time monitoring QRS (wave group) complex algorithm, including low-pass filtering, high-pass filtering, differentiation, squaring, integration, adaptive threshold and search process. This algorithm is a more commonly used algorithm, and its specific implementation process will not be repeated.
[0064] S103, inputting several ECG segments into an autoencoder to mine hidden features, and outputting feature parameters corresponding to the several ECG segments.
[0065] Among them, several ECG segments of a heart patient are ECG segments to be predicted.
[0066] In order to better illustrate the processing logic of the autoencoder, the structure of the autoencoder and its training process are introduced below.
[0067] The structure of the autoencoder includes an encoder and a decoder, which are symmetrical in structure. The encoder maps the input data x (here, the ECG segment) to a hidden variable space with a lower dimension than the input to obtain a low-dimensional variable h, while the decoder is used to reversely map the low-dimensional variable h to the original data space to obtain the original-dimensional data y.
[0068] The structure of the encoder is as follows:
[0069]
[0070] Among them, input x refers to the ECG segment, Conv represents the convolution operation, and Residual.a * n1 Indicates that the residual block a is used to perform the operation, n1 and n2 represent the different numbers of residual blocks a, * indicates that the residual block contains more than one convolutional layer, Maxpool represents the maximum pooling operation, Residual.b * Indicates that the residual block b is used to perform the operation, and Flatten indicates the flattening operation;
[0071] The structure of the decoder is as follows:
[0072]
[0073] Among them, Reshape represents a reshaping operation, Upsample represents an upsampling operation, and n3 and n4 represent different numbers of residual blocks a.
[0074] It is worth noting that two different formats of residual blocks are used in both the encoder and the decoder, namely residual block a and residual block b. In residual block a and residual block b, convolutional layers are used to build a bottleneck structure to reduce the number of weights that need to be trained; in the bottleneck structure, two convolutional layers with a kernel size of 1 are applied before and after the functional convolutional layer with a kernel size of 3. That is: the first convolutional layer and the third convolutional layer are in 1×1 format, which are used to reduce the number of channels and restore to the original number of channels, respectively. Since the first and third convolutional layers are able to map data to lower channel dimensions and reverse mapping, the second convolutional layer uses a 1×3 format in a low channel range, which can work at a low dimensional level with a smaller training weight. Residual block a maintains the channel of the input data, while residual block b can change the channel as needed. Both residual block a and residual block b allow data to flow directly from the top layer to the bottom layer, providing more original information to deeper layers, thereby effectively reducing the gradient vanishing problem and making it possible to train deeper neural networks.
[0075] For a better illustration and explanation of the autoencoder, see Figure 2, is a schematic diagram of the structure of the autoencoder, which is built with reference to the Keras framework, TensorFlow backend and Python language.
[0076] The autoencoder includes two structures: encoder and decoder. In the encoder and decoder, two different formats of residual blocks are introduced to meet the requirements of maintaining or changing the number of channels. Furthermore, both the encoder and decoder contain 13 residual blocks, such as Figure 2 As shown, but it does not form a limitation. Each residual block consists of three convolutional layers to form a bottleneck structure to reduce the number of weights that need to be trained. With this design, data can participate in the calculation of the current convolutional layer or flow directly to the next layer, thereby avoiding the gradient vanishing problem and making it possible to train deeper neural networks. Of course, the nonlinear ReLU activation function and batch normalization technology are also used in the residual block to extract local and general features from single-channel ECG data to prevent overfitting problems and achieve better model convergence.
[0077] In this embodiment, the training process of the autoencoder includes the following steps:
[0078] S1031, collect and obtain the original input sample x i .
[0079] Among them, the original input sample x i ECG samples belonging to the group diagnosed with paroxysmal AF.
[0080] The ECG samples of paroxysmal AF are specifically retrospective anonymized sample data of several adult patients who underwent 24-hour 12-lead dynamic ECG testing and were diagnosed with paroxysmal AF. Of course, considering that the onset time of AF is regarded as a predicted transition point, some samples with short-term rapid transitions from normal to AF are excluded. Exemplarily, the ECG samples of paroxysmal AF include but are not limited to 12-lead ECG recorded using a Holter machine, from which a standard single-lead ECG is obtained, with a sampling rate of 128Hz, and stored using a DMS data management system.
[0081] Since the ECG samples of paroxysmal AF are collected dynamically and continuously without any interruption, they are interfered by muscle movement and ECG collectors, which will generate noise and artifacts during the collection process, which not only interferes with the R peak detection algorithm, but also affects the accuracy of the subsequent AI model. Therefore, after collecting the ECG samples of paroxysmal AF, the signal quality will be evaluated, including but not limited to using a discrete wavelet transform algorithm combined with a scoring mechanism to evaluate it, in order to eliminate ECG data carrying one or more major noises such as baseline drift, flat lines, and high-frequency noise. The specific evaluation method has been introduced above, so it will not be repeated here.
[0082] Since the ECG samples of paroxysmal AF are continuous, in order to save computing resources, they need to be cut into small segments and input into the autoencoder for training. Specifically, a fixed-length window is used to slide on the time series of the ECG samples of paroxysmal AF, and cut into several ECG segments containing R peaks, for example, cut into 5-second single-lead ECG (sampling rate is 128Hz), and each ECG segment containing R peak is used as the original input sample x i Of course, the sinus rhythm may be cut every two R peaks, that is, the ECG segment of the sinus rhythm contains two R peaks, and the ECG segment containing paroxysmal AF contains a single R peak, but this does not constitute a limitation.
[0083] In an optional embodiment, when analyzing ECG samples of paroxysmal AF, it is found that arrhythmia may occur 1 hour before the occurrence of AF, see Table 1.
[0084] Table 1
[0085]
[0086]
[0087] In Table 1, about 85.6% (332 / 388) of the patients showed arrhythmias before AF occurred. Specifically, 25.3% (98 / 388) of the patients had occasional APC (atrial premature beats) and 46.4% (180 / 388) had frequent APCs. APCs also include heterogeneous, paired, and dual combined APCs. Before AF occurred, single AT (atrial tachycardia) accounted for 16.2% (63 / 388) and multiple ATs accounted for 9.5% (37 / 388). Atrial flutter with the same RR interval accounted for 4.4% (17 / 388). Other types of arrhythmias include occasional VPC (ventricular premature beats), accounting for 11.9% (46 / 388) and frequent VPC, accounting for 8% (31 / 388). These two types are the most common. Meanwhile, 14.9% (58 / 388) of the patients showed no changes 1 hour before AF.
[0088] To this end, in the process of cutting ECG samples of paroxysmal AF, a long ECG sample including 1 hour before the onset of AF can be cut out, and then the long ECG sample can be cut into 5-second ECG segments using a time window, so as to improve the prediction accuracy of the autoencoder and logistic regression model and save training resources.
[0089] It is worth noting that since the samples will be used to train the logistic regression model later, each ECG segment can be marked in advance for subsequent use. Of course, it can also be marked when training the logistic regression model. Among them, the sinus rhythm sample is marked as 0, and the AF sample is marked as 1. The marking operation will be introduced in detail later, so it will not be repeated here.
[0090] Since the ECG samples of paroxysmal AF are time series data, they contain more sinus rhythm data than AF data. Therefore, in order to balance the positive and negative sample data, some sinus rhythm samples can be removed. Of course, no samples can be removed when testing the model. Figure 4 , is a logical diagram for screening patients and extracting valid samples to train and test the model. Among them, 400 patients have a total of 7055 hours of ECG samples. 140 invalid patients are excluded because their heart condition is directly in atrial fibrillation or they enter atrial fibrillation only a few minutes after the start of electrocardiogram acquisition. Of course, although these invalid patients can be used for training and testing models, they are not used for subsequent alarm time statistics. Among them, 35 patients did not have normal heart conditions before atrial fibrillation, 66 patients did not have a long enough (1 hour) normal time before atrial fibrillation, and 39 patients had seven noises that caused terrible R peak detection. In this embodiment, after excluding 140 invalid patients, the remaining 260 patients with a total of 5406 hours of ECG samples are obtained for training and testing. Among them, the ECGs of 60 patients are used for model training, and the remaining 200 patients' ECGs are used for model testing. After cutting these ECGs, the training sample dataset contains 1,694,711 positive samples (AF) and 1,702,560 negative samples (sinus rhythm), all of which are used as the original input sample x i The data set for training the autoencoder contains 5,648,868 positive samples (AF) and 8,674,219 negative samples (sinus rhythm). To protect the privacy of patients, the data in this embodiment are all anonymized data, including only the patient ID, age and gender information.
[0091] Furthermore, the original input sample x i is converted to a matrix. represents a matrix, k×1 is the dimension of the original input sample, and 1 represents the number of channels. For example, the original input sample x i is converted into a 640×1 matrix, The long axis 640 represents the time axis, and by performing convolution calculations on this axis, the neural network is allowed to extract morphological and temporal features, and the short axis 1 represents the number of channels of the data.
[0092] S1032, the original input sample x i Transformed into damaged samples in, is the impaired ECG segment affected by noise ∈, ∈∈N(0,σ), the noise obeys the normal distribution, σ is the scale range.
[0093] In this embodiment, the original input sample x is not directly used. i To train an autoencoder, we need to add a normally distributed noise to the input so that the original input sample x i Partially “damaged”, the partially covered damaged sample is used to fit the model. Specifically, the damaged sample has In the form of, where ∈∈N(0,σ), since ECG is collected in a fixed range of -2 to 2. Therefore, σ is set to 0.2, but it does not form a limit. By i Add noise to the To fit the model, instead of the original input sample x i , so that the autoencoder cannot see the original input sample x during training i All the information provided can improve the robustness of the autoencoder, improve the generalization and robustness of the model, and thus present better data representation capabilities.
[0094] S1033, the encoder in the autoencoder converts the damaged samples Hidden variables h mapped to low-dimensional space i , the decoder in the autoencoder will hide the variable h i Output samples y that are reverse-mapped to the original dimensions i .
[0095] Among them, the damaged samples Input into the autoencoder and map Get the hidden variable h i And the output sample y i .
[0096] S1034, with the original input sample x i And the output sample y i The minimum mean square error of is used as the loss function, and the autoencoder is trained using iterative gradient descent until the loss function converges.
[0097] Among them, the entire autoencoder is used to calculate the original input sample x i With the reconstructed output sample y i The difference between the two (from the decoder) is used as the cost function, with the goal of training the entire autoencoder structure to reach the optimal point until the loss function converges. i The dimension is less than x i When , the autoencoder plays the role of feature compression.
[0098] Furthermore, when the autoencoder is initialized, normal distribution and random weights are used for initialization, and the optimization algorithm Adam optimizer is used for internal optimization training. The default parameters of momentum are β1=0.9, β2=0.999, the initial learning rate is set to 0.01, and the size of each small batch is 128. Whenever the training loss does not improve for 10 consecutive epochs, the learning rate decay technique is introduced into the training with a factor of 10.
[0099] The above is an introduction to the structure of the autoencoder and its training process.
[0100] After the autoencoder is trained, it can be used to process several ECG segments of heart patients. Specifically, several ECG segments to be predicted are input into the autoencoder for hidden feature mining, and feature parameters corresponding to several ECG segments are output. Figure 3 , is a schematic diagram of the feature space generated by the autoencoder model. Features in eight dimensions are shown, but they are not limiting. Among them, the red part represents atrial fibrillation, while the blue part represents sinus rhythm. Its feature distribution shows a strong correlation with the actual heart condition. It is worth noting that due to the black box characteristics of the autoencoder, all the features extracted lack physical meaning, and the amplitude of each feature is just a unitless measurement used to characterize the potential characteristics and trend information of the original ECG. Therefore, all features need to be input into the median filter for filtering to remove outliers that may be caused by the failure of R peak detection.
[0101] S104, inputting the characteristic parameters corresponding to the plurality of ECG segments into the trained logistic regression model for processing, and obtaining the probability of occurrence of paroxysmal atrial fibrillation AF in each of the plurality of ECG segments.
[0102] Among them, the logistic regression model is a generalized linear regression analysis model, which uses the prediction results of the linear regression analysis model to approximate the probability of the true mark. In order to associate the features output by the autoencoder with the possibility of AF, this embodiment is implemented by building a logistic regression model. The output of the logistic regression model is limited between 0 and 1, 0 indicates that paroxysmal AF has not occurred, and 1 indicates that paroxysmal AF has occurred. The greater the probability, the greater the possibility of paroxysmal AF.
[0103] In this embodiment, sinus rhythm samples are marked as 0 and AF samples are marked as 1 to train a logistic regression model. The higher the output of the logistic regression model, the greater the possibility that the patient will have AF.
[0104] In the specific implementation process, the training process of the logistic regression model includes the following steps:
[0105] S1041, the original input sample x i Marking is performed.
[0106] Among them, the original input sample x i The source of has been introduced above, so it will not be repeated here. In this embodiment, the original input sample x i The label is 0 or 1. 0 represents a sinus rhythm sample and 1 represents an AF sample. When labeling, all the original input samples x i All were accurately labeled as AF samples or sinus rhythm samples (normal heart rhythm), and the labels involved atrial arrhythmias before AF within one hour. During the labeling, the ECGs were mainly interpreted and labeled independently by cardiologists, and further reviewed by senior cardiologists to ensure the correctness of the basic diagnostic labels.
[0107] S1042, using the autoencoder to process the original input sample x i , and get the corresponding output sample.
[0108] In order to ensure the accuracy of logical prediction, the original input sample x i The trained autoencoder is input for processing to obtain the corresponding output samples, and then the logistic regression model is used to train the association probability between these features and AF.
[0109] S1043, input the output sample into the logistic regression model and combine it with the original input sample x i The label and set loss function are used to train the logistic regression model using iterative gradient descent method until the set loss function converges.
[0110] The output of the logistic regression model is limited between 0 and 1. The logistic regression model is trained by marking each sinus rhythm sample as 0 and each AF sample as 1. The higher the output of the logistic regression model, the greater the possibility of AF in the patient. After training, the trend of prediction can be obtained: before AF occurs, the output of the logistic regression model gradually approaches 1. Therefore, in order to warn of AF, this embodiment is set with a preset threshold. If the output of the logistic regression model is higher than the preset threshold, an alarm will be issued that paroxysmal AF is about to occur.
[0111] See also Figure 5 , is a schematic diagram of the probability of atrial fibrillation. The red part represents atrial fibrillation, the blue part represents sinus rhythm, and the orange dotted line is the preset threshold (0.5). If the probability of atrial fibrillation is higher than 0.5, an alarm will be triggered.
[0112] Furthermore, the preset threshold can be selected in combination with evaluation parameters such as model overall accuracy, model sensitivity, model specificity, model F1 score, etc. The model F1 score is a measurement indicator for classification problems, which is the harmonic mean of precision and recall.
[0113] See Table 2, which is a table of the mutual comparison between preset thresholds and various evaluation parameters.
[0114] Table 2
[0115] Overall model accuracy Model sensitivity Model specificity Model F1 score Training threshold = 0.5 0.905 0.939 0.871 0.908 Training threshold = 0.572 0.892 0.892 0.892 0.892 Test threshold = 0.5 0.882 0.907 0.865 0.859 Test threshold = 0.572 0.875 0.883 0.869 0.863 Test threshold = 0.585 0.871 0.871 0.871 0.843
[0116] As shown in Table 2, when training the model, if the preset threshold of 0.5 is selected, the overall accuracy of the model is 0.905, the sensitivity of the model is 0.939, the specificity of the model is 0.871, and the F1 score of the model is 0.908. Of course, in order to interpret the patient's ECG sample more intuitively, the probability of each predicted ECG segment of the patient as a training sample can be used as a coordinate diagram analysis tool, from 0 to 1 to draw the ROC curve (receiver operating characteristic curve), and the AUC (area under the ROC curve) value is calculated to be 0.896.
[0117] When training the model, if the preset threshold of 0.572 is selected, the overall accuracy of the model is 0.892, the model sensitivity and model specificity are equal, both are: 0.892, and the model F1 score is 0.892.
[0118] When testing the model, if the preset threshold of 0.5 was selected, the overall model accuracy was 0.882, the model sensitivity was 0.907, the model specificity was 0.865, and the model F1 score was 0.859.
[0119] When testing the model, if the preset threshold of 0.572 is selected, the overall model accuracy is 0.875, the model sensitivity is 0.883, the model specificity is 0.869, and the model F1 score is 0.863. The calculated AUC is 0.865.
[0120] When testing the model, if the preset threshold of 0.585 is selected, the overall accuracy of the model is 0.871, the model sensitivity and model specificity are equal, both 0.871, and the model F1 score is 0.843.
[0121] In order to predict AF in advance, we set a lower threshold for early alarm. It should be noted that only 56 patients in the training data set and 183 patients in the test data set have valid AF onset start times. Therefore, in this embodiment, it is necessary to refer to these patients to calculate the advance alarm time. Since the heart condition of other patients is directly in the AF state or immediately enters atrial fibrillation a few minutes after collecting the ECG, this means that if the ECG data of these patients is used to train the logistic regression, the output will be higher than the threshold. In order to, this embodiment reduces the set threshold by analyzing the relationship between the set threshold and the corresponding advance alarm time of the valid patients, see Table 3 for details.
[0122] Table 3
[0123]
[0124] It can be seen from Table 3 that if the threshold is too low, such as lower than 0.5, it will lead to a high false alarm rate, which is meaningless. Therefore, in this embodiment, the preset threshold is adjusted according to the start time of the AF attack presented by the ECG sample. For example, by setting the threshold between 0.5 and 0.55, an average advance alarm time of 24.5 to 32.6 can be obtained, so that medical treatment can be accurately provided to the patient in advance to ensure the patient's life safety, but it does not constitute a limitation. In addition, some patients quickly change from 0 to 1 before the onset of AF (for example, the ECG data changes within 5 minutes before the onset of AF), so they cannot be regarded as successfully predicted. For this reason, this embodiment counts the number of patients with an advance alarm time of less than 5 minutes, which accounts for a small proportion of the number of people tested in this embodiment and has little impact on the accuracy of the model.
[0125] S105 , predicting the occurrence of paroxysmal AF in the cardiac patient based on the probability of occurrence of paroxysmal AF in each of the multiple ECG segments.
[0126] Among them, the probability of paroxysmal AF occurring in each of several ECG segments is compared with a set threshold, and if any ECG segment exceeds the set threshold, an AF warning can be issued. Of course, the probability predicted by several ECG segments corresponding to the patient can also be combined, and a coordinate diagram analysis tool can be used to draw a ROC curve (receiver operating characteristic curve) from 0 to 1 to analyze the possibility of paroxysmal AF occurring in heart patients.
[0127] In the technical solution of the present invention, a single-lead ECG test is used to predict and diagnose patients with paroxysmal AF, an end-to-end artificial intelligence-based automatic prediction and diagnosis model is developed, and the deep learning model is trained, verified and tested on the 24-hour dynamic ECG dataset of the Department of Cardiovascular Medicine of Hospital A. It aims to provide an effective, high-precision, practical and comprehensive automatic ECG prediction and diagnosis framework, which can be used as a reliable tool in the clinical prediction, diagnosis and decision-making process of AF and other arrhythmias. In this solution, the autoencoder and logistic regression model are mainly trained using ECG samples diagnosed as paroxysmal AF. By combining the autoencoder and logistic regression model to build an ECG automatic prediction framework for the prediction and diagnosis of paroxysmal AF patients, the prediction of paroxysmal AF can be improved, providing an accurate basis for clinical prediction, diagnosis and decision-making.
[0128] In the second aspect, based on the same inventive concept as the prediction method for paroxysmal atrial fibrillation provided in the embodiment of the first aspect, the embodiment of the present invention further provides a prediction system for paroxysmal atrial fibrillation, see Figure 6 ,include:
[0129] An acquisition unit 601 is used to acquire a dynamic electrocardiogram (ECG) of a heart patient;
[0130] A cutting unit 602 is used to cut the dynamic electrocardiogram ECG to obtain a plurality of ECG segments containing R peaks;
[0131] An autoencoder processing unit 603 is used to process the plurality of ECG segments to mine hidden features and output feature parameters corresponding to the plurality of ECG segments;
[0132] The model processing unit 604 is used to input the characteristic parameters corresponding to the plurality of ECG segments into the trained logistic regression model for processing, so as to obtain the probability of occurrence of paroxysmal atrial fibrillation (AF) in each of the plurality of ECG segments; wherein the probability is limited between 0 and 1, 0 indicates that paroxysmal AF does not occur, and 1 indicates that paroxysmal AF occurs, and the greater the probability, the greater the possibility of occurrence of paroxysmal AF;
[0133] A prediction unit 605, configured to predict the occurrence of paroxysmal AF in the cardiac patient based on the probability of occurrence of paroxysmal AF in each of the plurality of ECG segments;
[0134] The autoencoder and the logistic regression model are mainly trained using ECG samples diagnosed as paroxysmal AF.
[0135] It should be noted that the prediction system for paroxysmal atrial fibrillation provided by the embodiment of the present invention, wherein the specific manner in which each module performs operations has been described in detail in the method embodiment provided in the above-mentioned first aspect, and the specific implementation process can refer to the method embodiment provided in the above-mentioned first aspect, and will not be elaborated here.
[0136] In the third aspect, based on the same inventive concept as the prediction method for paroxysmal atrial fibrillation provided in the embodiment of the first aspect, the embodiment of the present invention further discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the methods described above.
[0137] In the fourth aspect, based on the same inventive concept as the prediction method for paroxysmal atrial fibrillation provided in the embodiment of the first aspect, the embodiment of the present invention also discloses a prediction device for paroxysmal atrial fibrillation, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the methods described above when executing the program.
[0138] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application.
[0139] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A prediction method for paroxysmal atrial fibrillation, characterized in that: The method comprises: Obtaining a dynamic electrocardiogram (ECG) from a cardiac patient; Cutting the dynamic electrocardiogram ECG to obtain a plurality of ECG segments containing R peaks; Inputting the plurality of ECG segments into an autoencoder to mine hidden features, and outputting feature parameters corresponding to the plurality of ECG segments; Inputting the characteristic parameters corresponding to the plurality of ECG segments into the trained logistic regression model for processing, and obtaining the probability of occurrence of paroxysmal atrial fibrillation (AF) in each of the plurality of ECG segments; wherein the probability is limited between 0 and 1, 0 indicates that paroxysmal AF does not occur, and 1 indicates that paroxysmal AF occurs, and the greater the probability, the greater the possibility of occurrence of paroxysmal AF; Based on the probability of occurrence of paroxysmal AF in each of the plurality of ECG segments, predicting the occurrence of paroxysmal AF in the cardiac patient; The autoencoder and the logistic regression model are mainly trained using ECG samples diagnosed as paroxysmal AF.
2. The method according to claim 1, characterized in that Before cutting the dynamic electrocardiogram ECG to obtain a plurality of ECG segments containing R peaks, the method further includes: The dynamic electrocardiogram (ECG) is processed by using a discrete wavelet transform algorithm to obtain actual noise of the dynamic electrocardiogram (ECG); the actual noise is one or more of baseline drift, flat line, and high-frequency noise; A scoring mechanism is introduced to score the actual noise, and the dynamic electrocardiogram ECG whose noise score is within a set scoring range is retained.
3. The method according to claim 1, characterized in that The structure of the autoencoder includes: an encoder and a decoder; wherein, The encoder is used to map the input x to a hidden variable space with a lower dimension than the input x, and obtain a low-dimensional variable h, with the following structure: h=Flatten(Maxpool(Residual.a * n2(Residual.b * (MaxpoolResidual.a * n1 ((Residual.b * (Maxpool(Residual.a * n1 (Conv(x)))))))))) Among them, input x refers to the ECG segment, Conv represents the convolution operation, and Residual.a * n1 Indicates that the residual block a is used to perform the operation, n1 and n2 represent the different numbers of residual blocks a, * indicates that the residual block contains more than one convolutional layer, Maxpool represents the maximum pooling operation, Residual.b * Indicates that the residual block b is used to perform the operation, and Flatten indicates the flattening operation; The decoder is used to reversely map the low-dimensional variable h to the original data space to obtain the original dimensional data y, and the structure is as follows: y=Conv(Upsample(Residual.a n 4(Residual.b * (Upsample(Residual.a * n1 (Residual.b * (Upsample(Residual.a * n3 (upsample(Reshape(h)))))))))) Among them, Reshape represents a reshaping operation, Upsample represents an upsampling operation, and n3 and n4 represent different numbers of residual blocks a.
4. The method according to claim 3, characterized in that The residual block a and the residual block b are constructed into a bottleneck structure using convolutional layers; in the bottleneck structure, two convolutional layers with a core size of 1 are applied before and after a functional convolutional layer with a core size of 3.
5. The method according to claim 3, characterized in that The training process of the autoencoder is as follows: Collect the original input sample x i , represents a matrix, k×1 is the dimension of the original input sample, 1 represents the number of channels; the original input sample x i ECG samples belonging to patients diagnosed with paroxysmal AF; The original input sample x i Transformed into damaged samples in, is the damaged ECG segment affected by noise ∈, ∈∈N(0,σ), the noise obeys the normal distribution, σ is the scale range; The encoder in the autoencoder transforms the damaged sample Hidden variables h mapped to low-dimensional space i , the decoder in the autoencoder converts the hidden variable h i Output samples y that are reverse-mapped to the original dimensions i ; Take the original input sample x i and the output sample y i The minimum mean square error of is used as the loss function, and the autoencoder is trained by iterative gradient descent method until the loss function converges.
6. The method according to claim 5, characterized in that The training process of the logistic regression model is as follows: The original input sample x i Marking is performed; wherein the original input sample x i Labeled as 0 or 1, 0 represents sinus rhythm samples and 1 represents AF samples; Process the original input sample x using the autoencoder i , and obtain the corresponding output sample; The output sample is input into the logistic regression model and combined with the original input sample x i The label and the set loss function are used to train the logistic regression model using an iterative gradient descent method until the set loss function converges; If the output of the logistic regression model is higher than a preset threshold, an alarm will be issued indicating that paroxysmal AF is about to occur.
7. The method according to claim 6, characterized in that The method further includes: adjusting the preset threshold according to the AF attack start time presented by the ECG sample.
8. A prediction system for paroxysmal atrial fibrillation, characterized in that: include: An acquisition unit, used for acquiring a dynamic electrocardiogram (ECG) of a heart patient; A cutting unit, used for cutting the dynamic electrocardiogram ECG to obtain a plurality of ECG segments containing R peaks; An autoencoder processing unit, used for processing the plurality of ECG segments to mine hidden features and outputting feature parameters corresponding to the plurality of ECG segments; A model processing unit, used for inputting the characteristic parameters corresponding to the plurality of ECG segments into the trained logistic regression model for processing, so as to obtain the probability of occurrence of paroxysmal atrial fibrillation (AF) in each of the plurality of ECG segments; wherein the probability is limited between 0 and 1, 0 indicates that paroxysmal AF does not occur, 1 indicates that paroxysmal AF occurs, and the greater the probability, the greater the possibility of occurrence of paroxysmal AF; A prediction unit, configured to predict the occurrence of paroxysmal AF in the cardiac patient based on the probability of occurrence of paroxysmal AF in each of the plurality of ECG segments; The autoencoder and the logistic regression model are mainly trained using ECG samples diagnosed as paroxysmal AF.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A prediction device for paroxysmal atrial fibrillation, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 7 are implemented.