ECG data classification method and device based on multi-branch block full attention network

The spatial and channel features of ECG data are extracted through a multi-branch block full-attention network model, and the correlation degree matrix is ​​fused using an affine algorithm. This solves the problem of missing correlation features between ECG data channels and spatial features in the existing technology, and improves the accuracy of ECG data classification.

CN116636857BActive Publication Date: 2025-09-12JILIN UNIVERSITY +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310559376.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-17
Publication Date
2025-09-12
Estimated Expiration
2043-05-17

AI Technical Summary

Technical Problem

In the existing technology, the classification method based on multi-lead ECG data channels and spatial feature attention mechanism leads to the lack of correlation features between ECG data channels and spatial features, resulting in low ECG data classification accuracy.

Method used

A multi-branch block full-attention network model is adopted to extract the spatial features and channel features of the target ECG data through the feature extraction module and the full-attention block, and the correlation degree matrix is ​​fused through the affine algorithm to achieve accurate classification of the ECG data.

Benefits of technology

The accuracy of ECG data classification is improved, especially the classification accuracy of a few samples and the prediction results of data imbalance classification, which solves the problem of low classification accuracy in existing methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116636857B_ABST
    Figure CN116636857B_ABST
Patent Text Reader

Abstract

The present invention proposes a method and device for classifying ECG data based on a multi-branch block full-attention network. The method comprises: acquiring target ECG data; inputting the acquired target ECG data into a pre-configured multi-branch block full-attention network model, wherein the target ECG data is multi-lead ECG data, wherein the model comprises a feature extraction module and a full-attention block, wherein the feature extraction module comprises multiple multi-branch blocks and a short-circuit block; extracting features from the target ECG data using the feature extraction module to obtain first data; inputting the first data into the full-attention module to extract spatial features and channel features; and determining the target classification result corresponding to the target ECG data from preset optional classifications based on the spatial features and channel features. The features extracted by the feature extraction module are input into the full-attention block, and the features of the spatial dimension and the channel dimension are extracted for classification. The features of multiple data channel features and spatial features are integrated to improve the accuracy of ECG data classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electrocardiogram (ECG) data classification, and in particular to an ECG data classification method and device based on a multi-branch block full attention network. Background Art

[0002] In recent years, due to concerns about health, the diagnosis of ECG data has received increasing attention. A common method for diagnosing ECG data is to extract channel and spatial features from multi-lead ECG data separately using an attention mechanism. However, this method results in a loss of correlation between ECG data channel and spatial features, leading to low accuracy in ECG data classification. Summary of the Invention

[0003] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes a method and device for classifying ECG data based on a multi-branch block full attention network, which can improve the accuracy of ECG data classification.

[0004] In a first aspect, an embodiment of the present invention provides an electrocardiogram data classification method based on a multi-branch block full attention network, comprising:

[0005] Acquiring target ECG data, wherein the target ECG data is multi-lead ECG data;

[0006] Inputting the acquired target ECG data into a preconfigured multi-branch block full attention network model, wherein the multi-branch block full attention network model includes a feature extraction module and a full attention block, and the feature extraction module includes multiple multi-branch blocks and short-circuit blocks;

[0007] Extracting features from the target ECG data using the feature extraction module to obtain first data;

[0008] Input the first data into the full attention module to extract spatial features and channel features;

[0009] According to the spatial features and the channel features, a target classification result corresponding to the target ECG data is determined from preset optional classifications.

[0010] In some embodiments, the multi-branch block full attention network model is trained by the following method:

[0011] Obtain training sets and test sets corresponding to training ECG data of different samples;

[0012] Extracting features from the training set using the feature extraction module to obtain first feature data;

[0013] Performing spatial feature extraction and channel feature extraction on the first feature data through a full attention block to obtain second feature data;

[0014] Inputting the second feature data into the classification block for classification to obtain the multi-branch block full attention network model in the training state;

[0015] Inputting the test set into the multi-branch block full attention network model in the training state to perform testing to obtain a test result;

[0016] The test results are subjected to imbalance identification by a pre-trained classification evaluation model to obtain a macro ROC curve;

[0017] Determining the recognition accuracy of the imbalanced classification of the multi-branch block full attention network model according to the area value under the macro ROC curve, wherein the imbalanced classification refers to the classification of samples of the electrocardiogram data with imbalanced proportions;

[0018] Whether the multi-branch block full attention network model is trained is determined according to the recognition accuracy.

[0019] In some embodiments, obtaining training sets and test sets corresponding to training ECG data of different samples includes:

[0020] Performing electrocardiogram classification on the training electrocardiogram data;

[0021] Denoising the training ECG data using a wavelet denoising algorithm with weight threshold shrinkage;

[0022] Resampling the denoised training ECG data according to a unified sampling frequency, wherein the sampling frequency is a frequency after normalization processing;

[0023] Segmenting the resampled training ECG data according to a fixed time length to obtain an ECG sequence;

