Abstract
Physical activity (PA) recognition has recently become important in activity monitoring for the public healthcare. Although body-worn sensors are well suited to collect data on activity patterns for long periods of time, users may forget to wear special microsensors. On the contrary, more and more people take smartphone with them almost anytime. At present, most popular smartphones have three built-in kinematic sensors (triaccelerometer, gyroscope, and magnetic sensor) which could be utilized to recognize PA. This study utilized three built-in kinematic sensors in a smartphone to recognize PA and found out which features derived from the three sensors were significant to different PA. We used a combined algorithm of Fisher's discriminant ratio criterion and
1. Introduction
Physical activity (PA) recognition has recently become important in activity monitoring for the public healthcare. The progressive decline in the PA level due to the adoption of sedentary lifestyles has been associated with the increasing incidence of obesity, diabetes, and cardiovascular diseases [1, 2]. In addition, a “long lie” caused by a fall may result in negative psychological and physical outcomes [3]. The fear of falling can lead to a further decrease of physical activity. Thus, a reliable PA recognition system in daily life would not only encourage people to do more outdoor activities but also be an assessment of activities of daily living for chronic treatment.
Body-worn sensors [4, 5] are well suited to collecting data on activity patterns for long periods of time. In contrast to other approaches, such as laboratory-based systems [6] or video analysis [7, 8], they can be used under conditions of free living with minimal inconvenience to the user [9]. However, users may forget to wear these special microsensors. At present, smartphone is a fast-growing device which people take with it anytime. Most of state-of-the-art smartphones have the built-in kinematic sensors (such as triaccelerometer, gyroscope, and magnetic sensor), Global Positioning System (GPS), Wi-Fi, Bluetooth, camera, proximity sensor, microphone, and so forth.
The built-in kinematic sensors of smartphones are used to recognize PA, which not only reduces the cost of hardware but also exploits existing communication module and ubiquitous monitor. The previous studies have demonstrated the effectiveness of using a smartphone to detect a fall [10]. Acceleration was measured by two devices, a smartphone and an independent accelerometer, to confirm that fall detection using a smartphone is a feasible and highly attractive technology.
Most of the previous studies [10–12] only used accelerometers to research PA recognition. In our earlier study [13], we also utilized accelerometer built in a smartphone to detect falls and raised the alarm by Multimedia Messaging Service (MMS). However, acceleration only reflects the change of PA in linear acceleration, but angular velocity and orientation information were not reflected by an accelerometer.
There are several studies using the combination of accelerometer, gyroscope, and magnetic sensor. Zhang et al. [14] evaluated a continuous activity recognition system, using three small wearable wireless sensors and a smartphone to store, transmit, analyze, and update data. Three sensors, each composed of a triaxial accelerometer and a triaxial gyroscope, are attached to the chest and both thighs. The recognition algorithm was developed using a decision tree based on time series data and spectrum analysis. Bahle et al. [15] found a particularly interesting result that adding the magnetic disturbance features significantly improves recognition based on the vector norm of accelerometers and gyroscopes. Chiang et al. [16] measured essential movements of human body through wireless sensor network body motion sensors that involve the accelerometer and gyroscope. Activities are recognized by the fuzzy algorithm. Jeannet et al. [17] used a monitor containing a 3D accelerometer and a gyroscope fixed on the subject's tee-shirt, on the chest. Multiple sensors systems could identify physical activity in a more refined way by recognizing subactivities such as jogging or rowing, due to the fact that a bigger amount of information on the body motion can be collected. However, the more the sensors were employed to record physical activity, the higher the interference of the measuring system with the spontaneous behavior of the user [18]. Therefore, the development of simple, small and light-weight systems to monitor physical activity in daily life should be recommended.
The aims of this study were to utilize the built-in kinematic sensors (triaccelerometer, gyroscope, and magnetic sensor) of a smartphone to recognize PA and find out which features derived from the built-in kinematic sensors were significant to recognize PA. This work will make the assessment of activities of daily living and fall detection more ubiquitous and portable.
The rest of the paper is organized as follows: Section 2 provides the method of the PA recognition. The experimental results and discussion are presented in Sections 3 and 4. Finally, Section 5 concludes the paper.
2. Methods
The block diagram of the main data processing scheme was described in Figure 1. The built-in accelerometer, gyroscope, and the orientation sensor of a smartphone collected information which reflected acceleration, angular velocity, and orientation of PA. And then features were extracted from the information, and the optimal features were selected. Subsequently, all activities were classified, and if a fall was detected, the alarm information about the location of the fall would be sent to the preset person by MMS.

The block diagram of the main data processing scheme.
2.1. Device and Data Collection
A smartphone (Samsung I9023 Nexus S,

The coordinate system and the placement of the smartphone at the chest of a subject.
The smartphone has built-in triaxial accelerometer (STM KR3DM) with 19.6 m/s2 maximum range and 0.019 m/s2 resolution, triaxial gyroscope sensor (STM K3G) with 34.9 rad/s maximum range and 0.0012 rad/s resolution, and triaxial magnetic field sensor (Asahi Kasei AK8973) with 2000 μT maximum range and 0.0625 μT resolution. An application software of PA recognition was developed and installed on the smartphone. This application measured the acceleration, angular velocity, and orientation of the smartphone.
The standard sensor coordinate system of the smartphone is defined relative to the screen. As shown in Figure 2, the x-axis (
The coordinate system of the accelerometer is the same as the standard sensor coordinate system. The accelerometer measures acceleration along
The coordinate system of the gyroscope is the same as the one used for the accelerometer. Rotation is positive in the counterclockwise direction. Gyroscope measures the rate of rotation around
The orientation sensor is software-based and derives its data from the accelerometer and the geomagnetic field sensor. The orientation sensor monitors the position of the smartphone relative to the earth's frame of reference and measures azimuth (
In Android operating system, four different sampling frequencies (fastest, game, normal, and UI) of sensors can be selected. The values of the four frequencies are not constant and depend on the computational workload of the smartphone. The fastest sampling frequency is selected and can reach 50 Hz normally. The acceleration, gyroscope, and orientation signals were sampled at 25 Hz and stored on a Secure Digital (SD) card in the smartphone. Table 1 showed the descriptions of activities performed by a subject. Ten healthy volunteers (6 males, age:
Description of activities performed by a subject.
2.2. Feature Extraction
The sliding window approach was employed to divide the sensor signal into smaller time windows (Figure 3). At a sampling frequency of 25 Hz, each window with 50% overlap represents 1.6 seconds. The features were extracted from the sliding windows signals for activity recognition.
(1) Signal Magnitude Vector (2) Tilt angle (TA) of body trunk TA is defined as the angle between the positive

The sliding window of the data from the accelerometer, the gyroscope, and the orientation sensor during running. The window slides one time such as the blue-dotted rectangle moves to the blue solid one.
As shown in Table 2, seven kinds of statistical features were defined and described. And all statistical features of each signal were calculated at each window. So 140 features were extracted from the acceleration, angular velocity, and orientation measured by the built-in kinematic sensors of the smartphone.
Definitions of statistical features.
Definitions of features.
2.3. Feature Selection and Classification
A combined algorithm of Fisher's discriminant ratio (FDR) criterion and
Then the 10 highest-ranked features were selected. And the exhaustive search method with the
Furthermore, large values of
A hierarchical classifiers system was shown in Figure 4. According to level of intensity of physical activity, Classifier 1 was used to differentiate between static and dynamic activity. Likewise, Classifier 3 and Classifier 7 utilized the level intensity of activity to recognize high level of intensity of physical activities, such as falls, jumping, and running. In addition, Classifier 2 employed tilt angle (TA) of body trunk derived from accelerometers to identify lying from sitting/standing.

The classifiers flowchart. All abbreviations in this figure were shown in Table 1; for example, “R” represents “Running.”
Moreover, Classifier 5 was employed to classify jumping and falls. Falls are said to have occurred if at least two consecutive peaks in the signal magnitude vector above a defined threshold are recorded [20]. According to the orientation, falls were divided into the categories of right-side fall (FR), left-side fall (FL), backward fall (FB), or forward fall (FF).
Furthermore, there were no obvious features to classify some certain activities, such as walking, walking downstairs and walking upstairs. In a classifier, all possible combinations splitting the activities were exhaustively formed, and for each combination its
3. Results
3.1. The Features Selected
The scatter graphs of part classifiers were shown in Figure 5. The symbols of pluses and circles indicated points into the two classes of classifiers, respectively. In addition, Figure 5 pointed out the combinations of selected features resulted in well separated classes in the 2-dimensional feature space.

The scatter graphs of part classifiers. (a) The scatter graph of C3. (b) The scatter graph of C4. (c) The scatter graph of C8. Pluses and circles indicated points into the two classes of classifiers, respectively.
As shown in Table 4, twenty-eight well selected features for fourteen classifiers included nineteen features derived from accelerometer, six features derived from gyroscope and three derived from the orientation sensor.
The selected features of all classifiers.
In these three sensors, accelerometer was dominant to PA recognition. In addition, gyroscope served well in recognizing the change of body posture such as transitions, and the orientation sensor was effective to detect falls. As illustrated in Figure 6,

Data obtained during four kinds of falls (forward fall, left-side fall, right-side fall, and backward fall). The dotted red rectangles were amplified to observe details. The features from the orientation sensor were effective to detect falls.
3.2. The Application of PA Recognition in the Smartphone
Figure 6 illustrated the application of PA recognition implemented in the smartphone when a subject changed the motion from motionless to walking. The green line indicated the SVM value of the accelerometer in real time. Five common activities (jumping, running, walking, lying, and motionless) can be represented by the blue line.
3.3. The Recognition Results for All Activities
We used hold-out method [21] to estimate the classifiers, which partitions the data into two mutually exclusive subsets: a training set and a test set. A set of experiments was performed with 10 subjects, with each performing a set of 16 different activities as described in Table 1. 600 windows were randomly divided into two parts: a training set (400 samples) and a test set (200 samples).
The confusion matrix in Table 5 was a representative of recognition errors for the test set. From the confusion matrix, we can see that walking may be misclassified as walking upstairs or walking downstairs, because these activities contain similar movements and frequencies at the lower limbs. In addition, falls may be recognized as sit-to-lie, because the posture of the two activities were lying at last. The accuracies of static, transitions, dynamic, and falls were 98.75%, 94.625%, 91.8%, and 97.63%, respectively. A total recognition rate of 95.03% achieved that our proposed PA recognition system based on the smartphone could accomplish high recognition rates for the fifteen activities. The application of PA recognition was displayed in Figure 7. The green line indicated the SVM value of the accelerometer real time, and the blue line presented the PA.
Representative confusion matrix.
Key: lying = a; sitting/standing = b; lie-to-sit = c; sit-to-lie = d; sit-to-stand = e; stand-to-sit = f; walking = g; walking upstairs = h; walking downstairs = I; running = j; jumping = k; forward fall = l; right-side fall = m; backward fall = n; left-side fall = o.

The application of PA recognition implemented in the smartphone. The green line indicated the SVM value of the accelerometer real time, and the blue line presented the PA.
4. Discussion
A PA recognition system based on a smartphone was developed. The optimal features derived from the built-in kinematic sensors of the smartphone were selected from 140 features for each classifier.
In the previous studies [22, 23], the recognition rates of walking, walking upstairs, and walking downstairs were low, caused by the similarity of these three activities (Figure 8). In this study, the three classes were well separated. Figure 9 presented the scatter graphs of three activities (walking, walking upstairs, and walking downstairs), employing a combination of

Data obtained during walking, walk downstairs, and walk upstairs.

The scatter graphs of three activities, employing a combination of GyStd, A3aStd, and G3aStd. Pluses, circles, and dots indicated points from walking, walking upstairs, and walking downstairs, respectively.
The PA recognition system based on the smartphone provided several advantages, such as existing communication module and ubiquitous monitor. The previous studies have used Short Messaging Service (SMS)[10] or Multimedia Messaging Service (MMS) [13] to send information of a fall to a guardian. In an earlier study, we warned falls of the elderly to a guardian by MMS including time, map of suspected fall location, and GPS coordinate. When a fall was detected, an automatic MMS would be sent to preset people. According to the convenient communication module of smartphones, more information of PA could be sent in real time. A remote PA recognition system based on a private cloud platform [24] will be developed in our future work.
The main limitation of our approach is that the smartphone must be worn on the chest. People put phones in the pocket of shirts or pants according to their respective habits, which would cause loose attachment between the body and smartphone resulting in the invalidness of the algorithm eventually. Khan et al. [25] used linear discriminant analysis to recognize PA based on a single triaxial accelerometer that allowed subjects to carry the sensor freely in any pocket without firm attachment. In future work, we plan to develop a PA recognition system based on a smartphone according to wearing habits of users.
5. Conclusion
For this study, the optimal features derived from the built-in kinematic sensors of the smartphone were selected to recognize PA. The results of selected features suggested the accelerometer was significant to PA recognition, and gyroscope and orientation sensor were effective to recognize the change of body posture or detect falls, respectively. Despite the limitations of this system which requires firm attachment of the smartphone to a subject, the experimental results demonstrated the feasibility of utilizing the built-in kinematic sensors of the smartphone to recognize PA.
Footnotes
Acknowledgments
This work was supported in part by the National S&T Major Project of China (no. 2011ZX03005-001), Guangdong Province and Chinese Academy of Sciences Comprehensive Strategic Cooperation Project (no. 2011A090100025), and National Natural Science Foundation of Youth Science Foundation (no. 31000447).
