Signal processing method, device and non-transitory computer readable storage medium
By judging the change trend of the segment signal and the dynamic time warping algorithm, the representative peak value of the bad signal is calculated, which solves the problem of heart rate signal noise when the wearer moves and achieves a stable average heart rate output.
Patent Information
- Application Number
- CN202010776216.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-07-10
- Filing Date
- 2020-08-05
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2040-08-05
AI Technical Summary
When the wearer makes sudden movements, the signal sensed by the heart rate monitoring device appears noisy, making it difficult to calculate the peak value, resulting in a delay in calculating the average heart rate.
By judging whether the segment signal of the time series physiological signal is good or bad, using the change trend of the previous and subsequent segment signals to calculate the representative peak value of the bad signal, combined with the dynamic time warping algorithm to judge the signal quality, and determine whether to retain or discard the bad signal to stabilize the output Average heart rate.
Find peaks in poor-quality physiological signals to avoid delays in average heart rate and ensure the accuracy and stability of signal processing.
Smart Images

Figure CN113907734B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a signal processing method, device and non-transitory computer-readable storage medium, and in particular to a signal processing method, device and non-transitory computer-readable storage medium for calculating heart rate. Background Art
[0002] In recent years, as the public pays more attention to health, various monitoring devices that can monitor heartbeats have begun to appear on the market. When the wearer is stable and motionless, the monitoring device can obtain the best physiological signals. When the wearer makes a sudden movement (such as turning the head, nodding, standing up, etc.), the monitoring device will generate noise that affects the accuracy. In the past, the acceleration signal of the accelerometer was used to determine whether the wearer has moved. When the wearer is stationary, the peak value can be calculated smoothly, and then the instantaneous heart rate is calculated by the time difference between adjacent peak values, and finally several instantaneous heart rates are counted to obtain the average heart rate.
[0003] When the wearer makes a sudden movement (such as turning the head, nodding, standing up, etc.), the signal sensed by the monitoring device will have noise, making it difficult to calculate the peak value. The current practice is to directly abandon the signal with noise. However, the instantaneous heart rate is obtained from adjacent peaks. If a section of the signal is abandoned, two instantaneous heart rates will be missing, which will cause a delay in the average heart rate. Summary of the invention
[0004] The present invention provides a signal processing method, a device and a non-transitory computer-readable storage medium, which can find the peak value in the physiological signal with poor quality, thereby stably outputting the average heart rate.
[0005] The signal processing method of the present invention includes: extracting multiple segment signals from physiological signals according to a time series; judging whether each segment signal is a good signal or a bad signal to calculate the peak values of these segment signals judged as good signals; if the i-th segment signal is judged as a bad signal, confirming whether the i-2-th segment signal and the i+2-th segment signal are good signals; when it is determined that the i-2-th segment signal and the i+2-th segment signal are both good signals, retaining the i-th segment signal judged as a bad signal to calculate the representative peak value of the i-th segment signal; and calculating multiple instantaneous heart rates based on the segment signals judged as good signals and the retained segment signals judged as bad signals.
[0006] In one embodiment of the present invention, the step of retaining the i-th segment signal to calculate the representative peak value of the i-th segment signal when it is determined that the i-2th segment signal and the i+2th segment signal are both good signals includes: judging the change trend of the i-th segment signal based on the first peak value of the i-2th segment signal and the second peak value of the i+2th segment signal; and obtaining the representative peak value of the i-th segment signal by using a calculation method corresponding to the change trend.
[0007] In one embodiment of the present invention, before the step of determining the change trend of the i-th segment signal, the step further includes: calculating the absolute value of the difference between the first peak value and the second peak value. The step of determining the change trend of the i-th segment signal includes: comparing the absolute value of the difference with a threshold value; if the absolute value of the difference is less than or equal to the threshold value, determining that the change trend of the i-th segment signal is in a stable state; if the absolute value of the difference is greater than the threshold value and the first peak value is less than the second peak value, determining that the change trend of the i-th segment signal is in a continuously increasing state; and if the absolute value of the difference is greater than the threshold value and the first peak value is greater than the second peak value, determining that the change trend of the i-th segment signal is in a continuously decreasing state.
[0008] In one embodiment of the present invention, the step of obtaining the representative peak of the i-th segment signal by using a calculation method corresponding to the change trend includes: when the change trend is in a stable state, including: obtaining a line segment based on the first peak and the second peak; finding multiple candidate peaks in the i-th segment signal; and selecting one of the candidate peaks closest to the line segment from among these candidate peaks as the representative peak of the i-th segment signal.
[0009] In one embodiment of the present invention, the step of obtaining the representative peak value of the i-th segment signal by using the calculation method corresponding to the change trend includes: when the change trend is in a continuously increasing state, including: obtaining a first line segment based on the first peak value and the third peak value of the i-1-th segment signal; obtaining a second line segment based on the second peak value and the fourth peak value of the i+1-th segment signal; finding multiple candidate peaks in the i-th segment signal; taking out the first candidate peak value closest to the first line segment from these candidate peaks; taking out the second candidate peak value closest to the second line segment from these candidate peaks; if the first candidate peak value is the same as the second candidate peak value, taking the first candidate peak value as the representative peak value of the i-th segment signal; and if the first candidate peak value is different from the second candidate peak value, taking the smallest of the first candidate peak value and the second candidate peak value as the representative peak value of the i-th segment signal.
[0010] In one embodiment of the present invention, the step of obtaining the representative peak value of the i-th segment signal by using the calculation method corresponding to the change trend includes: when the change trend is in a continuously decreasing state, including: obtaining a first line segment based on the first peak value and the third peak value of the i-1-th segment signal; obtaining a second line segment based on the second peak value and the fourth peak value of the i+1-th segment signal; finding multiple candidate peaks in the i-th segment signal; taking out the first candidate peak value closest to the first line segment from these candidate peaks; taking out the second candidate peak value closest to the second line segment from these candidate peaks; if the first candidate peak value is the same as the second candidate peak value, taking the first candidate peak value as the representative peak value of the i-th segment signal; and if the first candidate peak value is different from the second candidate peak value, taking the largest one of the first candidate peak value and the second candidate peak value as the representative peak value of the i-th segment signal.
[0011] In one embodiment of the present invention, if the i-th segment signal is determined to be a bad signal, after confirming whether the i-2-th segment signal and the i+2-th segment signal are good signals, it further includes: if it is determined that at least one of the i-2-th segment signal and the i+2-th segment signal is a bad signal, discarding the i-th segment signal determined to be a bad signal.
[0012] In one embodiment of the present invention, the step of determining whether each segment signal is a good signal or a bad signal includes: utilizing a dynamic time warping (DTW) algorithm to determine whether the segment signal is a good signal or a bad signal.
[0013] In one embodiment of the present invention, the signal processing method further includes: after obtaining the representative peak value of the i-th segment signal, obtaining a comparison value based on the average value of the first peak value of the i-2th segment signal and the second peak value of the i+2th segment signal; determining whether the representative peak value is greater than the comparison value; if the representative peak value is greater than the comparison value, determining that the i-th segment signal is unreliable and discarding the i-th segment signal; and if the representative peak value is less than or equal to the comparison value, determining that the i-th segment signal is credible and retaining the i-th segment signal.
[0014] The signal processing device of the present invention comprises: a heart rate sensor for sensing physiological signals of a wearer; a storage unit comprising a plurality of program code segments; and a processor coupled to the heart rate sensor and the storage unit, wherein the processor executes the program code segments to: receive physiological signals from the heart rate sensor; extract a plurality of segment signals from the physiological signals according to a time series; determine whether each segment signal is a good signal or a bad signal to calculate the peak values of the segment signals determined as good signals; if the i-th segment signal is determined as a bad signal, confirm whether the i-2th segment signal and the i+2th segment signal are good signals; if it is determined that the i-2th segment signal and the i+2th segment signal are both good signals, retain the i-th segment signal to calculate the representative peak value of the i-th segment signal; if it is determined that at least one of the i-2th segment signal and the i+2th segment signal is a bad signal, discard the i-th segment signal; and calculate a plurality of instantaneous heart rates based on the segment signals determined as good signals and the retained segment signals determined as bad signals.
[0015] The non-transitory computer-readable storage medium of the present invention records at least one program instruction, and after being loaded into an electronic device, the program instruction executes the following steps: extracting multiple segment signals from physiological signals according to a time series; judging whether each segment signal is a good signal or a bad signal to calculate the peak values of these segment signals judged as good signals; if the i-th segment signal is judged as a bad signal, confirming whether the i-2-th segment signal and the i+2-th segment signal are good signals; when it is determined that the i-2-th segment signal and the i+2-th segment signal are both good signals, retaining the i-th segment signal to calculate the representative peak value of the i-th segment signal; when it is determined that at least one of the i-2-th segment signal and the i+2-th segment signal is a bad signal, discarding the i-th segment signal; and calculating multiple instantaneous heart rates based on the segment signals judged as good signals and the retained segment signals judged as bad signals.
[0016] Based on the above, the present invention can further determine whether to retain the bad signal, so as to find the peak value in the bad signal, thereby stabilizing the output of the average heart rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is a block diagram of a signal processing device according to an embodiment of the present invention.
[0018] Figure 2 is a flow chart of a signal processing method according to an embodiment of the present invention.
[0019] Figure 3A is a schematic diagram of a physiological signal according to an embodiment of the present invention.
[0020] Figure 3B is a schematic diagram of calculating instantaneous heart rate according to an embodiment of the present invention.
[0021] Figure 4 is a waveform diagram of a stable state according to an embodiment of the present invention.
[0022] Figure 5 is a waveform diagram of a continuous increase state according to an embodiment of the present invention.
[0023] Figure 6 is a waveform diagram of a continuous reduction state according to an embodiment of the present invention.
[0024] Figure 7 FIG. 4 is a waveform diagram representing a method for calculating a peak value in a stable state according to an embodiment of the present invention.
[0025] Figure 8A to Figure 8B FIG. 4 is a waveform diagram representing a method for calculating a peak value in a continuous increase state according to an embodiment of the present invention.
[0026] FIG. 9A to FIG. 9B FIG. 4 is a waveform diagram representing a method of calculating a peak value in a continuous decreasing state according to an embodiment of the present invention.
[0027] Description of the accompanying symbols:
[0028] 100: signal processing device;
[0029] 110: processor;
[0030] 120: storage unit;
[0031] 130: heart rate sensor;
[0032] 300: Physiological signal;
[0033] 401~404, 501~504, 601~604: peak value;
[0034] 701-704, 801, 802, 901-903: candidate peaks;
[0035] A1~A13, M1~M3: section signal;
[0036] iHR1~iHR12: instantaneous heart rate;
[0037] L100, L210, L220, L310, L320: line segment;
[0038] S205~S230: various steps of the signal processing method. DETAILED DESCRIPTION
[0039] Figure 1is a block diagram of a signal processing device according to an embodiment of the present invention. Figure 1 The signal processing device 100 includes a processor 110, a storage unit 120, and a heart rate sensor 130. The processor 110 is directly or indirectly electrically coupled to the storage unit 120 and the heart rate sensor 130.
[0040] The processor 110 is, for example, a central processing unit (CPU), a physical processing unit (PPU), a programmable microprocessor, an embedded control chip, a digital signal processor (DSP), an application specific integrated circuit (ASIC), or other similar devices.
[0041] The storage unit 120 is, for example, any type of fixed or removable random access memory (RAM), read-only memory (ROM), flash memory, hardware or other similar devices or a combination of these devices. The storage unit 120 stores a plurality of program code segments, which are executed by the processor 110 after being installed to implement the following signal processing method.
[0042] The heart rate sensor 130 is used to sense the wearer's physiological signals. The heart rate sensor 130 is, for example, a sensor using photoplethysmography (PPG), but is not limited thereto, and may also be, for example, a radar sensor or an electrocardiogram (ECG) sensor.
[0043] Figure 2 is a flow chart of a signal processing method according to an embodiment of the present invention. In this embodiment, the processor 110 is configured to execute the program code segments stored in the storage unit 120 to implement the following signal processing method.
[0044] In step S205, multiple segment signals are extracted from the physiological signal according to the time series. The processor 110 collects the physiological signal within the sampling time range through the heart rate sensor 130 and divides the physiological signal into multiple segment signals. Then, in step S210, each segment signal is judged as a good signal or a bad signal to calculate the peak value of the segment signal judged as a good signal. In addition, it is further determined whether to retain or discard the bad signal, and the representative peak value of the retained bad signal is calculated.
[0045] Here, the processor 110 uses a sampling window to capture a fixed length of signal to calculate a peak value. After calculating the peak value in the sampling window, the sampling window is shifted backward by a certain distance based on the time series, and then the peak value of the signal in the next sampling window is calculated. The shift distance is, for example, 1 / 2 of the width of the sampling window.
[0046] When the wearer is stable and motionless, the physiological signal detected by the heart rate sensor 130 will have obvious and regular peaks. When the wearer moves, the physiological signal detected by the heart rate sensor 130 will have noise. In the case where the physiological signal is mixed with noise, it is difficult to determine a good signal, and the noise intensity may be higher than the good signal, so the intensity cannot be used to determine the good signal. Here, a bad signal can be defined as too many peaks. For example, when the peak in the segment signal is greater than 1, it can be determined as a bad signal.
[0047] In addition, the processor 110 can use a dynamic time warping (DTW) algorithm to determine whether the segment signal is a good signal or a bad signal. The principle of the DTW algorithm is to provide a sample waveform and determine whether each waveform to be tested matches the sample waveform. Therefore, a sample waveform of a good signal is provided here, so that the waveform of each segment signal (i.e., the waveform to be tested) is compared with the sample waveform to determine whether each segment signal is a good signal or a bad signal.
[0048] For the i-th segment signal determined to be a bad signal, the processor 110 can further determine the change trend according to the segment signals that are adjacent to it in the time series, thereby calculating the representative peak value of the i-th segment signal. Therefore, it is necessary to first determine whether the segment signals that are adjacent to it in the time series are credible, that is, whether they are good signals.
[0049] Since the physiological signal is a continuous signal, the signal will conform to the overall trend of change. Therefore, the peak close to the overall trend is more likely to be the actual signal, and the peak deviating from the overall trend is more likely to be noise. Therefore, the present embodiment specifically takes out the second segment signal before and the second segment signal after (i-2 segment signal and i+2 segment signal) of the bad signal (i-th segment signal) to determine the trend of change. The reason for not taking the adjacent previous segment signal and the next segment signal (i-1 segment signal and i+1 segment signal) is that the peak of the adjacent segment signal is closer to the bad signal, which may be an unstable peak or affected by the bad signal. Therefore, taking out the peak of the second segment signal before and the second segment signal after (i-2 segment signal and i+2 segment signal) of the bad signal to further calculate the representative peak of the bad signal, on the one hand, still retains the trend of change, and on the other hand, is less susceptible to the impact of the bad signal.
[0050] In this embodiment, the peak value is calculated in real time. Therefore, when a segment signal is determined to be a bad signal, the segment signal is temporarily stored. After obtaining the peak values of the next two segment signals, it is determined whether to keep or discard the bad signal. The decision to keep or discard the bad signal can refer to steps S215 to S225. In addition, for example, each segment signal to be kept is given a mark "true", and each segment signal to be discarded is given a mark "false".
[0051] In step S215, if the i-th segment signal is determined to be a bad signal, it is determined whether the i-2th segment signal and the i+2th segment signal are good signals. In step S220, if it is determined that the i-2th segment signal and the i+2th segment signal are both good signals, the i-th segment signal is retained to calculate the representative peak value of the i-th segment signal. In step S225, if it is determined that at least one of the i-2th segment signal and the i+2th segment signal is a bad signal, the i-th segment signal is discarded.
[0052] For example, assuming that the third segment signal is determined to be a bad signal, the processor 110 will temporarily store the third segment signal to wait for the fifth segment signal to be obtained. The processor 110 further determines whether the first segment signal and the fifth segment signal are both good signals. If the first segment signal and the fifth segment signal are both good signals, the third segment signal is retained, and the representative peak value of the third segment signal is further calculated. If one of the first segment signal and the fifth segment signal is a bad signal, the third segment signal is discarded, that is, the representative peak value of the third segment signal is not calculated.
[0053] Finally, in step S230, the instantaneous heart rate is calculated based on the segment signals determined as good signals and the retained segment signals determined as bad signals. Here, the processor 110 calculates the instantaneous heart rate using the time difference between two adjacent peaks, and finally counts several instantaneous heart rates to obtain the average heart rate.
[0054] Generally speaking, the heart rate F (instantaneous heart rate) is obtained by calculating the time difference T between two adjacent peaks (ie, the heart rate cycle) and then calculating its reciprocal, where F = 1 / T (heart rate / second) = 60 / T (heart rate / minute).
[0055] Figure 3A is a schematic diagram of a physiological signal according to an embodiment of the present invention. Figure 3B is a schematic diagram of calculating instantaneous heart rate according to an embodiment of the present invention. Figure 3A , the physiological signal 300 includes a plurality of segment signals, and 13 segment signals A1 to A13 are shown here. Among them, segment signals A1, A2, A4, A5, A8, A10 to A13 represent good signals, and segment signals A3, A6, A7, and A9 represent bad signals. For segment signal A3, segment signal A1 is taken forward and segment signal A5 is taken backward. Both segment signal A1 and segment signal A5 are good signals, so segment signal A3, which is determined to be a bad signal, is retained. Similarly, segment signals A3 and A6 are retained, and segment signals A7 and A9 are discarded.
[0056] Reference Figure 3B , the processor 110 obtains the instantaneous heart rate based on the time difference between the peak values of two adjacent time segments. Based on the above embodiment, the segment signals A3 and A6 that are determined to be bad signals are retained, so the instantaneous heart rates iHR1~iHR5 can be obtained based on the time segments A1~A6. The instantaneous heart rates iHR10~iHR12 can be obtained based on the time segments A10~A13. In addition, since the time segments A7 and A9 have been discarded, the instantaneous heart rates iHR6~iHR9 that can be obtained based on the time segments A6~A10 cannot be obtained. Here, the processor 110 can calculate the average heart rate after obtaining a preset number of instantaneous heart rates. For example, it can be designed to calculate the average heart rate based on 5 instantaneous heart rates. Therefore, through the method of this embodiment, 5 instantaneous heart rates iHR1~iHR5 can be obtained based on the time segments A1~A6. Average heart rate=(iHR1+iHR2+iHR3+iHR4+iHR5) / 5.
[0057] If the method of the above embodiment is not used, since the segment signals A3, A6, A7, and A8 are all determined to be bad signals, the instantaneous heart rates iHR2, iHR3, iHR5 to iHR9 cannot be used, and therefore the segment signal A13 must be delayed to obtain the five instantaneous heart rates iHR1, iHR4, iHR10, iHR11, and iHR12. Therefore, the method of the above embodiment can solve the problem of delay in calculating the average heart rate.
[0058] In addition, in the above step S220, the representative peak value of the i-th segment signal is calculated, and the representative peak value can be selected from the multiple candidate peak values included in the i-th segment signal based on the first peak value of the i-2-th segment signal and the second peak value of the i+2-th segment signal. Specifically, the processor 110 determines the change trend of the i-th segment signal based on the first peak value of the i-2-th segment signal and the second peak value of the i+2-th segment signal. Afterwards, the processor 110 obtains the representative peak value of the i-th segment signal using a calculation method corresponding to the change trend.
[0059] The i-th segment signal determined as a bad signal has three change trends, including a stable state, a continuously increasing state, and a continuously decreasing state. The processor 110 calculates the absolute value of the difference between the first peak value and the second peak value (|first peak value-second peak value|), and determines the change trend of the i-th segment signal based on the absolute value of the difference. Here, the processor 110 compares the absolute value of the difference with a preset threshold value. If the absolute value of the difference is less than or equal to the threshold value, the change trend of the i-th segment signal is determined to be a stable state. If the absolute value of the difference is greater than the threshold value and the first peak value is less than the second peak value, the change trend of the i-th segment signal is determined to be a continuously increasing state. If the absolute value of the difference is greater than the threshold value and the first peak value is greater than the second peak value, the change trend of the i-th segment signal is determined to be a continuously decreasing state.
[0060] Bottom Figures 4 to 6 To illustrate the stable state, the continuously increasing state, and the continuously decreasing state respectively.
[0061] Figure 4 is a waveform diagram of a stable state according to an embodiment of the present invention. Figure 4 In FIG. 1 , it is assumed that the mth segment signal to the m+4th segment signal are shown, wherein the m+2th segment signal (segment signal M1) is a bad signal, and the other segment signals are good signals. The peak values 401, 402, 403, and 404 are the peak values of the mth segment signal, the m+1th segment signal, the m+3th segment signal, and the m+4th segment signal, respectively. |
[0062] For the segment signal M1, the processor 110 takes the peak value 401 (first peak value) of the mth segment signal, takes the peak value 404 (second peak value) of the m+4th segment signal, calculates the absolute value of the difference between the peak value 401 and the peak value 404, and compares it with the preset threshold value. Since the absolute value of the difference between the peak value 401 and the peak value 404 is not greater than the threshold value, it is determined that the change trend of the segment signal M1 is a stable state. Here, it is assumed that the preset threshold value is 1500 millivolts (mV).
[0063] Figure 5 is a waveform diagram of a continuous increase state according to an embodiment of the present invention. Figure 5 In FIG. 1 , it is assumed that the nth segment signal to the n+4th segment signal are shown, wherein the n+2th segment signal (segment signal M2) is a bad signal, and the other segment signals are good signals. The peak values 501, 502, 503, and 504 are the peak values of the nth segment signal, the n+1th segment signal, the n+3th segment signal, and the n+4th segment signal, respectively. |
[0064] For the segment signal M2, the processor 110 takes the peak value 501 (first peak value) of the nth segment signal, and takes the peak value 504 (second peak value) of the n+4th segment signal, calculates the absolute value of the difference between the peak value 501 and the peak value 504, and compares it with the preset threshold value. Since the absolute value of the difference between the peak value 501 and the peak value 504 is greater than the threshold value, the size of the peak value 501 and the peak value 504 is further determined. Here, the peak value 504 is greater than the peak value 501, so it is determined that the change trend of the segment signal M2 is a continuous increase state.
[0065] Figure 6 is a waveform diagram of a continuous reduction state according to an embodiment of the present invention. Figure 6 In FIG. 1 , it is assumed that the p-th segment signal to the p+4-th segment signal are shown, among which the p+2-th segment signal (segment signal M3) is a bad signal, and the other segment signals are good signals. The peak values 601, 602, 603, and 604 are the peak values of the p-th segment signal, the p+1-th segment signal, the p+3-th segment signal, and the p+4-th segment signal, respectively.
[0066] For the segment signal M3, the processor 110 takes the peak value 601 (first peak value) of the p-th segment signal, and takes the peak value 604 (second peak value) of the p+4-th segment signal, calculates the absolute value of the difference between the peak value 601 and the peak value 604, and compares it with the preset threshold value. Since the absolute value of the difference between the peak value 601 and the peak value 604 is greater than the threshold value, the magnitude of the peak value 601 and the peak value 604 is further determined. Here, the peak value 601 is greater than the peak value 604, so it is determined that the change trend of the segment signal M3 is in a continuously decreasing state.
[0067] After obtaining the change trend of the bad signal, the processor 110 can use a calculation method corresponding to the change trend to obtain the representative peak value of the bad signal. Figure 7 , Figure 8A to Figure 8B , FIG. 9A to FIG. 9B To illustrate how to calculate the peak value in the stable state, the continuously increasing state, and the continuously decreasing state.
[0068] Figure 7 is a waveform diagram representing a method of calculating a peak value in a stable state according to an embodiment of the present invention. Figure 4 An example is used to illustrate the calculation method of the representative peak value in a stable state.
[0069] Reference Figure 7 First, the processor 110 obtains the line segment L100 based on the peak 401 (first peak) and the peak 404 (second peak). Next, the processor 110 finds a plurality of candidate peaks 701-704 in the segment signal M1, and selects one of the candidate peaks 701-704 that is closest to the line segment L100 as the representative peak of the segment signal M1. Here, the candidate peak 702 is selected as the representative peak of the segment signal M1.
[0070] Figure 8A to Figure 8B is a waveform diagram representing a method of calculating a peak value in a continuous increase state according to an embodiment of the present invention. Figure 5 An embodiment is used to illustrate the calculation method of the peak value in the case of a continuous increase state.
[0071] Reference Figure 8A to Figure 8B , the n+2 segment signal (segment signal M2) is a bad signal. The processor 110 obtains the line segment L210 based on the peak value 501 (first peak) of the n segment signal and the peak value 502 (third peak) of the n+1 segment signal. Furthermore, the processor 110 obtains the line segment L220 based on the peak value 504 (second peak) of the n+4 segment signal and the peak value 503 (fourth peak) of the n+3 segment signal.
[0072] Furthermore, the processor 110 finds a plurality of candidate peaks 801 and 802 in the segment signal M2. Next, the processor 110 extracts the candidate peak 802 (the first candidate peak) closest to the line segment L210 from among the candidate peaks 801 and 802, and extracts the candidate peak 801 (the second candidate peak) closest to the line segment L220 from among the candidate peaks 801 and 802. Next, the processor 110 determines whether the first candidate peak is the same as the second candidate peak.
[0073] In a waveform whose changing trend is a continuously increasing state, since a sudden increase in strength is more likely to be noise, if the first candidate peak value is different from the second candidate peak value, the smallest of the first candidate peak value and the second candidate peak value is used as the representative peak value of the segment signal M2. Figure 8A to Figure 8B In the embodiment, the first candidate peak value (candidate peak value 802) is different from the second candidate peak value (candidate peak value 801), so the processor 110 selects the smallest candidate peak value 802 as the representative peak value of the segment signal M2.
[0074] In other embodiments, if the first candidate peak closest to the line segment L210 is the same as the second candidate peak closest to the line segment L220 , the processor 110 uses the first candidate peak (ie, the second candidate peak) as the representative peak of the segment signal M2 .
[0075] FIG. 9A to FIG. 9B is a waveform diagram representing a calculation method of a peak value in a continuous decreasing state according to an embodiment of the present invention. Figure 6 An embodiment is used to illustrate the calculation method of the representative peak value in the case of a continuous reduction state.
[0076] Reference FIG. 9A to FIG. 9B , the p+2 segment signal (segment signal M3) is a bad signal. The processor 110 obtains the line segment L310 based on the peak value 601 (first peak) of the p-th segment signal and the peak value 602 (third peak) of the p+1-th segment signal. Furthermore, the processor 110 obtains the line segment L320 based on the peak value 604 (second peak) of the p+4-th segment signal and the peak value 603 (fourth peak) of the p+3-th segment signal.
[0077] Furthermore, the processor 110 finds a plurality of candidate peaks 901, 902, and 903 in the segment signal M3. Next, the processor 110 extracts the candidate peak 902 (the first candidate peak) closest to the line segment L310 from among the candidate peaks 901, 902, and 903, and extracts the candidate peak 902 (the second candidate peak) closest to the line segment L320 from among the candidate peaks 901, 902, and 903. Next, the processor 110 determines whether the first candidate peak is the same as the second candidate peak.
[0078] In this embodiment, the first candidate peak value and the second candidate peak value are both the candidate peak value 902 , so the processor 110 uses the candidate peak value 902 as the representative peak value of the segment signal M3 .
[0079] In other embodiments, in a waveform whose changing trend is a continuously decreasing state, since a sudden surge with a sudden decrease in intensity is more likely to be noise, if the first candidate peak closest to segment L310 is different from the second candidate peak closest to segment L320, the maximum of the first candidate peak and the second candidate peak is used as the representative peak of the segment signal M3.
[0080] In addition, in the above embodiment, the representative peak value of the bad signal is further calculated. In order to avoid an absurd judgment result, after obtaining the representative peak value of the bad signal, it is further calculated whether the voltage value of the representative peak value of the bad signal is too high. For example, the i-th segment signal is determined to be a bad signal, and the comparison value is obtained based on the average value of the first peak value of the i-2 segment signal and the second peak value of the i+2 segment signal. Wherein, the comparison value = 2×AC AVG (S1 AC :S2 AC ).AC AVG (S1 AC :S2 AC ) represents the voltage value S1 of the first peak value of the i-2 segment signal AC The second peak value S2 of the i+2 segment signal AC The average value of the voltage.
[0081] Next, the representative peak value of the bad signal is compared with the comparison value. If the representative peak value is greater than the comparison value, the bad signal is determined to be unreliable and discarded. If the representative peak value is less than or equal to the comparison value, the bad signal is determined to be reliable and retained.
[0082] In addition, the above embodiment can be implemented by a non-transitory computer-readable storage medium. The non-transitory computer-readable storage medium records at least one program instruction, and after the program instruction is loaded into the electronic device, the steps S205 to S230 are executed.
[0083] In summary, the present invention calculates possible representative peak values based on the changing trends of the preceding and following signals for segment signals of poor quality, finds the peak values from the poor quality PPG signals, solves the problem of average heart rate delay caused by poor quality of physiological signals, and can output the average heart rate stably.
Claims
1. A signal processing method, characterized in that: include: Extracting a plurality of segment signals from a physiological signal according to a time series; Determine whether each of the segment signals is a good signal or a bad signal, so as to calculate the peak values of the segment signals determined to be good signals; If the i-th segment signal is determined to be a bad signal, confirm whether the i-2-th segment signal and the i+2-th segment signal are good signals; When it is determined that both the i-2th segment signal and the i+2th segment signal are good signals, retain the i-th segment signal determined to be a bad signal and calculate a representative peak value of the i-th segment signal; as well as Calculating a plurality of instantaneous heart rates based on the segment signals determined to be good signals and the retained segment signals determined to be bad signals; Wherein, when it is determined that both the i-2th segment signal and the i+2th segment signal are good signals, the step of retaining the i-th segment signal to calculate the representative peak value of the i-th segment signal includes: Calculating an absolute value of a difference between a first peak value of the (i-2)th segment signal and a second peak value of the (i+2)th segment signal; Determining a change trend of the i-th segment signal based on the absolute value of the difference; and A calculation method corresponding to the change trend is used to obtain the representative peak value of the i-th segment signal.
2. The signal processing method according to claim 1, characterized in that: The step of judging the change trend of the i-th section signal based on the absolute value of the difference comprises: comparing the absolute value of the difference with a threshold value; If the absolute value of the difference is less than or equal to the threshold value, it is determined that the change trend of the i-th segment signal is a stable state; If the absolute value of the difference is greater than the threshold value and the first peak value is less than the second peak value, it is determined that the change trend of the i-th segment signal is a continuously increasing state; and If the absolute value of the difference is greater than the threshold value and the first peak value is greater than the second peak value, it is determined that the change trend of the i-th segment signal is a continuously decreasing state.
3. The signal processing method according to claim 2, characterized in that: The step of obtaining the representative peak value of the i-th segment signal by using a calculation method corresponding to the change trend includes: When the change trend is the stable state, it includes: Obtain a line segment based on the first peak value and the second peak value; In the i-th segment signal, find a plurality of candidate peaks; and A candidate peak value closest to the line segment is selected from the candidate peak values as a representative peak value of the i-th segment signal.
4. The signal processing method according to claim 2, characterized in that: The step of obtaining the representative peak value of the i-th segment signal by using a calculation method corresponding to the change trend includes: When the change trend is in the continuously increasing state, it includes: Obtain a first line segment based on the first peak value and a third peak value of the (i-1)th segment signal; Obtain a second line segment based on the second peak value and a fourth peak value of the (i+1)th segment signal; In the i-th segment signal, find a plurality of candidate peaks; Selecting a first candidate peak value closest to the first line segment from the candidate peak values; Selecting a second candidate peak value closest to the second line segment from the candidate peak values; If the first candidate peak value is the same as the second candidate peak value, taking the first candidate peak value as the representative peak value of the i-th segment signal; and If the first candidate peak value is different from the second candidate peak value, the minimum of the first candidate peak value and the second candidate peak value is used as the representative peak value of the i-th segment signal.
5. The signal processing method according to claim 2, characterized in that: The step of obtaining the representative peak value of the i-th segment signal by using a calculation method corresponding to the change trend includes: When the change trend is in the state of continuous decrease, it includes: Obtain a first line segment based on the first peak value and a third peak value of the (i-1)th segment signal; Obtain a second line segment based on the second peak value and a fourth peak value of the (i+1)th segment signal; In the i-th segment signal, find a plurality of candidate peaks; Selecting a first candidate peak value closest to the first line segment from the candidate peak values; Selecting a second candidate peak value closest to the second line segment from the candidate peak values; If the first candidate peak value is the same as the second candidate peak value, taking the first candidate peak value as the representative peak value of the i-th segment signal; and If the first candidate peak value is different from the second candidate peak value, the maximum of the first candidate peak value and the second candidate peak value is used as the representative peak value of the i-th segment signal.
6. The signal processing method according to claim 1, characterized in that: If the i-th segment signal is determined to be a bad signal, after the step of confirming whether the i-2-th segment signal and the i+2-th segment signal are good signals, the method further includes: When it is determined that at least one of the (i-2)th segment signal and the (i+2)th segment signal is a bad signal, the (i)th segment signal determined to be a bad signal is discarded.
7. The signal processing method according to claim 1, characterized in that: The step of determining whether each of the segment signals is a good signal or a bad signal comprises: A dynamic time warping algorithm is used to determine whether each of the segment signals is a good signal or a bad signal.
8. The signal processing method according to claim 1, characterized in that: Also includes: After obtaining the representative peak value of the i-th segment signal, obtaining a comparison value based on an average value of a first peak value of the i-2-th segment signal and a second peak value of the i+2-th segment signal; Determine whether the representative peak value is greater than the comparison value; If the representative peak value is greater than the comparison value, the i-th segment signal is determined to be unreliable and the i-th segment signal is discarded; and If the representative peak value is less than or equal to the comparison value, the i-th segment signal is determined to be credible and the i-th segment signal is retained.
9. A signal processing device, characterized in that: include: a heart rate sensor for sensing a physiological signal of a wearer; a storage unit including a plurality of program code segments; as well as A processor is coupled to the heart rate sensor and the storage unit, and the processor executes the program code segments to: receiving the physiological signal from the heart rate sensor; Extracting a plurality of segment signals from the physiological signal according to a time series; Determine whether each of the segment signals is a good signal or a bad signal, so as to calculate the peak values of the segment signals determined to be good signals; If the i-th segment signal is determined to be a bad signal, confirm whether the i-2-th segment signal and the i+2-th segment signal are good signals; When it is determined that both the i-2th segment signal and the i+2th segment signal are good signals, retaining the i-th segment signal determined to be a bad signal to calculate a representative peak value of the i-th segment signal; as well as Calculating a plurality of instantaneous heart rates based on the segment signals determined to be good signals and the retained segment signals determined to be bad signals; Wherein, when it is determined that both the i-2th segment signal and the i+2th segment signal are good signals, the step of retaining the i-th segment signal to calculate the representative peak value of the i-th segment signal includes: Calculating an absolute value of a difference between a first peak value of the (i-2)th segment signal and a second peak value of the (i+2)th segment signal; Determining a change trend of the i-th segment signal based on the absolute value of the difference; and A calculation method corresponding to the change trend is used to obtain the representative peak value of the i-th segment signal.
10. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium records at least one program instruction, and after the at least one program instruction is loaded into an electronic device, the following steps are executed: Extracting a plurality of segment signals from a physiological signal according to a time series; Determine whether each of the segment signals is a good signal or a bad signal, so as to calculate the peak values of the segment signals determined to be good signals; If the i-th segment signal is determined to be a bad signal, confirm whether the i-2-th segment signal and the i+2-th segment signal are good signals; When it is determined that both the i-2th segment signal and the i+2th segment signal are good signals, retain the i-th segment signal to calculate a representative peak value of the i-th segment signal; as well as Calculating a plurality of instantaneous heart rates based on the segment signals determined to be good signals and the retained segment signals determined to be bad signals; Wherein, when it is determined that both the i-2th segment signal and the i+2th segment signal are good signals, the step of retaining the i-th segment signal to calculate the representative peak value of the i-th segment signal includes: Calculating an absolute value of a difference between a first peak value of the (i-2)th segment signal and a second peak value of the (i+2)th segment signal; Determining a change trend of the i-th segment signal based on the absolute value of the difference; and A calculation method corresponding to the change trend is used to obtain the representative peak value of the i-th segment signal.
