Electrocardiogram anomaly detection method based on time-frequency enhanced self-supervised contrast learning

By adopting a self-supervised comparison learning method with time-frequency enhancement in electrocardiogram abnormality detection, using the in- and inter-time frequency comparison learning mechanism and feature-level sample data enhancement generator, the impact of data enhancement methods on the detection accuracy of electrocardiogram abnormality in the prior art is solved, and higher detection accuracy is achieved.

CN119867771AActive Publication Date: 2025-04-25ZHENGZHOU UNIV +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411760779.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-04-25
Estimated Expiration
2044-12-03

AI Technical Summary

Technical Problem

Existing self-supervised learning data enhancement methods have a negative impact on the accuracy of ECG abnormality detection, resulting in the original ECG signal becoming an abnormal signal or losing characteristics.

Method used

Using a self-supervised comparison learning method based on time-frequency enhancement, a feature-level sample data enhancement generator is designed to generate enhanced samples to improve detection accuracy through the time-frequency and time-frequency comparison learning mechanism.

Benefits of technology

It improves the accuracy of electrocardiogram abnormality detection, solves the problem of selecting positive and negative samples in comparison learning, and enhances the impact on abnormality detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119867771A_ABST
    Figure CN119867771A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of electrocardio time sequence data processing, and discloses an electrocardio anomaly detection method based on time-frequency enhanced self-supervised contrast learning, which comprises the following steps: acquiring frequency sample data of an electrocardio signal, and performing time-frequency conversion to obtain time sample data; obtaining a time coding sequence and a frequency coding sequence; establishing an intra-time-frequency comparative learning convolutional neural network model, and training the intra-time-frequency comparative learning convolutional neural network model by using the positive sample pair; establishing an inter-time-frequency comparative learning convolutional neural network model, and training the inter-time-frequency comparative learning convolutional neural network model by using the positive sample pair; guiding model convergence by using a total loss function to obtain a trained time-frequency internal comparative learning convolutional neural network model and a trained time-frequency internal comparative learning convolutional neural network model; real-time electrocardiosignals are collected, and electrocardiosignal anomaly detection is carried out according to the steps. According to the method, the accuracy of abnormal electrocardiogram detection is improved through an intra-time-frequency and inter-time-frequency comparison learning mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of electrocardiogram time series data processing, and relates to an electrocardiogram anomaly detection method based on time-frequency enhancement self-supervised contrast learning. Background Art

[0002] Electrocardiogram (ECG) is an important clinical measurement method for examining various cardiovascular diseases caused by the electrical activity of the heart, such as atrial fibrillation, atrial premature beats, or severe ventricular arrhythmias. With the development of artificial intelligence, neural networks are used to extract and classify ECG signals, but these network architectures are often based on supervised learning, which requires a large amount of labeled data to train the model. Data labeling is a time-consuming and laborious process, so it is necessary to use self-supervised comparative learning for ECG abnormality detection to solve the problem of scarce labels.

[0003] In self-supervised deep learning, it is particularly important to create representations that help the model learn robust and distinguishable. Typically, time series data enhancement methods are based on transformation enhancement and mask enhancement, such as jittering, flipping, rotation, permutation, time random-masking, and time band-masking. However, these transformations can cause the original ECG signal to become an abnormal ECG signal, or even lose the characteristics of the ECG signal, thereby reducing the accuracy of ECG abnormality detection. Summary of the invention

[0004] In view of the technical problem that the existing self-supervised learning data enhancement methods affect the accuracy of ECG anomaly detection, the present invention provides an ECG anomaly detection method based on self-supervised contrastive learning with time-frequency enhancement. Through the intra-time-frequency and inter-time-frequency contrast learning mechanisms and by designing a feature-level sample data enhancement generator, the difficult problem of positive and negative sample selection in contrastive learning and the impact on anomaly detection are solved, thereby improving the accuracy of ECG anomaly detection.

[0005] To achieve the above object, the present invention adopts the following technical solutions:

[0006] The present invention provides a method for detecting electrocardiogram anomalies based on time-frequency enhancement self-supervised contrastive learning, comprising the following steps:

[0007] S1. Obtain frequency sample data of ECG signal Time sample data is obtained by time-frequency conversion

[0008] S2. Time sample data Input into the time encoder to get the time code sequence The frequency sample data Input into the frequency encoder to get the frequency code sequence

[0009] S3. Establish a time-frequency contrast learning convolutional neural network model to encode the sequence in time. and frequency coded sequences The original sample data Z is sampled on the feature space of , and is input into the feature enhancement generator in the intra-time-frequency contrastive learning convolutional neural network model to obtain the enhanced sample data Z′. The original sample data Z and the enhanced sample data Z′ are used as positive sample pairs to train the intra-time-frequency contrastive learning convolutional neural network model.

[0010] S4. Establish a time-frequency contrast learning convolutional neural network model to encode the time sequence and frequency coded sequences Used as positive sample pairs to train the time-frequency contrastive learning convolutional neural network model;

[0011] S5. Guide the model convergence with the total loss function to obtain the trained intra-time-frequency contrast learning convolutional neural network model and the inter-time-frequency contrast learning convolutional neural network model;

[0012] S6. Collect real-time ECG signals and perform ECG signal abnormality detection in the order of steps S1 to S5.

[0013] In the above technical solution of the present invention, the feature enhancement generator is composed of a feature enhancement encoder and a feature enhancement decoder.

[0014] In the above technical solution of the present invention, the total loss function integrates two models to learn the internal features and the correlation and complementarity between time-based and frequency-based embeddings, and analyzes from multiple time-frequency perspectives. The calculation formula of the total loss function is as follows:

[0015]

[0016] in: is the loss function of the intra-time-frequency contrastive learning convolutional neural network model, is the loss function of the time-frequency contrast learning convolutional neural network model, λ is the trade-off parameter of each loss function, λ=0.6.

[0017] In the above technical solution of the present invention, the calculation formula of the loss function of the time-frequency intra-contrast learning convolutional neural network model is as follows:

[0018]

[0019] Where: N is the number of positive sample logarithms of the input time-frequency contrastive learning convolutional neural network model; sim() is the cosine similarity; C1() is the function of the distance between the sample of the input time-frequency contrastive learning convolutional neural network model and the network center,

[0020] In the above technical solution of the present invention, the calculation formula of the loss function of the time-frequency contrast learning convolutional neural network model is as follows:

[0021]

[0022] Where: N′ is the number of positive sample logs of the time-frequency contrast learning convolutional neural network model; sim() is the cosine similarity; C2() is the function of the distance between the sample input to the time-frequency contrast learning convolutional neural network model and the network center,

[0023] It is worth noting that when performing real-time ECG signal abnormality detection, the present invention uses the overall abnormality score S T To evaluate the proportion of abnormal ECG signals.

[0024] S T =S F +S C ,

[0025] Where: SF is the abnormal signal score output by the time-frequency contrast learning convolutional neural network model, S F =2-sim(Z,C1)-sim(Z′,C1),0 F ≤2; S C The abnormal signal score output by the convolutional neural network model for time-frequency comparison learning,

[0026] Compared with the prior art, the present invention has the following beneficial effects:

[0027] The present invention proposes an intra-time-frequency and inter-time-frequency contrast learning mechanism. The intra-time-frequency contrast learning network can learn the cross-domain features of ECG signals in the time-frequency space and capture the abnormal distribution of ECG data in different time-frequencies. The inter-time-frequency contrast learning network makes the time representation close to the frequency representation to learn the abnormal distribution of ECG data between time and frequency and deeply mine the internal features of ECG from the time and frequency. A feature-level sample data enhancement generator is designed in the intra-time-frequency contrast learning model to perform sampling in the sample feature space and generate feature-enhanced samples by analyzing the latent variables of the data from the feature perspective, thus solving the problem of positive and negative sample selection in contrastive learning and the impact on anomaly detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 ​It is a schematic diagram of the principle of ECG anomaly detection based on time-frequency enhanced self-supervised contrast learning of the present invention.

