Improved Least Squares Baseline Drift Removal Method
Through the improved least squares method, the baseline drift interference in the electromyography signal is fitted and removed, which solves the problem that baseline drift interference is difficult to effectively deal with in the prior art and improves the recognition accuracy.
Patent Information
- Application Number
- CN202111506236.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-10
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2041-12-10
AI Technical Summary
In the prior art, when processing electromyography signals, it is difficult to quickly and efficiently remove baseline drift interference, resulting in low recognition accuracy.
Using the improved least squares method, the fitted straight line segments in the window are converted into quadratic polynomials for fitting, thereby removing baseline drift interference.
Through the improved least squares method, the baseline drift removal effect is improved by about 5%, and the signal attenuation rate is maintained, and the comprehensive index is better than the original method.
Smart Images

Figure CN113987411B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of signal baseline drift elimination, and specifically relates to an improved least squares-based baseline drift removal method. Background Art
[0002] sEMG is an electrical signal generated by the contraction of muscle groups triggered by nerve electrical signals emitted by the brain. The electrical signal conducted through human tissues to the skin surface is the surface electromyogram signal (sEMG). This electrical signal contains time information, intensity information, etc. generated by sEMG.
[0003] Due to the characteristics of the collected signal, such as small amplitude, weak signal, and susceptibility to interference, it will cause serious distortion of the collected signal waveform, resulting in inaccurate final analysis results and large errors. Therefore, weakening or filtering out interference signals during the processing process will greatly improve the recognition accuracy. Therefore, during the research process, domestic and foreign scholars need to preprocess the collected sEMG signals to filter out the noise in the signals, improve the signal-to-noise ratio, and reduce the misjudgment probability brought by the noise to the feature recognition algorithm before performing eigenvalue analysis on the sEMG signals.
[0004] The interference signals in sEMG signals are mainly composed of the following points:
[0005] 1. Motion artifacts: During the collection of electromyogram signals, the weak electrical signals generated during the friction between the electrodes of the electromyogram signal collection device and the human skin will, after being amplified by the operational amplifier, generate motion noise with an amplitude similar to that of sEMG. Since the noise of motion artifacts is mainly concentrated in the low-frequency band, mainly distributed between 1 and 10 Hz, the motion artifact noise can be filtered out using a filter. Common filtering algorithms include Butterworth high-pass filtering algorithm, Chebyshev high-pass filtering algorithm, orthogonal wavelet adaptive algorithm, etc.
[0006] 2. Power frequency noise: Power frequency noise is mainly caused by the induced signals brought by the AC power supply in the collection device. When the AC power supply is input, the alternating signal will generate an induced signal on the circuit board, thus causing a background interference signal of 50 Hz (or 60 Hz). The power frequency noise will bring very large interference to the signal output of the signal collection device because this signal is exactly within the frequency band of the electromyogram signal. Therefore, 50 Hz (or 60 Hz) needs to be completely filtered out, this frequency band is abandoned, or a modern filter is used to distinguish between the noise signal and the useful signal. A common method for removing power frequency noise is to use a notch filter to filter out the power frequency noise signal component in the output signal.
[0007] 3. Baseline drift: During the process of detecting EMG signals, due to human movement and external interference, the collected signals output by the signal acquisition device will be mixed with some interference signals, which will interfere with subsequent eigenvalue extraction and recognition. Baseline drift is caused by low-frequency interferences such as human breathing, weak muscle contractions, and electrode movement, resulting in the actual signal fluctuating up and down around the baseline. Common filtering algorithms include high-pass filtering, median filtering, integer coefficient filtering, etc. to remove baseline drift interference.
[0008] Since the energy of EMG signals is mainly concentrated between 50 Hz and 150 Hz, when extracting signal eigenvalues, analyzing the frequency band of 60 Hz to 150 Hz can effectively filter out motion artifacts and power frequency noise. However, during the movement of the user wearing the EMG sensor, the friction between the sensor and the skin will continuously generate interference signals, causing the EMG signal to float up and down around the baseline, which will cause great interference to spectrum analysis and eigenvalue extraction. Therefore, how to quickly and efficiently filter out the baseline drift component is the key to improving the recognition accuracy.
[0009] In 2014, Pang Yu et al. from Chongqing University of Posts and Telecommunications proposed a baseline drift removal algorithm based on morphology. This method can ensure the morphological characteristics of the collected signals by features such as shape, size, and structure, thereby removing the characteristic morphology of ECG signals.
[0010] In 2015, Han Qingyang et al. from the Optoelectronic Technology R & D Center of the Chinese Academy of Sciences proposed a method combining ensemble empirical mode decomposition with signal randomness detection based on permutation entropy, which can filter out baseline drift and high-frequency noise together. After testing, this method can effectively improve the recognition accuracy.
[0011] In 2018, Lin Jinchao et al. from Chongqing University of Posts and Telecommunications proposed a method based on improved ensemble empirical mode decomposition, which can overcome the drawbacks of empirical mode decomposition and mode mixing, and thus effectively filter out the baseline drift component in the signal.
[0012] In 2020, Guo Shuyan et al. from North University of China proposed a completely adaptive algorithm that highly fits the physical meaning of EMD, which can effectively filter out the baseline drift component in the signal.
[0013] According to the applicant's understanding, the deficiencies and defects of the prior art are shown in Table 1.
[0014]
[0015]
[0016] Table 1 Comparison table of baseline drift algorithms
[0017] Among various baseline drift filtering algorithms, comparatively, the improved ensemble empirical mode decomposition method and the fully adaptive algorithm have the best denoising effect, but also the largest computational complexity. The wavelet transform and the average empirical algorithm have a medium computational complexity and a medium denoising effect. The least squares method algorithm has the smallest computational complexity and a medium denoising effect. Summary of the Invention
[0018] The technical problem to be solved by the present invention is to overcome the deficiencies of the prior art and provide a method for removing baseline drift based on the improved least squares method. By converting the straight line segment fitted in the window into a quadratic polynomial for fitting through the improved least squares method, the baseline drift problem within the window is solved.
[0019] The present invention provides a hinge cover installation structure, including the following steps.
[0020] Step S1. Set the fitting function as K i (x) = a i x 2 + b i x + c i , each segment consists of N (N < m) data, and the ILSM formula is obtained as:
[0021]
[0022] In the formula, m is the total number of acquisition points of the electromyogram acquisition data, and N is the number of sampling points in each segment.
[0023] Step S2. The sum of the squares of the distances from each point on the fitting function P(X) to each sampling point is the cost function Q(a, b, c), and the formula is
[0024]
[0025] When the cost function Q(a, b, c) is at the minimum value, that is, when the partial derivatives are 0, the best fitting curve is obtained.
[0026] Step S3. Take the partial derivative of the cost function Q(a, b, c), and let the partial derivative be equal to 0, then the partial derivative formula is Use the gradient descent algorithm to obtain the optimal solution, then In the formula, a′, b′, c′ are the new polynomial coefficients after calculation, a, b, c are the previous polynomial coefficients, W is the learning rate, and d a , d b , d c are the partial derivatives of A, B, C.
[0027] Step S4. Substitute the new polynomial coefficients a′, b′, c′ into the cost function to obtain the value of the cost function for the new polynomial coefficients. Then, the difference between the cost function calculated by the new polynomial coefficients and the previous cost function is the gradient, denoted as Q(a, b, c, a′, b′, c′), and the formula is
[0028] When the value of the cost function is less than the set value, stop the operation.
[0029] As a further technical solution of the present invention, the ability to remove the baseline drift problem is observed by using the sample mean square error algorithm, and the formula is
[0030]
[0031] In the formula, m is the number of samples, x i is the value of the i-th sampled electromyogram signal, is the average value of the electromyogram signal samples.
[0032] The advantages of the present invention are as follows: The method segments the sampled data into windows of a certain size. After segmentation, the improved least squares method is used for polynomial fitting to obtain the fitting function of each window. Subtract the value of the fitting function from the original data, and after obtaining the filtered value, add the average value of the original data to pull the data back to the baseline as a whole, completing the algorithm filtering step. Based on the improved least squares method, the effect of removing the baseline drift is about 5% better than that of the least squares method, and the attenuation rate of the signal is similar to that before improvement. In summary, the comprehensive indicators of the algorithm in all aspects after improvement are better than those before improvement, and it has a good effect of removing the baseline drift. Description of the Drawings
[0033] Figure 1 is a schematic flowchart of the method of the present invention;
[0034] Figure 2 is a fitting curve diagram of the improved two-difference algorithm with 30 windows in the embodiment of the present invention;
[0035] Figure 3 is a fitting curve diagram of the improved two-difference algorithm with 10 windows in the embodiment of the present invention;
[0036] Figure 4 is a comparison diagram before and after processing by the improved two-interpolation algorithm with 30 windows in the embodiment of the present invention;
[0037] Figure 5 is a comparison diagram before and after processing by the improved least squares algorithm with 10 windows in the embodiment of the present invention. Detailed Embodiment
[0038] Please refer to Figure 1, this embodiment provides an installation structure of a hinge cover for the present invention, including the following steps:
[0039] Step S1. Set the fitting function as K i (x) = a i x2 + b i x + c i , each segment consists of N (N < m) data, and the ILSM formula is obtained as:
[0040]
[0041] In the formula, m is the total number of acquisition points of the electromyogram acquisition data, and N is the number of sampling points in each segment;
[0042] Step S2. The sum of the squares of the distances from each point on the fitting function P(X) to each sampling point is the cost function Q(a, b, c), and the formula is
[0043]
[0044] When the cost function Q(a, b, c) is at its minimum value, that is, when the partial derivatives are 0, the best fitting curve is obtained;
[0045] Step S3. Take the partial derivative of the cost function Q(a, b, c), and set the partial derivative equal to 0, then the partial derivative formula is Use the gradient descent algorithm to obtain the optimal solution, then In the formula, a′, b′, c′ are the new polynomial coefficients after calculation, a, b, c are the previous polynomial coefficients, W is the learning rate, d a , d b , d c are the partial derivatives of A, B, C;
[0046] Step S4. Substitute the new polynomial coefficients a′, b′, c′ into the cost function to obtain the value of the cost function of the new polynomial coefficients. Then, the difference between the cost function calculated by the new polynomial coefficients and the previous cost function is the gradient, denoted as Q(a, b, c, a′, b′, c′), and the formula is
[0047] When the value of the cost function is less than the set value, stop the operation.
[0048] As Figure 2 shown, it is the data trend function after fitting by the improved second-difference algorithm with a window size of 30. It can be seen from the figure that the function lines after fitting each segment of the electromyogram acquisition signal fit the trend of the electromyogram signal very accurately.
[0049] As Figure 3As shown, it is the data trend function after fitting by the improved second-difference algorithm with a window size of 10. It can be seen from the figure that as the window size decreases, the fitted curve can better fit the data trend.
[0050] As Figure 4 and Figure 5 shown, they are respectively the comparison diagrams of the processing effects of the functions with window sizes of 10 and 30. It can be seen from the figure that the processing effect of the algorithm with a window size of 10 is more in line with the baseline than that with a window size of 30.
[0051] In the time domain, the degree of deviation of the signal from the baseline is mainly analyzed. Therefore, the sample mean square error can be used to observe the overall variation degree of the signal, so as to observe the ability of the algorithm to remove the baseline drift problem.
[0052]
[0053] In the formula, m is the number of samples, x i is the value of the i-th sampled electromyogram signal, is the average value of the electromyogram signal samples.
[0054]
[0055] Table 2 Sample variance value table before and after algorithm improvement
[0056] As shown in Table 2, the sMSE value of the electromyogram signal with added baseline drift is 21013, and the sMSE of the original electromyogram signal is 6031. It can be seen that after adding the baseline drift, the electromyogram signal deviates significantly. In the case of a window size of 10, the sMSE value of the least squares method is 237 higher than that of the improved least squares method. It can be seen that the improved least squares method has a better effect on removing baseline drift than before.
[0057] To sum up, from both the time domain and the frequency domain, and from the summary of multiple indicators, the effect of removing baseline drift based on the improved least squares method is about 5% higher than that of the least squares method, and the attenuation rate of the signal is similar to that before improvement. Therefore, it can be seen that the comprehensive indicators of this algorithm in all aspects after improvement are better than those before improvement, and it has a good effect on removing baseline drift.
[0058] The method of this embodiment first segments the sampled data into windows of a certain size. After segmentation, the improved least squares method is used to fit the polynomial to obtain the fitting function of each window. Subtract the value of the fitting function from the original data. After obtaining the filtered value, add the average value of the original data to pull the data back to the baseline as a whole, and complete the algorithm filtering step.
[0059] The basic principles, main features and advantages of the present invention have been shown and described above. Those skilled in the art should understand that the present invention is not limited by the above specific embodiments, and the above specific embodiments and the descriptions in the specification are only for further explaining the principles of the present invention. Without departing from the spirit scope of the present invention, the present invention will have various changes and improvements, and these changes and improvements all fall within the scope of the present invention claimed. The scope of the present invention claimed is defined by the claims and their equivalents.
Claims
1. An improved least squares-based baseline drift removal method, characterized in that, Including the following steps, Step S1. Set the fitting function as K i (x) = a i x 2 + b i x + c i , each segment consists of N data, N < m, Obtain the ILSM formula as: In the formula, m is the total number of acquisition points of the electromyogram acquisition data, and N is the number of sampling points in each segment; Step S2. The sum of the squares of the distances from each point on the fitting function P(X) to each sampling point is the cost function Q(a, b, c), and the formula is When the cost function Q(a, b, c) is at its minimum value, that is, when the partial derivatives are 0, obtain the best fitting curve; Step S3. Take the partial derivatives of the cost function Q(a, b, c), and set the partial derivatives equal to 0, then the partial derivative formula is Use the gradient descent algorithm to obtain the optimal solution, then In the formula, a′, b′, c′ are the new polynomial coefficients after calculation, a, b, c are the previous polynomial coefficients, W is the learning rate, d a , d b , d c are the partial derivatives of A, B, and C; Step S4. Substitute the new polynomial coefficients a′, b′, c′ into the cost function to obtain the value of the cost function of the new polynomial coefficients. Then, the difference between the cost function calculated by the new polynomial coefficients and the previous cost function is the gradient, denoted as Q(a, b, c, a′, b′, c′), and the formula is Stop the operation when the cost function value is less than the set value.
2. The improved least squares-based baseline drift removal method according to claim 1, characterized in that, Adopt the sample mean square error observation algorithm to observe the ability to remove the baseline drift problem, and the formula is In the formula, m is the total number of acquisition points of the electromyogram acquisition data, x i is the i-th sampled electromyogram signal value, is the average value of the electromyogram signal samples.