A target detection method and system in a complex traffic scene

CN122929513APending Publication Date: 2026-10-16ZHEJIANG NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510090079.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-21
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

首先,技术在光照变化、恶劣天气(如雨雪、大雾)及夜间等复杂条件下的鲁棒性不足,动态目标(如高速行驶的车辆和行人)的检测精度较低,难以满足实时性和准确性要求;其次,小目标(如远处行人、非机动车)和密集目标(如拥堵场景中的车辆)检测效果不佳,容易出现漏检、误检及重叠框问题

Benefits of technology

[0027] As can be seen from the above technical solutions, compared with the prior art, the present invention discloses a target detection method and system in complex traffic scenarios. First, Deformable Attention is introduced to enable the model to focus on key sampling points, thereby improving detection accuracy. At the same time, GSConv is replaced with standard convolution to reduce unnecessary redundancy in the model, thereby reducing the number of model parameters and computational complexity. Second, BiFPN is introduced to achieve efficient fusion of multi-scale features. Finally, a CGR design module is introduced to enhance the original C2f feature extraction module through reparameterization technology, which effectively reduces computational complexity through implicit feature reuse.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122929513A_ABST
    Figure CN122929513A_ABST
Patent Text Reader

Abstract

The application discloses a target detection method and system in a complex traffic scene, and relates to the technical field of intelligent traffic, comprising obtaining a target image and establishing a road target data set; an improved YOLOv8 model is established, the improved YOLOv8 model is trained through the road target data set, a road target image to be detected is detected through the improved YOLOv8 model after training, and a target is recognized; in the improved YOLOv8 model, the backbone network and the convolution layer of the neck are replaced by a GSConv layer on the basis of the YOLOv8 model; an attention mechanism is introduced to the C2f layer of the backbone network, the PANet layer of the neck is replaced by a BiFPN layer, and a bidirectional fusion mechanism is introduced; the RepGhost layer and the C2f layer are combined in the neck to construct a CRG layer. The application can guarantee target detection accuracy while reducing computational complexity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent transportation technology, and more specifically to a target detection method and system for complex traffic scenarios. Background Technology

[0002] With the continuous development of artificial intelligence and intelligent transportation, driverless cars have already appeared in people's lives. In congested traffic environments, small target vehicles (such as motorcycles and electric bicycles) are easily obscured by other large vehicles (such as trucks and buses), making it difficult for detection algorithms to accurately determine the presence and location of target vehicles. Furthermore, in dense scenes, the extremely small distances between small target vehicles increase the possibility of mutual interference, further increasing the difficulty of detection. On the other hand, the different installation positions and angles of various traffic monitoring cameras cause significant changes in the image features of vehicles from different perspectives. This change in perspective not only affects the shape and size of the target but may also cause the loss or deformation of some features, making it difficult for detection algorithms to capture sufficient feature information.

[0003] Currently, object detection algorithms can be broadly categorized into two main types. One type is region-based object detection algorithms, typically represented by Fast R-CNN and Faster R-CNN. These algorithms first use region-based methods to identify candidate regions in the input image that may contain objects, and then use convolutional neural networks to extract features and classify these candidate regions. Due to this sophisticated two-step processing flow, two-stage algorithms usually have high detection accuracy. However, when faced with complex and computationally intensive tasks, especially on embedded systems or resource-constrained hardware platforms, they may encounter performance bottlenecks in balancing real-time performance and detection accuracy when processing large amounts of video stream data. The other type is single-stage object detection algorithms based on regression analysis, represented by the YOLO (You Only Look Once) series and the SSD (Single Shot MultiBox Detector) series. The YOLO series algorithms, in particular, have wide applications in computer vision, using an end-to-end network to extract features from the input image in a single pass, and then using these features to predict the possible location and category of objects within the input image. SSD combines the regression approach of YOLO with the anchoring mechanism of Faster R-CNN, achieving efficient and accurate object detection through dense sampling on feature maps at different scales. The single-stage algorithm achieves faster detection speed than the two-stage algorithm, but sacrifices detection accuracy.

