Background
With the rapid development of mobile devices and internet technologies, motion detection based on intelligent devices has gradually become a research hotspot in the fields of location services, artificial intelligence and the like. The method for realizing motion state estimation at the present stage mainly adopts a multi-sensing fusion technology and a computer vision technology. The multi-sensor fusion technology collects signals of the advancing state of a user through an accelerometer, a gyroscope, a magnetometer and the like, and judges the state and gait parameters of a pedestrian according to the signals and the change characteristics of the signals; the computer vision carries out model training through the labeled data of each gait, and the uncalibrated data is substituted into the model to calculate the gait parameters of the user. Both methods are machine learning based modeling methods, both of which require a large amount of training data; meanwhile, the technology of gait recognition by using computer vision is established on video hardware equipment, so that the motion scene of a user has great limitation.
Accordingly, further developments and improvements are still needed in the art.
Disclosure of Invention
In order to solve the above problems, a method for measuring a running gait by using a three-axis accelerometer is proposed. The invention provides the following technical scheme:
a method of measuring a running gait with a tri-axial accelerometer, comprising:
s100, carrying out short time domain spectrum analysis on the acquired real-time acceleration data to obtain a frequency band with the strongest energy entropy;
s200, constructing a filter based on the frequency band with the strongest energy entropy, and denoising acceleration data;
s300, solving peak point data based on the denoised acceleration data;
and S400, calculating running gait based on the acceleration data and the peak point data.
Further, the short time domain spectrum analysis includes: after the real-time acceleration data are obtained, Fourier transform is carried out on the acceleration data in the running state, frequency domain analysis is achieved, and based on the frequency band with the strongest energy entropy, the selection of a filter, the passband cut-off frequency and the stopband cut-off frequency are determined.
Further, the process of denoising the acceleration data by the filter includes:
s210, constructing a filter to solve two coefficient vectors, a ═ a (1), a (2) …, a (n) and b ═ b (1), b (2), …, b (n);
s220, performing filtering processing on the acceleration data:
wherein a (i) represents the ith element of the a vector, b (i) represents the ith element of the b vector, x (i) is the original acceleration of the ith epoch of the input, and y (i) is the output corresponding to x (i).
Further, the process of solving peak point data includes:
s310, determining the length d of the sliding window based on the output frequency fre _ acc and the running step frequency fre _ step of the accelerometer:
s320, detecting and solving the maximum value of the ith acceleration value in the neighborhood region:
Acc_v(i)≥{Acc_v(k)|i-5<k<i+15} (3);
if not, detecting the next window, otherwise, judging the next step:
Acc_v(i)≥Accthr (4)
wherein AccthrA threshold value that is a peak minimum;
if the window meets the requirement (4), the next judgment is carried out, otherwise, the next window is detected:
time(i)-time(i-1)>0.2s (5)
wherein, time (i) refers to the time of the ith peak point.
Further, the running gait calculation process includes step frequency detection, where the step frequency is the reciprocal of the time difference between two peaks:
fre_step(i)=1/(time(i)-time(i-1)) (6)
here, fre _ step (i) indicates the step frequency at the ith time, and time (i) indicates the timestamp at the ith time.
Further, the running gait calculation process comprises step length estimation, regression fitting correction coefficients are made based on the acceleration of the chest and the feet, a linear estimation model is constructed, and then the step length is calculated:
acc in the formulanormIs the modulus of the acceleration; (a, b) represents a step interval; a (i) represents the acceleration pole difference in the ith step interval; step _ len (i) is the step size of the ith step interval.
Further, the running gait calculation process includes calculating the touchdown duration, collecting and constructing a mapping from the peak interval characteristic of the chest belt type equipment to the touchdown time characteristic of the foot binding equipment based on the peak interval characteristic of the chest belt type equipment and the touchdown time characteristic of the foot binding equipment:
Δt2=k*Δt1+bias (8)
wherein, t1A step interval, t, calculated for the detection of acceleration and peak values by precordial acquisition2For the stepping time obtained by the acceleration and feature extraction collected by the ankle, k and bias are the slope and bias of the linear function, respectively.
Further, the running gait calculation process includes calculating a vertical amplitude, constructing a trigonometric function curve based on an acceleration curve of a stepping interval, and calculating a maximum amplitude of the trigonometric function curve:
the acceleration waveform is approximated as a sin function:
Acc(t)=A*sinωt (9)
where A is the amplitude of the trigonometric function, ω is the angular velocity, t is the time between two peaks:
and performing double indefinite integration to obtain a displacement approximation function in the vertical direction:
calculate the vertical amplitude ver _ d (i) of the ith step period:
a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method for a tri-axial accelerometer to measure running gait.
An electronic terminal, comprising: a processor and a memory;
the memory is configured to store a computer program and the processor is configured to execute the computer program stored by the memory to cause the terminal to perform a method for measuring a running gait with a tri-axial accelerometer.
Has the advantages that:
according to the method for measuring running gait by using the three-axis accelerometer, a relatively simple gait estimation model is constructed under the condition that the accelerometer is rigidly bound with a human body, the calculation of step frequency, step length, vertical amplitude and touchdown duration can be completed only by recording the data of the three-axis acceleration, the training process of the original complex algorithm of multiple sensors and a large amount of data is simplified, the resources occupied by the algorithm system are saved, the hardware configuration is reduced, the number of sensors of intelligent equipment is saved, the enterprise cost is reduced, and the method has great significance.
Detailed Description
In order to make the technical solutions of the present invention better understood, the following description of the technical solutions of the present invention with reference to the accompanying drawings of the present invention is made clearly and completely, and other similar embodiments obtained by a person of ordinary skill in the art without any creative effort based on the embodiments in the present application shall fall within the protection scope of the present application. In addition, directional terms such as "upper", "lower", "left", "right", etc. in the following embodiments are directions with reference to the drawings only, and thus, the directional terms are used for illustrating the present invention and not for limiting the present invention.
As shown in fig. 1, a method of measuring a running gait with a tri-axial accelerometer includes:
s100, carrying out short time domain spectrum analysis on the acquired real-time acceleration data to obtain a frequency band with the strongest energy entropy; under the condition that the three-axis accelerometer is rigidly bound with the human body, real-time acceleration data of the motion state of the human body is obtained, and frequency spectrum analysis is carried out on the real-time acceleration data.
Further, the short time domain spectrum analysis includes: after the real-time acceleration data are obtained, Fourier transform is carried out on the acceleration data in the running state, frequency domain analysis is achieved, and based on the frequency band with the strongest energy entropy, the selection of a filter, the passband cut-off frequency and the stopband cut-off frequency are determined. After the frequency spectrum analysis of the acceleration is completed, the energy value of the acceleration on each frequency band can be obtained, the frequency band with the strongest energy entropy is intercepted, as shown in fig. 3, the walking state is strongest at 1-3 Hz, and the running state is strongest at 2-5 Hz, and the data is used as the basis for constructing low-pass/band-pass filtering. For example, the frequency band with the strongest energy entropy is (a, b), and when the filter is constructed, aHz can be set as the pass band cut-off frequency, and bHz can be set as the stop band cut-off frequency.
S200, constructing a filter based on the frequency band with the strongest energy entropy, and denoising acceleration data;
the purpose of constructing the filter is to extract the accelerations a to bHz to achieve the denoising effect. Before and after denoising, the acceleration pair is as shown in fig. 4.
Further, the process of denoising the acceleration data by the filter includes:
s210, constructing a filter to solve two coefficient vectors, a ═ a (1), a (2) …, a (n) and b ═ b (1), b (2), …, b (n);
the frequency domain filtering can enable acceleration data to be smoother, and is beneficial to subsequent related detection and gait estimation work. As shown in fig. 5, since the acceleration data is time domain data, a filter is required to be constructed to solve two coefficient vectors, a ═ a (1), a (2) …, a (n) ], and b ═ b (1), b (2), …, b (n) ].
S220, performing filtering processing on the acceleration data: the process of constructing the filter is an off-line process, aiming at obtaining a and b, so that the solution can be performed by using [ n, wn ] ═ button (wp, ws, ap, as) and [ b, a ] ═ button (n, wn) in Matlab. Wherein, the button is a design function of the Butterworth filter, the input wp and ws are respectively the normalized passband cut-off frequency and stopband cut-off frequency, and the ap and as are respectively the maximum attenuation of the passband and the stopband. n and wn are the lowest order of Butterworth and cut-off frequency, coefficient vectors b and a of the numerator and denominator polynomial of the system function of the Butterworth digital filter of order n. After b and a are obtained through settlement, filtering processing can be performed on the acceleration data, as shown in fig. 6, fig. 6 is formulated as:
wherein a (i) represents the ith element of the a vector, b (i) represents the ith element of the b vector, x (i) is the original acceleration of the ith epoch of the input, and y (i) is the output corresponding to x (i).
S300, solving peak point data based on the denoised acceleration data;
in the gait calculation process, the acceleration peak value is an important parameter, and the detection accuracy of the acceleration peak value directly influences the calculation accuracy of the step frequency, the stride, the vertical amplitude and the touchdown time. After the filtering smoothing is completed, acceleration data Acc with obvious peak characteristics and smooth waveform is obtained, where the Acc includes a time epoch time and a value Acc _ vertical (hereinafter abbreviated as Acc _ v) of the vertical acceleration, and then the peak detection operation can be performed.
Further, the process of solving peak point data includes:
s310, based on the output frequency fre _ acc and the running step frequency fre _ step of the accelerometer, the length d of the sliding window is determined, peak detection actually searches for the maximum value of the acceleration in a certain neighborhood region, and before detection, the length of the neighborhood region, namely the length d of the sliding window, needs to be determined. Since the output frequency of the accelerometer is fre _ acc: 50Hz, running stride frequency of about fre _ step: 2-5 Hz, and d is calculated by the following formula in order to accurately screen the peak point of the acceleration:
when fre _ acc is 50Hz, d is 10, that is, the window size is 10 acceleration epochs.
S320, detecting and solving the maximum value of the ith acceleration value in the neighborhood region:
Acc_v(i)≥{Acc_v(k)|i-5<k<i+5} (3);
if not, detecting the next window, otherwise, judging the next step:
Acc_v(i)≥Accthr (4)
wherein AccthrA threshold value that is a peak minimum;
if the window meets the requirement (4), the next judgment is carried out, otherwise, the next window is detected:
time(i)-time(i-1)>0.2s (5)
wherein, time (i) refers to the time of the ith peak point.
In the above process, equation (3) is the maximum value of the detection area interval, equation (4) is to determine whether the value of the previous step is greater than the threshold, equation (5) is whether the time interval between the current point and the previous peak point is greater than 0.2 seconds, the graphical flow and the calculation flow of the peak detection are shown in fig. 7 and 8, where T is used to store the time epoch of the peak point, and since the window length is 5 (open interval), the initial value of i is set to 5.
And S400, calculating running gait based on the acceleration data and the peak point data.
As shown in fig. 2, the running gait includes a touchdown time, a step frequency, a stride, and a vertical amplitude. The touchdown time refers to the duration from the heel landing of a single foot to the toe off; the step frequency refers to the number of steps in one second; stride refers to the distance within a stepping cycle; vertical amplitude refers to the height at which the body's center of gravity moves vertically during running. Mapping the running process to the acceleration profile can result in a step time and a step period.
Further, the running gait solution process includes step frequency detection, the acceleration of the user during the traveling process presents a distribution characteristic similar to sine waves, and we can use the interval between two peaks as a single step interval, and the step frequency of the time period is equal to the reciprocal of the time difference between two peaks:
fre_sfep(i)=1/(time(i)-time(i-1)) (6)
here, fre _ step (i) indicates the step frequency at the ith time, and time (i) indicates the timestamp at the ith time.
Furthermore, the running gait calculation process comprises step length estimation, according to a human body morphology model, the step length of the pedestrian can be approximately estimated by the quartic root of the extremely poor acceleration in the vertical direction, but the formula is only suitable for acceleration equipment bound to the feet. The method is based on the acceleration of the chest and the feet, regression fitting correction coefficients are made, a linear estimation model is constructed, and as shown in fig. 9, the step length is further solved:
acc in the formulanormIs the modulus of the acceleration; (a, b) represents a step interval; a (i) represents the acceleration pole difference in the ith step interval; step _ len (i) is the step size of the ith step interval.
Furthermore, the running gait calculation process comprises calculating the touchdown duration, and the characteristics of the touchdown duration cannot be acquired due to the difference of the characteristics acquired by the chest strap type equipment and the foot binding equipment, and only the characteristic t of the peak value interval can be acquired1(ii) a The latter can obtain the touchdown time characteristic t more accurately2. According to this feature, t is constructed1To t2The mapping of (2) can be used to calculate the touchdown time by only using the chest strap data, as shown in fig. 10.
Acquiring and constructing a mapping of peak interval characteristics of the chest strap apparatus to touchdown time characteristics of the foot binding apparatus based on the peak interval characteristics of the chest strap apparatus and the touchdown time characteristics of the foot binding apparatus, as shown in the figureShown by 11, t1And t2The relation of approximate linearity exists between the two stages, so that a linear model can be utilized to carry out regression fitting, an off-line stage and an on-line stage are set, the off-line stage works by collecting a large amount of sample standard data and serving as a test sample for a mapping function, and the coefficient and the offset of the mapping function are obtained by a regression fitting method to obtain the mapping function f (t); the online stage is the real-time settlement of the touchdown time length according to t1And f (t) resolving the touchdown time:
Δt2=k*Δt1+bias (8)
wherein, t1A step interval, t, calculated for the detection of acceleration and peak values by precordial acquisition2For the stepping time obtained by the acceleration and feature extraction collected by the ankle, k and bias are the slope and bias of the linear function, respectively.
Further, the running gait calculation process includes calculating a vertical amplitude, which is a displacement of the center of gravity in the vertical direction, and an approximate value can be obtained by double integrating the acceleration in the vertical direction, but due to the limited sampling frequency, the settlement accuracy is greatly limited, and the approximate diagram is shown in fig. 12.
According to the characteristic that the acceleration waveform is similar to the trigonometric function waveform, the acceleration curve of a stepping interval is approximated to be a trigonometric function curve, and the process of solving the vertical amplitude is changed into the process of solving the double integral of the trigonometric function. By the peak detection method, a trigonometric function curve can be constructed based on an acceleration curve of a stepping interval at a time interval t of one stepping period, a peak value A1 and a valley value A2 in the area, and the vertical amplitude is measured, that is, the maximum value of the displacement trigonometric function, that is, the maximum amplitude of the trigonometric function is measured:
the acceleration waveform is approximated as a sin function:
Acc(t)=A*sinωt (9)
where A is the amplitude of the trigonometric function, ω is the angular velocity, t is the time between two peaks:
and performing double indefinite integration to obtain a displacement approximation function in the vertical direction:
calculate the vertical amplitude ver _ d (i) of the ith step period:
a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method for a tri-axial accelerometer to measure running gait.
An electronic terminal, comprising: a processor and a memory;
the memory is configured to store a computer program and the processor is configured to execute the computer program stored by the memory to cause the terminal to perform a method for measuring a running gait with a tri-axial accelerometer.
The present invention has been described in detail, and it should be understood that the detailed description and specific examples, while indicating the preferred embodiment of the invention, are intended for purposes of illustration only and are not intended to limit the scope of the invention.