Dynamic electrocardiogram heartbeat classification method, device, equipment and storage medium

By using a multi-band coupling matrix and a dynamic attention module, the problems of low recognition of small amplitude feature waves and heterogeneity of temporal information in ECG heartbeat classification are solved, achieving high-precision heartbeat classification and improving the robustness and generalization performance of the model.

CN120744581BActive Publication Date: 2026-03-31GUANGDONG UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-27
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing ECG heartbeat classification methods suffer from low recognition of second-order coupling features between small-amplitude characteristic waves, heterogeneity of temporal information of multi-view ECG features and non-stationarity of signal-to-noise ratio, and lack of dynamic attention mechanism, which makes it impossible to adaptively adjust the optimal recognition range.

Method used

A multi-band coupling matrix is ​​used to enhance the recognition of second-order coupling features of characteristic waves. A multi-view feature fusion module based on channel-time decoupling cross-attention and a dynamic attention module based on ECG heartbeat multi-neighborhood range hierarchical information fusion are constructed to adaptively extract and fuse multi-view heartbeat information.

Benefits of technology

It significantly improves the accuracy and generalization performance of heartbeat classification, enhances the robustness and generalization ability of the model, and reduces the risk of overfitting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120744581B_ABST
    Figure CN120744581B_ABST
Patent Text Reader

Abstract

The application provides a dynamic electrocardiogram heartbeat classification method and device, equipment and storage medium. It relates to the technical field of electrocardiogram heartbeat classification. The method comprises: preprocessing a data set to obtain multi-view data of ECG heartbeats, and performing feature extraction to obtain multi-view features; embedding the multi-view features of multiple heartbeats into groups according to the increment of the neighborhood size from 0 to l, uniformly setting the features of each view in the same length on the time axis in each group, and connecting them on the channel axis to form multi-range groups, using a multi-view cross-attention mechanism for each range group to obtain multi-view fusion features, and extracting discriminative information from different range multi-group features to obtain attention-enhanced features; inputting the attention-enhanced features and R-R intervals into a classification head to obtain a classification prediction result. The application effectively deals with the inherent diversity of ECG signals and improves the generalization performance of the classification model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electrocardiogram (ECG) heart rate classification technology, and in particular to a dynamic ECG heart rate classification method, apparatus, device, and storage medium. Background Technology

[0002] Electrocardiography (ECG) is a non-invasive technique for assessing heart health and is crucial for detecting arrhythmias in clinical practice. However, manual diagnosis of ECGs by experienced clinicians is time-consuming and inefficient, especially during long-term monitoring. Therefore, much research has focused on developing computer-aided diagnostic and automated classification methods to improve the efficiency of ECG analysis.

[0003] Existing ECG heartbeat classification methods can be broadly categorized into two types based on the number of heartbeats input. The first type focuses on extracting discriminative features from single heartbeat waveforms and multi-beat RR interval sequences. For example, the paper "J. Niu, Y. Tang, Z. Sun, and W. Zhang, 'Inter-patient ECG classification with symbolic representations and multi-perspective convolutional neural networks,' IEEE J. Biomed. Health Inform., vol. 24, no. 5, pp. 1321-1332, May 2020." uses a discretization strategy to convert heartbeat morphology into a symbolic space to improve the robustness of heartbeat morphology representation, and combines RR interval information with a heartbeat embedding matrix to enhance the generalization ability of the heartbeat classification model. The paper "Automatic heartbeat classification using S-shaped reconstruction and a squeeze and excitation residual network," by X.Li, F.Zhang, Z.Sun, D.Li, X.Kong, and Y.Zhang, "Automatic heartbeat classification using S-shaped reconstruction and a squeeze and excitation residual network," Comput. Biol. Med., vol. 140, 2022, Art. no. 105108, segments the heartbeat signal and stacks it into a two-dimensional matrix. Then, two-dimensional convolution is used to expand the receptive field, enhancing the model's ability to perceive the contextual information of the ECG waveform. However, the discriminative information contained in a single heartbeat waveform and the RR interval is limited. Clinically, many abnormal heartbeats, such as supraventricular ectopic beats and ventricular fusion beats, require comprehensive contextual information from multiple heartbeat waveforms for accurate identification. Therefore, the second type of method classifies the target heartbeat based on ECG data from multiple adjacent heartbeats. For example, the paper "X. Zhai and C. Tin, 'Automated ECG classification using dual heartbeat coupling based on convolutional neural network,' IEEE Access, vol. 6, pp. 27465-27472, 2018" highlights the second-order coupling relationship between feature waves by calculating the outer product matrix of adjacent heartbeats, and uses CNN to extract the contextual information of the outer product matrix, which significantly improves the accuracy of heartbeat classification.The paper "F.Li, Y.Xu, Z.Chen, and Z.Liu, 'Automated heartbeat classification using 3-D inputs based on convolutional neural network with multi-fields ofview,' IEEE Access, vol.7, pp.76295-76304, 2019" uses a 2D convolutional network to extract multi-field information from a matrix composed of ECG heartbeat morphology, RR interval, and correlation coefficients of adjacent heartbeats, which significantly improves the recognition accuracy of supraventricular ectopic beats and ventricular ectopic beats. The paper "S. Mousavi and F. Afghah, 'Inter-and intra-patient ECG heartbeat classification for arrhythmia detection: A sequence-to-sequence deep learning approach,'" in Proc. IEEE Int. Conf. Acoust., Speech Signal Process., 2019, pp. 1308-1312, constructs a sequence-to-sequence prediction model based on a bidirectional recurrent neural network (BiRNN) to extract potential contextual information from multi-beat ECGs, effectively improving the recognition accuracy of supraventricular ectopic beats and ventricular fusion beats. However, for long-term multi-beat sequence modeling tasks, BiRNN suffers from difficulties in learning long-range dependencies due to gradient vanishing. Therefore, the paper "Y.Xia, Y.Xiong, and K.Wang, 'A transformer model blended with CNN and denoising autoencoder for inter-patient ecg arrhythmia classification,' Biomed. Signal Process. Control, vol. 86, 2023, Art. no. 105271" uses a CNN-Transformer hybrid architecture to represent the local-global correlation of multiple heartbeat sequences stepwise, which significantly improves the accuracy of heartbeat classification.Building on this, the paper "H. Peng, X. Chang, Z. Yao, D. Shi, and Y. Chen, “A deep learning framework for ECG denoising and classification,” Biomed. Signal Process. Control, vol. 94, Aug. 2024, Art. no. 106441." proposes a wavelet CNN-Transformer encoder, which decouples the latent temporal features of ECG through prior orthogonal transformation, effectively reducing the dependence of deep learning models on training samples.