[0004] While technological advancements have improved the accuracy of object detection models to some extent, the issues of lightweight design and high false negative rates for overlapping targets remain unresolved in traffic scenarios. Firstly, the technology lacks robustness under complex conditions such as varying lighting, severe weather (rain, snow, fog), and nighttime conditions, resulting in low detection accuracy for dynamic targets (such as high-speed vehicles and pedestrians), failing to meet real-time and accuracy requirements. Secondly, the detection performance for small targets (such as distant pedestrians and non-motorized vehicles) and dense targets (such as vehicles in congested scenarios) is poor, easily leading to false negatives, false positives, and overlapping bounding boxes.

[0005] Therefore, how to ensure target detection accuracy while reducing computational complexity is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0006] In view of this, the present invention provides a target detection method and system for complex traffic scenarios to solve the problems existing in the background art.

[0007] To achieve the above objectives, the present invention adopts the following technical solution:

[0008] A target detection method for complex traffic scenarios includes:

[0009] Acquire target images and establish a road target dataset;

[0010] An improved YOLOv8 model is established and trained using the road target dataset. The trained improved YOLOv8 model is then used to detect and identify targets in the road target images. In the improved YOLOv8 model, the convolutional layers of the backbone network and neck layer are replaced with GSConv layers. An attention mechanism is introduced into the C2f layer of the backbone network to construct a C2f_DAttention layer. The PANet layer in the neck layer is replaced with a BiFPN layer, and a bidirectional fusion mechanism is introduced based on the FPN layer. In the stitching operation of the neck layer, the RepGhost layer and the C2f layer are combined simultaneously to construct a CRG layer.

[0011] Preferably, in the construction of the C2f_DAttention layer, the Deformable Attention mechanism is combined with the C2f module to establish the C2f_DAttention module.

[0012] Preferably, the Deformable Attention mechanism specifically includes:

[0013] Based on the feature map x∈R H×W×C Generate from p∈R HG×WG×2The uniform grid formed is used as a reference point. Where r is the downsampling factor, the value of the reference point is normalized to the range [-1,1] according to the grid shape HG×WG, and the feature map x is projected through a linear projection matrix W. q Mapping this to the query tag, we get q = xW q Where q is the query tag, and then the network θ is generated using the offset. offset Generate an offset Δp, and adjust the amplitude of the offset using a predefined scaling factor s:

[0014] Δp = s·tanh(Δp);

[0015] After obtaining the deformation points, feature sampling is performed at the corresponding positions on the feature map x using bilinear interpolation to obtain the corresponding Key and Value vectors, as shown in the following formula:

[0016] q = xW q , Δp=θ offset ;

[0017]

[0018] in, This represents the result after sampling through feature map x and Δp, where p represents the position of the base grid point on the feature map, and W... k and W v These represent the linear transformation matrices of Key and Value, respectively. and To obtain the key and value of the corresponding token by interpolation based on the moved reference point, For bilinear interpolation, the final result for q is... Multi-head attention calculation is performed, and a relative position offset R is used, followed by a linear projection layer W. o The final output z is obtained, and the output formula of the attention head is:

[0019]

[0020] Where T represents transpose, B represents the offset of the positional embedding in the attention mechanism, and z m is the embedding output calculated by the m-th attention head, d is the feature dimension that each head should process, and σ() is the Softmax function.

[0021] Preferably, the BiFPN layer specifically includes:

[0022]

[0023] Where O represents the fused feature output; Ii W represents the i-th input feature of different level feature maps. i and I i The corresponding learning weights are ε, which is a constant used to avoid the denominator being zero.

[0024] A target detection system for complex traffic scenarios includes:

[0025] The dataset creation module acquires target images and creates a road target dataset.

[0026] The target recognition module establishes an improved YOLOv8 model, trains it using the road target dataset, and uses the trained improved YOLOv8 model to detect and recognize targets in the road target images to be detected. In the improved YOLOv8 model, the backbone network and the convolutional layers in the neck layer are replaced with GSConv layers; an attention mechanism is introduced into the C2f layer of the backbone network to construct a C2f_DAttention layer; the PANet layer in the neck layer is replaced with a BiFPN layer, and a bidirectional fusion mechanism is introduced based on the FPN layer; in the stitching operation of the neck layer, the RepGhost layer and the C2f layer are combined simultaneously to construct a CRG layer.