[0024] The ECG sequence is divided into a training set and a test set according to sample categories and ECG categories, wherein the ECG sequence corresponding to the test set and the ECG sequence corresponding to the training set are of different sample categories.

[0025] In some embodiments, the denoising of the training ECG data by a wavelet denoising algorithm using weight threshold shrinkage includes:

[0026] Decomposing the training ECG data by discrete wavelet to obtain wavelet coefficients of each layer of the training ECG data;

[0027] The denoised signal is obtained by reconstructing the wavelet through the dynamic soft threshold function and the wavelet coefficients of each layer.

[0028] In some embodiments, extracting features from the target ECG data using the feature extraction module to obtain the first data includes:

[0029] Extracting features of the target ECG data in sequence using a first multi-branch block set in the feature extraction module to obtain first multi-branch data, wherein the first multi-branch block set includes a plurality of multi-branch blocks;

[0030] Short-circuiting the target ECG data by a first short-circuiting block in the feature extraction module to obtain first short-circuited data;

[0031] Merging the first multi-branch data and the first short-circuited data to obtain temporary data;

[0032] Extracting features from the temporary data in sequence by a second multi-branch block set in the feature extraction module to obtain second multi-branch data;

[0033] Short-circuiting the temporary data by the first short-circuit block in the feature extraction module to obtain second short-circuit data;

[0034] The second multi-branch data and the second short-circuited data are merged to obtain first data, wherein the second multi-branch block set includes a plurality of multi-branch blocks.

[0035] In some embodiments, inputting the first data into the full attention module to extract spatial features and channel features includes:

[0036] Preprocessing the dimensions of the first data through a pooling layer and a linear layer to obtain a first global prior feature matrix, a second global prior feature matrix, and a feature vector matrix, wherein the preprocessing includes compression processing, expansion processing, segmentation processing, and merging processing;

[0037] fusing the first global priori feature matrix and the second global priori feature matrix using an affine algorithm to obtain a correlation degree matrix;

[0038] The second data is obtained by performing channel feature calculation on the first data, the correlation degree matrix and the eigenvector matrix.

[0039] In some embodiments, the first data is input into the full attention module to extract spatial features and channel features, and the calculation formula of the correlation matrix is:

[0040]

[0041] Among them, A i,j It is expressed as the correlation matrix of channels i and j at specific spatial locations, Q i is the first global prior, Kj is the second global prior, C is the total number of channels;

[0042] The calculation formula of the second data is:

[0043]

[0044] Among them, F Oj The second data F is represented as O The mapping on the j channel, F I represents the first data, γ is the scale factor, V j Expressed as the eigenvector matrix, F Ij It is represented as the mapping of the second data on the j channel, A i,j It is represented as the correlation degree matrix of channels i and j at specific spatial positions.

[0045] In a second aspect, an embodiment of the present invention provides an ECG data classification device based on a multi-branch block full attention network. The ECG data classification device based on the multi-branch block full attention network is pre-configured with a multi-branch block full attention network model. The multi-branch block full attention network model includes a feature extraction module and a full attention block. The feature extraction module includes multiple multi-branch blocks and short-circuit blocks. The device is used to:

[0046] Acquiring target ECG data, wherein the target ECG data is multi-lead ECG data;

[0047] Inputting the acquired target ECG data into a preconfigured multi-branch block full attention network model, wherein the multi-branch block full attention network model includes a feature extraction module and a full attention block, and the feature extraction module includes multiple multi-branch blocks and short-circuit blocks;

[0048] Extracting features from the target ECG data using the feature extraction module to obtain first data;

[0049] Input the first data into the full attention module to extract spatial features and channel features;

[0050] According to the spatial features and the channel features, a target classification result corresponding to the target ECG data is determined from preset optional classifications.

[0051] In a second aspect, an embodiment of the present invention provides an electronic device comprising: a memory, a processor, and a computer program stored in the memory and runnable on the processor, wherein when the processor executes the computer program, the electrocardiogram data classification method based on the multi-branch block full attention network as described in the first aspect is implemented.

[0052] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium storing a computer program, wherein the computer program is used to execute the electrocardiogram data classification method based on the multi-branch block full attention network based on the attention mechanism as described in the first aspect.

[0053] According to an embodiment of the present invention, the ECG data classification method and device based on the multi-branch block full attention network has at least the following beneficial effects: acquiring target ECG data; inputting the acquired target ECG data into a pre-configured multi-branch block full attention network model, wherein the target ECG data is multi-lead ECG data, wherein the multi-branch block full attention network model includes a feature extraction module and a full attention block, and the feature extraction module includes multiple multi-branch blocks and a short-circuit block; extracting features from the target ECG data through the feature extraction module to obtain first data; inputting the first data into the full attention module to extract spatial features and channel features; and determining the target classification result corresponding to the target ECG data from preset optional classifications based on the spatial features and the channel features. According to the technical solution of the embodiment of the present invention, the features extracted by the feature extraction module are input into the full attention block, and then the features of the spatial dimension and the features of the channel dimension are extracted for classification, which can fuse multiple data channel features and spatial features, thereby improving the accuracy of ECG data classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the technical solution of the present invention and do not constitute a limitation to the technical solution of the present invention.

