**1. Introduction**

We have witnessed the rapid growth and wide popularity of smart watches, smart bands and smartphones in recent years. Walk detection (WD) and step counting (SC) are fundamental applications using these smart devices. They also provide the algorithmic basis for daily activity recognition, calorie consumption estimation, body state diagnosis and indoor navigation.

WD and SC are generally carried out by processing sensing data, from an MEMS-based accelerometer and optionally gyroscope sensors. These sensors are generally tiny and low-cost and embedded in the wearable devices. They provide continuous 1D to 3D accelerator or angle rate data, so as to indicate the motion dynamics of the user who is wearing the device. Various algorithms have been proposed to process the accelerator data stream to extract temporal and frequency features from the sensing data and design recognition algorithms for walk detection and step counting. In particular, walk detection could differentiate walking from other daily activities, such as sitting, standing and running. Step counting counts the number of steps when users are in a walking state.

Algorithms were designed using different ways to process the accelerator stream data, in order to conduct walk detection and step counting. The common design methodologies include heuristic-based, signal processing and machine learning methods. However, a common feature of these algorithms

is that the design is based on recognizing the patterns of a gait cycle. In particular, a gait cycle of a human is composed of several consecutive phases, i.e., stance phase and swing phase. Algorithms recognize and extract the features of these phases to detect walking, and the distinguished periodical events are exploited for step counting.

However, the algorithms' performances are shown to be highly sensitive to the application contexts, and the following contexts are used in this paper: (1) the sensor placements; (2) the sensor orientations; (3) the user's walking patterns; (4) the preprocessing window sizes; and (5) the sensor sampling rates. How the WD and SC algorithms are impacted by the dynamic contexts has not yet been adequately investigated. Most previous works have only treated the sensor placement as the major context factor [1–3]. As in Brajdic's intensive survey [4], they only compared different algorithms and the effects of placements, including [4], who evaluated the performance of step counting algorithms in a loose way. To date, few works have studied the impact of all five application contexts simultaneously within the same experiment. In this paper, we extended the single context factor of placement to five context factors. We also employed a new criterion (Section 5.3.1) to evaluate the performance of step counting.

In addition, existing datasets do not provide enough information in evaluating WD and SC thoroughly. For example, the dataset of [5] is small, and only gestures are collected. USC-HAD [6] fixed the sensor position at the front right hip. The UCI smartphone dataset [7–9] only fixed the sensor at limited positions. The PlaceLab dataset [10] only had one subject. The work [11] lacks step data. To evaluate WD and SC thoroughly, we built our own dataset. We consider context factors including placement, orientation, walking pattern factors and also window size and sampling rate. The window size and sampling rate are determined by the potential applications and are also limited by the hardware. We collected and labeled datasets by the five factors.

In the other applications, WD and SC are fundamental algorithms. For example, [12] used SC to assist in indoor navigation; [13] recognized physical activity such as walking, running, etc.; [14] was a real-time gait analysis in walking and running. The work in [15] could detect falls among activities for elderly people. The work in [16] was a low-cost indoor/outdoor navigation system aided by GPS. Many studies have employed multiple sensors such as the accelerometer, gyroscope, heart rate sensor and a barometer to detect human activity. While placing more sensors in different locations can be cumbersome for subjects, one single accelerometer is more preferable due to the low power consumption and low cost.

From the algorithmic aspect, five algorithms from three main categories (heuristic, signal processing and machine learning) are investigated and summarized in this paper. We carefully design experiments to evaluate the impacts of different contexts thoroughly. In each experiment, testing datasets were constructed by recording multiple users' movement indoors and outdoors, using Android phones and smart watches as the testing devices. The accuracy and fragility of different algorithms provide valuable guidance for algorithm selection for the related applications. Although many commercial wristbands, pedometers and step counting applications have been developed, they usually suffer from false positives. We employ a receiver operating characteristic (ROC) curve to make a more accurate evaluation.

The remaining sections are organized as follows. The related works and context impacts are defined in Section 2. Related algorithms are introduced in Section 3. The experiment design is introduced in Section 4. Performance evaluation and comparisons are presented in Section 5. Section 6 concludes the paper.