[0027] As can be seen from the above technical solutions, compared with the prior art, the present invention discloses a target detection method and system in complex traffic scenarios. First, Deformable Attention is introduced to enable the model to focus on key sampling points, thereby improving detection accuracy. At the same time, GSConv is replaced with standard convolution to reduce unnecessary redundancy in the model, thereby reducing the number of model parameters and computational complexity. Second, BiFPN is introduced to achieve efficient fusion of multi-scale features. Finally, a CGR design module is introduced to enhance the original C2f feature extraction module through reparameterization technology, which effectively reduces computational complexity through implicit feature reuse. Attached Figure Description

[0028] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0029] Figure 1 This is a schematic diagram of the method steps provided by the present invention;

[0030] Figure 2A schematic diagram of the structure of the improved YOLOv8 model (BGR-YOLO) provided by this invention;

[0031] Figure 3(a) is an overall architecture diagram of the Deformable Attention mechanism provided by the present invention;

[0032] Figure 3(b) is a diagram of the C2f_DAttention architecture provided by the present invention;

[0033] Figure 4 A diagram of the GSConv module provided by this invention;

[0034] Figure 5(a) shows the PANet module in the traditional algorithm YOLOv8 provided by this invention;

[0035] Figure 5(b) is a network architecture diagram of BiFPN provided by the present invention;

[0036] Figure 6(a) is a flowchart of the Ghost module provided by the present invention;

[0037] Figure 6(b) is a flowchart of the training phase of the RepGhost module provided by the present invention;

[0038] Figure 6(c) is a flowchart of the inference stage of the RepGhost module provided by the present invention;

[0039] Figure 7(a) is a comparison chart of the current mainstream models provided by the present invention;

[0040] Figure 7(b) is a comparison curve of the accuracy provided by the present invention;

[0041] Figure 8 Examples of images and their annotations for the road target detection dataset provided by this invention;

[0042] Figure 9 This is a comparison chart of detection results in a traffic scenario provided by the present invention. Detailed Implementation

[0043] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0044] This invention discloses a target detection method in complex traffic scenarios, such as... Figure 1 As shown, it includes:

[0045] Acquire target images and establish a road target dataset;

[0046] An improved YOLOv8 model was established and trained using a road target dataset. The trained improved YOLOv8 model was then used to detect and identify targets in road target images. In the improved YOLOv8 model, the convolutional layers in the backbone network and neck layer were replaced with GSConv layers. An attention mechanism was introduced into the C2f layer of the backbone network to construct a C2f_DAttention layer. The PANet layer in the neck layer was replaced with a BiFPN layer, and a bidirectional fusion mechanism was introduced on top of the FPN layer. In the stitching operation of the neck layer, the RepGhost layer and the C2f layer were combined simultaneously to construct a CRG layer.

[0047] The improved YOLOv8 model is based on the traditional YOLOv8 model and incorporates the following three improvements: First, it introduces Deformable Attention, enabling the model to focus on key sampling points and improving detection accuracy. Simultaneously, it replaces standard convolutions with GSConv, reducing unnecessary redundancy and thus lowering the number of parameters and computational complexity. Second, it introduces BiFPN to achieve efficient fusion of multi-scale features. Finally, it introduces a CGR design module to enhance the original C2f feature extraction module through reparameterization, effectively reducing computational complexity through implicit feature reuse. This results in the BGR-YOLOv8 model, whose structure is as follows: Figure 2 As shown.

[0048] In one specific embodiment, the C2f_DAttention layer combines the Deformable Attention mechanism with the C2f module to establish the C2f_DAttention module. The C2f_DAttention module includes C2f and Deformable Attention (DAttention). First, the input feature map is divided into two parts: one part retains shallow information through skip connections, while the other part enters the C2f structure for deep feature extraction. C2f gradually fuses features through lightweight operations such as grouped convolutions to improve representational power. Based on this, the extracted deep features pass through the Deformable Attention module DAttention, which dynamically adjusts the receptive field to weight key locations, optimizing the robustness of features to complex backgrounds. Finally, the features processed by DAttention are fused with the shallow features from the skip connections to generate the module's output features.

