Abstract

Pedestrian dead reckoning (PDR) is an essential technology for positioning and navigation in complex indoor environments. In the process of PDR positioning and navigation using mobile phones, gait information acquired by inertial sensors under various carrying positions differs from noise contained in the heading information, resulting in excessive gait detection deviation and greatly reducing the positioning accuracy of PDR. Using data from mobile phone accelerometer and gyroscope signals, this paper examined various phone carrying positions and switching positions as the research objective and analysed the time domain characteristics of the three-axis accelerometer and gyroscope signals. A principal component analysis algorithm was used to reduce the dimension of the extracted multidimensional gait feature, and the extracted features were random forest modelled to distinguish the phone carrying positions. The results show that the step detection and distance estimation accuracy in the gait detection process greatly improved after recognition of the phone carrying position, which enhanced the robustness of the PDR algorithm.

1. Introduction

With the rapid development of information technology, reliable location-based service (LBS) applications are becoming more and more widely used. LBS applications have become a research hotspot in the current academic and navigation information service industries [1]. Due to the development of global satellite navigation systems, positioning in outdoor environments has met people’s needs, but problems such as signal occlusion and multipath effects make it impossible to use satellites for effective positioning in indoor environments. With the development of smart devices, the demand for indoor positioning technology based on smartphones is growing. Smartphone positioning technology mainly includes radio frequency technology, map-matching technology, and inertial navigation technology. Smartphones support wireless frequency signals such as low-energy Wi-Fi and Bluetooth, which are the main methods used by smartphones for indoor positioning. Smartphones’ indoor map-matching technology includes methods based on particle filters, hidden Markov models, and geometric similarities, but the practicability and accuracy of these methods have not been guaranteed [2, 3]. Pedestrian dead reckoning (PDR) is the inertial navigation positioning method used by smartphones; it has strong independence and is one of the main methods of indoor positioning [4].

As an LBS positioning technology, PDR is widely used in indoor environments. The main steps are gait detection, heading estimation, and position estimation. When a pedestrian walks, the position in which they carry their mobile phone is not fixed. Common carrying positions include horizontally on the chest, swinging in the hand, making a call, and inside a backpack. At different positions, the motion data obtained by the sensor contain jitter noise of different amplitudes [5]. Therefore, identification of the various carrying positions of mobile phones and setting their corresponding gait detection parameters have great significance for the robustness and scalability of the enhanced PDR algorithm.

Scholars have already had a good effect on pedestrian gait recognition in a single state. In terms of gait detection, Jang et al. [6] proposed that the horizontal acceleration and vertical acceleration of pedestrians can be modelled as sinusoidal waveforms. By detecting the number of peaks and troughs of the waveform and combining the gait patterns of pedestrians, step number can be identified. Li et al. [7] used the sliding window method, the peak detection method, and the zero point crossing method to perform step detection. Huang et al. [8] proposed a gait detection method by evaluating autocorrelation information of acceleration and angular velocity. Based on the gyroscope’s better sensitivity than accelerometers, Mannini and Sabatini [9] proposed a hidden Markov model (HMM) gait segmentation method. In terms of step size estimation, Weinberg [10] explores the relationship between the maximum and minimum values of vertical acceleration and the step size and establishes the Weinberg formula. Kim et al. [11] developed an empirical method based on the correlation between average acceleration and step size. Lee [12] used the factors of acceleration amplitude, step frequency, and swing angle to establish a linear combination model of step size estimation. Tian et al. [13] designed a step-by-step empirical model based on the pedestrian’s height and stride frequency. Fengtao et al. [14] proposed a step size estimation method based on fuzzy logic algorithm. Based on the previous studies, the author proposes a gait detection algorithm under different carrying positions in the literature [5] and proposes a step estimation model based on real-time stride frequency, in which the detection accuracy of steps in a single state reaches 99%, 50 m. The cumulative error of the step size under the test distance is less than 0.3 m.