[0004] Currently, the shortcomings of existing technologies include:

[0005] First, existing methods for representing heartbeats using second-order coupling matrices suffer from low recognition rates due to the small coupling values ​​between small-amplitude feature waves. Second, the temporal information contained in multi-view ECG features is heterogeneous, and the signal-to-noise ratio is non-stationary. Existing technologies lack adaptive fusion mechanisms to address these differences. Third, the optimal recognition range varies for different heartbeats. Existing technologies lack dynamic attention mechanisms and cannot adaptively adjust the context-aware range. Summary of the Invention

[0006] This application provides a dynamic electrocardiogram (ECG) heartbeat classification method, device, equipment, and storage medium, overcoming three key limitations of existing heartbeat classification methods: (1) In ECG characterization methods based on the outer product matrix of adjacent heartbeat sequences, the second-order coupling feature between small amplitude feature waves has low recognition accuracy; (2) There is a lack of effective mechanisms to cope with the heterogeneity of temporal information and the non-stationarity of signal-to-noise ratio contained in multi-view ECG features; and (3) There is a lack of dynamic attention mechanisms, making it impossible to adaptively adjust the optimal recognition range for different heartbeats in order to achieve high-precision heartbeat classification.

[0007] Firstly, this application provides a method for classifying heartbeats using dynamic electrocardiogram (ECG), including:

[0008] The dataset is preprocessed to obtain multi-view data of ECG heartbeats; wherein, the multi-view data of ECG heartbeats includes heartbeat waveform, low-frequency coupling matrix, high-frequency coupling matrix and RR interval;

[0009] Feature extraction is performed on the multi-view data of the ECG heartbeat to obtain multi-view features;

[0010] The multi-view features of multiple heartbeats are embedded and grouped according to the neighborhood size from 0 to l. The features of each view within each group are unified to the same length on the time axis and connected on the channel axis to form multiple range groups. A multi-view cross-attention mechanism is used for each range group to obtain multi-view fusion features.

[0011] Based on the multi-view fusion features, discriminative information is extracted from multiple groups of features in different ranges to obtain attention-enhanced features;

[0012] The attention enhancement features and the RR interval are input into the classification head to obtain the classification prediction results.

[0013] In one possible design, preprocessing the dataset to obtain multi-view ECG heart rate data includes:

[0014] Acquire electrocardiogram (ECG) data, and remove baseline drift and normalize the ECG data to obtain a preprocessed ECG signal;

[0015] Based on the preprocessed ECG signal, for each heartbeat, the ECG signal is divided into multiple time sample segments with the R peak position as the reference point. Each segment contains data t1 milliseconds before and t2 milliseconds after the R peak, which are used as heartbeat segments.

[0016] Two bandpass filters are used on the preprocessed ECG signal to obtain low-frequency signals below the first frequency and high-frequency signals from the first frequency to the second frequency. The low-frequency coupling matrix and the high-frequency coupling matrix are obtained by performing an outer product operation on the two adjacent segments before and after each heartbeat.

[0017] The RR interval is calculated based on the R peak positions recorded in the electrocardiogram dataset.

[0018] In one possible design, feature extraction is performed on the multi-view data of the ECG heartbeat to obtain multi-view features, including:

[0019] A multi-view feature extractor is established; wherein, the multi-view feature extractor includes feature extractors from different views;

[0020] The multi-view data generated by the target heartbeat and its surrounding heartbeats within a maximum neighborhood size l are input into feature extractors of different views to obtain features for each view, thus obtaining the multi-view features; wherein, the feature extractors of different views include a first network and two second networks, the first network extracts the morphological features of the heartbeat from the heartbeat fragment as a feature of one view, and the two second networks extract the second-order features of the heartbeat from the low-frequency coupling matrix and the high-frequency coupling matrix as features of one view respectively.

[0021] In one possible design, the first network includes three identical first convolutional blocks, each containing a convolutional layer, a batch normalization layer, an activation layer, a max pooling layer, and a squeeze activation module connected in sequence.

[0022] The second network includes three second convolutional blocks, each containing a second convolutional layer, a second batch normalization layer, and a second max pooling layer connected in sequence, with the three second convolutional blocks having different kernel sizes.

[0023] In one possible design, a multi-view cross-attention mechanism is used for each range group to obtain multi-view fused features, including:

[0024] The multi-view features within each range group are concatenated, and then a linear layer is used to generate a fused feature Z from the concatenated features. f The calculation process is as follows:

[0025] Z f =Linear(Cat(G)) (1)

[0026] In the formula, G = [Z mor Z low Z high ] represents the multi-view features within each range group, Z mor Z low Z high These represent the heartbeat waveform features, low-frequency coupling matrix features, and high-frequency coupling matrix features, respectively. Cat represents the splicing operation, and Linear represents the fully connected layer.

[0027] Based on the aforementioned fusion feature Z f The first channel weights and second channel weights are generated using the following formula:

[0028] U f =MLP(AvgPool(Z) f ))+MLP(MaxPool(Z f (2)

[0029] U k =MLP(AvgPool(Z) k ))+MLP(MaxPool(Z k ))

[0030] In the formula, U f U represents the weight of the first channel. k Z represents the weight of the second channel. k The input features are represented by k∈{mor,high,low}, which represent three perspectives. mor,high,low represent the heartbeat waveform, low-frequency coupling matrix, and high-frequency coupling matrix, respectively. MLP represents multilayer perceptron, AvgPool represents global average pooling, and MaxPool represents global max pooling.

[0031] Based on the first channel weight and the second channel weight, the first feature and the second feature are calculated using the following formula:

[0032]

[0033] In the formula, P f Let P represent the first feature, Softmax represent the normalized exponential function, T represent the matrix transpose, and P represent the first feature. k Indicates the second characteristic;

[0034] Based on the first and second features, the weights of the third and fourth channels are calculated using the following formula:

[0035]

[0036] In the formula, W f and W k These represent the weights of the third and fourth channels, respectively.

[0037] Based on the third and fourth channel weights, the feature embeddings for each viewpoint are calculated using the following formula:

[0038]

[0039] In the formula, The feature embedding represents the viewpoint k;

[0040] Based on the feature embeddings from each perspective, the multi-view fused features are calculated using the following formula:

[0041]

[0042] In the formula, Indicates multi-view fusion features, These represent the fused heartbeat waveform characteristics, the fused low-frequency coupling matrix characteristics, and the fused high-frequency coupling matrix characteristics, respectively.

[0043] In one possible design, based on the multi-view fusion features, discriminative information is extracted from multiple groups of features across different ranges to obtain attention-enhancing features, including:

[0044] The multi-view fusion feature of the i-th range group is represented as:

[0045]

[0046] In the formula, This represents the multi-view fusion feature of the first range group. Let l represent the multi-view fusion feature of the i-th range group, MLP represent multilayer perceptron operation, and l+1 represent the total number of groups.

[0047] Connect the multi-view fused features of all groups along the time axis to form a unified feature representation H:

[0048]

[0049] In the formula, Cat temp This indicates a splicing operation along the time axis. This represents the multi-view fusion feature of the second range group. This represents the multi-view fusion feature of the last range group;

[0050] Specifically, we will unify feature representation The input is fed into a multi-policy attention mechanism, where the temporal features are treated as a series of timestamps, where T = L·(l+1) represents the total number of timestamps. A linear transformation is then applied to... Generate query tags The unified feature representation H is converted into a bond. Sum Let D represent the set of real numbers, D represent the number of feature channels for each viewpoint, and L represent the number of time axis features for each group;

[0051] For the t-th query term q in the query Q t Attention operations can be performed using the following formula:

[0052]

[0053] In the formula, α t,i The query term q t With the i-th keyword k i Attention weights between, d k The characteristic dimension of the bond is represented by e, which represents the natural constant, and V. t It means to talk to q t The value for the attention operation, Attn(q) t ,K t V t ) represents q t The result after attention operation, α t,j q t With key K t Attention score between the j-th time axis features, v i V represents t The i-th time axis feature;

[0054] For query q t Different categories f are obtained by deriving corresponding keys and values ​​through different mapping strategies. The derived keys and values ​​are calculated using formula (10), and the compressed keys and compressed values ​​are calculated using formula (11).

[0055]

[0056] In the formula, and This represents the derived key and value. It is a learnable multilayer perceptron used to map keys or values ​​within a group to a single compressed key. or compressed value k (i-1)×L+1:i×L Let v represent the i-th time axis feature of K. (i-1)×L+1:i×L f represents the i-th time axis feature of V. K (q t ,K t V t ) represents the derivation strategy of K, f V (q t ,K t V t ) represents the derivation strategy of V;

[0057] Based on the derived keys and values, fine-grained keys and fine-grained values ​​are calculated; the formula for calculating fine-grained keys is as follows:

[0058]

[0059] In the formula, [·] represents the index operator used to access vector elements, Rank(·) represents the rank position in descending order, Rank=1 corresponds to the highest score, and Cat represents the concatenation operation. q t With compression key Attention scores among the l+1 time-axis feature vectors This represents the indices of the top n attention scores, ranked from largest to smallest. express The rank index of the attention score of the i-th time-axis feature vector, where n represents the top n feature vectors selected. Indicates fine-grained bonds;

[0060] Based on fine-grained bonds and fine granularity value The attention enhancement feature o is calculated using the following formula. t :

[0061]

[0062] In the formula, g cmp ∈[0,1] and g slc ∈[0,1] is the gate score of the corresponding policy. q tAttention results obtained through the compressed attention strategy q t Attention results obtained by selecting an attention strategy;

[0063] g is determined by the following formula. cmp and g slc :

[0064] g cmp =Sigmoid(MLP(Q)),g slc =Sigmoid(MLP(Q)) (16)

[0065] In the formula, Sigmoid represents the Sigmoid activation function.

[0066] In one possible design, the classification head comprises seven sequentially connected modules: the first module performs time-dimensional average pooling on the attention-enhanced features; the second module concatenates the pooled features with the RR interval; the third module performs a linear transformation on the concatenated features; the fourth module introduces non-linearity through a ReLU activation function; the fifth module randomly discards some neurons; the sixth module performs another linear transformation; and the seventh module converts the output into a probability distribution using a normalized exponential function to obtain and output the final classification result.

[0067] Secondly, this application provides a dynamic electrocardiogram heart rate classification device, the device comprising:

[0068] The data preprocessing module is configured to preprocess the dataset to obtain multi-view data of ECG heartbeats; wherein, the multi-view data of ECG heartbeats includes heartbeat waveforms, low-frequency coupling matrix, high-frequency coupling matrix and RR interval;

[0069] The multi-view feature extraction module is configured to extract features from the multi-view data of the ECG heartbeat to obtain multi-view features.

[0070] The multi-view feature fusion module is configured to embed the multi-view features of multiple heartbeats into groups according to the neighborhood size increasing from 0 to l. The features of each view within each group are unified to the same length on the time axis and connected on the channel axis to form multiple range groups. A multi-view cross-attention mechanism is used for each range group to obtain multi-view fused features.

[0071] The multi-range group attention module is configured to extract discriminative information from multi-range group features of different ranges based on the multi-view fusion features to obtain attention enhancement features;

[0072] The classification module is configured to input the attention enhancement features and the RR interval into the classification head to obtain the classification prediction result.

[0073] Thirdly, embodiments of this application provide an electronic device, including: at least one processor and a memory; the memory stores computer execution instructions; the at least one processor executes the computer execution instructions stored in the memory, causing the at least one processor to perform the dynamic electrocardiogram heart rate classification method as described in the first aspect and various possible designs of the first aspect.

[0074] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions. When a processor executes the computer-executable instructions, it implements the dynamic electrocardiogram heart rate classification method described in the first aspect and various possible designs of the first aspect.

[0075] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the dynamic electrocardiogram heart rate classification method as described in the first aspect and various possible designs of the first aspect.

[0076] The dynamic electrocardiogram heart rate classification method, device, equipment, and storage medium provided in this application have at least the following beneficial effects:

[0077] This application employs a multi-band coupling matrix to enhance the discriminative power of second-order coupling features of characteristic waves, and constructs a multi-view feature fusion module based on channel-time decoupling cross-attention and a dynamic attention module based on ECG heartbeat multi-neighborhood range hierarchical information fusion. This allows for adaptive extraction and fusion of multi-view heartbeat information from different ranges, effectively addressing the inherent diversity of ECG signals and improving the generalization performance of the classification model. Specifically, compared with existing technologies, this application has the following three advantages:

[0078] First, in existing ECG characterization methods based on the outer product matrix of adjacent heartbeat sequences, the coupling values ​​between small-amplitude characteristic waves (QSPT wave groups) are much smaller than those between large-amplitude characteristic waves (R waves), making them difficult to identify. To address this technical deficiency, this application proposes a heartbeat characterization method based on a multi-band coupling matrix. This method significantly improves the discernibility of second-order coupling features of characteristic waves by extracting coupling matrices from low-frequency signals below 17Hz and high-frequency signals from 17Hz to 100Hz, respectively, thus highlighting richer heartbeat discrimination information.

[0079] Second, addressing the lack of effective mechanisms in existing technologies to address the heterogeneity of temporal information and the non-stationarity of signal-to-noise ratio inherent in multi-view ECG features, this invention provides a multi-view feature fusion (MVCAF) module based on channel-time decoupled cross-attention. This module achieves adaptive fusion of multi-view features through a two-level fusion strategy and a channel-time decoupled cross-attention mechanism, significantly enhancing the discriminative power of feature representations and thus effectively improving the model's generalization performance.

[0080] Third, addressing the limitations of existing technologies that lack a dynamic attention mechanism to adaptively adjust the optimal recognition range for different heartbeats, this invention proposes a Dynamic Attention Module (MRGA) based on progressive information fusion across multiple neighborhood ranges of ECG heartbeats. This module employs a progressive fusion strategy across multiple neighborhood ranges of heartbeats and a dynamic attention mechanism, enabling selective extraction of key features from local details and multi-heartbeat contextual information. This reduces the risk of model overfitting and improves the model's robustness. Attached Figure Description

[0081] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0082] Figure 1 A simplified flowchart of a dynamic electrocardiogram heart rate classification method provided in this application embodiment;

[0083] Figure 2 A detailed flowchart of a dynamic electrocardiogram heart rate classification method provided in this application embodiment;

[0084] Figure 3 The structural diagram of the ECG classification model based on multi-view and multi-range attention provided in the embodiments of this application;

[0085] Figure 4 The diagram shows the structure of a one-dimensional convolutional encoder and a two-dimensional convolutional encoder provided in the embodiments of this application; wherein, (a) is a one-dimensional convolutional encoder; and (b) is a two-dimensional convolutional encoder.

[0086] Figure 5 The diagram shows the structure of the multi-view cross-fusion module provided in the embodiments of this application; wherein, (a) is the overall structure; and (b) is the cross-attention fusion process.

[0087] Figure 6 A structural diagram of the classification head provided in an embodiment of this application;

[0088] Figure 7 This is a structural diagram of the dynamic electrocardiogram heart rate classification device provided in an embodiment of this application.

[0089] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0090] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0091] The collection, storage, use, processing, transmission, provision, and disclosure of financial data or user data involved in the technical solution of this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0092] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, it does not mean that the applicant has used or necessarily used the solution.

[0093] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0094] This application provides a method for classifying heartbeats using dynamic electrocardiogram (ECG), such as... Figure 1 The diagram shown is a simplified flowchart of the dynamic electrocardiogram (ECG) heartbeat classification method provided in this embodiment. The main processes of this dynamic ECG heartbeat classification method include: preprocessing the dataset, including removing baseline drift and signal normalization; acquiring multi-view data of ECG heartbeats, including heartbeat waveforms, low-frequency coupling matrices, high-frequency coupling matrices, and RR intervals; processing the multi-view data of ECG heartbeats using a classification model; and finally, classifying and predicting the target heartbeat into five arrhythmia categories.

[0095] Specifically, such as Figure 2 The diagram shown is a flowchart of the dynamic electrocardiogram heartbeat classification method provided in this application embodiment. The dynamic electrocardiogram heartbeat classification method includes the following steps S100-S500.

[0096] S100: Preprocess the dataset to obtain multi-view data of ECG heartbeats; the multi-view data of ECG heartbeats includes heartbeat waveforms, low-frequency coupling matrix, high-frequency coupling matrix and RR interval.

[0097] In some embodiments, step S100 may be implemented by the following steps S101-S103.

[0098] S101: Prepare the dataset.

[0099] The MIT-BIH arrhythmia database was used as the experimental dataset, containing 48 electrocardiogram (ECG) recordings from 47 subjects. The sampling rate was 360 Hz, and the recordings were processed using bandpass filters ranging from 0.1 to 100 Hz. Each recording contained two ECG leads and lasted approximately 30 minutes. Cardiologists provided reference annotations for each heartbeat in the database. Heartbeats were detected using lead II ECG signals. According to the American Association for Medical Instrumentation (AAMI) classification, arrhythmias are strictly divided into five main categories: normal (N), supraventricular ectopic beats (SVEB), ventricular ectopic beats (VEB), fusion beats (F), and unknown beats (Q).

[0100] S102: Data preprocessing.

[0101] First, two nested median filters are used to estimate the baseline drift, and then the baseline is subtracted from the original signal. The time windows for the two median filters are 200 ms and 600 ms, respectively. Then, the ECG signal is normalized by dividing the entire signal by the average amplitude of the R-peak in the corresponding record.

[0102] S103: Acquire multi-view data.

[0103] For each heartbeat, the ECG signal is divided into 216 time-sample segments, with the R-peak position as the reference point. Each segment contains data from 250 milliseconds before and 350 milliseconds after the R-peak, which serve as the first input data for the model.

[0104] Two bandpass filters were applied to the preprocessed signal to obtain low-frequency signals below 17 Hz and high-frequency signals from 17 Hz to 100 Hz. The coupling matrices for the low and high frequencies were obtained by performing an outer product operation on the two adjacent segments before and after each heartbeat, serving as the other two input data for the model. The two adjacent segments before and after each heartbeat were obtained as follows: the larger of the two preceding and following RR intervals of the current heartbeat was used as the window unit. The preceding segment contained the ECG signal segments two window units forward and one window unit backward relative to the current heartbeat's R-peak position, and the following segment contained the ECG signal segments one window unit forward and two window units backward relative to the current heartbeat's R-peak position. After calculating the outer product, bilinear interpolation was used to scale the coupling matrix to a uniform size of 73×73.

[0105] The RR interval is calculated based on the R peak positions recorded in the ECG dataset and used as the fourth input data for the model.