[0049] In one specific embodiment, the local and efficient attention allocation method of Deformable Attention not only accelerates the model's convergence process but also improves the overall performance of the model by focusing more precisely on important information. It provides a more efficient and effective solution for handling large-scale data and complex visual tasks. The Deformable Attention module is shown in Figure 3(a). As shown in Figure 3(b), during the construction process, the Deformable Attention mechanism is first added after the convolution operation to enhance the feature representation capability, enabling the model to capture richer feature information. Then, residual connections are used to deeply fuse the feature information enhanced by Deformable Attention with the original feature information. This operation not only strengthens the connection between different channels but also enables the model to more fully learn complex information in the road scene, such as vehicle scale changes and pedestrian positions, resulting in the Bottleneck_DAttention module. Finally, the Bottleneck module is used to replace the Bottleneck module in C2f to obtain the C2f_DAttention module. This module not only accurately captures key information in the image but also effectively suppresses background noise and redundant information, thereby improving the model's detection accuracy and robustness in complex environments. The Deformable Attention mechanism specifically includes:

[0050] Given a feature map x∈R H×W×C First, generate a set of p∈R HG×WG×2 The uniform grid formed is used as a reference point. Where r is the downsampling factor, the value of the reference point is normalized to the range [-1,1] according to the grid shape HG×WG, and the feature map x is projected through a linear projection matrix W. q Mapping to the query token, we get q = xW q Where q is the query tag, and then the network θ is generated using the offset. offset Offsets Δp are generated, and these offsets dynamically adjust the position of the reference point to focus on more critical feature regions. To prevent model instability caused by excessively large offsets, a predefined scaling factor s is used to adjust the amplitude of the offsets.

[0051] Δp = s·tanh(Δp);

[0052] After obtaining the deformation points, feature sampling is performed at the corresponding positions on the original feature map x using bilinear interpolation to obtain the corresponding Key and Value vectors, as shown in the following formula:

[0053] q = xWq , Δp=θ offset ;

[0054]

[0055] in, This represents the result after sampling through feature map x and Δp, where p represents the position of the base grid point on the feature map, and W... k and W v These represent the linear transformation matrices of Key and Value, respectively. and To obtain the key and value of the corresponding token by interpolation based on the moved reference point, For bilinear interpolation, the final result for q is... Multi-head attention calculation is performed, and a relative position offset R is used, followed by a linear projection layer W. o The final output z is obtained, and the output formula of the attention head is:

[0056]

[0057] Where T represents transpose, B represents the offset of the positional embedding in the attention mechanism, and z m is the embedding output calculated by the m-th attention head, d is the feature dimension that each head should process, and σ() is the Softmax function.

[0058] In one specific embodiment, traditional FPN typically performs feature fusion from high to low layers, while BiFPN introduces a bidirectional fusion mechanism, simultaneously performing bottom-up and top-down fusion. This allows for a better combination of detailed information from low layers and abstract information from high layers, enhancing the expressive power of multi-scale features. Simultaneously, to significantly improve training efficiency and enhance the effectiveness of feature fusion, a fast normalization fusion technique is introduced, closely integrated with an adaptive weight learning mechanism. BiFPN weights and fuses features at different scales, ensuring that features at different scales are appropriately weighted according to their importance during the fusion process. This weighted fusion reduces information loss and redundancy, thereby improving feature effectiveness. This strategy not only accelerates the training process but also endows the network structure with the ability to exhibit superior performance for different scale targets in road detection tasks. In this way, the network can more flexibly handle road information at various scales, thereby improving the model's accuracy. The BiFPN layer specifically includes:

[0059]

[0060] Where O represents the fused feature output; I iW represents the i-th input feature of different level feature maps. i and I i The corresponding learning weight is ε, which is a constant used to avoid the denominator being zero. In this invention, ε = 0.0001.