[0029] Figure 2 It is the sensitivity experimental result of the trade-off parameter (λ) in the total loss function guidance model of the present invention. DETAILED DESCRIPTION

[0030] The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention. Unless otherwise specified, the technical means used in the examples are conventional means known to those skilled in the art. The test methods in the following examples are conventional methods unless otherwise specified.

[0031] Embodiment 1

[0032] refer to Figure 1 The schematic diagram of the principle of ECG anomaly detection based on time-frequency enhanced self-supervised contrastive learning of the present invention is shown. The time encoder and the frequency encoder use the same architecture, both consisting of four convolutional blocks. Each block contains a Conv1D layer, where the first block uses the ReLU activation function. The second and third blocks combine the BatchNormalization layer and the RULR activation function, and the fourth block contains a MaxPool1D layer. Feature enhancement generator G T It consists of a feature enhancement encoder and a feature enhancement decoder.

[0033] The ECG anomaly detection method based on time-frequency enhanced self-supervised contrastive learning in this embodiment includes the following specific steps:

[0034] S1. Obtain frequency sample data of ECG signal Time sample data is obtained by time-frequency conversion

[0035] S2. Time sample data Input into the time encoder to get the time code sequence The frequency sample data Input into the frequency encoder to get the frequency code sequence

[0036] S3. Establish a time-frequency contrast learning convolutional neural network model to encode the sequence in time. and frequency coded sequences The original sample data Z is sampled on the feature space of , and is input into the feature enhancement generator in the intra-time-frequency contrastive learning convolutional neural network model to obtain the enhanced sample data Z′. The original sample data Z and the enhanced sample data Z′ are used as positive sample pairs to train the intra-time-frequency contrastive learning convolutional neural network model.

[0037] S4. Establish a time-frequency contrast learning convolutional neural network model to encode the time sequence and frequency coded sequences Used as positive sample pairs to train the time-frequency contrastive learning convolutional neural network model;

[0038] S5, guiding the model convergence with the total loss function shown in formula (1), and obtaining the trained intra-time-frequency contrast learning convolutional neural network model and the inter-time-frequency contrast learning convolutional neural network model;

[0039] S6. Collect real-time ECG signals, perform ECG signal abnormality detection in the order of steps S1 to S5, and calculate the abnormal signal ratio.

[0040] The data sets used for the experimental comparison are as follows:

[0041] CPSC202: This is a dataset designed for developing algorithms to detect atrial fibrillation (AF) events from dynamic electrocardiogram (ECG) records. The dataset contains 32,255 2-lead long-term Holter monitoring records from 49 AF patients and 56 non-AF patients, with a sampling rate of 200 Hz. The training set, validation set, and test set contain 21,960, 4,550, and 5,745 records, respectively.

[0042] PTB-XL: This dataset contains 21,799 10-second 12-lead clinical ECG records from 188,869 patients with a sampling rate of 500 Hz. Each record is annotated by up to two cardiologists for diagnosis, and the categories mainly include: normal ECG, myocardial infarction, ST / T changes, conduction disorders, cardiac hypertrophy, and atrial fibrillation (AF). Among them, atrial fibrillation is classified as an abnormal category, and the others are defined as normal categories. The training set, validation set, and test set contain 4,000, 1,757, and 1,757 records, respectively.

[0043] BUTQDB: This is a dataset dedicated to electrocardiogram (ECG) quality assessment. The dataset contains 18 long single-lead ECG records with a sampling rate of 1000Hz. Signal quality is divided into three levels: Level 1 indicates the best quality, all key ECG waveforms are clearly visible; Level 2 indicates an increased noise level and unreliable detection of important ECG features; Level 3 indicates that the QRS complex cannot be reliably detected, making the signal unsuitable for further analysis.