[0055] Figure 1 is a flowchart of an ECG data classification method based on a multi-branch block full attention network provided by an embodiment of the present invention;

[0056] Figure 2 is a flowchart of a model training method provided by another embodiment of the present invention;

[0057] Figure 3 is a flow chart of feature extraction performed by a feature extraction module provided by another embodiment of the present invention;

[0058] Figure 4 is a flowchart of extracting spatial features and channel features by a full attention module provided by another embodiment of the present invention;

[0059] Figure 5 An overall flow chart of a multi-branch block full attention network model provided for another embodiment of the present invention;

[0060] Figure 6A flowchart of a multi-branch block in a multi-branch block full attention network model provided by another embodiment of the present invention;

[0061] Figure 7 A flowchart of a full attention block in a multi-branch block full attention network model provided by another embodiment of the present invention;

[0062] Figure 8 A flowchart of a short-circuit block and a classification block in a multi-branch block full-attention network model provided by another embodiment of the present invention;

[0063] Figure 9 This is a structural diagram of an ECG data classification device based on a multi-branch block full attention network provided by another embodiment of the present invention. DETAILED DESCRIPTION

[0064] The following describes embodiments of the present invention in detail. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended only to explain the present invention and are not to be construed as limiting the present invention.

[0065] In the description of the present invention, it should be understood that descriptions involving orientations, such as up, down, front, back, left, right, etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, they cannot be understood as limitations on the present invention.

[0066] In the description of the present invention, "several" means one or more, "many" means more than two, "greater than," "less than," and "exceed" are understood to exclude the number itself, while "above," "below," and "within" are understood to include the number itself. The use of "first" and "second" in the description is solely for the purpose of distinguishing technical features and should not be construed as indicating or implying relative importance, implicitly specifying the number of the indicated technical features, or implicitly specifying the order of the indicated technical features.

[0067] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, and connecting should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.

[0068] refer to Figure 1 and Figure 5 , Figure 1 is a flowchart of an ECG data classification method based on a multi-branch block full attention network provided by an embodiment of the present invention. Figure 5The overall flow chart of the multi-branch block full attention network model provided in another embodiment of the present invention includes steps S110 to S150:

[0069] Step S110 , acquiring target ECG data, where the target ECG data is multi-lead ECG data.

[0070] It's important to note that many heart diseases can currently be detected in electrocardiograms (ECGs), and early, mild cases are easy to treat and inexpensive. Therefore, given limited medical resources for manual diagnosis, protecting people's health requires more efficient computer-assisted diagnosis systems. From a medical perspective, multi-lead ECGs contain richer disease characteristics than single-lead ECGs. For example, ventricular hypertrophy located in different parts of the heart will manifest as abnormalities in different ECG leads. For example, second-degree type II block presents as sudden QRS wave dropout, requiring diagnosis from multiple consecutive heartbeats. Therefore, a multi-lead, long-sequence cardiac disease diagnosis system has broader and more practical clinical significance. Specifically, multi-lead ECG data can be 12-lead ECG data, acquired and recorded as target ECG data using a 12-lead ECG signal acquisition device, such as a 12-lead ECG machine or a 12-lead 24-hour Holter recorder. Target ECG data is the data for which ECG classification is determined. This solves the problem that most current studies are based on single-lead single-beat processing, lack of inter-lead and adjacent beat-related features for the diagnosis of special diseases, and low classification accuracy.

[0071] Step S120: input the acquired target ECG data into a pre-configured multi-branch block full attention network model, wherein the multi-branch block full attention network model includes a feature extraction module and a full attention block, and the feature extraction module includes multiple multi-branch blocks and short-circuit blocks.

[0072] It should be noted that the multi-branch block full attention network model is a trained model. The target ECG data is input into the pre-configured multi-branch block full attention network model to achieve classification of the target ECG data.

[0073] Furthermore, the multi-branch block full attention network model is trained by the following steps, referring to Figure 2 , Figure 2 Flowchart of a model training method provided by another embodiment of the present invention, including steps S121 to S128:

[0074] Step S121: Obtain training sets and test sets corresponding to training ECG data of different samples.

[0075] Step S122, extracting features from the training set using a feature extraction module to obtain first feature data;

[0076] Step S123, performing spatial feature extraction and channel feature extraction on the first feature data through the full attention block to obtain second feature data;

[0077] Step S124, inputting the second feature data into the classification block for classification to obtain a multi-branch block full attention network model in a training state;

[0078] Step S125, input the test set to the multi-branch block full attention network model in the training state to test and obtain the test results;

[0079] Step S126, using a pre-trained classification evaluation model to perform imbalance identification on the test results to obtain a macro ROC curve;

[0080] Step S127, determining the recognition accuracy of the imbalanced classification of the multi-branch block full attention network model according to the area under the macro ROC curve, wherein the imbalanced classification refers to the classification of samples of the ECG data with imbalanced proportions;

