CN117972439A - Heart rate prediction method and system based on enhanced spatial construction and generation countermeasure network - Google Patents

Heart rate prediction method and system based on enhanced spatial construction and generation countermeasure network Download PDF

Info

Publication number
CN117972439A
CN117972439A CN202410381113.4A CN202410381113A CN117972439A CN 117972439 A CN117972439 A CN 117972439A CN 202410381113 A CN202410381113 A CN 202410381113A CN 117972439 A CN117972439 A CN 117972439A
Authority
CN
China
Prior art keywords
network
data
heart rate
construction
training
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202410381113.4A
Other languages
Chinese (zh)
Other versions
CN117972439B (en
Inventor
杨阳
兰天宇
张尉华
姜淑华
黄旭鹏
李丰田
朱耀东
曹馨妍
王保国
李明秋
从海芳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
First Hospital Jinlin University
Changchun University of Science and Technology
Original Assignee
First Hospital Jinlin University
Changchun University of Science and Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by First Hospital Jinlin University, Changchun University of Science and Technology filed Critical First Hospital Jinlin University
Priority to CN202410381113.4A priority Critical patent/CN117972439B/en
Publication of CN117972439A publication Critical patent/CN117972439A/en
Application granted granted Critical
Publication of CN117972439B publication Critical patent/CN117972439B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Measurement And Recording Of Electrical Phenomena And Electrical Characteristics Of The Living Body (AREA)

Abstract

The invention belongs to the technical field of medical information prediction, and discloses a heart rate prediction method and a heart rate prediction system based on an enhanced spatial structure and a generated countermeasure network. The method filters noise from the original data set through EMD empirical mode decomposition algorithm; mapping an original high-dimensional heart rate signal to a construction space, inputting data into splicing noise in a low-dimensional space, firstly training a construction network and an inverse construction network, then alternately training a generation network and a discrimination network in a generation countermeasure network model, generating more real data, and distinguishing between the real data and the generated data; training a deep learning model GAN-ECGformer by using the multi-loss value composite training model; and after training, checking the predicted sample quality. The method not only improves the accuracy of prediction, but also ensures the diversity of the generation effect, thereby enabling the model to effectively process the heart rate data of a wider type.

Description

Heart rate prediction method and system based on enhanced spatial construction and generation countermeasure network
Technical Field
The invention belongs to the technical field of medical information prediction, and particularly relates to a heart rate prediction method and system based on an enhanced spatial structure and a generated countermeasure network.
Background
Electrocardiography (ECG) is a simple and effective diagnostic tool for recording cardiac electrical activity. ECG can help doctors identify signs of various heart diseases by measuring and analyzing the electrical signals produced by each beat of the heart. For example, it can detect problems such as arrhythmia, myocardial ischemia, and myocardial infarction. Interpretation of cardiac ECG signals is a complex task because these signals typically contain large amounts of data and may contain subtle abnormal signals that may be early signs of heart disease. Traditional methods rely on doctors or technicians to interpret these signals manually, which is not only time consuming and laborious, but also subject to subjective judgment, which may lead to missed or misdiagnosis, requiring more efficient and accurate methods for processing and analyzing these complex data as the types of heart diseases increase and cases increase. ECG has become the method of choice for clinical assessment of heart health due to its non-invasive and cost-effective nature. Therefore, the accurate prediction and analysis by using the ECG signal has important significance for early diagnosis of heart diseases. At present, an automatic diagnosis model for an electrocardiogram still mainly depends on a traditional machine learning method, and the electrocardiosignals of a patient are classified according to different characteristics of different diseases, so that a doctor is assisted to improve diagnosis efficiency to a certain extent. However, in the actual clinical environment, due to the fact that the prevalence rate of part of heart diseases is low, the problems that the collected electrocardio data is unbalanced, features are difficult to extract and the like exist, the training effect of a model is affected, and then time series analysis gradually draws attention of researchers.
Compared with the traditional feedforward neural network, the RNN can better capture the time sequence relation existing between data, and the structure and the operation mode of the RNN are also closer to the real biological neural network to a certain extent. Some prior art firstly proposes a long-short-term memory network (LSTM), and effectively solves the problem of gradient disappearance or gradient explosion faced by RNN when treating long-term dependency. Some prior art firstly provides a GRU algorithm, and a gating mechanism, a forgetting mechanism and a state updating mechanism of a unit are introduced, so that a model can better capture important features and information in a long sequence. In order to effectively solve the time lag selection problem, some prior art proposes to predict an ECG sequence by using an ant colony optimization algorithm, and the method can effectively select parameters and predict a time sequence with smaller residual error. Some prior art techniques propose a time series data generation model TimeGAN that is capable of generating a time series that preserves time dynamics. In order to further solve the problem that the transducer cannot be directly applied to a long-time sequence model and cannot effectively capture long-term dependency coupling between input and output, an efficient transducer-based model Informer is designed in the prior art, so that the reasoning speed of long-time sequence prediction is greatly improved. Some prior art proposes an artificial neural network for time series prediction, which calculates future waveform predictions by simulating biological neural network, but the effect is greatly different from that of the same task model, so that the current research still aims to find a time series prediction model for realizing high accuracy.
However, in the above research algorithm, some key problems remain unsolved: in the existing studies, although there are work to achieve heart rate generation using a Generation Antagonism Network (GAN) and studies to conduct heart rate prediction alone, there has been no study to combine these two aspects. Most of these studies focus on methods for predicting a single unknown waveform using multiple known heart rate waveforms, while the predictive effect of these studies is relatively single, missing the diversity of the data.
In the prior art, a model for generating heart rate waveforms mostly adopts a simple generator and discriminator structure. However, for complex time series data, this simplified model structure is difficult to achieve a high quality predictive effect.
In previous studies, heart rate prediction was primarily dependent on Recurrent Neural Network (RNN) algorithms. These algorithms perform poorly when processing long time series data, because small errors per step can accumulate gradually, affecting the predictive effect of long sequences, and the computation time is long, which is detrimental to real-time prediction.
In the existing research, the model design loss value is mostly trained by adopting a single loss value driving model, and the design method can influence the training effect and quality of the model and limit the diversity and generalization capability of the model.
Disclosure of Invention
To overcome the problems in the related art, the disclosed embodiments of the present invention provide a heart rate prediction method and system based on enhanced spatial construction and generation of an countermeasure network.
The technical scheme is as follows: a heart rate prediction method based on enhanced spatial construction and generation of an countermeasure network, comprising:
s1, filtering noise from a raw data set through an EMD empirical mode decomposition algorithm;
S2, mapping an original high-dimensional heart rate signal to a construction space through a deep learning model GAN-ECGformer construction network and an inverse construction network, and inputting heart rate waveform data into splicing noise in a low-dimensional space; firstly, training a construction network and an inverse construction network, then alternately training a generation network and a discrimination network in a generated countermeasure network model, generating more real data, distinguishing the difference between the real data and the generated data, and training a deep learning model GAN-ECGformer by using a multi-loss value composite training model;
S3, after training of the deep learning model GAN-ECGformer, checking the quality of a prediction sample, and evaluating the prediction accuracy of the deep learning model GAN-ECGformer by using the RMSE index, the MAE index, the PRD index and the FD index.
In step S2, the deep learning model GAN-ECGformer generates a network and a discrimination network as cores, maps data into learning data of another dimension by using a construction network and an inverse construction network, and dynamically associates the data; under the new dimension, the generating network sequentially judges whether the learning data is internally represented or falsified data, after multiple rounds of countermeasure iteration, the generating network and the judging network gradually optimize the generating strategy and the identifying capability, so that the generating effect is the same as the real data distribution, and a multi-loss value compound training method for accelerating the training process and stabilizing the training quality is introduced.
In step S2, mapping the original high-dimensional heart rate signal to a construction space through a deep learning model GAN-ECGformer construction network and an inverse construction network, comprising: constructing a network to convert the original high-dimensional heart rate signalMapping to a New structural representation/>The expression is:
in the method, in the process of the invention, For the construction of the representation,/>To construct a network map,/>Is the original high-dimensional heart rate signal,/>For constructing parameters of the network, the constructing network disassembles the high-dimensional representation into multiple simple signal combination representation results by using mapping;
The reverse construction network is disassembled The inverse constructs to the original high-dimensional spatial representation, expressed as:
in the method, in the process of the invention, Reconstruction signal,/>Constructing a network map for the inverse,/>The purpose of the inverse constructed network is to recover the combined representation of the multiple simple signals to the representation of the original space, i.e. to the representation of the original signal, according to rules, as a parameter of the inverse constructed network.
Further, the raw high-dimensional heart rate signalAnd reconstructing the signal/>The difference between them is measured by means of the mean square error MSE, expressed as:
in the method, in the process of the invention, Is MSE,/>For the number of sampling points,/>Is the/>, in the heart rate sequenceSampling points/>For the/>, after reconstruction of the heart rate sequenceSampling points; in the training process, the smaller the Loss value is, the stronger the mapping capability of the construction space and the inverse construction space is.
In step S2, the generating network and the discriminating network train in a new low-dimensional space, the generating network randomly generates a random prediction result according to Gaussian noise, and generates network learning original data similar to real future dataSignal characteristics in a Low dimensional space/>The data sampled in Gaussian noise is transformed through self-attention, residual network and feedforward network to obtain signal characteristics/>, under low-dimensional spaceCharacterization of raw data/>Calculation/>And/>The difference between them is expressed as:
in the method, in the process of the invention, Is root mean square error,/>For/>True value of individual samples,/>For/>Prediction of individual samples,/>Is the number of samples;
The smaller the RMSE value, the smaller the gap between the data generated by the representative generation network and the real data;
the discrimination network evaluates the authenticity of the input data, minimizes the accuracy of the fake data generated by the generator, and discriminates the fake data generated by the generator from the real data, wherein the calculation formula is as follows:
in the method, in the process of the invention, As a minimum loss function of the arbiter,/>Is true data/>Distribution expectations/>,/>Is random noise/>Distribution expectations/>,/>For the discriminator/>Pair generator/>Is used for determining the discrimination probability of the (a),Is true data,/>Is random noise,/>To distinguish network/>For a given input/>Probability of judging whether the data is real data,/>Generating a network/>According to input noise/>Generated data,/>Is the expected value/>For the distribution of real data,/>Is the distribution of input noise;
Is composed of two parts, the first part/> Corresponding to maximizing the accuracy of the discriminator to the real data; if/>Is the real data,/>Close to 1,/>Maximum; second partCorresponding to minimizing the accuracy of the discriminator to the counterfeit data generated by the generator if/>Is data generated by a generator,/>Is 0,/>Maximum.
In step S2, the construction network, the inverse construction network, and the generation of the countermeasure network model calculation formula are composed of transformers, including multi-head self-attention, position coding and feedforward networks, self-attention formulasThe following are provided:
in the method, in the process of the invention, For/>Matching result of/>Is the/>, in the sequenceElement,/>For the number of sampling points in the sequence,/>Is an asymmetry index kernel/>,/>To correspond to the/>The information value of the individual element(s),For inputting information/>At the input of information/>The conditional probability of the following is expected,Obtaining an output from the attention combination V and Q, the multi-headed attention being split into a plurality of heads by splitting the attention mechanism;
Wherein, ,/>Selecting an asymmetry index kernelSelf-attentive combination V and Q obtain output, and through secondary dot product calculation, occupation/>Memory usage, multi-headed attention by splitting the attention mechanism into multiple heads;
The feed forward network formula is as follows:
in the method, in the process of the invention, Calculating the result for the feed-forward network,/>Calculating maximum for taking forward direction,/>To input information,/>For input layer corresponding weights,/>For the output layer corresponding weights,/>For input layer corresponding bias,/>Correspondingly biasing the output layer;
The feedforward network comprises two Dense layers and Relu activation functions to provide nonlinear transformation, and the feedforward network is fitted to the maximum in a mode of combining the linear transformation and the nonlinear transformation;
the position coding formula is as follows:
in the method, in the process of the invention, Encoding the result for the even-numbered element position in the sequence,/>For the odd-numbered element position encoding result,/>To set the coding frequency,/>Is word vector dimension,/>Is the first word vectorDimension/>Is the absolute position of the current word.
In step S2, the multiple-loss-value composite training model includes:
The expression for the resistance loss function is:
in the method, in the process of the invention, As a contrast loss function,/>The minimum loss function of the generator is generated,As a maximum loss function of the arbiter,/>As a loss function,/>To predict step size,/>For a known step size,/>To distinguish network,/>Generating a network,/>Is true heart rate data,/>The expression for the gaussian noise consistency loss function is:
in the method, in the process of the invention, As a consistency loss function,/>For the representation of real heart rate data in construction space,/>Is a representation of gaussian noise in construction space;
The expression of the kinetic energy loss function is:
in the method, in the process of the invention, As a kinetic energy loss function,/>For/>Information representative of the next time step;
the expression for constructing the loss function is:
in the method, in the process of the invention, To construct the loss function,/>The Gaussian noise is recovered and mapped to the original space representation data after construction space training.
In step S3, the deep learning model GAN-ECGformer training process specifically includes:
Input: the ECG signal is transmitted to the computer via a network,
Wherein the method comprises the steps ofRepresenting the representation of the signal in the original space, the observation step length is/>Prediction step size is/>,/>Has the following componentsAnd/>Common composition,/>Represents the extracted/>, of the real signalElements to/>Elements for model as basis sequence for prediction,/>Represents the extracted/>, of the real signalElements of the first to the secondA number of elements representing a sequence portion for validating the prediction; /(I)Is a collection of all data of the original dataset.
The iteration times are as followsConstructing a network as/>Reverse building a network to/>Generating a network as/>Judging the network as/>;/>Is a GAN-ECGformer model;
and (3) outputting: predicted heart rate predicted by GAN-ECGformer
Wherein the method comprises the steps ofRepresenting the representation of a signal in original space,/>Representing the results of model predictions, sequence co-ordinatesAnd sampling points.
Step 1, training
Step 2, sampling initial noiseWherein/>To/>Randomly distributing and sampling to obtain;
Step 3 of the method, in which the step 3,
Step 4 of the process, in which,; Wherein/>Generator multiple loss value sum,/>For the value of the resistance loss,/>Is a consistency loss value,/>Is a kinetic energy loss function;
Step 5, updating and generating network parameters;
Step 6 of the method, in which, ;/>Sum the loss values of the discriminator;
step 7, updating and judging network parameters;
step 8, repeating the steps 3-7 twice;
step 9, repeating the steps 3-8, Secondary times;
And 10, saving the model.
In step S3, the expression of the RMSE index is:
in the method, in the process of the invention, Is root mean square error,/>For the total number of samples,/>Is true value,/>Is a predicted value;
The expression of MAE index is:
in the method, in the process of the invention, Is the average absolute error;
The expression of the PRD index is:
in the method, in the process of the invention, Is the percentage root mean square error;
the FD index is expressed as:
in the method, in the process of the invention, For the characteristic distortion rate,/>For the original data/>Is/are of the eigenvectors of (1)To generate data/>Is/are of the eigenvectors of (1)Is the vector norm.
Another object of the present invention is to provide a heart rate prediction system based on an enhanced spatial configuration and generation countermeasure network, the system being implemented by the heart rate prediction method based on the enhanced spatial configuration and generation countermeasure network, the system comprising:
the preprocessing module is used for filtering noise from the original data set through an EMD empirical mode decomposition algorithm;
The deep learning model GAN-ECGformer training module is used for mapping an original high-dimensional heart rate signal to a construction space through a deep learning model GAN-ECGformer construction network and an inverse construction network, and inputting heart rate waveform data into splicing noise in a low-dimensional space; firstly, training a construction network and an inverse construction network, then alternately training a generation network and a discrimination network in a generated countermeasure network model, generating more real data, distinguishing the difference between the real data and the generated data, and training a deep learning model GAN-ECGformer by using a multi-loss value composite training model;
And the evaluation module is used for checking the quality of the prediction sample after the deep learning model GAN-ECGformer is trained, and evaluating the prediction accuracy of the deep learning model GAN-ECGformer by using the RMSE index, the MAE index, the PRD index and the FD index.
By combining all the technical schemes, the invention has the following beneficial effects: aiming at the problem of lack of diversity of the existing prediction model generation effect, the invention provides a method for combining a generated countermeasure network (GAN) with a heart rate prediction model. This not only improves the accuracy of the predictions, but also ensures a diversity of the generated effects, enabling the model to efficiently process a wider variety of heart rate data.
Aiming at the problem of simple structure of the existing model, a more complex network structure is adopted, and the internal dynamic relation of time series data is deeply learned through enhancing the space structure. The method remarkably improves the fitting and predicting capacity of the prediction model, and solves the limitation of the traditional simple model on complex data prediction.
Aiming at the problems of error accumulation and low real-time performance of RNN in long time sequence prediction, a transducer parallel output architecture is adopted, the problem of long-term dependence is effectively processed through a self-attention mechanism, the processing capacity and the prediction real-time performance of long time sequence data are improved, the overall trend of a waveform is focused instead of the output of a single time point, and the calculation efficiency is remarkably improved.
Aiming at the problems that the convergence effect of the same type of model is difficult and the convergence cannot be stabilized, a multi-loss value composite training process is introduced, the training speed is high, and meanwhile, the model training quality is ensured.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure;
FIG. 1 is a flowchart of a heart rate prediction method based on enhanced spatial construction and generation of an countermeasure network provided by an embodiment of the present invention;
FIG. 2 is a schematic diagram of data preprocessing provided by an embodiment of the present invention;
FIG. 3 is a training challenge loss graph of a deep learning model GAN-ECGformer provided by an embodiment of the present invention;
FIG. 4 is a training consistency loss graph of a deep learning model GAN-ECGformer provided by an embodiment of the present invention;
FIG. 5 is a graph of training kinetic energy loss for a deep learning model GAN-ECGformer provided by an embodiment of the present invention;
FIG. 6 is a graph of total generator discriminant loss for a deep learning model GAN-ECGformer provided by an embodiment of the present invention;
FIG. 7 is a graph showing the comparison of the predicted effect of GAN-ECGformer according to an embodiment of the present invention;
FIG. 8 is a graph comparing SimGAN predicted effects provided by an embodiment of the present invention.
Detailed Description
In order that the above objects, features and advantages of the invention will be readily understood, a more particular description of the invention will be rendered by reference to the appended drawings. In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. The invention may be embodied in many other forms than described herein and similarly modified by those skilled in the art without departing from the spirit or scope of the invention, which is therefore not limited to the specific embodiments disclosed below.
The innovation point of the invention is that: the invention provides a novel heart voltage signal prediction model GAN-ECGformer, which combines a generator and a discriminator to conduct antagonism learning, and maps data to new dimensions through a constructor and a reconstructor, so that the inherent dynamic association of data is deeply learned, the model effectively processes the problems of error accumulation and calculation efficiency in long time sequence prediction, the accuracy and practicality of electrocardiogram data processing and arrhythmia prediction are improved, the GAN-ECGformer performs experiments on MIT-BIH and CSPC2020 datasets, PRD reaches 41.7389, FD reaches 0.629, RMSE reaches 0.145, MAE reaches 0.085, indexes exceed the models of the same types, the applicability and generalization capability of the model on different concentricity data are proved, and new directions and ideas are provided for future related researches.
Generating an countermeasure network predictive design: the GAN-ECGformer adopts a mode of combining the generation countermeasure network with the prediction model, so that the prediction accuracy is improved, the diversity of the generation effect is ensured, and the universality of the model is ensured.
Constructing a space network design: the invention adopts a more complex network design, deep learning of the internal dynamic relation of the high-dimensional heart rate signal is realized through the enhanced space construction technology, the fitting effect and the prediction capability of the model can be obviously improved, and the limitation of the traditional simple model on complex data prediction is solved.
High parallelism and real-time design: in the model framework, the invention does not adopt a recursive time sequence network used by a main stream time sequence algorithm, utilizes a Transformer parallel output framework, combines a self-attention mechanism to effectively solve the long-term dependence problem, effectively processes context data, learns the internal dynamic connection of a time sequence, ensures the accuracy of the result while rapidly outputting the result, focuses on the overall trend of the waveform, and does not tangle with the output of a single time point, thereby obviously improving the calculation efficiency.
Multi-loss value composite training design: aiming at the problems that the convergence effect of the same type model is difficult and the convergence cannot be stabilized, the invention designs a multi-loss value composite training concept, the model training effect is ensured by utilizing various constraint effects, and the universality and the generation quality of the model are ensured by adopting the generation modes of the constraint models at a plurality of layers.
The invention provides an innovative deep learning model GAN-ECGformer which is specially designed for realizing high-integration time sequence data prediction. The model combines a transducer, a construction space and a multi-loss value compound training method to capture the complex high-integration heart rate signal characteristic representation to the greatest extent, capture the internal representation of time sequence data and focus the overall trend of the model, thereby remarkably improving the calculation efficiency.
The deep learning model GAN-ECGformer shows excellent performance in tests on the MIT-BIH and CPSC2020 datasets. The invention performs single patient test on all patients in the MIT-BIH data set, and the average PRD is 20.367, FD is 1.126, RMSE is 0.140 and MAE is 0.054, so that the model effect is better than all the model effects proposed in the prior art. Whereas on the CSPC2020 dataset, PRD reached 30.743, fd reached 1.161, rmse reached 0.113, mae reached 0.036. The remarkable ability of these performance markers GAN-ECGformer to predict heart rate waveforms at high quality, compared to other existing methods of generating an countermeasure network, the deep learning model GAN-ECGformer exhibits a predicted quality and diversity that exceeds all models.
The high quality prediction and diversity of the deep learning model GAN-ECGformer has important potential in the field of time series data. The value of the method in personalized treatment and wide clinical application shows the wide application prospect of deep learning in the field of medical health, and simultaneously highlights the important role of technical innovation in improving the life quality of patients.
Embodiment 1, as shown in fig. 1, a heart rate prediction method based on enhanced spatial configuration and generation of an countermeasure network according to an embodiment of the present invention includes:
s1, filtering noise from a raw data set through an EMD empirical mode decomposition algorithm;
S2, mapping an original high-dimensional heart rate signal to a construction space through a deep learning model GAN-ECGformer construction network and an inverse construction network, and inputting heart rate waveform data into splicing noise in a low-dimensional space; firstly, training a construction network and an inverse construction network, then alternately training a generation network and a discrimination network in a generated countermeasure network model, generating more real data, distinguishing the difference between the real data and the generated data, and training a deep learning model GAN-ECGformer by using a multi-loss value composite training model;
S3, after training of the deep learning model GAN-ECGformer, checking the quality of a prediction sample, and evaluating the prediction accuracy of the deep learning model GAN-ECGformer by using the RMSE index, the MAE index, the PRD index and the FD index.
The embodiment of the invention also provides a heart rate prediction system based on the enhanced space construction and generation countermeasure network, which comprises:
the preprocessing module is used for filtering noise from the original data set through an EMD empirical mode decomposition algorithm;
The deep learning model GAN-ECGformer training module is used for mapping an original high-dimensional heart rate signal to a construction space through a deep learning model GAN-ECGformer construction network and an inverse construction network, and inputting heart rate waveform data into splicing noise in a low-dimensional space; firstly, training a construction network and an inverse construction network, then alternately training a generation network and a discrimination network in a generated countermeasure network model, generating more real data, distinguishing the difference between the real data and the generated data, and training a deep learning model GAN-ECGformer by using a multi-loss value composite training model;
And the evaluation module is used for checking the quality of the prediction sample after the deep learning model GAN-ECGformer is trained, and evaluating the prediction accuracy of the deep learning model GAN-ECGformer by using the RMSE index, the MAE index, the PRD index and the FD index.
Embodiment 2, as another implementation manner of the present invention, a heart rate prediction method based on enhanced spatial configuration and generation of an countermeasure network according to an embodiment of the present invention includes:
I. System initialization and configuration:
1. Guiding and storing tools: including 'pyedflib', 'numpy', 'pandas', 'scipy', 'torch', 'matplotlib', etc.
2. Setting global parameters: sampling rate: 256Hz. Window length: 1500 sampling points (900 sampling points are used as prediction basis, 600 sampling points are prediction points). Batch size (bS): 32. learning rate: 0.0005. training round number (num_epoch): 100. the CUDA environment is initialized.
Data processing and feature extraction, including:
ECG data import: the data file in npy format is loaded from the specified path using 'numpy.load'.
As shown in fig. 2, data preprocessing: respectively drawing upper and lower envelope curves according to upper and lower extreme points of an original signal; calculating a mean value according to the upper envelope line and the lower envelope line, and drawing a mean value envelope line; subtracting the mean envelope from the original signal according to the mean envelope to obtain an intermediate signal; the first three steps of iteration are repeated, whether the result meets the termination condition is judged, if not, iteration is performed again, and if yes, the result is output;
Feature extraction: the algorithm converts heart rate data from one-dimensional voltage data with high integration level to a construction space and converts the data into a plurality of simple signal superposition representations, so that the algorithm is easier to capture data representation relations.
Thirdly, constructing and training a deep learning model GAN-ECGformer, which comprises the following steps:
model design: (specific details are formulated in the model core technology below);
Data set preparation, namely dividing the data set by the serial number of the patient, and carrying out independent experiments on single patients to randomly scramble and divide the data.
Model training: as an optimizer, a 'torch.optim.adam' was used. 5 fold cross validation was used. Loss function: mseloss'. Indexes such as loss, PRD, FD, MAE, RMSE and the like of training and testing are recorded.
Performance assessment and outcome record, comprising:
evaluation index calculation: RMSE, MAE, PRD, FD.
Selecting an optimal model: the optimal deep learning model GAN-ECGformer is selected based on the indices of the test RMSE, etc.
Visualization of results: the loss and accuracy are plotted as a function of epoch.
And (3) storing results: the results of the training and testing are saved to the CSV file.
System optimization and tuning includes:
Parameter tuning: and adjusting the network structure and the training parameters according to the performance result.
Feature selection: and analyzing the influence of different characteristics on the model performance.
Code optimization: the code is optimized to improve efficiency.
Practical applications and tests include:
actual data testing: evaluating the performance of the model on a new ECG data set, comparing and calculating future heart rate with the generated predicted heart rate, and judging whether the performance index meets the standard or not;
and (3) system deployment: gradually expanding the model into the existing public data set;
user feedback collection: for further improving the model and system.
Embodiment 3, as another implementation manner of the present invention, a heart rate prediction method based on enhanced spatial configuration and generation of an countermeasure network according to an embodiment of the present invention includes:
The MIT-BIT data set is an important data resource in the fields of electrocardiogram analysis and arrhythmia research, and aims to promote automatic detection research of heart diseases, particularly arrhythmia, and 48-section two-channel environmental electrocardiogram records which last for half an hour of 47 patients are covered, wherein the two ECG signal channels mainly comprise MLII and V1. These recordings are annotated precisely, which in detail marks various arrhythmic events, such as premature beat, tachycardia, bradycardia, etc., and provides abundant clinical data for research. The sampling frequency is 360 samples per second, ensuring high quality and applicability of the data.
ECG signals are typically nonlinear, non-stationary signals, meaning that their mean and variance vary from person to person over time, and different underlying diseases and causes of obesity affect ECG signal expression differently, most conventional linear signal processing methods assume a steady and linear time series rather than an adaptive nonlinear signal. An Empirical Mode Decomposition (EMD) method is an adaptive method that can well handle nonlinear and nonstationary signals, and EMD can decompose complex signals into a series of simple eigenmode functions, each IMF representing a local feature in the signal. This decomposition makes it possible to extract specific electrocardiographic events (such as QRS complexes, T waves, etc.) from the ECG signal, while also helping to identify and remove noise.
Assume the raw ECG signal isThe goal of EMD is to be/>Decomposition into/>The eigenmode functions IMFs/>And a residual/>The method comprises the following steps:
in the method, in the process of the invention, For/>The eigenmode functions IMF,/>Is the residual part of the signal.
The decomposition process of EMD is as follows:
marking local extreme points by the input signals;
connecting all maximum value points of the waveform through the cubic spline difference values to form an upper envelope curve, and connecting minimum value points to form a lower envelope curve;
the envelope lines formed by connecting the maximum value and the minimum value respectively are averaged
Subtracting the upper envelope mean value and the lower envelope mean value from the input signal, namely:
repeating the above steps for several times until Output signal representing satisfaction of an eigenmode function IMF or shutdown criterion, which determines the number of executions of the screening process to produce an eigenmode function, i.e.:
Wherein the method comprises the steps of Representing standard deviation,/>Representing the sum/>, in the sequenceSampling points/>For the EMD filtering result of the last sampling point,/>The EMD filtering result for that sample point.
When (when)When the waveform is smaller than the given threshold, the screening process is stopped, and the waveform is output.
The invention provides a model core technology, and innovatively provides a heart voltage signal prediction model based on an enhancement space construction and generation countermeasure network, namely a deep learning model GAN-ECGformer (GENERATIVE ADVERSARIAL Network for electrocardiogram using Transformer), which mainly takes a generation network and a discrimination network as cores, and utilizes a construction network and an inverse construction network to map data to another dimension for learning, so that the learning data of a model in a deeper level is internally and dynamically associated. Under the new dimension, the generating network sequentially judges whether the learning data is input into the real data or the fake data by the judging network, after multiple rounds of countermeasure iteration, the generating network and the judging network gradually optimize the generating strategy and the identifying capability of the generating network and gradually enable the generating effect to be gradually close to the real data distribution.
In the embodiment of the invention, the innovation of the invention is provided: the construction network and the inverse construction network are used to enable mapping of data to a new low dimensional space, particularly when processing heart rate signals, where traditional high dimensional representations are difficult to capture the intrinsic dynamic characteristics of the data, whereas heart rate waveforms are often highly integrated, meaning that they are represented by a large amount of information integration, where tiny precursors prior to onset of a disease may be difficult to predict in a highly integrated waveform representation, mapping heart rate waveforms to lower dimensional representations may break down complex heart rate signals into a combined representation of more simple signals, allowing the model to better capture the tiny characteristics and intrinsic dynamic representations in the waveforms, allowing the model to more easily understand the complex representation of the data, thereby improving the performance and accuracy of the model.
Constructing a network to convert the original high-dimensional heart rate signalMapping to a New structural representation/>The expression is:
in the method, in the process of the invention, For the construction of the representation,/>To construct a network map,/>Is the original high-dimensional heart rate signal,/>For constructing parameters of the network, the constructing network disassembles the high-dimensional representation into multiple simple signal combination representation results by using mapping;
The reverse construction network is disassembled The inverse constructs to the original high-dimensional spatial representation, expressed as:
in the method, in the process of the invention, Reconstruction signal,/>Constructing a network map for the inverse,/>The purpose of the inverse constructed network is to recover the combined representation of the multiple simple signals to the representation of the original space, i.e. to the representation of the original signal, according to rules, as a parameter of the inverse constructed network.
Meanwhile, in order to quantify reconstruction quality and optimize model parameters, the invention adopts an original high-dimensional heart rate signalAnd reconstructing the signal/>The difference between them is measured by means of the mean square error MSE, expressed as:
in the method, in the process of the invention, Is MSE,/>For the number of sampling points,/>Is the/>, in the heart rate sequenceSampling points/>For the/>, after reconstruction of the heart rate sequenceSampling points;
In the training process, the smaller the Loss value is, the stronger the mapping capability of the construction space and the inverse construction space is, namely, the more accurate the mapping between the two spaces is.
In the embodiment of the invention, the generating network and the judging network train the generating network in a new low-dimensional space to randomly generate a random prediction result according to Gaussian noise, and the random prediction result is similar to real future data to generate network learning original dataSignal characteristics in a Low dimensional space/>The data sampled in Gaussian noise is transformed through self-attention, residual network and feedforward network to obtain signal characteristics/>, under low-dimensional spaceCharacterization of raw data/>Calculation/>And/>The difference between them is expressed as:
in the method, in the process of the invention, Is root mean square error,/>For/>True value of individual samples,/>For/>Prediction of individual samples,/>Is the number of samples;
The smaller the RMSE value, the smaller the gap between the data generated by the representative generation network and the real data;
the discrimination network evaluates the authenticity of the input data, minimizes the accuracy of the fake data generated by the generator, and discriminates the fake data generated by the generator from the real data, wherein the calculation formula is as follows:
in the method, in the process of the invention, As a minimum loss function of the arbiter,/>Is true data/>Distribution expectations/>,/>Is random noise/>Distribution expectations/>,/>For the discriminator/>Pair generator/>Is used for determining the discrimination probability of the (a),Is true data,/>Is random noise,/>To distinguish network/>For a given input/>Probability of judging whether the data is real data,/>Generating a network/>According to input noise/>Generated data,/>Is the expected value/>For the distribution of real data,/>Is the distribution of input noise;
In an embodiment of the present invention, in the present invention, Is composed of two parts, the first part/>Corresponding to maximizing the accuracy of the discriminator to the real data; ideally, if/>Is the real data,/>In the vicinity of 1,Maximum; second part/>Corresponding to minimizing the accuracy of the discriminator to the counterfeit data generated by the generator, ideally if/>Is data generated by a generator,/>0, Thus/>It should be ensured that it is as large as possible.
The two compete and push the training process of the deep learning model, and finally, the data generated by the generated network is more similar to the real data, and the deep learning model can obtain complex data representation similar to the real data through the contrast training. The deep learning model is used for inputting the known waveform and noise in a spliced mode, and the deep learning model can obtain the context correlation reasoning capability, so that the deep learning model is applied to a waveform prediction task.
The construction network, the inverse construction network and the generation of the countermeasures network model calculation formula mainly consist of a transducer, which mainly comprises a multi-head self-attention, a position coding and a feed-forward network, and the self-attention formulaThe following are provided:
in the method, in the process of the invention, For/>Matching result of/>Is the/>, in the sequenceElement,/>For the number of sampling points in the sequence,/>Is an asymmetry index kernel/>,/>To correspond to the/>The information value of the individual element(s),For inputting information/>At the input of information/>The conditional probability expectation,/> Obtaining an output from the attention combination V and Q, the multi-headed attention being split into a plurality of heads by splitting the attention mechanism;
Wherein, ,/>Selecting an asymmetry index kernelSelf-attentive combination V and Q obtain output, and through secondary dot product calculation, occupation/>Memory usage, multi-headed attention by splitting the attention mechanism into multiple heads; thereby making the model more focused on the degree of correlation between contexts, increasing the ability of the model to process complex input data, which not only takes into account the independent features between elements in the sequence, but also the interactions between them. Multi-headed attentiveness by "splitting" the attentive mechanism into multiple heads, the model can learn information from different presentation subspaces simultaneously. This means that each head may focus on a different aspect of the sequence, such as one head focusing on capturing short-term dependencies, while another head may focus on long-term dependencies. The diversified learning path greatly enriches the expression capability of the model and improves the understanding depth of complex time sequence data.
The feed forward network formula is as follows:
in the method, in the process of the invention, Calculating the result for the feed-forward network,/>Calculating maximum for taking forward direction,/>To input information,/>For input layer corresponding weights,/>For the output layer corresponding weights,/>For input layer corresponding bias,/>Correspondingly biasing the output layer;
The feedforward network comprises two Dense layers and Relu activation functions to provide nonlinear transformation, and the mode of combining the linear transformation and the nonlinear transformation is utilized to enable the model to exert the maximum fitting effect.
The position coding formula is as follows:
;/>
in the method, in the process of the invention, Encoding the result for the even-numbered element position in the sequence,/>For the odd-numbered element position encoding result,/>To set the coding frequency,/>Is word vector dimension,/>Is the first word vectorDimension/>Is the absolute position of the current word.
Because of the periodicity of the sine and cosine functions, the input word vectors become unique coding positions in the model, so that the position relations among the word orders are represented by numbers, and the position relations among the vectors can be conveniently understood in the subsequent model learning process.
In order to solve the characteristic of slow training of the existing model, GAN-ECGformer adopts multi-loss value compound training, and utilizes four loss value compound training models, so that the model training time is reduced, the model training quality is not reduced, and a specific loss function consists of the following four loss functions.
The expression for the resistance loss function is:
in the method, in the process of the invention, As a contrast loss function,/>The minimum loss function of the generator is generated,As a maximum loss function of the arbiter,/>As a loss function,/>To predict step size,/>For a known step size,/>To distinguish network,/>Generating a network,/>Is true heart rate data,/>Is Gaussian noise;
The antagonism loss function directs the generating network and the discriminating network to update parameters in antagonism, the object of the generator is to generate false data which is as close to real data as possible, the object of the discriminator is to distinguish whether the input is from a real data set or a generating network, the two compete and push the model training process, the data generated by the generating network is finally more similar to the real data, the two networks are in continuous antagonism with each other, the two networks try to surpass each other, and the performance of the whole model is gradually improved along with the continuous antagonism training. The generator gradually grasps the complex distribution and characteristics of the real data in the learning process, and can generate more and more real data. Meanwhile, the judging capability of the discriminator is enhanced, and the true and false data can be more accurately identified. This process eventually results in the data generated by the generation network being more and more similar to the real data, enabling high quality data generation.
Through this resistance training, the deep learning model GAN-ECGformer will result in a complex data representation that is close to the real data.
The invention provides an expression of a consistency loss function for the first time, which is as follows:
in the method, in the process of the invention, As a consistency loss function,/>For the representation of real heart rate data in construction space,/>Is a representation of gaussian noise in construction space; /(I)
The consistency loss function ensures that the Gaussian noise has a one-to-one correspondence with the real heart rate under the construction space, and in the process, the consistency loss function ensures that the model can effectively convert the input Gaussian noise into the heart rate signal representation with practical physiological significance, and the Gaussian noise provides a rich and diversified input space due to the randomness of the Gaussian noise, so that the model has the opportunity to explore and generate various possible heart rate signal representations. The consistency loss function guides the model to optimize its parameters during training by quantifying the consistency between the generated heart rate signal and the real heart rate signal to ensure that the heart rate signal generated from different noise inputs is both diverse and maintains a high degree of correlation with the real signal.
By learning to convert gaussian noise into physiologically reasonable heart rate signals, the model is able to generate accurate and diversified heart rate signals in the face of new, unseen noise inputs. The capability shows that the model has stronger generalization capability, can adapt to various input conditions, and improves the reliability and the effectiveness of the model in practical application.
Therefore, the consistency loss function is set, the deep learning model GAN-ECGformer converts different Gaussian noises into heart rate representations with different characteristics in the learning process, and the consistency loss function endows the representations of the Gaussian noises with significance, so that the diversity of the deep learning model GAN-ECGformer is ensured, and the generalization capability of the deep learning model GAN-ECGformer is improved.
The invention innovatively provides an expression of a kinetic energy loss function as follows:
in the method, in the process of the invention, As a kinetic energy loss function,/>For/>Information representative of the next time step;
the kinetic energy loss function strengthens dynamic connection among data points by punishing incoherent or unnatural dynamic changes in the data sequence, so that the model predicts or generates the data sequence with continuous dynamic changes more accurately, and improves the performance of the model when processing complex time sequence data by ensuring that the model can capture the internal dynamic representation of the data and reduce unnecessary oscillation. This not only improves the understanding of the overall trend of the model to the data, but also improves the accuracy and reliability of the predictions.
The kinetic energy loss function ensures that the deep learning model GAN-ECGformer captures the inherent dynamic representation of data in the training process, and the kinetic energy loss of the waveform is increased when the waveform excessively oscillates, so that the dynamic connection of the data before and after the waveform is improved, the oscillation effect is reduced, the training quality of the deep learning model GAN-ECGformer is improved, and the effectiveness of the deep learning model GAN-ECGformer on the overall trend is ensured.
The invention innovatively proposes that the expression of the construction loss function is as follows:
in the method, in the process of the invention, To construct the loss function,/>The Gaussian noise is recovered and mapped to the original space representation data after construction space training.
In summary, the construction penalty ensures that any data processing or generation activity performed in the construction space, such as feature extraction, data compression, or generation of new data instances, can be accurately reverse converted back to the original heart rate waveform representation, ensuring that the model, after being mapped to the construction space, can be accurately returned to the original spatial representation, thereby ensuring that the model, after generating data in the construction space, can be accurately converted to the representation of the heart rate waveform.
After the deep learning model GAN-ECGformer is trained, the model performance is jointly evaluated by using four indexes, so that the quality of the deep learning model GAN-ECGformer is intuitively evaluated.
As a preferred embodiment of the present invention, the process of deep learning model GAN-ECGformer in the embodiment of the present invention includes:
Input: the ECG signal is transmitted to the computer via a network,
Wherein the method comprises the steps ofRepresenting the representation of the signal in the original space, the observation step length is/>Prediction step size is/>,/>Has the following componentsAnd/>Common composition,/>Represents the extracted/>, of the real signalElements to/>Elements for model as basis sequence for prediction,/>Represents the extracted/>, of the real signalElements of the first to the secondA number of elements representing a sequence portion for validating the prediction; /(I)Is a collection of all data of the original dataset.
The iteration times are as followsConstructing a network as/>Reverse building a network to/>Generating a network as/>Judging the network as/>;/>Is a GAN-ECGformer model;
and (3) outputting: predicted heart rate predicted by GAN-ECGformer
Wherein the method comprises the steps ofRepresenting the representation of a signal in original space,/>Representing the results of model predictions, sequence co-ordinatesAnd sampling points.
Step 1, training
Step 2, sampling initial noiseWherein/>To/>Randomly distributing and sampling to obtain;
Step 3 of the method, in which the step 3,
Step 4 of the process, in which,; Wherein/>Generator multiple loss value sum,/>For the value of the resistance loss,/>Is a consistency loss value,/>Is a kinetic energy loss function;
Step 5, updating and generating network parameters;
Step 6 of the method, in which, ;/>Sum the loss values of the discriminator;
step 7, updating and judging network parameters;
step 8, repeating the steps 3-7 twice;
step 9, repeating the steps 3-8, Secondary times;
And 10, saving the model.
In the embodiment of the invention, the expression of the RMSE index is:
in the method, in the process of the invention, Is root mean square error,/>For the total number of samples,/>Is true value,/>Is a predicted value;
The expression of MAE index is:
in the method, in the process of the invention, Is the average absolute error;
The expression of the PRD index is:
in the method, in the process of the invention, Is the percentage root mean square error;
the FD index is expressed as:
in the method, in the process of the invention, For the characteristic distortion rate,/>For the original data/>Is/are of the eigenvectors of (1)To generate data/>Is/are of the eigenvectors of (1)Is the vector norm.
From the above examples, heart disease is one of the leading causes of death worldwide, and there is a great need for effective diagnostic tools. The invention can improve the early diagnosis rate of heart diseases, reduce the medical cost and can be widely used in the medical care field. In addition, due to the high accuracy and real-time performance, the technology can be applied to remote heart disease monitoring and personalized treatment schemes, so that better service is provided for medical institutions and patients, and market competitiveness is improved.
The invention generates an countermeasure network for the first time to be used for heart rate prediction, can improve the early diagnosis rate of heart diseases, combines a plurality of technologies and training modes, and ensures the high accuracy and instantaneity of output results.
The invention can be used for predicting heart rate by generating an antagonism network for the first time, can improve the early diagnosis rate of heart diseases, combines various technologies and training modes, ensures high accuracy and instantaneity of output results, is in a relatively stagnant state all the time in the heart rate predicting field, predicts smaller predicted heart rate by using longer known heart rate waveforms in most researches, and has the advantages of complicated calculation process and low flexibility.
The invention can not solve the problem that the former can not realize the high-precision prediction of the next waveform by using a small quantity of waveforms, and can ensure the output to be rapid and the quick response to ensure the real-time performance while realizing the high precision.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
The content of the information interaction and the execution process between the devices/units and the like is based on the same conception as the method embodiment of the present invention, and specific functions and technical effects brought by the content can be referred to in the method embodiment section, and will not be described herein.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present invention. For specific working processes of the units and modules in the system, reference may be made to corresponding processes in the foregoing method embodiments.
The embodiment of the invention also provides a computer device, which comprises: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, which when executed by the processor performs the steps of any of the various method embodiments described above.
Embodiments of the present invention also provide a computer readable storage medium storing a computer program which, when executed by a processor, performs the steps of the respective method embodiments described above.
The embodiment of the invention also provides an information data processing terminal, which is used for providing a user input interface to implement the steps in the method embodiments when being implemented on an electronic device, and the information data processing terminal is not limited to a mobile phone, a computer and a switch.
The embodiment of the invention also provides a server, which is used for realizing the steps in the method embodiments when being executed on the electronic device and providing a user input interface.
Embodiments of the present invention provide a computer program product which, when run on an electronic device, causes the electronic device to perform the steps of the method embodiments described above.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiments, and may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing device/terminal apparatus, recording medium, computer Memory, read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), electrical carrier signals, telecommunications signals, and software distribution media. Such as a U-disk, removable hard disk, magnetic or optical disk, etc.
To further illustrate the effects associated with the embodiments of the present invention, the following model verification experiments were performed.
Firstly, the invention takes patient 100/101/102/124 as an example, carries out K-fold verification experiments, the experimental results are shown in table 1, wherein the comprehensive index effect is best when K=5, and MLII is taken as an example, PRD, RMSE, MAE is the lowest, and most indexes of the whole K-fold verification table are in reasonable intervals.
Table 1K A fold verification
Meanwhile, the invention visualizes the comparison result of the influence caused by different observation step sizes and different prediction step sizes predicted by the model, and the invention displays the prediction task visualization result of all channels contained in MIT-BIH, wherein the prediction task visualization result comprises different observation step sizes and different prediction step sizesResulting prediction bias is different from >For example, as shown in table 2, the present invention will list the complete index comparisons for each channel in the subsequent discussion.
TABLE 2 comparison of indices caused by different observation step sizes and different prediction step sizes
Furthermore, the invention tests the Transformer designed in the model, changes the Transformer into LSTM and GRU, and compares the LSTM with the GRU, so as to ensure the objectivity of the experiment, the comparison experiment adopts Constructor structural design and multi-Loss value auxiliary training, the comparison prediction effect of the Transformer and GRU, LSTM, VAE is shown in the table 3, and the index of the Transformer model is obviously superior to other models in terms of PRD, FD, RMSE and MAE expression, and the powerful prediction capability of the Transformer model is shown.
From the perspective of the predicted waveform, both the recurrent neural network models, GRU and LSTM, perform well in certain specific situations. In particular, both models can provide relatively good prediction results when the step size of the known data is larger than the prediction step size. This is possible because in this case the model is able to make efficient predictions with sufficient historical information. However, when the two steps are equal or the known step size is smaller than the prediction step size, the prediction performance of these models drops drastically. In this case, the predicted waveform is gradually distorted, indicating that the model has a limitation in dealing with long-term dependency. On the other hand, VAE models represent a significant disadvantage in the experiments of the present invention. The ability of the VAE to predict tasks is very poor compared to the GRU, LSTM, which may be related to the nature of its generative model. Furthermore, the GRU, LSTM and VAE models all showed significant concussion effects, indicating that these models have shortcomings in terms of prediction accuracy and stability. This concussion is particularly pronounced in the face of complex or irregular time series data.
Comparison of predicted outcome indicators in tables 3 Transformer and GRU, LSTM, VAE
In the present invention, an in-depth analysis of single patient data in the MIT-BIH arrhythmia database is focused. This database covers the ECG data of 46 patients, of which MLII channels are the most abundant and therefore the main focus of the study of the present invention. As shown in Table 4, the performance metrics of a single patient experiment were recorded using the GAN-ECGformer model. Through strict testing and verification, the data of most patients show good model adaptability. Specifically, the results of the other patients showed validity of the model except for the patient numbers 203, 219, 223, which had relatively low performance indexes. Statistically, the average PRD for all patients reached 41.739, the average FD was 0.629, the average RMSE was 0.145, and the average MAE was 0.085. The results show that the GAN-ECGformer model not only has good versatility, but also shows significant effectiveness in processing complex arrhythmia data. In addition, the adaptability of the model between different patients also demonstrates its potential application value in personalized arrhythmia diagnosis. Particularly when processing patient data with different heart rhythm characteristics, the model exhibits a high degree of stability and reliability.
Table 4 MIT-BIH dataset single patient experiments (for example MLII,)/>
The model is compared with the existing model of the same type, as shown in Table 5, the model of the invention is superior to the existing model of the same type in PRD, RMSE, MAE indexes, and the comparison result not only proves the remarkable advantages of the model of the invention in terms of data accuracy and reliability, but also highlights the high efficiency of the model of the invention in electrocardiographic data analysis.
Table 5 GAN-ECGformer compares to existing model metrics
In the comparison model, simGAN is taken as an example for comparison of the prediction effect, as shown in fig. 7 for comparison of the prediction effect of GAN-ECGformer of the present invention, and fig. 8 for comparison of the prediction effect of SimGAN, in terms of the waveform generation effect, the generation effects of GAN-ECGformer and SimGAN show significant differences, and the SimGAN model has the problem of waveform oscillation, which is commonly found in most of the existing models, and is also shown when compared with the models such as the GRU and the like, because the model only captures the overall trend of the waveform, and the GAN-ECGformer takes into consideration the dynamic connection of the upper and lower time points for each point of the prediction while capturing the overall trend, thereby avoiding the problem of waveform oscillation.
While the invention has been described with respect to what is presently considered to be the most practical and preferred embodiments, it is to be understood that the invention is not limited to the disclosed embodiments, but on the contrary, is intended to cover various modifications, equivalents, and alternatives falling within the spirit and scope of the invention.

