CN107462258B - Step counting method based on mobile phone three-axis acceleration sensor - Google Patents

Step counting method based on mobile phone three-axis acceleration sensor Download PDF

Info

Publication number
CN107462258B
CN107462258B CN201710569013.4A CN201710569013A CN107462258B CN 107462258 B CN107462258 B CN 107462258B CN 201710569013 A CN201710569013 A CN 201710569013A CN 107462258 B CN107462258 B CN 107462258B
Authority
CN
China
Prior art keywords
data
peak
trough
acceleration
calculation window
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.)
Expired - Fee Related
Application number
CN201710569013.4A
Other languages
Chinese (zh)
Other versions
CN107462258A (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.)
Hohai University HHU
Original Assignee
Hohai University HHU
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 Hohai University HHU filed Critical Hohai University HHU
Priority to CN201710569013.4A priority Critical patent/CN107462258B/en
Publication of CN107462258A publication Critical patent/CN107462258A/en
Application granted granted Critical
Publication of CN107462258B publication Critical patent/CN107462258B/en
Expired - Fee Related 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72448User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions
    • H04M1/72457User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions according to geographic location
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M2250/00Details of telephonic subscriber devices
    • H04M2250/12Details of telephonic subscriber devices including a sensor for measuring a physical value, e.g. temperature or motion