[0061] In one specific embodiment, GSConv is introduced, which is a convolution that combines standard convolution, depthwise separable convolution, and the Shuffle technique. For example... Figure 4 As shown, first, an input feature map with C1 channels is obtained. The output channel number C2 of the first set of convolutional operations is halved to obtain the baseline value C2_Half. Then, a standard convolutional layer is applied to the input feature map, and the output channel number is set to C2_Half to extract preliminary feature representations. Next, depthwise separable convolution is used to further process these features. Although depthwise separable convolution has two internal operations, it is treated as a single operation in this process, and the output channel number remains C2_Half, as shown. Figure 4 As shown, DWConv's effectiveness in reducing the computational cost of detection models is evident. The computational cost of traditional convolutional layers is calculated as follows.

[0062] W×H×C1×K1×K2×C2

[0063] Where C1 and C2 are the number of channels in the input and output feature maps, respectively, K1×K2 is the size of the convolution kernel, and the values ​​of K1×K2, C1 and C2 will be adjusted as different network layers change.

[0064] In one specific implementation, YOLOv8 employs PANet (Path Aggregation Network) to optimize the feature fusion process. However, given the sensitivity of target detection tasks in traffic scenarios to multi-scale features and the stringent requirements for model real-time performance, the current PANet module's design in the Neck section cannot effectively utilize the original feature information. As shown in Figure 5(a), although this module directly concatenates the output of the previous processing stage to achieve preliminary feature integration, this direct concatenation strategy limits the ability to effectively extract deep semantic information. Due to the failure to fully fuse and enhance the complementarity between multi-scale features, this design affects the final detection accuracy of the model to some extent, especially in complex and variable road scenarios. A weighted bidirectional feature pyramid network (BiFPN) is introduced to improve the structure, as shown in Figure 5(b). Compared to PANet, BiFPN removes the first node to the right of P7, which only receives a single input edge and has a relatively limited contribution to the fusion of features at different levels in the feature network, thus simplifying the bidirectional network. Simultaneously, to significantly improve training efficiency and enhance the effectiveness of feature fusion, a fast normalization fusion technique is introduced, closely combined with an adaptive weight learning mechanism.

[0065] In one specific embodiment, a RepGhost network employing reparameterization technology is introduced. This network achieves implicit feature reuse in an innovative way, thereby avoiding the efficiency problems caused by the Concat operation. The CRG module mainly consists of two core parts: the C2f module and the RepGhost module. During the reparameterization process of the RepGhost module, as shown in Figure 6(a), starting from the Ghost module, a 1×1 convolution is first used to generate a feature map with fewer channels to reduce the computational cost. Then, depthwise convolution is used on the new feature map to further reduce the computational cost. Finally, a Concat operation is used to stack the output feature maps of the two convolutions in the channel dimension.

[0066] In the design of the RepGhost module, to optimize the efficiency and implicitness of information fusion, the Add operation is used to replace the traditional Concat operation. As shown in Figure 6(b), during the training phase, the RepGhost module enhances the expressive power of features by adding BN (batch normalization) to the branches, further improving the model's accuracy. Furthermore, the positions of the ReLU activation function and the Add operation are adjusted within the module to satisfy the reparameterization rule and accelerate inference speed. Figure 6(c) shows the structure of the RepGhost module during the inference phase, which is obtained based on the fusion optimization of Figure 6(b). During the inference phase, the module only contains regular convolutional layers, and the feature fusion process is performed in the weight space rather than the feature space, resulting in higher hardware efficiency. It facilitates information interaction between deep features. This allows low-level features to work together with high-level features, thereby improving accuracy in detection or classification tasks. The CRG architecture focuses on optimizing computational efficiency, using minimal computational resources to achieve high-precision feature extraction capabilities. CRG is suitable for resource-constrained road object detection tasks. The core components of RepGhostBottleneck consist of the RepGhost module and the SE (Squeeze-and-Excitation) module. The combination of these two reduces the number of parameters and computational cost while maintaining model performance. First, the input features enter the first RepGhost module. If the SE module is used, the features processed by the RepGhost module are further recalibrated by the SE module. This process helps the model focus more on important feature dimensions, thereby optimizing feature representation. Then, the features are further processed by the second RepGhost module. Finally, the processed features are combined with the original input features x through residual connections to retain original information while introducing newly learned features, resulting in the final output of RepGhostBottleneck. Finally, the RepGhostBottleneck module replaces the Bottleneck in C2f, resulting in the CRG module.