Claims (10)

1. A heart rate prediction method based on enhanced spatial construction and generation of an countermeasure network, the method comprising:
s1, filtering noise from a raw data set through an EMD empirical mode decomposition algorithm;
S2, mapping an original high-dimensional heart rate signal to a construction space through a deep learning model GAN-ECGformer construction network and an inverse construction network, and inputting heart rate waveform data into splicing noise in a low-dimensional space; firstly, training a construction network and an inverse construction network, then alternately training a generation network and a discrimination network in a generated countermeasure network model, generating more real data, distinguishing the difference between the real data and the generated data, and training a deep learning model GAN-ECGformer by using a multi-loss value composite training model;
S3, after training of the deep learning model GAN-ECGformer, checking the quality of a prediction sample, and evaluating the prediction accuracy of the deep learning model GAN-ECGformer by using the RMSE index, the MAE index, the PRD index and the FD index.
2. The heart rate prediction method based on enhanced spatial construction and generation of countermeasure network according to claim 1, wherein in step S2, the deep learning model GAN-ECGformer generation network and discrimination network are used as cores, and the construction network and inverse construction network are utilized to map data into learning data of another dimension, and then dynamically correlate the data; under the new dimension, the generating network sequentially judges whether the learning data is internally represented or falsified data, after multiple rounds of countermeasure iteration, the generating network and the judging network gradually optimize the generating strategy and the identifying capability, so that the generating effect is the same as the real data distribution, and a multi-loss value compound training method for accelerating the training process and stabilizing the training quality is introduced.
3. The method of claim 1, wherein mapping the original high-dimensional heart rate signal to the construction space through the deep learning model GAN-ECGformer construction network and the inverse construction network in step S2 comprises: constructing a network to convert the original high-dimensional heart rate signalMapping to a New structural representation/>The expression is:
in the method, in the process of the invention, For the construction of the representation,/>To construct a network map,/>Is the original high-dimensional heart rate signal,/>For constructing parameters of the network, the constructing network disassembles the high-dimensional representation into multiple simple signal combination representation results by using mapping;
The reverse construction network is disassembled The inverse constructs to the original high-dimensional spatial representation, expressed as:
in the method, in the process of the invention, Reconstruction signal,/>Constructing a network map for the inverse,/>The purpose of the inverse constructed network is to recover the combined representation of the multiple simple signals to the representation of the original space, i.e. to the representation of the original signal, according to rules, as a parameter of the inverse constructed network.
4. A method of heart rate prediction based on enhanced spatial structuring and generation countermeasure network as claimed in claim 3 wherein the raw high-dimensional heart rate signalAnd reconstructing the signal/>The difference between them is measured by means of the mean square error MSE, expressed as:
in the method, in the process of the invention, Is MSE,/>For the number of sampling points,/>Is the/>, in the heart rate sequenceSampling points/>For the/>, after reconstruction of the heart rate sequenceSampling points;
in the training process, the smaller the Loss value is, the stronger the mapping capability of the construction space and the inverse construction space is.
5. The heart rate prediction method based on enhanced spatial construction and generation of countermeasure network according to claim 1, wherein in step S2, the generation network and the discrimination network train in a new low-dimensional space, the generation network randomly generates random prediction results according to gaussian noise, and generates network learning raw data similar to real future dataSignal characteristics in a Low dimensional space/>The data sampled in Gaussian noise is transformed through self-attention, residual network and feedforward network to obtain signal characteristics/>, under low-dimensional spaceCharacterization of raw data/>Calculation/>And/>The difference between them is expressed as:
in the method, in the process of the invention, Is root mean square error,/>For/>True value of individual samples,/>For/>Prediction of individual samples,/>Is the number of samples;
The smaller the RMSE value, the smaller the gap between the data generated by the representative generation network and the real data;
the discrimination network evaluates the authenticity of the input data, minimizes the accuracy of the fake data generated by the generator, and discriminates the fake data generated by the generator from the real data, wherein the calculation formula is as follows:
in the method, in the process of the invention, As a minimum loss function of the arbiter,/>Is true data/>Distribution expectations/>Is random noise/>Distribution expectations/>,/>For the discriminator/>Pair generator/>Discrimination probability of/>Is true data,/>Is random noise,/>To distinguish network/>For a given input/>The probability of whether it is true data is determined,Generating a network/>According to input noise/>Generated data,/>Is the expected value/>For the distribution of the real data,Is the distribution of input noise;
Is composed of two parts, the first part/> Corresponding to maximizing the accuracy of the discriminator to the real data; if/>Is the real data,/>Close to 1,/>Maximum; second partCorresponding to minimizing the accuracy of the discriminator to the counterfeit data generated by the generator if/>Is data generated by a generator,/>Is 0,/>Maximum.
6. The heart rate prediction method based on the enhanced spatial construction and generation countermeasure network according to claim 1, wherein in step S2, the construction network, the inverse construction network, and the generation countermeasure network model calculation formula are composed of transformers, including multi-head self-attention, position coding, and feedforward networks, self-attention formulasThe following are provided:
in the method, in the process of the invention, For/>Matching result of/>Is the/>, in the sequenceElement,/>For the number of sampling points in the sequence,Is an asymmetry index kernel/>,/>To correspond to the/>Information value of individual element,/>For inputting information/>At the input of information/>The conditional probability expectation,/>Obtaining an output from the attention combination V and Q, the multi-headed attention being split into a plurality of heads by splitting the attention mechanism;
The feed forward network formula is as follows:
in the method, in the process of the invention, Calculating the result for the feed-forward network,/>Calculating maximum for taking forward direction,/>To input information,/>For input layer corresponding weights,/>For the output layer corresponding weights,/>For input layer corresponding bias,/>Correspondingly biasing the output layer;
The feedforward network comprises two Dense layers and Relu activation functions to provide nonlinear transformation, and the feedforward network is fitted to the maximum in a mode of combining the linear transformation and the nonlinear transformation;
the position coding formula is as follows:
in the method, in the process of the invention, Encoding the result for the even-numbered element position in the sequence,/>For the odd-numbered element position encoding result,/>To set the coding frequency,/>Is word vector dimension,/>Is the/>, of the word vectorThe dimensions of the dimensions,Is the absolute position of the current word.
7. The method for predicting heart rate based on enhanced spatial construction and generation of an countermeasure network according to claim 1, wherein in step S2, the multi-loss value composite training model includes:
The expression for the resistance loss function is:
in the method, in the process of the invention, As a contrast loss function,/>Generator minimum loss function,/>As a maximum loss function of the arbiter,/>As a loss function,/>To predict step size,/>For a known step size,/>To distinguish network,/>Generating a network,/>Is true heart rate data,/>Is Gaussian noise;
the expression of the consistency loss function is:
in the method, in the process of the invention, As a consistency loss function,/>For the representation of real heart rate data in construction space,/>Is a representation of gaussian noise in construction space;
The expression of the kinetic energy loss function is:
in the method, in the process of the invention, As a kinetic energy loss function,/>For/>Information representative of the next time step;
the expression for constructing the loss function is:
in the method, in the process of the invention, To construct the loss function,/>The Gaussian noise is recovered and mapped to the original space representation data after construction space training.
8. The heart rate prediction method based on the enhanced spatial construction and generation countermeasure network according to claim 1, wherein in step S3, the deep learning model GAN-ECGformer training process specifically includes:
Input: the ECG signal is transmitted to the computer via a network,
Wherein the method comprises the steps ofRepresenting the representation of the signal in the original space, the observation step length is/>Prediction step size is/>,/>There is/>And (3) withCommon composition,/>Represents the extracted/>, of the real signalElements to/>Elements, used for model as basis sequence of prediction,/>Represents the extracted/>, of the real signalElements to/>A number of elements representing a sequence portion for validating the prediction; /(I)A set of all data for the original data set;
The iteration times are as follows Constructing a network as/>Reverse building a network to/>Generating a network as/>Judging the network as/>;/>Is a GAN-ECGformer model;
and (3) outputting: predicted heart rate predicted by GAN-ECGformer
Wherein the method comprises the steps ofRepresenting the representation of a signal in original space,/>Representing the results of model predictions, sequence co/>A number of sampling points are used to sample the sample,
Step 1, training
Step 2, sampling initial noiseWherein/>To/>Randomly distributing and sampling to obtain;
Step 3 of the method, in which the step 3,
Step 4 of the process, in which,; Wherein/>Generator multiple loss value sum,/>For the value of the resistance loss,/>Is a consistency loss value,/>Is a kinetic energy loss function;
Step 5, updating and generating network parameters;
Step 6 of the method, in which, ;/>Sum the loss values of the discriminator;
step 7, updating and judging network parameters;
step 8, repeating the steps 3-7 twice;
step 9, repeating the steps 3-8, Secondary times;
And 10, saving the model.
9. The heart rate prediction method based on the enhanced spatial construction and generation countermeasure network according to claim 1, wherein in step S3, the expression of the RMSE index is:
in the method, in the process of the invention, Is root mean square error,/>For the total number of samples,/>Is true value,/>Is a predicted value;
The expression of MAE index is:
in the method, in the process of the invention, Is the average absolute error;
The expression of the PRD index is:
in the method, in the process of the invention, Is the percentage root mean square error;
the FD index is expressed as:
in the method, in the process of the invention, For the characteristic distortion rate,/>For the original data/>Is/are of the eigenvectors of (1)To generate data/>Is/are of the eigenvectors of (1)Is the vector norm.
10. A heart rate prediction system based on enhanced spatial structuring and generation of an countermeasure network, characterized in that the system is realized by a heart rate prediction method based on enhanced spatial structuring and generation of an countermeasure network as claimed in any one of claims 1 to 9, the system comprising:
the preprocessing module is used for filtering noise from the original data set through an EMD empirical mode decomposition algorithm;
The deep learning model GAN-ECGformer training module is used for mapping an original high-dimensional heart rate signal to a construction space through a deep learning model GAN-ECGformer construction network and an inverse construction network, and inputting heart rate waveform data into splicing noise in a low-dimensional space; firstly, training a construction network and an inverse construction network, then alternately training a generation network and a discrimination network in a generated countermeasure network model, generating more real data, distinguishing the difference between the real data and the generated data, and training a deep learning model GAN-ECGformer by using a multi-loss value composite training model;
And the evaluation module is used for checking the quality of the prediction sample after the deep learning model GAN-ECGformer is trained, and evaluating the prediction accuracy of the deep learning model GAN-ECGformer by using the RMSE index, the MAE index, the PRD index and the FD index.
CN202410381113.4A 2024-04-01 2024-04-01 Heart rate prediction method and system based on enhanced spatial construction and generation countermeasure network Active CN117972439B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410381113.4A CN117972439B (en) 2024-04-01 2024-04-01 Heart rate prediction method and system based on enhanced spatial construction and generation countermeasure network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410381113.4A CN117972439B (en) 2024-04-01 2024-04-01 Heart rate prediction method and system based on enhanced spatial construction and generation countermeasure network

