Cardiac pulsation state prediction method, blood pump control method, device and storage medium

The lightweight deep learning model predicts the future R peak occurrence time of ECG signal, which solves the problem of real-time prediction of cardiac pulsation status in patients with heart failure, and realizes real-time physiological adaptive pulsation modulation of the blood pump, reducing the risk of complications.

CN119033380BActive Publication Date: 2025-01-03CENT SOUTH UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411539937.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-01-03
Estimated Expiration
2044-10-31

AI Technical Summary

Technical Problem

The prior art cannot achieve real-time and accurate prediction of the heart pulsation status of patients with heart failure, resulting in the inability of the blood pump to achieve physiological adaptive pulsation modulation, resulting in complications such as gastrointestinal bleeding, thrombosis, etc.

Method used

Using a lightweight cardiac pulsation state prediction model based on deep learning, the future R peak of ECG signal is predicted through wavelet transformation and Butterworth filtering and noise reduction, combined with the sequence segmentation layer, feedforward neural network layer and long-term timing attention mechanism architecture. Time to realize physiological adaptive pulsation modulation of the blood pump.

Benefits of technology

It significantly reduces the computing power requirements of the model, eliminates signal acquisition, preprocessing and transmission delays, and realizes real-time, high-precision physiological adaptive pulsation modulation of the blood pump, reducing the occurrence of complications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119033380B_ABST
    Figure CN119033380B_ABST
Patent Text Reader

Abstract

The present invention discloses a cardiac pulsation state prediction method, a blood pump control method, a device and a storage medium, wherein the prediction method comprises: performing signal preprocessing on the collected ECG signal to obtain a data-enhanced ECG signal; inputting the data-enhanced ECG signal into a lightweight deep learning-based cardiac pulsation state prediction model, and outputting an ECG prediction signal after a preset interval; inputting the ECG prediction signal into an R-peak detector to detect the future R-peak occurrence time. Predicting ECG signals through a lightweight model effectively reduces the model's demand for computing power and solves the problem of computing power limitations of implantable blood pumps; predicting ECG signals and R-peak occurrence times after a preset interval based on nearby historical data can eliminate the time delay caused by signal acquisition, processing, transmission, and dynamic response of the blood pump, so that the physiological adaptability control of the blood pump is real-time and can meet the needs of clinical applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blood pump physiological adaptability control, and in particular to a heart beat state prediction method, a blood pump control method, a device and a storage medium. Background Art

[0002] At present, commercial blood pumps used in clinical practice generally adopt a constant speed and artificial pulse working mode, which is incompatible with the pulsating blood supply mode of the human heart. Clinical studies have shown that a series of complications will occur when the human body is supported by a non-physiologically adaptive blood supply mode for a long time, such as: increased probability of gastrointestinal bleeding, thrombosis or aortic insufficiency, impaired renal function, ischemic and hemorrhagic stroke, vascular dysfunction, etc. Physiologically adaptive pulsating blood pumping can be divided into synchronous pulsation and asynchronous pulsation. Synchronous pulsation means that the pulsation of the blood pump is synchronized with the contraction and relaxation cycle of the heart. Asynchronous pulsation adjusts the phase of the blood pump pulsation and the heart beat to pump blood according to the individual situation of the patient. Studies have found that synchronous pulsation can produce higher aortic pressure and maintain vascular elasticity; asynchronous pulsation can reduce the volume of the heart at the end of diastole, reduce ventricular work, and is conducive to reverse reconstruction of myocardial tissue. Pulsating speed regulation with physiological adaptability can enhance the pulsating performance of blood flow and prevent thrombosis, otherwise it may cause ventricular suction and reflux. The key to physiological adaptive pulsation speed regulation lies in the accurate prediction of heart beats.

[0003] ECG signal (electrocardiogram signal) is a graphical data that records the electrical activity of the heart. It reflects the electrical activity and rhythm of the heart. By analyzing it, the beating state of the heart can be obtained in order to guide the blood pump to make physiological adaptive pulsation modulation.

[0004] At present, in the research on physiological adaptive control of blood pumps based on ECG signals, the relevant method is: the human ECG signal is collected in real time by electrocardiogram acquisition equipment, and then the collected ECG data is analyzed to determine the time domain position of the R peak. Based on the R peak detection, the blood pump motor is dynamically adjusted to achieve pulsation modulation. The limitation of this method is that the execution of steps such as signal acquisition, preprocessing, communication transmission, and dynamic response of the blood pump motor will bring inevitable time delays, making the pulsation modulation not real-time and not a true physiological adaptive control.

[0005] To truly realize the physiological adaptive pulsation modulation of the blood pump, it is necessary to make a real-time and accurate prediction of the cardiac pulsation state of the heart failure patient in the future. However, there is currently no method to achieve real-time and accurate prediction of the cardiac pulsation state of the heart failure patient in the future.