[0081] Step S128: Determine whether the multi-branch block full attention network model is trained based on the recognition accuracy.

[0082] It should be noted that the training process of the pre-configured multi-branch block full attention network model is as follows: Use a multi-lead ECG signal acquisition device, for example, a 12-lead ECG signal acquisition device, such as a 12-lead ECG machine or a 12-lead 24-hour Holter recorder, to record training ECG data of different samples and label their corresponding ECG data categories. In order to ensure the training effect of the model, the recording time of each sample should be greater than a preset threshold, for example, such as a recording time of greater than 10 seconds. The ECG data division method is not limited here. For example, the ECG data can be divided into five categories: normal, myocardial infarction, hypertrophy, conduction block, and ST / T abnormality by referring to the super-classification division method after aggregating the standard classification of SCP-ECG (Standardized Communication Protocol for ECG Information) in the PTB-XL database paper. In order to improve the accuracy of training, the number of initial samples collected should be greater than 10,000. After sampling, noise is removed using a wavelet algorithm based on weighted threshold shrinkage. The training ECG data are denoised using this wavelet denoising algorithm. The wavelet denoising algorithm first performs discrete wavelet decomposition to obtain wavelet coefficients at each layer. These coefficients are then processed using a dynamic soft threshold function. Finally, wavelet reconstruction is performed to output the denoised training ECG signal. The denoised training ECG data are then normalized to obtain an ECG sequence. For example, the resampled ECG sequence can be uniformly resampled to 100 Hz. The resampled ECG sequence is then segmented into fixed lengths, typically 10 seconds long, meaning each lead ECG sequence is 1000 points long. Note that the segmentation duration must be less than the sample acquisition duration. Furthermore, to mitigate imbalance, a small number of samples are sampled multiple times with different starting points to ensure a roughly equal number of samples per category. When constructing the dataset, each ECG sequence is assigned a corresponding ECG data classification label. The ECG data and corresponding labels after fixed-length segmentation are randomly divided into n parts according to the same classification category, where the nth part cannot be the same sample as the other n-1 parts. This is to use the nth part as the test set. Patients with different samples in the test set and training set can fully reflect the recognition effect between patients; different types of data with the same order are spliced ​​into a complete data set and randomly shuffled; the first n-1 parts and the nth part of the data are divided into training set and test set respectively. The training set is input into the feature extraction module to extract the features of the training set to obtain the first feature data; the first feature data is extracted through the full attention block to obtain the second feature data; the second feature data is input into the classification block for classification to obtain a multi-branch block full attention network model in the training state, where the classification block consists of a pooling layer, a fully connected layer, an activation layer, a convolutional batch activation layer, and a batch normalization layer.During training, a batch size of 64 and an initial learning rate of 0.001 were used. The learning rate was adjusted using the gradient reduction method (ReduceLROnPlateau), and the cross-entropy loss function was used. The ECG sequences from the test set were input into the trained multi-branch block-attention network model to generate test results. The test results were then scored using accuracy and a pre-trained classification evaluation model. Accuracy reflects the overall classification accuracy and individual sample classification accuracy of the multi-branch block-attention network model. The classification evaluation model outputs the MacroAUC (area under the receiver operating characteristic curve). MacroAUC reflects the performance of imbalanced classification. A larger MacroAUC value indicates better imbalanced classification performance, higher recognition accuracy, and more accurate classification of disproportionate minority samples. This approach addresses the low classification accuracy of minority samples, a problem that has plagued most existing studies, as well as the skewed prediction results of existing methods for imbalanced data classification.

[0083] Step S130 , extracting features from the target ECG data using a feature extraction module to obtain first data.

[0084] It should be noted that the first data is obtained by extracting features from the target ECG data using the feature extraction module in the multi-branch block full-attention network model. The feature extraction module includes multiple multi-branch blocks and short-circuit blocks. By replacing ordinary convolution with multi-branch blocks, the model retains the ability of one-dimensional convolution kernels of various sizes to extract rich features while also expanding its usability as an equivalent replacement for ordinary convolution kernels. This allows the overall feature extraction network model to be constructed without requiring a very deep network depth.

[0085] Furthermore, refer to Figure 3 , Figure 3 This is a flow chart of feature extraction performed by a feature extraction module according to another embodiment of the present invention. Step S130 further includes steps S131 to S136:

[0086] Step S131, extracting features of target ECG data in sequence using a first multi-branch block set in a feature extraction module to obtain first multi-branch data, wherein the first multi-branch block set includes a plurality of multi-branch blocks;

[0087] Step S132, short-circuiting the target ECG data by the first short-circuiting block in the feature extraction module to obtain first short-circuited data;

[0088] Step S133, fusing the first multi-branch data and the first short-circuit data to obtain temporary data;

[0089] Step S134, extracting features from the temporary data in sequence using the second multi-branch block set in the feature extraction module to obtain second multi-branch data;

[0090] Step S135, short-circuiting the temporary data by the first short-circuiting block in the feature extraction module to obtain second short-circuited data;

[0091] Step S136: Merge the second multi-branch data and the second short-circuited data to obtain the first data, wherein the second multi-branch block set includes a plurality of multi-branch blocks.

[0092] It should be noted that the reference Figure 5 , taking the example of the first multi-branch block set including four multi-branch blocks, the target ECG data is sequentially processed by the feature extraction of the four multi-branch blocks to obtain the first multi-branch data. The first short-circuit block in the feature extraction module short-circuits the target ECG data to obtain the first short-circuit data, and the first multi-branch data and the first short-circuit data are fused to obtain temporary data. The temporary data is sequentially processed by the feature extraction of the four multi-branch blocks to obtain the second multi-branch data, and the second short-circuit block short-circuits the temporary data to obtain the second short-circuit data, and the second multi-branch data and the second short-circuit data are fused to obtain the first data. By adopting several multi-branch blocks, a shallower network layer is adopted in the basic feature extraction subnetwork, referring to Figure 5 In the embodiment provided, the subnetwork consists of a two-layer residual structure with multi-branch blocks, and each layer of the residual structure consists of four directly sequentially cascaded multi-branch blocks and a short-circuit block. It not only retains the ability to extract rich features using one-dimensional convolution kernels of various sizes, but also expands its ease of use to replace ordinary convolution kernels. The specific process of feature extraction module for target ECG data is as follows, refer to Figure 6 , Figure 6 A flowchart of a multi-branch block in a multi-branch block full attention network model provided by another embodiment of the present invention: the target ECG data is subjected to a 1×1 one-dimensional convolution by a multi-branch block and then batch normalization processing is performed, and the batch normalization data are subjected to average pooling dimensionality reduction and batch normalization processing, 1×3 one-dimensional convolution and batch normalization processing, 1×5 one-dimensional convolution and batch normalization processing, 1×7 one-dimensional convolution and batch normalization processing, and the obtained results are input into the activation layer. The data output by the activation layer is spliced ​​into a layer, and then the data is subjected to a 1×1 one-dimensional convolution to reduce the dimensionality to the same length as the input, and finally the first data is obtained after passing through the batch normalization layer and the activation layer. Reference Figure 8 , Figure 8 A flowchart of the short-circuit block and the classification block in the multi-branch block full-attention network model provided in another embodiment of the present invention. After the target ECG data or temporary data is input into the short-circuit block, it passes through a 1x1 one-dimensional convolution, a batch normalization layer, and an activation layer in sequence before being output.

[0093] Step S140, inputting the first data into the full attention module to extract spatial features and channel features;

[0094] It should be noted that the multi-attention module extracts both spatial and channel features from the first data, thereby simultaneously integrating the dual features of channel attention and spatial attention, paying attention to more comprehensive features and thus making the classification results more accurate. This solves the problem that existing methods extract channel and spatial features of 12-lead ECG data separately, resulting in the loss of correlation features between the two.

[0095] Furthermore, refer to Figure 4 , Figure 4 This is a flowchart of extracting spatial features and channel features by a full attention module according to another embodiment of the present invention. Step S140 further includes steps S141 to S143:

[0096] Step S141: Preprocessing the dimensions of the first data using a pooling layer and a linear layer to obtain a first global prior feature matrix, a second global prior feature matrix, and a feature vector matrix, wherein the preprocessing includes compression processing, expansion processing, segmentation processing, and merging processing;

[0097] Step S142, fusing the first global priori feature matrix and the second global priori feature matrix using an affine algorithm to obtain a correlation degree matrix;

[0098] Step S143 , obtaining second data by performing channel feature calculation on the first data, the correlation degree matrix, and the eigenvector matrix.

[0099] It should be noted that the reference Figure 7 , Figure 7 Flowchart of the full attention block in the multi-branch block full attention network model provided by another embodiment of the present invention, C is the number of channels, H is the height, W is the width, F IRepresents the first data, expressed in the form of a feature vector. The first data is processed to obtain the first global prior feature matrix Q, the second global prior feature matrix K and the feature vector matrix V. The calculation process of Q, K, and V is similar, except that the direction of segmentation is different. The following takes Q as an example to illustrate: the dimension C×H×W of the input first data is compressed to 1 dimension along the height (H) or width (W) through the pooling layer and the linear layer, that is, C×1×W and C×H×1, where 1 represents 1 dimension. After that, each compressed dimension is repeatedly expanded to C×H×W after expansion. Then each is split along the height (H) and width (W) as a new channel in turn, and the dimensions after segmentation become H×C×W and W×C×H. Finally, the values ​​after the two operations are merged into (H+W)×C×S through a merge operation. Among them, S is the channel dimension. In order to be able to fuse the global prior features that can be received in each row and column at each spatial position, an affine operation is used to fuse K and V. The formula is as follows:

[0100]

