A two-stage-based dynamic electrocardiosignal atrial fibrillation detection method and device

By employing a two-stage atrial fibrillation detection method, a lightweight convolutional model and a Transformer model are used to screen and refine dynamic electrocardiogram signals, solving the problems of missed and false detections of short-term, paroxysmal atrial fibrillation and achieving efficient and accurate atrial fibrillation detection.

CN116725486BActive Publication Date: 2026-02-17SUZHOU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310607548.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-26
Publication Date
2026-02-17
Estimated Expiration
2043-05-26

AI Technical Summary

Technical Problem

Existing technologies are prone to missed or false detections of short-term, paroxysmal atrial fibrillation, and there is a problem of wasted computational resources in dynamic electrocardiogram signals, especially when the dataset is large, it is difficult to balance algorithm efficiency and accuracy.

Method used

A two-stage atrial fibrillation detection method is adopted. First, a lightweight convolutional model RDAF-net is used for coarse detection to quickly screen out suspected atrial fibrillation segments. Then, a ConvTransAF-net model is used for fine detection, and the results are optimized by median filtering.

Benefits of technology

It improves the accuracy and efficiency of short-term, paroxysmal atrial fibrillation detection, avoids waste of resources, and ensures complete detection of short-term atrial fibrillation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116725486B_ABST
    Figure CN116725486B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of dynamic electrocardiosignal atrial fibrillation detection method, device based on two stages.The dynamic electrocardiosignal atrial fibrillation detection provided by the present application includes the following steps: the first sampling frequency is down-sampled to dynamic electrocardiosignal and QRS wave position sequence, long-range dynamic electrocardiosignal is intercepted using sliding window method, suspected atrial fibrillation region is extracted quickly by model RDAF-net, while reducing atrial fibrillation segment missed detection rate, ensure accuracy, provide basis for the second stage of detailed detection.Suspected atrial fibrillation segment set detected in the first stage is sampled by second sampling frequency, and the segment under second sampling frequency is intercepted by sliding window method, and the sampled suspected atrial fibrillation segment is input into model ConvTransAF-net, and the suspected atrial fibrillation segment input is finely detected.Finally, the classification result of the second stage is post-processed by median filter, and the final atrial fibrillation detection result is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of atrial fibrillation detection, and in particular to a method and apparatus for atrial fibrillation detection based on two-stage dynamic electrocardiogram signals. Background Technology

[0002] Atrial fibrillation (AF) is a common cardiac arrhythmia characterized by irregular, rapid, and disordered atrial contractions, leading to irregular ventricular contractions and a loss of normal contractile force. AF increases the risk of stroke, heart failure, and other complications. Due to its importance and prevalence, AF is often considered a separate area of ​​research within cardiac arrhythmias. In clinical practice, Holter monitoring is a powerful tool for revealing the occurrence, duration, and termination of AF.

[0003] Currently, traditional methods for detecting atrial fibrillation (AF) can be divided into two types: those based on atrial activity analysis and those based on ventricular activity analysis. AF is related to atrial activity disorder. From the perspective of electrocardiogram (ECG) changes, during AF, a series of irregular, low-amplitude, high-frequency f waves appear at the original P wave location, indicating significant characteristic changes in atrial activity. Methods based on atrial activity analysis mainly detect or classify AF by detecting the differences between the P wave and the f wave and designing corresponding features. Rapid and uncoordinated atrial activity can also cause irregular ventricular rhythms in the ECG signal, manifested as irregular RR intervals in the waveform. Methods based on ventricular activity analysis primarily focus on various statistical parameters of the RR interval.

[0004] Atrial activity analysis can address situations where heart rate variability is relatively low or heart rate is controlled by medication during atrial fibrillation. However, due to the low energy of P and f waves in the electrocardiogram, they are susceptible to noise interference, leading to false positives. In contrast, ventricular activity analysis is more robust to noise, but its accuracy still has room for improvement when handling complex rhythms because the information contained in the RR interval is limited. Furthermore, using the RR interval for atrial fibrillation detection often requires a relatively long ECG signal, making it difficult to effectively detect short-duration paroxysmal atrial fibrillation, and prone to missed or false positives in short-duration, paroxysmal atrial fibrillation.

[0005] Therefore, many methods apply deep learning to atrial fibrillation (AF) detection and classification tasks based on electrocardiogram (ECG) signals. Compared with traditional methods, deep learning methods generally have better accuracy and generalization ability in AF detection. However, they still face several challenges when dealing with dynamic ECG signals: the quality of dynamic ECG signals is unstable and easily affected by noise factors such as electromyography (EMG) interference and electrode displacement, which affects the performance of AF detection algorithms; AF can manifest in various forms, such as different durations, different heart rhythms, and different morphologies of AF waves. In addition, some other non-AF rhythms also have similar characteristics to AF, which may confuse the identification algorithm and reduce performance. Some solutions even neglect the balance between algorithm efficiency and detection accuracy, especially for some paroxysmal AF ECG signals. Due to their occasional occurrence and short duration, using a high-precision large model to detect the entire process wastes computational resources and is not conducive to large datasets, thus lacking necessity. Summary of the Invention