[0044] VFDB: This dataset contains 22 half-hour two-lead ECG records from patients with sustained ventricular tachycardia (VT), ventricular flutter (VFL), and ventricular fibrillation (VF), with a sampling rate of 250Hz. After preprocessing, the dataset contains 3013 10-second ECG signals, including 1723 normal signals, 606 noise signals, 523 ventricular tachycardia signals, 98 ventricular flutter signals, and 63 ventricular fibrillation signals. In order to improve the model training effect, the two-lead data is split into single-lead data to expand the dataset.

[0045] MITBIH: This dataset contains 48 half-hour dual-channel Holter ECG records from 47 subjects, collected between 1975 and 1979. The sources of the records include 23 randomly selected records from 4,000 24-hour records at Beth Israel Hospital (60% of which were inpatients and 40% were outpatients), as well as 25 records containing less common but clinically important arrhythmias. The data sampling rate is 360Hz and is annotated by multiple ECG experts. After preprocessing, the dataset generates 33,930 10-second ECG signal records, of which 33,694 are normal / noise signals and 236 are ventricular fibrillation (VF) or ventricular flutter (VFL) signals. For model training, the dual-channel data is split into single-channel data to expand the dataset.

[0046] CUDB: This dataset contains 35 8-minute ECG records from patients with sustained ventricular tachycardia (VT), ventricular flutter (VFL), and ventricular fibrillation (VF). It is a database dedicated to the study of rapid arrhythmias. Because the detector responds earlier to the rhythm changes before VF, a negative "alarm time" is displayed before the onset of VF. The minimum number of non-VF episodes before VF occurs is 61, and the average onset time of VF is 5 minutes and 47 seconds. After preprocessing, the dataset contains 19,985 ECG signals, including 19,653 normal signals, 19 noise signals, 5 ventricular tachycardia signals, and 208 ventricular fibrillation / ventricular flutter signals.

[0047] In order to compare the weights of the loss functions of the two contrastive learning network models, intra-time-frequency and inter-time-frequency, in the total loss function, a sensitivity experiment on the trade-off parameter (λ) was conducted on six datasets based on the AUC and AP indicators. The results are shown in Figure 2 As shown. In summary, when the parameter is too large, the model tends to prioritize mapping normal ECG signals to the center of the hypersphere, while ignoring the task of mapping abnormal ECG signals to the center of the hypersphere. On the contrary, when the trade-off parameter is too small, the task of mapping normal ECG signals to the center of the hypersphere cannot be fully optimized. Therefore, during the model training process, it is necessary to adjust and optimize the trade-off parameter to maintain a balance between the two tasks to achieve optimal performance. In this embodiment, λ = 0.6.

[0048] In order to verify the superiority of the ECG anomaly detection model of the present invention, tests were conducted on the remaining data sets, and TFCL was evaluated by comparing it with other anomaly detection models, contrastive learning models, and multimodal contrastive learning models. The results are shown in Table 1.

[0049] Table 1 Model test comparison results

[0050]

[0051] It can be seen from Table 1 that the detection model proposed in the present invention performs better than other models on all datasets. For example, on the CPSC2021 dataset, the AUC and AP indicators of the proposed model are up to 2.8% and 5.67% higher than those of all benchmark models; on the MIT BIH dataset, the AUC and AP indicators are up to 13.92% and 15.74% higher.

[0052] Traditional unsupervised anomaly detection methods rely heavily on the definition of normal and abnormal classes, while normal samples may only reflect part of the overall normality. Self-supervised contrastive learning can learn normality representation more comprehensively by comparing normal data from more angles.

[0053] Traditional contrastive learning enhancement methods such as jittering, permutation, and flipping will turn the original normal ECG signal into an abnormal ECG signal or even lose the characteristics of the physiological signal. In other words, the enhanced sample is similar to the abnormal ECG sample. At this time, the anomaly detection model not only learns the characteristics of the original normal ECG signal, but also learns the enhanced abnormal ECG characteristics, which causes the boundaries of the normal data features to become blurred, thereby greatly reducing the performance of ECG anomaly detection.

