## 3 Experiments and Results
### Comparative Experiments
#### 3.2.2 Experimental Results on the Rail Fastener Dataset  
According to the comparative results in Figure 10, the proposed method demonstrates superior anomaly detection performance compared to other models, which exhibit varying degrees of detection errors. Specifically, as shown in Figure 10b, the GANomaly model reveals significant errors in anomaly detection, especially in bolt-missing scenarios, failing to accurately identify the target anomaly regions. Because GANomaly primarily relies on image reconstruction to identify anomalies, the model is susceptible to interference from complex backgrounds, preventing the accurate restoration of detailed target regions and consequently impairing anomaly detection performance. Similarly, in Figure 10c, the f-AnoGAN model exhibits limitations in detecting rail fastener obstruction anomalies. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Model** & **AUC/\%** & **ACC/\%** & **F1/\%** \\ \hline GANomaly & 89.5 & 87.3 & 86.2 \\ f-AnoGAN & 90.1 & 88.5 & 87.4 \\ MemAE & 91.2 & 89.8 & 88.1 \\ SQUID & 92.5 & 91.3 & 90.2 \\ Proposed method & 94.0 & 92.5 & 91.6 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Quantitative results of the model comparison experiments on the MNIST dataset. Figure 9: Visualization results on the MNIST dataset (anomalies with red circles): (**a**) original image; (**b**) GANomaly; (**c**) f-AnoGAN; (**d**) MemAE; (**e**) SQUID; (**f**) proposed method. The reconstruction process lacks sufficient sensitivity to anomaly regions, resulting in noticeable discrepancies between the reconstructed and original images, thus reducing detection accuracy. Despite the MemAE model in Figure 10d slightly improving detection precision, particularly in suppressing background interference under complex environments, it still shows considerable errors in capturing fastener details. This limitation arises from its simplistic reconstruction strategy, which fails to effectively preserve detailed fastener information, thus reducing sensitivity. In Figure 10e, the SQUID model shows relatively strong anomaly detection performance, yet still leaves room for improvement in accurately localizing anomalies under complex backgrounds. In comparison, the proposed method illustrated in Figure 10f effectively integrates global and local information, precisely reconstructing and accurately detecting anomaly regions. By incorporating an attention mechanism, it enhances the weight of critical features, mitigates background interference, and significantly improves detection performance across the three types of fastener anomalies. Experimental results confirm that the proposed model outperforms all comparison models in anomaly feature extraction, overall detection accuracy, and handling of detailed anomalies. The quantitative comparison results between the proposed method and various detection networks are presented in Table 6. The GANomaly model yields the lowest AUC, whereas the proposed method achieves the best performance across all evaluation metrics. Although the SQUID model performs well in biomedical image anomaly detection--leveraging a small number of abnormal samples to achieve unsupervised detection with high accuracy--its performance in rail fastener anomaly detection is inferior to that of the proposed method. Specifically, the proposed method improves the AUC for different types of fastener anomalies by 21.1%, 17.8%, 9.4%, and 7.5% over GANomaly, f-AnoGAN, MemAE, and SQUID, respectively. Additionally, it outperforms these methods in terms of overall ACC by 16.8%, 14.0%, 8.2%, and 6.3%, and improves the F1-score by 17.9%, 16.4%, 9.5%, and 3.5%, respectively. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Model** & **AUC/\%** & **ACC/\%** & **F1/\%** \\ \hline GANomaly & 73.6 & 73.3 & 69.9 \\ f-AnoGAN & 76.9 & 76.1 & 71.4 \\ MemAE & 85.3 & 81.9 & 78.5 \\ SQUID & 87.2 & 83.8 & 84.3 \\ Proposed method & 94.7 & 90.1 & 87.8 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Quantitative results of the model comparison experiments on the fastener dataset.