When deep learning methods are used to detect rail surface defects, the training accuracy declines due to small defects and an insufficient number of samples. This paper investigates the problem of rail surface defect detection by using an improved feature pyramid network (FPN) and the metric learning approach. Firstly, the FPN is improved by adding deformable convolution and convolutional block attention modules to improve the accuracy of detecting defects of different scales, and it is pretrained on the MS COCO dataset. Secondly, a new model is established to extract network features based on the transfer learning model and learned network parameters. Thirdly, a multimodal network structure is constructed, and the distance between each modal representative and the embedded feature vector is calculated to classify the defects. Finally, experiments are carried out on the miniImageNet dataset and the rail surface defect dataset. The results show that the mAP (five-way five-shot) of our method is 73.42% on the miniImageNet dataset and 63.29% on the rail defect dataset. Our experiments show the effectiveness of the proposed method, and the results of the rail surface defect detection are satisfactory. As there are few sample classification studies of rail surface defects, this work provides a different approach and lays a foundation for further research.
Rail surface defects present a significant safety concern in railway operations. However, the scarcity of data poses challenges for employing deep learning in defect detection. This study proposes an enhanced ACGAN augmentation method to address these issues. Residual blocks mitigate vanishing gradient problems, while a spectral norm regularization-constrained discriminator improves stability and image quality. Substituting the generator’s deconvolution layer with upsampling and convolution operations enhances computational efficiency. A gradient penalty mechanism based on regret values addresses gradient abnormality concerns. Experimental validation demonstrates superior image clarity and classification accuracy compared to ACGAN, with a 17.6% reduction in FID value. MNIST dataset experiments verify the model’s generalization ability. This approach offers practical value for real-world applications.