[0054] The self-supervised contrastive learning proposed in the present invention aims to use a feature extractor to convert the original samples into slightly different enhanced samples through conversion enhancement, mask enhancement, and proximity enhancement to construct positive sample pairs, measure the embedding distance between the original samples and the enhanced samples to make the feature embedding of the positive sample pairs as close as possible in the sample space, and measure the embedding distance between the original enhancement and the enhancement of another input sample to make the negative sample pairs farther apart, thereby solving the problem of positive and negative sample selection in contrastive learning and the impact on anomaly detection.

[0055] The embodiments described above are only preferred embodiments of the present invention and are only used to explain the present invention, not to limit the scope of implementation of the present invention. For those skilled in the art, other implementation methods can certainly be easily made by replacement or modification based on the technical contents disclosed in this specification. Therefore, all changes and improvements made on the principles of the present invention should be included in the scope of the patent application of the present invention.

Claims

1. A method for detecting electrocardiogram abnormalities based on time-frequency enhanced self-supervised contrastive learning, characterized in that: The following steps are involved: S1. Obtain frequency sample data of ECG signal Time sample data is obtained by time-frequency conversion S2. Time sample data Input into the time encoder to get the time code sequence The frequency sample data Input into the frequency encoder to get the frequency code sequence S3. Establish a time-frequency contrast learning convolutional neural network model to encode the sequence in time. and frequency coded sequences The original sample data Z is sampled on the feature space of , and is input into the feature enhancement generator in the intra-time-frequency contrastive learning convolutional neural network model to obtain the enhanced sample data Z′. The original sample data Z and the enhanced sample data Z′ are used as positive sample pairs to train the intra-time-frequency contrastive learning convolutional neural network model. S4. Establish a time-frequency contrast learning convolutional neural network model to encode the time sequence and frequency coded sequences Used as positive sample pairs to train the time-frequency contrastive learning convolutional neural network model; S5. Guide the model convergence with the total loss function to obtain the trained intra-time-frequency contrast learning convolutional neural network model and the inter-time-frequency contrast learning convolutional neural network model; S6. Collect real-time ECG signals and perform ECG signal abnormality detection in the order of steps S1 to S5.

2. The method for detecting abnormal electrocardiogram according to claim 1, characterized in that: The feature enhancement generator is composed of a feature enhancement encoder and a feature enhancement decoder.

3. The method for detecting abnormal electrocardiogram according to claim 1, characterized in that: The calculation formula of the total loss function is as follows: in: is the loss function of the intra-time-frequency contrastive learning convolutional neural network model, is the loss function of the time-frequency contrast learning convolutional neural network model, λ is the trade-off parameter of each loss function, λ=0.

6.

4. The method for detecting abnormal electrocardiogram according to claim 1, characterized in that: The calculation formula of the loss function of the intra-time-frequency contrast learning convolutional neural network model is as follows: Where: N is the number of positive sample logarithms of the input time-frequency contrastive learning convolutional neural network model; sim() is the cosine similarity; C1() is the function of the distance between the sample of the input time-frequency contrastive learning convolutional neural network model and the network center, 5. The method for detecting abnormal electrocardiogram according to claim 1, characterized in that: The calculation formula of the loss function of the time-frequency contrast learning convolutional neural network model is as follows: Where: N′ is the number of positive sample logs of the time-frequency contrast learning convolutional neural network model; sim() is the cosine similarity; C2() is the function of the distance between the sample input to the time-frequency contrast learning convolutional neural network model and the network center,

Citation Information

Patent Citations

  • Method and device for detecting network intrusion, medium and electronic equipment

    CN117278311A

  • Multi-dimensional time sequence anomaly detection method based on time-frequency domain comparative learning and reconstruction

    CN118861938A

  • A method to detect myocardial ischemia using comparison analysis of heart rate variability time and frequency domain features

    KR1020130011567A

  • Method for enhancing audio-visual association by adopting self-supervised curriculum learning

    US20220165171A1

  • Apparatus and method to accomplish turbine meter output pulse multiplication

    US3808543A