[0101] Among them, A i,j It is expressed as the correlation matrix between channels i and j at specific spatial locations, Q i is the first global prior, K j is the second global prior, and C is the total number of channels.

[0102] In the process of inputting the first data to outputting the second data, the second data can be calculated as follows during the feature calculation process of the jth channel:

[0103]

[0104] Among them, F Oj Represented as the second data F O The mapping on the j channel, F I represents the first data, γ is the scale factor, V j Expressed as the eigenvector matrix, F Ij It is represented as the mapping of the second data on the j channel, A i,j It is expressed as the correlation matrix between channels i and j at specific spatial positions.

[0105] Step S150 : determining a target classification result corresponding to the target ECG data from preset optional classifications based on the spatial features and the channel features.

[0106] It should be noted that the reference Figure 8 , Figure 8A flowchart of the short-circuit block and the classification block in the multi-branch block full attention network model provided by another embodiment of the present invention. The multi-branch block full attention network model determines the target classification result corresponding to the target ECG data from the preset optional classification. Because the model integrates spatial features and channel features, when the multi-branch block full attention network model is used to classify the target ECG data, more comprehensive features can be taken into account, making the classification accuracy higher. It should be noted that, with reference to Figure 5 After extracting spatial features and channel features, the data will be input into the classification block, and will pass through the pooling layer, fully connected layer, activation layer, convolutional batch activation layer, batch normalization layer in sequence to output the target classification result.

[0107] like Figure 9 As shown, Figure 9 This is a structural diagram of an ECG data classification device based on a multi-branch block full attention network, provided by another embodiment of the present invention. The present invention also provides an ECG data classification device based on a multi-branch block full attention network. The ECG data classification device based on a multi-branch block full attention network is pre-configured with a multi-branch block full attention network model. The multi-branch block full attention network model includes a feature extraction module and a full attention block. The feature extraction module includes multiple multi-branch blocks and a short-circuit block. The device is used to:

[0108] Acquire target ECG data, which is multi-lead ECG data; input the acquired target ECG data into a preconfigured multi-branch block full-attention network model, wherein the multi-branch block full-attention network model includes a feature extraction module and a full-attention block, and the feature extraction module includes multiple multi-branch blocks and a short-circuit block; perform feature extraction on the target ECG data through the feature extraction module to obtain first data; input the first data into the full-attention module to extract spatial features and channel features; and determine a target classification result corresponding to the target ECG data from preset optional classifications based on the spatial features and channel features.

[0109] It is also used for: training a multi-branch block full-attention network model by the following method: obtaining a training set and a test set corresponding to training ECG data of different samples; performing feature extraction on the training set through a feature extraction module to obtain first feature data; performing spatial feature extraction and channel feature extraction on the first feature data through a full-attention block to obtain second feature data; inputting the second feature data into a classification block for classification to obtain a multi-branch block full-attention network model in a trained state; inputting a test set into the multi-branch block full-attention network model in a trained state for testing to obtain a test result; performing imbalanced recognition on the test result through a pre-trained classification evaluation model to obtain a macro ROC curve; determining the recognition accuracy of the imbalanced classification of the multi-branch block full-attention network model according to the area value under the macro ROC curve, wherein imbalanced classification refers to the classification of samples of ECG data with imbalanced proportions; judging whether the multi-branch block full-attention network model has been trained according to the recognition accuracy.

[0110] It is also used for: performing ECG classification on training ECG data; denoising the training ECG data through a wavelet denoising algorithm with weight threshold shrinkage; resampling the denoised training ECG data according to a unified sampling frequency, wherein the sampling frequency is a frequency after normalization; segmenting the resampled training ECG data according to a fixed time length to obtain an ECG sequence; dividing the ECG sequence into a training set and a test set according to sample categories and ECG categories, wherein the ECG sequence corresponding to the test set and the ECG sequence corresponding to the training set are different sample categories.

[0111] It is also used to: denoise the training ECG data through a wavelet denoising algorithm with weight threshold shrinkage, including: decomposing the training ECG data through discrete wavelets to obtain wavelet coefficients of each layer of the training ECG data; and reconstructing the wavelet through a dynamic soft threshold function and wavelet coefficients of each layer to obtain a denoised signal.

[0112] It is also used for: performing feature extraction on target ECG data through a feature extraction module to obtain first data, including: performing feature extraction on the target ECG data in sequence through a first multi-branch block set in the feature extraction module to obtain first multi-branch data, wherein the first multi-branch block set includes several multi-branch blocks; short-circuiting the target ECG data through a first short-circuit block in the feature extraction module to obtain first short-circuited data; fusing the first multi-branch data and the first short-circuited data to obtain temporary data; performing feature extraction on the temporary data in sequence through a second multi-branch block set in the feature extraction module to obtain second multi-branch data; short-circuiting the temporary data through the first short-circuit block in the feature extraction module to obtain second short-circuited data; fusing the second multi-branch data and the second short-circuited data to obtain first data, wherein the second multi-branch block set includes several multi-branch blocks.