[0006] Therefore, the technical problem to be solved by the present invention is to overcome the problem that the existing technology of detecting atrial fibrillation by analyzing the RR interval is prone to missed detection and false detection for short-term, paroxysmal atrial fibrillation; it ignores the balance between algorithm efficiency and detection accuracy, especially for some paroxysmal atrial fibrillation ECG signals, because they occur occasionally and last for a short time, using a high-precision large model to detect the whole process wastes computing resources and is not conducive to the large dataset, thus lacking necessity.

[0007] To address the aforementioned technical problems, this invention provides a method for detecting atrial fibrillation based on a two-stage dynamic electrocardiogram signal, characterized by the following steps:

[0008] Step 1: Downsample the dynamic ECG signal at a first sampling frequency, process the sampled signal through a first sliding window to obtain a short ECG signal segment of a first fixed length as the first input branch; set a QRS wave position sequence of a first fixed length as the second input branch; input the first input branch and the second input branch into the lightweight convolutional model RDAF-net respectively, and obtain the first feature and the second feature through the feature extraction module of the RDAF-net model; concatenate the first feature and the second feature, and reduce the number of channels of the concatenated new feature through the convolution kernel; finally, use dense connections and activation functions to determine whether there is a suspected atrial fibrillation segment in the input short ECG signal segment; set a first discrimination threshold, and if the duration of the atrial fibrillation episode in the input short ECG signal segment is greater than the first discrimination threshold, the segment is marked as a suspected atrial fibrillation segment;

[0009] Step 2: Restore the set of suspected atrial fibrillation segments detected in Step 1 to the sampling frequency of the dynamic ECG signal, i.e., the second sampling frequency, and sample them; process the restored set of suspected atrial fibrillation segments through the second sliding window, moving with the second step size to obtain a second fixed-length ECG signal segment; input the ECG signal segment into the ConvTransAF-net model; the input ECG signal segment first passes through the feature extraction module, and the extracted features are input into the encoding module for encoding. The encoded ECG signal segment is then processed through a dense connection layer and an activation function to complete the secondary classification of atrial fibrillation segments and non-atrial fibrillation segments; set a second discrimination threshold. In the input short ECG signal segments, if the duration of an atrial fibrillation episode is greater than the second discrimination threshold, the segment is marked as an atrial fibrillation segment;

[0010] Step 3: In Step 2, when the second sliding window detects the ECG signal with a second step size, a predicted probability of atrial fibrillation for a second fixed-length ECG signal segment within the second sliding window is generated. A prediction probability discrimination threshold is set, and the predicted probability generated in Step 2 is judged. The portion of the predicted probability less than the threshold is set to 0, and the portion of the predicted probability greater than or equal to the threshold is set to 1. The prediction result is further processed using median filtering, and the filtered result is the target atrial fibrillation detection result of the dynamic ECG signal.

[0011] In one embodiment of the present invention, in step 1, the first sampling frequency is 50Hz, the first sliding window length is 30s, the first step length is 15s, the first fixed length is 30s, and the first discrimination threshold is 5s; in step 2, the second sampling frequency is 250Hz, the second sliding window length is 5s, the second step length is 1s, the second fixed length is 5s, and the second discrimination threshold is 2.5s.

[0012] In one embodiment of the present invention, in step 1, the feature extraction module of the RDAF-net model includes a regular convolutional module and a grouped convolutional module; wherein, the kernel size of the regular convolutional module is 1×15, and the kernel size of the grouped convolutional module is Group=4 and the kernel size is 1×11; in both the regular convolutional module and the grouped convolutional module, a BN layer and the ReLU activation function are connected after the convolutional layer, and then the feature map is downsampled by 10 times through the AvgPool1D pooling layer, and finally the Disout activation function is used to improve the network's generalization ability.

[0013] In one embodiment of the present invention, in step 1, the first feature and the second feature are spliced ​​together and then the number of channels is reduced by using a convolutional module with a kernel size of 1×1; finally, two densely connected layers and a Sigmoid activation function are used to determine whether atrial fibrillation may exist in the input electrocardiogram signal segment and to find suspected atrial fibrillation segments.

[0014] In one embodiment of the present invention, during the training of the RDAF-net model, a weighted cross-entropy loss function is designed, and the ratio of false positives to false negatives is set to 1:2 to constrain the RDAF-net model; the atrial fibrillation judgment threshold is set to 0.5, and when the output probability of the model is greater than 0.5, it is judged as a suspected atrial fibrillation segment, and when the output probability is less than 0.5, it is considered as a non-atrial fibrillation segment; the prediction output of the RDAF-net model is One-Hot encoded, and the training optimizer is the Adams algorithm.

[0015] In one embodiment of the present invention, in step 2, the feature extraction module of the ConvTransAF-net model includes a multi-scale convolutional module and two grouped convolutional modules; wherein the kernel sizes of the multi-scale convolutional modules are 1×3, 1×9, and 1×15, respectively, and after the convolutional layer, they pass through a BN layer and the ReLU activation function in sequence; the three channels output by the multi-scale convolutional modules are concatenated, and lightweight channel attention (EAC) is used to selectively weight different channels of the feature map to enhance the effective feature channels; finally, average downsampling is performed and a Disout layer is used to improve the model's generalization ability; in the two grouped convolutional modules, Group = 4 and the kernel sizes are 1×7 and 1×3, respectively, and the feature map size is reduced to 1 / 5 and 1 / 2 after two samplings by the grouped convolutional modules; in the grouped convolutional modules, a BN layer and the ReLU activation function are connected after the convolutional layer, and a Disout layer is set afterward to improve the model's generalization ability.

[0016] In one embodiment of the present invention, in step 2, the features obtained by the feature extraction module are first reduced in dimension by the Squeeze operation, then the dimension order is swapped by the Permute operation, and then the input feature values ​​are converted into a high-dimensional vector representation by the six-layer encoding module TransformerEncoderLayer. Finally, the average value of the channel dimensions is calculated as the output. At the end of the ConvTransAF-net model, two densely connected layers and activation functions are used to realize the binary classification of atrial fibrillation segments.

[0017] In one embodiment of the present invention, during the training of the ConvTransAF-net model, the cross-entropy loss function is used, the model's prediction output is One-Hot encoded, and the training optimizer is the Adam algorithm.

[0018] In one embodiment of the present invention, in step 3, the probability discrimination threshold is 0.5; the window length of the median filter is 3s.

[0019] The present invention also provides a two-stage dynamic electrocardiogram signal atrial fibrillation detection device, comprising:

[0020] The suspected atrial fibrillation segment extraction module is used to downsample the dynamic electrocardiogram (ECG) signal at a first sampling frequency. The sampled signal is processed through a first sliding window to obtain a short ECG signal segment of a first fixed length as the first input branch. A QRS wave position sequence of a first fixed length is set as the second input branch. The first and second input branches are respectively input into the lightweight convolutional model RDAF-net. The feature extraction module of the RDAF-net model obtains the first and second features. The first and second features are concatenated. The new feature after concatenation is reduced in channel number by a convolution kernel. Finally, dense connections and activation functions are used to determine whether there is a suspected atrial fibrillation segment in the input short ECG signal segment. A first discrimination threshold is set. If the duration of the atrial fibrillation episode in the input short ECG signal segment is greater than the first discrimination threshold, the segment is marked as a suspected atrial fibrillation segment.

[0021] The atrial fibrillation probability prediction module is used to restore the set of suspected atrial fibrillation segments detected by the suspected atrial fibrillation segment extraction module to the sampling frequency of the dynamic electrocardiogram (ECG) signal, i.e., the second sampling frequency, and sample them. The restored set of suspected atrial fibrillation segments is processed through a second sliding window, moving with a second step size to obtain a second fixed-length ECG signal segment. This ECG signal segment is then input into the ConvTransAF-net model. The input ECG signal segment first passes through a feature extraction module, and the extracted features are encoded by an encoding module. The encoded ECG signal segment is then processed through a dense connection layer and an activation function to perform a secondary classification of atrial fibrillation segments and non-atrial fibrillation segments. A second discrimination threshold is set. In the input short ECG signal segments, if the duration of an atrial fibrillation episode is greater than the second discrimination threshold, the segment is marked as an atrial fibrillation segment.

[0022] The atrial fibrillation detection result output module is used to generate atrial fibrillation prediction probability for a second fixed-length ECG signal segment within the second sliding window when the ECG signal is detected in the second sliding window with a second step size in the atrial fibrillation probability prediction module. It sets a prediction probability discrimination threshold and judges the prediction probability generated by the atrial fibrillation probability prediction module; sets the portion of the prediction probability less than the threshold to 0 and the portion greater than or equal to the threshold to 1; and further processes the prediction result using median filtering. The filtered result is the target atrial fibrillation detection result of the dynamic ECG signal.

[0023] The technical solution of the present invention has the following advantages compared with the prior art:

[0024] The atrial fibrillation detection method based on a two-stage dynamic electrocardiogram (ECG) signal described in this invention performs a coarse detection in the first stage and a fine detection in the second stage on long-term dynamic ECG signals. In the first stage, a lightweight convolutional model is used to quickly extract segments suspected of causing atrial fibrillation while minimizing the omission of atrial fibrillation segments, ensuring detection efficiency. In the second stage of fine detection, the suspected segments extracted in the first stage are further refined to accurately locate segments where atrial fibrillation occurs, ensuring detection accuracy and avoiding false positives. This invention combines efficiency and accuracy, avoiding the resource waste caused by large-scale detection of the entire ECG signal. This invention sets a short-time threshold during the detection process to avoid missing short-term, paroxysmal atrial fibrillation. Attached Figure Description

[0025] To make the content of this invention easier to understand, the invention will be further described in detail below with reference to specific embodiments and accompanying drawings, wherein...

[0026] Figure 1 This is a flowchart of a two-stage dynamic electrocardiogram signal atrial fibrillation detection method provided by an embodiment of the present invention.

[0027] Figure 2 This is a diagram of the first-stage model RDAF-net structure of a two-stage dynamic electrocardiogram signal atrial fibrillation detection method provided in this embodiment of the invention.

[0028] Figure 3 This is a diagram of the ConvTransAF-net structure, the second-stage model of a two-stage dynamic electrocardiogram signal atrial fibrillation detection method provided in this embodiment of the invention.

[0029] Figure 4 This is a schematic diagram illustrating the effect of the post-processing stage provided in an embodiment of the present invention.

[0030] Figure 5 This is a schematic diagram of step 1, the construction of the training dataset, provided in an embodiment of the present invention.

[0031] Figure 6 This is a schematic diagram of step 2, the construction of the training dataset, provided in an embodiment of the present invention. Detailed Implementation

[0032] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments described are not intended to limit the present invention.

[0033] The flowchart of the two-stage atrial fibrillation detection method proposed in this invention is as follows: Figure 1 As shown, the specific method is as follows:

[0034] Step 1: Downsample the dynamic ECG signal at a first sampling frequency, process the sampled signal through a first sliding window to obtain a short ECG signal segment of a first fixed length as the first input branch; set a QRS wave position sequence of a first fixed length as the second input branch; input the first input branch and the second input branch into the lightweight convolutional model RDAF-net respectively, and obtain the first feature and the second feature through the feature extraction module of the RDAF-net model; concatenate the first feature and the second feature, and reduce the number of channels of the concatenated new feature through the convolution kernel; finally, use dense connections and activation functions to determine whether there is a suspected atrial fibrillation segment in the input short ECG signal segment; set a first discrimination threshold, and if the duration of the atrial fibrillation episode in the input short ECG signal segment is greater than the first discrimination threshold, the segment is marked as a suspected atrial fibrillation segment;

[0035] Step 2: Restore the set of suspected atrial fibrillation segments detected in Step 1 to the sampling frequency of the dynamic ECG signal, i.e., the second sampling frequency, and sample them; process the restored set of suspected atrial fibrillation segments through the second sliding window, moving with the second step size to obtain a second fixed-length ECG signal segment; input the ECG signal segment into the ConvTransAF-net model; the input ECG signal segment first passes through the feature extraction module, and the extracted features are input into the encoding module for encoding. The encoded ECG signal segment is then processed through a dense connection layer and an activation function to complete the secondary classification of atrial fibrillation segments and non-atrial fibrillation segments; set a second discrimination threshold. In the input short ECG signal segments, if the duration of an atrial fibrillation episode is greater than the second discrimination threshold, the segment is marked as an atrial fibrillation segment;

[0036] Step 3: In Step 2, when the second sliding window detects the ECG signal with a second step size, a predicted probability of atrial fibrillation for a second fixed-length ECG signal segment within the second sliding window is generated. A prediction probability discrimination threshold is set, and the predicted probability generated in Step 2 is judged. The portion of the predicted probability less than the threshold is set to 0, and the portion of the predicted probability greater than or equal to the threshold is set to 1. The prediction result is further processed using median filtering, and the filtered result is the target atrial fibrillation detection result of the dynamic ECG signal.

[0037] In step 1, the long-term dynamic electrocardiogram (ECG) signal and QRS wave position sequence are first downsampled, and then the sampled long-term ECG signal is segmented using the sliding window method. The segmented ECG signal segments and QRS wave position sequences are then input into the lightweight convolutional RDAF-net model, which rapidly extracts suspected atrial fibrillation (AF) segments. A first discrimination threshold is set. If the duration of an AF episode in the input signal is greater than the first discrimination threshold, the segment is marked as a suspected AF segment and proceeds to the second stage for detailed detection; otherwise, the segment is considered non-AF segment and does not require the second stage of detailed detection. Furthermore, if the proportion of suspected AF segments detected in the first stage is 0%, it is considered as no AF; if the proportion of detected suspected AF segments is ≥90%, it is considered as persistent AF, and the second stage of detection is not required.

