## 3 Experiments and Results
### Motion Pattern Recognition Based on LSTM Neural Network
#### 3.2.3 Different Sliding Window Lengths and Different Feature Set Types  
In order to study the motion pattern recognition effect of the LSTM network model after changing the number of feature inputs and the length of the sliding window, four different feature parameters sets were used: i.e. (1) only RMS feature parameters; (2) only time-domain feature parameters (RMS, VAR, and ZC); (3) only frequency-domain feature parameters (MPF and MF); and (4) all the feature parameters (RMS, VAR, ZC, MPF, and MF) used as the LSTM model inputs separately. The sliding window lengths selected were 256 ms, 512 ms, 1024 ms, and 2048 ms, respectively, and the feature parameter datasets were established at intervals of 50 ms. Seventy percent of the dataset was used for training, and 30% was used for testing. In the 70% of the dataset used for training, 90% of the dataset was used for training, and 10% of the dataset was used for verification. The number of the hidden layer nodes was 128, and the activation function of the input layer was the tanh. The final recognition results are shown in Table 5.  
It can be seen from Table 5 that, when all time and frequency-domain features (RMS, VAR, ZC, MPF, and MF) were used and the sliding window length was 2048 ms, the LSTM model showed the best recognition effect of 98.18%. For different sliding window lengths, there were cases where the contribution of the time-domain features to the accuracy of the motion pattern recognition was higher than that of the frequency-domain features. However, the contribution of frequency-domain feature values to lower-limb movement pattern recognition cannot be ignored. After adding time domain-features to the frequency-domain features, the recognition rate of human movement patterns was further improved, which is consistent with the results obtained by multilayer perceptrons. When the sliding window length was 512 ms, the highest recognition accuracy of the LSTM model was 88.84%. Compared with the multilayer perceptrons model, which had a recognition accuracy of 65.98% when the sliding window length was 512 ms, the recognition effect of the LSTM network model was found to be better. Figure 11 shows the changes in the recognition accuracy and the loss function value when the sliding window length was 512 ms. It can be seen that, when the number of iterations of the LSTM \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multicolumn{2}{c}{**Correct Rate (\%)**} & \multicolumn{5}{c}{**Sliding Window Length (ms)**} \\ \cline{2-6} \multicolumn{2}{c}{} & **256** & **512** & **1024** & **2048** \\ \hline \multirow{4}{*}{**Feature Sets**} & RMS & 68.62 & 84.32 & 94.36 & 96.87 \\ \cline{2-6}  & RMS, VAR and ZC & 73.30 & 87.65 & 96.08 & 97.66 \\ \cline{2-6}  & MPF and MF & 59.02 & 66.03 & 93.14 & 80.21 \\ \cline{2-6}  & RMS, VAR, ZC, & & & & \\ \cline{2-6}  & MPF and MF & 77.75 & 88.84 & 96.57 & 98.18 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Recognition accuracy of the LSTM model with different feature parameter sets and sliding window lengths. classifier was less than 100 during model training, the accuracy of the motion pattern recognition quickly reached a high value, and the overall trend was found steadily rising. The recognition accuracy of the trained LSTM model on the verification set was 88.84%. The value of the loss function had an opposite trend with respect to the recognition accuracy, which rapidly dropped to about 0.5. This value did not change too much as the number of training iterations increased. In order to analyze which motion patterns are misrecognized at low sliding window lengths, the results of the model classification on the validation set were compared with the true motion model. Figure 12 shows the recognition results of the LSTM classifier when the sliding window lengths were 256 ms and 512 ms. The red dot in the figure represents the true motion model corresponding to the surface EMG data, and the blue line segment is the motion model predicted by the model.