Nowadays, the detection of traffic signs is an essential key link in automatic driving, intelligent transportation and other fields, which is related to people’s driving safety. A traffic sign detection algorithm based on improved YOLOv5 is proposed to solve the problems of missing detection, false detection, low recognition accuracy and excessive model parameters in the current traffic sign recognition. Firstly, a small target detection head is added to improve the recognition accuracy of small targets. Secondly, a CSC3 module combining CBAM, SPConv and C3 is designed, which is introduced into the YOLOv5 backbone network and reduces its number at the same time, in order to improve the feature extraction ability and reduce the number of parameters. The detection head used to detect large targets is deleted, and the SPP is replaced with SPPCSPC to improve the model’s ability to detect traffic signs. Cross-layer connections are added, and Concat connections are reconstructed to improve the recognition accuracy of the algorithm. EIOU is introduced to replace the CIOU loss function to solve the problem of missed detection and false detection. Finally, DWConv is used to replace the Conv of the backbone network to reduce the model parameters and improve the detection accuracy. The experimental results show that the average accuracy of the improved algorithm mAP @ 0.5:0.95 is 62.6%, which is 8.3 percentage points higher than the original YOLOv5s, the number of parameters has decreased by 10.1%, and the detection speed has reached 74 FPS, which can meet the actual detection requirements © 2023 Journal of Computer Engineering and Applications Beijing Co., Ltd.; Science Press. All rights reserved.