Pregnant and lying-in woman electrocardiogram data enhancement method based on diffusion model
Through the diffusion model-based ECG data enhancement method, the problem of scarcity of ectopic heart beat data in ECG of pregnant women is solved, high-quality ECG data is generated, and the performance and generalization ability of the ECG classification model are improved. It is suitable for multiple The tag classification task solves the problems of data imbalance and poor model performance.
Patent Information
- Application Number
- CN202410964491.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-11-19
AI Technical Summary
The scarcity of ectopic heart beat data and multi-label data in pregnant women's electrocardiograms leads to data imbalance in electrocardiogram diagnosis and low model performance, making it difficult to obtain high-quality training data for composite arrhythmia.
Using the diffusion model-based ECG data enhancement method for pregnant women, the existing ECG signals are learned and the electrocardiogram data that meets the multi-label diagnostic needs are generated, including sliding slices, noise processing and deep learning. Model training to achieve high-quality data generation.
Effectively solve the problem of data imbalance, improve the performance and generalization ability of the ECG classification model, and the generated data quality is high, suitable for multi-label classification tasks, enhance the robustness and adaptability of the model, and is suitable for pregnant women and ECG and Other types of ECG data enhancement.
Smart Images

Figure CN118981636A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electrocardiogram (ECG) signal processing, and in particular to a method for enhancing electrocardiogram data of pregnant women based on a diffusion model. Background Art
[0002] In medical diagnosis, the electrocardiogram (ECG) is an important tool for detecting and analyzing the electrical activity of the heart. Especially for pregnant women, their cardiac electrical activity may be affected by various physiological and pathological factors, resulting in complex and changeable ECG signals. However, in clinical practice, ECG data with multiple heartbeat characteristics (such as signals containing both premature beats and atrial fibrillation) are very rare and difficult to obtain. The main reasons include the following:
[0003] (1) Low probability. For example, premature beats and atrial fibrillation are both ectopic heart beats. It is rare for a pregnant woman to have both premature beats and atrial fibrillation at the same time, and the probability is low. However, if it happens, it can be detected and reminded immediately, which will help remind the patient to seek medical treatment immediately or take medical intervention measures.
[0004] (2) Short duration. This type of complex arrhythmia is usually short-lived and intermittent, and is not easy to be "captured" during continuous monitoring.
[0005] (3) Difficult to detect. Clinically, problems are mainly detected through intermittent short-term monitoring. The probability of this mixed arrhythmia occurring during monitoring is very low.
[0006] (4) Scarcity of public databases: Public ECG databases contain very few samples of simultaneously occurring ectopic heart beats.
[0007] Due to the above reasons, this type of multi-label ECG data is very scarce, and it is difficult to construct a training set with sufficient data. It is very difficult to obtain ECG signals with multiple arrhythmias superimposed on each other, and it is necessary to improve monitoring methods and recognition algorithms to obtain more of this rare data. However, in the electrocardiogram diagnosis and detection algorithm, a large amount of data is required to find a suitable strategy or train a high-precision model to detect heartbeat classification.
[0008] In recent years, the diffusion model, as a generative model, has made significant progress in the field of machine learning, especially in text understanding and two-dimensional image generation. The diffusion model was first proposed in 1997, but it was not until 2020 that DeepMind combined it with deep learning in its Denoising Diffusion Probabilistic Models (DDPM), making this type of model widely used in text-to-image generation tasks. In 2021, the DALL-E model proposed by Anthropic further demonstrated the great potential of the diffusion model in generating high-quality images from text.
[0009] Given the advantages of diffusion models in generating high-quality and diverse samples, how to explore its application in medical data generation, especially for scarce multi-label ECG data, there is an urgent need for a maternal electrocardiogram data enhancement method based on a diffusion model to solve the problem of insufficient ECG ectopic heart beat data and scarce multi-label data in the existing technology. Summary of the invention
[0010] In view of this, in order to solve the problem of little ECG ectopic heart beat data and little multi-label data, the purpose of the present invention is to propose a maternal electrocardiogram data enhancement method based on a diffusion model, which learns the ECG signals of an existing database through the diffusion model, so that the required single or concurrent ectopic heart beat ECG data can be generated according to demand.
[0011] Based on the above purpose, in a first aspect, the present invention provides a method for enhancing electrocardiogram data of pregnant women based on a diffusion model, which learns ECG signals of an existing database through a diffusion model and generates the required single or concurrent ectopic heartbeat electrocardiogram data according to demand, and the method comprises the following steps:
[0012] Acquire ECG signals, record metadata of ECG signals, and unify signal sampling frequency;
[0013] Sliding slices are performed on the ECG signals with uniform signal sampling frequency, and the label vector is initialized;
[0014] Set the input noise module to generate a noise sequence with a length of n and a sampling frequency of fs, and set LN different noise levels;
[0015] Set up SIG_ENCODER, SIG_DECODER, label encoder and noise predictor modules, set up LOSS function, train SIG_ENCODER, SIG_DECODER, label encoder and noise predictor models, calculate KL divergence loss, back propagate to update parameters, and iterate training to obtain ECG signal diffusion model;
[0016] The trained ECG signal diffusion model is applied to generate electrocardiogram (ECG) data that meets multi-label diagnosis requirements.
[0017] As a further solution of the present invention, the ECG signal is acquired through device collection or a public database, and the metadata of the ECG signal includes the ECG signal lead, sampling frequency, wearing method, ECG signal forward / reverse and heart rhythm diagnosis type label; wherein:
[0018] Lead: describes which lead the ECG signal is recorded from (such as I, II, III, aVR, aVL, aVF, V1-V6).
[0019] Sampling frequency: describes the sampling rate of the ECG signal, that is, how many data points are collected per second (for example, 500Hz).
[0020] Wearing method: describes the way the sensor or electrode is worn or placed when collecting ECG signals.
[0021] ECG signal forward / reverse: describes the polarity direction of the signal, that is, whether the positive and negative poles of the signal need to be adjusted.
[0022] Heart rhythm diagnosis type label: describes the clinical diagnosis results or feature labels of ECG signals, such as sinus rhythm, atrial premature beats, ventricular premature beats, etc.
[0023] As a further solution of the present invention, when the signal sampling frequency is unified, the obtained ECG signal is downsampled or oversampled to a unified frequency fs; wherein the downsampling or upsampling method includes but is not limited to interpolation, sampling, and time-frequency domain conversion.
[0024] As a further solution of the present invention, when sliding slicing is performed on ECG signals with a uniform signal sampling frequency, a window with a length of n sampling points is used to slide and slice the ECG signals, and the sliding step length is s sampling points.
[0025] As a further solution of the present invention, when initializing the label vector, the heart rhythm diagnosis type label is cleaned, and the heart rhythm type label vector to be classified is set to M = [M1, M2, ..., M n], for the cardiac rhythm diagnosis type of each slice signal, the label vector N = [N1, N2, N3......] is initialized according to the cardiac rhythm type label vector M.
[0026] As a further solution of the present invention, for a noise sequence with a length of n and a sampling frequency of fs, the noise level set by the input noise module is determined by the average energy of the noise in the time domain. The higher the energy, the higher the noise level.
[0027] As a further solution of the present invention, the SIG_ENCODER module is used to encode the input ECG signal into a latent space vector (latent vector); the SIG_DECODER module is used to decode the latent space vector (latent vector) into an ECG signal; the label encoder module is used to encode the label vector N = [N1, N2, N3...] into a label vector (label vector); the noise_predictor module, the input is a label vector (label vector) and a noise signal, and the output is predicted noise (predict noise).
[0028] As a further solution of the present invention, the electrocardiogram data that meets the multi-label diagnosis requirements is generated as an ECG signal of atrial fibrillation and premature beats.
[0029] As a further solution of the present invention, a method for generating a one-dimensional noise vector by setting an input noise module comprises the following steps:
[0030] Generate a random number with mean avg and standard deviation std for each sampling point; connect the random numbers of all sampling points to form a one-dimensional signal sequence with a length of N;
[0031] Alternatively, a frequency spectrum uniformly distributed in the frequency range [f_min,f_max] is generated; through inverse Fourier transform, a white noise signal in the time domain is obtained.
[0032] As a further solution of the present invention, the SIG_ENCODER module is designed to include an 8-layer convolutional neural network structure, including:
[0033] The first layer is a one-dimensional convolution layer with 64 convolution kernels, a kernel size of 5, and a stride of 1, followed by a ReLU activation function and a one-dimensional maximum pooling layer.
[0034] The second layer is a one-dimensional convolution layer with 128 convolution kernels, a kernel size of 3, and a step size of 1, followed by a ReLU activation function and a one-dimensional maximum pooling layer.
[0035] The third layer is a one-dimensional convolution layer with 256 convolution kernels, a kernel size of 3, and a step size of 1. It is connected to a ReLU activation function and a one-dimensional maximum pooling layer.
[0036] The fourth layer is a one-dimensional convolution layer with 512 convolution kernels, a kernel size of 3, and a stride of 1. It is connected to a ReLU activation function and a one-dimensional maximum pooling layer.
[0037] The fifth layer is a one-dimensional convolution layer with 1024 convolution kernels, a kernel size of 3, a stride of 1, and a ReLU activation function and a one-dimensional maximum pooling layer.
[0038] The sixth layer is the flattening layer, which flattens the data;
[0039] The seventh layer is a fully connected layer with 256 neurons and a ReLU activation function.
[0040] The eighth layer is a fully connected layer with 64 neurons. It uses the ReLU activation function and outputs the latent space vector latentvector.
[0041] As a further solution of the present invention, the SIG_DECODER module is designed to include a 10-layer residual network (ResNet) structure, including:
[0042] A convolutional layer, containing 64 3×3 convolution kernels, with a stride of 1, outputting 64 feature maps;
[0043] A maximum pooling layer that performs a 2×2 pooling operation;
[0044] 4 residual modules, each module contains 2 layers of 3×3 convolutional layers, the number of convolution kernels is 64, 128, 256, and 512 respectively, and each convolution layer is followed by a BN layer and a ReLU activation function;
[0045] A global average pooling layer that aggregates feature maps into a feature vector;
[0046] A fully connected layer that outputs a one-dimensional vector.
[0047] As a further solution of the present invention, when training the SIG_ENCODER, SIG_DECODER, label encoder and noise predictor models, the training process includes:
[0048] Encoder extracts signal features, adds input noise of a certain noise level, and Label encoder extracts label vector features;
[0049] Decoder tries to reconstruct the signal, and noise predictor tries to reconstruct the noise;
[0050] Calculate the KL divergence between the predicted noise distribution predict noise and the prior target input noise to obtain KLLoss;
[0051] Calculate the total loss and back-propagate to update the parameters of SIG_ENCODER, SIG_DECODER, label encoder and noisepredictor;
[0052] Repeat the above process, slightly reducing LOSS each time, gradually approaching the original signal;
[0053] Repeat the above process with all training signals to complete model training.
[0054] The present invention provides a maternal electrocardiogram data enhancement method based on a diffusion model, which effectively generates high-quality electrocardiogram data that meets specific label requirements by designing SIG_ENCODER, SIG_DECODER, label encoder and noise predictor modules, thereby improving the performance of the electrocardiogram classification model. The present invention realizes high-quality ECG signal generation through refined signal processing and deep learning models, and provides effective technical support for maternal heart rhythm abnormality detection.
[0055] In another aspect of the present invention, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, any one of the above-mentioned maternal electrocardiogram data enhancement methods based on the diffusion model according to the present invention is executed.
[0056] In another aspect of the present invention, a computer-readable storage medium is provided, storing computer program instructions, which, when executed, implement any of the above-mentioned maternal electrocardiogram data enhancement methods based on the diffusion model according to the present invention.
[0057] Compared with the prior art, the method for enhancing electrocardiogram data of pregnant women based on a diffusion model proposed in the present invention has the following beneficial effects:
[0058] 1. Solved the problem of data imbalance. In the traditional electrocardiogram data collection process, there is often a problem of insufficient data of certain heart rhythm types, resulting in data imbalance. The present invention can generate data of multiple heart rhythm types through the diffusion model, effectively solving the problem of data imbalance and providing more comprehensive training data for the model.
[0059] 2. Improved model performance. By generating high-quality augmented data and providing more diverse training samples, the performance of the ECG classification model can be significantly improved. Especially in multi-label classification tasks, the model's generalization ability for different heart rhythm types is increased, reducing the risk of overfitting.
[0060] 3. High-quality data generation is achieved. The ECG data generated using the diffusion model is of high quality and can truly reflect the complexity and diversity of ECG signals. The generated data is not only close to the real ECG in morphology, but also contains noise characteristics of varying degrees, making the model more robust during training.
[0061] 4. Applicable to multi-label classification. The label encoder and decoder modules designed by the present invention can handle multi-label ECG classification tasks and adapt to complex clinical diagnosis needs. By encoding and decoding the label vector, accurate generation and classification of multiple heart rhythm types are achieved, improving the accuracy of diagnosis.
[0062] 5. Enhanced model generalization ability. By generating diverse training samples, the model can better generalize when facing unknown data, improving its performance in practical applications. The noise signal introduced by the diffusion model makes the generated data more diverse, further enhancing the generalization ability of the model.
[0063] 6. Flexible and controllable data generation is achieved. The present invention allows users to set specific labels and noise levels according to their needs, thereby generating ECG data that meets specific needs. It fully utilizes the advantages of different networks, ensures the high quality of generated data and the high accuracy of model prediction, and makes the data enhancement process more controllable and customized to adapt to different research and application scenarios.
[0064] In summary, the present invention provides a technical solution to the data imbalance problem by introducing a diffusion model for ECG data enhancement, significantly improving the performance and generalization ability of the ECG classification model. It is suitable for enhancing ECG data of pregnant women and other types of ECG data, and has important clinical application value and scientific research significance.
[0065] These and other aspects of the present application will be more concise and understandable in the following description of the embodiments. It should be understood that the above general description and the following detailed description are only exemplary and explanatory and cannot limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying creative work.
[0067] In the figure:
[0068] Figure 1 The present invention is a flowchart of a method for enhancing electrocardiogram data of pregnant women based on a diffusion model according to an embodiment of the present invention.
[0069] Figure 2 This is a schematic diagram of the training iteration in the method for enhancing electrocardiogram data of pregnant women based on a diffusion model according to an embodiment of the present invention.
[0070] Figure 3 This is a schematic diagram of a signal generated by a model in a method for enhancing electrocardiogram data of pregnant women based on a diffusion model according to an embodiment of the present invention.
[0071] Figure 4 This is a schematic diagram of the LSTM structure in the method for enhancing electrocardiogram data of pregnant women based on a diffusion model in an embodiment of the present invention. DETAILED DESCRIPTION
[0072] Below, the present application is further described in conjunction with the accompanying drawings and specific implementation methods. It should be noted that, under the premise of no conflict, the various embodiments or technical features described below can be arbitrarily combined to form a new embodiment.
[0073] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in combination with specific embodiments and with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0074] It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are intended to distinguish two non-identical entities or non-identical parameters with the same name. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present invention. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, other steps or units inherent to a process, method, system, product or device that includes a series of steps or units.
[0075] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0076] The flowcharts shown in the accompanying drawings are only examples 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 may be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0077] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0078] In order to solve the problem of little ECG ectopic heart beat data and little multi-label data, the present invention proposes a maternal electrocardiogram data enhancement method based on a diffusion model, which learns the ECG signal of an existing database through a diffusion model, so that the required single or concurrent ectopic heart beat ECG data can be generated according to demand.
[0079] See also Figure 1 As shown, an embodiment of the present invention provides a method for enhancing electrocardiogram data of pregnant women based on a diffusion model, which learns ECG signals of an existing database through a diffusion model, and generates required single or concurrent ectopic heartbeat electrocardiogram data according to demand. The method includes the following steps:
[0080] Step S10, acquiring an ECG signal, recording metadata of the ECG signal, and unifying the signal sampling frequency;
[0081] Step S20, performing sliding slicing on the ECG signal with a uniform signal sampling frequency, and initializing a label vector;
[0082] Step S30, setting an input noise module, generating a noise sequence with a length of n and a sampling frequency of fs, and setting LN different noise levels;
[0083] Step S40, setting SIG_ENCODER, SIG_DECODER, label encoder and noise predictor modules, setting LOSS function, training SIG_ENCODER, SIG_DECODER, label encoder and noise predictor models, calculating KL divergence loss, back-propagating and updating parameters, iteratively training to obtain an ECG signal diffusion model;
[0084] Step S50: Apply the trained ECG signal diffusion model to generate electrocardiogram (ECG) data that meets multi-label diagnosis requirements.
[0085] The method for enhancing maternal electrocardiogram data based on a diffusion model in an embodiment of the present invention aims to solve the problem of insufficient ECG ectopic heart beat data and insufficient multi-label data. Figures 1 to 4 As shown in the figure, through diffusion model learning, SIG_ENCODER, SIG_DECODER, LABEL_ENCODER and NOISE_PREDICTOR models suitable for one-dimensional ECG signals are designed, which can realize the training and generation of multi-label signals, so that the required single or concurrent ectopic heartbeat ECG data can be generated according to needs.
[0086] In this embodiment, the ECG signal is collected by a device, or the ECG signal is obtained based on a public database. If the ECG signal is collected based on the device, the ECG signal lead, sampling frequency, wearing method, ECG signal forward / reverse, and heart rhythm diagnosis type label diagnosed by medical professionals are recorded. If the ECG signal is obtained based on a public database, the signal lead, sampling frequency, wearing method, ECG signal forward / reverse, and heart rhythm diagnosis type label marked by experts are obtained from the database record information.
[0087] Specifically, the ECG signal is acquired through device collection or a public database. The metadata of the ECG signal includes the ECG signal lead, sampling frequency, wearing method, ECG signal forward / reverse direction, and heart rhythm diagnosis type label; among which:
[0088] Lead: describes which lead the ECG signal is recorded from (such as I, II, III, aVR, aVL, aVF, V1-V6).
[0089] Sampling frequency: describes the sampling rate of the ECG signal, that is, how many data points are collected per second (for example, 500Hz).
[0090] Wearing method: describes the way the sensor or electrode is worn or placed when collecting ECG signals.
[0091] ECG signal forward / reverse: describes the polarity direction of the signal, that is, whether the positive and negative poles of the signal need to be adjusted.
[0092] Heart rhythm diagnosis type label: describes the clinical diagnosis results or feature labels of ECG signals, such as sinus rhythm, atrial premature beats, ventricular premature beats, etc.
[0093] In this embodiment, when the signal sampling frequency is unified, the obtained ECG signal is downsampled or oversampled to the unified frequency fs; wherein the downsampling or upsampling method includes but is not limited to interpolation, sampling, and time-frequency domain conversion. When sliding slices are performed on the ECG signal with the unified signal sampling frequency, a window with a length of n sampling points is used to slide the ECG signal, and the sliding step is s sampling points.
[0094] When initializing the label vector, clean the heart rhythm diagnosis type label and set the heart rhythm type label vector to be classified M = [M1, M2, ..., M n ] (such as sinus, atrial fibrillation, premature beats, etc.), for each slice signal, the label vector N = [N1, N2, N3......] of the cardiac rhythm diagnosis type is initialized according to the cardiac rhythm type label vector M. For example, the label vector of atrial fibrillation and premature beats is [0, 1, 1, 0, ...].
[0095] In this embodiment, for a noise sequence with a length of n and a sampling frequency of fs, the noise level set by the input noise (input_noise) module is determined by the average energy of the noise in the time domain. The higher the energy, the higher the noise level.
[0096] The method of generating a one-dimensional noise vector includes: generating a random number with a mean value of avg and a standard deviation of std for each sampling point; connecting the random numbers of all sampling points to form a one-dimensional signal sequence with a length of N;
[0097] Alternatively, a frequency spectrum uniformly distributed in the frequency range [f_min,f_max] is generated; through inverse Fourier transform, a white noise signal in the time domain is obtained.
[0098] In this embodiment, the SIG_ENCODER module is used to encode the input ECG signal into a latent space vector (latent vector); the SIG_DECODER module is used to decode the latent space vector (latent vector) into an ECG signal; the label encoder module is used to encode the label vector N = [N1, N2, N3...] into a label vector (labelvector); the noise_predictor module, the input is a label vector (label vector) and a noise signal, and the output is predicted noise (predict noise).
[0099] The SIG_ENCODER module is designed as an 8-layer convolutional neural network structure, including:
[0100] The first layer is a one-dimensional convolutional layer with 64 convolution kernels, a kernel size of 5, and a stride of 1. It is followed by a ReLU activation function and a one-dimensional maximum pooling layer; followed by a one-dimensional maximum pooling layer with a kernel size of 2.
[0101] The second layer is a one-dimensional convolution layer with 128 convolution kernels, a kernel size of 3, and a step size of 1. It is followed by a ReLU activation function and a one-dimensional maximum pooling layer with a kernel size of 2.
[0102] The third layer is a one-dimensional convolution layer with 256 convolution kernels, a kernel size of 3, and a step size of 1. It is connected to a ReLU activation function and a one-dimensional maximum pooling layer.
[0103] The fourth layer is a one-dimensional convolution layer with 512 convolution kernels, a kernel size of 3, and a stride of 1. It is connected to a ReLU activation function and a one-dimensional maximum pooling layer.
[0104] The fifth layer is a one-dimensional convolution layer with 1024 convolution kernels, a kernel size of 3, a stride of 1, and a ReLU activation function and a one-dimensional maximum pooling layer.
[0105] The sixth layer is the flattening layer, which flattens the data;
[0106] The seventh layer is a fully connected layer with 256 neurons and a ReLU activation function.
[0107] The eighth layer is a fully connected layer with 64 neurons. It uses the ReLU activation function and outputs the latent space vector latentvector.
[0108] The SIG_DECODER module is designed as a 10-layer residual network (ResNet) structure, including:
[0109] A convolutional layer, containing 64 3×3 convolution kernels, with a stride of 1, outputting 64 feature maps;
[0110] A maximum pooling layer that performs a 2×2 pooling operation;
[0111] 4 residual modules, each module contains 2 layers of 3×3 convolutional layers, the number of convolution kernels is 64, 128, 256, and 512 respectively, and each convolution layer is followed by a BN layer and a ReLU activation function;
[0112] A global average pooling layer that aggregates feature maps into a feature vector;
[0113] A fully connected layer that outputs a one-dimensional vector.
[0114] When training SIG_ENCODER, SIG_DECODER, label encoder, and noise predictor models, the training process includes:
[0115] Encoder extracts signal features, adds input noise of a certain noise level, and Label encoder extracts label vector features;
[0116] Decoder tries to reconstruct the signal, and noise predictor tries to reconstruct the noise;
[0117] Calculate the KL divergence between the predicted noise distribution predict noise and the prior target input noise to obtain KLLoss;
[0118] Calculate the total loss and back-propagate to update the parameters of SIG_ENCODER, SIG_DECODER, label encoder and noisepredictor;
[0119] Repeat the above process, slightly reducing LOSS each time, gradually approaching the original signal;
[0120] Repeat the above process with all training signals to complete model training.
[0121] In the embodiment of the present invention, the structure of the noise_predictor module is:
[0122] Input layer: accepts input sequence;
[0123] RNN layer 1: LSTM unit number 128, return sequence output;
[0124] RNN layer 2: LSTM unit number 256, return sequence output;
[0125] RNN layer 3: LSTM unit number 256, return sequence output;
[0126] RNN layer 4: LSTM unit number 512, return sequence output;
[0127] Fully connected layer: maps RNN output features to the predicted number of neurons.
[0128] Among them, each LSTM structure is designed as follows Figure 4 shown.
[0129] In this embodiment, the LOSS function is set to train the SIG_ENCODER, SIG_DECODER, label encoder and noise predictor models, where the LOSS function is designed as the KL divergence loss: the KL divergence between the predicted noise distribution predictnoise and the prior target input noise is calculated. The training and gradient update process is:
[0130] (1) Encoder extracts signal features and adds input noise of a certain noise level. Label encoder extracts label vector features.
[0131] (2) The decoder attempts to reconstruct the signal, and the noise predictor attempts to reconstruct the noise.
[0132] (3) Calculate the KL divergence between the predicted noise distribution predict noise and the prior target input noise to obtain KL Loss.
[0133] (4) Calculate the total loss and back-propagate to update the parameters of SIG_ENCODER, SIG_DECODER, label encoder and noise predictor.
[0134] (5) Repeat the above process, slightly reducing LOSS each time and gradually approaching the original signal.
[0135] (6) Repeat the above process using all training signals to complete model training.
[0136] When applied, the above steps complete the SIG_ENCODER, SIG_DECODER, label encoder and noisepredictor model training. For multi-label data generation requirements (such as generating an ECG signal of atrial fibrillation and premature beats), see Figure 3 As shown, the application process is as follows:
[0137] (1) Generate label vectors from the required multiple labels through label encoder.
[0138] (2) Select an input noise of a certain noise level and input it into noisepredictor together with the label vector to obtain the output predicted noise.
[0139] (3) Subtract the predictor from the input noise to get the latent vector.
[0140] (4) Input the latent vector into the sig decoder to obtain the generated signal that meets the requirements.
[0141] The present invention provides a maternal electrocardiogram data enhancement method based on a diffusion model, which effectively generates high-quality electrocardiogram data that meets specific label requirements by designing SIG_ENCODER, SIG_DECODER, label encoder and noise predictor modules, thereby improving the performance of the electrocardiogram classification model. The present invention realizes high-quality ECG signal generation through refined signal processing and deep learning models, and provides effective technical support for maternal heart rhythm abnormality detection.
[0142] It should be noted that Figure 2 and Figure 3 The meaning of each part is:
[0143] ECG signal: electrocardiogram signal;
[0144] latent vector: latent vector;
[0145] input noise: input noise;
[0146] loss: lost;
[0147] SIG encoder: signal encoding;
[0148] noise signal: noise signal;
[0149] noise predictor: noise predictor;
[0150] SIG decoder: signal decoding;
[0151] predict noise: predict noise;
[0152] Label vector: label vector;
[0153] Label encoder: label encoding;
[0154] Prompt label vector: prompt label vector;
[0155] Generated signal: The signal generated.
[0156] According to a second aspect of an embodiment of the present invention, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method of any one of the above embodiments is implemented.
[0157] The computer device includes a processor and a memory, and may also include an input system and an output system. The processor, memory, input system and output system may be connected via a bus or other means, and the input system may receive input digital or character information, and generate signal input related to the migration of the maternal electrocardiogram data enhancement method based on the diffusion model. The output system may include display devices such as a display screen.
[0158] As a non-volatile computer-readable storage medium, the memory can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as the program instructions / modules corresponding to the method for enhancing the electrocardiogram data of pregnant women based on the diffusion model in the embodiment of the present application. The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of the method for enhancing the electrocardiogram data of pregnant women based on the diffusion model, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the local module via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0159] The processor may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor is generally used to control the overall operation of the computer device. In this embodiment, the processor is used to run the program code stored in the memory or process data. The processors of multiple computer devices of the computer device of this embodiment execute various functional applications and data processing of the server by running non-volatile software programs, instructions and modules stored in the memory, that is, implementing the steps of the maternal electrocardiogram data enhancement method based on the diffusion model of the above method embodiment.
[0160] It should be understood that, to the extent that they do not conflict with each other, all the embodiments, features and advantages described above for the method for enhancing electrocardiogram data of pregnant women based on a diffusion model according to the present invention are also applicable to the method and storage medium for enhancing electrocardiogram data of pregnant women based on a diffusion model according to the present invention.
[0161] It will also be appreciated by those skilled in the art that various exemplary logic blocks, modules, circuits and algorithm steps described in conjunction with the disclosure herein can be implemented as electronic hardware, computer software or a combination of the two. In order to clearly illustrate this interchangeability of hardware and software, a general description has been given to the functions of various schematic components, blocks, modules, circuits and steps. Whether this function is implemented as software or hardware depends on specific applications and the design constraints imposed on the entire system. Those skilled in the art can implement the function in various ways for each specific application, but this implementation decision should not be interpreted as causing a departure from the disclosed scope of the embodiments of the present invention.
[0162] The above are exemplary embodiments disclosed in the present invention, but it should be noted that various changes and modifications may be made without departing from the scope disclosed in the embodiments of the present invention as defined in the claims. The functions, steps and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. In addition, although the elements disclosed in the embodiments of the present invention may be described or required in individual form, they may also be understood as multiple unless explicitly limited to the singular.
[0163] It should be understood that, as used herein, the singular form "a" or "an" is intended to include the plural form as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" refers to any and all possible combinations of one or more of the items listed in association. The serial numbers of the embodiments disclosed in the above embodiments of the present invention are for description only and do not represent the advantages and disadvantages of the embodiments.
[0164] A person skilled in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the disclosure of the embodiments of the present invention (including the claims) is limited to these examples; under the concept of the embodiments of the present invention, the technical features in the above embodiments or different embodiments can also be combined, and there are many other changes in different aspects of the embodiments of the present invention as above, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.
Claims
1. A method for enhancing electrocardiogram data of pregnant women based on diffusion model, characterized in that: The following steps are involved: Acquire ECG signals, record metadata of ECG signals, and unify signal sampling frequency; Sliding slices are performed on the ECG signals with uniform signal sampling frequency, and the label vector is initialized; Set the input noise module to generate a length of , a noise sequence with a sampling frequency of fs, and LN different noise levels; Set up SIG_ENCODER, SIG_DECODER, label encoder and noise predictor modules, set up LOSS function, train SIG_ENCODER, SIG_DECODER, label encoder and noise predictor models, calculate KL divergence loss, back propagate to update parameters, and iterate training to obtain ECG signal diffusion model; The trained ECG signal diffusion model is applied to generate ECG data that meets multi-label diagnosis requirements.
2. The method for enhancing electrocardiogram data of pregnant women based on diffusion model according to claim 1, characterized in that: ECG signals are acquired through equipment collection or public databases. The metadata of ECG signals includes ECG signal leads, sampling frequency, wearing method, ECG signal forward / reverse direction, and heart rhythm diagnosis type label.
3. The method for enhancing electrocardiogram data of pregnant women based on diffusion model according to claim 2, characterized in that: When the signal sampling frequency is unified, the obtained ECG signal is downsampled or oversampled to the unified frequency fs; when the ECG signal with the unified signal sampling frequency is subjected to sliding slicing, the length is used. The ECG signal is segmented by sliding in a window of sampling points, and the sliding step length is sampling points.
4. The method for enhancing electrocardiogram data of pregnant women based on diffusion model according to claim 3, characterized in that: When initializing the label vector, clean the heart rhythm diagnosis type label and set the heart rhythm type label vector to be classified , the label vector of the cardiac rhythm diagnosis type for each slice signal , according to the heart rhythm type label vector , initialize the label vector of each slice signal .
5. The method for enhancing electrocardiogram data of pregnant women based on diffusion model according to claim 4, characterized in that: The input noise module has a length of , a noise sequence with a sampling frequency of fs. The set noise level is determined by the average energy of the noise in the time domain. The higher the energy, the higher the noise level.
6. The method for enhancing electrocardiogram data of pregnant women based on diffusion model according to claim 5, characterized in that: The SIG_ENCODER module is used to encode the input ECG signal into a latent space vector; the SIG_DECODER module is used to decode the latent space vector into an ECG signal; the label encoder module is used to convert the label vector Encoded as a label vector; the noise_predictor module inputs the label vector and the noise signal, and outputs the predicted noise.
7. The method for enhancing electrocardiogram data of pregnant women based on diffusion model according to claim 6, characterized in that: The electrocardiogram data generated to meet the multi-label diagnosis requirements is an ECG signal of atrial fibrillation and premature beats.
8. The method for enhancing electrocardiogram data of pregnant women based on diffusion model according to claim 7, characterized in that: The method of setting an input noise module to generate a one-dimensional noise vector includes the following steps: Generate a random number with mean avg and standard deviation std for each sampling point; connect the random numbers of all sampling points to form a one-dimensional signal sequence with a length of N; Alternatively, a frequency spectrum uniformly distributed in the frequency range [f_min,f_max] is generated; through inverse Fourier transform, a white noise signal in the time domain is obtained.
9. The method for enhancing electrocardiogram data of pregnant women based on diffusion model according to claim 6, characterized in that: The SIG_ENCODER module is designed to contain an 8-layer convolutional neural network structure, including: The first layer is a one-dimensional convolution layer with 64 convolution kernels, a kernel size of 5, and a stride of 1, followed by a ReLU activation function and a one-dimensional maximum pooling layer. The second layer is a one-dimensional convolution layer with 128 convolution kernels, a kernel size of 3, and a step size of 1, followed by a ReLU activation function and a one-dimensional maximum pooling layer. The third layer is a one-dimensional convolution layer with 256 convolution kernels, a kernel size of 3, and a step size of 1. It is connected to a ReLU activation function and a one-dimensional maximum pooling layer. The fourth layer is a one-dimensional convolution layer with 512 convolution kernels, a kernel size of 3, and a stride of 1. It is connected to a ReLU activation function and a one-dimensional maximum pooling layer. The fifth layer is a one-dimensional convolution layer with 1024 convolution kernels, a kernel size of 3, a stride of 1, and a ReLU activation function and a one-dimensional maximum pooling layer. The sixth layer is the flattening layer, which flattens the data; The seventh layer is a fully connected layer with 256 neurons and a ReLU activation function. The eighth layer is a fully connected layer with 64 neurons. It uses the ReLU activation function and outputs the latent space vector latentvector.
10. The method for enhancing electrocardiogram data of pregnant women based on diffusion model according to claim 9, characterized in that: The SIG_DECODER module is designed to contain a 10-layer residual network structure, including: A convolutional layer, containing 64 3×3 convolution kernels, with a stride of 1, outputting 64 feature maps; A maximum pooling layer that performs a 2×2 pooling operation; 4 residual modules, each module contains 2 layers of 3×3 convolutional layers, the number of convolution kernels is 64, 128, 256, and 512 respectively, and each convolution layer is followed by a BN layer and a ReLU activation function; A global average pooling layer that aggregates feature maps into a feature vector; A fully connected layer that outputs a one-dimensional vector.
Citation Information
Cited By
Arrhythmia classification method and device based on multi-mode diffusion model, and medium
CN120067836A
