Nothing Special   »   [go: up one dir, main page]

CN108981744B - Step frequency real-time calculation method based on machine learning and low-pass filtering - Google Patents

Step frequency real-time calculation method based on machine learning and low-pass filtering Download PDF

Info

Publication number
CN108981744B
CN108981744B CN201810884041.XA CN201810884041A CN108981744B CN 108981744 B CN108981744 B CN 108981744B CN 201810884041 A CN201810884041 A CN 201810884041A CN 108981744 B CN108981744 B CN 108981744B
Authority
CN
China
Prior art keywords
user
data
real
motion data
step frequency
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810884041.XA
Other languages
Chinese (zh)
Other versions
CN108981744A (en
Inventor
李莹
陈伟
范彬彬
尹建伟
邓水光
罗智凌
吴健
吴朝晖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang University ZJU
Original Assignee
Zhejiang University ZJU
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang University ZJU filed Critical Zhejiang University ZJU
Priority to CN201810884041.XA priority Critical patent/CN108981744B/en
Publication of CN108981744A publication Critical patent/CN108981744A/en
Application granted granted Critical
Publication of CN108981744B publication Critical patent/CN108981744B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01CMEASURING DISTANCES, LEVELS OR BEARINGS; SURVEYING; NAVIGATION; GYROSCOPIC INSTRUMENTS; PHOTOGRAMMETRY OR VIDEOGRAMMETRY
    • G01C22/00Measuring distance traversed on the ground by vehicles, persons, animals or other moving solid bodies, e.g. using odometers, using pedometers
    • G01C22/006Pedometers
    • AHUMAN NECESSITIES
    • A61MEDICAL OR VETERINARY SCIENCE; HYGIENE
    • A61BDIAGNOSIS; SURGERY; IDENTIFICATION
    • A61B5/00Measuring for diagnostic purposes; Identification of persons
    • A61B5/103Detecting, measuring or recording devices for testing the shape, pattern, colour, size or movement of the body or parts thereof, for diagnostic purposes
    • A61B5/11Measuring movement of the entire body or parts thereof, e.g. head or hand tremor, mobility of a limb
    • A61B5/112Gait analysis

Landscapes

  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Heart & Thoracic Surgery (AREA)
  • Surgery (AREA)
  • Biophysics (AREA)
  • Pathology (AREA)
  • Dentistry (AREA)
  • Biomedical Technology (AREA)
  • Physiology (AREA)
  • Medical Informatics (AREA)
  • Molecular Biology (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Animal Behavior & Ethology (AREA)
  • General Health & Medical Sciences (AREA)
  • Public Health (AREA)
  • Veterinary Medicine (AREA)
  • General Physics & Mathematics (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Remote Sensing (AREA)
  • Measurement Of The Respiration, Hearing Ability, Form, And Blood Characteristics Of Living Organisms (AREA)

Abstract

The invention discloses a real-time step frequency calculating method based on machine learning and low-pass filtering, which provides a simple and effective way for vast running enthusiasts to know the real-time step frequency of running and accurately calculate the step frequency through four stages of data preparation, model training, state judgment and real-time calculation. The invention greatly improves the conditions that the current step frequency calculation is not real-time and is easy to calculate the step frequency by mistake, so that the step frequency calculation achieves real-time reliability, and the condition of counting the step frequency by mistake is reduced due to the adoption of a machine learning method. Meanwhile, the invention displays the step frequency in real time, is convenient for the runner to control the running speed of the runner and has more accurate calculation of the step frequency.

Description

Step frequency real-time calculation method based on machine learning and low-pass filtering
Technical Field
The invention belongs to the technical field of motion detection, and particularly relates to a step frequency real-time calculation method based on machine learning and low-pass filtering.
Background
With the rapid development of economy and society, health is more and more emphasized by people; with the increasing popularity of mobile phones, mobile phone manufacturers implant various body state detection sensors in the mobile phones to obtain the motion state data of users. Meanwhile, many people can select running to keep a healthy body state, and for running, the step frequency is used as an important exercise evaluation index, so that the method has very important significance for evaluating the healthy exercise state of the user.
At present, a plurality of software for recording the step frequency of the mobile phone, such as various large sports software, daily social software and self-contained health software of the apple mobile phone, have a step frequency counting function, the software has the characteristic of counting the step frequency, the software is not real-time, and the software counts the walking steps of a user in a certain time period. In addition, these step counts are generally not very accurate, being an approximate step count, not so accurate; of course, it is reasonable to do so because some users only care how many steps he has taken the day. Still another problem with these software in the market today is miscalculation, especially with respect to the number of steps that the user may miscalculate during riding, resulting in the number of steps not truly reflecting the user's number of steps.
In the prior art, chinese patent publication No. CN104905794A provides a pedestrian stride frequency calculation system and method thereof, which can also calculate the pedestrian stride frequency in real time and is very accurate, but the method requires a large number of measurement devices, and is not suitable for daily use; chinese patent publication No. CN106310588A provides a method and apparatus for detecting the step frequency and impact of a treadmill, which completely uses the data of the treadmill and does not provide a new calculation method for the step frequency calculation method.
Machine learning is now well behaved in many areas, and machine learning techniques are also applied in various areas, such as recommendation algorithms for e-commerce, to find associated data mining algorithms among a large number of data. For the scenario of step frequency calculation, machine learning can be used to determine whether the user is in a walking state, not in another vehicle.
Disclosure of Invention
In view of the above, the invention provides a step frequency real-time calculation method based on machine learning and low-pass filtering, which can solve the problem that the step frequency statistical software in the market is not accurate enough in statistics and cannot calculate in real time.
A step frequency real-time calculation method based on machine learning and low-pass filtering comprises the following steps:
(1) collecting motion data of users in different motion states (such as states of taxi, bus, subway, bicycle, slow walking, normal walking, fast walking, jogging, fast running and the like) by using a sensor in a mobile phone;
(2) training a discrimination model for judging whether the user is in a walking state or not by using the motion data obtained in the step (1);
(3) and for the real-time motion data of the user to be detected, judging the real-time motion data by using the judgment model: if the user to be tested is judged to be in the walking state currently, executing the step (4), otherwise, directly returning the indication of the current non-walking state of the user to be tested;
(4) and calculating the current step frequency once per second according to the real-time motion data of the user to be detected.
Further, the motion data of the user in the step (1) includes gravity acceleration data, gyroscope data, and magnetic induction data.
Further, before training the discriminant model, in the step (2), for the motion data of the users in different motion states, manually marking whether each set of motion data is from the user in a walking state or from the user in a non-walking state, so as to obtain a large number of samples; each sample contains a set of motion data and its corresponding label, where the label is represented by 0 or 1, 1 represents that the motion data originates from a user in a walking state, and 0 represents that the motion data originates from a user in a non-walking state.
Further, in the step (2), all samples are divided into a training set and a verification set, three machine learning models, namely a random forest, a support vector machine and an XGboost, are trained by taking training set samples as input, then the three trained models are tested by using the verification set samples, and a model with the highest accuracy is selected and subjected to parameter fine adjustment, so that the discrimination model is obtained and stored.
Further, n groups of nearest motion data of the user to be tested are obtained in the step (3), the n groups of motion data are input into the discrimination model one by one to obtain a corresponding output result, and if the motion data determined to be in the walking state by the corresponding output result exceeds n/2 groups, the user to be tested is determined to be in the walking state currently.
Further, the specific implementation process of the step (4) is as follows:
4.1 sampling acceleration data and gravity acceleration data of a user to be detected at a frequency of 30 Hz;
4.2 performing dot product operation on the acceleration data and the gravity acceleration data of the user to be detected according to the following formula;
L=xu×xg+yu×yg+zu×zg
wherein: x is the number ofu、yu、zuThe components of acceleration in the X-axis, Y-axis and Z-axis directions, Xg、yg、zgThe components of the gravity acceleration in the directions of an X axis, a Y axis and a Z axis are respectively, and L is a dot product operation result;
4.3, filtering and denoising the dot product operation result L by using a third-order low-pass filter;
4.4 setting a threshold, counting the whole process from the time when the denoised dot product operation result L is larger than the threshold to the time when the denoised dot product operation result L is smaller than the threshold, and further counting the total steps in one second, namely the current step frequency of the user to be detected.
Based on the technical scheme, the step frequency real-time calculation method has the following beneficial technical effects:
(1) the invention adopts a machine learning method to reduce the condition of wrong statistics step frequency.
(2) Compared with the step frequency calculation software on the market, the step frequency can be calculated in real time, according to research, the optimal step frequency during running is about 180 degrees, and the running software on the world cannot display the step frequency in real time.
(3) The step frequency calculation of the invention is more accurate and precise.
Drawings
FIG. 1 is a schematic flow chart of steps of a step frequency real-time calculation method according to the present invention.
FIG. 2 is a waveform of acceleration data after filtering in a jogging state.
FIG. 3 is a waveform of unfiltered acceleration data during jogging.
Detailed Description
In order to more specifically describe the present invention, the following detailed description is provided for the technical solution of the present invention with reference to the accompanying drawings and the specific embodiments.
As shown in figure 1, the invention utilizes a machine learning algorithm to accurately judge whether a user is in a walking state but not on other vehicles, further filters noise by a low-pass filter, and finally achieves the purpose of calculating the step frequency in real time, and the specific steps are as follows:
s1, data preparation: mobile phone sensor data of a user is collected.
1.1 prepare a mobile phone, which is a common mobile phone on the market but needs to be attached with sensors such as gravitational acceleration, user acceleration, gyroscope, magnetic field, etc., all experiments in this embodiment are based on iPhone 6s, the obtained data are organized into a format as shown in table 1, and the number of the corresponding sensor is shown in the header.
TABLE 1
Figure BDA0001755171850000041
1.2 collecting sensor data of a user mobile phone, wherein the sensor data mainly comprises gravity acceleration data, user acceleration data, gyroscope data and magnetic induction data. The data of the sensor of the mobile phone user relates to a sampling frequency, the frequencies of the data generated by different mobile phones are slightly different, the embodiment is an experiment performed on an apple mobile phone, and the sampling frequency is 30 Hz.
1.3, the data obtained in the step 1.2 is arranged into input data of a model, whether the user is in a walking state or not is marked manually, and data of the user in states of taxi, bus, subway, bicycle, slow walking, normal walking, fast walking, jogging and fast running are collected respectively. The data of each state is collected for one hour, the data is originated from different people, and the data collectors are installed on the data of the different people, so that the generalization capability of the model is increased.
S2, judging whether the walking vehicle is in a walking state: the model trained based on the data in step S1 determines whether the user is in a walking state, and if so, returns directly to the user that the user is not currently in a walking state. After the data preparation work is completed, training of the model on the data set is started, and the method specifically comprises the following steps:
2.1 according to the training data obtained in the step S1, three mainstream machine learning models of random forest, support vector machine and XGBoost are tried and respectively run under the same data set.
2.2 according to the results of the three models, selecting a model with the highest accuracy, and finally adopting the XGboost model in the embodiment.
2.3 after the step 2.2 is finished, the XGboost model result is used as baseline, and the parameters of the selected model are adjusted in the step to obtain the model with higher accuracy. The parameter configuration of the last selected model in this embodiment is shown in table 2, where only important parameters are listed in table 2, and other parameters are configured by using the default parameters of the model, and are not listed one by one here.
TABLE 2
Parameter(s) Selectable value
booster gbtree
maxdepth 5
sub_sample 0.7
2.4 saving the model trained in step 2.3, and using the model as the final model for judging the motion state of the user.
S3, judging whether the walking vehicle is in a walking state: judging whether the user is in the walking state according to the model trained in the step S2, and if so, directly returning that the user is not in the walking state at present, wherein the specific process is as follows:
3.1 obtaining the user mobile phone sensor data in real time, organizing ten groups of data, sending the ten groups of data into the model finally obtained in the step S2, wherein the significance of selecting the ten groups is to increase the accuracy rate of model judgment.
3.2 making a result whether the user is in the walking state according to the ten judgment results in the step 3.1, if more than or equal to five results in the ten results are judged to belong to the walking state, otherwise, judging that the user is not in the walking state currently.
After step S3, we obtain a model, which has high accuracy on the verification set, but a good model must be a model with better generalization capability, so we need to look at the generalization capability of the model, and need to go back to step S3 if the generalization capability is poor, otherwise go to step S4.
S4, step frequency real-time calculation: if the user is in a walking state, acquiring the data of the mobile phone sensor of the user in real time, calculating the step frequency in real time, and calculating the current step frequency once per second, wherein the specific process is as follows:
4.1 collecting the sensor data of the mobile phone of the user at the frequency of 30HZ, wherein the model is judged to belong to the walking state in the step, and only the acceleration data and the gravity acceleration data of the user are needed at the moment, and other data can not be used.
4.2, performing dot product on the user acceleration data and the gravity acceleration data obtained every second, wherein the user acceleration and the gravity acceleration are divided into data in XYZ three axial directions, and the dot product is expressed by the following formula:
xu×xg+yu×yg+zu×zg
wherein: x is the number ofuX value, X, representing user accelerationgX values representing gravitational acceleration, and so on; the result after dot product is the user's own up and down wave in the direction of gravity, such as the cell phone user is inThe data in the jogging state is shown in fig. 3.
4.3, a third-order low-pass filter is implemented, and in the embodiment, an IIR (infinite Impulse response) filter which is simple and easy to implement is selected, and a specific formula of the IIR is as follows:
outputi=α0(inputiβ0+inputi-1β1+inputi-2β2-outputi-1α1-outputi-2α2)
wherein α and β are the coefficients of the filter, which are fixed, inputiData, output, representing input timing iiThe coefficients used in the present embodiment are shown in table 3, representing data with an output timing i:
TABLE 3
Coefficient of performance Value taking
α0 1
α1 -0.631042566328
α2 0.04623279
β0 0.4768836
β1 0
β2 -0.4768836
4.4 filtering out the noise in the data after dot product in step 4.2 by using a third-order low-pass filter in step 4.3, the noise mainly comes from shaking the mobile phone in the hand or other parts of the user's body, and fig. 2 shows the filtered data.
4.5 select a threshold, one step each time above the threshold to below the threshold, so that the number of steps in one second divided by one second is the user's current stride rate. If the threshold value selected in this embodiment is 0.5, the time period from when the data is greater than 0.5 to when the data is less than 0.5 is recorded as 1 step, and then the number of steps in one second is calculated, so as to obtain the current step frequency.
The embodiments described above are presented to enable a person having ordinary skill in the art to make and use the invention. It will be readily apparent to those skilled in the art that various modifications to the above-described embodiments may be made, and the generic principles defined herein may be applied to other embodiments without the use of inventive faculty. Therefore, the present invention is not limited to the above embodiments, and those skilled in the art should make improvements and modifications to the present invention based on the disclosure of the present invention within the protection scope of the present invention.

Claims (5)

1. A step frequency real-time calculation method based on machine learning and low-pass filtering comprises the following steps:
(1) collecting motion data of users in different motion states by using a sensor in the mobile phone;
(2) training a discrimination model for judging whether the user is in a walking state or not by using the motion data obtained in the step (1);
(3) and for the real-time motion data of the user to be detected, judging the real-time motion data by using the judgment model: if the user to be tested is judged to be in the walking state currently, executing the step (4), otherwise, directly returning the indication of the current non-walking state of the user to be tested;
(4) according to the real-time motion data of the user to be detected, calculating the current step frequency once per second, and the specific implementation process is as follows:
4.1 sampling acceleration data and gravity acceleration data of a user to be detected at a frequency of 30 Hz;
4.2 performing dot product operation on the acceleration data and the gravity acceleration data of the user to be detected according to the following formula;
L=xu×xg+yu×yg+zu×zg
wherein: x is the number ofu、yu、zuThe components of acceleration in the X-axis, Y-axis and Z-axis directions, Xg、yg、zgThe components of the gravity acceleration in the directions of an X axis, a Y axis and a Z axis are respectively, and L is a dot product operation result;
4.3, filtering and denoising the dot product operation result L by using a third-order low-pass filter;
4.4 setting a threshold, counting the whole process from the time when the denoised dot product operation result L is larger than the threshold to the time when the denoised dot product operation result L is smaller than the threshold, and further counting the total steps in one second, namely the current step frequency of the user to be detected.
2. The stride frequency real-time calculation method of claim 1, wherein: the motion data of the user in the step (1) comprises gravity acceleration data, gyroscope data and magnetic induction data.
3. The stride frequency real-time calculation method of claim 1, wherein: before the discriminant model is trained, for the motion data of the users in different motion states, manually marking whether each group of motion data is from the users in a walking state or from the users in a non-walking state, so as to obtain a large number of samples; each sample contains a set of motion data and its corresponding label, where the label is represented by 0 or 1, 1 represents that the motion data originates from a user in a walking state, and 0 represents that the motion data originates from a user in a non-walking state.
4. The stride frequency real-time calculation method of claim 3, wherein: and (2) dividing all samples into a training set and a verification set, training three machine learning models of a random forest, a support vector machine and an XGboost by taking the training set samples as input, testing the three trained models by using the verification set samples, selecting the model with the highest accuracy and carrying out parameter fine adjustment on the model, thereby obtaining and storing the discrimination model.
5. The stride frequency real-time calculation method of claim 1, wherein: and (3) acquiring the nearest n groups of motion data of the user to be detected, inputting the n groups of motion data into the discrimination model one by one to obtain a corresponding output result, and if the motion data judged to be in the walking state by the corresponding output result exceeds n/2 groups, judging that the user to be detected is in the walking state currently.
CN201810884041.XA 2018-08-06 2018-08-06 Step frequency real-time calculation method based on machine learning and low-pass filtering Active CN108981744B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810884041.XA CN108981744B (en) 2018-08-06 2018-08-06 Step frequency real-time calculation method based on machine learning and low-pass filtering

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810884041.XA CN108981744B (en) 2018-08-06 2018-08-06 Step frequency real-time calculation method based on machine learning and low-pass filtering

Publications (2)

Publication Number Publication Date
CN108981744A CN108981744A (en) 2018-12-11
CN108981744B true CN108981744B (en) 2020-07-07

Family

ID=64555814

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810884041.XA Active CN108981744B (en) 2018-08-06 2018-08-06 Step frequency real-time calculation method based on machine learning and low-pass filtering

Country Status (1)

Country Link
CN (1) CN108981744B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115282573B (en) * 2022-09-29 2022-12-20 山东布莱特威健身器材有限公司 Treadmill intelligent control method and system combining internet of things and data analysis

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101226061A (en) * 2008-02-21 2008-07-23 上海交通大学 Method for locating walker
CN101907467A (en) * 2010-08-06 2010-12-08 浙江大学 Method and device for personal location based on motion measurement information
CN104296749A (en) * 2014-11-03 2015-01-21 中国科学院深圳先进技术研究院 Motion state perception-based low power consumption positioning method and system
CN106289311A (en) * 2016-08-04 2017-01-04 北京妙医佳信息技术有限公司 A kind of motion duration and the detection method of distance
CN108195395A (en) * 2017-11-17 2018-06-22 捷开通讯(深圳)有限公司 Mobile terminal and its step-recording method, storage device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI457539B (en) * 2012-12-19 2014-10-21 Ind Tech Res Inst Multi-posture step length calibration system and method for indoor positioning

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101226061A (en) * 2008-02-21 2008-07-23 上海交通大学 Method for locating walker
CN101907467A (en) * 2010-08-06 2010-12-08 浙江大学 Method and device for personal location based on motion measurement information
CN104296749A (en) * 2014-11-03 2015-01-21 中国科学院深圳先进技术研究院 Motion state perception-based low power consumption positioning method and system
CN106289311A (en) * 2016-08-04 2017-01-04 北京妙医佳信息技术有限公司 A kind of motion duration and the detection method of distance
CN108195395A (en) * 2017-11-17 2018-06-22 捷开通讯(深圳)有限公司 Mobile terminal and its step-recording method, storage device

Also Published As

Publication number Publication date
CN108981744A (en) 2018-12-11

Similar Documents

Publication Publication Date Title
CN103323615B (en) A kind of mobile terminal and method being calculated walking speed by acceleration transducer
CN103954295B (en) A kind of step-recording method based on acceleration transducer
CN103997572B (en) A kind of step-recording method based on mobile phone acceleration sensor data and device
CN105678222B (en) A kind of mobile device-based Human bodys' response method
CN110664390B (en) Heart rate monitoring system and method based on wrist strap type PPG and deep learning
CN104567912B (en) Method for realizing pedometer on Android mobile phone
CN106491138A (en) A kind of motion state detection method and device
CN107970590B (en) A kind of running body-building data system and method based on Android platform
CN103315728A (en) Heart rate detection and display method and device adopting same
CN107662613B (en) A kind of extreme driving behavior recognition methods and system based on mobile intelligent perception
CN106618542A (en) Denoising heart rate detecting device and method
CN205286364U (en) Wireless Intelligence exercise heart monitors earphone
CN105509763A (en) Step-counting interference removal method and device
WO2017177582A1 (en) Method and device for implementing speed measurement of sports apparatus
CN104316162A (en) Method and system for intelligently measuring and analyzing multilevel vibrational frequency of large-scale electro-optical telescope
CN105469546B (en) A kind of tumbling alarm system and method
CN107091650A (en) A kind of software step-recording method based on mobile phone acceleration and range sensor
CN103344249A (en) Step counting method based on short-time spectral analysis of inertial sensor
CN106388786A (en) Processing method acquiring data based on intelligent ring
CN110147163A (en) The eye-tracking method and system of the multi-model fusion driving of facing mobile apparatus
CN108981744B (en) Step frequency real-time calculation method based on machine learning and low-pass filtering
CN110532898A (en) A kind of physical activity recognition methods based on smart phone Multi-sensor Fusion
CN105387870B (en) Information processing unit, direction of travel estimating method and storage medium
CN105574471B (en) The recognition methods of the method for uploading, user behavior of user behavior data and device
CN106096589A (en) The method carrying out pulse frequency Variability Analysis in short-term based on intelligent terminal's photographic head

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant