Multi-scale fusion traffic sign real-time detection method and system
By constructing a multi-scale fusion traffic sign detection method, using the ADC-DETR model and Focaler_L2 loss function, the problem of difficulty in detecting small and medium-sized targets and complex scenes in the existing technology is solved, and the traffic sign detection effect is achieved through real-time detection and efficient calculation.
Patent Information
- Application Number
- CN202411129367.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-11-29
AI Technical Summary
The existing traffic sign detection methods have problems such as slow detection speed, large calculation amount, high sensitivity to small targets and large data requirements when dealing with small targets and complex scenarios, which are difficult to meet the real-time detection needs.
A multi-scale fusion real-time detection method for traffic signs is proposed. By building an ADC-DETR model, PCBlock replaces the BasicBlock module of the RT-DETR backbone network with PCBlock, the AD_CCFM module replaces the cross-scale feature fusion module of the hybrid encoder, and Focaler_L2 loss is used. Functions are trained to reduce the amount of parameters and improve computational efficiency.
The detection speed is improved, the amount of parameters is reduced, the calculation efficiency and detection accuracy are improved, so that the model can be better applied to small-target traffic sign detection, and the adaptability and feature extraction capabilities for complex scenarios are enhanced.
Smart Images

Figure CN119049014A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer vision and traffic sign detection, and in particular to a multi-scale fusion traffic sign real-time detection method and system. Background Art
[0002] In recent years, with the continuous advancement of intelligent driving and intelligent assisted driving and the rapid growth of traffic flow, traffic management and safety issues have become increasingly prominent. Traffic signs, as an important part of road traffic management, play an important role in ensuring road traffic order and improving driving safety. With the development of vehicle automation technology, accurate and rapid detection of traffic signs can assist drivers or autonomous driving systems in making correct driving decisions.
[0003] Traditional traffic sign detection methods include: color-based traffic sign detection method, shape-based traffic sign detection method and fusion feature-based traffic sign detection method. The color-based traffic sign detection method extracts possible traffic signs from the color space according to the specific color range of the traffic sign. Common color spaces include RGB, HSI and HSV. The shape-based traffic sign detection method is based on the main types of traffic signs to quickly segment the traffic signs from the complex environment by detecting the outline of the traffic signs to obtain the region of interest of the traffic signs. The main shape categories of traffic signs are rectangles, circles and triangles. The fusion feature-based traffic sign detection method combines color and shape. This method can well solve the defects of the two detection methods based on color and shape, and improve the detection accuracy.
[0004] In recent years, the application of deep learning in the field of traffic sign recognition has developed rapidly. Compared with traditional machine learning, traffic sign recognition based on deep learning does not require manual design and extraction of sign image features. Instead, human-like neural networks complete feature extraction and recognition through autonomous learning and correction during training. At present, target detection algorithms based on deep learning are mainly divided into two schools: two-stage algorithms represented by the R-CNN series and one-stage algorithms represented by YOLO and SSD.
[0005] RT-DETR is an end-to-end object detector that uses a Transformer encoder and decoder structure, which is similar to the DETR model, but can achieve real-time target detection. Compared with the traditional DETR model, RT-DETR improves detection speed, has high efficiency and accuracy, reduces the number of parameters, and has a wide range of application scenarios. The RT-DETR network mainly consists of three parts: Backbone, hybrid encoder, and decoder. First, the backbone network is used to extract the feature representation of the input image; then the hybrid encoder is used to process the extracted features; finally, a certain number of feature points are selected from the processed features as the initial position of the target query, and the decoder uses the Transformer structure to interact the initial target query with the features to generate the prediction result of the target.
[0006] The document "Chinese invention patent application publication number CN117994761A" discloses a traffic sign detection method based on a DETR-like network model. This method uses TridentNet as the backbone network for feature extraction, which can improve the accuracy of small target traffic sign detection in complex scenarios, but it has problems such as long training time, lack of real-time performance, and large amount of calculation.
[0007] The document "Chinese invention patent with application publication number CN117789177A" discloses a traffic sign detection method based on composite feature fusion, which is specifically aimed at the problem of traffic sign detection under severe weather conditions. By constructing an auxiliary backbone network for auxiliary feature extraction and a main backbone network for feature fusion, the detection capability of the model is enhanced under severe weather conditions such as rainy days, foggy days, and snowy days. The composite feature fusion method improves the robustness and accuracy of traffic sign detection by constructing a multi-scale bidirectional feature pyramid network. However, this method has certain challenges in terms of training complexity, sensitivity to small targets, and hyperparameter adjustment.
[0008] The document "Chinese invention patent application publication number CN118015581A" discloses a single-stage target detection method for traffic sign detection. By constructing a YOLOV5s backbone network for feature extraction and a bottleneck network for feature fusion, it has the advantages of high efficiency, fast detection, and high accuracy in traffic sign detection. However, it has certain limitations in terms of computational complexity, sensitivity to small targets, and data requirements.
[0009] The document "Chinese invention patent application publication number CN117975418A" discloses a traffic sign detection method based on improved RT-DETR, which reduces the complexity of the model by replacing the BasicBlock module in the backbone network; and by adding the MCCA attention mechanism, the convolution can fully extract the features of each path. However, its sensitivity to small targets in complex scenes has certain limitations. Summary of the invention
[0010] Purpose of the invention: In response to the problems pointed out in the background technology, the present invention proposes a multi-scale fusion traffic sign real-time detection method and system. The detection speed meets the real-time requirements. The improved detection model reduces the number of parameters, improves the calculation efficiency and detection accuracy, so that it can be better applied to small target traffic sign detection.
[0011] Technical solution: The present invention discloses a multi-scale fusion traffic sign real-time detection method, the specific steps are as follows:
[0012] Step 1: Build the ADC-DETR model, use the defined PCBlock to replace the BasicBlock module of the RT-DETR backbone network BackBone; use the AD_CCFM module to replace the cross-scale feature fusion CCFM module of the RT-DETR hybrid encoder;
[0013] Step 2: Replace the GIoU loss function in RT-DETR with the defined Focaler_L2 loss function and train it using the public dataset TT100K to determine the model parameters;
[0014] Step 3: Obtain a driving record video stream dataset V1, extract key frames from the driving record video stream dataset V1, obtain a driving record video stream key frame dataset V2, input the driving record video stream key frame dataset V2 into the ADC-DETR model, and obtain a traffic sign prediction dataset P;
[0015] Step 4: Define a confidence threshold Conf, and determine whether the key frame of the video stream in the traffic sign prediction dataset P contains a traffic sign based on the threshold, and obtain the traffic sign key frame dataset T.
[0016] Furthermore, in step 1, PCBlock uses a 3×3 convolution module to convert the output channel into twice the input channel, and then connects the PConv convolution module, BN module and ReLu activation function in series, and then connects a jump connection ShortCut including average pooling and 1×1 convolution in parallel, and finally performs point-by-point addition and ReLu activation.
[0017] Furthermore, the AD_CCFM module in step 1 includes multiple convolution modules, two DySample dynamic upsampling modules, multiple RepC3 modules, a Z_Cat module and an ASF_Dy module, wherein the ASF_Dy module is composed of a Z_Cat module connected in series with a RepC3 module and a DySF module in parallel, and then connected in series with a CPAM attention mechanism module; the specific structure is as follows:
[0018] Step 1.1: Define the feature map as a two-dimensional tensor containing key feature information of the traffic sign image extracted by the convolution operation of the input traffic sign image. The input traffic sign image first undergoes convolution, maximum pooling operation and the first PCBlock module to obtain feature map P1. Feature map P1 is extracted and enhanced by the second PCBlock module to obtain feature map P2. Feature map P2 is further passed through the third PCBlock module to obtain feature map P3. Feature map P3 is passed through the fourth PCBlock module and convolution operation to obtain feature map P4. Feature map P4 is passed through the intra-scale feature interaction module AIFI, convolution operation and the first DySample dynamic upsampling module to generate feature map P5.
[0019] Step 1.2: Define the first Z_Cat module, which takes the output of feature map P2 after 1×1 convolution, feature map P3 and the output of the first DySample dynamic upsampling module as input. The output of the first Z_Cat module is used as the input of the first RepC3 module.
[0020] Step 1.3: The output of the first Z_Cat module is connected in series with the first RepC3 module, and after 1×1 convolution, the output feature map P11 is input to the second DySample dynamic upsampling module;
[0021] Step 1.4: Define the second Z_Cat module, which has the same structure as the first Z_Cat module, and takes the output of the feature map P1 after 1×1 convolution, the feature map P2 and the output of the second DySample dynamic upsampling module as input. The output of the second Z_Cat module is used as the input of the second RepC3 module, and the second RepC3 module has the same structure as the first RepC3 module;
[0022] Step 1.5: Define the DySF module. The DySF module takes the feature maps P2, P3, and P4 as input. The second RepC3 module and the DySF module are connected in parallel as the input of the CPAM attention mechanism module. The output of the CPAM attention mechanism module is used as the input of the RTDETRDecoder. The output of the CPAM attention mechanism module is horizontally spliced with the feature map P11 after 1×1 convolution and input into the third RepC3 module with the same structure as the first RepC3 module. The output of the third RepC3 module is used as the input of another RTDETRDecoder. The output of the third RepC3 module is horizontally spliced with the feature map P4 after 1×1 convolution and the feature map obtained by the in-scale feature interaction module AIFI and convolution operation, and input into the fourth RepC3 module with the same structure as the first RepC3 module. The output of the fourth RepC3 module is used as the input of the third RTDETRDecoder.
[0023] Furthermore, the first Z_Cat module uses a 1×1 convolution from the feature map P2 to obtain the feature map P6, and then uses a 1×1 convolution to change the number of output channels of the feature map P6 to twice the number of input channels to obtain the feature map P7, and then uses the maximum pooling MaxPool in parallel with the average pooling AvgPool to add the feature map P7 and the feature map P3 point by point to obtain the feature map P8; uses a 1×1 convolution to change the number of output channels of the feature map P5 to half the number of input channels, and uses the nearest neighbor interpolation nearest method to obtain a feature map P9 of the same size as the feature map P3; the feature map P3 is obtained by a 1×1 convolution to obtain a feature map P10 of the same size; the ConCat method in PyTorch is used to horizontally splice the three feature maps P8, P9, and P10, and the output number of channels is the sum of the number of channels of the feature maps P8, P9, and P10.
[0024] Furthermore, the RepC3 module is composed of two 1×1 convolutions in parallel, one of which is subjected to RepConv reparameterization and is added point by point with the output of the other convolution to form a residual connection. If the number of hidden channels is not equal to the number of output channels, an additional 1×1 convolution is used to adjust the channels.
[0025] Furthermore, the DySF module is specifically as follows: the feature maps P2, P3, and P4 are respectively subjected to channel adjustment and dynamic upsampling DySample through 1×1 convolution to generate normalized feature maps Q1, Q2, and Q3 with consistent scales, and then the normalized feature maps Q1, Q2, and Q3 are dimensionally expanded using the dimensionality increase function unsqueeze to form three three-dimensional feature maps, and the three three-dimensional feature maps are stacked and spliced along the channel dimension to obtain the feature map Q4, 3D convolution, batch normalization, and activation function operations are performed on the feature map Q4, and a 3D maximum pooling layer is used to perform a pooling operation to obtain a pooled three-dimensional feature map Q5, and finally the dimensionality reduction function squeeze is used to restore the pooled three-dimensional feature map Q5 to a two-dimensional feature map.
[0026] Furthermore, the Focaler_L2 loss function in step 2 is as follows:
[0027]
[0028] Among them, IoU is the overlap loss between the predicted box and the true box, d represents the density of the target area, u represents the prediction confidence of the target area, [d,u]∈[0,1], λ is the regularization strength hyperparameter, and θ is all trainable parameters of the model.
[0029] Furthermore, the specific steps of step 3 are as follows:
[0030] Step 3.1: Obtain a driving record video stream dataset V1, extract key frames from the driving record video stream dataset V1, and use a BloomFilter and a data de-invalidation method to perform data cleaning operations on the driving record video stream dataset V1 to obtain a driving record video stream key frame dataset V2;
[0031] Step 3.2: Use the determined model parameters to predict the key frame dataset V2 of the driving record video stream, perform an end-to-end detection process, take images of any size as input, normalize the images to a uniform size of 640×640 pixels, use the ADC-DETR model to predict the normalized images, filter out accurate prediction boxes, and obtain a traffic sign prediction data set P containing the detection results.
[0032] Furthermore, the specific steps in step 4 are as follows:
[0033] The intersection over union (IoU) threshold is used to exclude candidate boxes with a low degree of overlap with the true bounding box, and the confidence threshold Conf is defined to further filter the prediction results. For each traffic sign video stream key frame in the traffic sign prediction dataset P, a series of candidate bounding boxes with confidence scores are generated. In the screening process, the candidate boxes with a low degree of overlap with the true bounding box are first excluded according to the IoU threshold. Then, the confidence threshold Conf is used to determine whether the remaining candidate boxes are sufficiently reliable to represent the existence of the traffic sign. The confidence score of the candidate box is compared with the confidence threshold Conf. If the score is higher than Conf, it is considered that the candidate box contains a traffic sign, and its corresponding key frame is added to the traffic sign key frame dataset T.
[0034] The present invention also discloses a multi-scale fusion traffic sign real-time detection system, including a memory, a processor and a computer program. When the computer program is loaded into the processor and executed, it can execute the steps of the above-mentioned multi-scale fusion-based traffic sign real-time detection method.
[0035] Beneficial effects:
[0036] 1. The present invention first uses PConv convolution to construct the PCBlock module, which reduces redundant calculations and memory accesses, reduces the number of parameters and computational costs, and improves the processing capability and nonlinear processing of occluded and irregular input data.
[0037] 2. Secondly, in the hybrid encoder part, the AD_CCFM module is proposed, which can combine features of different scales to capture information of different scales in the image, making the model more adaptable when dealing with complex scenes or objects. This module also enhances the network's multi-scale information extraction capability, which helps to extract more useful features when dealing with small targets or complex textures.
[0038] 3. Finally, the Focaler-L2 loss function is used. Through L2 regularization, not only the generalization ability and localization error of the model are enhanced, but also the model parameters are normalized, making the model more robust on unseen data.
[0039] 4. Experimental results show that the method of the present invention effectively improves the feature extraction capability of traffic signs. Compared with the RT-DETR model, it reduces the number of parameters by 27.8%, and the accuracy and average precision value are also effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 is a method flow chart of an embodiment of the present invention;
[0041] Figure 2 is an overall network structure diagram of an embodiment of the present invention;
[0042] Figure 3 is a schematic diagram of a PCBlock module in an embodiment of the present invention;
[0043] Figure 4 is a structural diagram of Z_Cat in an embodiment of the present invention;
[0044] Figure 5 is a structural diagram of DySF in an embodiment of the present invention;
[0045] Figure 6 is a schematic diagram of an ASF_Dy module in an embodiment of the present invention;
[0046] Figure 7 1 is a detection effect diagram of the original RT-DETR algorithm of an embodiment of the present invention in a real-time road;
[0047] Figure 8 This is a diagram showing the detection effect of the algorithm of the present invention on a real road. DETAILED DESCRIPTION
[0048] The present invention is further described below in conjunction with embodiments. It is necessary to point out that the following embodiments are only used to further illustrate the present invention and cannot be understood as limiting the scope of protection of the present invention. Some non-essential improvements and adjustments made by technical personnel in this field based on the above invention content still fall within the scope of protection of the present invention.
[0049] The present invention proposes a multi-scale fusion traffic sign real-time detection method and system, the method comprises obtaining an image or video stream to be identified, inputting the image or video stream to be identified into an ADC-DETR model, and the specific steps include:
[0050] Step 1: Use the customized PCBlock to replace the BasicBlock module of the RT-DETR backbone network BackBone. The specific method is as follows:
[0051] Step 1.1: Define PConv convolution, use the split method in Python to split the input x into two parts along the channel dimension: the number of channels x1 used for convolution and the number of channels x2 that remain unchanged, perform a convolution operation on x1, and use the ConCat method in PyTorch to horizontally splice the convolved x1 and the unmodified x2 to obtain the output x3.
[0052] Step 1.2: Define the PCBlock module, which consists of a 3×3 convolution module that doubles the output channel to the input channel. Then, after connecting the PConv convolution module, the BN module, and the ReLu activation function in series, connect a jump connection ShortCut containing average pooling and 1×1 convolution in parallel, and finally perform point-by-point addition and ReLu activation.
[0053] Step 2: Use the AD_CCFM module to replace the cross-scale feature fusion CCFM module of the RT-DETR hybrid encoder. For the ADC-DETR model framework diagram of the embodiment of the present invention, see Figure 2 , the specific method is:
[0054] Step 2.1: Define the feature map as a two-dimensional tensor containing key feature information of the traffic sign image extracted from the input traffic sign image through a convolution operation. The input traffic sign image first undergoes convolution, maximum pooling operations, and a PCBlock module to obtain a feature map P1. The feature map P1 is extracted and enhanced by the PCBlock module to obtain a feature map P2. The feature map P2 is further processed by the PCBlock module to obtain a feature map P3. Subsequently, the feature map P3 is processed by the PCBlock module and a convolution operation to obtain a feature map P4. The feature map P4 is processed by an intra-scale feature interaction module, a convolution operation, and dynamic upsampling DySample to generate a feature map P5.
[0055] Step 2.2: The first Z_Cat module takes the output of feature map P2 after 1×1 convolution, feature map P3 and the output of the first DySample dynamic upsampling module as input, and the output of the first Z_Cat module is used as the input of the first RepC3 module.
[0056] DySample is a fast, efficient and general dynamic upsampler. Different from the common kernel-based dynamic upsamplers, DySample is designed from the perspective of point sampling. Compared with other dynamic upsamplers, DySample does not require a custom CUDA package and consumes less computing resources, showing superiority in latency, training memory, training time, GFLOPs and number of parameters.
[0057] The first Z_Cat module uses a 1×1 convolution to obtain feature map P6 from feature map P2 in step 2.1 above, and then uses a 1×1 convolution to change the number of output channels of feature map P6 to twice the number of input channels to obtain feature map P7, and then uses the maximum pooling MaxPool in parallel with the average pooling AvgPool to add feature map P7 and feature map P3 in step 2.1 point by point to obtain feature map P8. Use a 1×1 convolution to change the number of output channels of feature map P5 in step 2.1 above to half the number of input channels, and use the nearest neighbor interpolation nearest method to obtain feature map P9 of the same size as feature map P3. Feature map P3 is obtained by a 1×1 convolution to obtain feature map P10 of the same size, and the three feature maps P8, P9, and P10 are horizontally spliced using the ConCat method in PyTorch, and the number of output channels is the sum of the number of channels of feature maps P8, P9, and P10.
[0058] Step 2.3: The output of the first Z_Cat module is connected in series with the first RepC3 module, and after 1×1 convolution, the output feature map P11 is input to the second DySample dynamic upsampling module.
[0059] The RepC3 module is defined as two 1×1 convolutions in parallel, one of which is RepConv reparameterized and added point by point with the output of the other convolution to form a residual connection. If the number of hidden channels is not equal to the number of output channels, an additional 1×1 convolution is used to adjust the channels.
[0060] Step 2.4: Define the second Z_Cat module, which has the same structure as the first Z_Cat module. It takes the output of the feature map P1 after 1×1 convolution, the feature map P2 and the output of the second DySample dynamic upsampling module as input. The output of the second Z_Cat module is used as the input of the second RepC3 module. The second RepC3 module has the same structure as the first RepC3 module.
[0061] Step 2.5: Define the DySF module. The feature maps P2, P3, and P4 in the above step 2.1 are adjusted through channels and dynamically upsampled by DySample through 1×1 convolution to generate normalized feature maps Q1, Q2, and Q3 with consistent scales. Then, the normalized feature maps Q1, Q2, and Q3 are dimensionally expanded using the dimension-raising function unsqueeze to form three three-dimensional feature maps. The three three-dimensional feature maps are stacked and spliced along the channel dimension to obtain the feature map Q4. The feature map Q4 is subjected to 3D convolution, batch normalization, and activation function operations. The 3D maximum pooling layer is used for pooling operations to obtain the pooled three-dimensional feature map Q5. Finally, the dimensionality reduction function squeeze is used to restore the pooled three-dimensional feature map Q5 to a two-dimensional feature map.
[0062] The unsqueeze function is a tensor operation function in PyTorch, which is used to add a new dimension at a specified position. The function is to insert a new dimension at the specified position of the tensor, thereby changing the shape of the tensor.
[0063] The DySF module takes feature maps P2, P3, and P4 as input. The second RepC3 module and the DySF module are connected in parallel as the input of the CPAM attention mechanism module. The output of the CPAM attention mechanism module is used as the input of the RTDETRDecoder. The output of the CPAM attention mechanism module is horizontally spliced with the feature map P11 after 1×1 convolution and input into the third RepC3 module with the same structure as the first RepC3 module. The output of the third RepC3 module is used as the input of another RTDETRDecoder. The output of the third RepC3 module is horizontally spliced with the feature map P4 after 1×1 convolution and the feature map obtained by the in-scale feature interaction module AIFI and convolution operation, and input into the fourth RepC3 module with the same structure as the first RepC3 module. The output of the fourth RepC3 module is used as the input of the third RTDETRDecoder.
[0064] Step 2.6: Define the CPAM attention mechanism module, which consists of a position attention mechanism module and a channel attention mechanism module. The CPAM attention mechanism module has two inputs, one of which is the output of RepC3, I1, and the other is DySF, that is, the output of DySample Scale Sequence Feature Fusion, I2. Perform an average pooling AvgPool operation on I1 to obtain output I3, perform a one-dimensional convolution and Sigmoid activation function operation on I3 to obtain output I4, multiply I4 and I1 point by point to obtain I5, and add I2 and I5 point by point to obtain I6. Calculate the mean of I6 in the height and width directions, respectively, then add the two means and pass through a 1×1 convolution and ReLu activation function, then split the result into two tensors corresponding to the height and width respectively, and finally use the Sigmoid activation function and multiply it point by point with I6.
[0065] See also Figure 2 The AD_CCFM module is composed of four convolution modules connected in series, followed by two DySample dynamic upsampling modules, followed by two RepC3 modules, and finally a Z_Cat module and an ASF_Dy module. The ASF_Dy module is composed of a Z_Cat module connected in series with a RepC3 module and a DySF module in parallel, and then a CPAM attention mechanism module.
[0066] The ASF module effectively improves the performance of the model in the target detection task by combining multi-scale feature fusion and attention mechanism. It can adaptively adjust the weights of each scale feature, making the model pay more attention to important features, thereby improving detection accuracy.
[0067] Step 3: Replace the GIoU loss function in RT-DETR with the customized Focaler_L2 loss function and use the public dataset TT100K for training to determine the model parameters. The specific method is:
[0068] Step 3.1:
[0069]
[0070] Where IoU is the overlap loss between the predicted box and the true box, d represents the density of the target area, u represents the prediction confidence of the target area, [d,u]∈[0,1], λ is the regularization strength hyperparameter, and θ is all trainable parameters of the model.
[0071] Step 3.2: Divide the public dataset into a training set and a validation set in a ratio of 8:2. Use the public dataset TT100K for training to obtain the best training weight b. Use b to verify the validation set divided by the public dataset TT100K, and then adjust the parameters.
[0072] TT100K (TsingHua-Tencent 100K) is a large-scale dataset for traffic sign detection, jointly developed by Tsinghua University and Tencent. Among the 100,000 images provided, 30,000 are traffic signs, covering different lighting and weather conditions, with a total of 221 categories, 128 of which are labeled.
[0073] Step 4: Obtain a driving record video stream dataset V1, extract key frames from the driving record video stream dataset V1, obtain a driving record video stream key frame dataset V2, input the driving record video stream key frame dataset V2 into the ADC-DETR system, and obtain a traffic sign prediction dataset P. The specific method is as follows:
[0074] Step 4.1: Get the driving record video stream dataset V1, extract key frames from the driving record video stream dataset V1, and use BloomFilter, data de-invalidation and data filling methods to perform data cleaning operations on the driving record video stream dataset V1 to obtain 11745 driving record video stream key frame datasets V2. Use the LabelImg tool to annotate the driving record video stream key frame dataset V2. Each traffic sign in each image has its category label and a set of corresponding position coordinates.
[0075] Step 4.2: Use the optimal weight b obtained in step 3.2 above to predict the key frame dataset V2 of the driving record video stream, perform an end-to-end detection process, and take images of any size as input. In order to ensure that the model can run efficiently, the image is normalized to a uniform size of 640×640 pixels. Use ADC-DETR to predict the normalized image, filter out the accurate prediction box, and obtain a traffic sign prediction data set P containing the detection results.
[0076] Step 5: Define the confidence threshold Conf, and judge whether the key frame of the video stream in the traffic sign prediction dataset P contains a traffic sign according to the threshold, and obtain the traffic sign key frame dataset T. The specific method is:
[0077] The intersection over union (IoU) threshold is used to exclude candidate boxes with a low degree of overlap with the true bounding box, and the confidence threshold Conf is defined to further filter the prediction results. For each video stream key frame in the traffic sign prediction dataset P, the object detection algorithm generates a series of candidate bounding boxes with confidence scores. The confidence score reflects the degree of certainty of the algorithm about the existence of traffic signs in the candidate boxes. In the screening process, first, the candidate boxes with a low degree of overlap with the true bounding box are excluded according to the IoU threshold. Then, the confidence threshold Conf is used to determine whether the remaining candidate boxes are sufficiently reliable to represent the existence of traffic signs. The confidence score of the candidate box is compared with Conf. If the score is higher than Conf, it is considered that the candidate box is likely to contain a traffic sign, and its corresponding key frame is added to the traffic sign key frame dataset T.
[0078] The embodiment of the present invention uses meanAverage Precision (mAP), parameter amount (Params), computation amount (GFLOPs) and precision (Precision, P) as evaluation indicators. The experimental results are shown in Table 1. It can be seen from the table that the improved traffic sign algorithm has an average accuracy improvement of 1.3% compared with the RT-DETR algorithm, the model parameter amount has decreased by 27.8%, the model computation amount has decreased by 16.6%, and the precision has increased by 0.4%. The improved traffic sign detection model reduces the number of parameters while improving the accuracy.
[0079] Table 1
[0080] Params GFLOPs P mAP@50 mAP@50-95 RT-DETR 19.9M 57.1 85.9% 81.3% 62.7% YOLOv10 20.5M 98.3 79% 80.5% 62.8% YOLOv8 25.9M 78.8 79.8% 79.2% 61.5% Gold-YOLO 41.3M 87.4 61% 60.2% 45.9% Model of the present invention 14.4M 47.6 86.3% 82.6% 63.3%
[0081] Figure 7 To show the detection effect of the original RT-DETR algorithm on the real road, Figure 8 This is a detection effect diagram of the algorithm of the present invention in the real road. Figure 8It can be seen that the ADC-DETR model of the present invention can accurately detect traffic signs.
[0082] Related vocabulary or variable description:
[0083]
[0084]
[0085] The above only expresses the preferred implementation of the present invention, and does not limit the present invention in other forms. Any technician familiar with the profession may use the above disclosure to modify or modify it into an equivalent embodiment with equivalent changes. However, any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention without departing from the content of the technical solution of the present invention still belongs to the protection scope of the technical solution of the present invention.
Claims
1. A multi-scale fusion traffic sign real-time detection method, characterized in that: The specific steps are as follows: Step 1: Build the ADC-DETR model, use the defined PCBlock to replace the BasicBlock module of the RT-DETR backbone network BackBone; use the AD_CCFM module to replace the cross-scale feature fusion CCFM module of the RT-DETR hybrid encoder; Step 2: Replace the GIoU loss function in RT-DETR with the defined Focaler_L2 loss function and train it using the public dataset TT100K to determine the model parameters; Step 3: Obtain a driving record video stream dataset V1, extract key frames from the driving record video stream dataset V1, obtain a driving record video stream key frame dataset V2, input the driving record video stream key frame dataset V2 into the ADC-DETR model, and obtain a traffic sign prediction dataset P; Step 4: Define a confidence threshold Conf, and determine whether the key frame of the video stream in the traffic sign prediction dataset P contains a traffic sign based on the threshold, and obtain the traffic sign key frame dataset T.
2. The multi-scale fusion traffic sign real-time detection method according to claim 1 is characterized in that: In step 1, PCBlock uses a 3×3 convolution module to double the output channel of the input channel, and then connects the PConv convolution module, the BN module and the ReLu activation function in series, and then connects a jump connection ShortCut including average pooling and 1×1 convolution in parallel, and finally performs point-by-point addition and ReLu activation.
3. A multi-scale fusion traffic sign real-time detection method according to claim 1 or 2, characterized in that: The AD_CCFM module in step 1 includes multiple convolution modules, two DySample dynamic upsampling modules, multiple RepC3 modules, a Z_Cat module and an ASF_Dy module, wherein the ASF_Dy module is composed of a Z_Cat module connected in series with a RepC3 module and a DySF module in parallel, and then connected in series with a CPAM attention mechanism module; the specific structure is as follows: Step 1.1: Define the feature map as a two-dimensional tensor containing key feature information of the traffic sign image extracted by the convolution operation of the input traffic sign image. The input traffic sign image first undergoes convolution, maximum pooling operation and the first PCBlock module to obtain feature map P1. Feature map P1 is extracted and enhanced by the second PCBlock module to obtain feature map P2. Feature map P2 is further passed through the third PCBlock module to obtain feature map P3. Feature map P3 is passed through the fourth PCBlock module and convolution operation to obtain feature map P4. Feature map P4 is passed through the intra-scale feature interaction module AIFI, convolution operation and the first DySample dynamic upsampling module to generate feature map P5. Step 1.2: Define the first Z_Cat module, which takes the output of feature map P2 after 1×1 convolution, feature map P3 and the output of the first DySample dynamic upsampling module as input. The output of the first Z_Cat module is used as the input of the first RepC3 module. Step 1.3: The output of the first Z_Cat module is connected in series with the first RepC3 module, and after 1×1 convolution, the output feature map P11 is input to the second DySample dynamic upsampling module; Step 1.4: Define the second Z_Cat module, which has the same structure as the first Z_Cat module, and takes the output of the feature map P1 after 1×1 convolution, the feature map P2 and the output of the second DySample dynamic upsampling module as input. The output of the second Z_Cat module is used as the input of the second RepC3 module, and the second RepC3 module has the same structure as the first RepC3 module; Step 1.5: Define the DySF module. The DySF module takes the feature maps P2, P3, and P4 as input. The second RepC3 module and the DySF module are connected in parallel as the input of the CPAM attention mechanism module. The output of the CPAM attention mechanism module is used as the input of the RTDETRDecoder. The output of the CPAM attention mechanism module is horizontally spliced with the feature map P11 after 1×1 convolution and input into the third RepC3 module with the same structure as the first RepC3 module. The output of the third RepC3 module is used as the input of another RTDETRDecoder. The output of the third RepC3 module is horizontally spliced with the feature map P4 after 1×1 convolution and the feature map obtained by the in-scale feature interaction module AIFI and convolution operation, and input into the fourth RepC3 module with the same structure as the first RepC3 module. The output of the fourth RepC3 module is used as the input of the third RTDETRDecoder.
4. The multi-scale fusion traffic sign real-time detection method according to claim 3 is characterized in that: The first Z_Cat module uses a 1×1 convolution from feature map P2 to obtain feature map P6, and then uses a 1×1 convolution to change the number of output channels of feature map P6 to twice the number of input channels to obtain feature map P7, and then uses maximum pooling MaxPool in parallel with average pooling AvgPool to add feature map P7 and feature map P3 point by point to obtain feature map P8; uses a 1×1 convolution to change the number of output channels of feature map P5 to half the number of input channels, and uses the nearest neighbor interpolation nearest method to obtain a feature map P9 of the same size as feature map P3; obtains feature map P10 of the same size through a 1×1 convolution from feature map P3; uses the ConCat method in PyTorch to horizontally splice the three feature maps P8, P9, and P10, and the output number of channels is the sum of the number of channels of feature maps P8, P9, and P10.
5. The multi-scale fusion traffic sign real-time detection method according to claim 3 is characterized in that: The RepC3 module consists of two 1×1 convolutions in parallel, one of which is RepConv reparameterized and added point by point with the output of the other convolution to form a residual connection. If the number of hidden channels is not equal to the number of output channels, an additional 1×1 convolution is used to adjust the channels.
6. The multi-scale fusion traffic sign real-time detection method according to claim 3 is characterized in that: The DySF module is specifically as follows: the feature maps P2, P3, and P4 are respectively subjected to channel adjustment and dynamic upsampling DySample through 1×1 convolution to generate normalized feature maps Q1, Q2, and Q3 with consistent scales, and then the normalized feature maps Q1, Q2, and Q3 are dimensionally expanded using the dimensionality increase function unsqueeze to form three three-dimensional feature maps, and the three three-dimensional feature maps are stacked and spliced along the channel dimension to obtain the feature map Q4, and the feature map Q4 is subjected to 3D convolution, batch normalization, and activation function operations, and a 3D maximum pooling layer is used for pooling operations to obtain a pooled three-dimensional feature map Q5, and finally the dimensionality reduction function squeeze is used to restore the pooled three-dimensional feature map Q5 to a two-dimensional feature map.
7. The multi-scale fusion traffic sign real-time detection method according to claim 1, characterized in that: The Focaler_L2 loss function in step 2 is as follows: Among them, IoU is the overlap loss between the predicted box and the true box, d represents the density of the target area, u represents the prediction confidence of the target area, [d,u]∈[0,1], λ is the regularization strength hyperparameter, and θ is all trainable parameters of the model.
8. The multi-scale fusion traffic sign real-time detection method according to claim 1, characterized in that: The specific steps of step 3 are as follows: Step 3.1: Obtain a driving record video stream dataset V1, extract key frames from the driving record video stream dataset V1, and use a BloomFilter and a data de-invalidation method to perform data cleaning operations on the driving record video stream dataset V1 to obtain a driving record video stream key frame dataset V2; Step 3.2: Use the determined model parameters to predict the key frame dataset V2 of the driving record video stream, perform an end-to-end detection process, take images of any size as input, normalize the images to a uniform size of 640×640 pixels, use the ADC-DETR model to predict the normalized images, filter out accurate prediction boxes, and obtain a traffic sign prediction data set P containing the detection results.
9. The multi-scale fusion traffic sign real-time detection method according to claim 1, characterized in that: The specific steps in step 4 are as follows: The intersection over union (IoU) threshold is used to exclude candidate boxes with a low degree of overlap with the true bounding box, and the confidence threshold Conf is defined to further filter the prediction results. For each traffic sign video stream key frame in the traffic sign prediction dataset P, a series of candidate bounding boxes with confidence scores are generated. In the screening process, the candidate boxes with a low degree of overlap with the true bounding box are first excluded according to the IoU threshold. Then, the confidence threshold Conf is used to determine whether the remaining candidate boxes are sufficiently reliable to represent the existence of the traffic sign. The confidence score of the candidate box is compared with the confidence threshold Conf. If the score is higher than Conf, it is considered that the candidate box contains a traffic sign, and its corresponding key frame is added to the traffic sign key frame dataset T.
10. A multi-scale fusion traffic sign real-time detection system, comprising a memory, a processor and a computer program, characterized in that: When this computer program is loaded into a processor and executed, it can execute the steps of a real-time traffic sign detection method based on multi-scale fusion as described in any one of claims 1 to 9.
Citation Information
Cited By
Real-time traffic sign detection method based on deep learning
CN119323775A
