## 3 Experimental Results and Discussion
### Evaluation Metrics  
The performance of the presented method is compared with others. The mean absolute error (_MAE_) [35] and root-mean-square error (_RMSE_) [36] are selected to evaluate the performance of the methods and are defined as follows:  
\[MAE=\frac{1}{n}\sum\limits_{i=1}^{n}|r_{i}-\overline{r}_{i}|, \tag{11}\] \[RMSE=\sqrt{\frac{1}{n}\sum\limits_{i=1}^{n}\left(r_{i}-\overline {r}_{i}\right)^{2}},\]  
where \(r_{i}\) and \(\overline{r_{i}}\) are the actual and predicted RUL, respectively. The vibration data collected in each of the three directions are stacked into one sample and the input data are normalized in the data preprocessing. In this paper, the life percentage of the rail is used as the output label [37], i.e., the actual rail RUL of the rail is normalized to a range of 0-100%. For each sample indexed, the output label is the life percentage of the rail, i.e., the ratio of the current sample indexed value to the total number of full life cycles. That is, when this ratio is 0, the rail reaches full life into failure. The normalized value is calculated as follows:  
\[RUL=\frac{f(x)}{T}*100 \tag{12}\]  
where \(f(x)\) is the true _RUL_ at that time. With the increase in the number of iterations, the loss function value decreases in the training process and gradually tends to be stable. The experimental results are demonstrated in Figure 7. As shown in Figure 7 the RUL prediction curve is better fitted to the labelled value of the actual RUL. The results preliminarily prove that the presented method effectively predicts the accurate rail RUL. To further validate the superiority of the model, the prediction results of the model presented in this paper are compared with the CNN, the CNNLSTM network, and the CNNBiLSTM network. The RAE and RMSE values under various operating conditions are shown in Figures 8 and 9. As seen from the figure, the MAE and RMSE values of the CNNBiLSTM-RSA model are lower than those of the other three algorithms, which shows that the CNNBiLSTM-RSA model has higher prediction accuracy. This is due to the fact that the introduced RSA mechanism avoids the problems of gradient vanishing and gradient explosion that exist in typical recurrent networks. \begin{table}
\begin{tabular}{c c c} \hline \hline \multirow{2}{*}{Feature Extraction Module} & \multirow{2}{*}{\(1\)DCNN} & In\_channels= 3 \\  & & Out\_channels = 32 \\  & & kernel\_size = 3 \\  & & padding = 1 \\  & Max\_Pooling & kernel\_size = 2 \\ \hline \multirow{4}{*}{Train} & \multirow{4}{*}{Epoch = 100} & input\_size = 32 \\  & & hidden\_size = 32 \\  & & kernel\_size = 2 \\ \hline \multirow{4}{*}{Train} & \multirow{4}{*}{Epoch = 100} & batch\_size = 16 \\  & & optimizers = Adam \\ \cline{1-1}  & & lr = 0.001 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Model structure parameter settings. Figure 8: Comparison of RMSE of different models under different working conditions. Figure 7: Predicted RUL curves for rails with different damage under different operating conditions: (**A**) RUL prediction curve for stripping off the blocks from rails under operating condition 1; (**B**) RUL prediction curve for Wave abrasion from rails under operating condition 2; (**C**) RUL prediction curve for fish scale injury from rails under operating condition 3; (**D**) RUL prediction curve for stripping off the blocks from rails under operating condition 4. To verify the effectiveness of RSA in improving model performance through ablation experiments, the models involved in the experiments include CNNBiLSTM networks with an RSA mechanism added to verify the effectiveness and necessity of this mechanism and the combination of CNN-BiLSTM and a traditional SA mechanism to experience the advantages of using the RSA mechanism. The MAE and RSME results of each model in this comparison experiment are shown in Tables 3-6. Tables 3-6 show that the MAE and RMSE of the CNNBiLSTM-RSA network are lower than those of the CNNBiLSTM-SA network without residual connection and those of the CNNBiLSTM network without added attention mechanism.