Landscapes

  • Engineering & Computer Science (AREA)
  • Environmental & Geological Engineering (AREA)
  • Human Computer Interaction (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (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)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses a step counting method based on a three-axis acceleration sensor of a mobile phone, which comprises the following steps: acquiring data, namely acquiring triaxial data of a triaxial acceleration sensor according to a calculation window; data preprocessing, namely, performing average smoothing on the data and solving a resultant acceleration; extracting characteristics, namely respectively extracting the mean value and the variance of data and the number of wave crests of the combined acceleration, clustering the combined acceleration by using a clustering algorithm, and extracting a clustering center as the combined acceleration characteristics; position discrimination, namely classifying the features by using a classification algorithm to obtain class labels; waveform reconstruction, namely segmenting data into quadruples and segmenting the data into complete waves; and (4) step number calculation, namely acquiring a corresponding discrimination threshold according to the category, discriminating the reconstructed data by using the threshold, and adding 1 to the step number of the corresponding category when the condition is met. The step counting method can identify different positions of the mobile phone, is more accurate in step counting and has stronger anti-interference performance.

Description

Step counting method based on mobile phone three-axis acceleration sensor
Technical Field
The invention relates to a step counting method based on a mobile phone three-axis acceleration sensor, and belongs to the technical field of consumer application electronics.
Background
Along with the improvement of the living standard of people, people pay more and more attention to how to carry out reasonable physical exercise, monitor the physical condition in time and acquire the motion data in time, so that the basic requirement of the masses of people who love sports is met. On the other hand, in the explosive development of the internet of things today, more and more sensor devices are applied to wearable devices. The smart phone is taken as a typical smart wearable device and a smart monitoring device to enter the lives of the public, and a plurality of application software for health monitoring and motion guidance appear on the mobile platform of the smart phone, so that powerful material and technical support is provided for acquiring health information. Pedometers are a typical example of a related application.
There are many devices that count the number of steps a user walks, but they all have some drawbacks. Most of the existing methods acquire an acceleration signal through an acceleration sensor, and then set a simple threshold value to judge whether a wave peak value in the combined acceleration is effective or not, so that a step counting function is realized. Because false wave crests are easy to appear in the sensor acquisition process, misjudgment may occur in the method, and the step counting precision is low. In addition, the periodic characteristic of the motion is also utilized to judge whether the similarity of the combined acceleration waveform of the front wave and the rear wave is within a certain threshold range, and the like. Since the sports persons have various sports forms, such as running and walking, and the acceleration changes are different when the acquisition devices are placed at different positions of the body during the sports, the similarity of the waveforms may not be high enough. Therefore, the conventional method is still insufficient because the step count statistics using only the resultant acceleration data and the periodic characteristics of the extracted waveform is prone to cause erroneous counting or missing counting.
Disclosure of Invention
The invention aims to solve the technical problem of providing a step counting method based on a mobile phone three-axis acceleration sensor, which extracts characteristics of three-axis acceleration data and combined acceleration data, identifies data needing step counting by using a classification algorithm, removes influences caused by false peaks and false valleys through reconstruction data, identifies different positions of a mobile phone in a motion process, sets different thresholds for the data at the different positions for filtering, finally improves step counting accuracy and has higher anti-interference performance.
The invention adopts the following technical scheme to solve the technical problems
The invention provides a step counting method based on a mobile phone three-axis acceleration sensor, which comprises the following specific steps:
step 1, determining a sampling calculation window according to a set sampling frequency and a sampling time window, and acquiring triaxial acceleration data of a triaxial acceleration sensor of a mobile phone, wherein the number of each axis data in each sampling calculation window is 0,1, … and n-1 according to an acquisition sequence, wherein n represents the number of each axis data in each sampling calculation window;
step 2, smoothing the collected triaxial acceleration data in each sampling calculation window, and calculating the smoothed resultant acceleration;
step 3, in each sampling calculation window, performing feature extraction on the three-axis acceleration data and the combined acceleration after smoothing in the step 2, wherein an average value xMean and a variance xVariance of the x-axis acceleration are extracted as x-axis data features, an average value yMean and a variance yVariance of the y-axis acceleration are extracted as y-axis data features, an average value zMean and a variance zVariance of the z-axis acceleration are extracted as z-axis data features, and the peak number peakCount of the combined acceleration is extracted as an appearance feature of a peak; clustering the combined acceleration data into 3 classes by using a clustering algorithm, respectively obtaining an average value of each class of combined acceleration data, and sequencing the 3 average values from large to small to obtain combined acceleration characteristics of < clusterPeak, clusterMean, clusterThrough >, clusterPeak > clusterMean > clusterThrough;
step 4, judging the category of the data collected in each sampling calculation window according to the characteristics extracted in the step 3;
step 5, if the judgment result in the step 4 is static noise or motion noise, discarding the data in the current sampling calculation window, otherwise, performing waveform reconstruction on the combined acceleration data in the current sampling calculation window; the waveform reconstruction method specifically comprises the following steps:
5.1, calculating the average value of the combined acceleration in the current sampling calculation window, and dividing the combined acceleration in the current sampling calculation window into a plurality of areas where wave crests are located and areas where wave troughs are located by using the average value, wherein the areas where the wave crests are located and the areas where the wave troughs are located alternately appear;
5.2, searching the area of each peak, acquiring the largest peak in the area of the current peak as the true peak of the area, and recording the corresponding data number peak index of the true peak in the current sampling calculation window;
5.3, searching the area where each wave trough is located, acquiring the minimum wave trough in the area where each wave trough is located as the true wave trough of the area, and simultaneously recording the corresponding data number of the true wave trough value in the current sampling calculation window;
5.4, the true peak, the last true valley trough before the true peak, the first true valley trough after the true peak, and the half-wave length halfWaveLength form a reconstructed waveform quadruple < peak, trough left, trough right, halfWaveLength >, completing reconstruction of a waveform, the halfWaveLength is max { | peak index-trough left |, | peak index-troughIndexRight | }, the troughIndexLeft represents that the trough left corresponds to a data number in the current sampling calculation window, and the troughIndexRight represents that the trough right corresponds to a data number in the current sampling calculation window;
step 6, setting a threshold quadruple < peak threshold, troughThreshold, maxWaveLength, minWaveLength > according to the type of the data acquired in the current sampling calculation window, and judging the reconstructed waveform obtained in the step 5 one by one:
6.1, according to the category of data acquired in the current sampling calculation window, acquiring a corresponding threshold quadruple < peakThreshold, troughTHhreshold, maxWaveLength and minWaveLength > from a preset threshold quadruple, wherein peakThreshold is used as a threshold of a true peak, troughTHhreshold is used as a threshold of a true trough, and maxWaveLength and minWaveLength are respectively a maximum retrievable value and a minimum retrievable value of the halfWaveLength;
6.2, the waveform quadruples < peak, trough left, trough right, halfWaveLength > of the reconstructed waveform are compared one by one with the threshold quadruples: firstly, judging a true peak, entering the next step if peak is greater than peak threshold, and otherwise, comparing waveform quadruples of the next reconstructed waveform; then, judging the true wave trough, if trough left < troughThreshold and trough right < troughThreshold, entering the next step, otherwise, comparing the waveform quadruplet of the next reconstructed waveform; finally, judging the half wavelength, if the half wavelength is greater than minWaveLength and the half wavelength is less than maxWaveLength, counting the current reconstructed waveform as one step, and adding one to the total step number of the corresponding data type; otherwise, comparing the waveform quadruple of the next reconstructed waveform;
and 7, respectively adding the step numbers in the sampling calculation windows according to different data types, namely realizing step counting.
As a further optimization scheme of the present invention, in step 2, an average smoothing method is adopted to perform smoothing processing on each axis data of the three-axis data, and a smoothing formula is as follows:
Figure BDA0001349139670000031
wherein s is a preset smooth window with a large sizeSmall and even number greater than zero, ai+jRepresenting data numbered i + j within the calculation window of the sample before smoothing, ai' denotes the data numbered i in the sample calculation window after smoothing, and n denotes the number of data in the sample calculation window.
As a further optimization scheme of the present invention, in step 5, in step 5.1, the average value is used to divide the resultant acceleration in the current sampling time window into a region where a peak is located and a region where a trough is located, specifically: and dividing by judging whether the combined acceleration is greater than the average value, wherein the area where the combined acceleration is greater than the average value is the area where the wave crest is located, and the area where the combined acceleration is less than the average value is the area where the wave trough is located.
As a further optimization scheme of the present invention, in step 5.4, when a complete waveform quadruple cannot be reconstructed in the last combined acceleration data in the current sampling calculation window, the partial combined acceleration data is added to the front part of the next sampling calculation window, so as to ensure the continuity of calculation in the adjacent sampling calculation windows.
As a further optimization of the present invention, the length of the sampling calculation window, windows, is the sampling frequency, f, the length of the sampling time window, N.
As a further optimization scheme of the present invention, the method for determining the category of the data collected in each sampling calculation window in step 4 is as follows:
4.1, respectively acquiring three-axis acceleration data of the mobile phone according to data categories, extracting features according to the methods in the steps 1 to 3, and taking the extracted features as a training set, wherein the data categories comprise a) static noise, b) the mobile phone in a jacket pocket, c) the mobile phone in a trousers pocket, d) the mobile phone walks in the hand, e) the mobile phone runs in the hand, f) the mobile phone is in other positions, and g) motion noise;
4.2, constructing a classification model, and training and learning the classification model by using the training set in the step 4.1;
and 4.3, inputting the features extracted from the data collected in each sampling calculation window into the classification model after training and learning, wherein the output of the classification model is the corresponding class.
As a further optimization scheme of the invention, the classification model in step 4.2 is a three-layer neural network, wherein the activation functions of the first layer and the second layer are both linear rectification functions with leakage, the third layer adopts a normalized exponential function softmax function, a random gradient descent algorithm with momentum is adopted to train the three-layer neural network, and the loss function is a cross entropy loss function.
Compared with the prior art, the invention adopting the technical scheme has the following technical effects:
1. the method collects the three-axis data of the three-axis acceleration sensor, extracts the data characteristics, discriminates the position state of the mobile phone by means of a classification algorithm, can identify different positions of the mobile phone in the movement process, reconstructs data to identify a complete wave, and respectively counts steps for different position categories, so that the step counting is more accurate;
2. the method identifies different positions of the mobile phone in the movement process, can identify different position types and count steps, and meets the requirements of users on different application scenes;
3. the method identifies the real wave crest and the real wave trough through the reconstruction data, removes the influence of the pseudo wave crest and the pseudo wave trough, and has stronger anti-interference performance;
4. the method is based on a mobile phone platform, can utilize a portable mobile phone as data acquisition, calculation, storage and display equipment, has a three-axis acceleration sensor in common smart phones, and has strong practicability and strong transportability.
Drawings
FIG. 1 is a system flow diagram of an embodiment of the present invention;
FIG. 2 is a schematic diagram of three-axis acceleration according to an embodiment of the present invention;
FIG. 3 is a flow chart of waveform reconstruction according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a valley resolution process according to an embodiment of the present invention;
FIG. 5 is a flowchart illustrating step count calculation according to an embodiment of the present invention.
Detailed Description
The technical scheme of the invention is further explained in detail by combining the attached drawings:
as shown in fig. 1, a system flow of the embodiment of the present invention is shown, which includes the following steps:
101. data acquisition: the method comprises the steps of setting the sampling frequency and the sampling time window of the mobile phone triaxial acceleration sensor, calculating the sampling calculation window, and storing the value of the acquired triaxial acceleration. The data for each axis within each sample computation window is numbered 0,1, …, n-1 in the order of acquisition, where n represents the number of data for each axis within each sample computation window.
Calculating a sampling calculation window, wherein the formula is as follows: windows length ═ f × N. Wherein, the windowLength represents the total length of the sampling calculation window, and the unit is one; f represents the sampling frequency in hertz; n represents the time length of sampling, and the unit is second; for example, when f is 50 hz and N is 4, a window length is obtained, i.e., 4 × 50 is 200, and at this time, when the acceleration sensor respectively collects data in 200 corresponding directions on the x axis, the y axis and the z axis, the current calculation window is closed, the data is transferred to the next step, and a new calculation window is opened to accept new data.
The three axes of the three-axis acceleration sensor are shown in fig. 2 and are respectively marked as an x axis, a y axis and a z axis. Taking the state that the screen is horizontally placed upwards as an example, the x axis acquires the acceleration change condition of the direction when the acceleration sensor moves left and right; the y axis collects the acceleration change condition in the direction when the acceleration sensor moves back and forth; and the z axis acquires the acceleration change condition in the direction when the acceleration sensor moves up and down.
102. Data preprocessing: the method comprises the step of smoothing the data acquired in the step 101 by adopting an average value smoothing method. Smoothing the acceleration of an x axis, the acceleration of a y axis and the acceleration of a z axis in the three-axis acceleration respectively according to a preset smoothing window coefficient s, wherein the smoothing formula is as follows:
Figure BDA0001349139670000051
where s is a preset smooth window size and is an even number greater than zero, ai+jRepresenting data numbered i + j within the calculation window of the sample before smoothing, ai' denotes the data numbered i in the sample calculation window after smoothing, and n denotes the number of data in the sample calculation window.
Calculating a resultant acceleration value of the smoothed x-axis acceleration, y-axis acceleration and z-axis acceleration according to the following formula:
Figure BDA0001349139670000052
wherein x isf、yf、zfThe smoothed x-axis acceleration, y-axis acceleration, and z-axis acceleration, respectively.
103. Feature extraction: extracting the characteristics of the acceleration in the current calculation window, comprising: respectively extracting the characteristics of acceleration values of an x axis, a y axis and a z axis in the three-axis acceleration sensor; and extracting the characteristics of the triaxial acceleration value and the appearance characteristics of the wave crest.
Extract the characteristics of triaxial acceleration sensor x axle, y axle and z axle acceleration respectively, include: extracting an average value xMean and a variance xVariance of the acceleration value of the x axis in the calculation window, and respectively using the average value xMean and the variance xVariance as the size characteristic and the chaos degree of the motion in the x axis direction in the current calculation window; similarly, the mean yMean and variance yVariance of the y-axis acceleration values are extracted, and the mean and variance zMean of the z-axis acceleration values are extracted. Extracting the number of the combined acceleration wave crests in the current calculation window as the appearance characteristics of the wave crests, and recording the appearance characteristics as peak count; meanwhile, the characteristics of the three-axis resultant acceleration value are extracted.
Extracting features of the three-axis combined acceleration values, including: the method comprises the steps of utilizing a clustering algorithm with preset clustering number to cluster the combined acceleration data into 3 types, respectively obtaining average combined acceleration values of the data belonging to the same type, sequencing the obtained 3 average values from large to small to obtain 3 clustering centers < clusterPeak, clusterMean and clusterThrough > as combined acceleration characteristics, wherein the clusterPeak represents the average characteristic of a peak, the clusterMean represents the characteristic near the average value, and the clusterThrough represents the average characteristic of a trough.
And extracting appearance characteristic peakCount of the wave crests, and calculating the appearance times of the wave crests in the resultant acceleration value in the current calculation window. The peak satisfies the following formula:
ah-1<ah
ah+1<ah
wherein, ahIndicates the resultant acceleration value of the data number h in the sampling calculation window, ah-1Represents the resultant acceleration value, a, of the data number h-1 within the sampling calculation windowh+1And represents the total acceleration value with the data number of h +1 in the sampling calculation window.
The above-mentioned characteristic value set
<xMean,xVariance,yMean,yVariance,zMean,zVariance,peakCount,clusterPeak,clusterMean,clusterThrough>。
104. And (3) judging the data type: and according to the extracted features of the x axis, the y axis and the z axis, combining the features of the acceleration and the appearance features of the wave crest to form a feature value group of a currently acquired calculation window, and judging the category of the acquired data by utilizing a classification algorithm. Wherein the categories of data include: a) stationary noise, b) cell phone in jacket pocket, c) cell phone in trousers pocket, d) cell phone walking while in hand, e) cell phone running while in hand, f) cell phone in other position, g) sports noise, 5 categories b to f representing the location of the cell phone, f being a general term when the cell phone is placed in other positions such as in a bag.
The classification algorithm uses a multilayer neural network, the network is divided into 3 layers, the activation functions of the first layer and the second layer are linear rectification functions with leakage, and the third layer adopts a normalized exponential function softmax function. In the training and learning process, corresponding triaxial data are collected according to different categories respectively, processing of 101, 102 and 103 is carried out to extract features, then category marking is carried out, namely, one-hot code coding is carried out according to the categories from a to g to obtain category labels, the feature data and the corresponding category labels are input into a multilayer neural network, a random gradient descent algorithm with momentum is adopted for training, and a loss function is a cross entropy loss function.
105. Waveform reconstruction: according to the type discrimination result in 104, when the discrimination result is a or g, the data in the current sampling calculation window is represented as invalid data, and the data in the current sampling calculation window is discarded. Otherwise, reconstructing data in the current sampling calculation window, calculating an average value of the total acceleration values in the current calculation window, analyzing a true peak and a true valley by using the average value, reconstructing to obtain a waveform quadruple, and analyzing the data in the calculation window into a set of a plurality of quadruples, thus obtaining a plurality of reconstructed complete waveform quadruples.
And (3) reconstructing and acquiring a waveform quadruple: calculating the average value of the combined acceleration values in the current calculation window, segmenting the region where the wave crest is located and the region where the wave trough is located by using the average value, when the combined acceleration value is larger than the average value, the current region is the wave crest region needing to be searched, and when the combined acceleration value is smaller than the average value, the current region is the wave trough region needing to be searched; searching an area where the wave crest is located, obtaining the largest wave crest in the wave crest area as the real wave crest peak of the current area, and recording the data number peak index where the real wave crest is located; searching the region where the trough is located, and acquiring the trough with the minimum trough region as the real trough of the current region.
One complete wave is composed of three regions, namely a left valley region, a peak region and a right valley region. The peak areas and the valley areas alternately appear, the average value is crossed from the left valley area to the peak area, the average value is crossed from the peak area to the right valley area, and a complete wave passes through the average value twice.
To remove the effect of the spurious peak, the true peak of a wave is defined as: in the two-time crossing average value, the peak in a peak area has the largest value among a plurality of peaks, and the peak satisfies the following formula:
ah-1<ah
ah+1<ah
similarly, a true trough is defined as: in the two-time crossing average value, in a wave trough area, the wave trough is the minimum value in a plurality of wave troughs, and the wave trough meets the following formula:
ak-1>ak
ak+1>ak
wherein, akRepresenting the resultant acceleration value of the data number k within the sampling calculation window, ak-1Represents the resultant acceleration value of the data number k-1 in the sampling calculation window, ak+1Representing the resultant acceleration value of the data number k +1 within the sample calculation window.
The specific operation comprises the following steps: in a peak searching area, acquiring the maximum value of a peak, recording the data number of the true peak, and calculating the number as peak index; similarly, in a valley search area, a minimum valley is obtained, the data number where the true valley is located is recorded, and finally a quadruple < peak, trough left, trough right, half wave length > is obtained, where the variables are: the true peak meets the last true wave trough before the true peak, and the first true wave trough after the true peak, and half wave length.
The calculation formula of halfWaveLength is as follows:
halfWaveLength=max{|peakIndex-troughIndexLeft|,|peakIndex-troughIndexRight|}
wherein, troughIndexLeft represents the data number of the troughLeft, and troughIndexRight represents the data number of the troughRight.
The reconstruction of one wave is completed, and a plurality of reconstructed waveform quadruples can be reconstructed in a sampling calculation window. To ensure continuity of adjacent complete wave data within the computational window, troughRight of one quad is troughLeft of the next quad.
And searching for the complete wave starts from the true wave trough, when the quadruple cannot be completely obtained, the current wave is considered to be incomplete, the current residual wave data needs to be stored, the data of the next calculation window is waited to arrive, the region where the trough left is located and the data of the region are added to the front part of the data of the next calculation window in the combined acceleration data, and the true wave crest and the true wave trough are continuously searched. When a waveform quadruple of a complete wave is obtained, the calculation of the next step is carried out.
Fig. 3 shows a specific flow of waveform reconstruction in step 105:
301. and judging whether the resultant acceleration value is larger than the average value. If the wave crest information is larger than the mean value, the wave crest information enters a wave crest searching area, and then the true wave crest information in the waveform quadruple < peak, trough left, trough right and halfWaveLength > is searched; otherwise, searching for true valley information is started.
302. And judging whether the previous value of the current value is smaller than the average value. If yes, information storage is carried out; otherwise, the information indicating the last wave is already stored, and the information does not need to be stored.
303. And (5) information storage. When the average value is smaller than the mean value, the average value is crossed to reach the area where the peak is located. At this time, the true valley information is saved as true valley value trough and data number troughindextright in the quadruple information of the previous wave, and half wave length in the previous wave is calculated, and the formula is as follows:
max{|peakIndex-troughIndexLeft|,|peakIndex-troughIndexRight|}
the above completes the feature acquisition of the last wave. Meanwhile, the wave trough information is stored as the true left wave trough value troughLeft of the current wave, the data number troughIndexleft is recorded, and the original wave trough area is emptied.
304. And judging whether the current combined acceleration value is a wave crest or not. If not, the data is discarded and the next resultant acceleration value is read.
305. The current combined acceleration is a peak value, and whether the current combined acceleration value is the maximum value in a peak domain needs to be judged. And judging the current resultant acceleration value and the wave crest in the existing wave crest domain, and searching the maximum value. If not, the data is truncated and the next resultant acceleration value is read.
306. And storing peak index when the current resultant acceleration is the potential true peak value of the waveform quadruple, and adding the current peak into a peak domain.
307. And (4) extracting the relevant features of the true wave trough when the current resultant acceleration value is not more than the mean value and is the region where the wave trough is located.
Fig. 4 shows a specific flow of performing the trough analysis in step 307:
401. and judging whether the current wave enters the valley area for the first time, if so, storing the true peak information of the current wave. Otherwise, the true peak information of the current wave is stored, and the trough search is directly carried out.
402. At present, the true peak passes through the average value and enters the wave band where the wave trough is located, the true peak characteristic information of the current complete wave needs to be stored in the quadruplet, namely the value peak of the true peak and the data number peak index where the true peak is located are stored, and the peak area is emptied.
403. And judging whether the current combined acceleration value is a wave trough or not, and if not, inputting the next combined acceleration value.
404. And judging whether the current valley is the minimum value in the valley domain, comparing the current combined acceleration value with the existing valley value in the domain, and selecting the minimum value as the final candidate true valley value.
405. And storing the candidate minimum trough value obtained currently, storing the trough information, including the trough value and the data number corresponding to the trough, and adding the trough value into the trough domain. And inputting the next resultant acceleration value for judgment.
106. Calculating the number of steps: and (3) reconstructing the obtained quadruple data according to the waveform 105 and judging the obtained data type information in 104, judging by using the corresponding threshold quadruple of each type, and adding 1 to the total step number of the corresponding type when the requirement of the threshold quadruple is met.
According to the data category information obtained in the step 104, threshold quadruplets < peak threshold, troughThreshold, maxWaveLength, minWaveLength > of corresponding categories are obtained, the obtained waveform quadruplet characteristics < peak, troughLength, troughRight, halfWaveLength > are compared with the threshold quadruplets, the quadruplets meeting the requirements are screened out, and step number calculation is carried out.
Fig. 5 shows a specific flow of step number calculation in step 106:
501. step 104 obtains the data type.
502. According to the acquired category type, when the category corresponds to stationary noise or moving noise, the category is discarded. Otherwise, the corresponding threshold quadruple < peakThreshold, troughThreshold, maxWaveLength, minWaveLength > is taken out. And judging the reconstructed quadruple data by using a threshold value.
503. And judging whether the peak value of the true wave is in a preset range, if the peak is less than the peak threshold, discarding the current reconstruction data, and judging the next reconstruction waveform quadruple.
504. And judging whether the true left wave trough is in a preset range, if the troughLeft is greater than troughThreshold, the current reconstruction data is not valid data, and discarding.
505. And judging whether the true right trough is in a preset range, if the troughRight > troughThreshold, indicating that the current data is invalid data, and discarding.
506. And judging whether the half wavelength is in a set range, if the half wavelength is less than the minWaveLength, judging that the current data is invalid data, and discarding.
507. And judging whether the half wavelength exceeds a preset range, if the half wavelength is greater than maxWaveLength, the current data does not meet the requirement, and discarding.
508. And adding one step to the total step count of the type data when the current reconstructed quadruple data is valid data and belongs to correct step count data.
The above description is only an embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can understand that the modifications or substitutions within the technical scope of the present invention are included in the scope of the present invention, and therefore, the scope of the present invention should be subject to the protection scope of the claims.