Two types of mainstream technologies are used for the identification of different mobile phone carrying positions. The first is based on visual image recognition [15]. This technique has relatively high recognition accuracy in an experimental environment with relatively few personnel. However, when the number of people is relatively large and their behaviour is complicated, this technique is difficult to use. In addition, visual recognition algorithms are complex and can easily reveal private user information. The second type of identification technology is sensor-based state recognition [16]. The sensor can obtain more accurate information on the user and environmental parameters, and it has perceptual concealment, so it has been increasingly favoured by researchers. Domestic scholars Fan and Wang extracted the essential characteristics of behaviour from acceleration data for mobile phone carrying positions (bag, trouser pocket, and hand) and generated various vector models. The final position recognition rate reached 80.29% [17]. Miao et al. placed smartphones in left and right coat pockets and front and back trouser pockets in six common positions. Light and distance sensors were used to determine whether the phone was in the pocket, and a decision tree algorithm was used to identify and classify the position according to other sensor signals. The classification accuracy rate was 89.6% [18]. Coskun et al. studied three carrying positions—hand, bag, and pocket—using information from a single acceleration sensor, which used angle information to improve the devices’ position recognition rate, but some positions were poorly identified [19]. From the location of the identification device, Grokop et al. studied the behaviour recognition of smartphones in various locations and generated their location vectors by acquiring data from the accelerometer, light sensor, distance sensor, and camera and extracting, classifying, and identifying features. The accuracy rate reached 92.6% [20]. Scholars have made some achievements in research on the carrying position of equipment, but there is still vast room for improvement in actual indoor positioning and navigation.

Based on the above findings, this paper proposes a multimode PDR gait detection algorithm based on the identification of the pedestrian phone carrying position of PCA/RF algorithms by studying the relationship between mobile phone inertial devices and the mobile phone carrying position. The mobile phone carrying position during the pedestrian’s normal walking behaviour is identified, thereby widening the applicable scenario of the PDR algorithm and providing better, more precise location-based services for the user.

2. Inertial Signal Features of Mobile Phones under Different Carrying Positions

To distinguish the various mobile phone carrying positions, the original inertial data collected by the mobile phone in various carrying positions are first analysed. The aim of this study is closely related to the attitude of the mobile phone, but the module value of accelerometer measurement and gyroscope measurement cannot accurately reflect the attitude information of the mobile phone [21]. Thus, the three-axis vector data of the accelerometer and gyroscope are selected as the basic reference data for the study. Usually, the acceleration data obtained by the IMU contain the gravity component, so the scholars remove the gravity component in advance when performing IMU-based PDR positioning. In the research of smartphone sensor, the research found that the smartphone has a linear accelerometer sensor, and the recorded data are the carrier acceleration that removes the influence of gravity. Therefore, this study selects it as the source of acceleration data. Figures 1 and 2 show the original accelerometer and gyroscope measurements of the mobile phone in various carrying positions.

Figures 1(a)1(d) show the original acceleration data for the mobile phone in the horizontal chest position, the swinging hand position, the position used to make a call, and the backpack position.

Figures 2(a)2(d) shows the original gyroscope measurements for the mobile phone in the horizontal chest position, the swinging hand position, the position used to make a call, and the backpack position.

A comparison of the original data in the four mobile phone carrying positions in Figures 1 and 2 shows that the amplitudes of acceleration and angular velocity differ in the various carrying positions, especially in the swinging hand position, which is significantly higher than the other two. From here, we can begin to extract the swinging hand position. However, the variation in the inertial signal is similar in the other three positions and is difficult to distinguish from the surface layer. The feature extraction method should be adopted to extract the features of the other positions, and then, position distinction should be performed.

3. Pedestrian Mobile Phone Carrying Position Recognition Algorithm

The attitude of the mobile phone differs among various positions. Although the accelerometer and gyroscope have no correlation between the three axes and the two axes, a correlation exists between the three axes when the pedestrian moves. The methods used include splitting the window of original data, analysing the correlation between three axes in the window and uniaxial statistics, forming a feature matrix, and using the random forest [22], K-nearest neighbour [23], decision tree, or support vector machine. A classification recognition algorithm is used to model the extracted features, and the model is then used for position recognition.

Recognition of the carrying position of the pedestrian mobile phone can be divided into three steps: first, extraction of the features of the inertial signal of the mobile phone in various carrying positions; second, selection of the extracted features; and third, training the selected feature to obtain the classifier and using this classifier for classification and identification.

3.1. Signal Feature Extraction of Accelerometer and Gyroscope

In sensor-based pedestrian gait and motion recognition research, the current commonly used time domain features are mean, standard deviation, root mean square, skewness, kurtosis, variance, and covariance [24]. The mean value can reflect the overall energy of the exercise and can be used to distinguish obvious changes in the state of motion; the variance has been proven appropriate for distinguishing between “walking,” “jogging,” and “jumping” activities with certain precision [25], and the covariance between the uniaxial axes reflects the correlation of the axes in motion and the correlation with the state of motion. Therefore, this study extracted the mean, variance, and interaxis covariance of each axis in motion for time domain feature analysis. Their calculation methods are as follows:where N represents the length of the window and Si,n represents the data for the nth epoch on the ith axis.

3.2. Feature Selection Algorithm

In the feature extraction stage, to obtain more information about pedestrian mobile phone carrying positions, as many feature extractions as possible are performed, which leads to too many features, some of which may be unrelated or redundant to the mobile phone carrying position. Therefore, it is necessary to use a feature selection algorithm to filter out related features with large correlations and improve the classification accuracy. This paper uses the principal component analysis (PCA) [26] algorithm to reduce feature data dimensionality.

PCA is an effective feature linear transformation method proposed by Pearson in 1901. It is widely used in pattern recognition and signal processing. In essence, high-dimensional features are linearly transformed to obtain the feature vector of the original feature, that is, the principal component, with the first few selected as the new feature combination, so that the main information from the original data can be preserved to the greatest extent. The main principles are as follows.

Let each sample have a t-dimensional feature, then one sample can be represented as X = (x1, x2, …, xt), which requires the construction of t new features, (y1, y2, …, yt), and make them meet the following conditions:(1)The new features are obtained by a linear combination of the original features.(2)The new features are irrelevant.(3)The obtained new feature y1 has the largest variance, with y2 the second-largest. Then, (y1, y2, …, yt) are the 1st, 2nd, …, tth principal components.

The calculation steps are as follows:(1)Calculate the covariance matrix of X:where X is the sample feature set and is the average of the feature vectors.(2)Calculate the t eigenvalues of the covariance matrix S and the corresponding eigenvector .(3)The obtained eigenvalues are sorted from large to small, and the top m are selected. The eigenvector matrix corresponding to the m eigenvalues is , and the value of m can be determined according to the following formula:where represents the energy loss rate. Finally, a new eigenvector consisting of the m features is obtained:

3.3. Classification Identification

In pattern recognition, various machine learning algorithms influence the recognition effect [27]. In general research, the supervised classification method is used, which includes two stages: the learning/training stage and the pattern recognition/verification stage. The learning/training stage obtains a model via data acquisition, and the pattern recognition/verification stage uses the model to perform pattern classification and recognition.

Common classification methods are random forest, K-nearest neighbour, decision tree, Bayesian decision, support vector machine, and others. This study found that the random forest algorithm has the highest recognition rate via multiple attempts and algorithm optimisations, so it is adopted as the main algorithm to recognise the mobile phone carrying positions.

3.3.1. Random Forest Algorithm

