Aiming at the existing network's poor recognition of distant targets in road traffic scenes, insufficient expression of target features, and inaccurate target positioning, a road target detection method based on the improved YOLOv5 algorithm is proposed. Firstly, the feature extraction structure of the YOLOv5 algorithm is summarized, and the shortcomings of the original network structure are analyzed; secondly, a small target detection layer is added on the basis of the original network, and the recognition ability of the network for distant targets is improved by supplementing the fusion feature layer and introducing an additional detection head; thirdly, the original detection head is decoupled, and the expression ability of the network for target features is improved by changing the bounding box regression and target classification process into two branches; then, the prior frame is re-clustered, and the height-width ratio of the prior frame is adjusted by the K-means++ algorithm to enhance the network's positioning ability for the target; finally, ablation, comparison and visualization verification experiments are carried out with AP, mAP and FPS as evaluation indicators. The results show that the detection speed of the proposed algorithm on the BDD100K dataset is 95.2 frames/second, and the average accuracy reaches 55.6%, which is higher than that of the YOLOv5 algorithm 6.7%. It can be seen that the improved YOLOv5 algorithm has good target detection accuracy while meeting the real-time requirements of detection. It is suitable for road target detection tasks in complex traffic environments and has guiding significance for improving the visual perception ability of autonomous vehicles.