Complex periodic signal starting and ending point detection and signal extraction method

Through the threshold and gradient-based signal detection method, the accuracy and completeness of the start and end point detection of complex periodic signals is solved, and efficient signal extraction and data conversion are realized, which is suitable for signal analysis in multiple fields.

CN120277522APending Publication Date: 2025-07-08NAT INNOVATION INST OF DEFENSE TECH PLA ACAD OF MILITARY SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510302645.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-14
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

The prior art has problems such as insufficient accuracy, high computational complexity, noise sensitivity and incomplete data processing in the detection and extraction of complex periodic signals.

Method used

The signal detection method based on threshold + gradient is adopted, and the accurate detection and signal extraction of complex period signals is achieved by defining data extraction, clearing arrays, gradient calculation and flag bit initialization, combined with zero crossing detection and noise exclusion.

Benefits of technology

It improves the detection accuracy and efficiency of complex periodic signals, ensures the complete storage of effective data, reduces noise interference, and adapts to the conversion of signal lengths of different periodic periodics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120277522A_ABST
    Figure CN120277522A_ABST
Patent Text Reader

Abstract

The invention discloses a starting and ending point detection and signal extraction method for a complex periodic signal, which comprises the following steps: S1, reading necessary data needing to be subjected to signal detection and extraction from an Excel table by using a defined data extraction function, and converting the necessary data into an array form; s2, defining an array data clearing function, a gradient calculation function and an integer function; s3, initializing a flag bit; s4, defining a periodic signal cutting function; carrying out main circulation, traversing array data obtained from the data table, carrying out judgment on a rising edge and a falling edge, carrying out noise false detection and storing periodic signal data; s5, effective signal data detected in the complex periodic signals are extracted and sent to an output array, and the array form of the output array is a three-dimensional array. According to the invention, accurate detection and signal extraction are carried out on complex periodic signals by using a signal detection method based on threshold and gradient, so that the detection accuracy and efficiency of the periodic signals and the storage of effective data are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of signal processing, and can be applied in the fields of digital signal processing technology, pattern recognition and machine learning technology, etc., and particularly relates to a method for detecting the start and end points of a complex periodic signal and signal extraction. Background Art

[0002] In the field of modern signal processing, the detection and extraction of complex periodic signals widely exist in multiple fields such as communication, control, and medical treatment. For example, in electrocardiogram (ECG) signals, accurately identifying the start and end points of the heartbeat cycle is crucial for disease diagnosis. In addition, in the fields of audio processing, mechanical vibration monitoring, etc., the accurate extraction and analysis of signals are also extremely important.

[0003] A complex periodic signal is a periodic signal with multiple frequency components and non-linear characteristics, which makes the traditional signal processing methods (such as simple threshold detection) have limitations in the detection of the start and end points of the signal. Therefore, developing new algorithms that can effectively process complex signals and accurately extract the start and end points is of great significance for improving the accuracy and reliability of signal analysis.

[0004] Currently, there are various existing technical solutions for the detection and extraction of the start and end points of periodic signals, and these solutions mainly include: (1) detecting periodic signals based on thresholds, (2) detection based on thresholds + fixed windows, (3) frequency domain analysis: such as Fourier transform, (4) time domain analysis: such as Hilbert-Huang transform or wavelet transform, etc.

[0005] Among them, frequency domain analysis can convert the signal from the time domain to the frequency domain through Fourier transform, identify the frequency components of the signal, then remove the non-periodic components through a filter, and finally convert the signal back to the time domain through inverse Fourier transform. However, Fourier transform has poor performance in dealing with non-stationary signals because it assumes that the signal is stationary throughout the time range. For complex periodic signals, this assumption often does not hold, resulting in difficulty in accurately identifying the start and end points of the signal by frequency domain analysis.

[0006] Signal envelope detection in time domain analysis identifies the start and end points of the signal by detecting the envelope of the signal, and the envelope can be obtained through methods such as Hilbert transform. However, algorithms such as Hilbert-Huang transform and wavelet transform have high computational complexity, large computational amount, are sensitive to noise, and are prone to misjudgment when dealing with complex signals.

[0007] Deep learning can achieve the detection and judgment of the start and end points of periodic signals, but it requires a large amount of labeled data. If the training data is insufficient, the model may overfit the training data, resulting in poor generalization ability on unseen data, consuming a lot of computing resources, and being relatively complex for hyperparameter tuning. In a high-noise environment, the model performance significantly decreases.

[0008] However, for the detection and extraction of periodic signals based on a threshold, it is required that there is no signal tending to 0 in the detected periodic signals. Otherwise, during the detection process, it will be recognized as the end signal of the periodic signal, and the amplitudes of the signals other than the periodic signals basically tend to zero in order to be unaffected by noise and other interference factors. Since the lengths of the periodic signals in the collected signals are different, the detection based on the threshold + fixed window is likely to cause missing extracted signals and the phenomenon of "tail dragging" due to different periodic lengths, resulting in the situation of saving invalid data.