[0113] It is also used to: input the first data into the full attention module to extract spatial features and channel features, including: preprocessing the dimensions of the first data through the pooling layer and the linear layer to obtain the first global prior feature matrix, the second global prior feature matrix and the eigenvector matrix, wherein the preprocessing includes compression processing, expansion processing, segmentation processing and merging processing; fusing the first global prior feature matrix and the second global prior feature matrix through the affine algorithm to obtain the correlation degree matrix; and obtaining the second data by performing channel feature calculation on the first data, the correlation degree matrix and the eigenvector matrix. Wherein: the calculation formula of the correlation degree matrix is:

[0114] Among them, A i,j It is expressed as the correlation matrix between channels i and j at specific spatial locations, Q i is the first global prior, K j is the second global prior, C is the total number of channels;

[0115] The calculation formula for the second data is:

[0116] Among them, F Oj Represented as the second data F O The mapping on the j channel, F I represents the first data, γ is the scale factor, V j Expressed as the eigenvector matrix, F Ij It is represented as the mapping of the second data on the j channel, A i,j It is expressed as the correlation matrix between channels i and j at specific spatial positions.

[0117] like Figure 9 As shown, Figure 9 is a structural diagram of an ECG data classification device based on a multi-branch block full attention network provided by another embodiment of the present invention, comprising:

[0118] The processor 910 may be implemented as a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is configured to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.

[0119] The memory 920 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 920 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 920 and is called by the processor 910 to execute the ECG data classification method based on the multi-branch block full attention network in the embodiments of this application.

[0120] Input / output interface 930, used to implement information input and output;

[0121] Communication interface 940, used to implement communication interaction between this device and other devices, which can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WiFi, Bluetooth, etc.);

[0122] bus 950 , which transmits information between various components of the device (e.g., processor 910 , memory 920 , input / output interface 930 , and communication interface 940 );

[0123] The processor 910 , the memory 920 , the input / output interface 930 , and the communication interface 940 are connected to each other in communication within the device via a bus 950 .

[0124] An embodiment of the present application also provides an electronic device, including the electrocardiogram data classification device based on the multi-branch block full attention network as described above.

[0125] An embodiment of the present application also provides a storage medium, which is a computer-readable storage medium. The storage medium stores a computer program, which, when executed by a processor, implements the above-mentioned ECG data classification method based on a multi-branch block full attention network.

[0126] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory optionally includes a memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of the above-mentioned networks include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof. The device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and are located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.

[0127] Those skilled in the art will appreciate that all or some of the steps and systems in the method disclosed above can be implemented as software, firmware, hardware, and appropriate combinations thereof. Some physical components or all physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, and the computer-readable medium can include computer storage media (or non-transitory media) and communication media (or temporary media). As known to those skilled in the art, the term computer storage media is included in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data) and is volatile and non-volatile, removable, and non-removable. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory, or other memory technology, CD-ROM, digital versatile disks (DVD), or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage, or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, as is well known to those skilled in the art, communication media typically includes computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0128] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above implementation. Those skilled in the art can also make various equivalent modifications or substitutions under the shared conditions that do not violate the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present invention.

Claims

1. A method for ECG data classification based on a multi-branch block full attention network, characterized in that: include: Acquiring target ECG data, wherein the target ECG data is multi-lead ECG data; Inputting the acquired target ECG data into a preconfigured multi-branch block full attention network model, wherein the multi-branch block full attention network model includes a feature extraction module and a full attention block, and the feature extraction module includes multiple multi-branch blocks and short-circuit blocks; Extracting features from the target ECG data using the feature extraction module to obtain first data; Input the first data into the full attention module to extract spatial features and channel features; Determining a target classification result corresponding to the target ECG data from preset optional classifications according to the spatial features and the channel features; The step of extracting features from the target ECG data by the feature extraction module to obtain first data includes: Extracting features of the target ECG data in sequence using a first multi-branch block set in the feature extraction module to obtain first multi-branch data, wherein the first multi-branch block set includes a plurality of multi-branch blocks; Short-circuiting the target ECG data by a first short-circuiting block in the feature extraction module to obtain first short-circuited data; Merging the first multi-branch data and the first short-circuited data to obtain temporary data; Extracting features from the temporary data in sequence by a second multi-branch block set in the feature extraction module to obtain second multi-branch data; Short-circuiting the temporary data by a second short-circuit block in the feature extraction module to obtain second short-circuit data; The second multi-branch data and the second short-circuited data are merged to obtain first data, wherein the second multi-branch block set includes a plurality of multi-branch blocks.

