On the basis of introducing the composition of the track defect testing system,the principle of the YO-LOv5s algorithm model is analyzed.In response to the problem of poor performance of the YOLOv5s algorithm model for testing small target defect such as rail surface drops and clamp cracks,the YOLOv5s algorithm is optimized through data augmentation strategy and algorithm model improvement,and experimental and field application verifica-tion are conducted.The results showed that the average accuracy of the improved YOLOv5s algorithm model is im-proved by 7.7%and its testing speed is increased by 5.7 frames per second,which enables the track defect testing sys-tem to effectively test small defects such as rail surface drops and clamp cracks.The optimized YOLOv5s algorithm model provides a theoretical basis for accurately testing small target defects such as rail surface drops and clamp cracks by applying the track defect testing system.