[0009] When extracting signals in the prior art, the extracted signals may be distorted, incomplete or over-smoothed. The present invention mainly solves the problem of accurate start and end point detection of complex periodic signals. Summary of the Invention

[0010] Aiming at the problems existing in the prior art, the purpose of the present invention is to provide a method for detecting the start and end points and extracting signals of complex periodic signals, mainly using a signal detection method based on a threshold + gradient to accurately detect and extract complex periodic signals, greatly improving the detection accuracy, efficiency of periodic signals and the preservation of valid data.

[0011] To achieve the above object, the present invention provides a method for detecting the start and end points and extracting signals of complex periodic signals, and the method includes the following steps:

[0012] S1. Use the defined data extraction function to read the necessary data for signal detection and extraction from the Excel table, and save the data into an array;

[0013] S2. Define a function for clearing array data, a gradient calculation function and a rounding function. When the data collected during the detection and signal extraction of complex periodic signals is multiple periodic signals, after saving the detected signals of the previous period and saving the data, perform a data clearing operation;

[0014] S3. Initialize the flag bits; the flag bits include the first peak flag bit, the rising allow flag bit, the falling start flag bit, the rising edge counter, the second rising label flag bit, the second falling label flag bit, the error occurrence flag bit, the rising edge gradient flag bit, the falling edge gradient flag bit, the save data flag bit, and the send data flag bit. Among them, the number of rises is set to 0, and except that the rising allow flag bit is set to True, the rest of the flag bits are set to False;

[0015] S4. Define a periodic signal cutting function; perform a main loop, traverse the array data obtained from the data table, and judge the rising edge and falling edge, misdetection of noise and save the periodic signal data;

[0016] S5. After the transmission data flag bit is triggered, the valid signal data detected in the complex periodic signal is extracted and sent to the output array, and the array form of the output array is a three-dimensional array.

[0017] Further, in step S2, it is obtained by calculating the difference between adjacent data collected by the data glove. The data acquisition device is a data glove, and the sampling interval time Δt of the data glove is approximately 0. At this time, the gradient is equivalent to the slope, and the calculation formula is as follows:

[0018]

[0019] where k represents the slope, inp is the value of the latter data collected by the data glove, inp1 is the value of the former data collected by it, and Δt represents the sampling interval time.

[0020] Further, step S4 is specifically implemented as follows:

[0021] S4.1 First, calculate the sum of the squares of the 3-axis angular velocities of the five fingers and the back of the hand of the instruction issuer, save it to the array for later use, and keep the length of each array not greater than N1;

[0022] S4.2 Perform zero-crossing detection; calculate the average value of the sum of the squares of the 3-axis angular velocities of the 5 fingers in each loop in S4.1, and save the value calculated in each loop to the zero-crossing detection array; when the length of the zero-crossing detection array is greater than N2, at this time, delete the first element of the array to complete the operation of updating the array. When its value is less than N3, reset the flag bit. After the zero-crossing detection judgment, take N4 points backward. N4 represents the fixed array length data taken backward during zero-crossing detection; if the average value of all elements in the zero-crossing detection array is less than the set fixed threshold Q1, it does not conform to the trend that the signal value will continue to rise after the rising edge, so it is determined as the second peak, and the saving of this group of data is abandoned, and the operation of clearing the array elements is performed;

[0023] S4.3 Calculate the average value of all elements in the array in S4.1 as the data support for gradient calculation, call the gradient calculation function defined in S2, and perform gradient calculation; when performing each loop, update the data in the array in S4.1 and the data in the gradient array;

[0024] S4.4 Perform gradient calculation and judgment on the rising edge and falling edge, and set the relevant flag bits after meeting the gradient conditions. At this time, the flag bits of the rising edge gradient and the falling edge gradient are in a locked state;

[0025] S4.5 Determine the rising edge: If the relevant flag bits are satisfied and the sum of the squares of the angular velocities of the three axes of any one of the five fingers and the back of the hand meets the threshold requirement, the rising edge flag bit can be triggered, and the rising edge counter is incremented by 1; when the number of rising edges is odd, the first peak flag bit is activated at this time;

[0026] When the first peak flag bit is activated in S4.6, the condition for the falling edge is determined simultaneously: when the second rising edge flag bit is triggered, the corresponding flag bit will be triggered and prepared for the second falling edge;

[0027] S4.7 Determine the two rising edges of a single-cycle signal. When the rising edge meets the conditions of being greater than 1 and even, the relevant flag bits will be triggered, the data will be saved, and the data will be sent immediately, ending the detection and data extraction work of this cycle signal;

