A method for classifying arrhythmias based on temporal adaptation of contrast tests
Through the multimodal image fusion and comparison test time adaptation methods, the problems of ECG data category imbalance and low classification efficiency are solved, efficient heart rate arrhythmia classification is achieved, and the cost of manual feature extraction is reduced.
Patent Information
- Application Number
- CN202211724133.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2042-12-30
AI Technical Summary
The prior art has problems such as class imbalance, the need to manually extract features and low classification efficiency when processing ECG data, resulting in poor model performance and high cost.
The heart rate arrhythmia classification method based on multimodal image fusion and contrast test time adaptation is adopted, and category balanced sampling is performed through the SMOTE algorithm, one-dimensional ECG data is converted into two-dimensional images, and the convolutional neural network is used for training, and the time domain adaptation is compared with improved pseudo-label, self-supervised comparison learning and regularization technology is used for comparison test time domain adaptation.
It effectively solves the problem of ECG data category imbalance, reduces the need for manual feature extraction, improves classification efficiency, and achieves real-time adaptation and high classification effects.
Smart Images

Figure CN115836849B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of heart rate analysis, and in particular relates to a heart rate arrhythmia classification method based on comparative test time adaptation. Background Art
[0002] Deep neural networks work very well in various applications when the test data comes from the same distribution as the training data, but the performance drops dramatically when there is a distribution shift between the training and test distributions. In the real world, the drop in performance may make the model classification effect so poor that it can no longer be used. There has been a lot of work recently devoted to training robust models. While this is a viable research direction, it requires modifying the model training process. Due to privacy / storage considerations, modifying the model training process may not always be feasible because the training data may no longer be available and all that is available is the pre-trained model. Therefore, there is growing interest in test time adaptation, a setting in which the model can be adapted at test time without changing the training process or requiring access to the original training data.
[0003] Electrocardiograms (ECGs) are widely used by cardiologists and medical practitioners to diagnose and respond to serious cardiovascular syndromes such as arrhythmias and myocardial infarction. ECG-based heartbeat classification can provide cardiologists with accurate information about chronic cardiovascular diseases. Since cardiovascular disease is the leading cause of death worldwide, intelligent systems for diagnosing cardiovascular disease are very popular. Current machine learning systems applied to ECG classification either rely on manually extracted features or rely on large and complex deep neural networks that directly utilize one-dimensional ECG signals. The disadvantages of these traditional methods are the separation of the feature extraction part and the pattern classification part. These methods require expertise about the input data and the selected features, and require experts to manually extract features. The feature extraction process is not only time-consuming, but also very costly.
[0004] The existing technology still has the following problems:
[0005] 1) ECG data class imbalance. Class imbalance refers to the situation where the number of training examples of different categories in the classification task is very different. The class imbalance phenomenon is particularly significant in the ECG data classification task, because in the electrocardiogram-related data set, there are many normal heart beats and few abnormal heart beats, which leads to poor prediction performance of the model, especially for the prediction of categories with fewer samples.
[0006] 2) Manual feature extraction is required. Traditional methods for heartbeat classification using ECG signals mainly rely on manually made or manually extracted features using signal processing techniques, such as digital filter-based methods, threshold-based methods, Fourier transforms, and wavelet transforms. The disadvantage of these traditional methods is the separation of the feature extraction part and the pattern classification part. In addition, these methods require professional knowledge about the input data and the selected features. The process of manually extracting features requires a lot of manpower and financial resources, and the features obtained are likely to contain some noise data.
[0007] 3) Low classification efficiency. Traditional ECG data classification methods usually require the use of complex neural networks to achieve good classification results. However, it usually takes a long time to train a complex neural network. In real machine perception systems, there are usually certain requirements for timeliness. The comparative test time adaptation method proposed in this paper can basically achieve real-time adaptation and real-time classification, and the classification effect is comparable to that of traditional methods. Summary of the invention
[0008] In order to solve the technical problems mentioned in the above background technology, the present invention proposes a.
[0009] In order to achieve the above technical objectives, the technical solution of the present invention is:
[0010] A method for classifying arrhythmias based on time adaptation of comparative tests comprises the following steps:
[0011] S1, collect arrhythmia data and generate a data set, and collect heart beats through the Q peak position marked in the data set itself;
[0012] S2, using the SMOTE algorithm to perform category-balanced sampling on the heartbeats collected in step S1;
[0013] S3, using a multimodal image fusion framework to convert one-dimensional heart beats into two-dimensional images and divide the data set;
[0014] S4. Build a convolutional neural network model for the training phase;
[0015] S5, initializing the parameters of the convolutional neural network model built in step S4; inputting the data set divided in step S3 into the convolutional neural network model for training;
[0016] S6. Performing comparative test time domain adaptation on the convolutional neural network model trained in step S5; including improving pseudo labels, self-supervised comparative learning and regularization; after comparative test time domain adaptation, updating the weight parameters of the source model during the adaptation process, and using the adjusted model for the final arrhythmia classification task.
[0017] Preferably, step S1 specifically refers to: using MITdb and MITsa arrhythmia databases as data sets, wherein the sampling frequency of the MITdb arrhythmia database is 360 Hz, resampling the MITsa arrhythmia data to 360 Hz through the waveform database toolkit, deleting data other than normal heart beats, supraventricular ectopic beats, ventricular ectopic beats, fusion beats and unclassifiable beats, obtaining the position subscript index of the Q peak according to the annotation file of the data set, and then taking the position of the Q peak as the reference, including 150 points to the left and 100 points to the right, and then cutting out this section of data as the heart beat.
[0018] Preferably, step S2 specifically refers to: synthesizing new samples by linear interpolation between minority class samples and their three nearest neighbor samples, and using the SMOTE algorithm to sample normal heart beats, supraventricular ectopic beats, ventricular ectopic beats, fusion beats and unclassifiable beats into 20,000 samples.
[0019] Preferably, in step S3, a multimodal image fusion framework is used to convert the one-dimensional heartbeat into a two-dimensional image; the one-dimensional ECG data is converted into three different types of two-dimensional grayscale images, namely, Gram angle field, recurrence graph and Markov transition field, and then the three grayscale images are combined to form a three-channel color image, the MITdb arrhythmia database is relabeled and shuffled and rearranged, and the MITdb arrhythmia database is divided into a training set and a test set, the first 90% of the data is taken as the training set, and the last 10% of the data is taken as the test set.
[0020] Preferably, the network model used in the training phase in step S4 is ResNet-18. ResNet-18 includes 17 convolutional layers and one fully connected layer, so the output dimension of the fully connected layer of ResNet-18 is changed to 5.
[0021] Preferably, in step S5, the model learning rate is 10^(-4), the sample batch size is 256, the number of iterations is 20, and Adam is used to optimize the learning rate, where the smoothing factors β_1=0.6, β_2=0.98, and the loss function uses cross entropy.
[0022] Preferably, improving the pseudo-label in step S6 specifically refers to: initializing the target model using the weights of the pre-trained model, generating pseudo-labels for unlabeled target data using the target model, and establishing a memory queue Q with a length of M. W Store the feature vector E of the weakly enhanced target sample w and the predicted probability p w , whenever a test sample x is input t After that, the target model is used to obtain the feature vector E w and the predicted probability p wUpdate the queue and use the momentum update method to update the target model parameter θ. The formula is as follows:
[0023] θ t+1 =mθ t+1 +(1-m)θ t
[0024] Among them, θ t+1 represents the parameters of the target model at time step t+1, m is the momentum hyperparameter, in the present invention, m=0.2; whenever a test sample x is input t After that, we get x t The feature vector E of the weakly enhanced image t , and then from the memory queue Q W Take out with E t The 10 eigenvectors E with the closest cosine distance w and the predicted probability p w , then find the average of the 10 probabilities Final pseudo-label The formula is as follows:
[0025]
[0026] Among them, argmax is a built-in function in the Pytorch framework, which can return the ordinal number of the maximum value of the specified dimension.
[0027] Preferably, the self-supervised contrastive learning in step S6 specifically refers to: encoding the test image into two different strongly enhanced view features query (q) and key (k), q, k are regarded as positive samples. Maintain a queue Q of negative samples with a length of N negtive Store the feature k of negative samples - ,The goal of the contrastive learning loss function is to minimize the cosine distance between q,k, while maximizing q and the queue Q negtive Each negative sample feature k - The cosine distance between them, the contrast loss function formula is expressed as follows:
[0028]
[0029] Where N represents the queue Q negtive The length of , q represents the feature query, k + Represents the feature key, k i represents the i-th negative sample in the queue, τ is the temperature coefficient hyperparameter, τ = 0.1.
[0030] Preferably, in step S6, consistency regularization is used to maintain the consistency of prediction between the strongly enhanced image and the weakly enhanced image of the image, and the formula is expressed as follows:
[0031]
[0032] Where C represents the number of categories in the classification task, C = 5, p w represents the predicted probability of the weakly enhanced image output by the model, q s Represents the predicted probability of the strongly enhanced image output by the model
[0033] Preferably, step S6 uses diversity regularization to reduce the model's blind belief in wrong labels during the adaptation process, which leads to the accumulation of errors in the model. The formula is as follows:
[0034]
[0035] Where C represents the number of categories in the classification task, C = 5, p s Represents the predicted probability of the strongly enhanced image being output by the model;
[0036] The final loss function expression is as follows:
[0037] L=αL cont +βL con +γL div
[0038] Among them, α, β, and γ are the weight values before controlling each loss, α = 0.9, β = 0.7, and γ = 0.5.
[0039] The beneficial effects brought by adopting the above technical solution are:
[0040] (1) The arrhythmia classification method based on multimodal image fusion and comparative test time adaptation proposed in the present invention can solve the poor model classification performance caused by the imbalance of ECG data sets. By using the SMOTE algorithm to sample the number of categories to the same number, the impact of category imbalance on model performance is solved.
[0041] (2) The arrhythmia classification method based on multimodal image fusion proposed in the present invention does not require manual feature extraction. The one-dimensional ECG data is converted into a two-dimensional image using a multimodal image fusion framework, and multimodal fusion can accurately extract features through an efficient deep neural network.
[0042] (3) The comparative test time adaptation method proposed in the present invention is highly efficient and does not require the training of complex neural networks. The comparative test time adaptation process can basically achieve real-time adaptation and real-time classification, and the classification effect is very good. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 is a workflow diagram of the arrhythmia classification method based on multimodal image fusion and contrast test time adaptation;
[0044] Figure 2 It is a graph of the change in model loss value during training;
[0045] Figure 3 It is a diagram of the time domain adaptation process for comparative testing. DETAILED DESCRIPTION
[0046] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings.
[0047] The present invention discloses a method for classifying arrhythmia based on multimodal image fusion and comparative test time adaptation, such as Figure 1 As shown, the specific process is as follows:
[0048] Step 1: Data Preprocessing
[0049] 1.1 Collect heartbeats through the Q peak position marked by the dataset itself. This experiment uses the MITdb and MITsa arrhythmia databases as datasets, among which the sampling frequency of the MITdb arrhythmia database is 360Hz, so the MITdb arrhythmia database can be used directly. The sampling frequency of the MITsa arrhythmia database is 128Hz, and it needs to be resampled to 360Hz through the WFDB (waveform database) toolkit to ensure that the sampling frequency of the ECG data in the electrocardiogram sample set is 360Hz. According to the standards proposed by the American Association for the Advancement of Medical Instrumentation, all heartbeats can be divided into five categories: normal heartbeat (N), supraventricular ectopic beat (S), ventricular ectopic beat (V), fusion beat (F) and unclassifiable beat (Q). The five categories of labels are encoded as 0, 1, 2, 3, and 4, and other data that are not in these five categories are deleted. The subscript index of the Q peak position is obtained according to the annotation file of the data set, and then based on the position of the Q peak, 150 points are included to the left and 100 points to the right, and then this section of data is cut out as the heartbeat.
[0050] 1.2 Use SMOTE algorithm for class balanced sampling. In the MITdb arrhythmia database, the number of samples of the five classes N, S, V, F, and Q are 72471, 2223, 5788, 641, and 6431 respectively, and there is a serious class imbalance phenomenon. If the SMOTE algorithm is not used for class balanced sampling, the performance of the model finally trained is very poor. The SMOTE algorithm synthesizes new samples by linear interpolation between minority class samples and their K (K=3 in the present invention) nearest neighbor samples. In the present invention, the SMOTE algorithm is used to sample 20,000 samples for each of the five major classes, thereby achieving class balance.
[0051] 1.3 Use the multimodal image fusion framework to convert the one-dimensional heartbeat into a two-dimensional image. The one-dimensional ECG data is converted into three different types of two-dimensional grayscale images, namely Gramian Angular Field GAF, Recurrence Plot RP, and Markov Transition Field MTF. These three grayscale images are then combined to form a three-channel color image (GAF-RP-MTF). The three grayscale images are all formed by the original ECG data through different statistical methods, which maintains the time dependency of the signal and does not lose any information of the one-dimensional signal. Therefore, the obtained three-channel color image contains more information, and the three-channel image can be easily used with existing convolutional neural networks such as AlexNet and ResNet.
[0052] 1.4 Dataset Division. Relabel and shuffle the MITdb arrhythmia database, and divide it into a training set and a test set. Take the first 90% of the data as the training set and the last 10% of the data as the test set.
[0053] Step 2: Build a convolutional neural network for the training phase
[0054] 2.1 Build a convolutional neural network in the training phase. The network model used in the training phase is ResNet-18, which contains 17 convolutional layers and one fully connected layer. Since the present invention is a five-classification task, the output dimension of the fully connected layer of ResNet-18 is changed to 5, and the convolutional layer does not need to be changed.
[0055] Step 3: Pre-training Convolutional Neural Network
[0056] 3.1 Initialize model parameters. Set the model learning rate to 10 -4 , the sample batch size is 256, and the number of iterations is 20. Adam is used to optimize the learning rate, with smoothing factors β1=0.6, β2=0.98, and the loss function uses cross entropy.
[0057] 3.2 Input the preprocessed MITdb dataset into the model for pre-training. Input the preprocessed MITdb dataset into the model, first initialize the model parameters, and then start training the model. The value of the loss function becomes smaller and smaller until convergence. At this time, the initialized parameters will change. Save the changed parameters and use the pre-trained convolutional neural network as the source model. The model loss value changes during the training process are as follows: Figure 2 As shown in Figure 2, the pre-trained convolutional neural network has a classification accuracy of 99.5% for the MITdb dataset.
[0058] 3.3 Save the model. Save the trained model and use the trained convolutional neural network parameters as the initialization parameters for the ECG arrhythmia classification task when performing the ECG classification task.
[0059] Step 4: Comparative test of temporal domain adaptation
[0060] 4.1 Improve pseudo-labels. The comparative test time domain adaptation method proposed in the present invention is based on unsupervised operation, so the quality of the pseudo-label determines the final performance of the model. In order to obtain accurate pseudo-labels, the present invention uses a pseudo-label improvement scheme based on nearest neighbor voting of a memory queue to improve the pseudo-labels online in each round of the adaptation process. First, the target model is initialized with the weights of the pre-trained model, and the target model is used to generate pseudo-labels for unlabeled target data. Then, in order to realize the nearest neighbor search, a memory queue Q with a length of M is maintained. W , used to store the feature vector E of the weakly enhanced target sample w and the predicted probability p w , whenever a test sample x is input t After that, the target model is used to obtain the feature vector E w and the predicted probability p w To update the queue, in order to ensure that the feature space is more stable, the target model parameter θ is updated using the momentum update method. The update rule is as shown in equation (1). t After that, we get x t The feature vector E of the weakly enhanced image t , and then from the memory queue Q W Take out with E t The K (K=10 in this invention) feature vectors E with the closest cosine distance w and the predicted probability p w , then find the average of the 10 probabilities Final pseudo-label It can be obtained from equation (2):
[0061] θ t+1 =mθ t+1 +(1-m)θ t (1)
[0062] Among them, θ t+1 represents the parameters of the target model at time step t+1, m is the momentum hyperparameter, and in the present invention, m=0.2.
[0063]
[0064] Among them, argmax is a built-in function in the Pytorch framework, which can return the ordinal number of the maximum value of the specified dimension.
[0065] 4.2 Self-supervised contrastive learning. The proxy task used in contrastive learning in this invention is instance-discrimination. Different image views are obtained through data augmentation. The features of different views of the same image are regarded as positive pairs to be pulled closer, while the features of different images are regarded as negative pairs to be pushed away. The test image is encoded into the features query(q) and key(k) of two different strongly enhanced views. q and k are regarded as positive samples. A queue Q of negative samples of length N is maintained. negtive Store the feature k of negative samples - ,The goal of the contrastive learning loss function is to minimize the cosine distance between q,k, while maximizing q and the queue Q negtive Each negative sample feature k _ The cosine distance between them. The contrast loss function is as follows:
[0066]
[0067] Where N represents the queue Q negtive The length of , q represents the feature query, k + Represents the feature key, k i represents the i-th negative sample in the queue, τ is the temperature coefficient hyperparameter, and τ=0.1 in the present invention.
[0068] 4.3 Regularization. Two regularization methods are used in the present invention, namely consistency regularization and diversity regularization. The purpose of consistency regularization is to make the model maintain the consistency of prediction between the strong enhanced image and the weak enhanced image of the image, thereby improving the robustness of the model. The consistency regularization expression is as shown in equation (4):
[0069]
[0070] Where C represents the number of categories of the classification task. In this invention, C=5, p w represents the predicted probability of the weakly enhanced image output by the model, q s Represents the predicted probability of the strongly enhanced image output by the model.
[0071] The purpose of diversity regularization is to further improve the quality of pseudo labels. Although improving pseudo labels in step 4.1 effectively reduces the noise in pseudo labels caused by domain shift, they are still not suitable as true labels. In order to prevent the model from blindly believing in wrong labels during adaptation and causing errors to accumulate in the model, regularization terms are used in the loss function to encourage class diversification. The diversity regularization expression is as shown in equation (5):
[0072]
[0073] Where C represents the number of categories of the classification task. In this invention, C=5, p s Represents the predicted probability of the strongly enhanced image output by the model.
[0074] The final loss function expression is as shown in equation (6):
[0075] L=αL cont +βL con +γL div (6)
[0076] Among them, α, β, and γ are weight values before controlling each loss. In the present invention, α=0.9, β=0.7, and γ=0.5.
[0077] 4.4 Arrhythmia classification task. After the comparative test time domain adaptation, the source model continuously adapts to the target data, and the weight parameters of the source model are updated during the adaptation process, and the adjusted model is used for the final arrhythmia classification task.
[0078] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code. The scheme in the embodiments of the present application can be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.
[0079] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0080] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0081] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0082] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0083] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for classifying arrhythmias based on time adaptation of comparative tests, characterized in that: The following steps are involved: S1, collect arrhythmia data and generate a data set, and collect heart beats through the Q peak position marked in the data set itself; S2, using the SMOTE algorithm to perform category-balanced sampling on the heartbeats collected in step S1; S3, using a multimodal image fusion framework to convert one-dimensional heart beats into two-dimensional images and divide the data set; S4. Build a convolutional neural network model for the training phase; S5, initializing the parameters of the convolutional neural network model built in step S4; inputting the data set divided in step S3 into the convolutional neural network model for training; S6, performing a comparative test on the time domain adaptation of the convolutional neural network model trained in step S5; Including improving pseudo-labels, self-supervised contrastive learning, and regularization; after contrastive testing of time domain adaptation, the weight parameters of the source model are updated during the adaptation process, and the adjusted model is used for the final arrhythmia classification task; Step S1 specifically refers to: using MITdb and MITsa arrhythmia databases as data sets, wherein the sampling frequency of the MITdb arrhythmia database is 360 Hz, resampling the MITsa arrhythmia data to 360 Hz through the waveform database toolkit, deleting data other than normal heart beats, supraventricular ectopic beats, ventricular ectopic beats, fusion beats, and unclassifiable beats, obtaining the subscript index of the position of the Q peak according to the annotation file of the data set, and then taking the position of the Q peak as a reference, including 150 points to the left and 100 points to the right, and then cutting out this section of data as the heart beat; In step S3, a multimodal image fusion framework is used to convert the one-dimensional heartbeat into a two-dimensional image; the one-dimensional ECG data is converted into three different types of two-dimensional grayscale images, namely, Gram angle field, recurrence graph and Markov transition field, and then the three grayscale images are combined to form a three-channel color image, the MITdb arrhythmia database is relabeled and shuffled, and the MITdb arrhythmia database is divided into a training set and a test set, the first 90% of the data is taken as the training set, and the last 10% of the data is taken as the test set; In step S5, the model learning rate is 10^(-4), the sample batch size is 256, the number of iterations is 20, and Adam is used to optimize the learning rate, where the smoothing factors β_1=0.6, β_2=0.98, and the loss function uses cross entropy; Improving pseudo labels in step S6 specifically refers to: initializing the target model using the weights of the pre-trained model, using the target model to generate pseudo labels for unlabeled target data, and establishing a memory queue Q with a length of M. W Store the feature vector E of the weakly enhanced target sample w and the predicted probability p w , whenever a test sample x is input t After that, the target model is used to obtain the feature vector E w and the predicted probability p w Update the queue and use the momentum update method to update the target model parameter θ. The formula is as follows: i t+1 =mθ t+1 +(1-m)θ t Among them, θ t+1 represents the parameters of the target model at time step t+1, m is the momentum hyperparameter, m=0.2; whenever a test sample x is input t After that, we get x t The feature vector E of the weakly enhanced image t , and then from the memory queue Q W Take out with E t The 10 eigenvectors E with the closest cosine distance w and the predicted probability p w , then find the average of the 10 probabilities Final pseudo-label The formula is as follows: Among them, argmax is a built-in function in the Pytorch framework, which can return the ordinal number of the maximum value of the specified dimension; The self-supervised contrastive learning in step S6 specifically refers to: encoding the test image into two different strongly enhanced view features query (q) and key (k), q, k are regarded as positive samples, and maintaining a queue Q of negative samples with a length of N negtive Store the feature k of negative samples - ,The goal of the contrastive learning loss function is to minimize the cosine distance between q,k, while maximizing q and the queue Q negtive Each negative sample feature k - The cosine distance between them, the contrast loss function formula is expressed as follows: Where N represents the queue Q negtive The length of , q represents the feature query, k + Indicates the feature key, represents the i-th negative sample in the queue, τ is the temperature coefficient hyperparameter, τ = 0.
1.
2. A method for classifying arrhythmias based on time adaptation of comparative tests according to claim 1, characterized in that: Step S2 specifically refers to: synthesizing new samples by linear interpolation between minority class samples and their three nearest neighbor samples, and using the SMOTE algorithm to sample normal heart beats, supraventricular ectopic beats, ventricular ectopic beats, fusion beats and unclassifiable beats into 20,000 samples.
3. The method for classifying arrhythmias based on time adaptation of comparative tests according to claim 1, characterized in that: The network model used in the training phase in step S4 is ResNet-18. ResNet-18 contains 17 convolutional layers and one fully connected layer, so the output dimension of the fully connected layer of ResNet-18 is changed to 5.
4. The method for classifying arrhythmias based on time adaptation of comparative tests according to claim 1, characterized in that: In step S6, consistency regularization is used to maintain the consistency of prediction between the strongly enhanced image and the weakly enhanced image of the image. The formula is expressed as follows: Where C represents the number of categories in the classification task, C = 5, p w represents the predicted probability of the weakly enhanced image output by the model, q s Represents the predicted probability of the strongly enhanced image output by the model.
5. The method for classifying arrhythmias based on time adaptation of comparative tests according to claim 1, characterized in that: Step S6 uses diversity regularization to reduce the model's blind belief in wrong labels during the adaptation process, which leads to the accumulation of errors in the model. The formula is as follows: Where C represents the number of categories in the classification task, C = 5, p s Represents the predicted probability of the strongly enhanced image being output by the model; The final loss function expression is as follows: L=αL cont +βL con +γL div Among them, α, β, and γ are the weight values before controlling each loss, α = 0.9, β = 0.7, and γ = 0.5.
Citation Information
Patent Citations
Method for classifying imbalance heart beats based on multi-module neural network
CN109645983A
Deep learning arrhythmia classification method based on two-dimensional image
CN114359625A