ECG classification method, ECG classification model training method based on domain adaptation
By applying a domain adaptive ECG classification model based on convolutional neural networks in a clinical environment, the problem of doctors' difficulty in quickly identifying abnormal heartbeat in electrocardiogram records is solved, and more efficient ECG data classification and arrhythmia diagnosis are achieved.
Patent Information
- Application Number
- CN202111339975.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-12
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2041-11-12
AI Technical Summary
In clinical settings, it is difficult for doctors to quickly identify abnormal heartbeats in long-term electrocardiogram recordings, resulting in inefficient diagnosis of arrhythmia.
The domain adaptive ECG classification model based on convolutional neural network is adopted to preprocess ECG data, extract features and perform full connection processing to achieve accurate classification of ECG data.
It improves the accuracy of ECG classification, can effectively process ECG data in the inter-patient paradigm, reduces domain shift problems, and improves the accuracy of diagnosis of arrhythmia.
Smart Images

Figure CN114091530B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an electrocardiogram classification method, an electrocardiogram classification model training method based on domain adaptation, an electrocardiogram classification device, an electrocardiogram classification model training device based on domain adaptation, an electronic device, and a computer-readable medium. Background Art
[0002] The electrocardiogram reflects the state of the heart by recording the potential waveform of the electrical activity generated by the human heart, providing a lot of valuable information for clinical treatment. In a clinical setting, doctors can diagnose arrhythmias by observing the electrocardiogram, which is a non-invasive diagnostic method and a very effective tool for detecting arrhythmias. Generally speaking, arrhythmias can be diagnosed by identifying abnormal heartbeats in electrocardiogram records and classifying them. In the patient's electrocardiogram record, there are only a very small number of abnormal heartbeats, which makes it difficult for doctors to quickly identify abnormal heartbeats in long-term electrocardiogram records by manual recognition.
[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0004] Embodiments of the present invention provide an ECG classification method, an ECG classification model training method based on domain adaptation, an ECG classification device, an ECG classification model training device based on domain adaptation, an electronic device, and a computer-readable medium, thereby improving the accuracy of ECG classification at least to a certain extent.
[0005] Other features and advantages of the present invention will become apparent from the following detailed description, or may be learned in part by practice of the present invention.
[0006] According to one aspect of an embodiment of the present invention, there is provided an electrocardiogram classification method, comprising:
[0007] Acquire the ECG data to be processed, and pre-process the ECG data to be processed to obtain heart beat data;
[0008] Inputting the heartbeat data into a trained ECG classification model, and performing convolution processing on the heartbeat data using a feature extractor to obtain feature data; wherein the feature extractor includes a plurality of convolution layers arranged in succession; and
[0009] The feature data is fully connected using a classifier to obtain a classification result corresponding to the electrocardiogram data to be processed; wherein the classifier includes a fully connected layer.
[0010] In some embodiments of the present invention, based on the above solution, the method further includes: training the ECG classification model, including:
[0011] Divide the heartbeat sample data into training sets and test sets, and build an initial model based on a convolutional neural network;
[0012] Perform the first phase of pre-training on the initial model using the training set to obtain a pre-trained model;
[0013] The pre-trained model is trained in the second stage of domain adaptation using the training set and the test set to obtain the ECG classification model.
[0014] In some embodiments of the present invention, based on the above scheme, the first stage pre-training of the initial model using the training set to obtain the pre-trained model includes:
[0015] Inputting the training set into the model, and performing convolution processing on the training set using a feature extractor to obtain feature data;
[0016] Using a classifier to perform full connection processing on the feature data to obtain a classification result corresponding to the training set;
[0017] The classification loss is calculated based on the classification results, and the gradient descent method is used to minimize the classification loss and update the network parameters of the model.
[0018] In some embodiments of the present invention, based on the above scheme, the calculating classification loss includes:
[0019]
[0020] Where L(·,·) represents the cross entropy loss function, Indicates that the model will train the sample The prediction is the probability distribution of all classes, Represents the true label value of the output sample.
[0021] In some embodiments of the present invention, based on the above scheme, the second-stage domain adaptive training of the pre-trained model using the training set and the test set to obtain the ECG classification model includes:
[0022] Input the test set and the training set into the pre-trained model, and obtain the corresponding feature vectors through the feature extractor;
[0023] Map the feature vectors of the test set and the feature vectors of the training set into the reproducing kernel Hilbert space, and calculate the maximum mean difference of the feature distribution between the test set and the training set;
[0024] Use the classifier to perform full connection processing on the test set feature data and the training set feature data to obtain the corresponding classification results;
[0025] The classification loss is calculated based on the classification results of the training set, and the entropy loss is calculated based on the classification structure of the test set;
[0026] The total loss function is constructed by combining the maximum mean difference, classification loss and entropy loss, and the gradient descent method is used to minimize the total loss to update the network parameters of the model.
[0027] In some embodiments of the present invention, based on the above scheme, the total loss function is constructed by combining the maximum mean difference, classification loss and entropy loss, including:
[0028] loss = L cls +λ*M k (D s ,D t )+β*H(D t )
[0029] Among them, L cls represents the classification loss, H(D t ) represents entropy loss, and hyperparameters λ and β represent the trade-off parameters between entropy loss and maximum mean difference. k (D s ,D t ) indicates the maximum mean difference.
[0030] According to one aspect of an embodiment of the present invention, a method for training an electrocardiogram classification model based on domain adaptation is provided, comprising:
[0031] Acquire sample ECG data, preprocess the sample ECG data, and divide the preprocessed data into a training set and a test set;
[0032] Constructing a model based on a convolutional neural network; wherein the model includes: a feature extractor for extracting feature data, and a classifier for classifying according to the feature data; the feature extractor includes a plurality of convolutional layers arranged in succession, and the classifier includes a fully connected layer;
[0033] Perform the first phase of pre-training on the initial model using the training set to obtain a pre-trained model;
[0034] The pre-trained model is trained on the second stage of domain adaptation using the training set and the test set to obtain an ECG classification model.
[0035] According to one aspect of an embodiment of the present invention, there is provided an electrocardiogram classification device, comprising:
[0036] A preprocessing module, used for acquiring the ECG data to be processed, and preprocessing the ECG data to be processed to obtain heartbeat data;
[0037] A feature extraction module, used for inputting the heartbeat data into a trained ECG classification model, and performing convolution processing on the heartbeat data using a feature extractor to obtain feature data; wherein the feature extractor includes a plurality of convolution layers arranged in succession; and
[0038] A classification module is used to perform full-connection processing on the feature data using a classifier to obtain a classification result corresponding to the electrocardiogram data to be processed; wherein the classifier includes a fully connected layer.
[0039] According to one aspect of an embodiment of the present invention, a domain adaptive electrocardiogram classification model training device is provided, comprising:
[0040] A sample data processing module, used for acquiring sample ECG data, preprocessing the sample ECG data, and dividing the preprocessed data into a training set and a test set;
[0041] A model building module, used to build a model based on a convolutional neural network; wherein the model includes: a feature extractor for extracting feature data, and a classifier for classifying according to the feature data; the feature extractor includes a plurality of convolutional layers arranged in succession, and the classifier includes a fully connected layer;
[0042] The first stage training module is used to perform the first stage pre-training on the initial model using the training set to obtain a pre-trained model;
[0043] The second stage training module is used to perform second stage domain adaptive training on the pre-trained model using the training set and the test set to obtain an ECG classification model.
[0044] According to one aspect of the embodiments of the present invention, a computer readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the electrocardiogram classification method as described in any one of the embodiments is implemented.
[0045] According to one aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the domain-adaptive-based electrocardiogram classification model training method as described in any one of the embodiments is implemented.
[0046] According to one aspect of an embodiment of the present invention, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the ECG classification method as described in the above embodiments.
[0047] According to one aspect of an embodiment of the present invention, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the domain adaptive electrocardiogram classification model training method as described in the above-mentioned embodiments.
[0048] In the technical solutions provided by some embodiments of the present invention, by constructing a domain adaptive classification model based on a convolutional neural network, heartbeat data can be efficiently processed. By using multiple convolutional layers set continuously for feature extraction, the feature vector of the heartbeat data can be accurately obtained, and then the classifier is used to perform full connection processing on the feature vector, and the probability that the heartbeat data belongs to the preset heartbeat type is preset, which can effectively improve the accuracy of ECG data classification and achieve accurate judgment of the heartbeat type.
[0049] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The drawings herein are incorporated into and constitute a part of the specification, showing embodiments consistent with the present invention, and together with the specification, are used to explain the principles of the present invention. Obviously, the drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0051] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solution of an embodiment of the present invention can be applied;
[0052] Figure 2 A schematic diagram of a process flow of an electrocardiogram classification method according to an embodiment of the present invention is shown;
[0053] Figure 3 A schematic diagram schematically shows an electrocardiogram classification model architecture according to an embodiment of the present invention;
[0054] Figure 4 A schematic diagram of a process flow of a first pre-training stage according to an embodiment of the present invention is shown;
[0055] Figure 5 A schematic diagram of a process flow of a second adaptive training stage according to an embodiment of the present invention is shown;
[0056] Figure 6A schematic diagram schematically shows a comparison of accurate curves using domain adaptation and not using domain adaptation (DA) according to an embodiment of the present invention;
[0057] Figure 7 A schematic diagram schematically shows how a loss curve changes with increasing iteration times according to an embodiment of the present invention;
[0058] Figure 8 A schematic diagram schematically shows how the accuracy changes with the increase of data volume according to an embodiment of the present invention;
[0059] FIG9( a) schematically shows a confusion matrix before domain adaptation according to an embodiment of the present invention;
[0060] FIG9( b ) schematically shows a confusion matrix after domain adaptation according to an embodiment of the present invention;
[0061] Fig.10 A schematic diagram of a process flow of an electrocardiogram classification model training method according to an embodiment of the present invention is shown;
[0062] Fig.11 A block diagram of an electrocardiogram classification device according to an embodiment of the present invention is schematically shown;
[0063] Fig.12 A block diagram of a domain adaptive electrocardiogram classification model training device according to an embodiment of the present invention is schematically shown;
[0064] Fig.13 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0065] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the present invention will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.
[0066] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, those skilled in the art will appreciate that the technical solution of the present invention can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring various aspects of the present invention.
[0067] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0068] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0069] In the related art, as the most common group of cardiovascular diseases, arrhythmia can occur alone or with other cardiovascular diseases. It can occur suddenly and cause sudden death, or it can continue to affect the heart and cause its failure. Therefore, it is necessary to diagnose arrhythmia in a timely manner. In a clinical setting, doctors can diagnose arrhythmia by observing the electrocardiogram, which is a non-invasive diagnostic method and a very effective tool for detecting arrhythmia. The electrocardiogram reflects the state of the heart by recording the potential waveform of the electrical activity generated by the human heart, providing a lot of valuable information for clinical treatment. It is crucial for the diagnosis of arrhythmia. Generally speaking, arrhythmia is diagnosed by identifying abnormal heartbeats in electrocardiogram records and classifying them. In the patient's electrocardiogram record, only a very small number of abnormal heartbeats are contained, which makes it difficult for doctors to quickly identify abnormal heartbeats in long-term electrocardiogram records. In order to solve the problem of low efficiency of manual analysis of electrocardiogram records, how to combine artificial intelligence to realize automatic analysis and accurate diagnosis of electrocardiogram records is becoming a hot topic of research. Traditional machine learning methods first need to manually extract features from ECG records, including morphological features such as RR intervals and QRS intervals, time-frequency features extracted using wavelet transforms, and high-order statistical features (HOS). Then, machine learning algorithms such as support vector machines, random forests, and artificial neural networks are used to classify ECG records. However, the implementation process of manual feature extraction is relatively complicated, and the classification performance of traditional machine learning methods needs to be improved. In some technical solutions, a 17-layer convolutional neural network (CNN) is used to extract deep features in ECG signals, and these features are combined with expert features and sent to an integrated classifier to classify nine different ECG signals. Alternatively, in some technical solutions, the ECG signal is first converted into a spectrogram using a short-time Fourier transform, and the spectrogram is then used as the input of a 2D-CNN to classify arrhythmias. Alternatively, in some technical solutions, a stacked denoising autoencoder (SDAE) is used to automatically learn the semantic encoding of the heartbeat, and then the semantic encoding is sent to a bidirectional LST (Bi-LSTM) network for heartbeat classification. Although the above schemes can achieve a certain classification accuracy, their technical solutions only focus on the classification of ECG signals in the intra-patient paradigm, that is, the training set and the test set data come from the same patients, so the training set and the test set belong to the same distribution. When the model trained on the training set classifies the test set data, a very high classification accuracy can be obtained. However, this does not conform to the actual situation, because in actual applications, the ECG classification model cannot obtain the test patient data in advance for training, so the training data and the data to be tested must come from different patients, which is called the inter-patient paradigm.However, the ECG signal morphology between different individuals is different, which causes domain shift between the training set and the test set. Therefore, in the inter-patient mode, the network's ECG signal classification effect is not as good as that in the intra-patient mode. The above problem also exists in image classification.
[0070] In view of the problems existing in the related art, in order to solve the domain shift problem in the inter-patient paradigm, the embodiment of the present invention first proposes an ECG classification method. The implementation details of the technical solution of the embodiment of the present invention are elaborated in detail below.
[0071] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solution of an embodiment of the present invention can be applied.
[0072] like Figure 1 As shown, the system architecture 100 may include a terminal device (such as Figure 1 As shown in the figure, one or more of a smart phone 101, a tablet computer 102, and a portable computer 103, and of course, it can also be a smart terminal device such as a desktop computer), a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the terminal device and the server 105. The network 104 can include various connection types, such as a wired communication link, a wireless communication link, and the like.
[0073] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.
[0074] In one embodiment of the present invention, the user can send a data processing request for classifying the patient's ECG data to the server 105 through the terminal device 103. The data processing request can include the patient's ECG data to be processed, or the address of the ECG data. After receiving the data processing request, the server 105 can extract the ECG data, perform classification operations on it, obtain the classification results and return them to the terminal.
[0075] It should be noted that the data classification method provided in the embodiment of the present invention is generally executed by the server 105, and accordingly, the data classification device is generally set in the server 105. However, in other embodiments of the present invention, the terminal device 101 may also have similar functions as the server 105, and cooperate to execute the ECG classification method provided in the embodiment of the present invention.
[0076] Figure 2The flowchart of the ECG classification method according to one embodiment of the present invention is schematically shown. The method can be executed collaboratively by a terminal device and a server; or, it can also be executed locally by a terminal device having similar functions or computing capabilities as the server.
[0077] In step S11, the ECG data to be processed is obtained, and the ECG data to be processed is preprocessed to obtain heartbeat data.
[0078] In one embodiment of the present invention, the above-mentioned ECG data to be processed may be ECG data collected from the current patient in real time. After obtaining the ECG data to be processed, the ECG data may be preprocessed first. Specifically, the above-mentioned preprocessing may include:
[0079] Step S21, performing denoising processing on the ECG data to be processed to obtain a denoised ECG signal;
[0080] Step S22, dividing the denoised ECG signal into heart beats according to a preset sampling number based on the peak position of the R wave to obtain an original heart beat signal;
[0081] Step S23, normalizing the original heartbeat signal corresponding to each sampling point and mapping it to a preset value interval to obtain the heartbeat data.
[0082] For example, various noises are easily introduced into ECG signals during the acquisition process, such as power frequency interference, baseline drift, myoelectric interference, and electrode contact noise. These noises will affect the classification accuracy of ECG signals. In order to eliminate these noises, we use discrete wavelet transform to denoise ECG signals. First, use discrete wavelet transform to perform 8-scale wavelet decomposition on the noisy ECG signal to obtain the wavelet coefficients at each scale. The wavelet coefficient calculation formula is as follows:
[0083]
[0084] Where, f(t) is the ECG signal with noise, % j,k is a discrete wavelet function, j,k∈Z.
[0085] Then the soft threshold function is used to calculate the threshold to filter the noise component of the wavelet coefficients at each scale, and finally the discrete wavelet inverse transform is used to reconstruct the signal; the formula is as follows:
[0086]
[0087] Where C is a constant that has nothing to do with the signal.
[0088] After data denoising, we can get the denoised ECG signal. For the denoised ECG signal, the heartbeat segmentation is performed according to the peak position of the R wave in the annotation. The specific segmentation method is: take the R wave peak as the reference point, take 99 sampling points forward, take 200 sampling points backward, a total of 300 sampling points, the corresponding duration is about 0.83 seconds, and the heartbeat cycle of an ordinary person lasts for 0.6 to 0.8 seconds, so the divided heartbeats can contain a complete heartbeat cycle.
[0089] After completing the heartbeat division, each sampling point can be normalized to map the heartbeat intensity value to the range of -1 to 1, which helps the neural network to better extract features. The normalization formula may include:
[0090]
[0091] Among them, x is the heartbeat data, X min and X max are the minimum and maximum values of the heartbeat data sampling points respectively.
[0092] In step S12, the heartbeat data is input into a trained ECG classification model, and a feature extractor is used to perform convolution processing on the heartbeat data to obtain feature data; wherein the feature extractor includes a plurality of convolution layers arranged in succession.
[0093] In one embodiment of the present invention, reference Figure 3 In the model structure shown, the extractor F includes 4 convolutional layers (conv1-conv4) and a fully connected layer (fc5), which can be used to extract the feature vector of the data. Among them, the conv1 layer consists of 4 convolutional kernels with a kernel size of 1×21, and its activation function adopts ReLU, followed by a maximum pooling layer with a pool size of 1×3; the conv2 layer consists of 16 convolutional kernels with a kernel size of 1×23, and the activation function also adopts ReLU, followed by a maximum pooling layer with a pool size of 1×3; the conv3 layer consists of 32 convolutional kernels with a kernel size of 1×25, and the activation function is also ReLU, but the pooling layer adopts an average pooling layer with a pool size of 1×3; the conv4 layer consists of 64 convolutional kernels with a kernel size of 1×27, and also adopts ReLU activation function; a Flatten layer can be set after the conv4 layer to flatten the feature data output by the conv4 layer and convert it into one-dimensional data; a fully connected layer with 128 neurons is set after the Flatten layer.
[0094] In step S13, a classifier is used to perform full connection processing on the feature data to obtain a classification result corresponding to the ECG data to be processed; wherein the classifier includes a fully connected layer.
[0095] In one embodiment of the present invention, reference Figure 3 As shown, the classifier can be composed of a fully connected layer (fc6). Specifically, it can be a fully connected layer with 4 neurons, using a softmax activation function to predict the probability that the heartbeat data belongs to the four heartbeat types.
[0096] In one embodiment of the present invention, the above method may further include: training the ECG classification model. Specifically, the model training process may include:
[0097] Step S31, dividing the heartbeat sample data into a training set and a test set, and constructing an initial model based on a convolutional neural network;
[0098] Step S32, performing a first-stage pre-training on the initial model using the training set to obtain a pre-trained model;
[0099] Step S33, performing second-stage domain adaptive training on the pre-trained model using the training set and the test set to obtain the ECG classification model.
[0100] In one embodiment of the present invention, for the above-mentioned heartbeat sample data, the MIT-BIH arrhythmia database can be used as the source of our ECG data, as the original ECG data. The MIT-BIH database contains 48 ECG records of 47 patients collected from 1975 to 1979, each record is about 30 minutes long, and the sampling frequency is 360HZ. Each record contains data from two leads, the first lead is lead II, and the second lead is mostly lead V1. Usually, the QRS complex is most obvious in lead II, so we use lead II data. Each heartbeat in the MIT-BIH arrhythmia database is independently marked by two cardiologists, and finally the heartbeat marks with disagreements are jointly negotiated to determine the mark type, which is very authoritative. Usually the R wave peak position is given in the annotation information.
[0101] For the original ECG data, the method of steps S21 to S23 described above can be used for preprocessing to obtain heartbeat sample data. For the heartbeat sample data, the training set and the test set can be divided into a certain ratio. Specifically, the training set is called the source domain, and the test set is called the target domain. Source domain There are s labeled samples, the target domain Contains t unlabeled samples, assuming that the source domain and the target domain are sampled from probability distributions p and q respectively, p≠q. Due to the difference between the probability distributions of the source domain and the target domain, it is difficult for the model trained in the source domain to have an outstanding performance in the target domain.
[0102] Traditional machine learning algorithms usually assume that training samples and test samples come from the same probability distribution. Based on this assumption, researchers designed corresponding models and discrimination criteria to classify test set samples. However, this assumption is unreasonable in arrhythmia classification. This is because the distribution of training samples and test samples in arrhythmia classification is slightly different, which will affect the classification performance of the network in the test set. How to overcome this problem and transfer knowledge from the source domain to the target domain is what the technical solution of this application focuses on.
[0103] In one embodiment of the present invention, a domain adaptation network based on CNN is designed according to the principle of domain adaptation. Specifically, CNN is a type of feedforward neural network that includes convolution calculations and has a deep structure. It provides an end-to-end learning model that can learn more abstract features from data and classify the data. CNN is not only widely used in two-dimensional image data, but also has good performance in processing one-dimensional signals. Since the ECG signal to be classified is one-dimensional data, this application adopts a one-dimensional convolutional neural network (1D-CNN).
[0104] Its network structure is as follows Figure 3 As shown in the figure, the network consists of 4 convolutional layers (conv1-conv4) and 2 fully connected layers (fc5-fc6). Conv1-fc5 constitute the feature extractor F, which is used to extract the feature vector of the data, while fc6 constitutes the classifier C, which classifies the data into the class it should belong to. The detailed structure of the network can include: the input of the CNN model is heartbeat data of size 1×300, conv1 consists of 4 convolution kernels with a kernel size of 1×21, and its activation function adopts ReLU, followed by a maximum pooling layer with a pool size of 1×3; conv2 consists of 16 convolution kernels with a kernel size of 1×23, and the activation function also adopts ReLU, followed by a maximum pooling layer with a pool size of 1×3; conv3 consists of 32 convolution kernels with a kernel size of 1×25, and the activation function is also ReLU, but the pooling layer adopts an average pooling layer with a pool size of 1×3; conv4 consists of 64 convolution kernels with a kernel size of 1×27, and also adopts ReLU activation function; followed by a Flatten layer and a fully connected layer with 128 neurons, the above constitutes a feature extractor F, and the classifier C is a fully connected layer with 4 neurons, using a softmax activation function.
[0105] In one embodiment of the present invention, the above step S32 may specifically include:
[0106] Step S321, inputting the training set into the model, and performing convolution processing on the training set using a feature extractor to obtain feature data;
[0107] Step S322, using a classifier to perform full connection processing on the feature data to obtain a classification result corresponding to the training set;
[0108] Step S323, calculate the classification loss according to the classification result, and use the gradient descent method to minimize the classification loss and update the network parameters of the model.
[0109] Specifically, in the pre-training stage, we select 80% of the heartbeat samples in the source domain as the training set to train the network, and the remaining 20% of the heartbeat samples as the test set to test the classification performance of the network. Figure 4 As shown in the figure, during the training process, we feed the heartbeats of the training set into the neural network for training. The feature extractor F extracts abstract and efficient features from the samples, and then the classifier C classifies the samples according to the extracted features. The classification loss L is then calculated based on the classification results. cls Finally, mini-batch gradient descent (MBGD) is used to minimize the classification loss and update the network parameters. When the training is finished, the pre-trained network can accurately classify the heartbeats of the source domain test set, but does not have a good classification performance for the target domain heartbeats.
[0110] Among them, for the classification loss L cls , in order to ensure the classification accuracy of the source domain. We can minimize the classification loss L of the labeled data in the source domain cls To achieve this, L cls The calculation formula is as follows:
[0111]
[0112] Where L(·,·) represents the cross entropy loss function, Indicates that the model will train the sample The prediction is the probability distribution of all classes, Represents the true label value of the output sample.
[0113] In one embodiment of the present invention, since the target domain data is not labeled, it is not possible to directly adapt the CNN model trained on the source domain data to the target domain through fine-tuning. Although the probability distributions of the source and target domains are slightly different, their classification tasks are the same. To classify the target domain data, the only way is to use a classifier trained on the source domain data and then use domain adaptation methods to transfer knowledge from the labeled source domain data to the unlabeled target data.
[0114] The above step S33 may specifically include:
[0115] Step S331, input the test set and the training set into the pre-trained model, and obtain the corresponding feature vector through the feature extractor;
[0116] Step S332, mapping the feature vector of the test set and the feature vector of the training set into the reproducing kernel Hilbert space, and calculating the maximum mean difference of the feature distribution between the test set and the training set;
[0117] Step S333, using a classifier to perform full connection processing on the test set feature data and the training set feature data to obtain corresponding classification results;
[0118] Step S334, calculating the classification loss based on the classification result of the training set, and calculating the entropy loss based on the classification structure of the test set;
[0119] Step S335, construct a total loss function by combining the maximum mean difference, classification loss and entropy loss, and use the gradient descent method to minimize the total loss to update the network parameters of the model.
[0120] After pre-training, the network can basically classify the target domain data, but the network still needs to be adjusted to achieve higher classification accuracy in the target domain. Therefore, in the domain adaptation stage, we fine-tune the pre-trained network by minimizing the total loss. The total loss is calculated as follows
[0121] loss = L cls +λ*M k (D s ,D t )+β*H(D t )
[0122] Among them, L cls represents the classification loss, H(D t ) represents entropy loss, and hyperparameters λ and β represent the trade-off parameters between entropy loss and maximum mean difference. k (D s ,D t ) indicates the maximum mean difference.
[0123] Like the source domain, the target domain data is also divided into a training set and a test set with a ratio of 8:2. The former is used to adjust the network, and the latter is used to test the classification performance of the final network.
[0124] refer to Figure 5 As shown, the training heartbeats of the source domain and the target domain can be first fed into the pre-trained network, and their feature vectors can be extracted by the feature extractor F. Then the feature vectors are mapped to RKHS. According to formula (8), the MK-MMD between the feature distributions of the source domain and the target domain data can be calculated, and the classification loss L can be calculated according to the classification results of the network on the source domain data and the target domain data. cls and entropy penalty H(D t). Subsequently, the MBGD method is used to minimize the total loss to update network parameters, such as weights and biases. After the iterative process is completed, the network learns a transferable feature representation that can map the source domain data and the target domain data to the same probability distribution as much as possible.
[0125] In one embodiment of the present invention, the entropy loss and the maximum mean difference in the above total loss function are explained through the following embodiments.
[0126] Specifically, if only the classification loss of the source domain data is minimized during the network optimization process, this will usually lead to overfitting of the source domain data, resulting in poor performance when classifying the target domain data. In order to improve the classification accuracy of the network in the target domain, we hope to minimize the difference between the feature distributions of the source and target domain data and learn a transferable feature representation. In order to train this representation, we considered the Maximum Mean Discrepancy (MMD) as a measure of the difference between the source and target domains. MMD is the most widely used loss function in transfer learning, especially domain adaptation. It is mainly used to measure the distance between two different but related distributions. In the process of calculating domain differences, we use nonlinear feature mapping The source and target domain data are mapped into the reproducing kernel Hilbert space. This space is generated by the feature kernel k. The MMD distance between the source and target domain feature distributions is then calculated in this space.
[0127] The choice of kernel k is crucial to calculating MMD, but choosing a suitable kernel is difficult because we do not know which kernel is optimal for the task. In order to reduce the impact of improper kernel function selection, we use MK-MMD to measure the difference between the source domain and the target domain. Define the feature kernel k as m kernels {k u}. Multiply each kernel by a coefficient and determine the value of the coefficient through network learning to obtain the optimal kernel. The calculation formula for multi-core k is as follows:
[0128]
[0129] Among them, β u is the kernel k u The coefficient of .
[0130] The empirical approximation of MK-MMD between the source and target domain probability distributions is calculated as follows:
[0131]
[0132] Further expanding the formula, we can get the following formula:
[0133]
[0134] Based on kernel techniques This avoids the explicit operation of the infinite-dimensional feature map in the above formula. Applying the kernel technique to the above formula yields:
[0135]
[0136] Based on this, the kernel function can be used to calculate the MK-MMD between the source domain distribution and the target domain distribution.
[0137] In addition, although the distribution difference between the source domain and the target domain is minimized, it still exists. Therefore, the CNN classifier still cannot accurately classify the unlabeled target domain data. In order to further improve the classification accuracy of the network in the target domain, the decision boundary of the classifier C should be able to pass through the low-density area of the unlabeled target data. In order to achieve low-density separation between all classes, we adopt the principle of entropy minimization. Minimizing the entropy penalty is equivalent to minimizing the uncertainty of predicting the target data label, and the classifier F will adjust itself to pass through the low-density area of the target domain. The entropy penalty calculation formula is as follows:
[0138]
[0139] in, is the probability distribution of all categories predicted by the network for the target domain samples, and H(·) is the entropy loss. In addition,
[0140]
[0141] Where c is the number of categories, is the network prediction sample is the probability of class J.
[0142] In other exemplary embodiments of the present disclosure, reference is made to Fig.10 As shown, a flowchart of a method for training an ECG classification model based on domain adaptation according to an embodiment of the present invention is schematically shown. Specifically, it may include:
[0143] Step S41, acquiring sample ECG data, preprocessing the sample ECG data, and dividing the preprocessed data into a training set and a test set;
[0144] Step S42, constructing a model based on a convolutional neural network; wherein the model includes: a feature extractor for extracting feature data, and a classifier for classifying according to the feature data; the feature extractor includes a plurality of convolutional layers arranged in succession, and the classifier includes a fully connected layer;
[0145] Step S43, performing a first-stage pre-training on the initial model using the training set to obtain a pre-trained model;
[0146] Step S44, performing second-stage domain adaptive training on the pre-trained model using the training set and the test set to obtain an ECG classification model.
[0147] Specifically, the MIT-BIH arrhythmia database is used as the ECG sample data. The preprocessing process is as described in the above embodiment, and may include denoising, heartbeat segmentation, and normalization. The network structure of the model is referenced Figure 3 As shown, conv1-fc5 constitute a feature extractor F, which is used to extract the feature vector of the data, and fc6 constitutes a classifier C, which classifies the data into the class to which it belongs. Among them, the loss functions of the pre-training stage and the adaptive training stage are as described in the above embodiment. They will not be repeated in this embodiment.
[0148] For the ECG classification model based on one-dimensional convolutional neural network in this model training method, for convolutional neural network, as the number of network layers continues to increase, the features extracted by each layer will eventually transform from general features to specific features. The greater the domain difference, the greater the distance between the distributions of specific features of the source domain and target domain data extracted by the higher layers, so the transferability of the feature representation is worse. According to the quantitative study of feature transferability, conv1-conv2 learns the general features of the data, while in conv3-conv4, the learned features are slightly specific, and these features can be transferred. Therefore, in the domain adaptation stage, only conv1-conv4 needs to be fine-tuned. To a certain extent, the features extracted by the fully connected layer fc5 have been specific and cannot be safely transferred, so we learn transferable feature representations by minimizing the multi-kernel maximum mean difference (MK-MMD) between the feature distributions. We extract feature vectors from the source and target domain data through the feature extractor F, and then calculate the MK-MMD between the probability distributions of the source and target domain feature vectors. FC6 is a classifier, which analyzes and processes the feature vector extracted by the previous feature extractor F, and finally obtains the classification result of the heartbeat data. The cross entropy loss and entropy loss are calculated according to the classification result.
[0149] In one embodiment of the present invention, in order to better evaluate the performance of the present method, we use five evaluation indicators commonly used in ECG classification related work, namely sensitivity (Sen), positive prediction rate (Ppr), F1 score (F1), F1-macro score (F1-macro) and overall accuracy (Acc). Among them, Sen, Ppr and F1 evaluate the classification performance of a single category, and Acc and F1-macro evaluate the overall performance. The calculation formula of the evaluation index is:
[0150] Sensitivity: Sen=TP / (TP+FN)
[0151] Positive predictive rate: Ppr = TP / (TP+FP)
[0152] Overall classification accuracy: Acc = (TP+TN) / (TP+FP+TN+FN)
[0153] F1 score: F1 = 2(Sen*Ppr) / (Sen+Ppr)
[0154] Among them, TP, FP, TN and FN represent the number of true positive, false positive, true negative and false negative samples, and F1-macro is the unweighted average of the F1 scores of each category to be compared.
[0155] For data partitioning, in order to meet the data partitioning requirements of the inter-patient paradigm, the known method of "automatically classifying heartbeats using electrocardiogram morphology and heartbeat interval features" is used to partition the MIT-BIH database. According to the recommendations of the American Association for the Advancement of Medical Devices (AAMI), the four records 102, 104, 107, and 217 are not used, and the remaining records will be divided into two sub-datasets, namely DS1 and DS2. DS1 is the source domain dataset, including 101, 106, 108, 109, 112, 114, 115, 116, 118, 119, 122, 124, 201, 203, 205, 207, 208, 209, 215, 220, and 230, a total of 22 records. The remaining 22 records, 100, 103, 105, 111, 113, 117, 121, 123, 200, 202, 210, 212, 213, 214, 219, 221, 222, 228, 231, 232, 233 and 234, constitute the target domain dataset DS2. This division method is more in line with the actual situation.
[0156] For heartbeat classification, in order to compare the proposed method with existing schemes, we adopted the heartbeat classification methods used in these schemes. Specifically, we strictly classified the heartbeat data in the MIT-BIH database according to the AAMI standard. There are 15 different heartbeat types in the MIT-BIH database. According to the ANSI / AAMI EC57:1998 standard, these 15 types of heartbeats can be further divided into one of the following 5 categories (normal beat (N), supraventricular ectopic beat (SVEB), supraventricular ectopic beat (VEB), fusion beat (F) and unknown beat (Q)). The specific classification method is shown in Table 1.
[0157]
[0158] Table 1
[0159] Since there are few Q-type heartbeats in the AAMI standard, we only focus on the other four types of heartbeats. There are a total of 50,709 heartbeat samples in the source domain DS1 and 49,400 heartbeat samples in the target domain DS2. Table 2 shows the detailed number of the four heartbeat types in the two datasets.
[0160]
[0161] Table 2
[0162] As shown in Table 2, in the MIT-BIH database, N-type heartbeats account for 89.5% of the total heartbeats, which leads to an extremely unbalanced distribution of the number of heartbeats of each type. However, the CNN network is a multi-classification algorithm based on balanced training data. The more unbalanced the training data, the worse the overall classification performance of the CNN. Therefore, we only take 5,000 N-type heartbeat samples in both the source domain and the target domain.
[0163] In the pre-training stage, the network parameters shown in Table 3 are mainly used.
[0164]
[0165] Table 3
[0166] In the adaptive training stage, the network parameters shown in Table 4 are mainly used.
[0167]
[0168] Table 4
[0169] To demonstrate the performance of the proposed domain adaptation method, we compared the classification results before and after domain adaptation. In addition, we compared our method with several other heartbeat classification methods, all of which used the data partitioning method of the inter-patient paradigm and were evaluated on the MIT-BIH Arrhythmia Database. Specifically, we pre-trained the network with source domain data, which achieved a classification accuracy of over 98% on the source domain test set data, but obtained a classification accuracy of 83.40% on the target domain test set. On this basis, we used the domain adaptation method to fine-tune the pre-trained network. The curve of classification accuracy changing with the number of iterations is shown in Figure 2. Figure 6 shown.
[0170] When the domain adaptation method is used, the accuracy curve gradually rises and eventually stabilizes. In contrast, we retrain the pre-trained network using source domain data without using the domain adaptation method. The results show that as the number of iterations increases, the accuracy curve remains basically stable. Figure 6As shown in the figure, the accuracy curve obtained by the domain adaptation method is always higher than the curve obtained without the domain adaptation method, and the gap between the two gradually increases. It can be seen that the domain adaptation method improves the classification performance of the inter-patient paradigm. After the introduction of domain adaptation, the overall classification accuracy of the network reached 90.98%, an increase of 7.58%.
[0171] In addition, we also analyze the network loss in our dataset. Figure 7 The curves of classification loss, MK-MMD loss, entropy loss and total loss respectively vary with the number of iterations. In the domain adaptation stage, the total loss consists of classification loss, MK-MMD and entropy loss. We aim to optimize the network by minimizing the total loss. In the pre-training stage, we have pre-trained our model with source domain data, and the classification loss has reached convergence before minimizing the total loss. Therefore, from Figure 7 It can be seen that when the total loss is minimized, the classification loss curve no longer decreases, but remains stable. However, as the number of iterations increases, the MK-MMD loss and entropy loss gradually decrease and eventually stabilize. The total loss curve also tends to decrease. At the beginning of the iteration, the total loss curve decreases rapidly. After 25 iterations of the network, the curve decreases gradually. Finally, after 50 iterations of the network, the total loss curve tends to stabilize. It can be inferred that our algorithm can reach convergence after 50 iterations.
[0172] In addition, we also studied the effect of data volume on algorithm accuracy. We took 100%, 75%, 50%, 25%, and 13% of the training data from the source domain and the target domain, respectively, to fine-tune our domain adaptation network. The final accuracy curve is shown in Figure 2. Figure 8 As shown. Figure 8 We can see that as the amount of training data increases, the classification accuracy is also improving. When the amount of training data is 13%, the final classification accuracy can reach 85.26%. When the amount of data is 25%, the accuracy can reach 86.51%. When the amount of training data is 50%, the final classification accuracy is 90.26%. The accuracy curve corresponding to 50% data is basically close to the performance when using 100% data, and the accuracy curves of 75% and 100% data basically overlap with each other.
[0173] The classification confusion matrix before and after domain adaptation is shown in Figure 9(a) and Figure 9(b). We can calculate the specific values of each evaluation index based on the confusion matrix. Table 5 lists the comparison results of each evaluation index before and after domain adaptation. After adopting the domain adaptation method, the classification performance of the network for each type of heartbeat is improved. For the N type of heartbeat, the sensitivity, positive prediction rate and F1 score are improved by 12.48%, 1.35% and 0.08 respectively. In the VEB type of heartbeat, these indicators increase by 0.49%, 5.35% and 0.03 respectively. For the classification of SVEB heartbeat, these indicators are improved by 0.58%, 20.11% and 0.11 respectively. For the F type of heartbeat, the domain adaptation method achieves 28.05%, 11.22% and 0.16 improvements in each index respectively. The experimental results show that this method effectively alleviates the impact of the degradation of classification performance caused by the difference in the probability distribution of heartbeat data in the source domain and the target domain.
[0174]
[0175]
[0176] Table 5
[0177] Table 5 shows the comparison results of our algorithm with several other advanced algorithms. In
[26] , a CNN with batch weighted loss was proposed to classify ECG signals, while
[27] combined LSTM and CNN to recognize ECG. In
[28] , a new deep learning method based on adversarial domain adaptation was proposed for ECG classification. As shown in Table 5, compared with the classic deep learning algorithms
[26] and
[27] , our proposed algorithm achieved higher overall classification accuracy and F1 macro score. This is because we not only use CNN in the deep learning algorithm, but also consider minimizing the domain difference between the probability distribution of source domain and target domain data, and map the source domain and target domain data to similar probability distributions as much as possible. This can improve the classification performance of the network for target domain data. Although the overall classification accuracy of our algorithm is slightly lower than that of the adversarial domain adaptation algorithm used in
[28] , our algorithm has obvious advantages in classifying VEB, SHEB and F-type heartbeats. We also obtained a higher f1-macro score, which means that our algorithm has balanced classification performance. This is because we not only reduce the difference between the probability distributions of the source domain and the target domain, but also reduce the uncertainty of the network's prediction of the target domain data label by minimizing the entropy loss, which is more conducive to the network's accurate classification of the data.
[0178] According to the ECG classification method and ECG classification model training method in the embodiment of the present invention, the domain adaptation method is applied to arrhythmia classification, and a deep domain adaptation network based on CNN is developed to classify arrhythmias, the purpose of which is to solve the problem of decreased classification performance caused by domain differences under the inter-patient paradigm. Specifically, by minimizing the MK-MMD between the probability distributions of the source domain data and the target domain data and the entropy loss calculated based on the prediction results of the network on the target domain data, we narrowed the domain differences and learned transferable feature representations. Subsequently, we trained and tested the proposed domain adaptation network on the MIT-BIH arrhythmia database. We pre-trained the network using source domain heartbeat data and obtained an accuracy of 83.40% on the target domain test set. On this basis, the pre-trained network was fine-tuned by the domain adaptation method to improve the network classification performance. After domain adaptation, the classification accuracy of the network on the target domain test set was improved to 90.98%. Before domain adaptation, the classifier trained on the source domain data can only accurately classify the source domain data, but the classification effect in the target domain is not ideal. After domain adaptation, the distance between the source domain and the target domain distribution is shortened, and the classification performance in the target domain is also improved. In addition, this method does not require any annotation information in the target domain, which is more practical.
[0179] The following describes an apparatus embodiment of the present invention, which can be used to execute the content cache management method in the above embodiment of the present invention. For details not disclosed in the apparatus embodiment of the present invention, please refer to the above embodiment of the multimedia playback control method of the present invention.
[0180] Fig.11 The block diagram of an electrocardiogram classification device according to an embodiment of the present invention is schematically shown.
[0181] Reference Fig.11 As shown, the ECG classification device 110 according to an embodiment of the present invention includes: a preprocessing module 1101, a feature extraction module 1102, and a classification module 1103.
[0182] The preprocessing module 1101 can be used to obtain the ECG data to be processed, and preprocess the ECG data to be processed to obtain heart beat data.
[0183] The feature extraction module 1102 can be used to input the heartbeat data into a trained ECG classification model, and use a feature extractor to perform convolution processing on the heartbeat data to obtain feature data; wherein the feature extractor includes a plurality of convolution layers arranged in succession.
[0184] The classification module 1103 can be used to perform full-connection processing on the feature data using a classifier to obtain a classification result corresponding to the ECG data to be processed; wherein the classifier includes a fully-connected layer.
[0185] In one embodiment of the present invention, the preprocessing module 1101 may include: a denoising processing unit, a heart beat division processing unit, and a normalization processing unit.
[0186] The denoising processing unit can be used to perform denoising on the ECG data to be processed to obtain a denoised ECG signal.
[0187] The heartbeat division processing unit can be used to divide the denoised electrocardiogram signal into heartbeats according to a preset sampling number based on the peak position of the R wave to obtain the original heartbeat signal.
[0188] The normalization processing unit can be used to normalize the original heartbeat signal corresponding to each sampling point and map it to a preset value interval to obtain the heartbeat data.
[0189] In one embodiment of the present invention, the device 110 may further include: a model training module.
[0190] The model training module can be used to divide the heartbeat sample data into a training set and a test set, and to construct an initial model based on a convolutional neural network; perform a first-stage pre-training on the initial model using the training set to obtain a pre-trained model; and perform a second-stage domain adaptive training on the pre-trained model using the training set and the test set to obtain the ECG classification model.
[0191] In one embodiment of the present invention, the model training module may include: inputting a training set into the model, performing convolution processing on the training set using a feature extractor to obtain feature data; performing full connection processing on the feature data using a classifier to obtain a classification result corresponding to the training set; calculating the classification loss based on the classification result, and minimizing the classification loss using the gradient descent method to update the network parameters of the model.
[0192] In one embodiment of the present invention, the calculating the classification loss includes:
[0193]
[0194] Where L(·,·) represents the cross entropy loss function, Indicates that the model will train the sample The prediction is the probability distribution of all classes, Represents the true label value of the output sample.
[0195] In one embodiment of the present invention, the model training module may include: inputting the test set and the training set into the pre-trained model, and obtaining the corresponding feature vector through a feature extractor; mapping the feature vector of the test set and the feature vector of the training set to the reproducing kernel Hilbert space, and calculating the maximum mean difference of the feature distribution between the test set and the training set; using a classifier to fully connect the test set feature data and the training set feature data to obtain the corresponding classification results; calculating the classification loss based on the classification results of the training set, and calculating the entropy loss based on the classification structure of the test set; constructing a total loss function by combining the maximum mean difference, classification loss and entropy loss, and minimizing the total loss using the gradient descent method to update the network parameters of the model.
[0196] In one embodiment of the present invention, the construction of a total loss function by combining the maximum mean difference, the classification loss and the entropy loss includes:
[0197] loss = L cls +λ*M k (D s ,D t )+β*H(D t )
[0198] Among them, L cls represents the classification loss, H(D t ) represents entropy loss, and hyperparameters λ and β represent the trade-off parameters between entropy loss and maximum mean difference. k (D s ,D t ) indicates the maximum mean difference.
[0199] Fig.12 A block diagram of a domain adaptive electrocardiogram classification model training device according to an embodiment of the present invention is schematically shown.
[0200] Reference Fig.12 As shown, according to an embodiment of the present invention, a domain adaptive ECG classification model training device 120 includes: a sample data processing module 1201, a model building module 1202, a first stage training module 1203, and a second stage training module 1204.
[0201] The sample data processing module 1201 can be used to obtain sample ECG data, pre-process the sample ECG data, and divide the pre-processed data into a training set and a test set.
[0202] The model building module 1202 can be used to build a model based on a convolutional neural network; wherein the model includes: a feature extractor for extracting feature data, and a classifier for classifying according to the feature data; the feature extractor includes a number of convolutional layers arranged in succession, and the classifier includes a fully connected layer.
[0203] The first stage training module 1203 can be used to perform first stage pre-training on the initial model using the training set to obtain a pre-trained model.
[0204] The second-stage training module 1204 may be configured to perform second-stage domain adaptive training on the pre-trained model using a training set and a test set to obtain an ECG classification model.
[0205] The specific details of each module in the above-mentioned ECG classification device and ECG classification model training device based on domain adaptation have been described in detail in the corresponding ECG classification method and ECG classification model training method based on domain adaptation, so they will not be repeated here.
[0206] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0207] Fig.13 A schematic diagram of the structure of a computer system suitable for implementing the ECG classification method and / or the domain adaptation-based ECG classification model training method according to an embodiment of the present invention is shown.
[0208] It should be noted that Fig.13 The computer system 900 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0209] like Fig.13 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 902 or the program loaded from the storage part 908 to the random access memory (RAM) 903. In the RAM 903, various programs and data required for system operation are also stored. The CPU 901, the ROM 902 and the RAM 903 are connected to each other through a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0210] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed so that a computer program read therefrom is installed into the storage section 908 as needed.
[0211] In particular, according to an embodiment of the present invention, the process described below with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 909, and / or installed from a removable medium 911. When the computer program is executed by a central processing unit (CPU) 901, various functions defined in the system of the present application are executed.
[0212] It should be noted that the computer-readable medium shown in the embodiment of the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0213] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0214] The units involved in the embodiments of the present invention may be implemented by software or hardware, and the units described may also be arranged in a processor. The names of these units do not, in some cases, limit the units themselves.
[0215] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.
[0216] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0217] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation of the present invention.
[0218] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art that are not disclosed in the present invention.
[0219] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. An electrocardiogram classification method, characterized in that: include: Acquire the ECG data to be processed, and pre-process the ECG data to be processed to obtain heart beat data; Inputting the heartbeat data into a trained ECG classification model, and performing convolution processing on the heartbeat data using a feature extractor to obtain feature data; wherein the feature extractor includes a plurality of convolution layers arranged in succession; and Using a classifier to perform full connection processing on the feature data to obtain a classification result corresponding to the ECG data to be processed; wherein the classifier includes a fully connected layer; The method further includes: training the electrocardiogram classification model, including: Divide the heartbeat sample data into training sets and test sets, and build an initial model based on a convolutional neural network; The initial model is pre-trained in the first stage using the training set to obtain a pre-trained model, including: inputting the training set into the model, performing convolution processing on the training set using a feature extractor to obtain feature data; performing full connection processing on the feature data using a classifier to obtain a classification result corresponding to the training set; calculating the classification loss according to the classification result, minimizing the classification loss using a gradient descent method, and updating the network parameters of the model; The pre-trained model is subjected to second-stage domain adaptive training using a training set and a test set to obtain the ECG classification model, including: inputting the test set and the training set into the pre-trained model, and obtaining corresponding feature vectors through a feature extractor; mapping the feature vectors of the test set and the feature vectors of the training set into a reproducing kernel Hilbert space, and calculating the maximum mean difference of feature distribution between the test set and the training set; performing full-connection processing on the feature data of the test set and the feature data of the training set using a classifier to obtain corresponding classification results; calculating classification loss based on the classification results of the training set, and calculating entropy loss based on the classification structure of the test set; constructing a total loss function by combining the maximum mean difference, classification loss and entropy loss, and minimizing the total loss using a gradient descent method to update the network parameters of the model.
2. The ECG classification method according to claim 1, characterized in that: Preprocessing the ECG data to be processed includes: Performing denoising on the ECG data to be processed to obtain a denoised ECG signal; Based on the peak position of the R wave, the denoised electrocardiogram signal is divided into heart beats according to a preset sampling number to obtain an original heart beat signal; The original heartbeat signal corresponding to each sampling point is normalized and mapped to a preset value interval to obtain the heartbeat data.
3. The ECG classification method according to claim 1, characterized in that: The calculation of classification loss includes: Where L(·,·) represents the cross entropy loss function, Indicates that the model will train the sample The prediction is the probability distribution of all classes, Represents the true label value of the output sample.
4. The ECG classification method according to claim 1, characterized in that: The total loss function is constructed by combining the maximum mean difference, classification loss and entropy loss, including: loss=L cls +λ*M k (D s ,D t )+β*H(D t ) Among them, L cls represents the classification loss, H(D t ) represents entropy loss, and hyperparameters λ and β represent the trade-off parameters between entropy loss and maximum mean difference. k (D s , D t ) indicates the maximum mean difference.
5. A domain adaptive ECG classification model training method, characterized in that: include: Acquire sample ECG data, preprocess the sample ECG data, and divide the preprocessed data into a training set and a test set; Constructing a model based on a convolutional neural network; wherein the model includes: a feature extractor for extracting feature data, and a classifier for classifying according to the feature data; the feature extractor includes a plurality of convolutional layers arranged in succession, and the classifier includes a fully connected layer; The initial model is pre-trained in the first stage using the training set to obtain a pre-trained model, including: inputting the training set into the model, performing convolution processing on the training set using a feature extractor to obtain feature data; performing full connection processing on the feature data using a classifier to obtain a classification result corresponding to the training set; calculating the classification loss according to the classification result, minimizing the classification loss using a gradient descent method, and updating the network parameters of the model; The pre-trained model is subjected to second-stage domain adaptive training using a training set and a test set to obtain an ECG classification model, including: inputting the test set and the training set into the pre-trained model, and obtaining corresponding feature vectors through a feature extractor; mapping the feature vectors of the test set and the feature vectors of the training set into a reproducing kernel Hilbert space, and calculating the maximum mean difference of feature distribution between the test set and the training set; performing full-connection processing on the feature data of the test set and the feature data of the training set using a classifier to obtain corresponding classification results; calculating classification loss based on the classification result of the training set, and calculating entropy loss based on the classification structure of the test set; constructing a total loss function by combining the maximum mean difference, classification loss and entropy loss, and minimizing the total loss using a gradient descent method to update the network parameters of the model.
6. An electrocardiogram classification device, characterized in that: include: A preprocessing module, used for acquiring the ECG data to be processed, and preprocessing the ECG data to be processed to obtain heartbeat data; A feature extraction module, used for inputting the heartbeat data into a trained ECG classification model, and performing convolution processing on the heartbeat data using a feature extractor to obtain feature data; wherein the feature extractor includes a plurality of convolution layers arranged in succession; and A classification module, used for performing full connection processing on the feature data using a classifier to obtain a classification result corresponding to the ECG data to be processed; wherein the classifier includes a fully connected layer; The electrocardiogram classification model comprises: Divide the heartbeat sample data into training sets and test sets, and build an initial model based on a convolutional neural network; The initial model is pre-trained in the first stage using the training set to obtain a pre-trained model, including: inputting the training set into the model, performing convolution processing on the training set using a feature extractor to obtain feature data; performing full connection processing on the feature data using a classifier to obtain a classification result corresponding to the training set; calculating the classification loss according to the classification result, minimizing the classification loss using a gradient descent method, and updating the network parameters of the model; The pre-trained model is subjected to second-stage domain adaptive training using a training set and a test set to obtain the ECG classification model, including: inputting the test set and the training set into the pre-trained model, and obtaining corresponding feature vectors through a feature extractor; mapping the feature vectors of the test set and the feature vectors of the training set into a reproducing kernel Hilbert space, and calculating the maximum mean difference of feature distribution between the test set and the training set; performing full-connection processing on the feature data of the test set and the feature data of the training set using a classifier to obtain corresponding classification results; calculating classification loss based on the classification results of the training set, and calculating entropy loss based on the classification structure of the test set; constructing a total loss function by combining the maximum mean difference, classification loss and entropy loss, and minimizing the total loss using a gradient descent method to update the network parameters of the model.
7. A domain adaptive electrocardiogram classification model training device, characterized in that: include: A sample data processing module, used for acquiring sample ECG data, preprocessing the sample ECG data, and dividing the preprocessed data into a training set and a test set; A model building module, used to build a model based on a convolutional neural network; wherein the model includes: a feature extractor for extracting feature data, and a classifier for classifying according to the feature data; the feature extractor includes a plurality of convolutional layers arranged in succession, and the classifier includes a fully connected layer; The first stage training module is used to perform the first stage pre-training on the initial model using the training set to obtain the pre-training model, including: inputting the training set into the model, performing convolution processing on the training set using a feature extractor to obtain feature data; performing full connection processing on the feature data using a classifier to obtain a classification result corresponding to the training set; calculating the classification loss according to the classification result, minimizing the classification loss using a gradient descent method, and updating the network parameters of the model; The second stage training module is used to perform second stage domain adaptive training on the pre-trained model using the training set and the test set to obtain an ECG classification model, including: inputting the test set and the training set into the pre-trained model, and obtaining the corresponding feature vector through the feature extractor; mapping the feature vector of the test set and the feature vector of the training set to the reproducing kernel Hilbert space, and calculating the maximum mean difference of the feature distribution between the test set and the training set; using the classifier to perform full connection processing on the feature data of the test set and the feature data of the training set to obtain the corresponding classification result; calculating the classification loss based on the classification result of the training set, and calculating the entropy loss based on the classification structure of the test set; constructing a total loss function by combining the maximum mean difference, classification loss and entropy loss, and minimizing the total loss by using the gradient descent method to update the network parameters of the model.
8. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the ECG classification method according to any one of claims 1 to 4, and / or the ECG classification model training method based on domain adaptation according to claim 5.
9. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the ECG classification method as described in any one of claims 1 to 4, and / or the domain adaptive ECG classification model training method as described in claim 5.
Citation Information
Patent Citations
Heartbeat classification method and device for multi-tag ECG signal labeling
US20230342595A1