A BCG signal heart rate calculation method based on fast fourier transform and convolutional neural network
By combining the DTW algorithm and Fast Fourier Transform with a convolutional neural network, the problem of noise interference in BCG signal heart rate calculation was solved, thereby improving the accuracy and robustness of heart rate prediction for BCG signals.
Patent Information
- Application Number
- CN202510142318.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-10
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2045-02-10
AI Technical Summary
Existing methods for calculating heart rate using BCG signals are not robust and are easily affected by noise from breathing, body movement, and conversation, and there is a lack of effective signal filtering methods.
The DTW algorithm is used to remove some of the excessively noisy BCG signals, and heart rate is calculated by fast Fourier transform and convolutional neural network. Accurate heart rate prediction is achieved by combining exponential moving average normalization and the multi-layer structure of convolutional neural network.
It effectively removes noise interference, improving the accuracy and robustness of BCG signal heart rate calculation, especially significantly reducing the error in heart rate prediction in the presence of body movement and conversation.
Smart Images

Figure CN120052841B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of vital sign monitoring, and relates to a BCG signal heart rate calculation method based on fast Fourier transform and a convolutional neural network. BACKGROUND
[0002] Ballistocardiogram (BCG) is a signal formed by measuring the slight changes in body surface pressure through a sensor, and contains information such as human heartbeats, breathing and movements, and can be used as a non-contact method for monitoring heart activity.
[0003] In the current use process, there is no suitable method for screening BCG signals, and there is no clear boundary for screening the required signals for signals with excessive noise. At the same time, the robustness of the existing BCG signal for predicting heart rate is poor, and is easily disturbed by noise such as breathing, body movement, conversation, etc. Therefore, it is very necessary to develop a heart rate calculation method that can resist noise such as breathing, body movement, conversation, etc. SUMMARY
[0004] The purpose of the application is to provide a BCG signal heart rate calculation method based on fast Fourier transform and a convolutional neural network, which uses the DTW algorithm to remove part of the BCG signals with excessive noise, and calculates the heart rate with high precision through the convolutional neural network for qualified BCG signals. At the same time, due to the participation of short-time Fourier transform, the heart rate can also be accurately calculated for BCG signals with certain body movement.
[0005] The technical scheme adopted by the application is as follows: a BCG signal heart rate calculation method based on fast Fourier transform and a convolutional neural network:
[0006] Step 1) filtering a BCG signal with a length of n to obtain a filtered BCG signal BCG_F;
[0007] BCG={x(1), x(2), x(3), …, x(n)}
[0008] BCG_F=Filter_BCG(BCG)
[0009] The Filter_BCG function filters the BCG signal with a Butterworth filter with a bandwidth of 0.8Hz-25Hz, filters out low-frequency and high-frequency signals, and the result is recorded as BCG_F;
[0010] The specific method in step 1) is that frequencies below 0.8Hz are considered low-frequency signals, and frequencies above 25Hz are considered high-frequency signals.
[0011] Step 2) Screening for BCG_F signal, calculating the BCG_F signal waveform similarity, screening the BCG_F signal less than or equal to threshold value y.
[0012] In step 2), the method for calculating the waveform similarity is dynamic time warping method, and the steps are:
[0013] First, divide the BCG_F signal according to the length m, calculate the dynamic time warping distance of the divided BCG_F signal and the previous part of the BCG_F signal, sum the dynamic time warping distance of all the parts of the BCG_F signal (except the first part of the BCG_F signal) and the previous part of the BCG_F signal, and take the sum as the dynamic time warping distance BCG_DTW for a single signal.
[0014] Screen the dynamic time warping distance BCG_DTW for a single signal, if the obtained value is higher than the set value y, further analysis will not be continued for this data, and it is determined that there is still high noise influence after filtering in the data, and the obtained heart rate value will have high deviation.
[0015] Step 3) Exponential moving standardization processing for the BCG_F signal screened by step 2):
[0016] BCG_standardize = scale_BCG(BCG_F)
[0017] The scale_BCG function is composed of the following three formulas:
[0018] EMA_current = a x value + (1-a) x EMA_previous
[0019]
[0020] z_score = (value-EMA_current) / (EMA_sdc)
[0021] Wherein, EMA_current is the mean value of the exponential moving average at the current time point, EMA_previous is the mean value of the exponential moving average at the previous time point, EMA_sdc is the standard deviation of the exponential moving average at the current time point, EMA_sdp is the standard deviation of the exponential moving average at the previous time point, a is the attenuation factor, value is the data value at the current time point, and the obtained z_score is composed of BCG_standardize sequence according to the order, which is recorded as BCG_standardize signal.
[0022] Step 4) Fourier transform is performed on the BCG_standardize signal obtained through step 3:
[0023] The fft_BCG function is decomposed into the following 6 formulas, where e represents the base of natural logarithm, i is the imaginary unit, and the argmax function is used to find the value of the independent variable that makes the function take the maximum value. In the formula of FFT, x(n) represents the original data sequence, N is the total number of data points, and k is the frequency index:
[0024] n = n sample_time × f sample
[0025] where n is the total number of data points, n sample_time is the sampling time, and f sample is the sampling frequency;
[0026]
[0027] where f s (i) is the i-th sampling frequency, and n is the total number of data points;
[0028]
[0029] where f min and f max are the minimum and maximum values of the frequency, respectively, and idx min and idx max are the indices of the first sampling frequency greater than or equal to f min and f max , respectively;
[0030]
[0031] where sig_fft(k) is the Fourier transform of the data x(n) at the k-th frequency point, and N is the total number of data points;
[0032]
[0033] where result(k) is the normalized FFT at the k-th frequency point;
[0034] The fft_BCG function calculates the FFT result of the BCG_standardize signal and outputs the normalized amplitude spectrum within the specified frequency range. The obtained normalized amplitude spectrum is denoted as BCG_fft.
[0035] Step 5) The BCG_standardize signal and the BCG_fft are input into a convolutional neural network model to obtain the heart rate value of the BCG signal.
[0036] First, the BCG_F signal is input into a convolutional neural network for processing, the convolutional neural network comprising 14 convolutional layers, the output channels in the convolutional layers increasing from 1 to 512 in a non-negative manner, the size of the feature map gradually decreasing as the network deepens, and the depth of the feature gradually increasing, to obtain a result denoted as x3, and x3 is flattened;
[0037] Then, the result BCG_FCL is obtained by processing through a first fully connected layer, BCG_fft is flattened, and then the flattened BCG_fft and BCG_FCL are combined together and input into a second fully connected layer to obtain a final heart rate value.
[0038] The present application has the beneficial effects that: through the above method, the present application can remove part of the BCG signal with excessive noise through the DTW algorithm, and due to the participation of the fast Fourier transform and the convolutional neural network, the heart rate can also be accurately predicted for the BCG signal with certain body movement. BRIEF DESCRIPTION OF DRAWINGS
[0039] Figure 1 The present application is a flowchart.
[0040] Figure 2 It is a BCG signal waveform diagram screened out by the present application. DETAILED DESCRIPTION
[0041] In the process of specific implementation, the present application needs to be introduced into a terminal (such as Raspberry Pi 4) that can perform analysis, the terminal needs to input the collected BCG signal into the present application, and the time length of 15s is taken as the division length, generally the BCG signal with a time length of 15s is selected for prediction and stored in the memory, if the time length of the BCG signal is longer than 15s, continuous and uninterrupted heart rate monitoring can also be performed, and the processor performs data processing on the stored BCG signal.
[0042] The specific process of the BCG signal heart rate calculation method based on the fast Fourier transform and the convolutional neural network is as shown in Figure 1 The specific method comprises:
[0043] Step 1, filtering the BCG signal to obtain the filtered BCG signal BCG_F:
[0044] BCG={x(1), x(2), x(3), …, x(n)}
[0045] BCG_F=Filter_BCG(BCG)={x_f(1), x_f(2), x_f(3), …, x_f(n)}
[0046] The Filter_BCG function uses a Butterworth filter to filter the BCG signal, removing low-frequency and high-frequency signals. The result is denoted as BCG_F.
[0047] Step 2: Filter the obtained BCG_F signals and calculate waveform similarity using the dynamic time warping method.
[0048] BCG_DTW = dtw_distance(BCG_F)
[0049] The dtw_distance function first divides the BCG_F signal into segments of length m, calculates the dynamic time warping distance between each segment of the BCG_F signal and the previous segment, and sums them up. The sum is then considered as the dynamic time warping distance BCG_DTW for a single signal.
[0050] The dynamic time warping algorithm can be summarized in the following steps:
[0051] Initialize the cumulative distance matrix dtw_matrix with a size of (len_a+1)*(len_b+1), and set infinity on the boundaries of the matrix, except for the position (0,0) which is set to 0.
[0052] Iterate through the two sequences, calculate the local distance (here, Euclidean distance) between each pair of elements, and update the cumulative distance matrix.
[0053] The update rule can be expressed as follows: For each element a_i of sequence_a and each element b_j of sequence_b, calculate the local distance cost, where cost is the absolute value of the difference between a_i and b_j. Then, update the elements (i,j) of the cumulative distance matrix dtw_matrix as follows:
[0054] dtw_matrix[i,j]=cost+min(dtw_matrix[i-1,j],dtw_matrix[i,j-1],dtw_matrix[i-1,j-1])
[0055] The min function represents finding the minimum value among them.
[0056] The final DTW distance is the bottom right element of the cumulative distance matrix, dtw_matrix[len_a,len_b].
[0057] The dynamic time warping distance BCG_DTW obtained for a single signal is screened, if the value obtained is higher than a certain value y, then the data will not be further analyzed, but it is determined that there is still high noise influence in the data after filtering, and the heart rate value obtained may have high deviation, Figure Two That is, it is an example of a poor BCG signal data screened out by step 2, and it can be more obviously seen from the waveform diagram that the BCG signal has a section seriously affected by noise, and the error between the heart rate value obtained by the method of the application and the actual heart rate value is 26, which is a large error;
[0058] Step 3, the BCG_F signal screened by step 2 is subjected to exponential moving standardization:
[0059] BCG_standardize = scale_BCG(BCG_F)
[0060] The scale_BCG function is composed of the following three formulas:
[0061] EMA_current = a x value + (1-a) x EMA_previous
[0062]
[0063] z_score = (value-EMA_current) / (EMA_sdc)
[0064] Wherein, EMA_current is the mean value of the exponential moving average at the current time point, EMA_previous is the mean value of the exponential moving average at the previous time point, EMA_sdc is the standard deviation of the exponential moving average at the current time point, EMA_sdp is the standard deviation of the exponential moving average at the previous time point, EMA is the mean value of the exponential moving average, a is the attenuation factor, and value is the data value at the current time point. The z_score obtained in accordance with the sequence is the BCG_standardize sequence, which is denoted as the BCG_standardize signal.
[0065] Step 4, the BCG_standardize signal screened by step 2 is subjected to short-time Fourier transform:
[0066] BCG_fft = fft_BCG(BCG_F)
[0067] The fft_BCG function can be decomposed into the following six equations, where e represents the base of the natural logarithm, i is the imaginary unit, and the argmax function is used to find the value of the argument that maximizes the function. In the equations of the FFT, x(n) represents the original data sequence, N is the total number of data points, and k is the frequency index:
[0068] n = n sample_time x f sample
[0069] where n is the total number of data points, n sample_time is the sampling time, and f sample is the sampling frequency;
[0070]
[0071] where f s (i) is the i-th sampling frequency, and n is the total number of data points;
[0072]
[0073] where f min and f max are the minimum and maximum values of the frequency, respectively, and idx min and idx max are the indices of the first sampling frequency greater than or equal to f min and f max , respectively;
[0074]
[0075] where sig_fft(k) is the Fourier transform of the data x(n) at the k-th frequency point, and N is the total number of data points;
[0076]
[0077] where result(k) is the normalized FFT at the k-th frequency point.
[0078] The fft_BCG function calculates the FFT of the BCG_standardize signal and outputs the normalized amplitude spectrum of the FFT within the specified frequency range. The resulting normalized amplitude spectrum is denoted as BCG_fft.
[0079] Step 5, the BCG_standardize signal is input into the convolutional neural network model constructed with the BCG_fft input, the BCG_F signal is input into the convolutional neural network to obtain a result x3, x3 is flattened, then a first fully connected layer is used for processing to obtain a result BCG_FCL, the BCG_fft signal is flattened and recorded as x2, then x2 and BCG_FCL are combined together and input into a second fully connected layer to obtain a final heart rate value.
[0080] The convolutional neural network comprises 14 convolutional layers, the output channels in the convolutional layers increase from 1 to 512 in a non-negative increasing manner, the size of the feature map gradually decreases with the deepening of the network, and the depth (channel number) of the feature gradually increases.
[0081] Table 1: Convolutional layer related parameter setting table
[0082]
[0083] After the 14 convolutional layers, two fully connected layers are used, and the two fully connected layers use a Mish activation function.
[0084] Table 2: Fully connected layer configuration table
[0085]
[0086] When the BCG signal quality is determined to be good, the execution of step 2 can be ignored.
[0087] When the heart rate prediction method of the present application does not perform step 2, the test data is taken from the data set of 392 people's heart rates and BCG signals collected by the inventor, each of which contains 15 minutes of quiet state BCG signals (including certain body movements) and heart rate data, and 15 minutes of conversation state (including certain body movements) BCG signals and heart rate data. The data of the first 320 people in the collection process is selected as the training set, and the data of the last 72 people is selected as the test set. The data collection processes of the two are consistent, except for the time sequence difference.
[0088] Table 3: Result table of omitted steps
[0089]
[0090] The MAE of heart rate for the quiet state BCG signal (including certain body movement) in the test set is 0.901 bpm, and the person linear correlation coefficient reaches 0.983. The MAE of heart rate for the dialogue state BCG signal (including certain body movement) is 2.286 bpm, and the person linear correlation coefficient reaches 0.913.
[0091] Table 4: Screening method change result table
[0092]
[0093] Compared with the results of Euclidean distance and Manhattan distance calculation, the MAE value of the method of the present application is reduced in both states, and the person linear correlation coefficient value is slightly improved.
Claims
1. A method for calculating heart rate of BCG signal based on fast Fourier transform and convolutional neural network, characterized in that: Step 1) filtering a BCG signal with length n to obtain a filtered BCG signal BCG_F; BCG={x(1),x(2),x(3),…,x(n)} BCG_F=Filter_BCG(BCG) The Filter_BCG function filters the BCG signal with a Butterworth filter with a bandwidth of 0.8Hz-25Hz, filters out low and high frequency signals, and the result is recorded as BCG_F; Step 2) screening the BCG_F signal and calculating the waveform similarity of the BCG_F signal, and screening the BCG_F signal less than or equal to the threshold value y; Step 3) performing exponential moving standardization processing on the BCG_F signal screened in step 2: BCG_standardize=scale_BCG(BCG_F) The scale_BCG function is composed of the following three formulas: EMA_current=α×value+(1-α)×EMA_previous z_score=(value-EMA_current) / (EMA_sdc) Wherein, EMA_current is the mean value of the exponential moving average at the current time point, EMA_previous is the mean value of the exponential moving average at the previous time point, EMA_sdc is the standard deviation of the exponential moving average at the current time point, EMA_sdp is the standard deviation of the exponential moving average at the previous time point, α is the decay factor, value is the data value at the current time point, and the z_score is composed in accordance with the order to form the BCG_standardize sequence, which is recorded as the BCG_standardize signal; Step 4) performing Fourier transform on the BCG_standardize signal obtained in step 3 to obtain the normalized amplitude spectrum result recorded as BCG_fft; Step 5) inputting the BCG_standardize signal and the BCG_fft into a convolutional neural network model to obtain the heart rate value of the BCG signal. In the step 2), the method for calculating the waveform similarity is the dynamic time warping method, and the steps are: first, divide the BCG_F signal according to the length m, calculate the dynamic time warping distance between the divided BCG_F signal and the previous BCG_F signal, sum all the dynamic time warping distances between the divided BCG_F signal and the previous BCG_F signal, and regard the sum as the dynamic time warping distance BCG_DTW for a single signal; screening the dynamic time warping distance BCG_DTW for a single signal, if the obtained value is higher than the set value y, the signal will not be further analyzed, and it is determined that there is still high noise influence in the signal after filtering, and the heart rate value obtained will have high deviation. 2. The BCG signal heart rate calculation method based on fast Fourier transform and convolutional neural network according to claim 1, characterized in that: 3. The BCG signal heart rate calculation method based on fast Fourier transform and convolutional neural network according to claim 1, characterized in that: The specific steps of the Fourier transform in step 4) are as follows: The fft_BCG function is decomposed into the following six formulas: e represents the base of natural logarithm, i is the imaginary unit, and the argmax function is used to find the value of the independent variable that makes the function take the maximum value. In the formula of FFT, x(n) represents the original data sequence, N is the total number of data points, and k is the frequency index: n = n sample_time x f sample where n is the total number of data points, n sample_time is the sampling time, f sample is the sampling frequency; where f s (i) is the ith sampling frequency, n is the total number of data points; where f min and f max are the minimum and maximum values of the frequency, respectively, and idx min and idx max are the indices of the first sample frequencies greater than or equal to f min and f max , respectively. Wherein, sig_fft(k) is the value of the Fourier transform of the data x(n) at the kth frequency point, and N is the total number of data points. Wherein, result(k) is the normalized FFT value at the kth frequency point. The fft_BCG function calculates the FFT result of the BCG_standardize signal and outputs the normalized amplitude spectrum of the FFT result in the specified frequency range. The obtained normalized amplitude spectrum is denoted as BCG_fft.
4. The BCG signal heart rate calculation method based on fast Fourier transform and convolutional neural network according to claim 1, characterized in that: The specific method in step 5) is as follows: First, input the BCG_F signal into the convolutional neural network for processing. The convolutional neural network contains 14 convolutional layers, and the output channels in the convolutional layers increase from 1 to 512 in a non-negative manner. The size of the feature map gradually decreases as the network deepens, and the depth of the feature gradually increases. The obtained result is denoted as x3, and x3 is flattened. Then, process the result BCG_FCL through the first fully connected layer. Flatten BCG_fft, and then combine the flattened BCG_fft and BCG_FCL together and input them into the second fully connected layer to obtain the final heart rate value.
5. The BCG signal heart rate calculation method based on fast Fourier transform and convolutional neural network according to claim 1, characterized in that: The specific method in step 1) is as follows: signals below 0.8 Hz are considered low-frequency signals, and signals above 25 Hz are considered high-frequency signals.
Citation Information
Patent Citations
Multi-channel ballistocardiography with cepstrum smoothing and quality-based dynamic channel selection
CN106999072A
Deep regression heart rate estimation method for ballistocardiogram signals
CN110420019A