Electrocardiogram classification method, system, electronic device and storage medium
By preprocessing and weighting the ECG, using the class-weighted width learning model for knowledge transfer, and constructing an ECG classification model, the problems of ECG waveform differences and heartbeat class imbalance among different patients were solved, and accurate identification of abnormal heartbeats was achieved.
Patent Information
- Application Number
- CN202310559904.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-18
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2043-05-18
AI Technical Summary
Existing general electrocardiogram analysis systems exhibit unstable performance and have difficulty accurately identifying abnormal heartbeats when faced with electrocardiogram waveform differences and heartbeat imbalance problems among different patients.
By preprocessing multiple ECGs, generating source domain and target domain datasets, and using the class weighted width learning model to calculate the connection weights, knowledge transfer is achieved, and the domain adaptation class weighted width learning model is trained. Different weight coefficients are assigned to different ECG categories to construct an ECG classification model.
It achieves accurate and rapid recognition of the electrocardiograms of different subjects, solves the problem of significant differences in electrocardiogram characteristics, and improves the ability to detect abnormal heart beats.
Smart Images

Figure CN116636856B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information processing technology, and in particular to an electrocardiogram classification method, system, electronic equipment and storage medium. Background Art
[0002] Cardiovascular disease is the leading cause of death worldwide, and arrhythmias, a key component of cardiovascular disease, have become a major contributing factor to the global mortality rate. Over the past few decades, numerous general and automated arrhythmia detection methods have emerged, based on traditional machine learning models or deep learning models. In traditional machine learning models, feature extraction and classification are performed separately. Unlike traditional machine learning models, deep learning models perform both feature extraction and classification simultaneously, enabling feature learning to be adaptively learned in an incremental manner without the need for domain expertise.
[0003] However, their widespread use in clinical practice remains a significant challenge due to two overlooked issues with reliable ECG analysis. One major issue is the significant morphology of ECG waveforms across different patients. Many general-purpose systems employ a fixed model, where classifiers are trained on a public ECG (Electro Cardio Gram) dataset and then directly applied to all patients without adaptation. Consequently, they exhibit a common drawback of unstable performance when classifying ECG signals from new patients. Another issue is that the number of normal heartbeats far exceeds the number of abnormal heartbeats. This imbalance between beat classes results in general models' performance being biased toward the majority class (normal beats). However, in arrhythmia analysis, detection of the minority class (abnormal beats) is of greater concern. This leads to biased ECG signal classification and inability to accurately identify abnormal beats. Summary of the Invention
[0004] The following is an overview of the topics described in detail in this article.
[0005] The embodiments of the present invention provide an electrocardiogram classification method, system, electronic device, and storage medium, which can accurately and quickly identify various types of heartbeats of different objects.
[0006] In a first aspect, an embodiment of the present invention provides an electrocardiogram classification method, the method comprising:
[0007] Perform preprocessing operations on the acquired multiple electrocardiograms to obtain source domain datasets and target domain datasets;
[0008] Input the source domain dataset into the preset class weighted width learning model for weight calculation to obtain the source domain connection weight;
[0009] Inputting the target domain dataset and the source domain connection weights into a preset domain adaptation class weighted width learning model for knowledge transfer to obtain the target domain connection weights;
[0010] Training the domain adaptation class weighted width learning model according to the source domain connection weight and the target domain connection weight to obtain an electrocardiogram classification model;
[0011] The target domain data set is input into the ECG classification model to perform ECG classification and obtain a classification label.
[0012] The ECG classification method provided by the embodiment of the present invention has at least the following beneficial effects: a preprocessing operation is performed on the multiple ECGs obtained, so as to achieve the distinction between the ECGs of different objects and obtain a source domain data set and a target domain data set. Thereafter, the source domain data set is input into a preset class weighted width learning model for weight calculation to obtain a source domain connection weight for characterizing the source domain knowledge. The target domain data set and the source domain connection weight are then input into a domain adaptation class weighted width learning model for knowledge transfer to obtain a target domain connection weight, thereby achieving the transfer of source domain knowledge to the target domain and solving the problem of significant differences in ECG features between objects. Finally, the domain adaptation class weighted width learning model is trained according to the source domain connection weight and the target domain connection weight, and different weight coefficients can be assigned to different ECG categories to constrain the contribution to the model and obtain an ECG classification model. The target domain data set is input into the ECG classification model for ECG classification to obtain classification labels, thereby achieving accurate and rapid recognition of various heartbeats of different objects and solving the problem of significant differences in ECG features between objects.
[0013] In some embodiments, the electrocardiogram includes a first electrocardiogram set and a second electrocardiogram set, wherein the first electrocardiogram set is a first electrocardiogram of a historical subject, and the second electrocardiogram set is a second electrocardiogram of a specific subject; and performing a preprocessing operation on the acquired multiple electrocardiograms to obtain a source domain dataset and a target domain dataset includes:
[0014] Performing peak detection on the first electrocardiogram and the second electrocardiogram based on a preset positioning algorithm to determine a first R wave peak in the first electrocardiogram and a second R wave peak in the second electrocardiogram;
[0015] Performing signal segmentation on the first R wave peak and the second R wave peak according to a preset signal length to obtain a plurality of first heart beat segments corresponding to the first R wave peak and a plurality of second heart beat segments corresponding to the second R wave peak;
[0016] performing a normalization operation on the first heart beat segment and the second heart beat segment;
[0017] The source domain dataset is generated according to the normalized first heart beat segment, and the target domain dataset is generated according to the normalized second heart beat segment.
[0018] In some embodiments, before inputting the source domain dataset into a preset class weighted width learning model to perform weight calculation to obtain the source domain connection weight, the method further includes:
[0019] In the target domain data set, the second heart beat segments are selected according to a preset time interval to obtain target domain training data, and the remaining second heart beat segments are used as target domain test data.
[0020] In some embodiments, inputting the source domain dataset into a preset class weighted width learning model to perform weight calculation to obtain the source domain connection weight includes:
[0021] Obtain source domain sample categories in the source domain dataset;
[0022] Performing a labeling operation on the source domain sample category to obtain a source domain label matrix corresponding to the source domain sample category;
[0023] Inputting the source domain dataset into the class weighted width learning model to perform feature calculation to obtain a first feature node;
[0024] Calculating the first feature node based on a preset nonlinear activation function to obtain a first enhanced node;
[0025] Calculating a first training weight for the source domain sample category, and combining the first training weight, the first feature node, and the first enhancement node to generate a first weighted expansion matrix;
[0026] The class weighted width learning model is trained according to the first weighted expansion matrix and the source domain label matrix to generate source domain connection weights.
[0027] In some embodiments, inputting the target domain dataset and the source domain connection weights into a preset domain adaptation class weighted width learning model for knowledge transfer to obtain the target domain connection weights includes:
[0028] Obtaining target sample categories in the target domain training data;
[0029] Performing a labeling operation on the target sample category to obtain a target label matrix corresponding to the target sample category;
[0030] Inputting the target domain training data into the domain adaptation class weighted width learning model to perform random feature calculation to obtain a second feature node;
[0031] Calculating the second feature node based on a preset nonlinear activation function to obtain a second enhanced node;
[0032] Calculating a second training weight for the target sample category, and combining the second training weight, the second feature node, and the second enhancement node to generate a second weighted expansion matrix;
[0033] The domain adaptation class weighted width learning model is trained according to the second weighted expansion matrix, the source domain connection weight, and the target label matrix to obtain the target domain connection weight.
[0034] In some embodiments, inputting the target domain dataset into the ECG classification model to perform ECG classification to obtain a classification label includes:
[0035] Inputting the target domain test data into the ECG classification model to perform node calculation to obtain a third characteristic node and a third enhanced node of the target domain test data;
[0036] Perform node series connection on the third characteristic node and the third enhanced node to obtain a third extended matrix;
[0037] Inputting the third extended matrix and the target domain connection weights into the ECG classification model to perform ECG prediction, and outputting a predicted output vector;
[0038] The classification label corresponding to the target domain test data is determined according to the predicted output vector.
[0039] In some embodiments, the classification label includes one of the following:
[0040] non-ectopic heart beats;
[0041] Supraventricular ectopic heartbeats;
[0042] ventricular ectopic heart beats;
[0043] Fusion heartbeat;
[0044] Unknown heartbeat.
[0045] In a second aspect, an embodiment of the present invention further provides an electrocardiogram classification system, the system comprising:
[0046] The data acquisition module is used to perform preprocessing operations on the acquired multiple electrocardiograms to obtain source domain datasets and target domain datasets;
[0047] The weight calculation module is used to input the source domain dataset into the preset class weighted width learning model for weight calculation to obtain the source domain connection weight;
[0048] A knowledge transfer module is used to input the target domain dataset and the source domain connection weights into a preset domain adaptation class weighted width learning model for knowledge transfer to obtain the target domain connection weights;
[0049] a model training module, configured to train the domain adaptation class weighted width learning model according to the source domain connection weight and the target domain connection weight to obtain an electrocardiogram classification model;
[0050] The classification prediction module is used to input the target domain data set into the ECG classification model to perform ECG classification and obtain a classification label.
[0051] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the electrocardiogram classification method as described in the first aspect when executing the computer program.
[0052] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the electrocardiogram classification method as described in the first aspect.
[0053] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained through the structures particularly pointed out in the description and the drawings. 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 examples 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 This is an overall flow chart of the ECG classification method provided by an embodiment of the present invention;
[0056] Figure 2 yes Figure 1 Specific method flow chart of step S101 in FIG;
[0057] Figure 3 is an overall flow chart of an electrocardiogram classification method provided by another embodiment of the present invention;
[0058] Figure 4 yes Figure 1 Specific method flow chart of step S102 in FIG;
[0059] Figure 5 yes Figure 1Specific method flow chart of step S103 in FIG;
[0060] Figure 6 yes Figure 1 Specific method flow chart of step S105 in;
[0061] Figure 7 is a structural diagram of an ECG classification system provided in an embodiment of the present application;
[0062] Figure 8 This is a schematic diagram of the hardware structure of the electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0064] Cardiovascular disease is the leading cause of death worldwide, and arrhythmias, a key component of cardiovascular disease, have become a major contributing factor to the global mortality rate. In clinical analysis, non-invasive and inexpensive electrocardiograms (ECGs) are commonly used to help cardiologists effectively diagnose arrhythmias. However, this process requires cardiologists to observe long-term ECG recordings, which is subjective, time-consuming, and labor-intensive. Therefore, computer-assisted automatic classification systems for ECG signals have emerged to assist in arrhythmia analysis.
[0065] Unlike traditional machine learning models, where feature extraction and classification are performed separately, deep learning models perform both feature extraction and classification simultaneously, enabling adaptive learning of features in an incremental manner without the need for domain experts.
[0066] While existing general-purpose systems demonstrate excellent performance under certain conditions, their widespread adoption in clinical practice remains a significant challenge due to two overlooked issues with reliable ECG analysis. One major issue is the significant morphology of ECG waveforms across patients. Many general-purpose systems employ a fixed model, where classifiers are trained on a public ECG dataset and then directly applied to all patients without adaptation. Consequently, they exhibit a common drawback of unstable performance when classifying ECG signals from new patients. Another issue is that the number of normal heartbeats far exceeds the number of abnormal heartbeats. This imbalance between beat classes results in the performance of general models being biased toward the majority class (normal beats). However, in arrhythmia analysis, detecting the minority class (abnormal beats) is of greater concern.
[0067] In order to solve the above problems, the embodiments of the present invention provide an ECG classification method, system, electronic device and storage medium, which perform preprocessing operations on the multiple acquired ECGs, thereby achieving the distinction between the ECGs of different objects, and obtaining a source domain dataset and a target domain dataset. Thereafter, the source domain dataset is input into a preset class weighted width learning model for weight calculation to obtain a source domain connection weight for characterizing the source domain knowledge, and then the target domain dataset and the source domain connection weight are input into a domain adaptation class weighted width learning model for knowledge transfer to obtain a target domain connection weight, thereby achieving the transfer of source domain knowledge to the target domain, and solving the problem of significant differences in ECG features between objects. Finally, the domain adaptation class weighted width learning model is trained according to the source domain connection weight and the target domain connection weight, and can constrain the contribution to the model by assigning different weight coefficients to different ECG categories, thereby obtaining an ECG classification model, and the target domain dataset is input into the ECG classification model for ECG classification to obtain classification labels, thereby achieving accurate and rapid recognition of various types of heartbeats of different objects, and solving the problem of significant differences in ECG features between objects.
[0068] Reference Figure 1 , an embodiment of the present invention provides an ECG classification method, which includes but is not limited to the following steps S101 to S105.
[0069] Step S101: preprocessing the acquired multiple electrocardiograms to obtain a source domain dataset and a target domain dataset;
[0070] In some embodiments, a preprocessing operation is performed on the multiple acquired ECGs to ensure that the specifications of each ECG are consistent, and the ECGs of different objects are distinguished to obtain a source domain dataset and a target domain dataset, thereby improving the precision and accuracy of subsequent ECG signal classification.
[0071] Step S102: inputting the source domain dataset into a preset class weighted width learning model to perform weight calculation to obtain the source domain connection weight;
[0072] In some embodiments, the source domain dataset is input into a preset class-weighted width learning model for weight calculation to obtain the source domain connection weight, thereby training a general class-weighted width learning model on the source domain dataset, fully learning the useful knowledge in the source domain, and then more accurately describing the network structure and achieving better prediction and optimization effects. In addition, by assigning different weight coefficients to different categories of heartbeats to constrain their contribution to the model, the subsequent training of the domain-adaptive class-weighted width learning model is facilitated.
[0073] Step S103: inputting a preset domain adaptation class weighted width learning model into the target domain dataset and the source domain connection weights to perform knowledge transfer and obtain the target domain connection weights;
[0074] In some embodiments, a preset domain adaptation class weighted width learning model is input based on the target domain dataset and the source domain connection weight to perform knowledge transfer, and the target domain connection weight is obtained, thereby achieving domain adaptation of the domain adaptation class weighted width learning model and realizing the transfer of source domain knowledge to the target domain.
[0075] Step S104: training a domain adaptation class weighted width learning model according to the source domain connection weight and the target domain connection weight to obtain an ECG classification model;
[0076] In some embodiments, a domain adaptation class weighted width learning model is trained based on the source domain connection weights and the target domain connection weights, and during the training process, a training error term is constructed by category, and different weight coefficients are assigned to different categories to constrain their contribution to the model, thereby obtaining an ECG classification model, thereby achieving adaptation to the target domain and solving the problem of significant differences in ECG characteristics between patients. By assigning higher weight coefficients to minority classes, the degree of attention to the category during model training is increased, thereby improving the algorithm's ability to resist data imbalance and solving the data imbalance problem.
[0077] Step S105 : Input the target domain data set into the ECG classification model to perform ECG classification and obtain classification labels.
[0078] In some embodiments, an unlabeled target domain dataset is input into an ECG classification model for ECG classification to obtain classification labels, thereby achieving accurate classification of ECG signals and accurately detecting abnormal heart beats.
[0079] Reference Figure 2 In some embodiments, step S101 may include but is not limited to steps S201 to S204:
[0080] It should be noted that the electrocardiogram includes a first electrocardiogram set and a second electrocardiogram set, wherein the first electrocardiogram set is a first electrocardiogram of a historical object, and the second electrocardiogram set is a second electrocardiogram of a specific object.
[0081] It can be understood that the historical object in this embodiment can be a previous patient, and the specific object can be a specific patient that needs to be tested. Specifically, the electrocardiogram can be derived from the internationally disclosed MIT-BIH arrhythmia database, whose sampling frequency is 360Hz. The first 20 II lead signals are used as the electrocardiogram signals of the previous patient to form the first electrocardiogram set, and the last 24 II lead signals are used as the electrocardiogram signals of the specific patient to form the second electrocardiogram set.
[0082] Step S201, performing peak detection on the first electrocardiogram and the second electrocardiogram based on a preset positioning algorithm to determine a first R wave peak in the first electrocardiogram and a second R wave peak in the second electrocardiogram;
[0083] In some embodiments, peak detection is performed on the first electrocardiogram and the second electrocardiogram based on the Pan-Tompkins algorithm, the R peak positions in all electrocardiogram signals are located, and the first R peak in the first electrocardiogram and the second R peak in the second electrocardiogram are determined to improve the accuracy of electrocardiogram signal recognition.
[0084] Step S202, performing signal segmentation on the first R wave peak and the second R wave peak according to a preset signal length to obtain a plurality of first heart beat segments corresponding to the first R wave peak and a plurality of second heart beat segments corresponding to the second R wave peak;
[0085] In some embodiments, the first R wave peak and the second R wave peak are sampled and the signal is segmented according to a preset signal length to obtain multiple first heart beat segments corresponding to the first R wave peak and second heart beat segments corresponding to the second R wave peak, thereby achieving precise segmentation of the peaks and improving the precision and accuracy of subsequent ECG signal classification.
[0086] It should be noted that the signal length in this embodiment can be selected according to the needs of the user. In the process of sampling the first R wave peak and the second R wave peak, 144 and 155 sampling points can be taken before and after the R wave peak respectively to divide the long-term ECG signal into heart beat segments containing 300 sampling points, thereby reducing the computational complexity and improving the computational efficiency.
[0087] Step S203, performing a normalization operation on the first heart beat segment and the second heart beat segment;
[0088] In some embodiments, since the ECG signal is easily interfered by external noise, this embodiment performs min-max normalization processing on the first heart beat segment and the second heart beat segment to unify the amplitude range of all heart beat segments to the interval [0,1], which can remove the influence of noise and thus improve signal quality and accuracy.
[0089] Step S204 : generating a source domain dataset based on the normalized first heart beat segment, and generating a target domain dataset based on the normalized second heart beat segment.
[0090] In some embodiments, a source domain dataset is generated based on the normalized first heart beat segment, and a target domain dataset is generated based on the normalized second heart beat segment, wherein the normalized first heart beat segment is as follows:
[0091]
[0092] It is understandable that is the normalized heart beat segment, and are the minimum and maximum elements in the original heart beat segment respectively.
[0093] Reference Figure 3 , Figure 3 This is a flow chart of an ECG classification method provided by another embodiment of the present application, including but not limited to step S301:
[0094] It should be noted that step S301 occurs before step S102.
[0095] Step S301 : In the target domain data set, second heart beat segments are selected according to a preset time interval to obtain target domain training data, and the remaining second heart beat segments are used as target domain test data.
[0096] In some embodiments, the normalized second heart beat segments within the time interval in the target domain dataset are used as target domain training data, and the remaining normalized second heart beat segments in the target domain dataset are used as test data, thereby facilitating subsequent knowledge transfer from the source domain to the target domain and achieving adaptation to the target domain.
[0097] It should be noted that the time interval in this embodiment is the first five minutes, that is, the normalized second heart beat segment of the first five minutes in the target domain dataset is taken as the target domain training data.
[0098] Reference Figure 4 In some embodiments, step S102 may include but is not limited to steps S401 to S406:
[0099] Step S401, obtaining source domain sample categories in the source domain dataset;
[0100] It can be understood that source domain sample categories include but are not limited to N (non-ectopic beat), S (supraventricular ectopic beat), V (ventricular ectopic beat), F (fusion beat) and Q (unknown beat).
[0101] Step S402: labeling the source domain sample categories to obtain a source domain label matrix corresponding to the source domain sample categories;
[0102] In some embodiments, a labeling operation is performed on different source domain sample categories in a source domain dataset, and labels are assigned according to the heartbeat categories using one-hot encoding to obtain a source domain label matrix corresponding to the source domain sample categories, which facilitates the subsequent training of the class-weighted width learning model, achieves the distinction between different heartbeat categories, and improves the accuracy of heartbeat classification.
[0103] It is understandable that different heartbeat categories have different labels, for example, N is [1, 0, 0, 0, 0], S is [0, 1, 0, 0, 0], V is [0, 0, 1, 0, 0], F is [0, 0, 0, 1, 0], and Q is [0, 0, 0, 0, 1].
[0104] Step S403: inputting the source domain dataset into the class weighted width learning model to perform feature calculation to obtain a first feature node;
[0105] In some embodiments, the source domain dataset is input into a class-weighted width learning model for feature calculation, and the weights and biases of the class-weighted width learning model are randomly set to calculate the random features of the input source domain dataset. At the same time, a compact first feature node is obtained through fine-tuning of the sparse autoencoder to achieve extraction and dimensionality reduction of random features, thereby improving the performance of random features.
[0106] It should be noted that the structure of the class-weighted width learning model includes an input layer, feature nodes, enhancement nodes, and an output layer. The mapping relationship between the input layer and the feature nodes is shown in the following formula (1):
[0107] (1)
[0108] in, and are randomly set weights and biases, X is the input training sample (source domain dataset), is a sparse autoencoder, For the mapping i Group feature nodes.
[0109] Step S404: Calculate the first feature node based on a preset nonlinear activation function to obtain a first enhanced node;
[0110] In some embodiments, a nonlinear activation function is used to calculate the first feature node to obtain a first enhanced node corresponding to the first feature node, thereby making the feature more prominent and critical, and improving the authority and influence of the source domain dataset in the network. The mapping relationship between the feature node and the enhanced node is shown in the following formula (2):
[0111] (2)
[0112] in, and are randomly set weights and biases, For all feature nodes, is a nonlinear activation function, For the mapping j Group enhancement nodes.
[0113] Step S405: calculating a first training weight of the source domain sample category, and combining the first training weight, the first feature node, and the first enhancement node to generate a first weighted expansion matrix;
[0114] In some embodiments, a first training weight of each source domain sample category in the source domain dataset is calculated, and all first feature nodes and first enhancement nodes are combined to generate a first weighted expansion matrix , which can create connections between originally relatively isolated nodes.
[0115] It should be noted that the first characteristic node is , the first enhanced node is .
[0116] Step S406 : Training a class weighted width learning model according to the first weighted expansion matrix and the source domain label matrix to generate source domain connection weights.
[0117] In some embodiments, a class-weighted width learning model is trained based on the first weighted expansion matrix and the source domain label matrix to calculate the source domain network connection weights and generate source domain connection weights, thereby achieving a universal class-weighted width learning model trained on the source domain dataset, fully learning the useful knowledge in the source domain, and thus more accurately describing the network structure and achieving better prediction and optimization effects. Different weight coefficients are assigned to different categories of heartbeats to constrain their contribution to the model. By assigning a higher weight coefficient to the minority class, the degree of attention paid to that class during model training is increased, thereby improving the algorithm's ability to resist data imbalance and solving the data imbalance problem.
[0118] It should be noted that, through the source domain dataset In the process of training the class-weighted width learning model, the objective function of network training is first constructed, as shown in the following formula (3):
[0119] (3)
[0120] in, and Respectively i The expansion matrix (first weighted expansion matrix) and label matrix (source domain label matrix) of categories, is the regularized system, L is the total number of source domain sample categories, is the learned source domain knowledge, The source domain dataset i The weight coefficient of the training loss of each category is calculated as follows:
[0121] (4)
[0122] in, and are the scaling factors for the majority and minority classes, respectively. It is i The number of samples in each category, and by taking the derivative and setting it equal to 0, the source domain connection weight of the class weighted width learning model can be obtained as ,in, is an identity matrix of appropriate size.
[0123] Reference Figure 5 In some embodiments, step S103 may include but is not limited to steps S501 to S506:
[0124] Step S501, obtaining target sample categories in target domain training data;
[0125] It is understandable that target sample categories include, but are not limited to, N (non-ectopic beat), S (supraventricular ectopic beat), V (ventricular ectopic beat), F (fusion beat), and Q (unknown beat).
[0126] Step S502: labeling the target sample category to obtain a target label matrix corresponding to the target sample category;
[0127] In some embodiments, a labeling operation is performed on different labeled sample categories in the target domain training data, and labels are assigned according to the heartbeat categories using one-hot encoding to obtain a target label matrix corresponding to the target sample category, which facilitates the subsequent training of the domain-adaptive class weighted width learning model, achieves the distinction between different heartbeat categories, and improves the accuracy of heartbeat classification.
[0128] It is understandable that different heartbeat categories have different labels, for example, N is [1, 0, 0, 0, 0], S is [0, 1, 0, 0, 0], V is [0, 0, 1, 0, 0], F is [0, 0, 0, 1, 0], and Q is [0, 0, 0, 0, 1].
[0129] Step S503: input the target domain training data into the domain adaptation class weighted width learning model to perform random feature calculation to obtain a second feature node;
[0130] Step S504: Calculate the second feature node based on a preset nonlinear activation function to obtain a second enhanced node;
[0131] Step S505 , calculating a second training weight of the target sample category, and combining the second training weight, the second feature node, and the second enhancement node to generate a second weighted expansion matrix;
[0132] In steps S503 to S505 of some embodiments, the specific process of obtaining the second characteristic node, the second enhanced node and the second weighted expansion matrix is the same as the process of steps S403 to S405 above, and will not be repeated here in this embodiment.
[0133] Step S506 : Training the domain adaptation class weighted width learning model according to the second weighted expansion matrix, the source domain connection weights, and the target label matrix to obtain the target domain connection weights.
[0134] In some embodiments, a general class-weighted width learning model is trained on a source domain dataset to fully learn useful knowledge in the source domain. After obtaining the source domain connection weights, a domain-adaptive class-weighted width learning model is trained according to a second weighted expansion matrix, the source domain connection weights, and the target label matrix, thereby achieving domain adaptation of the domain-adaptive class-weighted width learning model and obtaining the target domain connection weights, thereby achieving the migration of source domain knowledge to the target domain. Furthermore, by constructing training error terms by category and assigning different weight coefficients to different categories to constrain their contribution to the model, adaptation to the target domain is achieved, solving the problem of significant differences in ECG characteristics between patients.
[0135] It should be noted that, when training data in the target domain In the process of training the weighted width learning model for domain adaptation, it is necessary to first construct the objective function, as shown in the following formula (5):
[0136] (5)
[0137] in, and They are the first j The expansion matrix (second weighted expansion matrix) and label matrix (target label matrix) of categories, and are two trade-off parameters, The first j The weight coefficient of the training loss of each category, That is, the target domain connection weight after domain adaptation. The first term in formula (5) is the regularization term to prevent overfitting. The second term is the target domain weighted training error term, and the third term is the knowledge transfer term.
[0138] In order to find the optimal solution of the above objective function, it is converted into a constrained form. Specifically, formula (5) is converted into formula (6):
[0139] (5)
[0140] (6)
[0141] Furthermore, the Lagrangian function can be constructed as shown in the following formula (7):
[0142] (7)
[0143] when When the row is full rank, the optimal target domain connection weight can be solved as shown in the following formula (8):
[0144] (8)
[0145] in, and .
[0146] when When the column is full rank, the optimal target domain connection weight can be solved as shown in the following formula (9):
[0147] (9)
[0148] Reference Figure 6 In some embodiments, step S105 may include but is not limited to steps S601 to S604:
[0149] Step S601: Input the target domain test data into the ECG classification model to perform node calculation to obtain the third characteristic node and the third enhanced node of the target domain test data;
[0150] It can be understood that the target domain test data is unlabeled target domain data.
[0151] Step S602: performing node series connection on the third characteristic node and the third enhanced node to obtain a third extended matrix;
[0152] Step S603: Input the third extended matrix and the target domain connection weights into the ECG classification model to perform ECG prediction and output a predicted output vector;
[0153] Step S604: Determine the classification label corresponding to the target domain test data according to the predicted output vector.
[0154] In some embodiments, the target domain test data is input into a trained ECG classification model for node calculation to obtain a third feature node and a third enhanced node of the target domain test data. The third feature node and the third enhanced node are then connected in series to obtain a third extended matrix. The third extended matrix and the target domain connection weights are then input into the ECG classification model for ECG prediction. A predicted output vector is output, and the serial number corresponding to the maximum value in the predicted output vector is selected as the predicted classification label, thereby achieving accurate classification of the ECG signal and accurately detecting abnormal heart beats.
[0155] It should be noted that when constructing the third feature node and the third enhancement node of the target domain test data, the random weights, random biases, sparse autoencoder outputs and nonlinear activation functions used are consistent with those in the training phase, and will not be repeated in this embodiment.
[0156] It is worth noting that when the trained ECG classification model predicts the target domain test data Unlabeled samples When the category is , its output is as shown in the following formula (10):
[0157] (10)
[0158] in, yes The expansion matrix (the third expansion matrix), The final category label predicted for the sample is .
[0159] In some embodiments, the classification label includes one of the following: non-ectopic beat; supraventricular ectopic beat; ventricular ectopic beat; fusion beat; unknown beat, thereby achieving prediction of various types of electrocardiogram signals.
[0160] See also Figure 7 The present application also provides an ECG classification system that can implement the above-mentioned ECG classification method. The system includes:
[0161] The data acquisition module 801 is used to perform preprocessing operations on the acquired multiple electrocardiograms to obtain a source domain dataset and a target domain dataset;
[0162] The weight calculation module 802 is used to input the source domain dataset into a preset class weighted width learning model to perform weight calculation to obtain the source domain connection weight;
[0163] The knowledge transfer module 803 is used to input the target domain dataset and the source domain connection weights into a preset domain adaptation class weighted width learning model for knowledge transfer to obtain the target domain connection weights;
[0164] A model training module 804 is used to train a domain adaptation class weighted width learning model according to the source domain connection weight and the target domain connection weight to obtain an ECG classification model;
[0165] The classification prediction module 805 is used to input the target domain data set into the ECG classification model to perform ECG classification and obtain a classification label.
[0166] The ECG classification system of the embodiment of the present application is used to execute the ECG classification method in the above embodiment. Its specific processing process is the same as the ECG classification method in the above embodiment, and will not be repeated here.
[0167] An embodiment of the present application further provides an electronic device including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor is used to execute the electrocardiogram classification method in the above embodiment of the present application.
[0168] See also Figure 8 , Figure 8 The hardware structure of an electronic device according to another embodiment is shown. The electronic device includes:
[0169] The processor 901 may be implemented as a general-purpose CPU (Central Processing Unit), 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.
[0170] The memory 902 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 902 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 902 and is called by the processor 901 to execute the ECG classification method of the embodiments of this application.
[0171] Input / output interface 903, used to implement information input and output;
[0172] Communication interface 904, 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.);
[0173] Bus 905 , which transmits information between various components of the device (e.g., processor 901 , memory 902 , input / output interface 903 , and communication interface 904 );
[0174] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0175] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned electrocardiogram classification method is implemented.
[0176] 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 may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0177] The embodiments described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0178] It will be understood by those skilled in the art that Figure 1-6 The technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than those shown in the figures, or a combination of certain steps, or different steps.
[0179] The system embodiment described above is merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0180] Those skilled in the art will appreciate that all or some of the steps in the methods, systems, and functional modules / units in the devices disclosed above may be implemented as software, firmware, hardware, or appropriate combinations thereof.
[0181] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0182] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0183] In the several embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For example, the division of the above units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.
[0184] The units described above as separate components may or may not be physically separate, and the components shown as units 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 these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0185] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0186] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes multiple instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: various media that can store programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0187] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and essence of the present invention should be within the scope of the present invention.
Claims
1. An electrocardiogram classification method, characterized in that: The method comprises: Perform preprocessing operations on the acquired multiple electrocardiograms to obtain source domain datasets and target domain datasets; Input the source domain dataset into the preset class weighted width learning model for weight calculation to obtain the source domain connection weight; Inputting the target domain dataset and the source domain connection weights into a preset domain adaptation class weighted width learning model for knowledge transfer to obtain the target domain connection weights; Training the domain adaptation class weighted width learning model according to the source domain connection weight and the target domain connection weight to obtain an electrocardiogram classification model; The target domain data set is input into the ECG classification model to perform ECG classification and obtain a classification label.
2. The electrocardiogram classification method according to claim 1, characterized in that: The electrocardiogram includes a first electrocardiogram set and a second electrocardiogram set, wherein the first electrocardiogram set is a first electrocardiogram of a historical object, and the second electrocardiogram set is a second electrocardiogram of a specific object; the preprocessing operation on the acquired multiple electrocardiograms to obtain a source domain dataset and a target domain dataset includes: Performing peak detection on the first electrocardiogram and the second electrocardiogram based on a preset positioning algorithm to determine a first R wave peak in the first electrocardiogram and a second R wave peak in the second electrocardiogram; Performing signal segmentation on the first R wave peak and the second R wave peak according to a preset signal length to obtain a plurality of first heart beat segments corresponding to the first R wave peak and a plurality of second heart beat segments corresponding to the second R wave peak; performing a normalization operation on the first heart beat segment and the second heart beat segment; The source domain dataset is generated according to the normalized first heart beat segment, and the target domain dataset is generated according to the normalized second heart beat segment.
3. The electrocardiogram classification method according to claim 2, characterized in that: Before inputting the source domain dataset into the preset class weighted width learning model to perform weight calculation to obtain the source domain connection weight, the method further includes: In the target domain data set, the second heart beat segments are selected according to a preset time interval to obtain target domain training data, and the remaining second heart beat segments are used as target domain test data.
4. The electrocardiogram classification method according to claim 1, characterized in that: The source domain data set is input into a preset class weighted width learning model to perform weight calculation to obtain the source domain connection weight, including: Obtain source domain sample categories in the source domain dataset; Performing a labeling operation on the source domain sample category to obtain a source domain label matrix corresponding to the source domain sample category; Inputting the source domain dataset into the class weighted width learning model to perform feature calculation to obtain a first feature node; Calculating the first feature node based on a preset nonlinear activation function to obtain a first enhanced node; Calculating a first training weight for the source domain sample category, and combining the first training weight, the first feature node, and the first enhancement node to generate a first weighted expansion matrix; The class weighted width learning model is trained according to the first weighted expansion matrix and the source domain label matrix to generate source domain connection weights.
5. The electrocardiogram classification method according to claim 3, characterized in that: The step of inputting the target domain dataset and the source domain connection weights into a preset domain adaptation class weighted width learning model for knowledge transfer to obtain the target domain connection weights includes: Obtaining target sample categories in the target domain training data; Performing a labeling operation on the target sample category to obtain a target label matrix corresponding to the target sample category; Inputting the target domain training data into the domain adaptation class weighted width learning model to perform random feature calculation to obtain a second feature node; Calculating the second feature node based on a preset nonlinear activation function to obtain a second enhanced node; Calculating a second training weight for the target sample category, and combining the second training weight, the second feature node, and the second enhancement node to generate a second weighted expansion matrix; The domain adaptation class weighted width learning model is trained according to the second weighted expansion matrix, the source domain connection weight, and the target label matrix to obtain the target domain connection weight.
6. The electrocardiogram classification method according to claim 3, characterized in that: Inputting the target domain dataset into the ECG classification model to perform ECG classification to obtain classification labels includes: Inputting the target domain test data into the ECG classification model to perform node calculation to obtain a third characteristic node and a third enhanced node of the target domain test data; Perform node series connection on the third characteristic node and the third enhanced node to obtain a third extended matrix; Inputting the third extended matrix and the target domain connection weights into the ECG classification model to perform ECG prediction, and outputting a predicted output vector; The classification label corresponding to the target domain test data is determined according to the predicted output vector.
7. The electrocardiogram classification method according to claim 1, characterized in that: The classification label includes one of the following: non-ectopic heart beats; Supraventricular ectopic heartbeats; ventricular ectopic heart beats; Fusion heartbeat; Unknown heartbeat.
8. An electrocardiogram classification system, characterized in that: The system comprises: The data acquisition module is used to perform preprocessing operations on the acquired multiple electrocardiograms to obtain source domain datasets and target domain datasets; The weight calculation module is used to input the source domain dataset into the preset class weighted width learning model for weight calculation to obtain the source domain connection weight; A knowledge transfer module is used to input the target domain dataset and the source domain connection weights into a preset domain adaptation class weighted width learning model for knowledge transfer to obtain the target domain connection weights; a model training module, configured to train the domain adaptation class weighted width learning model according to the source domain connection weight and the target domain connection weight to obtain an electrocardiogram classification model; The classification prediction module is used to input the target domain data set into the ECG classification model to perform ECG classification and obtain a classification label.
9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the electrocardiogram classification method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the electrocardiogram classification method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Abnormal-heart-rhythm classifying method based on deep transfer learning
CN109645980A
Electrocardiosignal classification method based on adversarial domain adaptive learning
CN111460953A