[0038] Specifically, the long-term dynamic electrocardiogram (ECG) signal and QRS wave position sequence were first downsampled at 50Hz. A sliding window method was then used to segment the long-term ECG signal to obtain short ECG signal segments, with a window length of 30s, a step size of 15s, and an overlap rate of 50%. (Refer to...) Figure 2 The RDAF-net model structure diagram shown illustrates that segmented short ECG signal fragments are input into the model as branch one, while a 30-second QRS wave position sequence at 50Hz is input as branch two, guiding the model to emphasize the relevant features of the QRS wave. After entering the model, both branches first pass through a regular convolutional module with a kernel size of 1×15, and then through a grouped convolutional module with a kernel size of 1×11 and a group of 4 convolutional layers for feature extraction. In the feature extraction module, both the regular and grouped convolutional modules are followed by a BN layer and a ReLU activation function after the convolutional layers to enhance the model's nonlinearity. To reduce computational cost, a 10x downsampling is used after both convolutions to quickly reduce the feature map size, and finally, a Disout layer is used to improve the model's generalization ability. The two branches that have passed through the feature extraction module are concatenated, and a convolutional module with a kernel size of 1×1 is used to reduce the number of channels. Finally, two dense connections and a Sigmoid activation function are used to determine whether atrial fibrillation may exist within the 30-second signal. In this model, the first judgment threshold is set to 3s, that is, if an atrial fibrillation segment longer than 3s appears in the input 30s signal, the segment is marked as a suspected atrial fibrillation segment.

[0039] Reference Figure 5 As shown, in order to train the RDAF-net model, 11,500 non-repeating 30-second ECG signals were extracted from the MIT-BIH atrial fibrillation dataset for training and testing. All data were downsampled to 50Hz, of which 4,693 were AF segments, accounting for 40.81%, and 6,807 were non-AF segments, accounting for 59.19%.

[0040] In the CPSC2018 dataset, all signals were first downsampled to 50Hz. Then, based on a 30-second timescale, ECG signals longer than 30 seconds were truncated, and signals longer than 15 seconds but less than 30 seconds were padded with zeros at the end to make them 30 seconds long. The signals were then randomly truncated without repetition from the recorded leads I, II, and V2, resulting in 1950 30-second single-lead segments, of which 948 were in the AF segment (48.62%) and 1002 were in the non-AF segment (51.38%).

[0041] In summary, during the first phase of training the RDAF-net model, a total of 13,450 sets of 30-second long signal segments were collected at a sampling rate of 50Hz. Among them, 5,641 sets were atrial fibrillation segments, accounting for 41.94%, and 7,809 sets were non-atrial fibrillation segments, accounting for 58.06%. In addition, the QRS wave position sequence of each data point was generated to meet the input requirements of the RDAF-net model.

[0042] During the first phase of training, a weighted cross-entropy loss function was used, with a heavier penalty for false positives, setting the penalty ratio between false positives and false negatives to 1:2. During testing, the atrial fibrillation (AF) detection threshold was set to 0.5. If the model's output probability was greater than 0.5, it was classified as AF; otherwise, it was classified as Non-AF. The model's predicted output was one-hot encoded. The batch size was set to 64, and the Adam algorithm was used as the training optimizer, with Lr = 0.001, Beta_1 = 0.9, Beta_2 = 0.999, and Epsilon = 1e-08.

[0043] The computational cost and parameter count of the RDAF-net model were measured using the OpCounter toolbox, and were only 0.96M and 2.3K respectively. The RDAF-net model has low complexity and is suitable for rapid screening in the first stage.

[0044] In step 2, refer to Figure 3 The model structure shown in this invention involves designing a ConvTransAF-net model in the second stage to perform refined detection of suspected atrial fibrillation segments extracted in the first stage. To achieve better performance, the ConvTransAF-net model uses an improved CNN as its backbone structure to extract high-level semantic features from the electrocardiogram signal. Then, a Transformer is used to establish global connections between the acquired high-level semantic features to achieve refined detection of suspected atrial fibrillation segments and determine the specific location of atrial fibrillation.