[0006] The patent application with announcement number CN117796817A discloses a method and system for rapid detection and early warning of acute myocardial infarction. Although an ECG signal prediction method is disclosed, it uses a transformer architecture and requires at least 5 seconds of current ECG data to be input, requiring at least one complete heartbeat. This will bring three problems: A. The problem of computing power demand. This solution cannot meet the real-time requirements in the application scenario of physiological adaptive pulsation modulation of the blood pump; B. How to ensure a complete heartbeat (the heartbeat cycle of heart failure patients fluctuates greatly), which requires the use of an algorithm to identify the ECG signal, so the identification takes time, which will also cause delays; C. If a complete heartbeat is required at the current moment, this means that the heart at the current moment has completed the beating, which inherently does not meet the needs of physiological adaptive modulation (the heart and blood pump need to be adaptively modulated at every moment).

[0007] Therefore, there is an urgent need for an accurate and real-time cardiac pulsation state prediction method that can achieve accurate and real-time prediction of the future R peak occurrence time based on the recent historical ECG signal data of heart failure patients, so as to perform physiologically adaptive pulsation speed regulation. Summary of the invention

[0008] In view of the deficiencies in the prior art, the purpose of the present invention is to provide a cardiac pulsation state prediction method, a blood pump control method, a device and a storage medium to solve the problem that the existing solutions are unable to achieve real-time and accurate prediction of the cardiac pulsation state of heart failure patients in the future period, so as to facilitate physiological adaptive pulsation modulation of the blood pump.

[0009] In a first aspect, a method for predicting a cardiac pulsation state is provided, comprising the following steps:

[0010] S1: performing signal preprocessing on the collected ECG signal to obtain an ECG signal after data enhancement;

[0011] S2: Input the data-enhanced ECG signal into a lightweight deep learning-based heart beat state prediction model, and output an ECG prediction signal after a preset interval (the preset interval refers to the preset interval between the cutoff time of the data-enhanced ECG signal input into the heart beat state prediction model and the start time of the ECG prediction signal output by the heart beat state prediction model);

[0012] S3: Input the ECG prediction signal into the R peak detector to detect the future R peak occurrence time.

[0013] Furthermore, in step S1, the signal preprocessing process is:

[0014] The collected ECG signal is filtered and denoised by wavelet transform combined with Butterworth filter layer.

[0015] Furthermore, in step S2, the lightweight deep learning-based heart beat state prediction model includes three parts: a sequence segmentation layer, a feedforward neural network layer, and a long-term temporal attention mechanism architecture layer connected in sequence. The prediction steps are:

[0016] S2.1: In the sequence segmentation layer, the ECG signal after data enhancement is segmented into multiple subsequences and output to the next layer;

[0017] S2.2: Input the subsequence output by the sequence segmentation layer into the feedforward neural network layer to complete the expression of temporal features and output it to the next layer;

[0018] S2.3: Input the subsequence output by the feedforward neural network layer into the long-term temporal attention mechanism architecture layer to extract the correlation between the temporal features of the subsequence ECG signals;

[0019] S2.4: Output the ECG prediction signal after a preset interval from the long-term temporal attention mechanism architecture layer.

[0020] Furthermore, in step S2.1, when performing sequence segmentation on the ECG signal after data enhancement, the data window length and the window sliding length are set, and the data window is slid according to the window sliding length to segment the ECG signal after data enhancement into multiple subsequences; wherein, the window sliding length is not greater than the data window length.

[0021] Furthermore, the number of subsequences after segmentation is defined as N, the batch is defined as B, and the subsequence length is defined as T. Then the tensor is in the form of (B, N, T).

[0022] Step S2.2 specifically includes:

[0023] Define the feedforward neural network layer and perform linear embedding. The feedforward neural network layer is expressed as:

[0024]

[0025] In the formula, output is the output of the feedforward neural network layer; W is the weight matrix, and the weight matrix form is (N, E); b is the bias term; input is a tensor in the form of (B, N, T); after the above formula transformation, the output tensor is in the form of (B, E, T), and the number of subsequences N has been linearly mapped to the new dimension E.

[0026] Furthermore, step S2.3 specifically includes:

[0027] Transpose the input tensor (B, E, T) to (B, T, E), apply a linear transformation, and map it to the query, key, and value vector space by matrix multiplication of the input tensor with the weight matrix;

[0028] The similarity between the query vector and the key vector is calculated by dot product and converted into attention weights by Softmax function;

[0029] Use the calculated attention weights to perform a weighted sum on the value vector to generate a weighted representation.

[0030] Further, in step S3, the steps of the R peak detector detecting the future R peak occurrence time are as follows:

[0031] S3.1: performing noise reduction preprocessing on the predicted ECG prediction signal;

[0032] S3.2: Calculate the first derivative of the preprocessed ECG prediction signal;

[0033] S3.3: Perform a square operation on the signal after the derivative;

[0034] S3.4: Integrate the squared signal using a sliding window;

[0035] S3.5: Preliminary peak detection based on the set initial dynamic threshold and the minimum distance between peaks;

[0036] S3.6: Optimize the peaks initially detected.

[0037] In a second aspect, a blood pump control method is provided, comprising the following steps:

[0038] Real-time collection of historical ECG signals immediately before the current moment;

[0039] Based on the historical ECG signal collected in real time and close to the current moment, the future R peak occurrence time is obtained by using the cardiac pulsation state prediction method as described above;