[0028] S4.8 Then detect and eliminate noise: when the trigger condition of the rising edge is met, the sum of the squares of the angular velocities of the five fingers is saved for the last N5 groups of data respectively; if the maximum value of the sum of the squares of the angular velocities of the three axes of the five fingers in the array in S4.1 is less than a certain set value Q4, it is determined that it is affected by noise or other interference, and the relevant flag bits are reset, the rising edge counter is decremented by 1, and the rising edge is judged again.

[0029] Furthermore, in step S4.1, the calculation formula for the sum of the squares of the three-axis angular velocities is as follows:

[0030] Velocity_squared_n = wx_n 2 +wy_n 2 +wz_n 2 , where n = 1, 2,..., 6,

[0031] where, Velocity_squared_n represents the sum of the squares of the three-axis angular velocities of each finger and the back of the hand, and wx_n, wy_n, wz_n represent the magnitudes of the angular velocities of the x, y, and z axes of the thumb, index finger, middle finger, ring finger, little finger, and the back of the hand respectively.

[0032] Furthermore, in step S4.2, the zero-crossing detection judges the average value of all elements in the zero-crossing detection array

[0033]

[0034] where zerode_array represents the average value of all elements in the zero-crossing detection array, represents the sum of all elements in the zero-crossing detection array, and N4 represents the array length of the elements already stored in the zero-crossing detection array.

[0035] Further, in step S4.4, when one of the states occurs, the change of the other state flag is prohibited, and the flag states are set as follows:

[0036]

[0037] Among them, k1 represents the set value when the gradient satisfies the rising edge condition, k2 represents the set value when the gradient satisfies the falling edge condition, and k represents the gradient calculated in S4.3

[0038] up_gradient_label and down_gradient_label respectively represent the setting states of the rising edge gradient and the falling edge gradient flags.

[0039] Further, in step S4.5, the issuance of the gesture instruction includes the issuance and retraction actions of the gesture, so that two peaks are included in one cycle. Therefore, the parity of the rising edge is judged. When it is odd, it is determined as the first rising edge at this time, and the relevant flag bits are updated; when it is even, it is determined as the second rising edge at this time, and the relevant flag bits are also updated.

[0040] Further, in step S5, when the send data flag is triggered, the valid signal data detected in the complex periodic signal will be extracted and sent to the output array, and the array form of the output array is a three-dimensional array.

[0041] Further, when the size of the data array of the periodic signal before conversion is greater than the set fixed array length, it means that the amount of data stored in the original periodic signal is sufficient to provide for the elements of the converted array, and there is no need to perform interpolation operations to add new data.

[0042] Further, when the size of the data array of the periodic signal before conversion is less than the set fixed array length, it means that the amount of data stored in the original periodic signal is not enough to provide for the converted array. At this time, new data needs to be added to complete the upsampling operation of data resampling.

[0043] The beneficial effects of the present invention are as follows:

[0044] The present invention mainly uses a signal detection method based on threshold + gradient to accurately detect and extract complex periodic signals, greatly improving the detection accuracy, efficiency of periodic signals and the preservation of effective data. During the processing of complex periodic signals, accurately detecting the starting point and ending point of the signal is crucial for signal analysis, feature extraction, and subsequent data processing. The present invention mainly selects state control flag bits and thresholds to accurately identify the starting and ending points of periodic signals, eliminate the influence of noise and other interference factors, and convert the original data saved by different periodic signals into data arrays with the same array length, facilitating the subsequent development of related work. In the detection of different processes of periodic signals, the principle of interlock is adopted to avoid the execution of the same state control flag bit in different detection states, achieving accurate detection of the starting and ending points of complex periodic signals and providing reliable data support for the follow-up. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 FIG. is a flowchart for implementing the method for detecting the starting and ending points of a complex periodic signal and extracting the signal according to the present invention;

[0046] Figure 2 FIG. is a flowchart for performing smoothing operations on data before and after converting periodic signals according to the present invention

[0047] Figure 3 FIG. is a schematic diagram of two periodic signals extracted according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0048] The technical solutions of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, 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 scope of protection of the present invention.

[0049] In the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance.

[0050] In the description of the present invention, it should be noted that unless otherwise clearly specified and defined, the terms "installation", "connection", and "coupling" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the communication inside two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0051] The following will combine Figures 1 - 3 to detail the specific implementation manners of the present invention. It should be understood that the specific implementation manners described herein are only for explaining and illustrating the present invention, and are not used to limit the present invention.

[0052] The inventive concept of this application lies in adopting a method based on threshold + gradient for the detection and signal extraction of complex periodic signals. The following will take the detection and signal extraction of signals from the data obtained from a data glove as an example for demonstration. Since using a data glove to issue relevant gesture commands involves the emission and retraction of gesture actions, there should be two peaks in one period to be extracted, and a complete period is the process from the start of the first rising edge to the end of the second falling edge. The implementation flowchart of the present invention is as Figure 1 shown. The following will introduce in detail the implementation steps of the method for detecting the start and end points and signal extraction of complex periodic signals according to the present invention:

[0053] S1. Use the defined data extraction function to read the necessary data for signal detection and extraction from the Excel sheet, such as the angular velocity information obtained by the gyroscopes in multiple IMUs in the data glove, the acceleration information obtained by the accelerometers, etc., and save the data to an array for subsequent data processing and storage.

[0054] Among them, the defined data extraction function extracts the multi-IMU measurement data obtained by column through the read_excel() method in the pandas library, and saves each column of data to each array. The necessary data refers to the angular velocity data obtained by the gyroscopes in the IMU inertial measurement elements in the data glove, excluding secondary angle information such as acceleration and related pitch angles and roll angles.

[0055] S2. Define the array clearing function. Since complex periodic signals need to be detected and signal extraction is required, and the collected data is multiple periodic signals. After saving the detected signals and data of the previous period, when dealing with the subsequent detected periodic signals, the process data needs to be saved to an array. Re-creating an array is very cumbersome and consumes storage space. At this time, the relevant array data can be cleared after the previous period signal is saved. Among them, the defined array clearing function uses the clear() function to clear the zero-crossing detection array, data temporary storage array, various data arrays of periodic signals, etc., to facilitate subsequent data processing and storage.

[0056] Define the gradient calculation function, which is mainly obtained by calculating the difference between adjacent data collected by the data glove. Since the sampling period of the data glove used this time is 20 ms, it can be considered that the sampling interval time Δt≈0. At this time, the gradient is equivalent to the slope, as shown in Formula 1:

[0057]

[0058] Among them, k represents the slope (gradient), inp is the value of the latter data collected by the data glove, and inp1 is the value of the previous data collected by it.

[0059] Define the rounding function. To facilitate the processing of some process data, round the data.

[0060] S3. Initialize the flag bits. The flag bits set in the example of the data glove include the first peak flag bit, rising edge permission flag bit, falling edge start flag bit, rising edge counter, second rising label flag bit, second falling label flag bit, error occurrence flag bit, rising edge gradient flag bit, falling edge gradient flag bit, save data flag bit, send data flag bit. Among them, the number of rises is set to 0, and except for the rising edge permission flag bit set to True, the rest of the flag bits are set to False. Setting the flag bit control status is to make the corresponding execution operations proceed in an orderly manner, avoid interference from factors such as misjudgment, and cooperate with the corresponding threshold settings for rising edge and falling edge detection and data saving operations.

[0061] S4. Define the periodic signal cutting function. Enter the main loop, traverse the array data obtained from the data table, and perform rising edge and falling edge judgment, noise misdetection, and save periodic signal data, etc.

[0062] Specifically, step S4 is implemented as follows:

[0063] S4.1 First, calculate the sum of the squares of the 3-axis angular velocities of the five fingers and the back of the hand of the instruction issuer, as shown in Formula 2. Save it in an array for later use, and ensure that the length of each array is no greater than N1. When it is greater than N1, delete the first element to maintain the updated data status;

[0064] Velocity_squared_n = wx_n 2 +wy_n 2 +wz_n 2 , where n = 1, 2,..., 6.

[0065] (Formula 2)

[0066] Among them, Velocity_squared_n represents the sum of the squares of the 3-axis angular velocities of each finger and the back of the hand, and wx_n, wy_n, wz_n (n = 1, 2,..., 6) respectively represent the magnitudes of the x, y, and z-axis angular velocities of the thumb, index finger, middle finger, ring finger, little finger, and the back of the hand.

[0067] Calculate the average value of the sum of the squares of the 3-axis angular velocities of the 5 fingers, that is:

[0068]

[0069] Among them, angular_velocity_mean represents the average value of the sum of the squares of the 3-axis angular velocities of the 5 fingers, Velocity_squared[n] represents the magnitude of each element stored in the S4.1 array, N1 represents the array length, and the value of N1 can be appropriately adjusted according to the length of the periodic signal, and it has the effect of data smoothing.

[0070] S4.2 Perform zero-crossing detection: When the length of the zero-crossing detection array is greater than N2, at this time, delete the first element of the array to complete the operation of updating the array, where the value of N2 is set according to the application field and the length of the periodic signal. Zero-crossing detection has relevant data processing operations during the normal execution of the detection and discrimination process. Only when the algorithm has a false detection, zero-crossing detection will ensure that misaligned data storage will not occur.

