# Using Wearable Sensors to Estimate Vertical Ground Reaction Force Based on a Transformer
## 4 Results  
We show the results on our dataset, using MSE and MAPE as the evaluation metrics of the model. Multiple sets of comparison experiments are conducted to highlight the effectiveness of the method proposed in this paper. In Table 1, we compare the effectiveness of the classical neural network models RNN, LSTM, and the transformer used in this paper for predicting GRF and the effect of Gate_MSE on the final experimental results. The use of Gate_MSE does not improve the overall effect, and its effect is slightly worse than that of the MSE loss function. The primary function of Gate_MSE is to predict the peak of the GRF, and we will demonstrate the improvement effect of Gate_MSE for predicting the peak of the GRF in the following section. During the movement, the foot is the first touch until entirely off the ground, and the GRF will appear in two peaks. The moment the heel first makes contact with the ground, the GRF quickly reaches a higher value; this process occurs quickly and steeply, indicating that the impact force occurs quickly, and the first peak force loading rate is considered to be highly correlated with the occurrence of injury. Then it rises more slowly to the second peak. To demonstrate the effectiveness of the transformer, we show in Figure 4 the prediction results of the transformer and the LSTM, which also uses MSE as the loss function. Table 1 illustrates that the overall effectiveness of using Gate_MSE is not as good as MSE. However, by comparing the curves of the ground truth with the predicted results in Figure 5, we can see that Gate_MSE is more effective in predicting the peak ground reaction force, which is often used to assess injury risk, muscle loss, etc., so that effective peak prediction is more important. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Model** & **MSE** & **MAPE** \\ \hline RNN & 0.0365 & 84.4239 \\ LSTM & 0.0293 & 82.7453 \\ Transformer & 0.0218 & 79.2751 \\ Transformer + Gate\_MSE & 0.0227 & 80.0136 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Effect of model and loss on the results. In this paper, we use the transformer's encoders as feature extractors. More encoders tend to mean deeper network layers and extract more valuable features, so in Table 2, we show the effect of stacking different numbers of encoders on the prediction effect of the model. In Table 2, we can see that using two encoders improves the prediction effect by 18% compared to using one encoder. When using three encoders, the effect improves by only 7%, and when the number of encoders is increased to four, the effect improves by only 5%. With the addition of encoders, there is a greater amount of computation and a longer computation time, which cannot be used in practice. In Table 3, we verified the model's prediction effect for different data formats. We used acceleration and rotation, acceleration and joint position, and acceleration and joint position with dimensionality reduction by PCA as the input data for the model. We can see from Table 3 that the best prediction results are obtained by using acceleration and joint position with dimensionality reduction by PCA, which we believe is because joint position \begin{table}
\begin{tabular}{c c c} \hline \hline
**Number of Encoders** & **MSE** & **MAPE** \\ \hline
1 & 0.0325 & 90.5268 \\
2 & 0.0237 & 81.5452 \\
3 & 0.0218 & 79.2751 \\
4 & 0.0216 & 78.4532 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Effect of the number of encoders on the results. Figure 4: We compare the performances of the transformer (**a**) and LSTM (**b**) on the prediction GRF task. The green solid line indicates ground truth and the blue dashed line indicates predicted value. Figure 5: We compare the effect of using (**a**) Gate_MSE and (**b**) MSE on the output results. From the figure, we can see that Gate_MSE has better results on peak prediction. contains more human information than rotation data, while using PCA not only makes the model input data less but also more generalizable.