The base classifiers of the random forest algorithm are decision trees. The model is shown in Figure 3. The training sample S is a sample set of sensor data that contain the carrying position information of the pedestrian’s mobile phone, and self-sampling is performed, that is, there is a random return from the S, and k new sample sets are constructed. The k decision trees generated by the sample set then constitute a random forest model that distinguishes the carrying position of the pedestrian’s mobile phone. The classified data are input into the model to obtain k classification results, and the final random forest classification result, that is, the carrying position information of the pedestrian’s mobile phone, is obtained by the voting algorithm.

The specific process of generating a random forest is as follows:(1)k samples are randomly selected to construct new sample sets from the training sample S, thereby constructing k classification trees, and each unselected sample constitutes k out-of-bag data.(2)The sample has d attributes (extracted features from the mobile phone accelerometer and gyroscope signals). Randomly extract h attributes (h < d) at each node of each tree, and then use an information gain strategy to select one optimal attribute from the h attributes as the split attribute of the node.

Let vectors X and C represent the sample attribute (x1, x2, …, xd) and the category attribute (c1, c2, …, cd), The information gain between a given attribute X and the associated category attribute C can be calculated using the following equation:wherewhere P(C = ci) is the probability that the category attribute ci appears, andwhere is the information gain of attribute X for category C, is the entropy of C, and is the average conditional entropy of C. Here, X represents the acceleration and gyroscope characteristics extracted from the training datasets and C represents the different carrying positions (flat, swinging in the hand, making a call, and in the backpack) of the mobile phone.

When dividing the decision tree attributes, one optimal attribute is selected among the d attributes of the current node; that is, the random forest is introduced through k rounds of training, and the random forest algorithm obtains a decision tree classifier set:(3)In the process of forming each tree, each node must be split according to step (2) until it can no longer be split. During this process, pruning of the decision tree is not performed.

Each decision tree in a random forest is built on an independent sample, and each tree has the same distribution. The classification error depends on the classification ability of each tree and the correlation between them. Only one decision tree has a limited classification ability, but after random generation of many decision trees, the algorithm can count the classification results of each tree, then vote to select the most likely classification result, and improve the classification accuracy of the random forest as a whole [15].(4)All of the k generated trees are composed of random forests, and the new data are discriminated and classified by the random forest classifier. The classification results are determined by the number of votes of the tree classifier, as follows:where indicates the integrated classifier, is the base classifier, Y indicates the output classification result, and is the indicative function.

The randomness of random forests is reflected in the fact that the training samples of each tree are random, and the classification properties of each node in the tree are also randomly selected. It is precisely because of these two random guarantees that the random forest avoids overfitting. In the construction of random forests, there are two parameters must be controlled by humans. One is the number of trees in the forest. The use of a large number is generally recommended. The other is the number of h attributes when building the tree. Generally, h is the root mean square of the number of sample attributes.

3.3.2. System Structure

The preprocessed three-axis accelerometer and three-axis gyroscope signals are characterised by feature extraction and feature selection, to obtain the signal characteristics that best reflect the different carrying positions of the mobile phone. The feature information obtained by sample processing is input into the random forest for model training, the model is used to identify the test samples, and the recognition result is compared with the real result to obtain the recognition rate of the model. The specific system flow is shown in Figure 4.

4. Experiment and Result Analysis

The research designed the experiment to verify the reliability of the algorithm and processed the inertial signals in different carrying positions of the collected mobile phones. Furthermore, this paper used the processed signal features to distinguish the carrying positions, and then gait detection was performed to obtain pedestrians’ real-time travel step number and distance.

4.1. Experimental Data Collection

InvenSense’s inertial sensors are widely used in smartphones with consistent performance. Therefore, this study selects the MeiLan Note3 smartphone with an InvenSense inertial sensor and high sales as the data collection platform. The main accelerometer and gyroscope parameters are shown in Table 1.

The experimental site is the 5th floor of the J6 Teaching Building of Shandong University of Science and Technology (Figure 5 is a plan view of the experimental site). Experimenters walked straight along the corridor with a normal gait. They placed the mobile phone in the horizontal chest position, the swinging hand position, the position used to make a call, and the backpack position.

By studying the daily behaviour of pedestrians, it is found that the switching process of the carrying position of the smartphone is generally completed within 2-3 seconds. Therefore, the progress of the experiment must be at least greater than the process, but it cannot be too large. Too large will mask the accuracy of the recognition algorithm. By considering the experimental site and the experimental personnel and other factors, it is decided to adopt five sets of data which were collected for each position for 50 steps.

4.2. Feature Extraction Results

The collected original inertial signal was processed to obtain a signal characteristic that could reflect the position of the smartphone. According to the inertial signal characteristics corresponding to different carrying positions, a random forest classification model was established.

4.2.1. Feature Extraction and Selection

Time domain feature extraction was performed on the collected data, and the gait points were combined to analyse the corresponding time domain features of each step. The location identification features of the mobile phone and their descriptions are shown in Table 2.

After these steps, 18 features were extracted, as shown in Figure 6.

Figures 6(a)6(d) present the features extracted by the inertial data acquired with the mobile phone in the horizontal chest position, the swinging hand position, the call making position, and the backpack position.

Figure 6 shows that some of the features are irrelevant to the position of the mobile phone. The main finding is that the feature characteristics are similar in the various carrying positions. Therefore, data dimensionality reduction is needed to eliminate the unrelated features. The contribution rates of the extracted features were analysed, and Figure 7 shows the contribution of the extracted features to several carrying positions.

Using the PCA method, 18 sets of feature data were analysed and dimensionality-reduced, and the data reduction to 5 dimensions was calculated using formula (5). The dimensionality-reduced data retain the relevant sensitive features to the greatest extent, while ensuring computational efficiency. Figure 8 shows a comparison of different experimental data before and after the dimensionality reduction.

Figures 8(a), 8(c), 8(e), 8(g), and 8(i) and 8(b), 8(d), 8(f), 8(h), and 8(j) present the spatial distribution of the corresponding sample points before and after the dimension reduction of the five sets of collected feature data. They show that the PCA method is better for the same sample after dimension reduction and that the sample points of various classes are more distinguishable. In addition, as the data dimension of the feature is reduced, the calculation of the later modelling and the classification is reduced, and the efficiency is improved.

4.2.2. Mobile Phone Carrying Position Identification Model

Through a series of processing actions and analyses of original sensor data, a set of samples were obtained to identify mobile phone carrying position. To use the information from the various mobile phone carrying positions to improve the gait detection accuracy of the PDR during complex motion, it is necessary to accurately identify the mobile phone carrying position. This paper first uses different classification models to model the characteristics of different mobile phone carrying positions. Figure 9 shows the modelling accuracy of the different classifiers.

The data shown in Figure 9 denote the average modelling accuracy obtained by using five sets of data. The figure shows that the random forest algorithm has the best modelling accuracy for the various mobile phone carrying positions. Therefore, this study uses the random forest model as the main model for identification.

4.2.3. Determination of Modelling Parameters of Random Forest Classifier

Random forest classifiers are fast, can avoid overfitting very well, and can process large amounts of data. In theory, the greater the number of decision trees in a random forest, the higher the modelling and classification accuracy. However, an excessive number of decision trees will increase the amount of calculation and the time required.

In this paper, the relationship between the number of decision trees in random forests and the accuracy of out-of-bag classification of classifiers is analysed under the premise of ensuring higher classification accuracy, as shown in Figure 10. This provides theoretical support for a more reasonable determination of the number of decision trees in the random forest model.

By analysing the relationship between the classification error of the random forest model and the number of decision trees, as shown in Figures 10(a) and 10(b), it is found that with an increase in the number of decision trees, the classification error of the random forest model gradually decreases, and it tends to remain stable with 70 trees. Therefore, the number of decision trees used to set up the random forest model in this experiment is 70.