[0071] When the average value of all elements in the zero-crossing detection array is less than the set fixed threshold Q1, reset the flag bit. The value of Q1 is selected through empirical judgment or adaptive adjustment. The purpose of this is that if the first peak of the periodic signal is not detected and the second peak is used as the first peak for data storage, then subsequent detection of the periodic signal will result in misalignment, causing subsequent data processing to be invalid.

[0072] When the algorithm determines that the second peak of the previous cycle signal is the first peak of the next cycle, after zero-crossing detection, take N3 points backward. N3 represents the length of the fixed array taken backward during zero-crossing detection. The value of N3 needs to be adjusted according to the different usage scenarios of the algorithm and the fluctuation characteristics of the signal. In the data glove, the setting of N3 is mainly related to the average interval duration approaching 0 between adjacent peaks of a single cycle signal to be extracted and the sampling period of the data glove. Since the issuance of gesture commands is generally a continuous action, assume that the average interval duration approaching 0 between adjacent peaks within a single cycle signal is T1. When the sampling period is fixed, the maximum interval duration between adjacent cycle signals is T, and the sampling period is t s , at this time, N3 should satisfy the following conditions:

[0073]

[0074] This can ensure that the second peak in a single cycle will not be misjudged as the first peak, and it can also ensure that the first peak of the next cycle signal will not be saved as the second peak of the previous cycle signal, thus causing dislocation.

[0075] Among them, the zero-crossing detection judges the average value of all elements in the zero-crossing detection array. The zero-crossing detection array stores the average value of the sum of the squares of the angular velocities of 3 axes of 5 fingers obtained in each loop, that is, the value calculated in formula 3.

[0076]

[0077] Among them, zerode_array represents the average value of all elements in the zero-crossing detection array, represents the sum of all elements in the zero-crossing detection array, and N4 represents the length of the array of elements already stored in the zero-crossing detection array.

[0078] If the average value of all elements in the zero-crossing detection array is still less than the set fixed threshold Q1, it does not conform to the trend that the signal value will continue to rise after the rising edge. Therefore, it is determined as the second peak, and the preservation of this group of data is abandoned, and the relevant flag bits are reset, and the operation of clearing the array elements is performed.

[0079] S4.3 Calculate the average value of all elements (including the data of the back of the hand) in the S4.1 array as the data support for gradient calculation, call the gradient calculation function defined in S2, and perform gradient calculation. Each time a loop is performed, update the data in the S4.1 array and the data in the gradient array.

[0080] S4.4 calculates and judges the gradients of the rising edge and the falling edge, and sets the relevant flag bits after meeting the gradient conditions. When judging the rising-edge gradient and the falling-edge gradient, as long as the gradient of any one of the five fingers and the back of the hand meets the set threshold conditions, the relevant flag bit setting can be triggered at this time. The gradient settings of the rising edge and the falling edge usually need to be dynamically selected according to the fluctuation law and magnitude of the periodic signal. At this time, the rising-edge gradient flag bit and the falling-edge gradient flag bit are in a mutually locked state, that is, when one state occurs, the change of the other state flag bit is prohibited. The flag bit states are set as follows.

[0081]

[0082] Among them, k1 represents the set value when the gradient meets the rising-edge condition, k2 represents the set value when the gradient meets the falling-edge condition, and k represents the gradient calculated in S4.3;

[0083] up_gradient_label and down_gradient_label respectively represent the setting states of the rising-edge gradient and the falling-edge gradient flag bits.

[0084] S4.5 makes a judgment on the rising edge: when the relevant flag bits are met and the sum of the squares of the three-axis angular velocities of any one of the five fingers and the back of the hand meets the threshold requirement, the rising-edge flag bit can be triggered, and the rising-edge counter is incremented by 1. Since the issuance of a gesture command includes the actions of issuing and retracting a gesture, that is, there are two peaks in one cycle, it is necessary to judge the parity of the rising edge. When it is odd, it is determined as the first rising edge at this time, and the relevant flag bits are updated; when it is even, it is determined as the second rising edge at this time, and the relevant flag bits are also updated. When the number of rising edges is odd, the first peak flag bit is activated at this time.

[0085] When the first peak flag bit is activated, the condition for the falling edge is judged simultaneously: the relevant flag bits are met and at the same time the sum of the squares of the three-axis angular velocities of the five fingers and the back of the hand are all less than the set falling-edge threshold. When the second rising-edge flag bit is triggered, the corresponding flag bit will be triggered and prepared for the second falling edge. At this time, the falling-edge gradient flag bit and the falling-edge judgment are performed again. When the relevant requirements for the falling edge are met, the update of the relevant flag bits for the falling edge will be triggered, and then the judgment of the rising edge will start immediately.

[0086] When the first peak flag bit is activated, the array for storing data in the previous cycle will be cleared to facilitate the storage of data in the current cycle, and the data storage flag bit will be triggered. The cyclic data will be sequentially stored in the array that has been cleared before the start of the cycle until the end of a single-cycle signal, preparing for subsequent data transmission and data resampling.