2. The ECG data classification method based on the multi-branch block full attention network according to claim 1 is characterized in that The multi-branch block full attention network model is trained by the following method: Obtain training sets and test sets corresponding to training ECG data of different samples; Extracting features from the training set using the feature extraction module to obtain first feature data; Performing spatial feature extraction and channel feature extraction on the first feature data through a full attention block to obtain second feature data; Inputting the second feature data into the classification block for classification to obtain the multi-branch block full attention network model in the training state; Inputting the test set into the multi-branch block full attention network model in the training state to perform testing to obtain a test result; The test results are subjected to imbalance identification by a pre-trained classification evaluation model to obtain a macro ROC curve; Determining the recognition accuracy of the imbalanced classification of the multi-branch block full attention network model according to the area value under the macro ROC curve, wherein the imbalanced classification refers to the classification of samples of the electrocardiogram data with imbalanced proportions; Whether the multi-branch block full attention network model is trained is determined according to the recognition accuracy.

3. The ECG data classification method based on the multi-branch block full attention network according to claim 2 is characterized in that The obtaining of training sets and test sets corresponding to training ECG data of different samples includes: Performing electrocardiogram classification on the training electrocardiogram data; Denoising the training ECG data using a wavelet denoising algorithm with weight threshold shrinkage; The denoised training ECG data is resampled according to a unified sampling frequency, wherein the sampling frequency is The frequency after normalization; Segmenting the resampled training ECG data according to a fixed time length to obtain an ECG sequence; The ECG sequence is divided into a training set and a test set according to sample categories and ECG categories, wherein the ECG sequence corresponding to the test set and the ECG sequence corresponding to the training set are of different sample categories.

4. The ECG data classification method based on multi-branch block full attention network according to claim 3 is characterized in that The wavelet denoising algorithm using weight threshold shrinkage is used to denoise the training ECG data, comprising: Decomposing the training ECG data by discrete wavelet to obtain wavelet coefficients of each layer of the training ECG data; The denoised signal is obtained by reconstructing the wavelet through the dynamic soft threshold function and the wavelet coefficients of each layer.

5. The ECG data classification method based on multi-branch block full attention network according to claim 1 is characterized in that Inputting the first data into the full attention module to extract spatial features and channel features includes: Preprocessing the dimensions of the first data through a pooling layer and a linear layer to obtain a first global prior feature matrix, a second global prior feature matrix, and a feature vector matrix, wherein the preprocessing includes compression processing, expansion processing, segmentation processing, and merging processing; fusing the first global priori feature matrix and the second global priori feature matrix using an affine algorithm to obtain a correlation degree matrix; The second data is obtained by performing channel feature calculation on the first data, the correlation degree matrix and the eigenvector matrix.

6. The ECG data classification method based on multi-branch block full attention network according to claim 5 is characterized in that The first data is input into the full attention module to extract spatial features and channel features. The calculation formula of the correlation matrix is: Among them, A i,j It is expressed as the correlation matrix of channels i and j at specific spatial locations, Q i is the first global prior, K j is the second global prior, C is the total number of channels; The calculation formula of the second data is: Among them, F Oj The second data F is represented as O The mapping on the j channel, F I represents the first data, γ is the scale factor, V j Expressed as the eigenvector matrix, F Ij It is represented as the mapping of the first data on the j channel, A i,j It is represented as the correlation degree matrix of channels i and j at specific spatial positions.

7. An ECG data classification device based on a multi-branch block full attention network, characterized in that: The ECG data classification device based on the multi-branch block full attention network is pre-configured with a multi-branch block full attention network model, which includes a feature extraction module and a full attention block. The feature extraction module includes multiple multi-branch blocks and short-circuit blocks. The device is used to: Acquiring target ECG data, wherein the target ECG data is multi-lead ECG data; Inputting the acquired target ECG data into a preconfigured multi-branch block full attention network model, wherein the multi-branch block full attention network model includes a feature extraction module and a full attention block, and the feature extraction module includes multiple multi-branch blocks and short-circuit blocks; Extracting features from the target ECG data using the feature extraction module to obtain first data; Input the first data into the full attention module to extract spatial features and channel features; Determining a target classification result corresponding to the target ECG data from preset optional classifications according to the spatial features and the channel features; The step of extracting features from the target ECG data by the feature extraction module to obtain first data includes: Extracting features of the target ECG data in sequence using a first multi-branch block set in the feature extraction module to obtain first multi-branch data, wherein the first multi-branch block set includes a plurality of multi-branch blocks; Short-circuiting the target ECG data by a first short-circuiting block in the feature extraction module to obtain first short-circuited data; Merging the first multi-branch data and the first short-circuited data to obtain temporary data; Extracting features from the temporary data in sequence by a second multi-branch block set in the feature extraction module to obtain second multi-branch data; Short-circuiting the temporary data by a second short-circuit block in the feature extraction module to obtain second short-circuit data; The second multi-branch data and the second short-circuited data are merged to obtain first data, wherein the second multi-branch block set includes a plurality of multi-branch blocks.

8. An electronic device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electrocardiogram data classification method based on the multi-branch block full attention network as described in any one of claims 1 to 6 is implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: The computer program is used to execute the electrocardiogram data classification method based on the multi-branch block full attention network as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and system for classifying multi-lead ECG signals

    CN109063552A

  • Multi-lead electrocardiogram signal processing method and device, equipment and storage medium

    CN114711780A