YOLO v5 was born when Joseph Redmon, the father of YOLO, announced his retirement from the field of computer vision, and its structure was further optimized on the basis of YOLO v4. After the sort target tracking algorithm was proposed, the deep sort algorithm added the optimization of apparent features on the basis of the sort algorithm, which enables the model to be more suitable for practical situations and more mature for vehicle detection on traffic roads. Focusing on the new direction of road traffic detection, a single camera is used to detect and track dual-channel vehicles. In the process of experimental exploration, a “double vertical line” algorithm is proposed by introducing the attention mechanism into the YOLO v5 structure and combining with the deep sort target tracking algorithm, which provides a new thinking angle and flow chart for vehicle repeat counting. Finally, the detection results of vehicle identity and traffic flow are obtained through experiments, enabling vehicles to be detected and tracked in real time even on roads with a certain speed. In addition, the calculation law avoids the miscalculation of roads with forks, obtains excellent results on vehicle types and traffic flow, and uses id identity to give car information, which significantly improves the possibility that the model can be applied to practical problems.