[0087] S4.7 Since the instruction signal described in this example contains two peaks, the rising edges of the single-cycle signal will be judged twice. When the rising edge meets the conditions of being greater than 1 and being an even number, the relevant flag bits will be triggered, the data will be saved, the data will be sent immediately, and the detection and data extraction of this cycle signal will be ended. The detected cycle signal of this cycle will be resampled. That is, when there is less data, interpolation will be used to add data. When there is more data, the relevant data volume will be reduced to keep the length of the output array consistent.

[0088] S4.8 Then the detection and elimination of noise will be carried out: when the triggering condition of the rising edge is met, the sum of the squares of the 5-finger angular velocities of the subsequent N5 groups of data will be saved respectively. The value of N5 is adjusted appropriately according to the field where this algorithm is used (the time interval between single peaks within a single-cycle signal) and the sampling period, mainly determined by the interval duration from the start of the rising edge to the end of the falling edge between single peaks within a single-cycle signal. Suppose the start time of the rising edge of a single peak is T2, and the end time of the falling edge of the same peak is T3, then N5 should satisfy the following inequality:

[0089]

[0090] Among them, the constant value is generally selected as 5 - 10, and ts is the sampling period.

[0091] Since the value within a certain period of time after the rising edge in a single cycle detected under normal conditions will be greater than a certain value Q3, the value of Q3 should be adaptively adjusted according to the gesture transformation form, palm difference, action standard degree, etc. of the instruction issuer or data collector. If the maximum value of the sum of the squares of the 3-axis angular velocities of the 5 fingers in the array in S4.1 is less than a certain set value Q4, the value of Q4 is appropriately selected or obtained through adaptive recognition according to the signal peak value of the gesture instruction issuer. At this time, it is determined that it is affected by noise or other interferences, and the relevant flag bits will be reset and the rising edge counter will be decremented by 1, and the rising edge will be judged again.

[0092] S5. When the send data flag bit is triggered, the valid signal data detected in the complex cycle signal will be extracted and sent to the output array. The array form of the output array is a three-dimensional array. The cycle signal of the gesture paradigm made by the data glove collected by a single person once will be effectively recognized and extracted. Among them, the output three-dimensional array is a data structure. Suppose the output array is person_array, and its dimension is (L, M, N), where L is the number of layers, indicating L valid cycle signals extracted from the data collected by a single person once; M is the number of rows in each layer, indicating the data types collected, such as 3-axis acceleration, angular velocity, etc.; N is the number of columns in each layer, indicating the number of elements obtained by converting each cycle signal into a fixed array length later (the fixed-length array is obtained by subsequent data resampling).

[0093] In order to directly use the signal data with different cycle lengths extracted in this stage for the training of relevant models in the follow-up, the data array collected by the original data glove saved will be converted into an array with a fixed length. The flowchart of the resampling operation for the data before and after the periodic signal conversion is as Figure 2 shown.

[0094] Assume that the length of the converted periodic signal data array is N, and the sizes of the original periodic signal data arrays with different sizes extracted by detection are M. At this time, the conversion is performed through Formula 7:

[0095]

[0096] where q represents the ratio of the length of the original data array to the length of the converted data array.

[0097] When the size of the data array of the periodic signal before conversion is greater than the set fixed array length, that is, q≥1. It means that the amount of data saved in the original periodic signal is sufficient to provide for the elements of the converted array to be saved, and there is no need to perform interpolation operations to add new data. Let the value of the i-th point after conversion be g(i), and the value of the element corresponding to the original periodic signal array be f(j). Denote d = q*i to represent the position corresponding to the i-th index of the converted periodic signal, and int(d) = z to represent the integer part of k*i. Then there is:

[0098]

[0099] When the size of the data array of the periodic signal before conversion is less than the set fixed array length, it means that the amount of data saved in the original periodic signal is not enough to provide for the converted array. At this time, new data needs to be added to complete the upsampling operation of data resampling, which can also reduce the appearance of noise points. The data interpolation is performed using the principle of simple Lagrange interpolation method. That is, when 0<q<1, the weights of d relative to the two integer parts adjacent to the index are respectively:

[0100]

[0101] where x1 and x2 are two adjacent integers of d, and x2 = x1 + 1.

[0102] Then the value of the interpolation at d is:

[0103] g(d) = w1*f(x1) + w2*f(x2)

[0104] Let the length of the array of the original periodic signal be j, then the calculation conversion formula is as follows:

[0105]

[0106] In this way, an array of periodic signals with different lengths can be converted into an array with a fixed length.

[0107] Through the above steps S1 - S5, the detection of the start and end points of complex periodic signals and signal extraction can be completed.

[0108] Figure 3 Part of the detection and extraction of periodic signals is shown in the form of an image. For example Figure 3 As shown, the range sandwiched between the two dashed lines on the left and the two dashed lines on the right in the figure is the detected periodic signal. For each intercepted part, the previous line is the position where the first rising edge is recognized, which is the start point of the complex periodic signal, and the latter line is the position where the second falling edge is recognized, which is the end point of the complex periodic signal.

[0109] The conversion of the array length is due to Figure 3 the different signal lengths intercepted by the two segments of periodic signals in []. To convert them into arrays of the same length, it is similar to performing a "slicing" operation on the periodic signal. When the data collected in the periodic signal is sufficient to meet the requirements of the number of "slices", the numerical values of the original periodic signal are used to fill the elements of the array with the same length. When the data collected in the periodic signal is insufficient to meet the requirements of the number of "slices", interpolation is required to supplement the data.

[0110] The present invention can be applied in all fields where complex periodic signal detection and extraction are carried out, such as the detection and extraction of radar and sonar echo signals in the communication field; in the field of biomedical engineering: electrocardiogram analysis, electroencephalogram analysis, respiratory signal monitoring; in the field of geoscience: seismic signal processing, meteorological monitoring; in the field of astronomy: celestial signal detection; in the field of control engineering: detecting and analyzing the periodic response in the system to optimize the control strategy.

[0111] Any process or method description in the flowchart of the present invention or described in other ways herein can be understood as representing a module, segment, or part of code including one or more executable instructions for implementing a specific logical function or process, which can be implemented in any computer scale medium for an instruction execution system, apparatus, or device. The computer-readable medium can be any medium that contains, communicates, propagates, or transports a program for use by an instruction execution system, apparatus, or device. Including read-only memory, magnetic disks, or optical discs, etc.

[0112] In the description of this specification, the descriptions referring to terms such as "embodiment", "example", etc. mean that the specific features, structures, materials or characteristics described in connection with that embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. In addition, those skilled in the art can combine or combine different embodiments or examples described in this specification and the features therein without contradiction.

[0113] Although the above has shown and described embodiments of the present invention, it can be understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those of ordinary skill in the art can perform update operations such as changes, modifications, substitutions, and variations on the above embodiments within the scope of the present invention.

Claims

1. A method for detecting the start and end points of a complex periodic signal and extracting the signal, characterized in that, The method includes the following steps: S1. Use a defined data extraction function to read the necessary data for signal detection and extraction from an Excel table, and save the data into an array; S2. Define a function to clear array data, a gradient calculation function, and a rounding function. When detecting and extracting signals from complex periodic signals, the collected data is multiple periodic signals. After saving the detected signals and data of the previous period, perform a data clearing operation; S3. Initialize the flag bits; the flag bits include the first peak flag bit, the rising edge allow flag bit, the falling edge start flag bit, the rising edge counter, the second rising label flag bit, the second falling label flag bit, the error occurrence flag bit, the rising edge gradient flag bit, the falling edge gradient flag bit, the save data flag bit, and the send data flag bit. Among them, the number of rises is set to 0, and except for the rising edge allow flag bit which is set to True, the rest of the flag bits are set to False; S4. Define a periodic signal cutting function; perform a main loop to traverse the array data obtained from the data table, and perform judgments on rising edges and falling edges, noise misdetection, and save periodic signal data; S5. When the send data flag bit is triggered, extract the valid signal data detected in the complex periodic signal and send it to the output array. The array form of the output array is a three-dimensional array.

2. The method for detecting the start and end points of a complex periodic signal and extracting the signal according to claim 1, wherein In step S2, it is obtained by calculating the difference between adjacent data collected by the data glove. The data acquisition device is a data glove, and the sampling interval time Δt of the data glove is approximately 0. At this time, the gradient is equivalent to the slope, and the calculation formula is as follows: where k represents the slope, inp is the value of the latter data collected by the data glove, inp1 is the value of the previous data collected by it, and Δt represents the sampling interval time.

3. The method for detecting the start and end points and extracting the signal of the complex periodic signal according to claim 2, wherein The specific implementation of step S4 is as follows: S4.1 First, calculate the sum of the squares of the 3-axis angular velocities of the five fingers and the back of the hand of the instruction issuer, save it into an array for later use, and ensure that the length of each array is not greater than N1; S4.2 Perform zero-crossing detection; calculate the average value of the sum of the squares of the 3-axis angular velocities of the 5 fingers in each loop of S4.1, and save the value calculated in each loop into the zero-crossing detection array; When the length of the zero-crossing detection array is greater than N2, at this time, delete the first element of the array to complete the operation of updating the array. When its value is less than N3, reset the flag bits. After passing the zero-crossing detection judgment, take N4 points backward. N4 represents the fixed array length data taken backward when performing zero-crossing detection; if the average value of all elements in the zero-crossing detection array is less than the set fixed threshold Q1, it does not conform to the trend that the signal value size will continue to rise after the rising edge, so it is determined as the second peak, and the saving of this group of data is abandoned, and the array elements are cleared; S4.3 Calculate the average value of all elements in the array of S4.1 as the data support for gradient calculation, call the gradient calculation function defined in S2, and perform gradient calculation; when performing each loop, update the data in the array of S4.1 and the data in the gradient array; S4.4 calculates and judges the gradients of the rising edge and the falling edge, and sets the relevant flag bits after meeting the gradient conditions. At this time, the flag bits of the rising edge gradient and the falling edge gradient are in a locked state; S4.5 judges the rising edge: when the relevant flag bits are met and the sum of the squares of the angular velocities of the three axes of one of the five fingers and the back of the hand meets the threshold requirement, the rising edge flag bit is triggered, and the rising edge counter is incremented by 1; when the number of rising edges is odd, the first peak flag bit is activated at this time; When the first peak flag bit is activated in S4.6, the condition of the falling edge is judged at the same time: when the second rising edge flag bit is triggered, the corresponding flag bit will be triggered and prepared for the second falling edge; S4.7 judges the two rising edges of a single-cycle signal. When the rising edge meets the conditions of being greater than 1 and even, the relevant flag bits will be triggered, the data will be saved, and the data will be sent immediately, ending the detection and data extraction of this cycle signal; S4.8 then detects and eliminates noise: when the trigger condition of the rising edge is met, the sum of the squares of the angular velocities of the five fingers of the last N5 groups of data is saved respectively; if the maximum value of the sum of the squares of the angular velocities of the three axes of the five fingers in the array in S4.1 is less than a set value Q4, it is determined that it is affected by noise or other interference, and the relevant flag bits are reset and the rising edge counter is decremented by 1, and the rising edge is judged again.

4. The method for detecting the start and end points of a complex periodic signal and extracting the signal according to claim 3, wherein In step S4.1, the calculation formula for the sum of the squares of the three-axis angular velocities is as follows: Velocity_squared_n = wx_n 2 + wy_n 2 + wz_n 2 , where n = 1, 2, …, 6 Among them, Velocity_squared_n represents the sum of the squares of the angular velocities of the three axes of each finger and the back of the hand, and wx_n, wy_n, and wz_n respectively represent the angular velocity magnitudes of the x, y, and z axes of the thumb, index finger, middle finger, ring finger, little finger, and the back of the hand.

5. The method for detecting the start and end points of a complex periodic signal and extracting the signal according to claim 4, characterized in that, In step S4.2, the zero-crossing detection judges the average value of all elements in the zero-crossing detection array where zerode_array represents the average value of all elements in the zero-crossing detection array, represents the sum of all elements in the zero-crossing detection array, and N4 represents the array length of the elements already stored in the zero-crossing detection array.

6. The method for detecting the start and end points of a complex periodic signal and extracting the signal according to claim 5, characterized in that In step S4.4, when one of the states occurs, the change of the flag bit of the other state is prohibited. The flag bit states are set as follows: Among them, k1 represents the set value when the gradient meets the rising edge condition, k2 represents the set value when the gradient meets the falling edge condition, and k represents the gradient calculated in S4.3; up_gradient_label and down_gradient_label respectively represent the setting states of the rising edge gradient and the falling edge gradient flag bits.

7. The method for detecting the start and end points of a complex periodic signal and extracting the signal according to claim 6, wherein In step S4.5, the issuance of the gesture command includes the actions of issuing and retracting the gesture, so that two peaks are included in one cycle. Therefore, the parity of the rising edge is judged. When it is odd, it is judged as the first rising edge at this time, and the relevant flag bits are updated; when it is even, it is judged as the second rising edge at this time, and the relevant flag bits are also updated.

8. The method for detecting the start and end points and extracting the signal of the complex periodic signal according to any one of claims 1-7, characterized in that In step S5, after the send data flag bit is triggered, the valid signal data detected in the complex cycle signal will be extracted and sent to the output array. The array form of the output array is a three-dimensional array.

9. The method for detecting the start and end points of a complex periodic signal and extracting the signal according to claim 8, wherein, When the size of the data array of the periodic signal before conversion is greater than the set fixed array length, it means that the amount of data saved in the original periodic signal is sufficient to be provided for the converted array elements to be saved, and there is no need to perform interpolation operations to add new data.

10. The method for detecting the start and end points of a complex periodic signal and extracting the signal according to claim 8, wherein When the size of the data array of the periodic signal before conversion is less than the set fixed array length, it means that the amount of data saved in the original periodic signal is not enough to be provided for the converted array. In this case, new data needs to be added to complete the upsampling operation of data resampling.