# Multimode Pedestrian Dead Reckoning Gait Detection Algorithm Based on Identification of Pedestrian Phone Carrying Position

Authors: Ying Guo; Qinghua Liu; Xianlei Ji; Shengli Wang; Mingyang Feng; Yuxi Sun
Journal: Mobile Information Systems
 (2019)

---

## 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.


---

## Body

## 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.Figure 1
Original accelerometer measurements in various carrying positions.
(a)
(b)
(c)
(d)Figure 2
Original gyroscope measurements in various carrying positions.
(a)
(b)
(c)
(d)Figures1(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.Figures2(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 Figures1 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:(1)mean:μi=1N∑n=1NSi,n,(2)variance:θi2=1N∑n=1NSi,n−μi2,(3)covariance:covi,j=1N∑n=1NSi,n−uiSj,n−uj,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 at-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 featurey1 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 ofX:(4)S=1MX−μ¯TX−μ¯,where X is the sample feature set and μ¯ is the average of the feature vectors.(2)
Calculate thet eigenvalues λ1,λ2,…,λt of the covariance matrix S and the corresponding eigenvector ω1,ω2,…,ωt.(3)
The obtained eigenvalues are sorted from large to small, and the topm are selected. The eigenvector matrix corresponding to the m eigenvalues is B=μ1,μ2,…,μm, and the value of m can be determined according to the following formula:(5)∑i=1Kλi∑i=1Mλi≥1−η,where η represents the energy loss rate. Finally, a new eigenvector y=y1,y2,…,ym consisting of the m features is obtained:(6)y=Bx.


### 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 Figure3. 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.Figure 3
Random forest model.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 hasd 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 vectorsX 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:(7)IGC:X=HC−HCX,where(8)HC=−∑i=1nPC=cilog2PC=ci,where P(C = ci) is the probability that the category attribute ci appears, and(9)HCX=−∑i=1nPX=xiHCX=ci,where IGC:X is the information gain of attribute X for category C, HC is the entropy of C, and HCX 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 thed 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:(10)DT1,DT2,…,DTk=f1x,f2x,…,fkx.(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 thek 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:(11)Fx=argmaxy∑i=1nIfix=Y,where Fx indicates the integrated classifier, fix is the base classifier, Y indicates the output classification result, and Ix 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 ofh 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 Figure4.Figure 4
System flowchart.


## 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:(1)mean:μi=1N∑n=1NSi,n,(2)variance:θi2=1N∑n=1NSi,n−μi2,(3)covariance:covi,j=1N∑n=1NSi,n−uiSj,n−uj,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 at-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 featurey1 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 ofX:(4)S=1MX−μ¯TX−μ¯,where X is the sample feature set and μ¯ is the average of the feature vectors.(2)
Calculate thet eigenvalues λ1,λ2,…,λt of the covariance matrix S and the corresponding eigenvector ω1,ω2,…,ωt.(3)
The obtained eigenvalues are sorted from large to small, and the topm are selected. The eigenvector matrix corresponding to the m eigenvalues is B=μ1,μ2,…,μm, and the value of m can be determined according to the following formula:(5)∑i=1Kλi∑i=1Mλi≥1−η,where η represents the energy loss rate. Finally, a new eigenvector y=y1,y2,…,ym consisting of the m features is obtained:(6)y=Bx.


## 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 Figure3. 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.Figure 3
Random forest model.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 hasd 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 vectorsX 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:(7)IGC:X=HC−HCX,where(8)HC=−∑i=1nPC=cilog2PC=ci,where P(C = ci) is the probability that the category attribute ci appears, and(9)HCX=−∑i=1nPX=xiHCX=ci,where IGC:X is the information gain of attribute X for category C, HC is the entropy of C, and HCX 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 thed 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:(10)DT1,DT2,…,DTk=f1x,f2x,…,fkx.(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 thek 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:(11)Fx=argmaxy∑i=1nIfix=Y,where Fx indicates the integrated classifier, fix is the base classifier, Y indicates the output classification result, and Ix 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 ofh 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 Figure4.Figure 4
System flowchart.


## 3.3.1. Random Forest Algorithm

The base classifiers of the random forest algorithm are decision trees. The model is shown in Figure3. 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.Figure 3
Random forest model.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 hasd 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 vectorsX 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:(7)IGC:X=HC−HCX,where(8)HC=−∑i=1nPC=cilog2PC=ci,where P(C = ci) is the probability that the category attribute ci appears, and(9)HCX=−∑i=1nPX=xiHCX=ci,where IGC:X is the information gain of attribute X for category C, HC is the entropy of C, and HCX 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 thed 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:(10)DT1,DT2,…,DTk=f1x,f2x,…,fkx.(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 thek 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:(11)Fx=argmaxy∑i=1nIfix=Y,where Fx indicates the integrated classifier, fix is the base classifier, Y indicates the output classification result, and Ix 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 ofh 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 Figure4.Figure 4
System flowchart.


## 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 Table1.Table 1
MeiLan Note3 built-in accelerometer and gyroscope parameters.
Manufacturer
Dimension
Measuring range
Resolution ratio
Rated current
Power
Sample frequency
Operating temperature
InvenSense
3
34.90656
1.0 m/s^2/1.065 ∗ 10^−3 rad/s
0.5 mA
5.5μA
15∼200 Hz
−20∼45°CThe experimental site is the 5th floor of the J6 Teaching Building of Shandong University of Science and Technology (Figure5 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.Figure 5
Plan view of the experimental site.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 Table2.Table 2
Mobile phone location characteristics and descriptions.
Feature number
Feature description
1
Triaxial acceleration mean
2
Triaxial acceleration variance
3
Covariance between acceleration axes
4
Triaxial gyroscope mean
5
Triaxial gyroscope variance
6
Covariance between gyroscope axesAfter these steps, 18 features were extracted, as shown in Figure6.Figure 6
Feature extraction results.
(a)
(b)
(c)
(d)Figures6(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.Figure6 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.Figure 7
Contribution levels of each feature.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.Figure 8
Before and after data reduction (in the figure, the purple sample points represent the position of the chest, the blue sample points represent the position of the swinging hand, the green sample points represent the call making position, and the yellow sample points represent the backpack position).
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
(i)
(j)Figures8(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. Figure9 shows the modelling accuracy of the different classifiers.Figure 9
Modelling accuracy of each classifier.The data shown in Figure9 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 Figure10. This provides theoretical support for a more reasonable determination of the number of decision trees in the random forest model.Figure 10
Relationship between random forest classification error and number of decision trees.
(a)
(b)By analysing the relationship between the classification error of the random forest model and the number of decision trees, as shown in Figures10(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 Table3 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.Table 3
Confusion matrix of smartphone carrying location identification accuracy.
Flat
Swinging
Calling
Backpack
Flat
100%
0
0
0
Swinging
0
100%
0
0
Calling
1.7%
0
98.3%
0
Backpack
0.4%
1%
0
98.6%


#### 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
Experimental results before and after position identification.
No.
Experimental content
Number of steps
Steps detected
Travel distance (m)
Before
After
Before
After
1
Horizontal-swinging-horizontal
58
52
59
51.03
44.79
2
Horizontal-swinging-horizontal
59
53
60
53.53
44.85
3
Horizontal-calling-horizontal
60
67
60
48.62
44.74
4
Horizontal-calling-horizontal
61
66
59
47.91
45.39
5
Horizontal-backpack-horizontal
62
58
61
45.41
44.67
6
Horizontal-backpack-horizontal
60
58
60
45.78
45.24Figure 11
Gait detection accuracy before and after position identification.Table4 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.


## 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 Table1.Table 1
MeiLan Note3 built-in accelerometer and gyroscope parameters.
Manufacturer
Dimension
Measuring range
Resolution ratio
Rated current
Power
Sample frequency
Operating temperature
InvenSense
3
34.90656
1.0 m/s^2/1.065 ∗ 10^−3 rad/s
0.5 mA
5.5μA
15∼200 Hz
−20∼45°CThe experimental site is the 5th floor of the J6 Teaching Building of Shandong University of Science and Technology (Figure5 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.Figure 5
Plan view of the experimental site.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 Table2.Table 2
Mobile phone location characteristics and descriptions.
Feature number
Feature description
1
Triaxial acceleration mean
2
Triaxial acceleration variance
3
Covariance between acceleration axes
4
Triaxial gyroscope mean
5
Triaxial gyroscope variance
6
Covariance between gyroscope axesAfter these steps, 18 features were extracted, as shown in Figure6.Figure 6
Feature extraction results.
(a)
(b)
(c)
(d)Figures6(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.Figure6 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.Figure 7
Contribution levels of each feature.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.Figure 8
Before and after data reduction (in the figure, the purple sample points represent the position of the chest, the blue sample points represent the position of the swinging hand, the green sample points represent the call making position, and the yellow sample points represent the backpack position).
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
(i)
(j)Figures8(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. Figure9 shows the modelling accuracy of the different classifiers.Figure 9
Modelling accuracy of each classifier.The data shown in Figure9 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 Figure10. This provides theoretical support for a more reasonable determination of the number of decision trees in the random forest model.Figure 10
Relationship between random forest classification error and number of decision trees.
(a)
(b)By analysing the relationship between the classification error of the random forest model and the number of decision trees, as shown in Figures10(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.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 Table2.Table 2
Mobile phone location characteristics and descriptions.
Feature number
Feature description
1
Triaxial acceleration mean
2
Triaxial acceleration variance
3
Covariance between acceleration axes
4
Triaxial gyroscope mean
5
Triaxial gyroscope variance
6
Covariance between gyroscope axesAfter these steps, 18 features were extracted, as shown in Figure6.Figure 6
Feature extraction results.
(a)
(b)
(c)
(d)Figures6(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.Figure6 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.Figure 7
Contribution levels of each feature.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.Figure 8
Before and after data reduction (in the figure, the purple sample points represent the position of the chest, the blue sample points represent the position of the swinging hand, the green sample points represent the call making position, and the yellow sample points represent the backpack position).
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
(i)
(j)Figures8(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. Figure9 shows the modelling accuracy of the different classifiers.Figure 9
Modelling accuracy of each classifier.The data shown in Figure9 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 Figure10. This provides theoretical support for a more reasonable determination of the number of decision trees in the random forest model.Figure 10
Relationship between random forest classification error and number of decision trees.
(a)
(b)By analysing the relationship between the classification error of the random forest model and the number of decision trees, as shown in Figures10(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 Table3 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.Table 3
Confusion matrix of smartphone carrying location identification accuracy.
Flat
Swinging
Calling
Backpack
Flat
100%
0
0
0
Swinging
0
100%
0
0
Calling
1.7%
0
98.3%
0
Backpack
0.4%
1%
0
98.6%


### 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
Experimental results before and after position identification.
No.
Experimental content
Number of steps
Steps detected
Travel distance (m)
Before
After
Before
After
1
Horizontal-swinging-horizontal
58
52
59
51.03
44.79
2
Horizontal-swinging-horizontal
59
53
60
53.53
44.85
3
Horizontal-calling-horizontal
60
67
60
48.62
44.74
4
Horizontal-calling-horizontal
61
66
59
47.91
45.39
5
Horizontal-backpack-horizontal
62
58
61
45.41
44.67
6
Horizontal-backpack-horizontal
60
58
60
45.78
45.24Figure 11
Gait detection accuracy before and after position identification.Table4 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.


## 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 Table3 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.Table 3
Confusion matrix of smartphone carrying location identification accuracy.
Flat
Swinging
Calling
Backpack
Flat
100%
0
0
0
Swinging
0
100%
0
0
Calling
1.7%
0
98.3%
0
Backpack
0.4%
1%
0
98.6%


## 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
Experimental results before and after position identification.
No.
Experimental content
Number of steps
Steps detected
Travel distance (m)
Before
After
Before
After
1
Horizontal-swinging-horizontal
58
52
59
51.03
44.79
2
Horizontal-swinging-horizontal
59
53
60
53.53
44.85
3
Horizontal-calling-horizontal
60
67
60
48.62
44.74
4
Horizontal-calling-horizontal
61
66
59
47.91
45.39
5
Horizontal-backpack-horizontal
62
58
61
45.41
44.67
6
Horizontal-backpack-horizontal
60
58
60
45.78
45.24Figure 11
Gait detection accuracy before and after position identification.Table4 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.



---

*Source: 4709501-2019-10-31.xml*