## 3 Experiments and Results
### Drift-Elimination Experiment  
A specialized dataset was constructed to train the Transformer model for drift elimination. The input to the model consists of two parts. One is the drift data collected by the resistance strain gauge without being pulled by the electronic universal testing machine, which has a duration of 1500 s. The other part is the voltage signal generated by the simulation, which is a cluster of sinusoidal signals. This cluster of sinusoidal signals is represented as \(u_{r}(t)=Asin(2\pi ft)\), \(t\in[0,\,1500\) s], where \(f=0.5\), \(0.6\), \(0.75\), and \(A=0.05\), \(0.07\), and \(0.1\), respectively. The Transformer model aims to utilize an encoder to capture the drift characteristics of the signal and then uses a decoder to eliminate the drift from the signal while retaining the other components of the signal. Therefore, it is reasonable to use simulated voltages of finite frequency and amplitude to train the network to eliminate drift from the similar signal. In the experiment, the simulated sinusoidal signal is superimposed with the acquired drift to obtain a signal containing the drift to simulate the sampling voltage \(u_{s}(t)\). The dataset was split into training and validation sets at a ratio of 8:2. For the Transformer model, both the numbers of encoder and decoder layers were set to 2, the number of heads (\(h\)) in the multi-head attention mechanism was set to 8, the output dimensions of the embedding layer and each sublayer were set to \(d_{model}=64\), the dimensionality of the feedforward network was set to \(\text{dim\_feed}forward=256\), and the dropout rate was set to \(0.1\). This configuration yielded the best performance on the validation set. Figure 5 and Table 2 compare the performance of different models in eliminating the drift of the simulated voltage signal. The simulated voltage signal is \(u_{r}(t)=0.1\)\(\sin(1.5\)\(\pi t)\), while the drift data are obtained by the device. This study compares the RNN model, the GRU model, the encoder-decoder model (AGRU) using both the attention mechanism and the GRU, and the Transformer model. The time step for the RNN and the GRU is set to 15, and the size of the hidden state is set to 64. The AGRU model consists of an encoder, attention mechanism, and decoder. The GRU model is used for both the encoder and decoder structures. The attention mechanism employs additive attention for the scoring function. In the AGRU model, the time step is set to 15, and the hidden state size for both the encoder and decoder is 64. In Table 2, in order to compare the ability of different models to eliminate drift, some performance metrics such as RMSE, MAE and MAPE are selected. According to the results shown in Figure 5 and Table 2, the RNN and GRU models are less effective at removing drift, resulting in distortion of the output signal. These problems mainly stem from the fact that these models suffer from gradient explosion and gradient vanishing, so they have difficulties in capturing long-term dependencies. In addition, RNN and GRU models struggle to retain all important information due to their fixed-length context vectors. This limitation leads to the loss of key information and critical details in the time characteristics. The introduction of the attention mechanism and sequence-to-sequence architecture allows the model to dynamically assign different weights to various parts of the data. This preserves the hidden states of important time-frequency features in the signal data, significantly enhancing the model's learning capability. From the model outputs in Table 2 and Figure 5c, it is evident that the AGRU model significantly improves drift elimination compared to the RNN and GRU models. The traditional sequence-to-sequence model suffers from the distance dependence problem, and the model's accuracy decreases greatly with the increasing sequence length. Although attempts have been made to solve this problem by introducing the attention mechanism or using variants of RNN such as LSTM and GRU, the problem still cannot be completely solved.