[0045] First, the suspected atrial fibrillation (AF) segments identified in the first stage are restored to a 250Hz ECG signal to obtain more refined short ECG signal segments. Simultaneously, a sliding window is used again to segment the input suspected ECG signal segments, with a window length of 5s, a stride of 1s, and an overlap rate of 80%. The resulting 250Hz, 5s short ECG signal segments are used as input to the ConvTransAF-net model. A second discrimination threshold of 2.5s is set; if the labeled AF beat duration in a 5s segment is greater than or equal to 2.5s, AF is considered to have occurred. The input ECG signal first passes through a set of multi-scale convolutional modules with kernel sizes of 1×3, 1×9, and 1×15. In these modules, smaller kernel sizes obtain finer-grained details, while larger kernel sizes capture features at different spatial scales. After convolution, a batch normalization (BN) layer and the ReLU activation function are applied to enhance the model's nonlinearity. The channels after convolution at three scales are concatenated, and a lightweight channel attention (EAC) is used to selectively weight different channels of the feature map, enhancing the effective feature channels. Finally, average downsampling is performed, and a Disout layer is used to improve the model's generalization ability. The obtained feature maps are sequentially passed through two grouped convolutional modules for feature extraction, and the feature map size is compressed. In the grouped convolutional modules, Group=4, and the convolutional kernel sizes are 1×7 and 1×3 respectively. After two downsampling operations, the feature map size is reduced to 1 / 5 and 1 / 2 respectively. In the grouped convolutional modules, a BN layer and the ReLU activation function are connected after the convolutional layer, and a Disout layer is set to improve the model's generalization ability. The features output from the above grouped convolutional modules are first reduced in dimension by a Squeeze operation, and then the dimension order is swapped by a permute operation. Then, they are passed through a six-layer TransformerEncoderLayer to convert the input feature values ​​into a high-dimensional vector representation. The hyperparameters of the encoder layer are set as follows: Dmodel=48, H=6, D=24, Dropout=0.2. Finally, the Mean operation is used to calculate the average value of the channel dimensions as the output. Finally, two dense connections and the Sigmad activation function are used to implement binary classification of atrial fibrillation fragments.

[0046] Reference Figure 6 As shown, to train the second-stage ConvTransAF-net model of this invention, 40375 signal segments of 5 seconds each were collected at a sampling rate of 250Hz. Among them, 12714 segments were atrial fibrillation segments, accounting for 31.49%, and 27661 segments were non-atrial fibrillation segments, accounting for 68.51%. During training, the cross-entropy loss function was used, the model's prediction output was one-hot encoded, the batch size was set to 64, and the Adam algorithm was used as the training optimizer, where Lr = 0.001, Beta_1 = 0.9, Beta_2 = 0.999, and Epsilon = 1e-08.

[0047] The complexity of the ConvTransAF-net model was measured using the OpCounter toolbox. Evaluation metrics included computational cost (FLOPs) and parameter count (Params). The results were FLOPs = 1.24M and Params = 20.96K. The ConvTransAF-net model performs secondary classification on suspected atrial fibrillation segments extracted by the first-stage model RDAF-net. This not only avoids missing short-term and paroxysmal atrial fibrillation, but also reduces computational cost and saves computational resources.

[0048] In step 3, during step 2, when the ECG signal is detected using a sliding window with a step size of 1 second, a predicted probability of atrial fibrillation is generated every second, and the following output is shown: Figure 4 The corresponding predicted probability sequence is shown in (a). A threshold of 0.5 is set for the predicted probability, as shown in (a). Figure 4 As shown in (b), the portion of the predicted probability less than the threshold is set to 0, and the portion of the predicted probability greater than the threshold is set to 1. Median filtering is used to further process the prediction results, eliminating some short-term detection oscillations and improving the stability of the detection results. The window length of the median filter is set to 3 seconds, resulting in the following... Figure 4 (c) shows the filtered result as the result of atrial fibrillation detection.

[0049] The present invention also provides a two-stage dynamic electrocardiogram signal atrial fibrillation detection device, comprising:

[0050] The suspected atrial fibrillation segment extraction module is used to downsample the dynamic electrocardiogram (ECG) signal at a first sampling frequency. The sampled signal is processed through a first sliding window to obtain a short ECG signal segment of a first fixed length as the first input branch. A QRS wave position sequence of a first fixed length is set as the second input branch. The first and second input branches are respectively input into the lightweight convolutional model RDAF-net. The feature extraction module of the RDAF-net model obtains the first and second features. The first and second features are concatenated. The new feature after concatenation is reduced in channel number by a convolution kernel. Finally, dense connections and activation functions are used to determine whether there is a suspected atrial fibrillation segment in the input short ECG signal segment. A first discrimination threshold is set. If the duration of the atrial fibrillation episode in the input short ECG signal segment is greater than the first discrimination threshold, the segment is marked as a suspected atrial fibrillation segment.

[0051] The atrial fibrillation probability prediction module is used to restore the set of suspected atrial fibrillation segments detected by the suspected atrial fibrillation segment extraction module to the sampling frequency of the dynamic electrocardiogram (ECG) signal, i.e., the second sampling frequency, and sample them. The restored set of suspected atrial fibrillation segments is processed through a second sliding window, moving with a second step size to obtain a second fixed-length ECG signal segment. This ECG signal segment is then input into the ConvTransAF-net model. The input ECG signal segment first passes through a feature extraction module, and the extracted features are encoded by an encoding module. The encoded ECG signal segment is then processed through a dense connection layer and an activation function to perform a secondary classification of atrial fibrillation segments and non-atrial fibrillation segments. A second discrimination threshold is set. In the input short ECG signal segments, if the duration of an atrial fibrillation episode is greater than the second discrimination threshold, the segment is marked as an atrial fibrillation segment.

