ECG contrastive learning feature extraction method, system, device and readable storage medium
By improving the ConvNeXt network and the comparison learning framework, the 12-lead ECG data is preprocessed and data enhanced, and the feature representation of the ECG data is extracted, which solves the problems of poor central electrical feature extraction effect and inconsistent standards of different equipment, and achieves more efficient and accurate ECG feature extraction.
Patent Information
- Application Number
- CN202211187677.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-28
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2042-09-28
AI Technical Summary
The existing electrocardiogram feature extraction methods cannot fully utilize data information when the training data length is short, resulting in poor feature extraction effect, and the standards of different models of electrocardiogram equipment do not uniformly affect feature extraction.
The ECG comparison learning feature extraction method based on improved ConvNeXt is adopted, and the feature representation of the ECG data is extracted by pre-processing and data augmentation of 12-lead ECG data, and the comparison learning framework is used for pre-training, and combined with technologies such as global average pooling and global maximum pooling, the feature representation of the ECG data is extracted.
It effectively alleviates the long-tail problem, improves the accuracy and stability of ECG feature extraction, can make full use of data information, adapt to ECG data of different lengths, and eliminates the impact of different standard ECG equipment on feature extraction.
Smart Images

Figure CN115568859B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of deep learning, and particularly relates to a method, system, device and readable storage medium for electrocardiogram contrast learning feature extraction. Background Art
[0002] In medical institutions, electrocardiogram measurements are required for all heart-related symptoms, which results in a large amount of unlabeled electrocardiogram datasets accumulated daily. Moreover, only clinicians and relevant experts can annotate these data. For these doctors, data annotation greatly increases their workload.
[0003] The lack of labeled data limits the number of samples available for direct training in deep learning, so that rare case data cannot be fully trained, which will cause certain data biases, resulting in the problem of low training result accuracy. The current electrocardiogram feature extraction methods are mainly used for electrocardiogram classification: one is to directly use a deep learning model for training to obtain classification results, but this method is prone to serious long-tail problems; the other is to use the contrast learning method to pre-train a large amount of electrocardiogram data, but this method ignores the problem of inconsistent standards between different types of electrocardiogram devices, which will affect the electrocardiogram feature extraction. And the current electrocardiogram feature extraction model still needs to be improved, and the length of the training data is generally intercepted short, and the given data information cannot be utilized more fully. Summary of the Invention
[0004] In order to solve the above problems, it is necessary to provide a method, system, device and readable storage medium for electrocardiogram contrast learning feature extraction.
[0005] The first aspect of the present invention provides an electrocardiogram contrast learning feature extraction method based on improved ConvNeXt, including the following steps:
[0006] Step 1, preprocess the 12-lead electrocardiogram data and input it into the contrast learning framework, and perform pre-training by minimizing the value of the NT-Xent loss function;
[0007] Among them, the backbone network of the contrast learning framework adopts an improved network based on ConvNeXt, which is obtained by the following method:
[0008] All the original two-dimensional convolutions are changed to one-dimensional convolution Conv1d, and the numerical value of each dimension change is changed to 12, 32, 64, 128, 256. The stride and convolution kernel size of the first convolution are both changed to 6. In each block, the positions of the depth convolution kernel DW Conv1d and layer normalization Layer Norm are changed after the GELU activation function, and the Layer Scale operation is replaced with SE Net;
[0009] The contrast learning method of the contrast learning framework is implemented as follows:
[0010] The original 12-lead ECG data is divided into two parts, and after data augmentation respectively, it is input into the backbone network to extract features. Then, through the combination of global average pooling GAP and global max pooling GMP, a linear layer Linear, an activation function ReLU, and batch normalization BN, the feature representation of the ECG data is output. Finally, the results of the two runs are backpropagated through the NE-Xent loss function for the entire contrast learning framework;
[0011] Step 2: Input the original 12-lead ECG data into the backbone network pre-trained in Step 1 for feature extraction. Through the combination of global average pooling GAP and global max pooling GMP, and then pass through the linearly connected linear layer Linear, activation function ReLU, and Dropout layer twice. Finally, through the linear layer Linear and the Sigmoid function, the logical classification probability of the ECG data is output, that is, the predicted result.
[0012] The second aspect of the present invention provides an ECG contrast learning feature extraction system based on improved ConvNeXt, including:
[0013] A data preprocessing module for preprocessing 12-lead ECG data;
[0014] A contrast learning module, connected to the data preprocessing module, for inputting the preprocessed 12-lead ECG data into the contrast learning framework and performing pre-training by minimizing the NT-Xent loss function value;
[0015] Among them, the backbone network of the contrast learning framework adopts an improved network based on ConvNeXt, which is obtained by the following method:
[0016] All original two-dimensional convolutions are changed to one-dimensional convolutions Conv1d, and the numerical value of each dimension change is 12, 32, 64, 128, 256. The stride and convolution kernel size of the first convolution are both changed to 6. In each block, the positions of the depth convolution kernel DW Conv1d and layer normalization Layer Norm are changed after the GELU activation function, and the Layer Scale operation is replaced with SE Net;
[0017] The contrast learning method of the contrast learning framework is implemented as follows:
[0018] The original 12-lead electrocardiogram (ECG) data is divided into two parts and input into the backbone network after data augmentation respectively to extract features. Then, through the combination of global average pooling (GAP) and global max pooling (GMP), a linear layer (Linear), a rectified linear unit (ReLU) activation function, and batch normalization (BN), the feature representation of the ECG data is output. Finally, the results of the two runs are backpropagated through the NE-Xent loss function for the entire contrastive learning framework.
[0019] The downstream task module, connected to the data preprocessing module and the contrastive learning module, is used to input the original 12-lead ECG data into the pre-trained backbone network for feature extraction. After the combination of global average pooling (GAP) and global max pooling (GMP), it passes through the sequentially connected linear layer (Linear), rectified linear unit (ReLU) activation function, and Dropout layer twice, and finally outputs the logical classification probability of the ECG data, that is, the predicted result, through the linear layer (Linear) and the sigmoid function.
[0020] The third aspect of the present invention provides an ECG contrastive learning feature extraction device, including:
[0021] A memory; and
[0022] A processor coupled to the memory, the processor being configured to execute the above-mentioned ECG contrastive learning feature extraction method based on instructions stored in the memory.
[0023] The fourth aspect of the present invention provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the above-mentioned ECG contrastive learning feature extraction method based on the improved ConvNeXt.
[0024] The present invention has prominent substantive features and significant progress compared with the prior art. Specifically:
[0025] 1. The method of the present invention uses the contrastive learning method to alleviate the impact of the long-tail problem on the results, only needs to train on the existing data, does not require a large amount of other data, and eliminates the influence of the datasets collected by different standard ECG devices on feature extraction.
[0026] 2. The method of the present invention uses data with a length of 30,000, that is, 1-minute length of ECG data, which fully utilizes more complete data information while considering the limitations of the input neural network size.
[0027] 3. The backbone network used in the present invention can adapt to the length of the input data and can extract ECG features more fully.
[0028] The additional aspects and advantages of the present invention will become apparent in the following description section or be understood through the practice of the present invention. Description of the Drawings
[0029] The above and / or additional aspects and advantages of the present invention will become apparent and be readily understood from the description of the embodiments in conjunction with the following drawings, wherein:
[0030] Figure 1 is the topology diagram of the backbone network in Embodiment 1 of the present invention.
[0031] Figure 2 is the topology diagram of the contrast learning framework in Embodiment 1 of the present invention.
[0032] Figure 3 is the topology diagram of implementing Step 2 in Embodiment 1 of the present invention.
[0033] Figure 4 is the principle block diagram of the system in Embodiment 2 of the present invention. Detailed Embodiments
[0034] In order to more clearly understand the above objects, features, and advantages of the present invention, the present invention will be further described in detail below in conjunction with the drawings and specific embodiments. It should be noted that, without conflict, the embodiments of the present application and the features in the embodiments can be combined with each other.
[0035] In the following description, many specific details are set forth in order to fully understand the present invention. However, the present invention can also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited by the specific embodiments disclosed below.
[0036] Embodiment 1
[0037] As shown in Figure 1 , Figure 2 and Figure 3 , this embodiment proposes an electrocardiogram contrast learning feature extraction method based on improved ConvNeXt, including the following steps:
[0038] Step 1: After preprocessing the 12-lead electrocardiogram data, input it into the contrast learning framework and perform pre-training by minimizing the NT-Xent loss function value;
[0039] Among them, the preprocessing of the electrocardiogram data includes:
[0040] Interception and filling of the electrocardiogram signal: Intercept the data with a length of 30,000 at the end, and fill the data with less than 30,000;
[0041] Data augmentation: Used in the contrast learning method, including one or a combination of random up and down flipping, random resampling, random amplitude change, adding Gaussian noise, adding baseline drift, and masking the electrocardiogram signals of certain leads;
[0042] The backbone network of the contrastive learning framework uses an improved network based on ConvNeXt, which is obtained by the following method:
[0043] All the original two-dimensional convolutions are changed to one-dimensional convolution Conv1d. The numerical value of each dimension change is 12, 32, 64, 128, 256. The stride and convolution kernel size of the initial convolution are both changed to 6. In each block, the positions of the depth convolution kernel DW Conv1d and layer normalization Layer Norm are changed after the GELU activation function, and the Layer Scale operation is replaced with SE Net;
[0044] The contrastive learning method of the contrastive learning framework is implemented in the following way:
[0045] The original 12-lead ECG data is divided into two parts. After data augmentation respectively, it is input into the backbone network to extract features. Then, through the combination of global average pooling GAP and global maximum pooling GMP, linear layer Linear, activation function ReLU, and batch normalization BN, the feature representation of the ECG data is output. Finally, the results of the two runs are backpropagated through the NE-Xent loss function for the entire contrastive learning framework;
[0046] Step 2: Input the original 12-lead ECG data into the backbone network pre-trained in Step 1 for feature extraction. After passing through the combination of global average pooling GAP and global maximum pooling GMP, it passes through the linearly connected linear layer Linear, activation function ReLU, and Dropout layer twice. Finally, through the linear layer Linear and Sigmoid function, the logical classification probability of the ECG data is output, that is, the predicted result.
[0047] Comparative experiment
[0048] This experiment is an ECG multi-label classification task on the CPSC2018 dataset, with a total of 6,877 datasets. They are divided into a training set, a validation set, and a test set according to 7:1:2. The F1 score is a commonly used evaluation metric in classification problems in machine learning. The higher the score, the better the accuracy of the result. Using this metric as the evaluation criterion, if there is no improvement in the validation set after 50 rounds, the training ends. The best training weights are selected to be tested on the test set as the final result.
[0049] According to the experiment results, the F1 score of the method in this embodiment in the classification task can reach 86.04%, and the accuracy rate can reach 97.13%. It can be seen that it can reach the practical level, thus reducing the labor cost.
[0050] Embodiment 2
[0051] Such as Figure 4As shown in the figure, this embodiment provides an electrocardiogram contrast learning feature extraction system based on the improved ConvNeXt, including:
[0052] A data preprocessing module for preprocessing 12-lead electrocardiogram data; among them, the preprocessing of electrocardiogram data includes:
[0053] Interception and filling of electrocardiogram signals: Intercept the data with a length of 30,000 at the end, and fill the data with less than 30,000.
[0054] Data augmentation: used in the contrast learning method, including one or a combination of random up and down flipping, random resampling, random amplitude change, adding Gaussian noise, adding baseline drift, and masking the electrocardiogram signals of certain leads.
[0055] A contrast learning module, connected to the data preprocessing module, for inputting the preprocessed 12-lead electrocardiogram data into the contrast learning framework and performing pre-training by minimizing the NT-Xent loss function value.
[0056] Among them, the backbone network of the contrast learning framework adopts an improved network based on ConvNeXt, which is obtained by the following method:
[0057] All the original two-dimensional convolutions are changed to one-dimensional convolution Conv1d, and the numerical value of each dimension change is changed to 12, 32, 64, 128, 256. The stride and convolution kernel size of the first convolution are both changed to 6. In each block, the positions of the depth convolution kernel DW Conv1d and layer normalization Layer Norm are changed after the GELU activation function, and the Layer Scale operation is replaced with SE Net.
[0058] The contrast learning method of the contrast learning framework is implemented in the following way:
[0059] The original 12-lead electrocardiogram data is divided into two times and input into the backbone network after data augmentation respectively to extract features, and then through the combination of global average pooling GAP and global maximum pooling GMP, linear layer Linear, activation function ReLU and batch normalization BN to output the feature representation of the electrocardiogram data. Finally, the results of the two runs are backpropagated through the NE-Xent loss function for the entire contrast learning framework.
[0060] The downstream task module, connected to the data preprocessing module and the contrast learning module, is used to input the original 12-lead electrocardiogram data into the pre-trained backbone network for feature extraction. After a combination of global average pooling (GAP) and global max pooling (GMP), it passes through a linear layer (Linear), a ReLU activation function, and a Dropout layer connected in sequence twice, and finally outputs the logical classification probability of the electrocardiogram data, that is, the predicted result, through a linear layer (Linear) and a Sigmoid function.
[0061] Embodiment 3
[0062] This embodiment provides an electrocardiogram contrast learning feature extraction device, including:
[0063] A memory; and
[0064] A processor coupled to the memory, the processor being configured to execute the electrocardiogram contrast learning feature extraction method based on the improved ConvNeXt described in Embodiment 1 according to the instructions stored in the memory.
[0065] Among them, the memory may include, for example, a system memory, a fixed non-volatile storage medium, etc. The system memory stores, for example, an operating system, application programs, a boot loader, and other programs.
[0066] The electrocardiogram contrast learning feature extraction device may further include an input / output interface, a network interface, a storage interface, etc. These interfaces and the memory and the processor may be connected through a bus, for example. Among them, the input / output interface provides a connection interface for input / output devices such as a display, a mouse, a keyboard, and a touch screen. The network interface provides a connection interface for various networking devices. The storage interface provides a connection interface for external storage devices such as an SD card and a USB flash drive.
[0067] Embodiment 4
[0068] This embodiment provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the electrocardiogram contrast learning feature extraction method based on the improved ConvNeXt described in Embodiment 1.
[0069] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer non-transitory readable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer program code.
[0070] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as combinations of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, embedded processors, or other programmable data processing devices to generate a machine, such that the instructions executed by the processors of the computer or other programmable data processing devices produce means for implementing the functions specified in one or more flows and / or blocks. Figure 1 in one or more flows and / or blocks Figure 1 or in one or more blocks.
[0071] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including instruction means for implementing the functions specified in one or more flows and / or blocks. Figure 1 in one or more flows and / or blocks Figure 1 or in one or more blocks.
[0072] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more flows and / or blocks. Figure 1 in one or more flows and / or blocks Figure 1 or in one or more blocks.
[0073] As mentioned above, the above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. An electrocardiogram contrast learning feature extraction method based on improved ConvNeXt, characterized in that It includes the following steps: Step 1: Preprocess the 12-lead ECG data and input it into the contrastive learning framework, and perform pre-training by minimizing the NT-Xent loss function value; Among them, the backbone network of the contrastive learning framework adopts an improved network based on ConvNeXt, which is obtained by the following method: Change all the original two-dimensional convolutions to one-dimensional convolution Conv1d, and change the numerical value of each dimension change to 12, 32, 64, 128, 256. The stride and kernel size of the first convolution are both changed to 6. In each block, the positions of the depth convolution kernel DW Conv1d and layer normalization Layer Norm are changed after the GELU activation function, and the Layer Scale operation is replaced with SE Net; The contrastive learning method of the contrastive learning framework is implemented in the following way: Divide the original 12-lead ECG data into two parts, input them into the backbone network after data augmentation respectively to extract features, then through the combination of global average pooling GAP and global max pooling GMP, linear layer Linear, activation function ReLU and batch normalization BN to output the feature representation of the ECG data. Finally, the results of the two runs are backpropagated through the NE-Xent loss function to the entire contrastive learning framework; Step 2: Input the original 12-lead ECG data into the backbone network pre-trained in Step 1 for feature extraction, through the combination of global average pooling GAP and global max pooling GMP, then pass through the linearly connected linear layer Linear, activation function ReLU and Dropout layer twice, and finally pass through the linear layer Linear and Sigmoid function to output the logical classification probability of the ECG data, that is, the predicted result.
2. The electrocardiogram contrast learning feature extraction method based on improved ConvNeXt according to claim 1, characterized in that The preprocessing of the ECG data includes: Interception and filling of the ECG signal: Intercept the data with a length of 30,000 at the end, and fill the data less than 30,000; Data augmentation: Used in the contrastive learning method, including one or more combinations of random up and down flipping, random resampling, random amplitude change, adding Gaussian noise, adding baseline drift, and masking the ECG signals of certain leads.
3. An electrocardiogram contrast learning feature extraction system based on improved ConvNeXt, characterized in that It includes: A data preprocessing module for preprocessing 12-lead ECG data; A contrastive learning module, connected to the data preprocessing module, for inputting the preprocessed 12-lead ECG data into the contrastive learning framework and performing pre-training by minimizing the NT-Xent loss function value; Among them, the backbone network of the contrastive learning framework adopts an improved network based on ConvNeXt, which is obtained by the following method: Change all the original two-dimensional convolutions to one-dimensional convolution Conv1d, and change the numerical value of each dimension change to 12, 32, 64, 128, 256. The stride and kernel size of the first convolution are both changed to 6. In each block, the positions of the depth convolution kernel DW Conv1d and layer normalization Layer Norm are changed after the GELU activation function, and the Layer Scale operation is replaced with SE Net; The contrastive learning method of the contrastive learning framework is implemented in the following way: The original 12-lead ECG data is divided into two parts and input into the backbone network after data augmentation respectively to extract features. Then, through the combination of global average pooling (GAP) and global max pooling (GMP), linear layer (Linear), activation function ReLU, and batch normalization (BN), the feature representation of the ECG data is output. Finally, the results of the two runs are backpropagated through the NE-Xent loss function for the entire contrastive learning framework. The downstream task module, connected to the data preprocessing module and the contrastive learning module, is used to input the original 12-lead ECG data into the pre-trained backbone network for feature extraction. After passing through the combination of global average pooling (GAP) and global max pooling (GMP), it passes through the linear layer (Linear), activation function ReLU, and Dropout layer connected in sequence twice. Finally, through the linear layer (Linear) and Sigmoid function, the logical classification probability of the ECG data, that is, the predicted result, is output.
4. The electrocardiogram contrast learning feature extraction system based on improved ConvNeXt according to claim 3, characterized in that The preprocessing of the ECG data includes: Interception and filling of the ECG signal: Intercept the data with a length of 30,000 at the end, and fill the data with less than 30,000. Data augmentation: Used in the contrastive learning method, including one or more combinations of random up and down flipping, random resampling, random amplitude change, adding Gaussian noise, adding baseline drift, and masking the ECG signals of certain leads.
5. An electrocardiogram contrast learning feature extraction device, comprising: Memory; and a processor coupled to the memory, the processor being configured to execute the ECG contrastive learning feature extraction method according to any one of claims 1-2 based on instructions stored in the memory.
6. A non-transitory computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the electrocardiogram contrast learning feature extraction method according to any one of claims 1-2.
Citation Information
Patent Citations
Electrocardiogram data processing method and device based on comparative learning and storage medium
CN113723519A
Target tracking method based on long-term and short-term integrated appearance updating mechanism
CN114972435A