PGCF-YOLO: a railway fastener detection algorithm based on improved YOLOv8n

Siwei Ma, Yuanyuan Li, Henan HuResearch Square 2025

Abstract

Railway fasteners are critical components for maintaining track stability and ensuring the safe operation of trains. Accurate and real-time detection of fastener defects is essential for achieving intelligent railway maintenance. However, existing object detection algorithms often struggle to balance detection accuracy and computational efficiency. To address these challenges, this paper proposes an improved lightweight detection algorithm—PGCF-YOLO (Pyramid Split Attention - GSConv + VoV-GSCSP – CARAFE – FocalerIoU – MPDIoU – You Only Look Once), based on the YOLOv8n architecture. First, a Pyramid Split Attention (PSA) module is integrated into the backbone to strengthen the model’s capability in perceiving complex defect features. Then, lightweight GSConv and VoV-GSCSP modules are introduced into the Neck to reduce parameter count and computational overhead while maintaining strong feature extraction capacity. The CARAFE upsampling operator is adopted to replace traditional nearest-neighbor interpolation, improving the model’s ability to capture both fine-grained details and global semantic information. Finally, a novel regression loss function, Focaler-MPDIoU, is proposed to enhance bounding box localization accuracy and accelerate training convergence. Experimental results demonstrate that PGCF-YOLO achieves excellent inference efficiency while maintaining high detection accuracy, reaching 99.3% mAP and 128 FPS, which represent improvements of 2.2% in accuracy and 12 FPS in speed over the original YOLOv8n. Furthermore, the parameter count and GFLOPs are reduced by 11.0% and 17.3%, respectively.

Introduction

Railway fasteners secure rails to sleepers, a task vital for track stability. Due to extreme mechanical stress and environmental exposure, these components frequently fracture or go missing. Manual inspection is labor-intensive and error-prone. While deep learning offers automation, current models often fail to balance the high accuracy required for safety with the speed needed for real-time deployment on inspection vehicles. PGCF-YOLO addresses this "Goldilocks" problem by optimizing the YOLOv8n framework for edge deployment without sacrificing precision.

Methodology: The PGCF Framework

The PGCF-YOLO architecture introduces four strategic enhancements to the standard YOLOv8n model to improve feature extraction and localization.

The overall architecture of PGCF-YOLO, highlighting the integration of PSA, GSConv, VoV-GSCSP, and CARAFE modules.

1. Pyramid Split Attention (PSA)

Integrated into the backbone, the PSA module employs a pyramid-based channel segmentation strategy. By processing features at multiple scales in parallel, it enhances the model's ability to identify complex, fine-grained defect patterns in diverse environments.

2. Lightweight Convolution: GSConv & VoV-GSCSP

To optimize the "Neck" of the network—where channel dimensions are highest—the authors introduced GSConv and VoV-GSCSP. GSConv utilizes a channel shuffle strategy to bridge the gap between standard and depthwise separable convolutions, reducing GFLOPs while maintaining robust feature extraction.

3. Content-Aware ReAssembly of FEatures (CARAFE)

Standard YOLO models typically use nearest-neighbor interpolation for upsampling, which ignores image content. PGCF-YOLO adopts CARAFE, a content-aware operator that dynamically generates kernels based on the feature map. This allows for a larger receptive field and superior semantic fusion, which is critical for detecting small-scale fastener defects.

Detailed structure of the CARAFE module, showing the kernel prediction and content-aware reassembly processes.

4. Focaler-MPDIoU Loss Function

The training process is optimized using a novel Focaler-MPDIoU loss function. By adaptively focusing on "hard" versus "easy" samples, this function improves bounding box localization accuracy and accelerates convergence compared to the standard CIoU loss.

Experimental Results

The model was evaluated on two datasets: the M-type Fastener Dataset (3,000 augmented images) and the E-type Fastener Dataset (1,200 images) for generalization testing.

PGCF-YOLO demonstrated superior performance across all key metrics:

  • Accuracy: Achieved 99.3% [email protected], surpassing the baseline YOLOv8n (97.1%) and the newer YOLOv11 (98.3%).
  • Efficiency: Reached 128 FPS on an RTX 4090, a 10% speed increase over the original model.
  • Compactness: Reduced parameters by 11% (to 2.67M) and GFLOPs by 17.3% (to 6.7).
  • Generalization: Maintained a 97.3% mAP on the E-type dataset, confirming its effectiveness across different fastener geometries.

Conclusion

PGCF-YOLO represents a significant advancement in railway safety technology. By combining attention mechanisms with lightweight convolutional structures and content-aware upsampling, the model achieves a rare trifecta: higher accuracy, faster inference, and a smaller memory footprint. Future research will focus on enhancing performance under extreme weather conditions and further compressing the model for deployment on ultra-low-power edge devices.

Summary updated

BibTeX
@inproceedings{ma2025pgcf,
  author = {Siwei Ma and Yuanyuan Li and Henan Hu},
  title = {{PGCF-YOLO: a railway fastener detection algorithm based on improved YOLOv8n}},
  booktitle = {Research Square},
  year = {2025},
  doi = {10.21203/rs.3.rs-6518914/v1},
}
Figure