[0106] S200: Feature extraction is performed on multi-view data of ECG heartbeats to obtain multi-view features.

[0107] S300: Embed the multi-view features of multiple heartbeats and group them according to the neighborhood size increasing from 0 to l. The features of each view in each group are unified to the same length on the time axis and connected on the channel axis to form multiple range groups. A multi-view cross-attention mechanism is used for each range group to obtain multi-view fusion features.

[0108] S400: Based on multi-view fusion features, discriminative information is extracted from multiple groups of features in different ranges to obtain attention-enhanced features.

[0109] S500: Input the attention enhancement features and RR interval together into the classification head to obtain the classification prediction results.

[0110] It should be noted that steps S200-S500 above can be implemented by constructing an ECG heart rate classification model. The overall architecture of the ECG heart rate classification model constructed in this embodiment is as follows: Figure 3 As shown, the ECG heart rate classification model mainly consists of three stages: multi-view feature extraction stage, multi-view feature fusion stage, and multi-range group attention stage (corresponding to steps S200-S400 respectively).

[0111] In the multi-view feature extraction stage, the neighborhood size *s* is used to represent the number of neighboring heartbeats on each side of the target heartbeat. The model then uses the target heartbeat *x*... iThe multi-view data generated from the heartbeats within their maximum neighborhood size l is input into feature extractors for different viewpoints to obtain features for each viewpoint. This classification model uses a 1-D CNN network to extract morphological features of the heartbeats from the heartbeat segments, and two identical 2-D CNN networks to extract second-order features of the heartbeats from the coupling matrix.

[0112] In the multi-view feature fusion stage, the multi-view feature embeddings of multiple heartbeats are grouped according to the neighborhood size, which increases from 0 to l. Within each group, the features from each viewpoint are unified to the same length L on the time axis, and then concatenated on the channel axis to form a multi-range group G. s Next, for each group, the multi-view crossattention fusion (MVCAF) module was used to obtain fused multi-view features.

[0113] In the multi-range group attention stage, a multi-range group attention (MRGA) module is used to extract discriminative information from multi-group features of different ranges and output attention-enhanced features O.

[0114] Finally, the attention enhancement feature and the RR interval feature R are input into the classification head to obtain the final classification prediction result (corresponding to step S500).

[0115] In some embodiments, the ECG heart rate classification model includes a multi-view feature extractor, a multi-view cross-attention fusion module, a multi-range group attention module (MRGA module), and a classification head, wherein the multi-view feature extractor, the multi-view cross-attention fusion module, the multi-range group attention module, and the classification head are respectively configured to perform steps S200-S500 as described above.

[0116] The multi-view feature extractor includes feature extractors for different viewpoints; wherein, the feature extractors for different viewpoints include a first network and two second networks, the first network extracts the morphological features of the heartbeat from the heartbeat fragment as a feature of one viewpoint, and the two second networks extract the second-order features of the heartbeat from the low-frequency coupling matrix and the high-frequency coupling matrix as features of one viewpoint respectively.

[0117] For example, the first network can be selected as a 1-D CNN network, with the following structure: Figure 4As shown in (a), the 1-D CNN network consists of three repeating convolutional blocks, each containing a 15×15 convolutional layer (1-D Conv), a batch normalization layer (BatchNorm), a ReLU activation layer (ReLU), a 3×2 max pooling layer (MaxPool), and a squeeze-and-excitation (SE) module at the end.

[0118] The second network can be a 2D CNN network, with the following structure: Figure 4 As shown in (b), the encoder of the two-dimensional convolutional neural network (2DCNN) consists of three convolutional blocks, each containing a 2-D Conv convolutional layer, a BatchNorm batch normalization layer, and a MaxPool max pooling layer. The kernel sizes of these three convolutional layers are 8×8, 10×10, and 5×5, respectively.

[0119] The structure of the Multi-View Cross-Attention Fusion Module (MVCAF module) is as follows: Figure 5 As shown in (a), Figure 5 Figure (b) illustrates the cross-attention fusion process.

[0120] The MVCAF module employs a multi-level feature fusion mechanism, integrating multi-view information layer by layer. First, the multi-view features within each group are concatenated. Then, a linear layer is used on the concatenated features to generate the fused feature Z. f .

[0121] Z f =Linear(Cat(G)) (1) where G = [Z mor Z low Z high ] represents the multi-view features within each range group, Z mor Z low Z high These represent the heartbeat waveform features, low-frequency coupling matrix features, and high-frequency coupling matrix features, respectively. Cat represents the splicing operation, and Linear represents the fully connected layer.

[0122] By integrating multi-view information from a global perspective, the fused features enhance the complementary interactions between them. In the three branches of MVCAF, the cross-attention fusion (CAF) module is responsible for coordinating the interaction between the fused features and the features of each input branch.

[0123] Considering the heterogeneity across different dimensions, the CAF module leverages the latent dependencies of multi-view data across multiple dimensions by performing cross-attention operations on the channel and time dimensions. CAF first performs max pooling and average pooling respectively from the fused feature Z. f and input features Z k Generate channel weights and

[0124]

[0125] In the formula, U f U represents the weight of the first channel. k Z represents the weight of the second channel. k The input features are represented by k∈{mor,high,low}, which represent three perspectives. mor,high,low represent the heartbeat waveform, low-frequency coupling matrix, and high-frequency coupling matrix, respectively. MLP represents multilayer perceptron, AvgPool represents global average pooling, and MaxPool represents global max pooling.

[0126] Max pooling and average pooling respectively gather important cues about the features of different objects to infer more refined attention. By multiplying the channel weights, a first cross matrix of shape L×L is obtained. Then, a softmax operation is applied to the cross matrix and its transpose to obtain the attention scores for the two inputs. The features obtained through the first cross-attention multiplication are calculated as follows:

[0127]

[0128] In the formula, P f Let P represent the first feature, Softmax represent the normalized exponential function, T represent the matrix transpose, and P represent the first feature. k This indicates the second characteristic.

[0129] Then, the two features are transposed, and CAF performs max pooling and average pooling again to obtain the channel weights. and

[0130]

[0131] In the formula, W f and W k These represent the weights of the third and fourth channels, respectively.

[0132] By multiplying the weights of the third and fourth channels, a second cross matrix of shape D×D is obtained. Features calculated by the second cross-attention multiplication

[0133]

[0134] In the formula, The feature embedding of viewpoint k is represented.