4.3. Identification Results and Analysis

The established random forest classification model was used to identify the experimental data of the mobile phone carrying position, and the recognition accuracy of the algorithm was obtained. Through the gait detection algorithm corresponding to different carrying positions, the pedestrian’s real-time travel step number and distance were obtained. The following are the specific experimental results.

4.3.1. Analysis of Identification Results of Different Mobile Phone Carrying Positions

In this study, the preprocessed three-axis accelerometer and gyroscope signals are extracted in the time domain, and the three-axis mean, variance, and interaxis covariance are obtained to form the feature matrix. PCA is used to select the extracted features to obtain the feature combination matrix that best reflects the mobile phone’s carrying position. The obtained feature combination matrix is modelled as a random forest, and the model is used to identify the carrying positions of the test data. The following results are obtained.

The data in Table 3 demonstrate that the model has an average identification rate of 99% for different mobile phone carrying positions. The results show that the mobile phone carrying position can be accurately identified by the accelerometer and gyroscope signals.

4.3.2. Impact of Mobile Phone Carrying Position Identification on PDR Gait Detection

The main purpose of this research is to adjust the gait detection parameters for various mobile phone positions to improve the gait detection accuracy in PDR by identifying the mobile phone carrying position. Therefore, after identifying the mobile phone carrying positions, a set of experiments were conducted to test and compare the accuracy of gait detection before and after position identification.

By analysing the daily pedestrian behaviour, it is found that mobile phones are generally held flat in the hand and then moved to other positions. The design experiment route is a straight 45 m line. The experimenter carries the mobile phone in different positions to collect data for the normal gait, with position-switching (horizontal-swinging-horizontal, horizontal-calling-horizontal, and horizontal-backpack-horizontal). There are two groups of data, in which the first two states of each group include a walk of 20 steps and the last state includes travelling 45 m to the end of the route. The number of steps is recorded.

The experimental data are subjected to feature extraction and feature selection, and the established model is used to identify the mobile phone carrying position. The gait detection parameter is then adjusted according to the identified position. The step-length model established by the author [5] is used to estimate the travel distance and compare it with the gait detection results using common parameters. The results are shown in Table 4 and Figure 11.

Table 4 and Figure 11 show that, after adding the position recognition algorithm, the accuracy of the step count and the travel distance estimation is significantly improved. The average accuracy of the step detection becomes 98.62%, which is 6.98% higher than before the position recognition algorithm is added, and the average accuracy of the travel distance is 99.42%, which is 7.65% higher than before the position recognition algorithm is added. The results show that enabling the position recognition algorithm increases the robustness of gait detection in the PDR algorithm.

5. Conclusions

In this paper, a smartphone accelerometer and gyroscope are used as the research object. The time domain features of the accelerometer and gyroscope signals are extracted using a statistical algorithm to form the feature matrix. The PCA algorithm is used to select the feature data that best reflect the mobile phone carrying position. The random forest algorithm is used to train models according to the selected features, and the model is used to identify the mobile phone carrying position and adjust the PDR gait detection parameters. The experimental results show that the identification accuracy of pedestrian mobile phone carrying position based on smartphone inertial sensors, PCA, and random forest classifier is high, and the application of PDR has potential for expansion.

Data Availability

The inertial data of the smartphone used to support the results of this study can be obtained from the author of this article (e-mail: [email protected]).

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

Acknowledgments

This research was supported by the National Key Research and Development Program of China (grant no. 2016YFC0803102), Key Research and Development Project of Shandong Province (grant no. 2018GGX106003), the Graduate Science and Technology Innovation of Shandong University of Science and Technology (grant no. SDKDYC170312), and the Research and Innovation Team Project of Shandong University of Science and Technology (grant no. 2014TDJH101).

Supplementary Materials

Figures S1–S10: comprehensive image analysis. (Supplementary Materials)