Abstract:For the subway system, An innovative turnout displacement detection method was designed , which integrated the optimized YOLOv5 object detection algorithm and QR code position recognition technology. By accurately identifying the position change of the QR code on the turnout, real-time detection and early warning of displacement can be realized; By pasting the QR code target on the track fork tip, the fork tip displacement is detected in real time by using a vision sensor; The YOLOv5s model is used for object detection, and the CBAM attention mechanism and DIoU loss function are introduced to improve the detection accuracy and efficiency. In order to improve the real -time nature of the road fork shift detection, the police reported in time under abnormal situations, we added the ShuffNet V2 module to the network. Experimental results show that the improved YOLOv5 model has excellent detection performance on QR code targets under different lighting conditions and meets the needs of use in real time, which provides reliable data support for the health detection of subway tracks. This solution aims to overcome the limitations of traditional detection methods and ensure a smoother and safer train operation.