Traffic sign detection method under complex background based on multi-scale feature fusion
By adopting the SS-YOLO method with multi-scale feature fusion in traffic sign detection, the error detection and missed detection problems in complex backgrounds and small target detection in the prior art are solved, and higher detection accuracy and real-time performance are achieved.
Patent Information
- Application Number
- CN202411624755.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-03-04
AI Technical Summary
The existing traffic sign detection methods have problems such as false detection and missed detection in complex backgrounds, inclement weather and small target detection, which is difficult to meet the high requirements of the automatic driving system for accuracy and real-timeness.
The SS-YOLO method based on multi-scale feature fusion is adopted to extract multi-scale features through the DS-C3 module and EMA attention mechanism, and a high-precision feature layer is generated through a four-layer multi-scale feature fusion network, combining the WIOU loss function to optimize the detection head, focusing on small object detection.
It improves the accuracy and robustness of traffic sign detection, enhances the detection ability of complex backgrounds and small targets, reduces the computational complexity, and meets the needs of real-time detection.
Smart Images

Figure CN119559611A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision and artificial intelligence technology, and in particular to a traffic sign detection method under complex backgrounds based on multi-scale feature fusion. Background Art
[0002] With the rapid development of autonomous driving technology, traffic signs, as an important source of information, have a direct impact on driving safety. Therefore, the accuracy and reliability of traffic sign detection have become a key research area in intelligent driving systems. Traditional manual feature extraction and classification algorithms have poor adaptability to environmental changes, especially in bad weather conditions (such as rainy and foggy days), when the visibility of traffic signs is reduced, increasing the difficulty of recognition.
[0003] There are two main types of traffic sign detection methods: single-stage detection and two-stage detection. The two-stage detection method first determines the region of interest by retrieving the approximate location of the object, and then uses a feature extraction network to determine the coordinates and specific category of the object. The single-stage detection method can complete the entire process from image to classification result within one network.
[0004] At present, the above two methods are commonly used in traffic sign detection. Yang et al. designed a visual multi-scale attention module for traffic sign detection, which fuses multi-scale feature maps with channel weights and spatial masks. Zhang et al. designed a bottom-up enhancement path to enhance the feature pyramid, thereby effectively utilizing the fine-grained features at the bottom to achieve accurate positioning of traffic signs. However, most CNN-based detection methods are designed for objects of normal size. When detecting traffic signs, directly selecting these methods to detect traffic signs in images will cause problems such as false detection and missed detection. Summary of the invention
[0005] The technical problem to be solved by the present invention is to provide a traffic sign detection method under complex background based on multi-scale feature fusion in view of the shortcomings of the prior art.
[0006] The technical solution of the present invention is as follows:
[0007] A method for detecting traffic signs under complex backgrounds based on multi-scale feature fusion, comprising the following steps:
[0008] A1 Image input: Obtain image information of traffic signs in real time through vehicle-mounted cameras or other image acquisition devices;
[0009] A2 backbone network feature extraction: The image is processed by the DS-C3 module to extract multi-scale feature information;
[0010] A3 Feature Fusion: The extracted multi-scale features are fused with the newly added 160×160 small target feature map to generate a feature layer containing high-precision information, enriching the scale of feature extraction;
[0011] A4 Detection and Classification: The small target detection head is used to predict the category and location of traffic signs. The WIOU loss function is used to reduce the impact of harmful gradients while ensuring high-quality anchor frames, thus improving the overall performance of the model and ultimately generating detection results.
[0012] A5 output results: Feedback the detection results to the driving system in real time to provide accurate traffic sign information.
[0013] In the method, in step A2, after the image is input, feature extraction is performed through the backbone structure of the SS-YOLO network; in this stage, the underlying features of the image are first extracted and processed through the DS-C3 module; the DS-C3 module includes a deep separable convolution, which can effectively reduce the amount of calculation, improve the operation efficiency, and make the network more suitable for embedded environments; in addition, the EMA attention mechanism module that follows it dynamically adjusts the feature weights, especially giving higher weights to the areas of small targets; the EMA module highlights the key areas by weighted processing of the input feature map, making the feature information of the small targets more prominent, and increasing the network's sensitivity to the features of the small targets.
[0014] In the method, in step A2, an integrated deep separable convolution module DS-C3 module is used to improve the detection accuracy of the network, and the DS-C3 module introduces deep separable convolution to further reduce the number of parameters and the amount of calculation; the feature map is connected together after passing through two deep separable convolution modules, and then processed by another deep separable convolution module; each deep separable convolution module is composed of a deep separable convolution, a batch normalization layer and a SiLU activation function; this module achieves the improvement of the detection capability and robustness of small targets while ensuring the lightweight of the model through channel-by-channel convolution and point-by-point convolution.
[0015] In the method, in step A2, an efficient multi-scale attention mechanism (EMA) is introduced to enhance the model's attention to key information; EMA significantly improves the detection performance of small targets by grouping the input feature maps in the channel dimension and using 3x3 and 1x1 convolution branches to extract the attention weights of the grouped feature maps in parallel.
[0016] The method, in step A3, in the feature fusion stage, SS-YOLO enriches the image feature expression through a four-layer multi-scale feature fusion network; compared with the three-layer feature fusion structure of the traditional YOLOv5, SS-YOLO adds a layer of 160×160 small target feature map to capture small target information with richer details; the four layers of feature maps are 160×160, 80×80, 40×40, and 20×20 respectively, and through top-down and bottom-up feature fusion, the spatial position information of each level is combined with the global semantic information to form a multi-scale feature expression; in this way, the network can accurately identify traffic signs of different scales and improve the detection accuracy of complex backgrounds and low-resolution traffic signs.
[0017] In the method, in step A4, in the detection head part, in order to focus more on the detection of small target traffic signs, SS-YOLO deletes the 20×20 large target detection head and only retains the 160×160, 80×80, and 40×40 feature map detection heads; each detection head includes multiple convolutional layers and prediction layers, and outputs prediction boxes and category labels through bounding box regression and classification layers; in this stage, the WIoU loss function is used to replace the original CIoU loss function. WIoU improves the network's regression accuracy for small target bounding boxes by reducing the gradient influence of low-quality samples, so that it can still stably detect small target traffic signs in scenes such as overlap, occlusion and complex background.
[0018] In the method, in step A4, the detection layer is optimized to address the problem that YOLOv5 does not perform well when processing small targets, a 20×20 detection head that is not suitable for small target detection is deleted, a special small target detection layer is introduced, and the feature enhancement network is deepened to generate a 160×160 small target feature map.
[0019] In the method, in step A4, an improved Wise-IOU (WIOU) bounding box loss function is proposed to replace the default CIOU loss function of YOLOv5; unlike the complex calculation of CIOU on intersection, centroid distance and box ratio, WIoU constructs an improved Bbox loss through a distance-based attention mechanism to reduce redundant calculations and speed up convergence; WIOUv1 combines the degree of outliers and the gradient gain allocation strategy to more effectively balance the contribution of low-quality samples and high-quality samples, thereby optimizing the generalization ability of the model and significantly improving the detection accuracy and convergence efficiency; WIOUv1 constructs an attention-based bounding box loss, assuming that the corresponding position of (x, y) in the target box is (xgt, ygt), Wg and Hg are the width and height of the minimum enclosing rectangle of the predicted box and the real box, IOU is the intersection-union ratio, and the WIOUv1 formula is
[0020] LWIoUv1 =R WIoU L IoU (1)
[0021] in
[0022]
[0023] LIOU=1-IOU (3)
[0024] To prevent low-quality samples from generating large harmful gradients, the outlier degree β is defined to describe the quality of the anchor box;
[0025]
[0026] Smaller gradient gains are assigned to anchor boxes with larger outliers, and WIOUv3 is constructed using the outliers and WIOUv1.
[0027] L WIOUv3 =rL IOUv1 (5)
[0028]
[0029] Where δ and α are a set of hyperparameters used to control the mapping of outlier β and gradient gain r.
[0030] The traffic sign detection method based on multi-scale feature fusion (SS-YOLO) proposed in the present invention aims to solve the problem of decreased detection accuracy of traffic signs in actual scenes due to factors such as weather, lighting changes and complex backgrounds. Specifically, traffic signs may be blurry, unclear, or even completely invisible in rainy, foggy or strong light, which will seriously affect the performance of the detection algorithm. In addition, when dealing with small targets (such as traffic signs in the distance), traditional target detection algorithms are usually difficult to accurately identify due to insufficient feature information, and thus cannot meet the high requirements of autonomous driving for small target detection. At the same time, complex background interference (such as buildings, pedestrians, other vehicles, etc.) may lead to false detection or missed detection, further affecting the safety of the system.
[0031] The present invention also proposes a solution to the computational complexity problem in real-time detection. With the development of intelligent driving technology, higher requirements are placed on the real-time and high efficiency of traffic sign detection algorithms, but traditional algorithms often have a large number of parameters and high computational complexity, making it difficult to meet real-time application requirements. Therefore, the present invention aims to improve the accuracy, robustness and real-time performance of traffic sign detection by improving the detection algorithm, thereby providing reliable technical support for intelligent driving.
[0032] Multi-scale feature fusion: Traditional traffic sign detection algorithms are prone to missed detection or false detection when facing complex backgrounds, lighting changes, and small target detection. This paper improves the robustness of the model by using multi-scale feature fusion, generating high-resolution feature layers, and removing large target detection heads to focus on small target detection, so that it can still work stably in complex real-world scenarios.
[0033] Lightweight and efficient: The traffic sign detection algorithms in the prior art often have large parameters and high computational complexity, making them difficult to implement in embedded devices and resource-constrained environments. However, the present invention introduces the DS-C3 module and uses depthwise separable convolution to significantly reduce the number of model parameters and computational complexity, significantly improve computational efficiency, and maintain high detection accuracy.
[0034] Optimized design for small target detection: To address the problem of small target traffic sign detection, this paper specifically optimizes the detection performance of small targets by removing the 20×20 detection head and adding a 160×160 prediction feature map. This design effectively improves the accuracy of the model in detecting small traffic signs and solves the common problems of missed detection and false detection in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is the structural diagram of SS-YOLO of the present invention;
[0036] Figure 2 It is the structural diagram of DS-C3 of the present invention;
[0037] Figure 3 This is the structural diagram of the EMA attention mechanism of the present invention;
[0038] Figure 4 Comparison of detection effects between YOLOv5 and SS-YOLO. DETAILED DESCRIPTION
[0039] The present invention is described in detail below in conjunction with specific embodiments.
[0040] The SS-YOLO of the present invention is based on the YOLOv5s structure and includes three parts: a backbone network, a feature fusion network, and a detection head. The structure diagram of SS-YOLO is shown in FIG. Figure 1 As shown in the figure: the backbone network is responsible for extracting the feature information of the input image, the feature fusion network enhances the detection effect by fusing multi-scale features, and the detection head is responsible for locating and classifying traffic signs. The specific detection process of SS-YOLO is as follows:
[0041] A1 Image input: Obtain image information of traffic signs in real time through vehicle-mounted cameras or other image acquisition devices.
[0042] A2 backbone network feature extraction: The image is processed by the DS-C3 module to extract multi-scale feature information.
[0043] After the image is input, it is extracted through the backbone structure of the SS-YOLO network. In this stage, the underlying features of the image are first extracted and processed by the DS-C3 module. The DS-C3 module contains deep separable convolutions, which can effectively reduce the amount of calculation, improve the operation efficiency, and make the network more suitable for embedded environments. In addition, the EMA attention mechanism module that follows it dynamically adjusts the feature weights, especially giving higher weights to the areas of small targets. The EMA module highlights the key areas by weighted processing of the input feature map, making the feature information of small targets more prominent and increasing the network's sensitivity to the features of small targets.
[0044] The present invention adopts an integrated deep separable convolution module (DS-C3 module) to improve the detection accuracy of the network. Compared with the traditional C3 module, the DS-C3 module introduces deep separable convolution to further reduce the number of parameters and calculations. The specific structure is as follows Figure 2 As shown in the figure, the feature maps are connected together after passing through two depthwise separable convolution modules, and then processed by another depthwise separable convolution module. Each depthwise separable convolution module consists of a depthwise separable convolution, a batch normalization layer, and a SiLU activation function. This module achieves improved detection capabilities and robustness for small targets while ensuring the lightweight of the model through channel-by-channel convolution and point-by-point convolution.
[0045] In this paper, an efficient multi-scale attention mechanism (EMA) is introduced to enhance the model's attention to key information. EMA significantly improves the detection performance of small objects by grouping the input feature maps in the channel dimension and using 3x3 and 1x1 convolution branches to extract the attention weights of the grouped feature maps in parallel. Figure 3 The specific structure of EMA is demonstrated, and richer feature aggregation is achieved through this method, thereby improving detection accuracy while reducing the number of parameters and computational overhead.
[0046] A3 Feature Fusion: The extracted multi-scale features are fused with the newly added 160×160 small target feature map to generate a feature layer containing high-precision information, enriching the scale of feature extraction.
[0047] In the feature fusion stage, SS-YOLO enriches the image feature expression through a four-layer multi-scale feature fusion network. Compared with the three-layer feature fusion structure of the traditional YOLOv5, SS-YOLO adds a layer of 160×160 small target feature map to capture more detailed small target information. The four layers of feature maps are 160×160, 80×80, 40×40, and 20×20 respectively. Through top-down and bottom-up feature fusion, the spatial position information of each level is combined with the global semantic information to form a multi-scale feature expression. In this way, the network can accurately identify traffic signs of different scales and improve the detection accuracy of complex backgrounds and low-resolution traffic signs.
[0048] A4 Detection and classification: The small target detection head is used to predict the category and location of traffic signs. The WIOU loss function is used to reduce the impact of harmful gradients while ensuring high-quality anchor frame effects, thereby improving the overall performance of the model and ultimately generating detection results.
[0049] In the detection head part, in order to focus more on the detection of small target traffic signs, SS-YOLO deleted the 20×20 large target detection head and only retained the 160×160, 80×80, and 40×40 feature map detection heads. Each detection head contains multiple convolutional layers and prediction layers, and outputs the prediction box and category label through the bounding box regression and classification layers. In this stage, the WIoU loss function is used to replace the original CIoU loss function. WIoU improves the network's regression accuracy for small target bounding boxes by reducing the gradient impact of low-quality samples, so that it can still stably detect small target traffic signs in scenes such as overlap, occlusion, and complex backgrounds.
[0050] In view of the problem that YOLOv5 does not work well when processing small targets, the present invention optimizes the detection layer, especially removes the 20×20 detection head that is not suitable for small target detection, introduces a special small target detection layer, and deepens the feature enhancement network to generate a 160×160 small target feature map. This improvement significantly improves the model's ability in small target traffic sign detection, improves the accuracy and reliability of detection, and reduces the computing and storage requirements, so that the model can run on embedded devices with limited resources.
[0051] The present invention proposes an improved Wise-IOU (WIOU) bounding box loss function to replace the default CIOU loss function of YOLOv5. Unlike CIOU's complex calculations on intersection, centroid distance, and box ratio, WIoU constructs an improved Bbox loss through a distance-based attention mechanism to reduce redundant calculations and speed up convergence. The WIOUv1 in the present invention combines the degree of outliers and the gradient gain allocation strategy, which can more effectively balance the contributions of low-quality samples and high-quality samples, thereby optimizing the generalization ability of the model and significantly improving detection accuracy and convergence efficiency. WIOUv1 constructs an attention-based bounding box loss, assuming that the corresponding position of (x, y) in the target box is (xgt, ygt), Wg and Hg are the width and height of the minimum enclosing rectangle of the predicted box and the true box, IOU is the intersection-union ratio, and the WIOUv1 formula is
[0052] L WIoUv1 =R WIoU L IoU (1)
[0053] in
[0054]
[0055] LIOU=1-IOU (3)
[0056] To prevent low-quality samples from generating large harmful gradients, an outlier degree β is defined to describe the quality of the anchor box.
[0057]
[0058] Smaller gradient gains are assigned to anchor boxes with larger outliers, and WIOUv3 is constructed using the outliers and WIOUv1.
[0059] L WIOUv3 =rL IOUv1 (5)
[0060]
[0061] Where δ and α are a set of hyperparameters used to control the mapping of outlier β and gradient gain r.
[0062] A5 output results: Feedback the detection results to the driving system in real time to provide accurate traffic sign information.
[0063] Experimental results and analysis
[0064] 1 Experimental platform and parameters
[0065] In order to make the experimental results more uniform, the models all use the same hyperparameters, using the SGD optimizer, the initial learning rate is 0.01, the momentum parameter is 0.937, the cyclic learning rate is 0.1, the batch-size is set to 8, and the training rounds are 300. The experimental environment of this paper is shown in Table 1.
[0066] Table 1 Experimental environment
[0067]
[0068] 2 Datasets
[0069] CCTSDB 2021 Dataset: CCTSDB 2021 China Traffic Sign Detection Dataset produced by Changsha University of Science and Technology, which contains nearly 20,000 traffic sign images and nearly 40,000 traffic sign instances. This paper selects 18,856 images, including training set (16,356 images), validation set (1,500 images) and test set (1,000 images).
[0070] 3 Evaluation Metrics
[0071] This paper uses four performance indicators, namely, mean average accuracy (mAP@0.5), recall, precision, and params, to evaluate the model. Precision measures the degree of false positives of the model, while recall measures the degree of missed positives of the model. mAP@0.5 comprehensively considers the changes of precision and recall with the threshold, and intuitively shows the performance of the model. Params reflects the complexity level of the model. The fewer the parameters, the simpler the model and the less memory it occupies.
[0072] 4 Ablation experiments
[0073] In order to verify the effectiveness of the improvements made in this paper on the small target traffic sign detection model and the impact of each improvement on the performance, ablation experiments were conducted on the CCTSDB 2021 dataset. The results of the ablation experiments are shown in Table 2 below:
[0074] Table 2 Ablation experiment data on CCTSDB dataset
[0075]
[0076] From the ablation experiment, although the additional small target feature extraction layer increases the number of parameters, the deletion of the large target detection head reduces the number of parameters and significantly improves the accuracy. Secondly, the C3-DS module and EMA attention mechanism not only effectively reduce feature redundancy and speed up the detection, but also improve the detection effect. Finally, the WIoU module ensures the effectiveness of each feature focus, allowing the network to focus on traffic signs in the image more accurately. This improvement significantly improves the recall rate, while achieving a better balance between accuracy and recall, thereby improving the overall detection effect.
[0077] In general, the experimental results show that the optimization of each algorithm has a positive effect on the final result, and the combined changes of the four algorithms are applied simultaneously to achieve the optimal average accuracy of the algorithm.
[0078] 5 Traffic Sign Detection Model Comparison Experiment
[0079] In order to verify the feasibility of different models on the CCTSDB dataset, some current one-stage and two-stage mainstream network models were trained and tested respectively, and precision (Precision, P), recall (Recall, R), mAP, and detection speed (FPS) were comprehensively considered as comparison indicators. The experimental results are shown in Table 3. The comparative experiment selected YOLOv5s, Faster R-CNN, SSD, RetinaNet, YOLOv3, Libra R-CNN, YOLOv7, Dynamic R-CNN and SS-YOLO proposed in this paper for comparative experiments. Faster R-CNN is the most typical two-stage target detection model. In the comparative experiment, Faster R-CNN has the most parameters and calculations, and its mAP is higher than SSD, YOLOv3 and YOLOv4, but the number of parameters is large and it is difficult to apply in practice. Since SSD is not effective in detecting small targets, its mAP value is low, and the number of parameters and detection time are also large. In terms of accuracy, YOLOv7 is close to SS-YOLO, but its mAP value is lower than SS-YOLO, with a difference of 2.68%. The results show that SS-YOLO achieves the best detection results at the fastest detection speed in the CCTSDB dataset, which also makes it feasible to deploy it on autonomous vehicles.
[0080] Table 3 Comparison with mainstream algorithms on CCTSDB dataset
[0081]
[0082]
[0083] 6 Traffic sign detection results comparison
[0084] To demonstrate the detection capability of SS YOLO, visualization results are provided. Figure 4 (a) The original image, as well as (b) the detection results of YOLOv5s and (c) the detection results of SS YOLO are shown. The detection results are enlarged for easier observation. Compared with YOLOv5, SS-YOLO achieves higher precision and recall, successfully fully detecting smaller traffic signs that YOLOv5s missed. In addition, SS-YOLO improves the detection speed and outperforms YOLOv5s, which is very beneficial for real-world applications in traffic sign detection and intelligent driving systems.
[0085] It should be understood that those skilled in the art can make improvements or changes based on the above description, and all these improvements and changes should fall within the scope of protection of the appended claims of the present invention.
Claims
1. A traffic sign detection method under complex background based on multi-scale feature fusion, characterized in that: The following steps are involved: A1 Image input: Obtain image information of traffic signs in real time through vehicle-mounted cameras or other image acquisition devices; A2 backbone network feature extraction: The image is processed by the DS-C3 module to extract multi-scale feature information; A3 Feature Fusion: The extracted multi-scale features are fused with the newly added 160×160 small target feature map to generate a feature layer containing high-precision information, enriching the scale of feature extraction; A4 Detection and Classification: The small target detection head is used to predict the category and location of traffic signs. The WIOU loss function is used to reduce the impact of harmful gradients while ensuring high-quality anchor frames, thus improving the overall performance of the model and ultimately generating detection results. A5 output results: Feedback the detection results to the driving system in real time to provide accurate traffic sign information.
2. The method according to claim 1, characterized in that In step A2, after the image is input, it is subjected to feature extraction through the backbone structure of the SS-YOLO network. In this stage, the underlying features of the image are first extracted and processed through the DS-C3 module. The DS-C3 module includes a deep separable convolution, which can effectively reduce the amount of calculation, improve the operation efficiency, and make the network more suitable for embedded environments. In addition, the EMA attention mechanism module that follows it dynamically adjusts the feature weights, especially giving higher weights to the areas of small targets. The EMA module highlights the key areas by weighting the input feature map, making the feature information of small targets more prominent and increasing the network's sensitivity to small target features.
3. The method according to claim 1, characterized in that In the step A2, an integrated deep separable convolution module DS-C3 module is used to improve the detection accuracy of the network. The DS-C3 module introduces deep separable convolution to further reduce the number of parameters and the amount of calculation; the feature map is connected together after passing through two deep separable convolution modules, and then processed by another deep separable convolution module; each deep separable convolution module is composed of a deep separable convolution, a batch normalization layer and a SiLU activation function; this module achieves the improvement of the detection capability and robustness of small targets while ensuring the lightweight of the model through channel-by-channel convolution and point-by-point convolution.
4. The method according to claim 1, characterized in that: In step A2, an efficient multi-scale attention mechanism (EMA) is introduced to enhance the model's attention to key information; EMA significantly improves the detection performance of small objects by grouping the input feature maps in the channel dimension and using 3x3 and 1x1 convolution branches to extract the attention weights of the grouped feature maps in parallel.
5. The method according to claim 1, characterized in that In the step A3, in the feature fusion stage, SS-YOLO enriches the image feature expression through a four-layer multi-scale feature fusion network; compared with the three-layer feature fusion structure of the traditional YOLOv5, SS-YOLO adds a layer of 160×160 small target feature map to capture small target information with richer details; the four layers of feature maps are 160×160, 80×80, 40×40, and 20×20 respectively, and through top-down and bottom-up feature fusion, the spatial position information of each level is combined with the global semantic information to form a multi-scale feature expression; in this way, the network can accurately identify traffic signs of different scales and improve the detection accuracy of complex backgrounds and low-resolution traffic signs.
6. The method according to claim 1, characterized in that In step A4, in the detection head part, in order to focus more on the detection of small target traffic signs, SS-YOLO deletes the 20×20 large target detection head and only retains the 160×160, 80×80, and 40×40 feature map detection heads; each detection head contains multiple convolutional layers and prediction layers, and outputs prediction boxes and category labels through bounding box regression and classification layers; at this stage, the WIoU loss function is used to replace the original CIoU loss function. WIoU improves the network's regression accuracy for small target bounding boxes by reducing the gradient influence of low-quality samples, so that it can still stably detect small target traffic signs in scenes such as overlap, occlusion and complex background.
7. The method according to claim 1, characterized in that In step A4, in order to solve the problem that YOLOv5 does not perform well in processing small targets, the detection layer is optimized by deleting the 20×20 detection head that is not suitable for small target detection, introducing a special small target detection layer, and deepening the feature enhancement network to generate a 160×160 small target feature map.
8. The method according to claim 1, characterized in that In step A4, an improved Wise-IOU (WIOU) bounding box loss function is proposed to replace the default CIOU loss function of YOLOv5; unlike the complex calculation of CIOU on intersection, centroid distance and box ratio, WIoU constructs an improved Bbox loss through a distance-based attention mechanism to reduce redundant calculations and accelerate convergence; WIOUv1 combines the degree of outliers and the gradient gain allocation strategy to more effectively balance the contribution of low-quality samples and high-quality samples, thereby optimizing the generalization ability of the model and significantly improving detection accuracy and convergence efficiency; WIOUv1 constructs an attention-based bounding box loss, assuming that the corresponding position of (x, y) in the target box is (xgt, ygt), Wg and Hg are the width and height of the minimum enclosing rectangle of the predicted box and the true box, IOU is the intersection-union ratio, and the WIOUv1 formula is L WIoUv1 =R WIoU L IoU (1) in LIOU=1-IOU (3) To prevent low-quality samples from generating large harmful gradients, the outlier degree β is defined to describe the quality of the anchor box; Smaller gradient gains are assigned to anchor boxes with larger outliers, and WIOUv3 is constructed using the outliers and WIOUv1. L WIOUv3 =rL IOUv1 (5) Where δ and α are a set of hyperparameters used to control the mapping of outlier β and gradient gain r.