Real time event-based segmentation to classify locomotion activities through a single inertial sensor

We propose an event-based dynamic segmentation technique for the classification of locomotion activities, able to detect the midswing, initial contact and end contact events. This technique is based on the use of a shank-mounted inertial sensor incorporating a tri-axial accelerometer and a tri-axial gyroscope, and it is tested on four different locomotion activities: walking, stair ascent, stair descent and running. Gyroscope data along one component are used to dynamically determine the window size for segmentation, and a number of features are then extracted from these segments. The event-based segmentation technique has been compared against three different fixed window size segmentations, in terms of classification accuracy on two different datasets, and with two different feature sets. The dynamic event-based segmentation showed an improvement in terms of accuracy of around 5% (97% vs. 92% and 92% vs. 87%) and 1-2% (89% vs. 87% and 97% vs. 96%) for the two dataset, respectively, thus confirming the need to incorporate an event-based criterion to increase performance in the classification of motion activities.


INTRODUCTION
Inertial sensors are gaining increasing popularity in medical applications due to their low power, cost and miniature size [1].Several applications in human motion analysis, activity monitoring and classification benefit from the use of sensors including accelerometers, gyroscopes and magnetometers [2,3].In principle, the research focus is now directed towards the data processing and information retrieval.
On-body sensors are collecting and continuously outputting streams of data and one important task is to process this incoming data stream into segments, in order to be able to associate, to each segment, some relevant information associated with the activity that is monitored within that segment.In the past, various methods have been applied to divide the signal into segments, the most common ones among them being the use of fixed window length and the application of event-based windows.
In the first class of techniques, the signal is divided into consecutive windows of fixed length.In the case of locomotion activities, used lengths lie in the range (1-10) s [4,5,6,7,8], and the presence of overlapping between consecutive windows is usually limited to 50%.One limitation of this approach is that problems can arise if an activity lasts for shorter or longer time periods than the pre-defined window length.
With the event-based segmentation, foot-off or foot strike events are used to dynamically define the length of the successive windows: the size of the windows thus depends on the type and duration of the activity.A number of different approaches have been proposed for identifying either foot strike or foot-off (or possibly both events) from body-worn sensor signals.
In terms of gait event detection, a gyroscope placed at the shank has been proven to be acceptably accurate in healthy gait walking up and down an incline [9] and in pathological [10,11] and in healthy gait when walking on level ground [10,12].Gyroscope placed on the foot and on the shank has been used for locomotion pattern classification, including descending and ascending stairs [13,14,15], and it was concluded that it is possible to detect the gait events from the locomotion activities performed by the subjects.
Apart from fixed length segmentation, event-based segmentation techniques generally use a small fixed-length window to identify the events within one gait cycle (initial contact, flat foot or footoff) [16,17,18].Chen et al. extracted all peaks (mid-swing) from the signal and used the center of two consecutive peaks to identify the foot-flat segment [13].In [19] foot-off event was detected based on the local minimum search from the expected foot-off point to zero-crossing of the next swing phase.To the best of our knowledge, there is no study yet which has evaluated the effect of a dynamic event-based segmentation with respect to static segmentation on the ability to classify human locomotion activities.
This study thus analyses and compares the classification accuracy obtained through an event-based dynamic segmentation against different fixed window lengths, on the classification of daily living activities including walking, stair ascent, stairs descent and running.In order to tune the event detection to these locomotion activities (that were not limited to level walking, but included stair negotiation), we modified the gait detection criterion in such a way that no window is used to detect the events.Then these events are used to define a signal segment that represents the whole activity cycle, to be used for the classification of locomotion activities.

MATERIALS AND METHODS
In order to evaluate the segmentation across different conditions, we used two different datasets: one directly collected within the research activity associated with this contribution, and one obtained as a benchmark dataset, publicly available.Details are reported in the next two subsections.

Data collection (BioLab³ dataset)
Nine healthy adults (29 ± 5 years) were recruited for this study.Participants were equipped with an inertial measurement unit that included an ADXL345 tri-axial accelerometer (±4g) and an ITG3200 tri-axial gyroscope (2000 rad/s), fixed on the shank (distal position) of the dominant leg.
Experiments were carried out in the university building, except running, which was performed outside the building.All participants were asked to carry out activities at their self-selected speed on a predefined route.This route includes a walking path of 50 meters  opening and closing a door  descending stairs on a staircase of 46 steps  few walking steps  opening and closing a door  running (outside the building along a path of about 100 meters)  opening and closing a door  ascending stairs  opening and closing a door  walking.Participants were asked to stand still for few seconds between each activity.Data were collected at a sampling rate of 100 Hz and labeled with ground truth knowledge.

Benchmark data (PAMAP2 dataset)
The PAMAP2 dataset was also used to check the validity of the method.This dataset is composed of different activities from 9 participants.For the purposes of this study, we only picked those activities that could be compared with the other database of interest (walking, stair ascent, stair descent and running).We took data coming from the ankle-mounted sensor (a tri-axial accelerometer and a tri-axial gyroscope) only, which is at a slightly lower position as compared to the sensor position used in the BioLab³ dataset.Further information about the dataset is available [20].

Event-based signal segmentation
In this study, signal segmentation is based on the detection of gait events.There are some characteristics that are common across different locomotors activities (walking, stairs descend, stairs ascend and running) like swing phase, stance phase etc.The shape of the swing phase (maximum peak) in the gyroscope signal has consistency throughout the signal followed by the lower peak of the stance phase.Each activity cycle for this activity subset is composed of a swing phase and a stance phase, and they can be identified by considering mid-swing (MS), initial contact (IC), and end contact (EC) events.There is a mutual agreement that foot-off event is the minimum value of the negative peak before swing phase peak and this foot-off event is used to identify the start and end of the gait cycle [11].
The algorithm is designed to detect these three events to find a single cycle from the raw gyroscope angular component along the sagittal plane.The segmentation is called real-time as it is done by sample by sample evaluation to detect the gait events.The whole procedure for event detection is defined in Table 1.
Each activity cycle (segment) is then defined by using consecutive EC events.For comparison, also fixed length widows were considered (with values of the window length equal to 1, 1.25 and 1.5 s, respectively).

Feature extraction and selection
Segments identified with the above-mentioned rules were taken as the reference for all the remaining inertial data.For each segment, a set of time and frequency domain features that are used in the literature for the activity recognition problem were derived from each axis and magnitude of the accelerometer and gyroscope signal [5,21].A total number of 138 features were then extracted.
Linear forward feature selection (LFFS) technique was then applied to get the relevant features set from the extracted features [22].Selected features are mentioned in Table 2.A total number of 30 features (FS1) were selected by the algorithm from BioLab³ dataset and 24 features (FS2) from PAMAP2 dataset.So in our study we have two feature sets FS1 and FS2 for each dataset.The purpose of selecting features from different datasets is to check whether the selection on one dataset would affect the classification accuracy rate of the other dataset respectively, as the position of the sensors in the two datasets was different.

Classification and performance evaluation
We tested the classification performance of a multilayer perceptron neural network (MLP) classifier on the extracted features by using WEKA toolbox.Features extracted from each segment were passed to the MLP to classify the activity, where each segment (gait cycle) was classified as either walking, stairs ascend, stairs descend or running activity.Different settings of the classifier were tested, and the best performance was achieved with the following parameters: 500 training epochs, learning rate of 0.3 and momentum of 0.2 to update the weights.A number of studies pointed out the positive performance of the MLP in activity recognition problem [4,23].
Leave-one-out cross-validation criteria was used to evaluate the performance of the classifier: data of one subject were used as the testing, while the rest of the subjects data were used for training; this process was repeated for all the subjects.The final result represents the average accuracy over all subjects.

Segmentation results
Figure 1 shows a sample of the results of the event-based segmentation algorithm over walking, stairs ascend, stairs descend and running activities.As it can be seen, events were detected accurately, with a limited variation depending on the activity type.

Stairs ascending Running
Figure 1.Gait events detection over four locomotors activities, where green, pink and red points represent MS, IC and EC respectively.
In particular, the algorithm mis-detected only 5 activity cycles (out of 1752): among them, one walking and one stairs ascend cycle was not identified because of lower MS; in one walking, stairs ascend and stairs descend cycle EC were not identified.All the running activity cycles were correctly identified.

Classification results
In order to understand the performance of the dynamic window (gait cycle), we compared the activity classification accuracy obtained from features extracted with the event-based segmentation technique with the ones extracted with different sizes of the fixed length window.For a fair comparison, sizes of the fixed length window were selected on the basis of the average activity cycle duration, and in such a way that the overall number of records would be similar to the number of records extracted from the event-based segmentation technique.Table 3 reports the average activity cycle duration as estimated with the segmentation technique, and the number of records that were used with the event-based segmentation and the different fixed length segmentation values.Readings show variations in activity cycle duration within the activities and within the subjects and none of the activity last for 1.5 s (100 samples /s).On the basis of the number of records (extracted window), comparison between the dynamic, 1 s and 1.25 s windows would be more interesting, as the number of records is similar to the ones of the dynamic segmentation.
Activity classification accuracy results will be reported into two different sections, corresponding to the two different datasets.

BioLab³ dataset
Figure 2 shows that the average performance of the dynamic window is higher than all static windows in both cases.
Classification performance of the dynamic window on FS1 and FS2 is pretty high (> 95% and > 90%, respectively), with less variation among the subjects.Whereas, accuracy obtained on 1s and 1.25 s windows is less than 90%, giving high variation among the subjects.1.5 s window performance is high from the rest of the static windows but a significant difference from dynamic window.

PAMAP2 dataset
For this second dataset, performance on different segmentation methods is less than 90% on FS1 while on FS2 accuracy increases significantly.Figure 3 shows the classification accuracy on PAMAP2 dataset.
Event-based dynamic segmentation performs slightly better than 1.5 s fixed window size window with both feature sets, and it is associated with a slightly higher variability than 1.5 s window size for FS1.

Figure 2. Classification accuracy for BioLab³ dataset
In regards to the datasets, classification accuracy was shown to depend on the feature set.As the sensor position is different in the two used datasets, feature set obtained on one dataset might be not good enough to represent the information for the other one.In the

Samples Samples
BioLab³ dataset, however, the average accuracy obtained with both feature sets has been shown to be higher than 90% for the event-based segmentation.

DISCUSSION
We evaluated the activity recognition performance on two datasets with different segmentation methods and feature sets.Four different locomotion activities were targeted in our dataset that were also present in the benchmark dataset.
We found that the proposed event-based dynamic segmentation technique correctly identifies almost all the activity events (>99% in both datasets).Catalfamo et al. algorithm detected more than 98% correct events in level and incline walking [9] and Formento et al. obtained values higher than 93% in stairs walking [16].Salarian et al. found 100% correct gait events in walking activity, where algorithm detects swing phase peak and find initial and end contact events within backward and forward windows from swing peak [11] and similar method is used in [13].All mentioned studies detect the events based on small windows and only Chen et al classified the activities and reported average accuracy higher than 93% [13].Regarding the classification results, performance of the neural network on the proposed event-based dynamic segmentation is higher (>95%) than that obtained with the relevant fixed window sizes.While a number of studies encouraged the use of fixed window size segmentation for activity recognition problem, the results obtained in this work seem to go in the other direction, as these results are better than the ones obtained by Hong et al. [6] (93.78%), Lee et al. [8] (86-92%, with 10 s of window size) and Wang et al. (93.3%) [7].Fixed window size can thus be sub-optimal when activities last for significantly shorter or longer time periods than the window length, or when activity durations vary over time.To compensate for this problem, event-based dynamic segmentation is a viable solution, if it is sufficiently accurate in detecting events.