Publications (2)

Publication Number Publication Date
CN117972439A true CN117972439A (en) 2024-05-03
CN117972439B CN117972439B (en) 2024-06-18

Family

ID=90864888

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410381113.4A Active CN117972439B (en) 2024-04-01 2024-04-01 Heart rate prediction method and system based on enhanced spatial construction and generation countermeasure network

Country Status (1)

Country Link
CN (1) CN117972439B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112116022A (en) * 2020-09-27 2020-12-22 中国空间技术研究院 Data generation method and device based on continuous hybrid potential distribution model
CN113269256A (en) * 2021-05-26 2021-08-17 广州密码营地科技有限公司 Construction method and application of Misrc-GAN model
CN115019510A (en) * 2022-06-29 2022-09-06 华南理工大学 Traffic data restoration method based on dynamic self-adaptive generation countermeasure network
CN116720056A (en) * 2023-05-31 2023-09-08 兰州理工大学 Enhancement decoding-based AE-GAN ECG signal reconstruction method
CN116787227A (en) * 2023-06-28 2023-09-22 辽宁石油化工大学 Cutter abrasion state monitoring method based on data enhancement and multi-feature fusion under small sample
CN117031539A (en) * 2023-07-26 2023-11-10 西安交通大学 Low-frequency reconstruction method and system for self-supervision deep learning seismic data

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112116022A (en) * 2020-09-27 2020-12-22 中国空间技术研究院 Data generation method and device based on continuous hybrid potential distribution model
CN113269256A (en) * 2021-05-26 2021-08-17 广州密码营地科技有限公司 Construction method and application of Misrc-GAN model
CN115019510A (en) * 2022-06-29 2022-09-06 华南理工大学 Traffic data restoration method based on dynamic self-adaptive generation countermeasure network
CN116720056A (en) * 2023-05-31 2023-09-08 兰州理工大学 Enhancement decoding-based AE-GAN ECG signal reconstruction method
CN116787227A (en) * 2023-06-28 2023-09-22 辽宁石油化工大学 Cutter abrasion state monitoring method based on data enhancement and multi-feature fusion under small sample
CN117031539A (en) * 2023-07-26 2023-11-10 西安交通大学 Low-frequency reconstruction method and system for self-supervision deep learning seismic data

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王子轩: "基于多尺度时间卷积神经网络模型的股票价格预测研究", 《中国优秀硕士学位论文全文数据库》, 31 July 2023 (2023-07-31), pages 1 - 69 *