[0067] A target detection system for complex traffic scenarios includes:

[0068] The dataset creation module acquires target images and creates a road target dataset.

[0069] The target recognition module establishes an improved YOLOv8 model. This model is trained on a road target dataset and then used to detect and identify targets in road target images. The improved YOLOv8 model replaces the convolutional layers in the backbone network and neck layer with GSConv layers. An attention mechanism is introduced into the C2f layer of the backbone network to construct a C2f_DAttention layer. The PANet layer in the neck layer is replaced with a BiFPN layer, and a bidirectional fusion mechanism is introduced on top of the FPN layer. In the neck stitching operation, the RepGhost layer and the C2f layer are combined to construct a CRG layer.

[0070] In one specific embodiment, the improved model of the present invention is compared with other algorithms as follows:

[0071] Experimental results:

[0072] While keeping the experimental environment unchanged, the proposed BGR-YOLO algorithm was compared with single-stage algorithms (YOLO series, SSD) and two-stage detection algorithms (Faster R-CNN). As shown in Table 1, Faster R-CNN achieved an mAP@50 of 0.25, while BGR-YOLO achieved an accuracy of 0.4 under the same evaluation metric. Because the two-stage algorithm needs to generate a large number of candidate boxes in the first stage, its convergence time is much longer than that of the algorithm proposed in this invention. Within the single-stage object detection algorithm, BGR-YOLO achieved a significant improvement of 0.239 in the key performance metric of mAP@50 compared to the SSD algorithm which uses ResNet as the feature extraction network. To further compare the performance of the improved YOLOv8n model, BGR-YOLO was compared with lightweight YOLO networks such as YOLOv5n, YOLOv6n, YOLOv9t, and YOLOv10n. While maintaining real-time performance, BGR-YOLO improved mAP@50 by 0.029, 0.033, 0.008, and 0.023 respectively, and significantly reduced the number of parameters and computational complexity. Compared to YOLOv8n, BGR-YOLO reduced the number of parameters by 36% and FLOPs by 20%.

[0073] Table 1 Comparison of BGR-YOLO with various detector versions.

[0074] Methods mAP@50 mAP@50-95 Params. / (M) FLOPs / (G) FasterR-CNN 0.250 0.086 41.3 13.1 SSD 0.161 - 26.3 87.7 RT-DETR-R50 0.374 0.200 42.8 130.5 YOLOv5n 0.381 0.215 2.5 7.1 YOLOv6n 0.367 0.211 4.2 11.8 YOLOv8n 0.389 0.216 3.0 8.2 YOLOv9t 0.392 0.223 2.0 7.6 YOLOv10n 0.377 0.212 2.7 8.2 BGR-YOLO(ours) 0.400(+1.1%) 0.220(+0.4%) 1.9(-1.1) 6.6(-1.6)

[0075] To verify the effectiveness of the proposed algorithm for target detection in traffic scenarios, ablation experiments were conducted on the BGR-YOLO model on the BDD100K dataset with identical training methods and environments. Using YOLOv8n as the baseline model, BiFPN, GSConv, C2f_DAttention, and CRG were sequentially added to the baseline YOLOv8n model. The ablation experiment results are shown in Table 2. When using only YOLOv8n, mAP@50 was 0.389, the number of parameters was 3M, and FLOPs were 8.1G. When each module was applied to the baseline model, each improvement enhanced the detection performance to varying degrees.

[0076] Table 2 BGR-YOLO Ablation Experiment

[0077]

[0078]

[0079] To verify the improved performance of CRG, this invention combines current mainstream lightweight models with C2f in the feature fusion stage of YOLOv8n in the Neck network. The experimental results are shown in Table 3. FasterNet achieves faster running speed by introducing the new technique of partial convolution (PConv) to reduce redundant computation and memory access. Compared to YOLOv8n, FasterNet reduces the number of parameters to 1.95M and the computational complexity to only 6.6G. GhostDynamicConv combines the Ghost module with dynamic convolution (DynamicConv), significantly reducing model parameters and FLOPs, with mAP@50 similar to the baseline model. ContextGuided is an attention-based downsampling method that retains more contextual information, reducing floating-point operations by 1.7G. PKIModule uses non-expansion multi-scale convolutional kernels to extract target features at different scales and capture local context, reducing the number of parameters by 1M, but its accuracy is mediocre. The RepGhost module achieves implicit feature reuse through reparameterization, replacing the concatenation operation, reducing the number of parameters to 1.94M and FLOPs by 1.6G. Therefore, by introducing RepGhost, the real-time requirements of target tasks in traffic scenarios are met, especially on resource-constrained devices (such as in-vehicle computers and embedded systems), significantly improving computational efficiency while also enhancing model accuracy.

[0080] Table 3 Comparison of various lightweight improvements with CRG

[0081]

[0082]

[0083] Figure 7(a) shows the trade-off between target detection performance and computational efficiency for different models in the scatter plot. The x-axis represents average accuracy (mAP@50) and the y-axis represents computational complexity (FLOPs). Different colored shapes represent different model types, comparing BGR-YOLO with current mainstream models. Compared to the traditional two-stage detection framework Faster R-CNN, the model proposed in this invention can guarantee higher accuracy. Compared to the popular real-time target detector series YOLO, BGR-YOLO achieves a significant reduction in computational complexity while maintaining accuracy. Therefore, BGR-YOLO can consume fewer computational resources when handling complex road target tasks, reducing hardware performance requirements. Figure 7(b) shows the changes in mAP@50 for YOLOv8n and BGR-YOLO over the first 150 epochs. YOLOv8n's mAP@50 value increases rapidly, and its performance is higher than BGR-YOLO for most epochs. However, as training progressed, YOLOv8n gradually converged, and the performance gap between BGR-YOLO and YOLOv8 gradually narrowed. BGR-YOLO surpassed YOLOv8n after approximately 150 epochs, demonstrating that the model proposed in this invention not only possesses strong feature extraction capabilities but also enhanced generalization ability. BGR-YOLO continued its upward trend, approaching its performance peak around 300 epochs.

[0084] For road detection tasks, this invention measures model performance using three evaluation metrics: mean average precision (mAP), number of parameters, and number of floating-point operations (FLOPs). Precision refers to the proportion of truly positive samples among all positive samples predicted by the model, and its formula is as follows:

[0085]

[0086] P represents the model's accuracy; a higher P value indicates a stronger ability of the model to predict positive samples. TP Indicates a true example; FP Indicates a false positive example. R Recall is the horizontal axis, and precision is the vertical axis. The curve plotted with recall on the horizontal axis and precision on the vertical axis is the PR curve. The integral average below this curve is the AP value for that category, and its formula is as follows:

[0087]

[0088] mAP (mean accuracy) measures the average accuracy of the model across all object classes, taking into account performance at different IoU thresholds. Its formula is shown below:

[0089]

[0090] AP i The average accuracy represents the accuracy of each category, where N is the total number of categories; in this invention, N = 9. This invention uses mAP@50 as one of the key evaluation metrics, specifically referring to the average accuracy calculated under the condition that the Intersection over Union (IoU) threshold is set to 0.5. mAP@50 measures the accuracy of the model in predicting the target location, particularly when the ratio of the intersection area between the predicted bounding box and the ground truth bounding box to their union area is greater than or equal to 0.5. A higher mAP@50 indicates a higher degree of matching between the predicted bounding box and the ground truth bounding box.