[0040] Physiologically adaptive pulsatile modulation of the blood pump is performed based on the future R peak occurrence time.

[0041] In a third aspect, an electronic device is provided, including:

[0042] a memory having a computer program stored thereon;

[0043] The processor is used to load and execute the computer program to implement the cardiac beat state prediction method or blood pump control method as described above.

[0044] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the cardiac beat state prediction method or blood pump control method as described above is implemented.

[0045] The present invention proposes a cardiac pulsation state prediction method, a blood pump control method, a device and a storage medium, which have the following beneficial effects:

[0046] (1) After sequence segmentation, assuming that the ECG signal of length Z is divided into N subsequences of length T (Z>>N), the computational complexity of the cardiac pulsation state prediction model is , is the computational complexity of the Transformer architecture , which makes the model lightweight, effectively reduces the model's demand for computing power, and solves the computing power limitation problem of implantable blood pumps;

[0047] (2) Based on recent historical data, the ECG signal and R peak occurrence time after a preset interval are predicted. The prediction effectively eliminates the time delay caused by signal acquisition, preprocessing, signal transmission, and dynamic response of the blood pump, making the physiological adaptive control of the blood pump real-time and meeting the needs of clinical applications.

[0048] (3) The ECG signal is segmented into multiple subsequences through the sequence segmentation layer. Each subsequence contains more ECG feature information than a single-point signal. The subsequence temporal features are expressed through the feedforward neural network layer. The correlation between the temporal features of the subsequence ECG signals is extracted from a global perspective through the long-term temporal attention mechanism architecture layer. This can significantly improve the prediction accuracy of the ECG signal, and further significantly improve the prediction accuracy of the R peak occurrence time, so as to achieve real-time, high-precision physiological adaptive pulsation modulation of the blood pump. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] 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 described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0050] Figure 1 is a flow chart of a method for predicting a cardiac pulsation state provided by an embodiment of the present invention;

[0051] Figure 2 is a schematic diagram of signal preprocessing steps provided by an embodiment of the present invention;

[0052] Figure 3 is a schematic diagram of sequence segmentation steps provided by an embodiment of the present invention;

[0053] Figure 4 is a schematic diagram of a specific example implementation step of sequence segmentation provided by an embodiment of the present invention;

[0054] Figure 5 It is a schematic diagram of the implementation steps of the feedforward neural network layer provided by an embodiment of the present invention;

[0055] Figure 6 It is a schematic diagram of the implementation steps of the transposed self-attention mechanism architecture provided by an embodiment of the present invention;

[0056] Figure 7 Schematic diagram of R peak detection steps provided by an embodiment of the present invention;

[0057] Figure 8 It is a flow chart of a blood pump control method provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0058] To make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described in detail below. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other implementation methods obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.

[0059] It should be noted that in the description of the embodiments of the present invention, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "include one..." do not exclude the presence of other identical elements in the process, method, article or device including the elements. The orientation or positional relationship indicated by the terms "upper", "lower", etc. is based on the orientation or positional relationship shown in the accompanying drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances.

[0060] In addition, the technical solutions between the various embodiments of the present invention can be combined with each other, but it must be based on the fact that ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0061] The basic idea of ​​the present invention is to first provide a method for predicting the cardiac pulsation state based on deep learning and natural cardiac signals, which performs wavelet transform on the collected ECG signal and combines it with Butterworth filtering to reduce noise to obtain the ECG signal after data enhancement, and designs a method for predicting the cardiac pulsation state based on deep learning - sequence segmentation realizes the ECG signal is divided into multiple subsequences, and each subsequence is input as a whole into the feedforward neural network layer to realize the expression of time features, and then the correlation between the time features of the subsequence ECG signals is extracted through the long-term temporal attention mechanism architecture, and the ECG prediction signal obtained after the correlation extraction is completed is detected by the R wave detector. The R peak occurrence time; secondly, a blood pump control method is provided, which realizes the physiological adaptive pulsation modulation of the blood pump based on the R peak occurrence time predicted by the cardiac pulsation state prediction method. The technical solution of the present invention is described in detail below in conjunction with specific embodiments.

[0062] like Figure 1 As shown, an embodiment of the present invention provides a method for predicting a cardiac pulsation state, comprising the following steps:

[0063] S1: Perform signal preprocessing on the collected ECG signal to obtain an ECG signal after data enhancement.

[0064] Specifically, the signal preprocessing process is: for the collected ECG signal, filtering and noise reduction are performed through wavelet transform combined with Butterworth filter layer.

[0065] S2: Input the data-enhanced ECG signal into a lightweight deep learning-based cardiac beat state prediction model, express the time characteristics of the signal and extract the correlation between the signal time characteristics, and output the ECG prediction signal after the preset time interval.

[0066] Specifically, the lightweight deep learning-based heart beat state prediction model consists of three parts: a sequence segmentation layer, a feedforward neural network layer, and a long-term temporal attention mechanism architecture layer connected in sequence. The prediction steps of the heart beat state prediction model are:

[0067] S2.1: In the sequence segmentation layer, the ECG signal after data enhancement is segmented into multiple subsequences and output to the next layer;

[0068] S2.2: Input the subsequence output by the sequence segmentation layer into the feedforward neural network layer to complete the expression of temporal features and output it to the next layer;

[0069] S2.3: Input the subsequence output by the feedforward neural network layer into the long-term temporal attention mechanism architecture layer to extract the correlation between the temporal features of the subsequence ECG signals, and output the ECG prediction signal after a preset time interval from the long-term temporal attention mechanism architecture layer.

[0070] It should be noted that the preset duration of the interval refers to: the preset duration of the interval between the cutoff time of the ECG signal after data enhancement input into the heart beat state prediction model and the start time of the ECG prediction signal output by the heart beat state prediction model.

[0071] The advantage of this step is that it uses the heart beat state prediction model to segment the ECG signal into multiple subsequences through sequence segmentation. Each subsequence contains more ECG feature information than a single-point signal. The time feature expression is performed and the correlation between the time features of the subsequence ECG signals is extracted, thereby improving the accuracy of the prediction.

[0072] S3: Input the ECG prediction signal into the R peak detector to detect the future R peak occurrence time.

[0073] The method for predicting the heart beat state provided in the above embodiment has the following advantages compared with the prior art:

[0074] (1) Low usage conditions:

[0075] The transformer architecture is used in the prior art, which requires at least 5 seconds of current ECG data to be input, and requires at least one complete heartbeat, and requires a professional doctor to label the ECG signal. In this embodiment, an improved lightweight attention architecture is used. For input segments of any length (no matter how long), assuming that the sequence segmentation data window is 12, taking a sampling rate of 250HZ as an example, the difference in computing power between the two methods is (250×5)^2 / (12)^2=10850.7 times. In other words, under the same computing power and the same model size, the computing speed of the algorithm in this embodiment is 10850.7 times that of the prior art. The prior art cannot meet the requirements of real-time performance and hardware miniaturization in the application scenario of physiological adaptive pulsation modulation of blood pumps; in addition, the prior art uses two sets of Transformer architectures plus an attention mechanism, and this embodiment only uses an improved Transformer encoder architecture, and the size of the model is less than 1 / 12 of the other party. This embodiment does not require professional doctors to label, has extremely low computing power, and can be used with any input length (does not necessarily include a heartbeat), and does not need to include QRS information. Existing pulse modulation methods basically require information before and after the R peak when detecting the R peak, generally 150ms before and after, which is close to a complete heartbeat. This embodiment does not require data before and after the R peak, but only requires extremely short historical data before the current moment.

[0076] (2) No delay:

[0077] At present, there are many studies related to physiological adaptive modulation, but they all ignore the delay in detecting heart beats. Through searching the data, it is found that all relevant real-time rapid pulse modulation methods are to quickly collect and identify the ECG signals before and after the R peak, and then obtain the moment of the R peak. The delay of these methods is more than 40ms, plus the calculation time of the pulse modulation algorithm and the delay of the motor response, which may be close to the duration of the QRS wave of 120ms. The method of this embodiment is: to achieve long-distance prediction, set to predict the ECG signal after the preset time interval of the current moment (such as 30 sampling points (120ms), which can be adjusted according to the actual computing power). This preset time can eliminate the delay caused by the detection of the R peak occurrence time, the calculation of the pulse modulation algorithm, and the motor response, so there is no delay, which can ensure the realization of accurate physiological adaptive modulation.

[0078] (3) High efficiency and high precision:

[0079] The embedding of the Transformer architecture in the prior art embeds the 1 dimension in (B, Z, 1), which realizes the embedding of the ECG signal value in a higher dimension, where (B, Z, 1) is the tensor form of the original ECG, B is the batch, Z is the signal length, that is, the number of ECG signals collected, which is also the time step feature, and 1 is the corresponding signal value; while this embodiment embeds the N (number of subsequences divided) dimension, which has the following significance: 1. The goal to be achieved is to make predictions on the time series, so the embedding is carried out on the time dimension, further mining the information on the time features, and further optimizing the sequence segmentation. These processing on the time dimension further enhances the model's ability to predict the time series; 2. Doctors often diagnose and treat based on the ECG composed of the original ECG signal data. Embedding the original ECG signal may not necessarily obtain good gain. Therefore, this embodiment does not process the ECG signal dimension and retains the original heart beat information. The algorithm of this embodiment achieves an average prediction error of 1.2ms, which can meet the needs of clinical use and is currently ahead of all algorithms in the field of time series prediction. The significant improvement in the prediction accuracy of ECG signals is also conducive to effectively identifying the type of heart disease patients.

[0080] More specifically, if Figure 2 As shown, the signal preprocessing process includes:

[0081] S1.1: Wavelet transform: First, a suitable wavelet function is selected, and then the signal is processed with the wavelet function through convolution operation to obtain coefficients of multiple scales and frequencies. Then, downsampling is applied to decompose these coefficients into low-frequency and high-frequency components to form wavelet coefficients, and finally the signal is reconstructed through inverse wavelet transform.

[0082] In this embodiment, the wavelet function is a Morlet wavelet, the ECG signal sampling frequency is preferably 250 Hz, the Nyquist sampling frequency is preferably 125 Hz, and after the convolution operation, the number of wavelet coefficient layers decomposed is 7, and the number of wavelet coefficient layers retained is preferably 1-6.

[0083] S1.2: Butterworth filtering: First, set the low-frequency cutoff frequency and high-frequency cutoff frequency of the Butterworth filter, then input the wavelet coefficients into the designed Butterworth filter, process these coefficients through the filter to remove unnecessary frequency components or smooth the signal, and finally output a smoothed optimized signal.

[0084] In this embodiment, the low frequency cut-off frequency is preferably 5 Hz, and the high frequency cut-off frequency is preferably 20 Hz.

[0085] In step S2.1, when the ECG signal after data enhancement is sequenced, the data window length and the window sliding length are set, and the data window is slid according to the window sliding length to segment the ECG signal after data enhancement into multiple subsequences; wherein, the window sliding length is not greater than the data window length. Each person's ECG signal has its own characteristics, so the window sliding length is set to be no greater than the data window length, which is significant in that: 1. When the window sliding length is less than the data window length, the boundary effects such as feature splitting caused by sequence segmentation are eliminated in a redundant manner; 2. The ECG signals of some patients may not have boundary effects, so they can also be set to be equal, thereby achieving full coverage but no redundancy.

[0086] like Figure 3 As shown, the specific steps of performing sequence segmentation on the ECG signal after data enhancement in this embodiment are as follows:

[0087] S2.1.1: Select the appropriate input signal length, set the data window length and window sliding length;

[0088] In this embodiment, an input signal length of 185, a data window length of 12, and a window sliding length of 6 are taken as an example for description.

[0089] S2.1.2: Pad the sequence to a suitable length so that the ECG signal does not lose its boundary information and the integrity of the signal is ensured. In this embodiment, the length of the sequence after padding can be selected to be 186.

[0090] S2.1.3: Slide the data window to divide the signal into a suitable number of subsequences. In this embodiment, the number of subsequences after the signal is divided is 30.

[0091] like Figure 4 As shown, in order to facilitate the understanding of steps S2.1.2 and S2.1.3, a simple example is now given, assuming that the input signal length is 11, the data window length is 4, and the window sliding length is 2.

[0092] In order to prevent the signal with a length of 11 from losing its boundary information, the signal length needs to be padded to an integer multiple of 2. The filling rule is: copy the content of the last signal point of the original signal, and fill the copied content to the right of the signal point to be filled. The preferred length of the filled signal is 12, then it is necessary to fill 1 signal point to the right, and the filling content is the content of the last signal point of the original signal: 11. The signal after filling is as follows Figure 4 shown.

[0093] According to the filling rule, the subsequence obtained by the first segmentation is 1234, the subsequence obtained by the second segmentation is 3456, and so on, until the complete signal segment is segmented.

[0094] The advantages of this step are: 1. The ECG signal is divided into multiple subsequences, so that each subsequence contains more specific ECG feature information than a single-point signal, which can improve the accuracy of heart beat prediction; 2. When the sequence is divided, the data window length is greater than the window sliding length, and overlapping sliding is performed, which can remove the boundary effect, ensure the integrity of the signal, and improve the accuracy of the prediction of the heart beat state.

[0095] Define the number of subsequences after segmentation as N, the batch as B, and the subsequence length as T, then the tensor is in the form of (B, N, T); the number of subsequences N can be regarded as an overall time step, and the subsequence length T can be regarded as the feature of the time step.

[0096] like Figure 5 As shown, in S2.2, the subsequence completes the expression of temporal features through the feedforward neural network layer, and the specific steps are as follows:

[0097] S2.2.1: Input signal;

[0098] S2.2.2: Define feedforward neural network layers and perform linear embedding;

[0099] Define a feedforward neural network layer that embeds the number of subsequences N into a high-level dimensional space.

[0100] The formula for a feedforward neural network layer is:

[0101]

[0102] Where output is the output of the feedforward neural network layer; W is the weight matrix, and b is the bias term;

[0103] Specifically, the input is a tensor in the form of (B, N, T), and the weight matrix is ​​in the form of (N, E), which embeds the time dimension N. After the above formula transformation, the output tensor will have the form of (B, E, T). In this way, the number of subsequences N has been linearly mapped to the new dimension E. In this embodiment, N=30 and E=128.

[0104] The advantage of this step is that it performs high-dimensional embedding on the time dimension of the subsequence instead of high-dimensional embedding on the time feature dimension of the subsequence, so that the expression of the time feature is more complete.

[0105] Doctors often divide the heartbeat ECG signal into P band, QRS band, and T band, analyze the above bands, and then associate them together to diagnose the patient's arrhythmia. These bands also determine the physiological value of the ECG signal, which is why existing technology requires a complete heartbeat to make predictions. Due to the requirements of the present invention for real-time performance and application, only data of the window length in the historical data can be input, and no requirements are made on whether the data contains a complete heartbeat. Therefore, a sequence segmentation layer is proposed to solve the above problem. Each of the above input data (actually incomplete) is considered to be a complete signal, and then the input ECG signal is divided into several subsequence bands according to the doctor's diagnosis and treatment process. Subsequently, the correlation of the subsequence bands is studied through the long-term temporal attention mechanism architecture layer to make predictions. Its significance lies in: 1. The prior art uses the ECG data corresponding to each moment as the token input, and a single signal has no physiological meaning. In this embodiment, each subsequence is used as the token input. A subsequence is an ECG band, which is an input with physiological significance. In the subsequent attention mechanism, the prior art focuses on the correlation between single ECG signals, and this embodiment focuses on subsequences. 1. The correlation between bands is consistent with the process of doctors diagnosing P band and QRS band; 2. Using the segmented subsequence as input also realizes the lightweight of the model. The total number of tokens in this embodiment is reduced to N, while the total number of tokens in the prior art model is Z; 3. Further explanation of physiological significance: the original ECG tensor form is (B, Z, 1), and the tensor form after segmentation is (B, N, T). The position of the signal value changes from 1 to T, that is, the feature of each time step changes from the original 1 (signal value) to T (a band composed of T signal values). The band is the ECG change over a period of time, which is more physiologically significant than a single signal; and Z becomes N, that is, token (time step) changes from Z to N. The prior art studies the correlation between Z, that is, the correlation between single time steps. This embodiment changes to studying the correlation between N, that is, the correlation between sub-bands, which is consistent with doctors.

[0106] S2.2.3: Output signal;

[0107] like Figure 6 As shown, in S2.3, the correlation between the temporal features of the subsequence ECG signals is extracted through the long-term temporal attention mechanism architecture layer, and the specific steps are as follows:

[0108] S2.3.1: Input:

[0109] The output of the feed-forward neural network layer is used as the input of the long-term temporal attention mechanism architecture.

[0110] S2.3.2: Tensor transposition, linear transformation:

[0111] Swap the T and E dimensions of the input tensor, transpose it to (B, T, E), apply a linear transformation, and map it to the query, key, and value vector space by performing matrix multiplication between the input tensor and the weight matrix;

[0112] Specifically, the weight matrices for the query vector, key vector, and value vector are The dimension is 12×12;

[0113] The advantage of this step is that before sequence segmentation, the weight matrix The dimensions of are all 185×185, which are 12×12 after segmentation and transposition. The matrix dimension is reduced, which effectively reduces the number of parameters and the amount of calculation in subsequent steps.

[0114] S2.3.3: Calculate attention weights:

[0115] The similarity between the query vector and the key vector is calculated by dot product and converted into attention weights by Softmax function. These weights represent the attention of each time step or feature to the current time step or feature;

[0116] Specifically, the similarity calculation formula is:

[0117]

[0118] in Represents the query vector and key vector The dot product score between ;

[0119] The Softmax function formula is:

[0120]

[0121] in, For the query vector and key vector The attention weight.

[0122] The advantage of this step is that the correlation of the time feature dimension of the subsequence is extracted instead of the correlation of the time dimension, which effectively improves the accuracy of heart beat prediction.

[0123] S2.3.4: Weighted summation:

[0124] Use the calculated attention weights to perform weighted summation on the value vector to generate a weighted representation;

[0125] Specifically, the weighted summation formula is:

[0126]

[0127] in is a value vector, To generate a weighted representation.

[0128] S2.3.5: Output representation:

[0129] The weighted representation is passed through a feed-forward neural network consisting of linear transformation and activation function to generate the final ECG prediction signal.

[0130] The purpose of the present invention is to achieve ultra-long-term time series prediction (with intervals in the middle), and the content to be predicted is likely to be related to features from a very long time ago (premature beats are induced by electrocardiographic impulses from a long time ago). If the attention model is directly input, then each step of the attention mechanism can only be calculated from a local perspective and cannot be studied from a global perspective. The above problem is solved by transposition, and accurate prediction across long intervals is achieved: 1. The dimension of the input token is changed from E to T by transposing (B, E, T), and the corresponding feature of each token contains the information of the entire time series, thereby obtaining a global perspective and improving the model's prediction ability; 2. The amount of calculation is further reduced, and tokens are changed from E to T, achieving lightweight.

[0131] like Figure 7 As shown, the steps of detecting the future R peak occurrence time in the R peak detector are as follows:

[0132] S3.1: Preprocessing: Perform noise reduction preprocessing on the predicted ECG prediction signal.

[0133] The noise reduction preprocessing specifically uses a bandpass filter to remove low-frequency baseline drift and high-frequency noise to obtain a relatively clean ECG signal. In this embodiment, the lower cutoff frequency of the bandpass filter is preferably 5 Hz, and the upper cutoff frequency is preferably 15 Hz.

[0134] S3.2: Derivative processing: Calculate the first-order derivative of the preprocessed ECG prediction signal to highlight the rapidly changing part of the QRS complex wave, thereby enhancing the characteristics of the R peak.

[0135] S3.3: Square operation: Perform a square operation on the derivative signal to increase the significance of the R peak and further emphasize the characteristics of the QRS wave.

[0136] S3.4: Sliding window integration: Use a sliding window to perform integration processing on the squared signal. Set a suitable window length, which helps to smooth the signal and improve the identifiability of the R peak. In this embodiment, the sliding window length is selected to be 250ms.

[0137] S3.5: Preliminary peak detection: Preliminary peak detection is performed based on the set initial dynamic threshold and the minimum distance between peaks to ensure that significant and relatively independent peaks are detected. In this embodiment, the preferred initial dynamic threshold is 1.5 times the sliding window integral mean, and the minimum distance between the initial peaks is 500ms.

[0138] S3.6: Further optimize the peak value: optimize the peak value detected initially, first initialize the optimized peak value list, then traverse the peak value detected initially, then define a search window for each peak value, find the local peak value within the window, and finally return the optimized peak value. In this embodiment, the preferred search window range is the area of ​​100ms before and after the peak value.

[0139] Step 3.7, evaluate the match between the predicted value and the true value: first initialize the list, then traverse all the true values, find the predicted value closest to the true value, then use the set threshold to determine whether the true value matches the predicted value, calculate the number of unmatched predicted values ​​and true values, and finally calculate the accuracy.

[0140] Based on the heart beat state prediction method provided in the above embodiment, the embodiment of the present invention further provides a blood pump control method, comprising the following steps:

[0141] Step 1: Real-time collection of historical ECG signals immediately before the current moment;

[0142] Step 2: Preprocess the historical ECG signal collected in real time immediately before the current moment to obtain an ECG signal after data enhancement;

[0143] Step 3: Input the ECG signal after data enhancement into the lightweight heart beat state prediction model based on deep learning, and output the ECG prediction signal after the preset interval;

[0144] Step 4: Input the ECG prediction signal into the R peak detector to detect the future R peak occurrence time;

[0145] Step 5: Perform physiological adaptive pulsation modulation on the blood pump based on the future R peak occurrence time.

[0146] It should be noted that, in this embodiment, the historical ECG signal immediately adjacent to the current moment is selected as input, and the preset interval duration is determined based on the detection of the R peak occurrence time, the calculation of the pulse modulation algorithm, and the shortest delay caused by the motor response. The reason is that by selecting the latest ECG signal and the shortest prediction interval, higher accuracy and real-time performance can be pursued, and higher blood pump control accuracy can be achieved. Of course, in other embodiments, if the requirements for real-time performance and accuracy are not so high, a more recent historical ECG signal can be appropriately selected as input according to actual conditions, or the prediction interval can be extended (i.e., a longer preset interval duration is selected).

[0147] For the contents not described in detail in this embodiment, please refer to the same or similar parts in the above embodiments, and no further description will be given here.

[0148] The blood pump control method provided in the above embodiment has the following advantages:

[0149] (1) After sequence segmentation, assuming that the historical ECG signal of length Z immediately adjacent to the current moment is divided into N subsequences (Z>>N), T is the length of each subsequence, then the computational complexity of the heart beat state prediction model is , is the computational complexity of the Transformer architecture , which makes the model lightweight, effectively reduces the model's demand for computing power, and solves the computing power limitation problem of implantable blood pumps;

[0150] (2) Based on recent historical data, the ECG signal and R peak occurrence time after a preset interval are predicted. The prediction effectively eliminates the time delay caused by signal acquisition, preprocessing, signal transmission, and dynamic response of the blood pump, making the physiological adaptive control of the blood pump real-time and meeting the needs of clinical applications.

[0151] (3) The historical ECG signal immediately adjacent to the current moment is segmented into multiple subsequences through the sequence segmentation layer. Each subsequence contains more ECG feature information than a single-point signal, and the subsequence temporal features are expressed through the feedforward neural network layer. The long-term temporal attention mechanism architecture layer extracts the correlation between the temporal features of the subsequence ECG signals from a global perspective, which can significantly improve the prediction accuracy of the ECG signal, and further significantly improve the prediction accuracy of the R peak occurrence time. This can realize real-time, high-precision physiological adaptive pulsation modulation of the blood pump, and improve and reduce the occurrence of non-physiological adaptive complications.

[0152] An embodiment of the present invention further provides an electronic device, including:

[0153] a memory having a computer program stored thereon;

[0154] The processor is used to load and execute the computer program to implement the heart beat state prediction method or blood pump control method described in the above embodiments.

[0155] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the heart beat state prediction method or blood pump control method described in the above embodiments is implemented.

[0156] It can be understood that the same or similar parts of the above embodiments can be referenced to each other, and the contents not described in detail in some embodiments can refer to the same or similar contents in other embodiments.

[0157] The effect of the technical solution of the present invention is further described below in conjunction with specific experimental results.

[0158] This experiment is deployed on Pytorch. The ECG detector model proposed in this invention is compared with the existing Autoformer model and Dlinear model in predicting the future R peak occurrence time. The signal sampling time is 4ms. The evaluation indicators include the error between the predicted R peak occurrence time and the actual R peak occurrence time, and the prediction accuracy. The prediction results are shown in Table 1.

[0159]

[0160] According to the prediction results shown in Table 1, when the predicted signal length is the same, the error and accuracy between the R peak occurrence time predicted by the ECG detector model proposed in the present invention and the actual R peak occurrence time are significantly better than those of the Autoformer and Dlinear models.

[0161] At the same time, the prediction performance of the ECG detector model of the present invention, the Autoformer model and the Dlinear for ECG signals is compared. The signal sampling time is 4ms, and the evaluation indicators are mean square error (MSE), mean square absolute error (MAE), root mean square error (RMSE), and normalized root mean square error (NRMSE).

[0162] Table 2 is the MSE table of the ECG detector model provided by the present invention and the other two models at different prediction signal lengths.

[0163]

[0164] Table 3 is a table of MAE values ​​of the ECG detector model provided by the present invention and the other two models at different prediction signal lengths.

[0165]

[0166] Table 4 is a table of RMSE values ​​of the ECG detector model provided by the present invention and the other two models at different prediction signal lengths.

[0167]

[0168] Table 5 is a table of NRMSE values ​​of the ECG detector model provided by the present invention and the other two models at different prediction signal lengths.

[0169]

[0170] According to the results shown in Tables 2, 3, 4 and 5, when the predicted signal length is the same, the error values ​​of the ECG signal predicted by the ECGdetector model proposed in the present invention are significantly smaller than those of the other two models, achieving better results.

[0171] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0172] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0173] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0174] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0175] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.

Claims

1. A method for predicting cardiac pulsation state, characterized in that: The steps include: S1: performing signal preprocessing on the collected ECG signal to obtain an ECG signal after data enhancement; S2: Input the ECG signal after data enhancement into the lightweight heart beat state prediction model based on deep learning, and output the ECG prediction signal after the preset interval; S3: inputting the ECG prediction signal into the R peak detector to detect the future R peak occurrence time; In step S2, the lightweight deep learning-based heart beat state prediction model includes three parts: a sequence segmentation layer, a feedforward neural network layer, and a long-term temporal attention mechanism architecture layer connected in sequence. The prediction steps are: S2.1: In the sequence segmentation layer, the ECG signal after data enhancement is segmented into multiple subsequences and output to the next layer; S2.2: Input the subsequence output by the sequence segmentation layer into the feedforward neural network layer to complete the expression of temporal features and output it to the next layer; S2.3: Input the subsequence output by the feedforward neural network layer into the long-term temporal attention mechanism architecture layer to extract the correlation between the temporal features of the subsequence ECG signals, and output the ECG prediction signal after a preset time interval from the long-term temporal attention mechanism architecture layer.

2. The method for predicting cardiac pulsation state according to claim 1, characterized in that: In step S1, the signal preprocessing process is: The collected ECG signal is filtered and denoised by wavelet transform combined with Butterworth filter layer.

3. The heart beat state prediction method according to claim 1, characterized in that: In step S2.1, when performing sequence segmentation on the ECG signal after data enhancement, the data window length and the window sliding length are set, and the data window is slid according to the window sliding length to segment the ECG signal after data enhancement into multiple subsequences; wherein, the window sliding length is not greater than the data window length.

4. The method for predicting cardiac pulsation state according to claim 1, characterized in that: Define the number of subsequences after segmentation as N, the batch as B, the subsequence length as T, and the form of the tensor after segmentation as (B, N, T); Step S2.2 specifically includes: Define the feedforward neural network layer and perform linear embedding. The feedforward neural network layer is expressed as: ; In the formula, output is the output of the feedforward neural network layer; W is the weight matrix, and the weight matrix form is (N, E); b is the bias term; input is a tensor in the form of (B, N, T); after the above formula transformation, the output tensor is in the form of (B, E, T), and the number of subsequences N has been linearly mapped to the new dimension E.

5. The method for predicting cardiac pulsation state according to claim 4, characterized in that: Step S2.3 specifically includes: Transpose the input tensor (B, E, T) to (B, T, E), apply a linear transformation, and map it to the query, key, and value vector space by matrix multiplication of the input tensor with the weight matrix; The similarity between the query vector and the key vector is calculated by dot product and converted into attention weights by Softmax function; Use the calculated attention weights to perform a weighted sum on the value vector to generate a weighted representation.

6. The method for predicting cardiac pulsation state according to claim 1, characterized in that: In step S3, the steps of the R peak detector detecting the future R peak occurrence time are as follows: S3.1: performing noise reduction preprocessing on the predicted ECG prediction signal; S3.2: Calculate the first derivative of the preprocessed ECG prediction signal; S3.3: Perform a square operation on the signal after the derivative; S3.4: Integrate the squared signal using a sliding window; S3.5: Preliminary peak detection based on the set initial dynamic threshold and the minimum distance between peaks; S3.6: Optimize the peaks initially detected.

7. A blood pump control method, characterized in that: The steps include: Real-time collection of historical ECG signals immediately before the current moment; Based on the historical ECG signal collected in real time immediately before the current moment, the future R peak occurrence time is obtained by using the cardiac pulsation state prediction method as described in any one of claims 1 to 6; Physiologically adaptive pulsatile modulation of the blood pump is performed based on the future R peak occurrence time.

8. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor is used to load and execute the computer program to implement the heart beat state prediction method according to any one of claims 1 to 6 or the blood pump control method according to claim 7.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the heart beat state prediction method according to any one of claims 1 to 6 or the blood pump control method according to claim 7 is implemented.