## 4 Experiments
### Analysis of Experimental Results
#### 4.3.2 Improved Model Comparison Experiments  
In order to prove the superiority of our proposed method in rail surface defect detection, we will verify each improvement point in turn, as follows:  
* The number of C3 STRs  
Table 2 represents the influence of successively adding different amounts of C3 STRs to the network model on the experimental results.  
Due to the excellent performance of the CDConv, we directly improved the network by adding the CDConv and sequentially comparing the detection results of different numbers of C3 STRs added to the network. We sequentially tested adding 1-5 C3 STRs to the Backbone and Head, and the experimental results showed that although each addition of a C3 STR module would increase the computational load of the network in turn, the detection accuracy gradually increased, reaching the highest detection accuracy with the addition of four modules. At the fifth point, the detection accuracy began to decrease, and the network model was already very large. Taking this into account, we chose to add four C3 STR improved models in this paper.  
* Attention mechanism  
Table 3 shows the influence of adding CBAM, ECA, CA, SE, and GAM to the network model on the experimental results.  
After confirming the optimal number of C3 STRs, this paper further improved the model by adding different attention mechanisms to the Head to make the network more focused on the injury concentration area. In Table 3, the experimental comparison of multiple attention mechanisms in this paper shows that mixed attention achieves the highest detection accuracy than single-channel attention mechanisms, among which GAM has a higher comprehensive performance than CBAM.  
* Loss function  
Table 4 shows the effects of adding different loss functions to the network model on the experimental results.  
This paper compares several mainstream loss functions, including the latest AlphaIoU and SloU, and finds that the combination of SloU and Soft-NMS to make the function, Soft-SloUNMS, achieves the best detection effect through experiments. The comparison of defect detection loss values of different loss functions is shown in Figure 9. In order to more intuitively reflect the difference between the improved loss and the original loss function,  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline \multirow{2}{*}{**Model**} & **Number of** & \multirow{2}{*}{**P**} & **R** & **[EMAIL_ADDRESS]** \\  & **C3 STRs** & & & \\ \hline YOLOv5s + CDConv + C3 STR & 1 & 0.943 & 0.933 & 0.950 \\ YOLOv5s + CDConv + C3 STR & 2 & 0.944 & 0.935 & 0.948 \\ YOLOv5s + CDConv + C3 STR & 3 & 0.951 & 0.936 & 0.951 \\ YOLOv5s + CDConv + C3 STR & 4 & 0.951 & 0.936 & 0.963 \\ YOLOv5s + CDConv + C3 STR & 5 & 0.949 & 0.934 & 0.953 \\ \hline \hline \end{tabular}
\end{table}
Table 2: The influence of the number of C3 STRs on the model.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline \multirow{2}{*}{**Model**} & **P** & **R** & **[EMAIL_ADDRESS]** \\ \hline YOLOv5s + CDConv + C3 STRs + CBAM & 0.963 & 0.938 & 0.964 \\ YOLOv5s + CDConv + C3 STRs + ECA & 0.964 & 0.935 & 0.961 \\ YOLOv5s + CDConv + C3 STRs + CA & 0.951 & 0.936 & 0.963 \\ YOLOv5s + CDConv + C3 STRs + SE & 0.962 & 0.938 & 0.960 \\ YOLOv5s + CDConv + C3 STRs + GAM & 0.967 & 0.940 & 0.965 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Comparison of the results of different attention mechanisms.