[0091] From the BDD100K dataset, 8001 images were selected as the training set, 1000 images as the validation set, and 999 images as the test set. Figure 8 As shown. Figure 9 The test comparison images under different environments are presented, showing the results from top to bottom under different lighting conditions compared to the original label, YOLOv8n, and BGR-YOLO. From the perspective of false negative rate, YOLOv8n exhibits significant limitations in complex environments, especially in roads with severe occlusion, while BGR-YOLO can better capture target objects and reduce false negatives. From the perspective of false positive rate, YOLOv8n shows a relatively high false positive rate under all three different test conditions, but in scenes with severe local congestion and mutual occlusion, BGR-YOLO can effectively identify occluded objects, reducing false positives in such complex environments. From the perspective of confidence level, the results obtained by BGR-YOLO after validation are generally higher than those of YOLOv8n. Therefore, the BGR-YOLO proposed in this invention can demonstrate significant performance improvements when handling scenes with dense small targets and occluded targets.

[0092] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.

[0093] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined in this invention may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A target detection method in complex traffic scenarios, characterized in that, include: Acquire target images and establish a road target dataset; An improved YOLOv8 model is established and trained using the road target dataset. The trained improved YOLOv8 model is then used to detect and identify targets in the road target images. In the improved YOLOv8 model, the convolutional layers of the backbone network and neck layer are replaced with GSConv layers. An attention mechanism is introduced into the C2f layer of the backbone network to construct a C2f_DAttention layer. The PANet layer in the neck layer is replaced with a BiFPN layer, and a bidirectional fusion mechanism is introduced based on the FPN layer. In the stitching operation of the neck layer, the RepGhost layer and the C2f layer are combined simultaneously to construct a CRG layer.

2. The target detection method in a complex traffic scenario according to claim 1, characterized in that, In the construction of the C2f_DAttention layer, the Deformable Attention mechanism is combined with the C2f module to establish the C2f_DAttention module.

3. The target detection method in a complex traffic scenario according to claim 2, characterized in that, The Deformable Attention mechanism specifically includes: Based on the feature map x∈R H×W×C Generate from p∈R HG ×WG× 2 The uniform grid formed is used as a reference point. Where r is the downsampling factor, the value of the reference point is normalized to the range [-1,1] according to the grid shape HG×WG, and the feature map x is projected through a linear projection matrix W. q Mapping this to the query tag, we get q = xW q Where q is the query tag, and then the offset generation network θoffset is used to generate the offset Δp, and the amplitude of the offset is adjusted using a predefined scaling factor s: Δp = s·tanh(Δp); After obtaining the deformation points, feature sampling is performed at the corresponding positions on the feature map x using bilinear interpolation to obtain the corresponding Key and Value vectors, as shown in the following formula: in, This represents the result after sampling through feature map x and Δp, where p represents the position of the base grid point on the feature map, and W... k and W v These represent the linear transformation matrices of Key and Value, respectively. and To obtain the key and value of the corresponding token by interpolation based on the moved reference point, For bilinear interpolation, the final result for q is... Multi-head attention calculation is performed, and a relative position offset R is used, followed by a linear projection layer W. o The final output z is obtained, and the output formula of the attention head is: Where T represents transpose, B represents the offset of the positional embedding in the attention mechanism, and z m is the embedding output calculated by the m-th attention head, d is the feature dimension that each head should process, and σ() is the Softmax function.

4. The target detection method in a complex traffic scenario according to claim 1, characterized in that, The BiFPN layer specifically includes: Where O represents the fused feature output; I i W represents the i-th input feature of different level feature maps. i and I i The corresponding learning weights are ε, which is a constant used to avoid the denominator being zero.

5. A target detection system for complex traffic scenarios, employing the target detection method for complex traffic scenarios as described in any one of claims 1-4, characterized in that, include: The dataset creation module acquires target images and creates a road target dataset. The target recognition module establishes an improved YOLOv8 model, trains it using the road target dataset, and uses the trained improved YOLOv8 model to detect and recognize targets in the road target images to be detected. In the improved YOLOv8 model, the backbone network and the convolutional layers in the neck layer are replaced with GSConv layers; an attention mechanism is introduced into the C2f layer of the backbone network to construct a C2f_DAttention layer; the PANet layer in the neck layer is replaced with a BiFPN layer, and a bidirectional fusion mechanism is introduced based on the FPN layer; in the stitching operation of the neck layer, the RepGhost layer and the C2f layer are combined simultaneously to construct a CRG layer.