optimised-algorithm-accurate
optimised-algorithm-accurate
net/publication/328990649
Conference Paper in Conference proceedings: ... Annual International Conference of the IEEE Engineering in Medicine and Biology Society. IEEE Engineering in Medicine and Biology Society.
Conference · July 2018
DOI: 10.1109/EMBC.2018.8513319
CITATIONS READS
13 2,411
4 authors, including:
L. Tarassenko
University of Oxford
427 PUBLICATIONS 18,267 CITATIONS
SEE PROFILE
All content following this page was uploaded by Dario Salvi on 21 December 2018.
Abstract— Step counting from smart-phones allows a wide devices is being investigated widely [5], little is still known
range of applications related to fitness and health. Estimating about mobile applications.
steps from phones’ accelerometers is challenging because of the The research community, and developers in general, would
multitude of ways a smart-phone can be carried. We focus our
work on the windowed peak detection algorithm, which has therefore benefit from a validated, open-source implemen-
previously been shown to be accurate and efficient and thus tation of a step-counting algorithm for smart-phones. Even
suitable for mobile devices. We explore and optimise further though there are a number of open-source projects related
the algorithm and its parameters making use of data collected to step-counting, to the best of our knowledge, none have
by three volunteers holding the phone in six different positions. been validated with robust methods. The aim of this paper
In order to simplify the analysis of the data, we also built
a novel device for the detection of the ground truth steps. is to describe how an algorithm for smart-phone based step
Over the collected data set, the algorithm reaches 95% average counting has been designed, optimised and validated. The
accuracy. We implemented the algorithm for the Android OS algorithm we propose makes use of the data generated by the
and released it as an open source project. A separate dataset accelerometer sensor, is robust to noise, is accurate enough
was collected with the algorithm running on the smart-phone to be meaningful for common fitness and health applications
for further validation. The validation confirms the accuracy of
the algorithm in real-time conditions. and is computationally efficient to be executable in real-time
by a smart-phone. The algorithm has been implemented in
I. INTRODUCTION Python and Java and is available as an open-source project
In the last 10 years, no other electronic device has had the at: https://oxford-step-counter.github.io/.
same commercial and societal impact as the smart-phone. II. RELATED WORK
Mobile phone penetration is greater than that of personal
computers and, in the United Kingdom, it has already There have been a number of attempts to develop step
reached peaks of 85% for people aged 17-75 [1]. Modern counting algorithms based on an accelerometers signal. In [6]
smart-phones embed a vast number of sensors connected a relationship between walking speed and the accelerometer
to powerful processing units and capacious memories. Even signals is used to devise an algorithm based on thresholding
low-end devices have built-in accelerometers, proximity sen- the magnitude. The algorithm was tested on five walking
sors, gyroscopes, magnetometers and Global Positioning samples ranging from 16 to 44 steps and achieved an average
System receivers. accuracy of 96.6%. The data collection protocol was not
This technology allows for several applications, from nav- detailed except for the fact that the device was fixed near
igation and positioning [2] to tracking for health and fitness the centre of mass of the subject.
purposes [3]. Particularly relevant for health and fitness, is In [7], the authors tested a multitude of algorithms for
the ability to measure physical activity. Step counting is the both walk detection and step counting. The paper describes
most commonly used parameter extracted in apps designed a wide range of techniques, from simple thresholding in
to measure and influence physical activity [4]. the time domain, to frequency domain analysis to non-
Recently, high-end smart-phones have often incorporated linear template matching and machine learning. To com-
low-power step counters, which are part of the motion- pare them, authors decided to benchmark nine algorithms:
sensing chip-set, but older or cheaper devices still lack windowed peak detection, mean crossing counts, normalized
this functionality. To compensate for the lack of hardware autocorrelation, dynamic time warping, short term Fourier
resources, mobile applications like Google Fit or Samsung transform, continuous wavelet transform, discrete wavelet
Health compute the step count using the main processing transform, hidden Markov model, and k-means clustering.
unit, but the accuracy and the details of their algorithms are They collected 130 data recordings from 27 subjects holding
unknown. The lack of a proper evaluation of these products a smart-phone in 4 ways: in-hand, in a front pocket, in a
makes it difficult to employ them for medical purposes, back pocket, and in a handbag. A video recording was taken
where transparency about the accuracy and the limitations of of each session for reference. Authors determined that the
the technology are needed. While the accuracy of wearable windowed peak detection, the hidden Markov model and
the continuous wavelet transform methods worked the best
All the authors are with the Institute of Biomedical Engineering, across the scenarios, with a median error of about 1.3%.
Department of Engineering Science, University of Oxford, Oxford, Given the computational complexity of the two latter tech-
United Kingdom. [email protected], [email protected],
[email protected], [email protected]. niques, authors concluded that the windowed peak detection
This work was supported by NIHR Oxford Biomedical Research Centre. is the most efficient algorithm.
Fig. 1. Block diagram of the step counting algorithm. Between each pair
of stages there is a buffer to allow parallelism.
TABLE II
P HYSICAL CHARACTERISTICS OF THE VOLUNTEERS WHO COLLECTED
THE DATA AND AVERAGE ± STANDARD DEVIATION OF THE DURATION
AND NUMBER OF STEPS OF THE COLLECTED TRACKS .
Fig. 5. Digitised value of the voltage measured on one Velostat foil (blue)
and the computed threshold (red). Age Weight(kg) Height(cm) Duration(s) Steps
38 86 180 163±20 537±50
33 80 186 171±27 481±58
iments were performed over short distances with the number 21 68 172 153±18 547±79
of steps varying between 22 and 79 (average 36 ±14 standard
deviation) and time varying between 14 and 41 seconds
(average 24±8 s). a distributed cloud-computing platform (Google Cloud Com-
Of 17 experiments, 12 showed no difference in the number pute) was employed to spread the processing load across
of steps counted by the device and the researchers, 4 had a multiple machines. Each permutation of parameters was
1-step difference and 1 had a 2-step difference. This yields ranked according to the mean error obtained on all the
to an average accuracy of 99% and standard deviation of 2%. recordings.
We considered this accuracy to be sufficient for the purpose
IV. RESULTS
of this work.
The details of the three researchers (all male) who col-
C. Data collection lected the data are summarised in table II together with
average and standard deviation of the duration and number
In order to optimise the parameters of the algorithm with
of steps.
different scenarios, we collected data from three researchers
Table III shows the optimal set of parameters obtained
walking for two to three minutes with the phone held in
by the distributed optimisation phase. With these set of
six different positions: in a hand, in a front pocket, in a
parameters, the average accuracy is 95% ± 4.5% standard
back pocket, in an armband, in a shoulder purse, and in
deviation.
a neck pouch on a lanyard. These scenarios are similar
If we split the analysis according to the position of the
to the ones proposed by [7]. This resulted in a dataset
smart-phone during the recordings we obtain the results in
containing 36 distinct recordings, each with approximately
table IV (each scenario has six recordings). It is possible to
2.5 minutes of accelerometer and ground-truth data. Six extra
observe that the in-hand and purse positions give rise the
experiments were dedicated to assess the differences between
lowest accuracies. These may be caused by the harmonics
three different phones (Google Pixel, Samsung Galaxy S6,
LG Nexus 5) in similar conditions: phone held in hand, same
floor and same user. TABLE III
To validate the algorithm when running on the phone, 12 S ET OF PARAMETERS THAT OBTAINS THE MINIMUM AVERAGE ERROR .
extra recordings were collected by two researchers holding
the phone in the same six positions as the ones used for Stage Parameters Value
optimising the algorithm. Window size M=13
Filter type Gaussian
Filtering
D. Algorithm optimisation Filter SD 0.35
To select the optimal set of parameters for our algorithm Cutoff frequency 3Hz
an exhaustive grid search across the parameter space was Gain at cutoff -60dB
performed. The explored range of the parameters is shown
in table I together with parameters that were kept constant. Type Mean Difference
Scoring
The sampling frequency was fixed at 100 Hz for all the tests. Window size N = 35
Both the algorithm and the benchmarking software were
developed in Python version 3. The optimisation of the Detection Threshold 1.2
parameters was performed on the 36 recordings of the
scenarios dataset. In order to expedite the exhaustive search, Post-Processing twindow 200 ms
TABLE IV
We have not evaluated scenarios of false walking activities
ACCURACY OF THE OPTIMISED ALGORITHM PER POSITION , N=6 FOR
as was done in [8]. For these scenarios, Gu et al. offer some
EACH POSITION
valid additions to the Windowed Peak Detection that would
need to be added to our implementation.
Position Average accuracy ± SD
In hand 93% ± 3.8% R EFERENCES
Front pocket 95% ± 2.8% [1] P. Lee, “Mobile Consumer Survey 2017: The UK cut,”
Back pocket 98% ± 1.2% Deloitte [Last accessed: 27 September 2017], Tech. Rep.,
Purse 90% ± 7.2% 2017. [Online]. Available: http://www.deloitte.co.uk/mobileuk/?_ga=
2.95282970.782041114.1506509099-13344498.1506509099
Armband 95% ± 2.5% [2] H.-E. Chen, Y.-Y. Lin, C.-H. Chen, and I.-F. Wang, “Blindnavi:
Neck pouch 98% ± 1.0% A navigation app for the visually impaired smartphone user,” in
Proceedings of the 33rd Annual ACM Conference Extended Abstracts
on Human Factors in Computing Systems, ser. CHI EA ’15. New
TABLE V
York, NY, USA: ACM, 2015, pp. 19–24.
ACCURACY OF THE OPTIMISED ALGORITHM PER PHONE MODEL [3] J. P. Higgins, “Smartphone Applications for Patients’ Health and
Fitness,” The American Journal of Medicine, vol. 129, no. 1, pp. 11–
19, Jan. 2016.
Phone model Accuracy Accuracy [4] J. Bort-Roig, N. D. Gilson, A. Puig-Ribera, R. S. Contreras, and S. G.
recording 1 recording 2 Trost, “Measuring and Influencing Physical Activity with Smartphone
Google Pixel 97.9% 95.30% Technology: A Systematic Review,” Sports Medicine, vol. 44, no. 5,
pp. 671–686, May 2014.
Google Nexus 5 96.1% 97.3% [5] P. Alinia, C. Cain, R. Fallahzadeh, A. Shahrokni, D. Cook, and
Samsung S6 99.6% 95.5% H. Ghasemzadeh, “How accurate is your activity tracker? a compar-
ative study of step counts in low-intensity physical activities,” JMIR
mHealth and uHealth, vol. 5, no. 8, p. e106, 2017.
[6] N. Z. Naqvi, A. Kumar, A. Chauhan, and K. Sahni, “Step count-
introduced in the walking frequency range by the arm ing using smartphone-based accelerometer,” International Journal on
swinging when holding the phone, or by the purse swinging Computer Science and Engineering, vol. 4, no. 5, pp. 675–681, May
2012.
back and forth under the arm. [7] A. Brajdic and R. Harle, “Walk detection and step counting on uncon-
If we analyse the six recordings that use different smart- strained smartphones,” in Proceedings of the 2013 ACM international
phones (results in table V) we can conclude that the choice joint conference on Pervasive and ubiquitous computing. ACM, 2013,
pp. 225–234.
of the phone does not affect the accuracy of our algorithm [8] F. Gu, K. Khoshelham, J. Shang, F. Yu, and Z. Wei, “Robust and
significantly, which confirms the findings of [7]. accurate smartphone-based step counting for indoor localization,”
IEEE Sensors Journal, vol. 17, no. 11, pp. 3453–3460, 2017.
The average accuracy obtained with the 12 validation [9] G. Palshikar, “Simple algorithms for peak detection in time-series,”
tracks collected with the algorithm running on the phone Tata Research Development and Design Centre, Tech. Rep., 2009.
is 93 ± 13%. This confirms that the algorithm performs with [10] W. W. Hoeger, L. Bond, L. Ransdell, J. M. Shimon, and S. Merugu,
“One-mile step count at walking and running speeds,” ACSM’s Health
a similar accuracy also when running on a smart-phone. The & Fitness Journal, vol. 12, no. 1, pp. 14–19, 2008.
high variance is due to one track taken in the back pocket [11] J. Pan and W. J. Tompkins, “A real-time QRS detection algorithm,”
when the algorithm counted almost twice the number of IEEE transactions on biomedical engineering, no. 3, pp. 230–236,
1985.
steps. The reason may be due to the fact that the pocket was
loose and allowed the phone to rebound and thus introduced
components in the signal at twice the frequency of the gait.