# Walking Gait Phase Detection Based on Acceleration Signals Using LSTM-DNN Algorithm
## 3 Materials and Methods
### Proposed LSTM-DNN Algorithm
In addition, the LSTM-DNN algorithm used in this study is also a multi-layer perceptron with a DNN basic architecture network. The feed-forward DNN has five layers, namely one input layer, two hidden layers, and one output layer. In general, the input vector P of the input layer is expressed as p1, p2,..., p15 and each input is represented by the corresponding weight matrix w11, w21, and w181. The essence of the LSTM-DNN algorithm is to integrate the DNN and LSTM network. Although the LSTM-DNN algorithm performs better in timing signal processing, it has a simple network structure due to fewer neurons. In the training process, the predicted value of the DNN is fed back to the LSTM network continuously. Since the DNN is used, the weights of the LSTM network and the DNN change during the training process. As a result, the fluctuations in the weight of the LSTM network in the later training process are reduced, thereby stabilizing the network structure. First, the LSTM network processes the output of the previous cell and the input eigenvectors of the current cell. Then the DNN uses the LSTM network's output signal as the input signal and the weights are adjusted in the DNN and the LSTM network through the training process. Finally, the trained network structure is used and the classification is conducted using the Softmax classifier gait detection. We compared the results of the LSTM-DNN with those of more mature and traditional algorithms, namely, the k-nearest neighbor method (KNN) and SVM, which are installed in the sklearn package. In order to make the classification results have certain comparability, this paper also uses the PCA processed data set as the input of KNN and SVM classifier. SVM algorithms separate classes into different class hyperplanes using samples. The algorithm maximizes the distance between two samples, thus differentiating the categories as much as possible. Among them, the choice of kernel function is crucial to the performance of the support vector machine algorithm. The kernel functions of support vector machines mainly include linear kernel function, RBF kernel function, poly kernel function, and sigmoid kernel function. In order to determine the kernel function under the unsynchronized speed, this paper has introduced these four kinds of kernel functions and tested them separately, and obtained the results as shown in \[f_{t}=\sigma(w_{f}\cdot(h_{t-1}+x_{t})+b_{f}) \tag{2}\]0 In the KNN classification algorithm, if most of the K closest samples in the feature space belong to a certain category, the samples also belong to this category. The KNN algorithm is suitable for multi-classification. The KNN distance parameter chosen in this paper is the euclidean distance. In addition, the use of the KNN algorithm involves the parameter K. In order to find the ideal K value, the paper takes the values of 2, 5, 7, 10, 15, 20, and 30 in three kinds of paces. Under different K values, the classification results obtained by the classifier are shown in \[f_{t}=\sigma(w_{f}\cdot(h_{t-1}+x_{t})+b_{f}) \tag{2}\]1 The final K value is then determined by using the accuracy and F-score. In this experiment, a total of more than 640,000 pieces of acceleration information were collected. To avoid overfitting, three of the data were used for training and the other was used for testing. In this study, we randomly selected data from three subjects to train the LSTM-DNN model and the other three models. Use the remaining data from one subject to verify the performance of the model. In addition, the final model parameters were determined after 15,000 network trainings. The overall process is shown in \[f_{t}=\sigma(w_{f}\cdot(h_{t-1}+x_{t})+b_{f}) \tag{2}\]2  
\[f_{t}=\sigma(w_{f}\cdot(h_{t-1}+x_{t})+b_{f}) \tag{2}\]3 Schematic diagram of the LSTM-DNN structure. \[f_{t}=\sigma(w_{f}\cdot(h_{t-1}+x_{t})+b_{f}) \tag{2}\]4 Flow chart of the analysis process.