Preprocessing of accelerometer data
The model learning and validation sub-module decompose the three-dimensional accelerometer signal into horizontal and vertical components
to make them orientation independent [1]. Further, it applies the windowing
function on the orientation independent signals for analysis of accelerometer signal, and feature extraction and selection. We have used the windows of different lengths and overlaps, and found that the window of 128 samples and 50% overlap
gives better results among all.
In the following, we describe the procedure of decomposition of accelerometer data into horizontal and vertical components
.
Decomposition of accelerometer data
The steps for decomposition of accelerometer data into horizontal and vertical components.
Apply the
windowing operation
ofIntervalLength
data-point on the accelerometer records.Compute the
Gravity
vector as a mean of the accelerometer data over the windowed records.The
vertical component
\(v\) is the dot product of accelerometer and gravity vector.The
horizontal component
\(h\) is the remaining part of the accelerometer.
Observations from accelerometer data
We have compared the recorded trip data with the Human Activity Recognition (HAR) data-set record [2]. Following Figure shows the horizontal and vertical accelerometer components for the recorded trip data and HAR records. It also depicts the Short Term Fourier Transform (STFT) plot to describe the time–frequency characteristics for the window of 128 samples and 50% overlap. We observed that the accelerometer signals for recorded trips are not comparable with the HAR data-set that was recorded in-lab environment. Instead, the signals for sitting and standing inside the bus are comparable with the HAR walking signal. We also observed that the vibration (magnitude) of accelerometer signal for standing inside the bus were significantly lower than sitting inside the bus. Moreover, Anguita et al. [2] concluded that sitting and standing are static postures and hence difficult to classify. In the case of commuter activity classifier, vibration feature aids to distinguish them accurately.
Further, we have observed that unwanted acceleration can hinder the classification of transport mode classifier and commuter activity classifier. This is because the accelerometer senses all kinds of acceleration, and in several scenarios, certain extraneous acceleration may result in misclassification. We have designed the segment extraction stage that fetches the meaningful segment from orientation independent acceleration signal and discards the extraneous acceleration segments. It processes
the windowed acceleration signal to identify the Triggers
for transport mode classifier and commuter activity classifier. Triggers
act as an enabling signal, which decides if a particular accelerometer segment would be used for classification. In the following, we describe the user movement trigger and stoppage segment trigger.
User movement trigger \((U_t)\)
The transport mode classifier gets activated if commuter module identifies the stepping event. The commuter would look for the seat on boarding the bus and also, during the course of his/her journey commuter might use mobile phone. These activities get added to accelerometer readings and lead to misclassification. Following figure also shows the effect of user movement in the bus on accelerometer signal. It depicts the horizontal and vertical acceleration components, and STFT plot for the window of 128 samples and 50 % overlap. The last column belonging to user activity shows an extraneous acceleration. We compute the user movement trigger for windowed acceleration signals that identifies and discards the user movement. The two consecutive acceleration windowed signals are considered as user movement and discarded in case the percentage change in the mean of acceleration signal is greater than \(U_t\).
Lu et al. [3] also applied triggers to discard extraneous signals in human activity classification and transport mode classification. Nericell [4] used to rely on detecting the orientation changes to capture stable segments. \(U_t\) has the similar effects. For our implementation, we have found the value of \(U_{t}\) to be \(0.8\) based on the experiments for recorded accelerometer readings. Thus, if the mean of the accelerometer reading for the consecutive windows
increases beyond 80 \%
, then these windows are discarded and considered as the user movement.
Stoppage segment trigger (\(S_t\))
Above figure shows the horizontal and vertical components plot, and STFT plot computed using the window of 128 samples and 50 % overlap for bus, car, and motor bike. It depicts that different types of vehicles have similar acceleration signal at a stoppage. These segments are not useful for transport mode classifier and results in misclassification. We compute the stoppage trigger for the windowed acceleration signals that identifies and discards the stoppage segments. The windowed acceleration
signal is considered as stoppage and discarded in case the relative standard deviation of acceleration signal is lesser than \(S_t\). For our implementation, we have found the value of \(S_t\) to be \(0.05\). Thus, if the relative standard deviation is lesser than 5 \%
, then the window is discarded and considered as a stoppage window.
Feature Extraction
Model learning and validation sub-module computes the features for the windowed acceleration signal using 128 samples and 50 \% overlap
that passes the segment extraction module. We have considered the wide range of features as used by [1], [2] , [5], and [6], namely set-1 and set-3 (Please refer following Table). The overlapping window reduces discontinuity and transition noise, and makes signal stationary. The energy ratio feature in following computes the energy in band B1: 0 to 1 Hz, B2:
1 to 3 Hz, B3: 3 to 5 Hz, B4: 5 to 16 Hz and the ratio between bands are computed as B1 / B2, B3 / B4, (B1+B2) / (B3+B4). Decision Tree (DT) and Support Vector Classifiers (SVC) are trained using these features.
Further, we have used the recursive feature elimination
[7] to derive reduced feature set-2 and set-4. The set-1 represents the wide range of features for accelerometer signal and jerk signal in time domain and frequency domain that sums to 256 features. Consequently, the feature set-1 requires more computation resource whereas set-4 represents the vibrations inside the vehicles with 14 features and requires lesser computation resource.
Split and Merge Classification
Lu et al. [3] examined the effect of phone placement on classification and observed that variation in phone placement results into decrease in classification accuracy. The authors presented the classifier merging approach to cater for the variation in phone placement. Our system also uses the classifier merging approach to cater for different positions. The classes sit and stand are split into subclasses sit (in hand), sit (shirt pocket), stand (in hand), stand (shirt pocket), stand (trouser pocket). The sub-class in parenthesis corresponds to the phone placement. The classifiers are evaluated using ten-fold cross-validation with stratified sampling for each class. Moreover, the resulting standing or sitting inference is of interest in commuter activity classification.
Opportunistic Activation of GPS
The commuter activity classifier identifies the commuter state to detect whether the commuter got a seat on boarding the bus or not. The commuter module associates the commuter state with the boarding location of the commuter to reflect whether the commuter who boarded the bus at the given location got a seat or needed to stand. Subsequently, during the course of the journey, whenever the state of the commuter changes, commuter module records the new state and the associated location. This procedure of recording the commuter data requires the use of GPS and accelerometer sensor. The research study shows that continuous location-sensing consumes considerable power [8]. Thus, to reduce power consumption, we have designed an algorithm for opportunistically activating the GPS. In the following, we describe the procedure used to record the commuter activity state.
Opportunistic procedure for commuter activity detection
When the commuter module activates the crowdedness detection, it initializes the empty state list \(S\) (line 1). Further, it identifies the commuter state \(S_i\) – standing or sitting and associates the state with the boarding location \(L\). The commuter state \(S_i\) and associated location \(L_i\) are appended to the list \(S\) (line 3). The associated location \(L_i\) includes a record of tuple \((ts, lt, ln, ac)\), where \(ts\) is the time stamp for the location record, \((lt\), \(ln)\) is the latitude and longitude of the location record, and \(ac\) is the estimated horizontal accuracy of the location (in meters) [9]. Subsequently, the commuter module deactivates the GPS service and relies on the commuter activity classifier to detect the change in the commuter state (line 4).
Whenever the state of the commuter changes (line 6), the commuter module activates the GPS service (line 2) and fetches the location \(L_i\) corresponding to the new state \(S_i\) . The new commuter state \(S_i\) and associated location \(L_i\) are appended to the list \(S\) (line 3). It then deactivates the GPS service and relies on the commuter activity classifier for further state changes during the commuter’s journey (line 4).
Additionally, the commuter module also analyzes the accelerometer data to detect user activity. In case the user activity is detected using user movement threshold \(U_t\), the commuter module activates the stepping detector to identify whether the commuter is alighting the bus (lines 9-10). If the commuter module detects the stepping event, it activates the GPS service to extract the speed of the commuter. In case the commuter module detected the steps and the movement speed of the commuter
is in the vicinity of normal walking speed, it acknowledges that the commuter has left the bus. In this case, the commuter module publishes the commuter list \(S\) to the server module using the MQTT protocol with the topic RouteID/UserID
, where RouteID
is the unique ID of the subscribed route and UserID
is the unique ID of the commuter (line 11).
References:
Wang, C. Chen, J. Ma, Accelerometer based transportation mode recognition on mobile phones, in: 2010 Asia-Pacific Conf. Wearable Comput. Syst., IEEE, 2010, pp. 44–46.
Anguita, A. Ghio, L. Oneto, X. Parra, J.L. Reyes-Ortiz, A public domain dataset for human activity recognition using smartphones, in: Esann,2013.
Lu, J. Yang, Z. Liu, N.D. Lane, T. Choudhury, A.T. Campbell, The Jigsaw continuous sensing engine for mobile phone applications, in: Proc. 8th ACM Conf. Embed. Networked Sens. Syst., SenSys 2010, ACM, 2010, pp. 71–84.
Mohan, V.N. Padmanabhan, R. Ramjee, Nericell: Rich monitoring of road and traffic conditions using mobile smartphones, in: Proc. 6th ACM Conf. Embed. Networked Sens. Syst., SenSys ’08, ACM, New York, NY, USA, 2008, pp. 323–336.
Hemminki, P. Nurmi, S. Tarkoma, Accelerometer-based transportation mode detection on smartphones, in: Proc. 11th ACM Conf. Embed. Networked Sens. Syst., SenSys 2013, ACM, 2013, p. 13.
Figo, P.C. Diniz, D.R. Ferreira, J.M. Cardoso, Preprocessing techniques for context recognition from accelerometer data, Pers. Ubiquitous Comput. 14 (7) (2010) 645–662.
Guyon, J. Weston, S. Barnhill, V. Vapnik, Gene selection for cancer classification using support vector machines, Mach. Learn. 46 (1–3) (2002) 389–422.
Zhuang, K.-H. Kim, J.P. Singh, Improving energy efficiency of location sensing on smartphones, in: Proc. 8th Int. Conf. Mob. Syst. Appl. Serv., ACM, 2010, pp. 315–330.
Location – Android developers, in: Android Dev., 2019, URL https://developer.android.com/reference/android/location/Location. (Accessed 15 April 2019).