[0135] MVCAF performs a similar fusion operation on the three input features to obtain the final multi-view fused feature embedding.

[0136]

[0137] In the formula, Indicates multi-view fusion features, These represent the fused heartbeat waveform characteristics, the fused low-frequency coupling matrix characteristics, and the fused high-frequency coupling matrix characteristics, respectively.

[0138] The structure of the MRGA module is as follows: Figure 2 The multi-range group attention region is shown in the diagram. First, MRGA employs a hierarchical progressive fusion strategy to integrate multi-range temporal features. Let represent the fusion of features from the previous group into the i-th group. Then, the fusion of the i-th group can be defined as follows:

[0139]

[0140] In the formula, This represents the multi-view fusion feature of the first range group. Let l represent the multi-view fusion feature of the i-th range group, MLP represent the multilayer perceptron operation, and l+1 represent the total number of groups.

[0141] Then, the feature embeddings of all groups are connected along the time axis to form a unified feature representation H.

[0142]

[0143] In the formula, Cat temp This indicates a splicing operation along the time axis. This represents the multi-view fusion feature of the second range group. This represents the multi-view fusion feature of the last range group.

[0144] Specifically, this embodiment will unify features The input is fed into a multi-policy attention mechanism, treating the temporal features as a series of tokens, where T = L·(l+1) represents the total number of tokens. MRGA transforms the last range group through a linear transformation. Generate query tags And convert the uniform feature H into a bond Sum

[0145] For the t-th query marker q in the query Q t Attention operation is defined as

[0146]

[0147] In the formula, α t,i The query term q t With the i-th keyword k i Attention weights between, d k The characteristic dimension of the bond is represented by e, which represents the natural constant, and V. t It means to talk to q t The value for the attention operation, Attn(q) t ,K t V t ) represents q t The result of attention operations, α t,j q t With key K t Attention score between the j-th time axis features, v i V represents t The i-th time axis feature.

[0148] With query q t The corresponding key token and value token are derived through different mapping strategies, thereby obtaining different categories f.

[0149]

[0150] In the formula, and This represents the derived key and value. It is a learnable multilayer perceptron used to map keys or values ​​within a group to a single compressed key. or compressed value k (i-1)×L+1:i×L Let v represent the i-th time axis feature of K. (i-1)×L+1:i×L f represents the i-th time axis feature of V. K (q t ,K t V t ) represents the derivation strategy of K, f V (q t ,K t V t ) represents the derivation strategy of V.

[0151] For compression value representation The formula is similar. Compressed representation can capture coarser-grained, high-level semantic information and reduce the computational burden on attention mechanisms.

[0152] The token selection strategy identifies and retains the tokens from the most relevant groups using compressed key-value pairs. We can retain these tokens from the top n groups, sorted by group importance score, calculated using the following formula:

[0153]

[0154] In the formula, [·] represents the index operator used to access vector elements, Rank(·) represents the rank position in descending order, Rank=1 corresponds to the highest score, and Cat represents the concatenation operation. q t With compression key Attention scores among the l+1 time-axis feature vectors This represents the indices of the top n attention scores, ranked from largest to smallest. express The rank index of the attention score of the i-th time-axis feature vector, where n represents the top n feature vectors selected. This indicates fine-grained bonding.

[0155] For fine-grained values There are similar formulas. Setting n=1 means focusing on the group with the highest score.

[0156] The final output of the NGSA module is O=o. 1:L It is a dynamic combination of the two mapping strategies mentioned above, specifically expressed as follows:

[0157]

[0158] In the formula, g cmp ∈[0,1] and g slc ∈[0,1] represents the gate scores for the corresponding policy, which are derived from the query Q using an MLP and a sigmoid activation function. q t Attention results obtained through the compressed attention strategy q t Attention results obtained by selecting an attention strategy.

[0159] g cmp =Sigmoid(MLP(Q)),g slc =Sigmoid(MLP(Q)) (16)

[0160] In the formula, Sigmoid represents the Sigmoid activation function.

[0161] like Figure 6 As shown, the classification head consists of seven sequentially connected modules. The first module is Temporal Average Pooling, which performs average pooling on the input feature O over time. The second module is Concatenate, which concatenates the pooled features with the RR feature R. The third module is Linear, which performs a linear transformation on the concatenated features. The fourth module is ReLU, which introduces non-linearity. The fifth module is Dropout, which prevents overfitting by randomly discarding some neurons. The sixth module is Linear again, which performs a linear transformation. The seventh module is Softmax, which converts the output into a probability distribution to obtain the final classification result and output it.

[0162] In summary, the core advantage of the dynamic electrocardiogram heart rate classification method provided in this application is as follows:

[0163] (1) Multi-band second-order coupling feature extraction method of adjacent heartbeat sequences. Given the significant differences in the frequency domain distribution of the QRS complex and PT wave, and the fact that the energy of the PT wave is mainly concentrated in the frequency band below 17Hz, this invention extracts the coupling matrix from the low-frequency band signal below 17Hz and the high-frequency band signal from 17Hz to 100Hz, respectively, to enhance the discriminability of the second-order coupling features between different characteristic waves and highlight richer heartbeat discrimination information.

[0164] (2) A multi-view feature fusion module based on channel-time decoupling cross-attention. For example... Figure 5 As shown, the Multi-View Feature Adaptive Fusion (MVCAF) module employs a two-level feature fusion mechanism to integrate multi-view input features at multiple levels. This module adaptively extracts the most discriminative feature information from each viewpoint by mining the potential correlations between features from multiple views. Specifically, the input to the MVCAF module consists of features from three views. First, the features from the three views are concatenated and a high-level fusion feature is generated through a linear projection layer. Then, guided by the high-level fusion feature, the MVCAF module dynamically adjusts the weight contributions of each viewpoint feature using a Cross-Attention Fusion (CAF) submodule. Finally, the MVCAF module outputs a fusion feature composed of the weighted features from the three views.

[0165] (3) A dynamic attention module based on hierarchical information fusion across multiple neighborhoods of ECG heartbeats. For example... Figure 3As shown in the Multi-Range Group Attention (MRGA) region diagram, the MRGA module adaptively aggregates key information from different neighborhood ranges. This module dynamically adjusts the importance weights of each neighborhood range and utilizes a compression attention mechanism and a selection attention mechanism to achieve adaptive aggregation. Specifically, the input to the MRGA module contains features from multiple time range groups. First, the MRGA module employs a hierarchical progressive fusion strategy to integrate features from each time range group. Compared to simple feature stacking input, this fusion strategy can more effectively model the dynamic characteristics of multi-range temporal sequences, thereby improving the representational power of temporal features. Subsequently, the MRGA module performs a cross-attention operation using compression and selection strategies, interacting the features of the large-range group with the features of each range group respectively, efficiently and dynamically capturing discriminative information within the relevant range. Finally, the MRGA module outputs features after gating and weighting.

[0166] This application also provides a dynamic electrocardiogram heart rate classification device, such as... Figure 7 As shown, the dynamic electrocardiogram heart rate classification device includes:

[0167] The data preprocessing module 701 is configured to preprocess the dataset to obtain multi-view data of ECG heartbeats; wherein, the multi-view data of ECG heartbeats includes heartbeat waveforms, low-frequency coupling matrix, high-frequency coupling matrix and RR interval;

[0168] The multi-view feature extraction module 702 is configured to extract features from the multi-view data of the ECG heartbeat to obtain multi-view features.

[0169] The multi-view feature fusion module 703 is configured to embed the multi-view features of multiple heartbeats into groups according to the neighborhood size increasing from 0 to l. The features of each view within each group are unified to the same length on the time axis and connected on the channel axis to form multiple range groups. A multi-view cross-attention mechanism is used for each range group to obtain multi-view fused features.

[0170] The multi-range group attention module 704 is configured to extract discriminative information from multi-range group features of different ranges based on the multi-view fusion features to obtain attention-enhanced features;

[0171] The classification module 705 is configured to input the attention enhancement features and the RR interval into the classification head to obtain the classification prediction result.

[0172] This application provides an electronic device. The electronic device may include a processor and a memory, wherein the processor and the memory can communicate; exemplarily, the processor and the memory communicate via a communication bus.

[0173] The processor executes computer execution instructions stored in memory, causing the processor to perform the scheme in the above embodiments. The processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0174] The communication bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into address bus, data bus, control bus, etc. Transceivers are used to enable communication between database access devices and other computers (e.g., clients, read-write libraries, and read-only libraries). Memory may include random access memory (RAM) and may also include non-volatile memory.

[0175] The electronic device provided in this application embodiment can be the terminal device described in the above embodiments.

[0176] This application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed on a computer, the computer performs the technical solution of the dynamic electrocardiogram heart rate classification method described in the above embodiments.

[0177] This application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When the at least one processor executes the computer program, it can implement the technical solution of the dynamic electrocardiogram heart rate classification method in the above embodiments.

[0178] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or modules, and may be electrical, mechanical, or other forms.

[0179] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to implement the solution of this embodiment according to actual needs.

[0180] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The unit composed of the above modules can be implemented in hardware or in the form of hardware plus software functional units.

[0181] The integrated modules described above, implemented as software functional modules, can be stored in a computer-readable storage medium. These software functional modules, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods of the various embodiments of this application.

[0182] It should be understood that the aforementioned processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0183] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage device, and may also be a USB flash drive, external hard drive, read-only memory, disk or optical disc, etc.

[0184] Buses can be Industry Standard Architecture (ISA) buses, Peripheral Component Interconnect (PCI) buses, or Extended Industry Standard Architecture (EISA) buses, etc. Buses can be categorized into address buses, data buses, control buses, etc.

[0185] The aforementioned storage medium can be implemented from any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium can be any available medium accessible to general-purpose or special-purpose computers.

[0186] An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Alternatively, the storage medium can be an integral part of the processor. The processor and storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and storage medium can exist as discrete components in an electronic control unit or main control device.

[0187] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0188] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A dynamic electrocardiogram heartbeat classification method, characterized in that, The method comprises: Preprocessing a data set to obtain multi-view data of ECG heartbeats; wherein the multi-view data of ECG heartbeats comprises heartbeat waveforms, low-frequency coupling matrices, high-frequency coupling matrices and R-R intervals; Extracting features from the multi-view data of ECG heartbeats to obtain multi-view features; The multi-view features of multiple heartbeats are embedded according to the neighborhood size from 0 to The grouping is performed incrementally, the features of each view in each group are unified to the same length on the time axis, and are connected on the channel axis to form a multi-range group, and a multi-view cross attention mechanism is used for each range group to obtain multi-view fusion features; Based on the multi-view fusion features, discriminative information is extracted from different range groups of features to obtain attention-enhanced features; The attention-enhanced features and R-R intervals are input into a classification head to obtain a classification prediction result; A multi-view cross-attention mechanism is used for each range group to obtain multi-view fusion features, comprising: The multi-view features in each range group are spliced, and a linear layer is used for the spliced features to generate fused features The calculation process is: (1) In the formula, , represents the multi-view feature in each range group, respectively represent the heart beat waveform feature, the low frequency coupling matrix feature, and the high frequency coupling matrix feature, represents the splicing operation, represents the full connection layer; based on the fused features The first channel weight and the second channel weight are generated by the following equation: (2) wherein, denotes a first channel weight, denotes a second channel weight, denotes an input feature, represents three views, denote a heart beat waveform, a low frequency coupling matrix, and a high frequency coupling matrix, respectively, denotes a multi-layer perceptron, denotes a global average pooling, denotes a global max pooling; Based on the first channel weight and the second channel weight, the first feature and the second feature are calculated by the following formula: (3) wherein denotes a first feature, denotes a normalized exponential function, T denotes a matrix transpose, denotes a second feature; Based on the first feature and the second feature, the third channel weight and the fourth channel weight are calculated by the following formula: (4) wherein and represent the third and fourth channel weights, respectively. Based on the third channel weight and the fourth channel weight, each view feature embedding is calculated by the following formula: (5) In the formula, represents the feature embedding of the viewing angle k; Based on each view feature embedding, the multi-view fusion feature is calculated by the following formula: (6) In the formula, indicates a multi-view fusion feature, respectively indicate a fused heart beat waveform feature, a fused low frequency coupling matrix feature, and a fused high frequency coupling matrix feature.

2. The dynamic electrocardiogram beat classification method of claim 1, wherein, The way of preprocessing a data set to obtain multi-view data of ECG heartbeats comprises: Obtaining electrocardiogram data, and removing baseline drift and signal normalization from the electrocardiogram data to obtain preprocessed ECG signals; Based on the preprocessed ECG signals, for each heartbeat, the ECG signals are segmented into multiple time sample segments with the R-peak position as the reference point, each segment containing t1 milliseconds of data before and t2 milliseconds of data after the R-peak, as a heartbeat segment; Two bandpass filters are used on the preprocessed ECG signals to obtain low-frequency signals below the first frequency and high-frequency signals from the first frequency to the second frequency, and the outer product operation is performed on the two adjacent segments of each heartbeat to obtain low-frequency coupling matrices and high-frequency coupling matrices; The R-R interval is calculated according to the R-peak position recorded in the electrocardiogram data set.

3. The dynamic electrocardiogram beat classification method of claim 1, wherein, Extracting features from the multi-view data of ECG heartbeats to obtain multi-view features, comprising: Establishing a multi-view feature extractor; wherein the multi-view feature extractor comprises feature extractors of different views; Generate multi-view data by inputting the target heartbeat and its maximum neighborhood size The multi-view data generated by inputting the target heartbeat and its maximum neighborhood size within the range of the surrounding heartbeats is input into different view feature extractors to obtain the features of each view, thereby obtaining the multi-view features; wherein the different view feature extractors include one first network and two second networks, the first network extracts the morphological features of the heartbeat from the heartbeat segment as the features of one view, and the two second networks extract the second-order features of the heartbeat from the low-frequency coupling matrix and the high-frequency coupling matrix as the features of one view respectively.

4. The dynamic electrocardiogram beat classification method of claim 3, wherein, The first network comprises three identical first convolutional blocks, and the first convolutional block comprises a convolutional layer, a batch normalization layer, an activation layer, a max-pooling layer and a squeeze activation module connected in sequence; The second network comprises three second convolutional blocks, and the second convolutional block comprises a second convolutional layer, a second batch normalization layer and a second max-pooling layer connected in sequence, and the kernel sizes of the three second convolutional blocks are different.

5. The dynamic electrocardiogram beat classification method of claim 1, wherein, Based on the multi-view fusion features, discriminative information is extracted from different range groups of features to obtain attention-enhanced features, comprising: The multi-view fusion feature of the first range group is represented as: i ​ (7) In the formula, representing the multi-view fusion features of the first range group, representing the multi-view fusion features of the first i+ range group, representing the multi-layer perception operation, representing the total number of groups. The multi-view fusion features of all groups are connected along the time axis to form a unified feature representation : (8) In the formula, represents a splicing operation along the time axis, represents multi-view fusion features of a second range group, represents multi-view fusion features of a last range group; Specifically, we unify the feature representation into a multi-strategy attention mechanism, treating temporal features as a sequence of timestamps, where denotes the total number of timestamps, and generates query tokens and converts the unified feature representation H into keys and values , denotes the real set, D denotes the number of feature channels for each view, denotes the number of time-axis features for each group. For the i-th query word in the query , the attention operation is performed by the following formula: t ​​ (9) In the formula, denotes the query word denotes the attention weight between the i-th keyword , denotes the feature dimension of the key, e denotes the natural constant, denotes the value to be subjected to the attention operation , denotes the result after the attention operation , denotes the result after the attention operation , denotes the attention score between the i-th time axis feature of the key , denotes the i-th time axis feature of , denotes the i-th time axis feature of For query , the corresponding key and value are derived by different mapping strategies to obtain different categories , the derived key and value are calculated by formula (10), and the compressed key and compressed value are calculated by formula (11): (10) (11) In the formula, and denote the derived key and value, is a learnable multilayer perceptron for mapping the keys or values within a group to a single compressed key or compressed value , denote the first group of timeline features of denote the first group of timeline features of denote the derivation strategy of denote the derivation strategy of Based on the derived keys and values, fine-grained keys and fine-grained values are calculated; wherein the calculation formula of the fine-grained key is as follows: (12) (13) (14) In the formula, represents an index operator for accessing vector elements, represents a ranking position in descending order, corresponds to the highest score, represents a connection operation, represents and the compressed key In the attention score between the time axis feature vectors, represents The top subscripts of the top ranked The ranking number of the attention score of the time axis feature vector, represents selecting the top feature vectors, represents a fine-grained key; Based on fine-grained keys and fine-grained values The attention enhanced feature is calculated by the following equation : (15) In the formula, and is the gate score of the corresponding policy, denotes the attention result obtained by the compressed attention policy, denotes the attention result obtained by the selected attention policy; is determined by the following equation and : (16) In the formula, represents activation function.

6. The dynamic electrocardiogram beat classification method of claim 1, wherein, The classification head comprises seven sequentially connected modules, wherein the first module is used for average pooling operation on the time dimension of attention enhanced features; the second module is used for splicing the pooled features and R-R intervals; the third module is used for linear transformation of the spliced features; the fourth module introduces non-linear characteristics through a Relu activation function; the fifth module is used for randomly discarding part of the neurons; the sixth module is used for linear transformation again; and the seventh module is used for converting the output into a probability distribution through a normalized exponential function to obtain the final classification result and output.

7. A dynamic electrocardiogram beat classification apparatus for implementing the dynamic electrocardiogram beat classification method according to any one of claims 1 to 6, characterized by The device comprises: a data preprocessing module configured to preprocess a data set to obtain multi-view data of ECG heartbeats; wherein the multi-view data of ECG heartbeats comprises heartbeat waveforms, low-frequency coupling matrices, high-frequency coupling matrices and R-R intervals; a multi-view feature extraction module configured to extract features from the multi-view data of ECG heartbeats to obtain multi-view features; The multi-view feature fusion module is configured to embed multi-view features of multiple heartbeats according to a neighborhood size from 0 to The grouping is performed incrementally, and features of each view in each group are unified to the same length on a time axis and connected on a channel axis to form multi-range groups, and a multi-view cross-attention mechanism is used for each range group to obtain multi-view fusion features. a multi-range group attention module configured to extract discriminative information from different range multi-group features based on the multi-view fusion features to obtain attention enhanced features; a classification module configured to input the attention enhanced features and R-R intervals into a classification head to obtain a classification prediction result.

8. An electronic device, comprising: comprise: a processor, and a memory connected in communication with the processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory to implement the dynamic electrocardiogram heartbeat classification method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to implement the dynamic electrocardiogram heartbeat classification method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Electrocardiogram cardiac beat classification method and system, medium, equipment and terminal

    CN115462797A

  • Multi-lead electrocardiogram classification and identification method based on convolution and self-attention mechanism

    CN115470828A