Maternal and fetal electrocardiogram extraction method based on multi-task learning

By employing a multi-task learning approach, feature extraction and dual-branch modules were constructed. Combined with multi-loss optimization, the noise interference and robustness issues of maternal and fetal electrocardiogram (ECG) signals were resolved. This enabled the extraction of high-precision ECG signals and heartbeat sequences, adapting to different noise levels and individual differences, thereby improving the accuracy of monitoring.

CN121891018APending Publication Date: 2026-04-21UNIV OF SCI & TECH OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610019858.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-08
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In existing technologies, deep learning-based methods for extracting maternal and fetal electrocardiograms suffer from problems such as weak noise resistance, poor robustness, and insufficient accuracy in extracting heartbeat sequences.

Method used

A multi-task learning-based approach is adopted to construct a feature extraction module, a dual-branch extraction module, and a multi-task output module. By combining multi-layer 1D convolution, channel attention, multi-scale transformer, and fully connected layers, and through dual-label and dual-loss collaborative optimization, accurate extraction of maternal and fetal electrocardiogram signals is achieved.

Benefits of technology

It significantly improves the accuracy of heartbeat localization, adapts to different noise levels and individual differences, and achieves high-precision extraction of maternal and fetal electrocardiogram signals, thereby improving the accuracy and reliability of monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121891018A_ABST
    Figure CN121891018A_ABST
Patent Text Reader

Abstract

The invention discloses a maternal and fetal electrocardio extraction method based on multi-task learning. The method comprises the steps that 1, a multi-channel electrode is used for collecting mixed electrocardio signals on the surface of the abdomen of a pregnant woman and preprocessing the mixed electrocardio signals; 2, extracting label signals required by training, and making a data set; 3, constructing a multi-task learning maternal and fetal electrocardiogram extraction network, and training a model by using a training data set in a data set; and 4, performing electrocardiogram extraction on the pregnant woman abdomen surface electrocardiogram signals by utilizing the trained model, and outputting maternal and fetal electrocardiogram waveforms and heart beat sequences thereof. The extraction precision of the maternal and fetal electrocardiosignals can be improved, and the electrocardiosignal waveform signal and the heart beat sequence thereof can be obtained at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of biosignal processing technology, specifically relating to a method for extracting maternal and fetal electrocardiograms based on multi-task learning, which is mainly applied to the extraction of maternal and fetal electrocardiogram and heartbeat sequences. Background Technology

[0002] Fetal electrocardiogram (FECG) is the electrical activity of the fetus in the mother's abdomen, reflecting the electrophysiological signals of fetal cardiac activity. Recording and analyzing FECG is crucial for assessing fetal health, placental function, and fetal cardiac development. The QRS complex, a waveform in the electrocardiogram, represents the process of cardiac contraction. It is generated by the electrical signals caused by the depolarization and repolarization of ventricular myocytes and is used to diagnose and monitor cardiac diseases such as arrhythmias and myocardial ischemia.

[0003] Abdominal surface electrocardiogram (AECG) is an electrocardiogram signal collected from the surface of a pregnant woman's abdomen. It offers advantages such as being non-invasive, safe, portable, and easy to collect. Researchers hope to extract fetal electrocardiogram signals from abdominal ECG signals to achieve non-invasive fetal heart rate monitoring. However, abdominal surface ECG signals are easily affected by various factors (such as muscle movement, fetal movement, maternal respiration, and power line noise). These noise components can interfere with the extraction and analysis of fetal ECG signals, leading to a decrease in signal quality and significantly increasing the difficulty of fetal ECG signal extraction.

[0004] Traditional fetal electrocardiogram (ECG) extraction methods have significant limitations: Adaptive Filter (AF) is difficult to completely remove residual components of maternal ECG signals and is prone to introducing additional noise; blind source separation-based methods (such as Independent Component Analysis (ICA)) are sensitive to noise and depend on the assumption of the number of source signals, which can easily lead to unstable and inaccurate decomposition results.

[0005] In recent years, deep learning-based extraction methods have gradually become a research hotspot. Deep learning can achieve signal extraction through automatic feature learning and modeling. Using deep learning to extract and process fetal ECG signals from the surface of the pregnant woman's abdomen can improve the quality of fetal ECG signals, thereby improving the accuracy and reliability of fetal monitoring. For example, generative adversarial networks (GANs) and long short-term memory networks (LSTMs) have been applied to fetal ECG waveform signal detection and have achieved good results. Among them, deep residual shrinkage networks (DRSNs) have outstanding performance in signal noise reduction. However, deep learning directly fits the ECG waveform signal, and the subsequent heartbeat extraction, i.e., finding the R-wave peak position, requires an additional peak-finding algorithm. The peak-finding results are prone to missed detections and false detections due to waveform noise. Furthermore, deep learning models have poor robustness, and the results are often limited by the distribution of training data, all of which lead to a decrease in the performance of the algorithm in practical applications. Summary of the Invention

[0006] To overcome the shortcomings of existing deep learning-based methods for extracting maternal and fetal electrocardiograms (ECGs), such as "weak noise resistance, poor robustness, and insufficient accuracy in extracting heartbeat sequences," this invention proposes a multi-task learning-based method for extracting maternal and fetal ECGs from the surface ECG signals of the pregnant woman's abdomen. This method aims to successfully extract maternal and fetal ECG signals from the surface ECG signals of the pregnant woman's abdomen, while simultaneously outputting complete ECG waveforms and heartbeat sequences of both the mother and fetus, thereby improving the extraction accuracy of maternal and fetal ECG signals.

[0007] To solve the technical problem, the present invention adopts the following technical solution: The present invention provides a method for extracting maternal and fetal electrocardiograms based on multi-task learning, characterized by the following steps: Step 1, using N Channel high-density electrode acquisition The mixed electrocardiogram (ECG) signals from the surface of the pregnant woman's abdomen were collected at specific times and preprocessed to obtain a preprocessed mixed ECG signal set. ,in, express The preprocessed mixed ECG signal set at specific times, and ,in, express The first time after time preprocessing Mixed ECG signals from multiple channels, where T indicates transpose; ; Indicates the number of channels; L; L is the duration of data collection; Step 2: Construct a mixed ECG signal set tag set ,include: Maternal ECG signal at all times , Real-time fetal electrocardiogram signals , Real-time maternal electrocardiogram and cardiac beat sequence and Real-time fetal electrocardiogram sequence ; Step 3: Construct a multi-task learning network for extracting maternal and fetal ECG data, including: a feature extraction module, a dual-branch extraction module, and a multi-task output module, and then... The process is performed to obtain the maternal electrocardiogram prediction signal for the j-th window. Probability prediction based on maternal heart rate sequence and fetal electrocardiogram prediction signals Predicting probability using fetal heart rate sequences ;in, Indicates the state under the j-th window Predicting maternal electrocardiogram signals at specific times. Indicates the state under the j-th window Predicting the timing of maternal heartbeats Indicates the state under the j-th window Predicting fetal electrocardiogram signals at specific times. Indicates the state under the j-th window Predicting fetal heartbeats at specific times; ; Step 4: Using the trained maternal and fetal ECG extraction model, ECG signals from the surface of the pregnant woman's abdomen are extracted to obtain... Predicted maternal electrocardiogram signals at specific times fetal electrocardiogram signals Maternal ECG and cardiac beat sequences and fetal electrocardiogram sequence .

[0008] The method for extracting maternal and fetal electrocardiograms based on multi-task learning described in this invention is characterized in that step 2 is performed as follows: Step 2.1, from Extract Maternal ECG signal at all times and fetal electrocardiogram signals ; Step 2.2, Record After identifying all maternal and fetal ECG positions, the signals at all maternal and fetal ECG positions were marked as 1, and the signals at the remaining positions were marked as 0, thus obtaining... Real-time maternal electrocardiogram and cardiac beat sequence and Real-time fetal electrocardiogram sequence ; Step 2.3: According to the window length W and step size S, Perform sliding window segmentation to obtain the mixed ECG signal fragment under the j-th window. ,in, Indicates the state under the j-th window Constantly mixing ECG signals; ; Step 2.4: According to the window length W and step size S... Perform sliding window segmentation to obtain the label information of the j-th window. This includes: maternal electrocardiogram signal fragments. and maternal heart beat sequence and fetal electrocardiogram signal fragments and fetal heart rate sequence ;in, Indicates the state under the j-th window Maternal electrocardiogram signal at any given time Indicates the state under the j-th window The constant heartbeats of the mother Indicates the state under the j-th window fetal electrocardiogram signals at specific times, Indicates the state under the j-th window A constant fetal heartbeat; .

[0009] Furthermore, step 3 is performed as follows: Step 3.1: Construct a feature extraction module, which includes: a multi-layer 1D convolution module and a channel attention module; wherein, The ECG convolutional features of the j-th window are obtained through feature extraction using a multi-layer 1D convolutional module. ; The deep ECG features of the j-th window are obtained through processing by the channel attention module. ;in, , ; Step 3.2: Construct a dual-branch extraction module, including: maternal ECG branch and fetal ECG branch, and extract them separately. and The processing is performed to obtain the parent output features of the j-th window. and the fetal output characteristics of the j-th window ; Step 3.3: Construct a multi-task output module, including: a maternal ECG output module and a fetal ECG output module with identical structures, and respectively... and The process is performed to obtain the maternal electrocardiogram prediction signal for the j-th window. The probability of predicting the maternal heartbeat sequence in the j-th window. And the fetal electrocardiogram prediction signal of the j-th window The probability of predicting fetal heart rate sequence in the j-th window ; Step 3.4, based on , , and , , , Constructing a waveform heartbeat dual loss This is used to train a multi-task learning network for extracting maternal and fetal electrocardiograms (ECGs), resulting in a well-trained ECG extraction model.

[0010] Furthermore, step 3.2 includes: Step 3.2.1: Construct the maternal ECG branch, including: a multi-scale transformer with a large-size nucleus and a fully connected layer, sequentially... Processing is performed to obtain the parent output features of the j-th window. ; Step 3.2.2: Construct fetal ECG branches, including: a time attention module, a multi-scale transformer with small-sized kernels, and a fully connected layer; and After performing residual connections, the data is input into the fetal ECG branch for processing to obtain the fetal output characteristics of the j-th window. ; The multi-scale transformer module with kernels of different sizes includes: multiple convolutional layers of different sizes, a fusion module, and a transformer module. The fusion module consists of a first linear layer, a normalization layer, a GELU activation function layer, and a second linear layer. The transformer module consists of K layers of Transformer encoders, and each Transformer encoder contains a multi-head self-attention sub-layer and a feedforward network sub-layer.

[0011] Furthermore, step 3.3 is performed as follows: Step 3.3.1: The maternal waveform output module in the maternal ECG output module utilizes a fully connected layer to... The process is performed to obtain the maternal electrocardiogram prediction signal for the j-th window. ; Step 3.3.2: The maternal heart rate output module in the maternal ECG output module utilizes a fully connected layer and a Sigmoid activation function to... The process is performed to obtain the predicted probability of the maternal heartbeat sequence for the j-th window. ; Step 3.3.3: The fetal waveform output module in the fetal ECG output module utilizes a fully connected layer to... The process is performed to obtain the fetal electrocardiogram prediction signal for the j-th window. ; Step 3.3.4: The fetal heart rate output module in the fetal ECG output module utilizes a fully connected layer and a Sigmoid activation function to... The process is performed to obtain the predicted probability of the fetal heart rate sequence for the j-th window. .

[0012] Furthermore, step 3.4 is performed as follows: Step 3.4.1: Construct the parent branch loss This includes: mean square error loss of the parent waveform characteristics. Weighted cross-entropy loss of the maternal heartbeat sequence : Construct using equation (1) : (1) In equation (1), This represents the segment of the maternal electrocardiogram signal in the j-th window. middle The mother's electrocardiogram signal at that moment; This represents the predicted maternal electrocardiogram signal segment in the j-th window. middle Predicting the mother's electrocardiogram signal at any given time.

[0013] Construct using equation (2) : (2) In equation (2), The weighting factor of the parent body; This represents the maternal heart rate sequence of the j-th window. middle The constant heartbeat of the mother; This represents the predicted maternal heart rate sequence for the j-th window. middle Predicting the timing of maternal heartbeats.

[0014] Construct the parent branch loss using equation (3) : (3) Step 3.4.2: Constructing fetal branch loss This includes: mean squared error loss of fetal waveform features. Weighted cross-entropy of fetal heartbeat sequences ; Construct using equation (4) : (4) In equation (4), This represents the fetal electrocardiogram signal segment in the j-th window. middle The fetal electrocardiogram signal at any given moment; This represents the predicted fetal electrocardiogram signal segment in the j-th window. middle Predicting fetal electrocardiogram signals at specific times.

[0015] Construct using equation (5) : (5) In equation (5), The weighting factor of the parent body; This represents the fetal heart rate sequence in the j-th window. middle A constant fetal heartbeat; This represents the predicted maternal and fetal heart rate sequence for the j-th window. middle Predicting fetal heartbeats at specific times; Fetal branch loss is constructed using equation (6). : (6) Step 3.4.3: Construct waveform heartbeat double loss using equation (7). : (7) In equation (7), Dynamic weights; Step 3.4.4: Use the Adam optimizer and The training signal set in the dataset was used to train the multi-task learning maternal and fetal ECG extraction network, and calculations were performed. To update the model parameters until the maximum number of iterations is reached or The process continues until convergence, thus obtaining a well-trained maternal and fetal electrocardiogram extraction model.

[0016] Furthermore, step 4 is performed as follows: Step 4.1: Using the trained maternal and fetal ECG extraction models, perform ECG extraction on the ECG test signal set and output the optimal maternal ECG prediction signal segment in the j-th window of the ECG test signal set. And the optimal heartbeat sequence prediction probability sequence and the optimal fetal electrocardiogram prediction signal fragment And the optimal heartbeat sequence prediction probability sequence ; Step 4.2, calculate separately , , and The median at each time point is obtained. Predicted maternal electrocardiogram signals at specific times fetal electrocardiogram signals Maternal ECG and cardiac beat sequences and fetal electrocardiogram sequence .

[0017] The present invention provides an electronic device, including a memory and a processor, characterized in that the memory is used to store a program supporting the processor in performing the method described therein, and the processor is configured to execute the program stored in the memory.

[0018] The present invention provides a computer-readable storage medium on which a computer program is stored, characterized in that the computer program is executed by a processor to perform the steps of the method described thereon.

[0019] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This invention uses a dual-label and dual-loss collaborative optimization method. By using the dual-label constraint of "ECG waveform + heartbeat sequence" and combining MSE and weighted CE dual loss, it not only ensures the waveform extraction accuracy, but also solves the problem of R-wave label sample imbalance, which significantly improves the accuracy of heartbeat localization. 2. This invention employs a branch-differentiated design, taking into account the differences in signal strength between the mother and fetus, and designs multi-scale transformers of different sizes in the temporal feature extraction module. Furthermore, the fetal branch incorporates residual connections and temporal attention, while the maternal branch simplifies the structure and reduces computational load, achieving a balance between accurate extraction of weak signals and efficient extraction of strong signals. 3. This invention, based on the idea of ​​individual training and real-time output, is applicable to the extraction of maternal and fetal electrocardiogram signals from different pregnant women. Through multi-stage filtering, Z-score standardization, and dynamic weight training strategies, the model can adapt to different noise levels (0~12dB) and individual differences. Attached Figure Description

[0020] Figure 1 This is a flowchart provided for the present invention; Figure 2 This is a schematic diagram of the multi-task learning model of the present invention; Figure 3 This is a diagram of the multi-scale transformer[3,5,7] module of the present invention. Detailed Implementation

[0021] In this embodiment, a method for extracting maternal and fetal electrocardiograms based on multi-task learning is described, such as... Figure 1 As shown, the procedure is as follows: Step 1, using N Channel high-density electrode acquisition The mixed electrocardiogram (ECG) signals from the surface of the pregnant woman's abdomen were collected at specific times and preprocessed to obtain a preprocessed mixed ECG signal set. ,in, express The preprocessed mixed ECG signal set at specific times, and ,in, express The first time after time preprocessing Mixed ECG signals from multiple channels, where T indicates transpose; ; Indicates the number of channels; L; L represents the duration of data collection.

[0022] In practice, this includes: (1) This experiment selected abdominal ECG data from the Fetal ECG Synthetic Database public dataset (hereinafter referred to as FECGSYN). This dataset is a commonly used validation dataset in the field of fetal ECG extraction, and the data is highly reliable and reproducible.

[0023] (2) The FECGSYN dataset simulated and synthesized ten individuals under seven physiological conditions, including: baseline, noise, fetal movement + noise, maternal and fetal heart rate variability + noise, uterine contractions + noise, ectopic pulsation + noise, and twin pregnancy + noise. Each condition had five different levels of additional noise (0, 3, 6, 9, and 12 dB), and the simulation was repeated five times, with the noise signal regenerated each time to obtain a more generalized signal. Therefore, a total of 10 × 7 × 5 × 5 = 1750 synthesized signals were included. Each synthesized signal was 5 minutes long, with a sampling frequency of 250 Hz, and included 32 channels of ECG signals. This example used the second to sixth physiological conditions, a total of five instances, for the experiment. The original signal, the actual maternal ECG waveform, the actual fetal ECG waveform, and ECG annotations (i.e., R-wave peak positions, used to generate heartbeat sequence labels) were obtained by parsing using the wfdb toolkit.

[0024] (3) Use a fourth-order Butterworth bandpass filter with a cutoff frequency of 0.08-5Hz to filter out noise such as maternal respiration, cardiac activity, motion artifacts and power frequency interference in the original abdominal surface electrocardiogram signal.

[0025] Step 2: Construct a mixed ECG signal set tag set ,include: Maternal ECG signal at all times , Real-time fetal electrocardiogram signals , Real-time maternal electrocardiogram and cardiac beat sequence and Real-time fetal electrocardiogram sequence In this example, the tag set The required information is extracted directly from the annotations of the FECGSYN dataset.

[0026] Step 2.1, from Extract Maternal ECG signal at all times and fetal electrocardiogram signals ; Step 2.2, Record After identifying all maternal and fetal ECG positions, the signals at all maternal and fetal ECG positions were marked as 1, and the signals at the remaining positions were marked as 0, thus obtaining... Real-time maternal electrocardiogram and cardiac beat sequence and Real-time fetal electrocardiogram sequence .

[0027] Step 2.3: According to the window length W and step size S, Perform sliding window segmentation to obtain the mixed ECG signal fragment under the j-th window. ,in, Indicates the state under the j-th window Constantly mixing ECG signals; ; Step 2.4: According to the window length W and step size S... Perform sliding window segmentation to obtain the label information of the j-th window. This includes: maternal electrocardiogram signal fragments. and maternal heart beat sequence and fetal electrocardiogram signal fragments and fetal heart rate sequence ;in, Indicates the state under the j-th window Maternal electrocardiogram signal at any given time Indicates the state under the j-th window The constant heartbeats of the mother Indicates the state under the j-th window fetal electrocardiogram signals at specific times, Indicates the state under the j-th window A constant fetal heartbeat; .

[0028] The specific implementation includes: (1) When creating the dataset, the window length of the sliding window segmentation is set to 500 and the step size is set to 125, which can completely cover at least one maternal RR interval and 3 to 5 fetal RR intervals, ensuring that complete ECG cycle features are included. (2) Each dataset It contains 5 minutes of signal data. The first 2 minutes (120 seconds, signal length 30000) are used for training, and the last 3 minutes (180 seconds, signal length 45000) are used for testing.

[0029] Step 3, as follows Figure 2 As shown, a multi-task learning network for extracting maternal and fetal electrocardiograms is constructed, including: a feature extraction module, a dual-branch extraction module, and a multi-task output module. The process is performed to obtain the maternal electrocardiogram prediction signal for the j-th window. Probability prediction based on maternal heart rate sequence and fetal electrocardiogram prediction signals Predicting probability using fetal heart rate sequences ;in, Indicates the state under the j-th window Predicting maternal electrocardiogram signals at specific times. Indicates the state under the j-th window Predicting the timing of maternal heartbeats Indicates the state under the j-th window Predicting fetal electrocardiogram signals at specific times. Indicates the state under the j-th window Predicting fetal heartbeats at specific times; .

[0030] Step 3.1: Construct a feature extraction module, which includes: a multi-layer 1D convolution module and a channel attention module; The ECG convolutional features of the j-th window are obtained through feature extraction using a multi-layer 1D convolutional module. ; The deep ECG features of the j-th window are obtained through processing by the channel attention module. ;in, , .

[0031] The specific implementation includes: (1) 3 layers of 1D convolution, with output channels of 32, 128, and 128 respectively, kernel sizes of 5, 7, and 11 respectively, stride of 1, padding to ensure that the output time step is consistent with the input; (2) The channel attention module adopts the "squeeze-and-excitation (SE)" structure to weight the 128 channel features output by the 3 convolution layers: first, the features of each channel are compressed into one value through global average pooling, then channel weights are generated through 2 fully connected layers (hidden layer dimension 64, output layer dimension 128) and the Sigmoid activation function, and finally the weights are multiplied with the original 128 channel features one by one to strengthen the channels with high ECG signal content and suppress noise channels.

[0032] Step 3.2: Construct a dual-branch extraction module, including: maternal ECG branch and fetal ECG branch. Step 3.2.1, as follows Figure 3 As shown, a multi-scale transformer module with kernels of different sizes is constructed, including: multiple 1D convolutional layers of different sizes, a fusion module, and a transformer module. The fusion module consists of a first linear layer, a normalization layer, a GELU activation function layer, and a second linear layer. The transformer module consists of K-layer Transformer Encoders, each layer containing a multi-head self-attention sublayer and a feedforward network sublayer; in specific implementation, it includes: (1) Multiple 1D convolutional layers of different sizes, including 3 layers of 1D convolutional layers of different sizes, all with 128 channels. The kernel size is shown in the brackets in the model diagram. The padding ensures that the output time step is consistent with the input.

[0033] (2) The first linear layer of the fusion module has 128*3 channels as input and 128*2 channels as output. The second linear layer has 128*2 channels as input and 128 channels as output. The output time step is consistent with the input.

[0034] (3) K=3 in the transformer module, both output and output have 128 channels, the number of attention heads in the multi-head self-attention sub-layer is 8, the number of channels in the feedforward network sub-layer is 128*4, and the output time step is consistent with the input.

[0035] Step 3.2.2: Construct the maternal ECG branch, including: a multi-scale transformer with a large-size nucleus and two fully connected layers, sequentially... Processing is performed to obtain the parent output features of the j-th window. ; The specific implementation includes: (1) The kernel sizes of the three 1D convolutional layers of the large-size kernel multiscale transformer are 5, 7, and 11, with a stride of 1. Padding ensures that the output time step is consistent with the input. (2) Fully connected layer: The first fully connected layer has an input dimension of 128 and an output dimension of 64, with the activation function ReLU; the second fully connected layer has an input dimension of 64 and an output dimension of 32, with the activation function ReLU, and the output time step is the same as the input.

[0036] Step 3.2.3: Construct fetal ECG branches, including: a time attention module, a multi-scale transformer with a small-sized kernel, and two fully connected layers; and After performing residual connections, the data is input into the fetal ECG branch for processing to obtain the fetal output characteristics of the j-th window. The specific implementation includes: (1) The residual connection is to add the output of the 3-layer 1D convolutional module and the output of the channel attention module element by element, and introduce non-linearity through the ReLU activation function; the temporal attention module consists of 2 layers of 1D convolution (convolution kernel size 3×1, stride 1, padding=2) and one layer of Sigmoid activation, generating attention weights in the temporal dimension (one weight for each time step), which are multiplied with the features output by the residual connection step by step.

[0037] (2) The kernel sizes of the three 1D convolutional layers of the small-kernel multi-scale transformer are 3, 5, and 7, respectively, with a stride of 1. Padding ensures that the output time step is consistent with the input. (3) Fully connected layer: The first fully connected layer has an input dimension of 128 and an output dimension of 64, with the activation function ReLU; the second fully connected layer has an input dimension of 64 and an output dimension of 32, with the activation function ReLU, and the output time step is the same as the input.

[0038] Step 3.3: Construct a multi-task output module, which includes: a maternal ECG output module and a fetal ECG output module with the same structure, each of which includes a waveform output module and a heartbeat output module; Step 3.3.1: The maternal waveform output module in the maternal ECG output module utilizes a fully connected layer to... The process is performed to obtain the maternal electrocardiogram prediction signal for the j-th window. The fully connected layer has an input dimension of 32 and an output dimension of 1, with the output time step being consistent with the input.

[0039] Step 3.3.2: The maternal heart rate output module in the maternal ECG output module utilizes a fully connected layer and a Sigmoid activation function to... The process is performed to obtain the predicted probability of the maternal heartbeat sequence for the j-th window. The fully connected layer has an input dimension of 32 and an output dimension of 1, with the output time step being consistent with the input.

[0040] Step 3.3.3: The fetal waveform output module in the fetal ECG output module utilizes a fully connected layer to... The process is performed to obtain the fetal electrocardiogram prediction signal for the j-th window. The fully connected layer has an input dimension of 32 and an output dimension of 1, with the output time step being consistent with the input.

[0041] Step 3.3.4: The fetal heart rate output module in the fetal ECG output module utilizes a fully connected layer and a Sigmoid activation function to... The process is performed to obtain the predicted probability of the fetal heart rate sequence for the j-th window. The fully connected layer has an input dimension of 32 and an output dimension of 1, with the output time step being consistent with the input.

[0042] Step 3.4, based on Model output , , and based on , , , Constructing a waveform heartbeat dual loss This is used to train a multi-task learning network for extracting maternal and fetal electrocardiograms (ECGs), resulting in well-trained models for extracting maternal and fetal ECGs.

[0043] Step 3.4.1: Construct the parent branch loss using equation (3). This includes: using equation (1) to construct the mean square error loss of the parent waveform features. 1. Construct the weighted cross-entropy loss of the mother heartbeat sequence using equation (2) : (1) (2) In equation (2), The weighting factor for the parent body.

[0044] (3) In this example, the parent weighting factor The value is 8.

[0045] Step 3.4.2: Construct fetal branch loss using equation (6) This includes: using equation (4) to construct the mean square error loss of fetal waveform features. The weighted cross-entropy of fetal heartbeat sequences is constructed using equation (5). ; (4) (5) In equation (5), The weighting factor of the parent body; (6) In this example, the fetal weighting factor The value is 10.

[0046] Step 3.4.3: Construct waveform heartbeat double loss using equation (7). : (7) In equation (7), For dynamic weights; in this example, dynamic weights To balance the loss contributions of the maternal and fetal branches and adapt to the optimization objectives of different training stages of the model, the specific adjustment strategy is as follows: In the early training stage (rounds 1-15): =0.3, prioritize increasing the proportion of fetal branch loss, force the model to learn the characteristics of weak fetal ECG signals first, and avoid the model biasing to optimize the maternal branch due to strong maternal signals; mid-training stage (16~30 rounds): =0.45, balancing maternal and fetal branch optimization, ensuring the accuracy of maternal ECG waveform fitting while continuously strengthening the fetal R-wave localization ability; late training stage (31 rounds until convergence): =0.48, slightly increasing the weight of the maternal branch to optimize the overall waveform extraction accuracy, while maintaining the loss ratio of the fetal branch to ensure that the fetal signal extraction effect does not degrade.

[0047] Step 3.4.4: Use the Adam optimizer and The training signal set in the dataset was used to train the multi-task learning maternal and fetal ECG extraction network, and calculations were performed. To update the model parameters until the maximum number of iterations is reached or The process continues until convergence, thus obtaining a well-trained ECG extraction model. Step 4: Use the trained model to extract ECG signals from the surface of the pregnant woman's abdomen. The model output is... Predicted maternal electrocardiogram signals at specific times fetal electrocardiogram signals Maternal ECG and cardiac beat sequences and fetal electrocardiogram sequence .

[0048] Step 4.1: Use the trained ECG extraction model to... ECG extraction is performed on the test signal set, and the optimal maternal ECG prediction signal segment of the ECG test signal set in the j-th window is output. And the optimal heartbeat sequence prediction probability sequence and the optimal fetal electrocardiogram prediction signal fragment And the optimal heartbeat sequence prediction probability sequence .

[0049] Step 4.2: Due to the existence of overlapping windows in the sliding window level signal, calculate the median at each time step in all optimal predicted signal segments to obtain... Predicted maternal electrocardiogram signals at specific times fetal electrocardiogram signals Maternal ECG and cardiac beat sequences and fetal electrocardiogram sequence In this example, if the median of the heartbeat sequence is not 0 or 1 at any time step, it is rounded to one decimal place.

[0050] In this embodiment, an electronic device includes a memory and a processor. The memory stores a program that supports the processor in executing the methods described above, and the processor is configured to execute the program stored in the memory.

[0051] In this embodiment, a computer-readable storage medium stores a computer program, which is executed by a processor to perform the steps of the above method.

[0052] To quantify the effectiveness of this invention, the method was applied to the public dataset FECGSYN to verify its effectiveness. The evaluation of this method mainly uses three metrics: recall, accuracy (ACC), F1 score, and fetal ECG waveform signal-to-noise ratio (SNR). Higher values ​​of these four metrics indicate higher reliability of the fetal ECG signal estimated by the algorithm. Three comparison methods were set up as follows: (1) W-net: The deep learning network model was replaced with W-net as the baseline for the deep learning method. (2) TS-PCA: Template Subtraction based on Principal Components Analysis (TSPCA) was used as the baseline for the traditional method. (3) Maternal and fetal ECG branches only include waveform output: The heartbeat output and loss of the model output branches in this invention were removed.

[0053] The evaluation indicators of maternal and fetal electrocardiograms in the task of extracting mixed electrocardiogram signals on the abdominal surface using the method proposed in this invention and the comparative method are shown in Tables 1 and 2.

[0054] Table 1 is a comparison of various evaluation indicators for maternal electrocardiogram extraction using different extraction methods;

[0055] Table 2 is a comparison of various evaluation indicators for fetal electrocardiogram extraction using different extraction methods.

[0056]

[0057] The results show that, under all four indicators, the proposed method significantly outperforms the comparative method, verifying the effectiveness and accuracy of the proposed method in the task of extracting mixed ECG signals from the abdominal surface.

[0058] In summary, this invention can extract mixed electrocardiogram (ECG) signals from the surface of a pregnant woman's abdomen and simultaneously output the ECG waveform and heartbeat sequence. This method improves the accuracy and reliability of monitoring results and has practical application value for ECG monitoring in pregnant women.

Claims

1. A method for extracting maternal and fetal electrocardiograms based on multi-task learning, characterized in that, The procedure is as follows: Step 1, using N Channel high-density electrode acquisition The mixed electrocardiogram (ECG) signals from the surface of the pregnant woman's abdomen were collected at specific times and preprocessed to obtain a preprocessed mixed ECG signal set. ,in, express The preprocessed mixed ECG signal set at specific times, and ,in, express The first time after time preprocessing Mixed ECG signals from multiple channels, where T indicates transpose; ; Indicates the number of channels; L; L is the duration of data collection; Step 2: Construct a mixed ECG signal set tag set ,include: Maternal ECG signal at all times , Real-time fetal electrocardiogram signals , Real-time maternal electrocardiogram and cardiac beat sequence and Real-time fetal electrocardiogram sequence ; Step 3: Construct a multi-task learning network for extracting maternal and fetal ECG data, including: a feature extraction module, a dual-branch extraction module, and a multi-task output module, and then... The process is performed to obtain the maternal electrocardiogram prediction signal for the j-th window. Probability prediction based on maternal heart rate sequence and fetal electrocardiogram prediction signals Predicting probability using fetal heart rate sequences ;in, Indicates the state under the j-th window Predicting maternal electrocardiogram signals at specific times. Indicates the state under the j-th window Predicting the timing of maternal heartbeats This indicates the window under the j-th window. Predicting fetal electrocardiogram signals at specific times. Indicates the state under the j-th window Predicting fetal heartbeats at specific times; ; Step 4: Using the trained maternal and fetal ECG extraction model, ECG signals from the surface of the pregnant woman's abdomen are extracted to obtain... Predicted maternal electrocardiogram signals at specific times fetal electrocardiogram signals Maternal ECG and cardiac beat sequences and fetal electrocardiogram sequence .

2. The method for extracting maternal and fetal electrocardiograms based on multi-task learning according to claim 1, characterized in that, Step 2 is performed as follows: Step 2.1, from Extract Maternal ECG signal at all times and fetal electrocardiogram signals ; Step 2.2, Record After identifying all maternal and fetal ECG positions, the signals at all maternal and fetal ECG positions were marked as 1, and the signals at the remaining positions were marked as 0, thus obtaining... Real-time maternal electrocardiogram and cardiac beat sequence and Real-time fetal electrocardiogram sequence ; Step 2.3: According to the window length W and step size S, Perform sliding window segmentation to obtain the mixed ECG signal fragment under the j-th window. ,in, Indicates the state under the j-th window Constantly mixing ECG signals; ; Step 2.4: According to the window length W and step size S... Perform sliding window segmentation to obtain the label information of the j-th window. This includes: maternal electrocardiogram signal fragments. and maternal heart beat sequence and fetal electrocardiogram signal fragments and fetal heart rate sequence ;in, Indicates the state under the j-th window Maternal electrocardiogram signal at any given time Indicates the state under the j-th window The constant heartbeats of the mother Indicates the state under the j-th window fetal electrocardiogram signals at specific times, Indicates the state under the j-th window A constant fetal heartbeat; .

3. The method for extracting maternal and fetal electrocardiograms based on multi-task learning according to claim 2, characterized in that, Step 3 is performed as follows: Step 3.1: Construct a feature extraction module, which includes: a multi-layer 1D convolution module and a channel attention module; wherein, The ECG convolutional features of the j-th window are obtained through feature extraction using a multi-layer 1D convolutional module. ; The deep ECG features of the j-th window are obtained through processing by the channel attention module. ;in, , ; Step 3.2: Construct a dual-branch extraction module, including: maternal ECG branch and fetal ECG branch, and extract them separately. and The processing is performed to obtain the parent output features of the j-th window. and the fetal output characteristics of the j-th window ; Step 3.3: Construct a multi-task output module, including: a maternal ECG output module and a fetal ECG output module with identical structures, and respectively... and The process is performed to obtain the maternal electrocardiogram prediction signal for the j-th window. The probability of predicting the maternal heartbeat sequence in the j-th window. And the fetal electrocardiogram prediction signal of the j-th window The probability of predicting fetal heart rate sequence in the j-th window ; Step 3.4, based on , , and , , , Constructing a waveform heartbeat dual loss This is used to train a multi-task learning network for extracting maternal and fetal electrocardiograms (ECGs), resulting in a well-trained ECG extraction model.

4. The method for extracting maternal and fetal electrocardiograms based on multi-task learning according to claim 3, characterized in that, Step 3.2 includes: Step 3.2.1: Construct the maternal ECG branch, including: a multi-scale transformer with a large-size nucleus and a fully connected layer, sequentially... Processing is performed to obtain the parent output features of the j-th window. ; Step 3.2.2: Construct fetal ECG branches, including: a time attention module, a multi-scale transformer with small-sized kernels, and a fully connected layer; and After performing residual connections, the data is input into the fetal ECG branch for processing to obtain the fetal output characteristics of the j-th window. ; The multi-scale transformer module with kernels of different sizes includes: multiple convolutional layers of different sizes, a fusion module, and a transformer module. The fusion module consists of a first linear layer, a normalization layer, a GELU activation function layer, and a second linear layer. The transformer module consists of K layers of Transformer encoders, and each Transformer encoder contains a multi-head self-attention sub-layer and a feedforward network sub-layer.

5. The method for extracting maternal and fetal electrocardiograms based on multi-task learning according to claim 4, characterized in that, Step 3.3 is performed as follows: Step 3.3.1: The maternal waveform output module in the maternal ECG output module utilizes a fully connected layer to... The process is performed to obtain the maternal electrocardiogram prediction signal for the j-th window. ; Step 3.3.2: The maternal heart rate output module in the maternal ECG output module utilizes a fully connected layer and a Sigmoid activation function to... The process is performed to obtain the predicted probability of the maternal heartbeat sequence for the j-th window. ; Step 3.3.3: The fetal waveform output module in the fetal ECG output module utilizes a fully connected layer to... The process is performed to obtain the fetal electrocardiogram prediction signal for the j-th window. ; Step 3.3.4: The fetal heart rate output module in the fetal ECG output module utilizes a fully connected layer and a Sigmoid activation function to... The process is performed to obtain the predicted probability of the fetal heart rate sequence for the j-th window. .

6. The method for extracting maternal and fetal electrocardiograms based on multi-task learning according to claim 5, characterized in that, Step 3.4 is performed as follows: Step 3.4.1: Construct the parent branch loss This includes: mean square error loss of the parent waveform characteristics. Weighted cross-entropy loss of the maternal heartbeat sequence : Construct using equation (1) : (1) In equation (1), This represents the segment of the maternal electrocardiogram signal in the j-th window. middle The mother's electrocardiogram signal at that moment; This represents the predicted maternal electrocardiogram signal segment in the j-th window. middle Predicting maternal electrocardiogram signals at specific times; Construct using equation (2) : (2) In equation (2), The weighting factor of the parent body; This represents the maternal heart rate sequence of the j-th window. middle The constant heartbeat of the mother; This represents the predicted maternal heart rate sequence for the j-th window. middle Predicting the timing of maternal heartbeats; Construct the parent branch loss using equation (3) : (3) Step 3.4.2: Constructing fetal branch loss This includes: mean squared error loss of fetal waveform features. Weighted cross-entropy of fetal heartbeat sequences ; Construct using equation (4) : (4) In equation (4), This represents the fetal electrocardiogram signal segment in the j-th window. middle The fetal electrocardiogram signal at any given moment; This represents the predicted fetal electrocardiogram signal segment in the j-th window. middle Predicting fetal electrocardiogram signals at specific times; Construct using equation (5) : (5) In equation (5), The weighting factor of the parent body; This represents the fetal heart rate sequence in the j-th window. middle A constant fetal heartbeat; This represents the predicted maternal and fetal heart rate sequence for the j-th window. middle Predicting fetal heartbeats at specific times; Fetal branch loss is constructed using equation (6). : (6) Step 3.4.3: Construct waveform heartbeat double loss using equation (7). : (7) In equation (7), Dynamic weights; Step 3.4.4: Use the Adam optimizer and The training signal set in the dataset was used to train the multi-task learning maternal and fetal ECG extraction network, and calculations were performed. To update the model parameters until the maximum number of iterations is reached or The process continues until convergence, thus obtaining a well-trained maternal and fetal electrocardiogram extraction model.

7. The method for extracting maternal and fetal electrocardiograms based on multi-task learning according to claim 6, characterized in that, Step 4 is performed as follows: Step 4.1: Using the trained maternal and fetal ECG extraction models, perform ECG extraction on the ECG test signal set and output the optimal maternal ECG prediction signal segment in the j-th window of the ECG test signal set. And the optimal heartbeat sequence prediction probability sequence and the optimal fetal electrocardiogram prediction signal fragment And the optimal heartbeat sequence prediction probability sequence ; Step 4.2, calculate separately , , and The median at each time point is obtained. Predicted maternal electrocardiogram signals at specific times fetal electrocardiogram signals Maternal ECG and cardiac beat sequences and fetal electrocardiogram sequence .

8. An electronic device, comprising a memory and a processor, characterized in that, The memory is used to store a program that supports the processor in executing the method of any one of claims 1-7, the processor being configured to execute the program stored in the memory.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer program is executed by the processor to perform the steps of the method according to any one of claims 1-7.