[0052] The atrial fibrillation detection result output module is used to generate atrial fibrillation prediction probability for a second fixed-length ECG signal segment within the second sliding window when the ECG signal is detected in the second sliding window with a second step size in the atrial fibrillation probability prediction module. It sets a prediction probability discrimination threshold and judges the prediction probability generated by the atrial fibrillation probability prediction module; sets the portion of the prediction probability less than the threshold to 0 and the portion greater than or equal to the threshold to 1; and further processes the prediction result using median filtering. The filtered result is the target atrial fibrillation detection result of the dynamic ECG signal.

[0053] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0054] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0055] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0056] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0057] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.

Claims

1. A two-stage based dynamic electrocardiogram signal atrial fibrillation detection method, characterized in that, The method comprises the following steps: Step 1: down-sampling the dynamic electrocardio signal at a first sampling frequency, processing the sampled signal through a first sliding window to obtain a first fixed-length short electrocardio signal segment as a first input branch; setting a first fixed-length QRS wave position sequence as a second input branch; inputting the first input branch and the second input branch into a lightweight convolution model RDAF-net, respectively, obtaining first features and second features through a feature extraction module of the RDAF-net model, splicing the first features and the second features, reducing the channel number of the spliced new features through a convolution kernel, and finally determining whether the input short electrocardio signal segment contains a suspected atrial fibrillation segment by using a dense connection and an activation function; setting a first discrimination threshold, and if the duration of an atrial fibrillation attack is greater than the first discrimination threshold in the input short electrocardio signal segment, the segment is marked as a suspected atrial fibrillation segment; Step 2: restoring the suspected atrial fibrillation segment set detected in step 1 to the sampling frequency of the dynamic electrocardio signal, i.e. a second sampling frequency; processing the restored suspected atrial fibrillation segment set through a second sliding window to obtain a second fixed-length electrocardio signal segment with a second step length; inputting the electrocardio signal segment into a ConvTransAF-net model; the input electrocardio signal segment is first processed through a feature extraction module, the extracted features are input into an encoding module for encoding, and the encoded electrocardio signal segment is classified into an atrial fibrillation segment and a non-atrial fibrillation segment through a dense connection layer and an activation function; setting a second discrimination threshold, and if the duration of an atrial fibrillation attack is greater than the second discrimination threshold in the input short electrocardio signal segment, the segment is marked as an atrial fibrillation segment; Step 3: in the process of detecting the electrocardio signal with the second sliding window and the second step length in step 2, a prediction probability of the atrial fibrillation of the second fixed-length electrocardio signal segment in the second sliding window is generated, a prediction probability discrimination threshold is set to judge the prediction probability generated in step 2; the part of the prediction probability less than the threshold is set to 0, and the part of the prediction probability greater than or equal to the threshold is set to 1; the prediction result is further processed by using a median filter, and the filtered result is the target atrial fibrillation detection result of the dynamic electrocardio signal.

2. The two-stage based dynamic electrocardiosignal atrial fibrillation detection method according to claim 1, characterized in that: In step 1, the first sampling frequency is 50 Hz, the first sliding window length is 30 s, and the first step length is 15 s; the first fixed length is 30 s, and the first discrimination threshold is 3 s; in step 2, the second sampling frequency is 250 Hz, the second sliding window length is 5 s, and the second step length is 1 s; the second fixed length is 5 s, and the second discrimination threshold is 2.5 s.

3. The two-stage based dynamic electrocardiosignal atrial fibrillation detection method according to claim 1, characterized in that: In the step 1, the feature extraction module of the RDAF-net model comprises a regular convolution module and a grouped convolution module; wherein the convolution kernel size of the regular convolution module is , the grouped convolution module has Group=4 and the convolution kernel size is ; in the regular convolution module and the grouped convolution module, a BN layer and an activation function ReLU are connected after the convolution layer, then the feature map is down-sampled by 10 times through an AvgPool1D pooling layer, and finally an activation function Disout is used to improve the network generalization ability.

4. The two-stage based dynamic electrocardiosignal atrial fibrillation detection method of claim 1, wherein: In the step 1, after splicing the first feature and the second feature, a convolution module with a convolution kernel size of is used to reduce the number of channels; finally, two dense connection layers and a Sigmoid activation function are used to determine whether the input ECG signal segment may contain atrial fibrillation, and find out the suspected atrial fibrillation segment.

5. The two-stage based dynamic electrocardiosignal atrial fibrillation detection method according to claim 1, characterized in that: In the training process of the RDAF-net model, a cross-entropy loss function with weights is designed, the loss penalty ratio of misdiagnosis and missed diagnosis is set to 1:2 to constrain the RDAF-net model; the prediction output of the model RDAF-net is One-Hot coding, and the training optimizer is Adams algorithm.

6. The two-stage based dynamic electrocardiosignal atrial fibrillation detection method according to claim 1, characterized in that: In step 2, the feature extraction module of the ConvTransAF-net model comprises a multi-scale convolution module and two group convolution modules; wherein the convolution kernel sizes of the multi-scale convolution module are , and the BN layer and the activation function ReLU are sequentially passed after the convolution layer; the three channels output by the multi-scale convolution module are connected in series, the different channels of the feature mapping are selectively weighted using the lightweight channel attention EAC, and the effective feature channels are enhanced; finally, average down-sampling is performed and the Disout layer is used to improve the model generalization ability; in the two group convolution modules, Group=4 and the convolution kernel sizes are , the feature map sizes are reduced to 1 / 5 and 1 / 2 after two samplings of the group convolution module; in the group convolution module, the BN layer and the activation function ReLU are connected after the convolution layer, and the Disout layer is set to improve the model generalization ability.

7. The two-stage based dynamic electrocardiosignal atrial fibrillation detection method according to claim 1, characterized in that: In the step 2, the features obtained by the feature extraction module are first reduced in dimension by a Squeeze operation, then the dimension order is exchanged by a Permute operation, and then the input feature values are converted into high-dimensional vector representations through six layers of encoding modules, Transformer Encoder Layer, and finally the average value of the channel dimension is calculated as the output; at the end of the ConvTransAF-net model, two densely connected layers and an activation function are used to realize the binary classification of the atrial fibrillation segment.

8. The two-stage based dynamic electrocardiosignal atrial fibrillation detection method according to claim 1, characterized in that: In the training process of the ConvTransAF-net model, a cross-entropy loss function is used, the prediction output of the model is One-Hot encoding, and the training optimizer is the Adam algorithm.

9. The two-stage based dynamic electrocardiosignal atrial fibrillation detection method according to claim 1, characterized in that: In the step 3, the prediction probability discrimination threshold is 0.5, and the window length of the median filter is 3s.

10. A two-stage based dynamic electrocardiogram signal atrial fibrillation detection apparatus, characterized in that, Comprise: The suspected atrial fibrillation segment extraction module is used for downsampling the dynamic electrocardiogram signal at a first sampling frequency, processing the sampled signal through a first sliding window to obtain a first fixed-length short electrocardiogram signal segment as a first input branch; a first fixed-length QRS wave position sequence is set as a second input branch; the first input branch and the second input branch are input into the lightweight convolutional model RDAF-net, and the feature extraction module of the RDAF-net model is used to obtain first features and second features; the first features and the second features are spliced, the new features after splicing are reduced in channel number through a convolution kernel, and finally a dense connection and an activation function are used to determine whether the input short electrocardiogram signal segment contains a suspected atrial fibrillation segment; a first discrimination threshold is set, and if the duration of the atrial fibrillation attack in the input short electrocardiogram signal segment is greater than the first discrimination threshold, the segment is marked as a suspected atrial fibrillation segment; The atrial fibrillation probability prediction module is used for sampling the suspected atrial fibrillation segment set detected in the suspected atrial fibrillation extraction module to the sampling frequency of the dynamic electrocardiogram signal, i.e. the second sampling frequency; the restored suspected atrial fibrillation segment set is processed through a second sliding window with a second step length to obtain a second fixed-length electrocardiogram signal segment; the electrocardiogram signal segment is input into the ConvTransAF-net model; the input electrocardiogram signal segment is first input into the feature extraction module, the extracted features are input into the encoding module for encoding, the encoded electrocardiogram signal segment is classified into atrial fibrillation segments and non-atrial fibrillation segments through a dense connection layer and an activation function; a second discrimination threshold is set, and if the duration of the atrial fibrillation attack in the input short electrocardiogram signal segment is greater than the second discrimination threshold, the segment is marked as an atrial fibrillation segment The atrial fibrillation detection result output module is configured to, when the atrial fibrillation probability prediction module detects the electrocardio signal in the second sliding window with the second step, generate a prediction probability of atrial fibrillation of a second fixed length electrocardio signal segment in the second sliding window, set a prediction probability discrimination threshold, and judge the prediction probability generated by the atrial fibrillation probability prediction module; set a part of the prediction probability less than the threshold to 0, and set a part of the prediction probability greater than or equal to the threshold to 1; and further process the prediction result by median filtering, and the filtered result is a target atrial fibrillation detection result of the dynamic electrocardio signal.