To address the existing problems such as low recognition accuracy and numerous detection errors in the current algorithms when detecting traffic signs, a traffic sign detection method based on the optimization of YOLOv5 was proposed. In the Backbone section, to achieve receptive fields of various sizes, obtain features of different complexities, and enhance the critical features of feature maps while suppressing redundant ones, the reparameterization module DBB was employed instead of Conv convolution, and convolutions with diverse scales are utilized to obtain receptive fields of various sizes. By means of feature extraction branches with different scales and diverse complexities, the feature space is enriched. Simultaneously, the SE attention mechanism was introduced. to enhance the significant features of the feature map and suppress redundant features, thereby enhancing the detection performance of the network; In the Neck section, a new SLA Neck was designed to aggregate feature maps from different layers, effectively preventing the loss of small target feature information. is employed as the neck structure, which reduces the number of parameters and the amount of computation while fusing the feature information of different levels, capturing more context information and details, segmenting the background information, enabling the model to be more focused on the target characteristic area, and enhancing the performance of the model when encountering objects of different sizes to achieve precise positioning; concurrently, The fused features were upsampled, and a small object detection layer was added to enhance shallow feature information. In the Head section, the IoU-Aware query selection was introduced, and the IoU score was incorporated into the objective function of the classification branch, using the IoU between the predicted box and the ground truth (GT) as the label for category prediction. This could achieve the consistent constraint on the classification and localization of the positive samples. and enhance the matching mechanism of the model, and reduce the occurrences of incorrect detection and missed detection; simultaneously, The SIoU was introduced as the loss function instead of the CIoU loss function, taking into account the direction between the ground truth box and the predicted box is encompassed within the loss range to elevate convergence speed and inference capability. The experimental results indicated that on the TT100K dataset, the proposed method, compared with YOLOv5m, reduced the amount of computation by 3.3%, and the number of parameters by 34.8%, while mAP and mAP@50:95 were improved by 13.8% and 10.4%, respectively. The experiment demonstrated that this model enhanced the detection accuracy while reducing the number of model parameters and the size of the model, making it valuable for practical applications.