Also Published As

Publication number Publication date
CN117972439B (en) 2024-06-18

Similar Documents

Publication Publication Date Title
US9161705B2 (en) Method and device for early detection of heart attack
US20100217144A1 (en) Diagnostic and predictive system and methodology using multiple parameter electrocardiography superscores
WO2019161611A1 (en) Ecg information processing method and ecg workstation
Fang et al. Dual-channel neural network for atrial fibrillation detection from a single lead ECG wave
Azami et al. Entropy analysis of univariate biomedical signals: Review and comparison of methods
CN116602642A (en) Heart rate monitoring method, device and equipment
Zeng et al. Ensemble learning on heartbeat type classification
à Mougoufan et al. Adaptive ECG beat classification by ordinal pattern based entropies
CN116361688A (en) Multi-mode feature fusion model construction method for automatic classification of electrocardiographic rhythms
Laxmikant et al. An efficient approach to detect diabetes using XGBoost classifier
Yao et al. Interpretation of electrocardiogram heartbeat by CNN and GRU
CN112932498A (en) T wave morphology classification system with strong generalization capability based on deep learning
CN115281688A (en) Cardiac hypertrophy multi-label detection system based on multi-mode deep learning
Tago et al. Classification of TCM pulse diagnoses based on pulse and periodic features from personal health data
CN117582235A (en) Electrocardiosignal classification method based on CNN-LSTM model
CN117972439B (en) Heart rate prediction method and system based on enhanced spatial construction and generation countermeasure network
Bian et al. Direct feature extraction and diagnosis of ECG signal in the compressed domain
Kishore et al. An innovative machine learning approach for classifying ECG signals in healthcare devices
CN110974260A (en) Case-based reasoning depression recognition system based on electroencephalogram characteristics
Nasiri et al. Intelligent arrhythmia detection using genetic algorithm and emphatic SVM (ESVM)
Kumar et al. Covering rough set-based classification for cardiac arrhythmia
CN113647954A (en) Cardiovascular disease identification method, device and medium of two-channel hybrid network model
Nasim et al. An Evolutionary-Neural Mechanism for Arrhythmia Classification With Optimum Features Using Single-Lead Electrocardiogram
Chen et al. Parametric canonical correlation analysis
Albuquerque et al. Authentication based on electrocardiography signals and machine learning

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant