Prediction method and device for pregnancy based on dynamic time warping algorithm
By applying dynamic time regularization algorithm in pregnancy prediction, the DTW distance between EHG signal channels is calculated and combined with support vector machines to predict, the problem of insufficient accuracy in distinguishing between non-productive contractions and productive contractions in the prior art is solved, and the accuracy of premature birth prediction is improved.
Patent Information
- Application Number
- CN202510441021.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2025-06-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to accurately distinguish between non-productive contractions and productive contractions, resulting in misjudgment of premature birth prediction and affecting the health of pregnant women and newborns.
The pregnancy prediction method based on dynamic time regularization (DTW) algorithm is used to calculate the DTW distance between different EHG signal channels, measure the similarity between signals, and combine it with support vector machine (SVM).
It effectively solves the problem of misjudgment caused by the time shift of individual physiological signals, improves data comparability and the accuracy of signal synchronization evaluation, and enhances the accuracy of premature birth prediction.
Smart Images

Figure CN120114075A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of bioelectrical signal analysis, and particularly relates to a pregnancy prediction method and device based on a dynamic time warping algorithm. Background Art
[0002] Preterm birth is a major cause of neonatal morbidity and mortality, posing significant health, development, and economic challenges worldwide. Defined as delivery before 37 weeks of gestation, preterm birth has an adverse impact on maternal health and the neurodevelopmental and cardiovascular outcomes of surviving infants. Therefore, effective prediction of preterm birth is of great significance. In addition to preterm birth itself, threatened preterm labor also affects the prediction of preterm birth. Threatened preterm labor refers to a pregnant woman with signs of preterm labor (such as uterine contractions or cervical changes), but does not meet the diagnostic criteria for preterm birth. This may indicate an increased risk of preterm birth. Clinically, this presents a key challenge: accurately distinguishing non-productive physiological contractions from productive contractions, which are signals of impending delivery. Misdiagnosis not only endangers the health of the mother and neonate but also results in unnecessary use of medical resources. Therefore, developing reliable methods to quickly and accurately distinguish non-productive uterine contractions from productive uterine contractions is crucial for improving maternal and neonatal outcomes.
[0003] Traditional pregnancy monitoring methods mainly rely on two techniques, IUPC (intrauterine pressure catheter) and TOCO (tocodynamometry), to distinguish between labor and non-labor contractions. These methods focus on observing the regularity (including the uniformity of contraction intervals, the consistency of duration, and the repeatability of cycles) and coordination (such as the smoothness of pressure changes, the symmetry of waveforms, and the relationship between the baseline and peak) of contractions. Among them, IUPC, as an invasive method for measuring intrauterine pressure, can directly and accurately measure the changes in intrauterine pressure. However, its invasiveness increases the risk of infection and requires amniotic membrane rupture and special insertion techniques. In contrast, the external pressure measurement method TOCO is non-invasive, easy to operate, and avoids these risks. But it is susceptible to factors such as maternal position, fetal position, and body type, resulting in lower measurement accuracy. More importantly, neither of these two methods can provide the spatial transmission characteristics of uterine contractions and cannot reflect the coordination of uterine contractions from a mechanical perspective.
[0004] The orderly propagation of action potentials between muscle cells is the basis for many important physiological processes. Since electromyogram (EMG) signals are closely related to the contractile force of uterine muscle cells, uterine electrical signals can effectively reflect the degree of uterine contraction. Uterine electromyogram, commonly known as electrohysterogram (EHG), is a proven, innovative, and non-invasive method. Compared with traditional methods, EHG signals, as a non-invasive technique for recording uterine myoelectric activity, not only overcome the limitations of traditional methods but also directly reflect the origin and conduction characteristics of uterine contractions from an electrophysiological perspective. EHG signals have rich temporal and frequency domain characteristics that can characterize the electrical activity patterns of uterine smooth muscle cells, and these characteristics are directly related to the contraction intensity, coordination, and productive / non-productive contractions of uterine smooth muscle cells. Therefore, pregnancy monitoring based on EHG signals provides a new research direction for accurately assessing uterine contraction characteristics and predicting childbirth.
[0005] During pregnancy, the excitability of uterine smooth muscle cells increases, and the electrical coupling between cells is enhanced, causing uterine contractions. Traditional uterine contraction monitoring mainly relies on clinical experience and real-time monitoring data, with limitations such as strong subjectivity and high real-time requirements. Similarly, feature extraction and analysis based on uterine contraction electrical signals (EHG) also face certain challenges. Therefore, how to select appropriate EHG signal features and minimize the influence of various noise sources to predict pregnancy-related outcomes remains an important research topic. The present invention proposes a pregnancy prediction method based on the dynamic time warping (DTW) algorithm, which measures the similarity between signals through the DTW distance to improve the practicality of uterine myoelectric signals in clinical applications such as pregnancy monitoring, childbirth detection, and preterm birth prediction. Summary of the Invention
[0006] The present invention aims to overcome the above-mentioned disadvantages of the prior art and proposes a pregnancy prediction method and device based on the dynamic time warping algorithm to more effectively distinguish non-productive uterine contractions from productive uterine contractions.
[0007] The specific steps for the present invention to solve its technical problems are as follows:
[0008] The first aspect of the present invention relates to a pregnancy prediction method based on the dynamic time warping algorithm, including the following steps:
[0009] Step 1: Obtain the original 16-channel EHG signals from the Icelandic 16-electrode Electrohysterogram Database and perform preprocessing, including filtering and calculating the bipolar signals of adjacent electrodes in the vertical direction according to the electrode distribution to obtain a 12×12 bipolar signal. Divide the uterine contraction windows according to the corresponding TOCO signals to obtain the EHG signals of the uterine contraction segments corresponding to the TOCO signals.
[0010] Step 2: For the 12×12 bipolar signals, use the dynamic time warping (DTW) algorithm to calculate the DTW distances between different bipolar signals, and measure the similarity between the signals through the DTW distances to obtain a 12×12 DTW matrix and visualize it.
[0011] Step 3: Evaluate the changes in the visualized DTW matrices of different subjects at different pregnancy stages based on the DTW matrices of different subjects at different pregnancy stages; observe how the average DTW distances between the electrodes in the horizontal and vertical directions change with the progress of pregnancy; evaluate the differences in the average DTW distances in the horizontal and vertical directions.
[0012] Step 4: Use the DTW matrix obtained in Step 2 as a feature, divide the dataset into a training set and a test set, and combine the true labels to perform pregnancy prediction using a support vector machine (SVM) to verify the effectiveness of the DTW distance in pregnancy prediction.
[0013] The second aspect of the present invention relates to a pregnancy prediction device based on the dynamic time warping algorithm, including a memory and one or more processors. Executable code is stored in the memory, and when the one or more processors execute the executable code, it is used to implement the pregnancy prediction method based on the dynamic time warping algorithm of the present invention.
[0014] The third aspect of the present invention relates to a computer-readable storage medium, on which a program is stored. When the program is executed by a processor, it implements the pregnancy prediction method based on the dynamic time warping algorithm of the present invention.
[0015] The present invention provides a pregnancy prediction method based on the dynamic time warping (DTW) algorithm. For multi-channel signals, the DTW algorithm is used to measure the similarity between different channels. Based on the evaluation of the differences in the DTW matrices of different subjects at different pregnancy stages, combined with the true labels, pregnancy prediction is performed.
[0016] The innovation of the present invention is as follows: Traditional pregnancy monitoring methods (such as monitoring uterine contraction intensity) often rely on statistical indicators within a fixed time window (such as the uterine contraction frequency of a TOCO sensor). However, time offsets in individual physiological signals (such as delayed uterine contractions and lagged fetal heart rate changes) may lead to misjudgments. DTW eliminates the problem of time series misalignment caused by individual differences or sensor acquisition delays by dynamically aligning the time axis, improving data comparability. DTW calculates the similarity between signals by aligning time series without relying on the phase information of the signals. Therefore, it has stronger robustness when dealing with non-stationary signals. By globally aligning the signals, DTW can eliminate the influence of time delays and local noise, enabling a more stable assessment of the synchronization between contraction signals.
[0017] The advantages of the present invention are as follows: DTW effectively solves the matching problem of inconsistent acquisition times of physiological signals of different pregnant women (such as differences in the starting points of uterine contractions) or unequal signal lengths (such as data of preterm and full-term pregnancies) through dynamic time warping. Compared with traditional methods such as Euclidean distance, the similarity measurement is more accurate.
[0018] Additional description
[0019] Figure 1 is the flowchart of the method of the present invention.
[0020] Figure 2 is the electrode distribution diagram for collecting EHG signals.
[0021] Figure 3 is the change diagram for visualizing the DTW matrix of different subjects at different pregnancy stages.
[0022] Figure 4 is the diagram for observing how the average DTW distance between electrodes in the horizontal and vertical directions changes with the progress of pregnancy and evaluating the difference in the average DTW distance between the horizontal and vertical directions.
[0023] Figure 5 is the ROC curve diagram of the prediction result.
[0024] Figure 6 is the schematic diagram of the device of the present invention. Detailed implementation manners
[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention are clearly and completely described below. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0026] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terms used in the specification of this application are for the purpose of describing specific embodiments only and are not intended to limit this application.
[0027] The technical solution of the present invention will be described in detail below.
[0028] Example 1
[0029] Refer to Figures 1 - 5 , this embodiment relates to a pregnancy prediction method based on a dynamic programming algorithm, including the following steps:
[0030] Step 1: Obtain the original 16-channel EHG signal from the dataset Icelandic 16-electrode Electrohysterogram Database, and perform preprocessing, including filtering and calculating the bipolar signals of adjacent electrodes in the vertical direction according to the electrode distribution to obtain a 12×12 bipolar signal. According to the corresponding TOCO signal, divide the uterine contraction window to obtain the EHG signal of the uterine contraction segment corresponding to the TOCO signal.
[0031] Step 2: For the 12×12 bipolar signal, use the dynamic time warping (DTW) algorithm to calculate the DTW distance between different bipolar signals, and measure the similarity between signals through the DTW distance to obtain a 12×12 DTW matrix and visualize it.
[0032] Step 3: According to the DTW matrices of different subjects in different pregnancy periods, evaluate the changes in the visualized DTW matrices of different subjects in different pregnancy stages; observe how the average DTW distance between electrodes in the horizontal and vertical directions changes with the progress of pregnancy; evaluate the differences in the average DTW distances in the horizontal and vertical directions.
[0033] Step 4: Use the DTW matrix obtained in Step 2 as a feature, divide the dataset into a training set and a test set, and combine the true labels to perform pregnancy prediction using a support vector machine (SVM) to verify the effectiveness of the DTW distance in pregnancy prediction.
[0034] The implementation steps of the DTW algorithm described in Step 2 specifically include:
[0035] Step 2.1: Define a distance metric for comparing the values of two time series at any two time points. Usually, the Euclidean distance is used, that is, the straight-line distance between two points.
[0036] Step 2.2: Create a distance matrix whose dimension is equal to the product of the lengths of the two time series. Each element d in the matrix i,jDenote the distance between the \(i\)-th point in time series 1 and the \(j\)-th point in time series 2.
[0037] Step 2.3: Calculate the cumulative distance mapping \(D\) using the following recursive formula:
[0038] \(D\) i,j =\(\min(D\) i,j-1 , \(D\) i-1,j , \(D\) i-1,j-1 ) + d i,j (1)
[0039] where \(D\) i,j-1 , \(D\) i-1,j , and \(D\) i-1,j-1 represent the minimum cumulative distances to the current point.
[0040] Step 2.4: Starting from the lower right corner (the last point of both sequences) of the cumulative distance matrix, backtrack to the upper left corner (the first point of both sequences) to form the optimal alignment path. The length of the obtained path is used as the DTW distance between the two time series.
[0041] Evaluate the changes in the visualized DTW matrix of different subjects at different pregnancy stages according to the DTW matrix of different subjects at different pregnancy stages described in Step 3; evaluate how the average DTW distance between horizontal and vertical electrodes changes as pregnancy progresses; evaluate the difference in the average DTW distance between the horizontal and vertical directions, specifically including:
[0042] Step 3.1: Visualize the DTW matrix of different subjects at different pregnancy stages, and evaluate the differences between the DTW matrices of different subjects at the same pregnancy stage or the same subject at different pregnancy stages.
[0043] Step 3.2: According to the distribution of electrodes, for a DTW matrix, evaluate how the average DTW distance between electrodes along the horizontal or vertical direction within a 12×12 DTW matrix changes as pregnancy progresses.
[0044] Step 3.3: According to the distribution of electrodes, for a DTW matrix, evaluate the difference in the average DTW distance between horizontal and vertical electrodes within a 12×12 DTW matrix.
[0045] Step 4 Perform pregnancy prediction based on the output obtained in Step 2, specifically including:
[0046] The evaluation metrics of the model include F1-score, recall, and ACC, and the specific calculations are as follows:
[0047]
[0048] Among them, TP means the prediction is correct and the sample is positive (true positive); FP means the prediction is incorrect, the sample is predicted as positive, but the sample is actually negative (false positive); FN means the prediction is incorrect, the sample is predicted as negative, but the sample is actually positive (false negative). N is the total number of test uterine contraction segments.
[0049] Calculate each index of the above calculation model to evaluate the performance of the model.
[0050] Example 2
[0051] Refer to Figure 6 , this example relates to a pregnancy prediction device based on the dynamic time warping algorithm, including a memory and one or more processors. An executable code is stored in the memory. When the one or more processors execute the executable code, it is used to implement the pregnancy prediction method based on the dynamic time warping algorithm in Example 1.
[0052] Example 3
[0053] This example relates to a computer-readable storage medium, on which a program is stored. When the program is executed by a processor, it implements the pregnancy prediction method based on the dynamic time warping algorithm in Example 1.
[0054] The technical features of the above-mentioned embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.
[0055] The above-mentioned embodiments only represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be understood as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A pregnancy prediction method based on a dynamic time warping algorithm, comprising the following steps: Step 1: Obtain the original 16-channel EHG signal from the Icelandic 16-electrode Electrohysterogram Database and perform preprocessing, including filtering and calculating the bipolar signals of adjacent electrodes in the vertical direction according to the electrode distribution to obtain a 12×12 bipolar signal; divide the contraction window according to the corresponding TOCO signal to obtain the EHG signal of the contraction segment corresponding to the TOCO signal; Step 2: For the 12×12 bipolar signals, use the dynamic time warping (DTW) algorithm to calculate the DTW distance between different bipolar signals, measure the similarity between the signals by the DTW distance, obtain the 12×12 DTW matrix and visualize it; Step 3: Based on the DTW matrices of different subjects at different gestational stages, evaluate the changes in the visualized DTW matrices of different subjects at different gestational stages; observe how the average DTW distances between electrodes in the horizontal and vertical directions change as pregnancy progresses; evaluate the differences in the average DTW distances in the horizontal and vertical directions; Step 4: Use the DTW matrix obtained in step 2 as a feature, divide the data set into a training set and a test set, combine the true labels, and use support vector machine (SVM) to predict pregnancy, verifying the effectiveness of DTW distance in pregnancy prediction.
2. A pregnancy prediction method based on dynamic time warping algorithm as claimed in claim 1, characterized in that: The implementation steps of the DTW algorithm described in step 2 specifically include: Step 2.1: Define a distance metric for comparing the values of two time series at any two points in time; typically use the Euclidean distance, which is the straight-line distance between two points. Step 2.2: Create a distance matrix whose dimension is equal to the product of the lengths of the two time series; each element d in the matrix i,j Represents the distance between the i-th point in time series 1 and the j-th point in time series 2; Step 2.3: Calculate the cumulative distance map D using the following recursive formula: D i,j =min(D i,j-1 ,D i-1,j ,D i-1,j-1 )+d i,j (1) Where D i,j-1 , D i-1,j and D i-1,j-1 Indicates the minimum cumulative distance to the current point; Step 2.4: Starting from the lower right corner of the cumulative distance matrix, trace back to the upper left corner to form the optimal alignment path; the obtained path length is used as the DTW distance between the two time series.
3. A pregnancy prediction method based on dynamic time warping algorithm as claimed in claim 1, characterized in that: Step 3 specifically includes: Step 3.1: Visualize the DTW matrices of different subjects at different gestational stages and evaluate the differences between the DTW matrices of different subjects at the same gestational stage or the same subject at different gestational stages. Step 3.2: Based on the distribution of electrodes, for a DTW matrix, evaluate how the average DTW distance between electrodes in the horizontal or vertical direction within a 12×12 DTW matrix changes as pregnancy progresses; Step 3.3: Based on the distribution of electrodes, for a DTW matrix, evaluate the difference between the average DTW distances between electrodes in the horizontal and vertical directions within a 12×12 DTW matrix.
4. A pregnancy prediction method based on dynamic time warping algorithm as claimed in claim 1, characterized in that: In step 4, pregnancy prediction is performed based on the output obtained in step 2, specifically including: The evaluation indicators of the model include F1-score, recall, and ACC, which are calculated as follows: TP is a correct prediction, the sample is positive, that is, a true positive; FP is a wrong prediction, the sample is predicted to be positive, but the sample is actually negative, that is, a false positive; FN is a wrong prediction, the sample is predicted to be negative, but the sample is actually positive, that is, a false negative; N is the total number of tested uterine contraction segments; Calculate the various indicators of the model as above and evaluate the model performance.
5. A pregnancy prediction device based on dynamic time warping algorithm, characterized in that: It comprises a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, it is used to implement the pregnancy prediction method based on the dynamic time warping algorithm described in any one of claims 1-4.
6. A computer-readable storage medium, characterized in that: A program is stored thereon, and when the program is executed by a processor, the pregnancy prediction method based on the dynamic time warping algorithm described in any one of claims 1-4 is implemented.