Claims (7)

1. A step counting method based on a mobile phone three-axis acceleration sensor is characterized by comprising the following specific steps:
step 1, determining a sampling calculation window according to a set sampling frequency and a sampling time window, and acquiring triaxial acceleration data of a triaxial acceleration sensor of a mobile phone, wherein the number of each axis data in each sampling calculation window is 0,1, … and n-1 according to an acquisition sequence, wherein n represents the number of each axis data in each sampling calculation window;
step 2, smoothing the collected triaxial acceleration data in each sampling calculation window, and calculating the smoothed resultant acceleration;
step 3, in each sampling calculation window, performing feature extraction on the three-axis acceleration data and the combined acceleration after smoothing in the step 2, wherein an average value xMean and a variance xVariance of the x-axis acceleration are extracted as x-axis data features, an average value yMean and a variance yVariance of the y-axis acceleration are extracted as y-axis data features, an average value zMean and a variance zVariance of the z-axis acceleration are extracted as z-axis data features, and the peak number peakCount of the combined acceleration is extracted as an appearance feature of a peak; clustering the resultant acceleration data into 3 classes by using a clustering algorithm, respectively obtaining an average value of each class of the resultant acceleration data, and sequencing the 3 average values from large to small to obtain a resultant acceleration characteristic < clusterPeak, clusterMean, clusterThrough >, clusterPeak > clusterMean > clusterThrough, clusterPeak represents the average characteristic of a peak, clusterMean represents the characteristic near the average value, and clusterThrough represents the average characteristic of a trough;
step 4, judging the category of the data collected in each sampling calculation window according to the characteristics extracted in the step 3;
step 5, if the judgment result in the step 4 is static noise or motion noise, discarding the data in the current sampling calculation window, otherwise, performing waveform reconstruction on the combined acceleration data in the current sampling calculation window; the waveform reconstruction method specifically comprises the following steps:
5.1, calculating the average value of the combined acceleration in the current sampling calculation window, and dividing the combined acceleration in the current sampling calculation window into a plurality of areas where wave crests are located and areas where wave troughs are located by using the average value, wherein the areas where the wave crests are located and the areas where the wave troughs are located alternately appear;
5.2, searching the area of each peak, acquiring the largest peak in the area of the current peak as the true peak of the area, and recording the corresponding data number peak index of the true peak in the current sampling calculation window;
5.3, searching the area where each wave trough is located, acquiring the minimum wave trough in the area where each wave trough is located as the true wave trough of the area, and simultaneously recording the corresponding data number of the true wave trough value in the current sampling calculation window;
5.4, the true peak, the last true valley trough before the true peak, the first true valley trough after the true peak, and the half-wave length halfWaveLength form a reconstructed waveform quadruple < peak, trough left, trough right, halfWaveLength >, completing reconstruction of a waveform, the halfWaveLength is max { | peak index-trough left |, | peak index-troughIndexRight | }, the troughIndexLeft represents that the trough left corresponds to a data number in the current sampling calculation window, and the troughIndexRight represents that the trough right corresponds to a data number in the current sampling calculation window;
step 6, setting a threshold quadruple < peak threshold, troughThreshold, maxWaveLength, minWaveLength > according to the type of the data acquired in the current sampling calculation window, and judging the reconstructed waveform obtained in the step 5 one by one:
6.1, according to the category of data acquired in the current sampling calculation window, acquiring a corresponding threshold quadruple < peakThreshold, troughTHhreshold, maxWaveLength and minWaveLength > from a preset threshold quadruple, wherein peakThreshold is used as a threshold of a true peak, troughTHhreshold is used as a threshold of a true trough, and maxWaveLength and minWaveLength are respectively a maximum retrievable value and a minimum retrievable value of the halfWaveLength;
6.2, the waveform quadruples < peak, trough left, trough right, halfWaveLength > of the reconstructed waveform are compared one by one with the threshold quadruples: firstly, judging a true peak, entering the next step if peak is greater than peak threshold, and otherwise, comparing waveform quadruples of the next reconstructed waveform; then, judging the true wave trough, if trough left < troughThreshold and trough right < troughThreshold, entering the next step, otherwise, comparing the waveform quadruplet of the next reconstructed waveform; finally, judging the half wavelength, if the half wavelength is greater than minWaveLength and the half wavelength is less than maxWaveLength, counting the current reconstructed waveform as one step, and adding one to the total step number of the corresponding data type; otherwise, comparing the waveform quadruple of the next reconstructed waveform;
and 7, respectively adding the step numbers in the sampling calculation windows according to different data types, namely realizing step counting.
2. The step counting method based on the three-axis acceleration sensor of the mobile phone according to claim 1, characterized in that, in step 2, an average smoothing method is adopted to perform smoothing processing on each axis data of the three-axis data, and the smoothing formula is:
Figure FDA0002412329070000021
where s is a preset smooth window size and is an even number greater than zero, ai+jRepresents data of number i + j in the sample before smoothing calculation window, a'iThe number of the data with the number i in the sampling calculation window after smoothing is shown, and n represents the number of the data in the sampling calculation window.
3. The step counting method based on the three-axis acceleration sensor of the mobile phone according to claim 1, characterized in that in step 5, in step 5.1, the average value is used to divide the combined acceleration in the current sampling time window into a region where a peak is located and a region where a trough is located, specifically: and dividing by judging whether the combined acceleration is greater than the average value, wherein the area where the combined acceleration is greater than the average value is the area where the wave crest is located, and the area where the combined acceleration is less than the average value is the area where the wave trough is located.
4. The step counting method based on the three-axis acceleration sensor of the mobile phone according to claim 3, characterized in that in step 5.4, when a complete waveform quadruple cannot be reconstructed from the last combined acceleration data in the previous sampling calculation window, the partial combined acceleration data is added to the front of the next sampling calculation window to ensure the continuity of the calculation in the adjacent sampling calculation windows.
5. The step counting method based on the three-axis acceleration sensor of the mobile phone according to claim 1, characterized in that the length of the sampling calculation window is windows length, sampling frequency f, and length N of the sampling time window.
6. The step counting method based on the three-axis acceleration sensor of the mobile phone according to claim 1, characterized in that the method for judging the category of the data collected in each sampling calculation window in step 4 is as follows:
4.1, respectively acquiring three-axis acceleration data of the mobile phone according to data categories, extracting features according to the methods in the steps 1 to 3, and taking the extracted features as a training set, wherein the data categories comprise a) static noise, b) the mobile phone in a jacket pocket, c) the mobile phone in a trousers pocket, d) the mobile phone walks in the hand, e) the mobile phone runs in the hand, f) the mobile phone is in other positions, and g) motion noise;
4.2, constructing a classification model, and training and learning the classification model by using the training set in the step 4.1;
and 4.3, inputting the features extracted from the data collected in each sampling calculation window into the classification model after training and learning, wherein the output of the classification model is the corresponding class.
7. The step counting method based on the three-axis acceleration sensor of the mobile phone according to claim 6, characterized in that the classification model in step 4.2 is a three-layer neural network, wherein the activation functions of the first layer and the second layer are both leaky linear rectification functions, the third layer adopts a normalized exponential function softmax function, the three-layer neural network is trained by a stochastic gradient descent algorithm with momentum, and the loss function is a cross entropy loss function.
CN201710569013.4A 2017-07-13 2017-07-13 Step counting method based on mobile phone three-axis acceleration sensor Expired - Fee Related CN107462258B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710569013.4A CN107462258B (en) 2017-07-13 2017-07-13 Step counting method based on mobile phone three-axis acceleration sensor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710569013.4A CN107462258B (en) 2017-07-13 2017-07-13 Step counting method based on mobile phone three-axis acceleration sensor

Publications (2)

Publication Number Publication Date
CN107462258A CN107462258A (en) 2017-12-12
CN107462258B true CN107462258B (en) 2020-06-16

Family

ID=60546251

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710569013.4A Expired - Fee Related CN107462258B (en) 2017-07-13 2017-07-13 Step counting method based on mobile phone three-axis acceleration sensor

Country Status (1)

Country Link
CN (1) CN107462258B (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109190553A (en) * 2018-08-30 2019-01-11 上海奥孛睿斯科技有限公司 Step detection method
CN109350072B (en) * 2018-11-15 2020-08-04 北京航空航天大学 Step frequency detection method based on artificial neural network
CN109540143B (en) * 2018-11-27 2022-12-02 中国广核电力股份有限公司 Pedestrian unconventional action direction identification method based on multi-sensing-source dynamic peak fusion
CN110595501B (en) * 2019-10-09 2022-10-04 成都乐动信息技术有限公司 Running distance correction method based on three-axis sensor
CN110721456B (en) * 2019-10-09 2020-12-25 成都乐动信息技术有限公司 Pedal frequency detection method based on three-axis sensor
CN110852260B (en) * 2019-11-08 2023-05-30 青岛联合创智科技有限公司 Drowning behavior recognition method based on accelerometer
CN111238527B (en) * 2020-01-15 2023-09-29 桂林市优创电子科技有限公司 Step counting method based on triaxial acceleration sensor
CN111442785B (en) * 2020-03-27 2021-01-26 广东工业大学 Step counting method, device and equipment based on inertia and storage medium
CN111358472B (en) * 2020-03-27 2022-08-23 山东建筑大学 Gait detection algorithm, device and system
CN112067015B (en) * 2020-09-03 2022-11-22 青岛歌尔智能传感器有限公司 Step counting method and device based on convolutional neural network and readable storage medium
CN112923922B (en) * 2021-03-04 2022-01-25 香港理工大学深圳研究院 Method, system and storage medium for counting steps and determining position information of pedestrian
CN113008231A (en) * 2021-04-30 2021-06-22 东莞市小精灵教育软件有限公司 Motion state identification method and system, wearable device and storage medium
CN113378801B (en) * 2021-08-11 2021-11-09 深圳市梦瑶科技有限公司 Intelligent bracelet accurate step counting method based on neural network
CN114034313B (en) * 2021-11-10 2024-04-02 广东乐心医疗电子股份有限公司 Step counting method and device
CN114139669B (en) * 2021-11-19 2024-10-22 歌尔科技有限公司 Rope skipping counting method, device and medium thereof
CN114739412B (en) * 2022-04-11 2024-05-03 河海大学 Pedestrian gait real-time detection method and device based on smart phone

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6441846B1 (en) * 1998-06-22 2002-08-27 Lucent Technologies Inc. Method and apparatus for deriving novel sports statistics from real time tracking of sporting events
CN104567912A (en) * 2015-02-02 2015-04-29 河海大学 Method for realizing pedometer on Android mobile phone
CN104990562A (en) * 2015-06-29 2015-10-21 合肥工业大学 Step counting method based on autocorrecting computing
CN104983489A (en) * 2015-07-28 2015-10-21 河北工业大学 Road condition identifying method for lower limb prosthesis walking
CN106767888A (en) * 2016-11-15 2017-05-31 皖西学院 A kind of meter based on Wave crest and wave trough detection walks algorithm

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6441846B1 (en) * 1998-06-22 2002-08-27 Lucent Technologies Inc. Method and apparatus for deriving novel sports statistics from real time tracking of sporting events
CN104567912A (en) * 2015-02-02 2015-04-29 河海大学 Method for realizing pedometer on Android mobile phone
CN104990562A (en) * 2015-06-29 2015-10-21 合肥工业大学 Step counting method based on autocorrecting computing
CN104983489A (en) * 2015-07-28 2015-10-21 河北工业大学 Road condition identifying method for lower limb prosthesis walking
CN106767888A (en) * 2016-11-15 2017-05-31 皖西学院 A kind of meter based on Wave crest and wave trough detection walks algorithm

Also Published As

Publication number Publication date
CN107462258A (en) 2017-12-12

Similar Documents

Publication Publication Date Title
CN107462258B (en) Step counting method based on mobile phone three-axis acceleration sensor
Yang et al. Deep convolutional neural networks on multichannel time series for human activity recognition.
Ihianle et al. A deep learning approach for human activities recognition from multimodal sensing devices
Zhu et al. Efficient human activity recognition solving the confusing activities via deep ensemble learning
CN106289309B (en) Step-recording method and device based on 3-axis acceleration sensor
Frank et al. Activity and gait recognition with time-delay embeddings
Lester et al. A hybrid discriminative/generative approach for modeling human activities
Rui et al. Segmenting visual actions based on spatio-temporal motion patterns
WO2021115064A1 (en) Fitness exercise recognition method based on wearable sensor
CN105787434A (en) Method for identifying human body motion patterns based on inertia sensor
Al-Ghannam et al. Prayer activity monitoring and recognition using acceleration features with mobile phone
CN112464738B (en) Improved naive Bayes algorithm user behavior identification method based on mobile phone sensor
Zhang Application of human motion recognition utilizing deep learning and smart wearable device in sports
Depari et al. Lightweight machine learning-based approach for supervision of fitness workout
CN110322472A (en) A kind of multi-object tracking method and terminal device
Garcia-Ceja et al. An improved three-stage classifier for activity recognition
CN111931616A (en) Emotion recognition method and system based on mobile intelligent terminal sensor equipment
CN111582361A (en) Human behavior recognition method based on inertial sensor
Shan et al. Deep analysis for smartphone-based human activity recognition
CN117133057A (en) Physical exercise counting and illegal action distinguishing method based on human body gesture recognition
Sharma et al. A transformer based approach for activity detection
Mobsite et al. A framework for elders fall detection using deep learning
Fu et al. Ping pong motion recognition based on smart watch
CN116747495A (en) Action counting method and device, terminal equipment and readable storage medium
KR20140020440A (en) Activity diagnosis apparatus and method of the same

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20200616

CF01 Termination of patent right due to non-payment of annual fee