Lightweight vehicle target detection method and system based on RT-DETR
By improving the context-guided residual network CGResNet and the bidirectional feature pyramid network BiFPN, and combining them with the EPGIoU loss function, the problems of large number of parameters and multi-scale occlusion in vehicle target detection models are solved, thereby improving detection speed and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WUXI UNIV
- Filing Date
- 2026-03-17
- Publication Date
- 2026-05-12
AI Technical Summary
Existing vehicle target detection models in autonomous driving scenarios suffer from problems such as large number of parameters, difficulty in accurately identifying multi-scale and occluded targets, and detection speed cannot meet real-time requirements.
The improved context-guided residual network CGResNet replaces the backbone network ResNet-18 of the RT-DETR model, and five bidirectional feature pyramid networks BiFPN are introduced in the encoder part. The model is trained with a new loss function EPGIoU to optimize feature fusion and bounding box localization.
It achieves improved speed and accuracy of vehicle target detection while reducing the number of parameters and computational load, especially in multi-scale and occluded scenarios.
Smart Images

Figure CN121861623B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of vehicle target detection technology, specifically relating to a lightweight vehicle target detection method and system based on RT-DETR. Background Technology
[0002] In autonomous driving scenarios, vehicles, as crucial participants in road traffic and key objects of traffic research, often require rapid and accurate target detection to determine better driving routes and reduce traffic accident rates. Therefore, research on vehicle target detection is of great significance to road traffic safety and has become a current research focus. With the continuous development of computer technology, deep learning-based target detection algorithms have gradually become the mainstream in this field. Currently, deep learning-based target detection algorithms are mainly divided into two categories: one is a two-stage target detection algorithm based on candidate regions, and the other is a single-stage target detection algorithm based on regression. In two-stage target detection algorithms, the first stage generates multiple proposal boxes in the image through a region proposal network, and the second stage fine-tunes the proposal boxes. Classic algorithms include Fast R-CNN, Faster R-CNN, and Mask R-CNN. Because the two-stage target detection algorithm divides the detection process into two stages, although it can achieve good detection accuracy, its detection speed is slow and cannot meet the real-time detection requirements of vehicle detection tasks. Single-stage target detection algorithms directly perform regression detection on the target; classic algorithms include SSD, YOLO series, etc. This single-stage model is much faster at inference than the two-stage model, but its accuracy is slightly lower. Considering the importance of real-time requirements in traffic safety, most research focuses on improving the single-stage model.
[0003] Currently, thanks to the efforts of numerous scholars, the performance of vehicle target detection is constantly improving. However, vehicle target detection for autonomous driving scenarios often faces challenges. First, high-precision vehicle detection models often rely on complex structures and massive computational demands, requiring high-performance GPUs, which poses a challenge to edge devices. Second, the sizes of vehicles to be detected vary greatly, making it difficult to accurately identify dense targets. Due to the significant differences in vehicle scale, multiple targets of different scales exist in the same image, making feature extraction for different targets difficult for detectors. Furthermore, in situations with heavy pedestrian or vehicular traffic, dense targets are prone to occlusion, leading to incomplete feature extraction of occluded targets and degrading detector performance. Summary of the Invention
[0004] This invention provides a lightweight vehicle target detection method based on RT-DETR, which solves the technical problems of large number of parameters and difficulty in accurate identification in existing vehicle target detection methods.
[0005] Includes the following steps:
[0006] S1. Data Acquisition and Division:
[0007] Collect images of traffic vehicles and divide them into training and validation sets according to proportions;
[0008] S2. Construction of a lightweight vehicle target detection model: Based on the RT-DETR model, the backbone network ResNet-18 of the RT-DETR model is replaced with an improved context-guided residual network. In the encoder part of the RT-DETR model, five bidirectional feature pyramid networks are introduced. The specific introduction method is as follows:
[0009] The first bidirectional feature pyramid network receives AIFI-enhanced, 2x upsampled, and size-aligned P5 features, and performs bidirectional weighted fusion with the original P4 baseline features after channel unification. The second bidirectional feature pyramid network receives and fuses fused P4 features that have been 2x upsampled and size-aligned to the P3 scale, and performs bidirectional weighted fusion with the original P3 baseline features after channel unification. The third bidirectional feature pyramid network receives backbone network P2 features that have been convolutionally downsampled and size-aligned to the P3 scale, the original P3 baseline features, and the primary enhanced P3 features after top-down fusion, and performs weighted fusion. The fourth bidirectional feature pyramid network receives the final enhanced P3 features that have been convolutionally downsampled and size-aligned to the P4 scale, the original P4 baseline features, and the primary enhanced P4 features after top-down fusion, and performs weighted fusion. The fifth bidirectional feature pyramid network receives enhanced P4 features that have been convolutionally downsampled and size-aligned to the P5 scale, and the original P5 baseline features after channel unification and AIFI global attention encoding, and performs bidirectional weighted fusion.
[0010] S3, Lightweight Vehicle Target Detection Model Training:
[0011] The lightweight vehicle target detection model was trained using a training set. During training, the loss function EPGIoU was used, which was designed through a multi-constraint collaborative approach using a center distance normalization penalty term, an aspect ratio consistency penalty term, and an area difference optimization term. The trained lightweight vehicle target detection model was validated using a validation set.
[0012] S4. Use the trained lightweight vehicle target detection model to detect vehicle targets in traffic scenarios.
[0013] Furthermore, the improved context-guided residual network replaces the residual base module in the ResNet-18 backbone network of the RT-DETR model with a context-guided module.
[0014] Furthermore, the center distance normalization penalty term adopts a normalization design strongly correlated with the target scale. Using the square of the diagonal length of the minimum bounding box as the normalization factor, the Euclidean distance between the centers of the two boxes is normalized and penalized. This achieves scale-adaptive penalty intensity to address the multi-scale characteristics of targets in traffic scenarios. Specifically: ,in, The square of the Euclidean distance between the centers of predicted bounding box A and ground truth bounding box B; The minimum diagonal length of the bounding box between predicted box A and ground truth box B.
[0015] Furthermore, the aspect ratio consistency penalty term uses an exponential function to smooth the aspect ratio deviation between the predicted and ground truth boxes, introducing a scale factor. The aspect ratio distribution characteristics of the vehicle target are dynamically adapted, specifically as follows: ,in, and It is the width and height of the predicted bounding box A. and These are the width and height of the actual frame B; It is a scale factor.
[0016] Furthermore, the area difference optimization term penalizes the union area deviation based on the minimum bounding box area, and is used to provide a stable optimization signal, specifically: ,in, The area of the smallest axis-aligned bounding box that can simultaneously contain both the predicted box A and the ground truth box B; Let the area be the union of the predicted bounding box A and the ground truth bounding box B.
[0017] Furthermore, the loss function EPGioU is specifically as follows:
[0018] ,in, The intersection-union ratio (IUU) of the predicted bounding box A and the ground truth bounding box B.
[0019] In another aspect, the present invention provides a lightweight vehicle target detection system based on RT-DETR, comprising:
[0020] Data acquisition and segmentation module:
[0021] Collect images of traffic vehicles and divide them into training and validation sets according to proportions;
[0022] Lightweight vehicle target detection model construction module:
[0023] Based on the RT-DETR model, the backbone network ResNet-18 of the RT-DETR model is replaced with an improved context-guided residual network. In the encoder part of the RT-DETR model, five bidirectional feature pyramid networks are introduced, specifically as follows:
[0024] The first bidirectional feature pyramid network receives AIFI-enhanced, 2x upsampled, and size-aligned P5 features, and performs bidirectional weighted fusion with the original P4 baseline features after channel unification. The second bidirectional feature pyramid network receives and fuses fused P4 features that have been 2x upsampled and size-aligned to the P3 scale, and performs bidirectional weighted fusion with the original P3 baseline features after channel unification. The third bidirectional feature pyramid network receives backbone network P2 features that have been convolutionally downsampled and size-aligned to the P3 scale, the original P3 baseline features, and the primary enhanced P3 features after top-down fusion, and performs weighted fusion. The fourth bidirectional feature pyramid network receives the final enhanced P3 features that have been convolutionally downsampled and size-aligned to the P4 scale, the original P4 baseline features, and the primary enhanced P4 features after top-down fusion, and performs weighted fusion. The fifth bidirectional feature pyramid network receives enhanced P4 features that have been convolutionally downsampled and size-aligned to the P5 scale, and the original P5 baseline features after channel unification and AIFI global attention encoding, and performs bidirectional weighted fusion.
[0025] Lightweight vehicle target detection model training module:
[0026] The lightweight vehicle target detection model was trained using a training set. During training, the loss function EPGIoU was used, which was designed through a multi-constraint collaborative approach using a center distance normalization penalty term, an aspect ratio consistency penalty term, and an area difference optimization term. The trained lightweight vehicle target detection model was validated using a validation set.
[0027] Target detection module: Uses a trained lightweight vehicle target detection model to detect vehicle targets in traffic scenarios.
[0028] The beneficial effects of the method described in this invention are as follows:
[0029] (1) To address the issues of unnecessary computational resource consumption and insufficient fusion of multi-scale target hierarchical features in the ResNet-18 backbone network, an improved context-guided residual network CCResNet is proposed. This network effectively maintains the ability to detect vehicle targets and reduces the number of parameters and computational cost of the original model, thereby improving the detection speed.
[0030] (2) In the feature fusion stage, a bidirectional feature pyramid network (BiFPN) is introduced to improve accuracy by using a multi-level feature pyramid and bidirectional information transmission while maintaining the advantage of lightweight design.
[0031] (3) A new loss function EPGIoU is proposed for bounding box localization regression to solve the problem of gradient fluctuation in multi-scale and occluded scenarios in vehicle target detection tasks. Attached Figure Description
[0032] Figure 1 This is a diagram of the improved context-guided residual network CGResNet in an embodiment of the present invention.
[0033] Figure 2 This is a structural diagram of the RT-DETR-R18 model before improvement in this embodiment of the invention;
[0034] Figure 3 This is a structural diagram of the improved lightweight vehicle target detection model RT-DETR-light in an embodiment of the present invention;
[0035] Figure 4 This is a comparison chart of GIoU and EPGioU during the training phase in an embodiment of the present invention;
[0036] Figure 5 This is a comparison chart of GIoU and EPGioU during the verification stage in an embodiment of the present invention;
[0037] Figure 6 A comparison chart showing the recognition performance of the improved model and the baseline model RT-DETR-R18 is provided.
[0038] Figure 7 A visual comparison of the improved model and the baseline model RT-DETR-R18 heatmap;
[0039] Figure 8 This is a structural diagram of the CG Block, the context-guided module. Detailed Implementation
[0040] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the present invention.
[0041] Example 1
[0042] This embodiment provides a lightweight vehicle target detection method based on RT-DETR, including the following steps:
[0043] S1. Data Acquisition and Division:
[0044] Collect images of traffic vehicles and divide them into training and validation sets according to proportions;
[0045] S2. Construction of a lightweight vehicle target detection model: Based on the RT-DETR model, the backbone network ResNet-18 of the RT-DETR model is replaced with an improved context-guided residual network CGResNet. In the encoder part of the RT-DETR model, a bidirectional feature pyramid network BiFPN is introduced; (This embodiment specifically improves the RT-DETR-R18 model, where R18 represents that the backbone network of the RT-DETR model is ResNet-18)
[0046] S3, Lightweight Vehicle Target Detection Model Training:
[0047] The lightweight vehicle target detection model was trained using a training set. During training, the loss function EPGIoU was used, which was designed through a multi-constraint collaborative approach using a center distance normalization penalty term, an aspect ratio consistency penalty term, and an area difference optimization term. The trained lightweight vehicle target detection model was validated using a validation set.
[0048] S4. Use the trained lightweight vehicle target detection model to detect vehicle targets in traffic scenarios.
[0049] This implementation addresses the hardware limitations of autonomous driving scenarios and the poor detection performance caused by multi-scale and occlusion phenomena, proposing a novel lightweight vehicle target detection model (RT-DETR-light). First, it proposes to improve the backbone network's convolutional module using a Context Guided Block (CG Block), and uses a lightweight network CGResNet designed based on this module as the feature extraction network, achieving a balance between inference speed and accuracy compared to other lightweight networks. Second, a bidirectional feature pyramid network (BiFPN) is introduced in the feature fusion stage, improving accuracy through multi-level feature pyramids and bidirectional information transfer. Finally, to address the gradient fluctuation problem in multi-scale and occluded scenarios in vehicle target detection, a novel loss function, EPGioU, is proposed to optimize the original loss function. Multi-constraint collaborative design optimizes gradient stability in extreme scenarios, improving the localization accuracy of small targets and densely packed vehicles. Experimental results (Example 4) show that, compared to the baseline algorithm, the proposed method achieves mAP@0.5 of 75.0% and 57.8% on the UA-DETRAC and BDD100K-Sub datasets, respectively, while reducing the number of parameters and computational cost by 26.4% and 18.0%, respectively, and improving the detection speed by 1.4 and 2.6 percentage points, respectively. This demonstrates that the proposed detection algorithm balances high detection accuracy with low parameter and computational cost, outperforming similar object detection algorithms and making it more suitable for improving the accuracy of real-time vehicle target detection and edge deployment in autonomous driving scenarios.
[0050] Example 2
[0051] This embodiment further defines Embodiment 1 and provides a further explanation of the construction of the target detection model for lightweight vehicles.
[0052] like Figure 1 As shown, to accurately capture and fuse multi-scale target hierarchical features while achieving model lightweighting, an improved context-guided residual network, CCResNet, is designed to enhance the ResNet-18 backbone network. Specifically, the CG Block, a context-guided module with a fused context guidance mechanism, structurally replaces the residual base module. Multi-scale context awareness enables it to adaptively capture cross-level features, thereby achieving collaborative and accurate detection of large-scale and far-to-small-scale vehicle targets. While significantly reducing the number of parameters and computational cost, CCResNet reconstructs the multi-scale feature association paths of feature extraction, achieving a shift from single-scale feature mapping to cross-domain contextual feature representation. This improves the discriminativeness and robustness of feature representation, providing more representative feature inputs for subsequent multi-target vehicle detection tasks.
[0053] The improved context-guided residual network CGResNet replaces the Basic Block residual module in the ResNet-18 backbone of the RT-DETR model with the context-guided module CG Block. CGResNet consists of three consecutive convolutional normalization layers (ConvNormLayer, with kernel settings set to...). ), MaxPool2d (with convolution kernel set to...) There are 4 consecutive context bootstrapping module layers, each containing 2 consecutive context bootstrapping modules.
[0054] like Figure 8 As shown, CG Block employs a "local-context" dual-path parallel architecture, achieving efficient aggregation of local details, surrounding context, and global semantic information through complementary feature extraction branches and an adaptive fusion mechanism. One path is the local feature refinement branch, which uses... A standard convolutional kernel is used to construct the extractor, which accurately captures fine-grained features such as target edges and textures using a limited receptive field. Another path is the adaptive context aggregation branch, consisting of two levels of extraction units: "mid-range" and "global." First, it... Dilated convolution expands the receptive field, capturing the mid-range contextual relationship between the target and its surrounding environment. Global average pooling (GAP) then aggregates global information, and a channel-adaptive weight vector is generated through nonlinear transformation to achieve dynamic perception of the global structure.
[0055] The dual-path design uses a joint feature extractor as the fusion hub to connect and fuse local and surrounding contextual features, simultaneously achieving adaptive information complementarity and dimensionality compression, and outputting a highly discriminative feature representation that combines local accuracy with contextual semantic integrity.
[0056] CG Block's adaptive context aggregation dual-path design significantly enhances the ability to capture and fuse multi-scale features in vehicle detection tasks: the local refinement branch accurately captures fine-grained features of small-scale vehicles, avoiding the dilution of small target features by background or large target information; the context aggregation branch effectively aggregates global semantic features of large-scale vehicles, and finally achieves efficient integration of vehicle features of different scales through channel adaptive weights, improving the expression and fusion effect of multi-scale vehicles.
[0057] CG Block's modular design:
[0058] The CG Block first receives the input feature map from the backbone network and transforms the channel dimension through 1×1 convolutions, preparing for subsequent parallel branches. The local feature extractor receives the features transformed by the 1×1 convolutions and processes them using standard 3×3 convolutions to extract local detail features, resulting in a local feature map. The surrounding context extractor also receives the features transformed by 1×1 convolutions and expands the receptive field through 3×3 dilated convolutions (DConv), aggregating long-range contextual information around the target to obtain a contextual feature map containing global dependencies. The joint feature extractor concatenates the local features output from the local feature extractor with the contextual features output from the surrounding context extractor, then performs feature fusion and nonlinear transformation through batch normalization (BN) and PReLU activation functions, outputting a joint feature that combines local details and contextual information. Finally, this joint feature flows to two paths. The main path is to enter the global context extractor. This extractor first applies global average pooling (GAP) to the joint feature, compressing the entire spatial information into a global feature vector, aggregating the global view of the image. Two more fully connected (FC) layers learn the global dependencies between channels, generating channel attention weights. These weights, acting as scaling factors, are then used to recalibrate the original joint features through channel-by-channel multiplication (similar to an attention mechanism), emphasizing feature channels useful for the current task and suppressing useless information. The enhanced features, weighted by the global context, are the final output of the CG Block, which integrates local details, surrounding semantics, and global information, and are fed into the next module of the network for further processing.
[0059] (1) Local Feature Extractor: As the basic feature perception unit, the local feature extractor uses standard Convolutional layers are used to implement this module. This module traverses the input feature map through a sliding window, focusing on fine-grained information such as local texture and edge contours of the target region. This enhances the representation of key details of the target (such as vehicle lights and contours in traffic scenes), providing a highly discriminative local feature foundation for subsequent contextual feature fusion. This ensures that this fine-grained information remains significant in global contextual integration and is not diluted or masked.
[0060] (2) Surrounding context extractor: through dilation Convolution and surrounding context extractors expand the receptive field of features without increasing computational cost, effectively aggregating scene information around the target (such as vehicles and road markings, relative positional relationships of adjacent vehicles, etc.), establishing semantic associations between local features and the surrounding environment, and providing scene constraints for target localization and category determination.
[0061] (3) Joint Feature Extractor: The joint feature extractor is the core of CG Block's feature fusion, integrating the output local features with the surrounding context features. First, the local features and the surrounding context features are combined through a concatenation operation. The combined features are then further processed through batch normalization (BN) and parametric ReLU (PRELU) operations. BN normalizes the mean and scales the variance of each channel of the combined features, eliminating gradient vanishing or training oscillation problems caused by feature distribution shifts, thus accelerating model convergence efficiency. PReLU uses a parametric nonlinear activation mechanism to adaptively retain negative feature information in the combined features (such as the weak response features of target edges in traffic scenes), further enhancing the nonlinear representation ability of the features and the model's adaptability to complex scenes.
[0062] (4) Global Context Extractor: The global context extractor focuses on acquiring global semantic information of the image, using a combination of global average pooling and a multilayer perceptron. This module first aggregates global spatial information from the input feature map to generate a global feature vector containing overall scene attributes of the image (such as traffic scene type, lighting conditions, etc.). Then, a multilayer perceptron (MLP) is used to learn complex nonlinear relationships between features, further refining the global context features. Finally, the extracted global context information is combined with joint features through a scaling layer. This compensates for the limitations of local features, establishes cross-regional feature associations, and improves the model's global perception capability of targets in complex traffic scenes.
[0063] CG Block's lightweight and localized refinement strategy:
[0064] To achieve the core goal of lightweighting the model, CG Block adopts lightweighting strategies such as dimensionality reduction fusion and separate computation at the structural design level. By simplifying redundant computation paths and optimizing feature interaction mechanisms, it achieves local feature refinement, which significantly reduces the number of parameters and computational overhead while maintaining the model's feature expressiveness.
[0065] (1) Dimensionality Reduction and Fusion Strategy Focuses on Efficient Computation: In the joint feature extractor, feature concatenation operations lead to a sharp increase in channel dimensions. To achieve efficient fusion, this module adopts a strategy of first reducing dimensions and then convolution: First, through... Convolution significantly reduces the channel dimension, and then through Convolution accurately captures the local spatial correlations of the target to focus on efficient computation, compared to directly performing concatenation on the spliced features. Convolution, this strategy can reduce the number of parameters. times.
[0066] (2) Depthwise separable convolution enables accurate local feature sampling: The local feature extractor and the surrounding context extractor are constructed based on depthwise separable convolution. By decoupling the spatial and channel dimension transformations of standard convolution, it significantly reduces the number of parameters while focusing on local features and maintaining the effectiveness of spatial interaction. For a convolution kernel size of... For convolutional layers, when the number of output channels is large, the number of parameters can be reduced by nearly [amount missing]. times.
[0067] (3) Dilated convolution efficiently expands the receptive field: The surrounding context extractor expands the receptive field through dilation. Convolution effectively expands the receptive field while maintaining computational efficiency, thereby efficiently capturing mid-range contextual information of an image.
[0068] Bidirectional Feature Pyramid Network (BiFPN)
[0069] To alleviate the problem of decreased detection accuracy caused by significant differences in target scale and complex occlusion in multi-target vehicle detection tasks, an efficient bidirectional feature pyramid network (BiFPN) is introduced in the feature fusion stage of the model. The core innovations include bidirectional feature fusion and weighted fusion mechanism.
[0070] Five bidirectional feature pyramid networks (BiFPNs) are introduced into the encoder part of the RT-DETR model. The specific introduction method is as follows:
[0071] The layers are cascaded in a "2 top-down + 3 bottom-up" sequence: The first BiFPN receives P5 features enhanced by AIFI, upsampled by 2x, and sized to P4 scale, and performs bidirectional weighted fusion with the original P4 baseline features after channel unification; the second BiFPN receives and fuses P4 features fused by 2x upsampling and sized to P3 scale, and performs bidirectional weighted fusion with the original P3 baseline features after channel unification; the third BiFPN receives the backbone network P2 features downsampled by convolution and sized to P3 scale, and performs low-level texture features. The first three features are weighted and fused: the original P3 baseline feature, the primary enhanced P3 feature fused from top to bottom, and the second feature. The third feature receives the final enhanced P3 feature, which is then convolutionally downsampled and sized to the P4 scale; the original P4 baseline feature; and the primary enhanced P4 feature fused from top to bottom. These three features are then weighted and fused together. The fourth BiFPN receives the enhanced P4 feature, which is convolutionally downsampled and sized to the P5 scale, and the original P5 baseline feature, which is channel-unified and encoded with AIFI global attention. These features are then weighted and fused bidirectionally. (The corresponding bidirectional feature pyramid network number is attached.) Figure 3 (Winning bid)
[0072] The bidirectional feature fusion mechanism allows information in the feature layers to flow and fuse in both top-down and bottom-up directions. In BiFPN, each bidirectional path is treated as a separate feature layer, and these layers can be repeated multiple times. This operation enables the network to utilize information across different scales more effectively without significantly increasing computational costs, thereby improving detection performance.
[0073] In practical tasks, small object detection relies more on low-level detailed features, while large object detection relies more on high-level semantic features. Features at different resolutions exhibit significant heterogeneity in representation quality. Indiscriminate fusion strategies introduce a large amount of noise, ultimately impairing the discriminative performance of the fused features. To address this issue, a weighted fusion mechanism adds a weight to each input, as shown in Equation (1).
[0074] (1)
[0075] in It is the first The weights of each input feature, These are the output features after fusion. It is the first Each input feature It is the sum of the weights of all input features. Through a weighted fusion mechanism, the network model can adaptively balance the contributions of features at different scales to the detection results.
[0076] In multi-target vehicle detection tasks, addressing the challenge of significant differences in vehicle target scale, BiFPN achieves effective fusion of deep semantic features and shallow detail features through a bidirectional path (top-down and bottom-up). This allows the model to simultaneously capture the overall outline of small, distant vehicles and the local details of large, nearby vehicles. Occlusion issues lead to incomplete target features and blurred semantic information. BiFPN's weighted fusion mechanism reduces the noise impact of occlusion by increasing the weight of effective features in unoccluded areas and suppressing the interference of ineffective features in occluded areas. Simultaneously, the bidirectional feature fusion mechanism integrates feature information from different levels, enabling the complete bounding box of the target to be located based on the visible portion and contextual information even when the vehicle is partially occluded. This significantly improves the robustness and accuracy of detection in complex traffic scenarios.
[0077] The original RT-DETR model is as follows: Figure 2 As shown, the improved lightweight vehicle target detection model (RT-DETR-light) is as follows: Figure 3 As shown in the attached figure; AIFI stands for Attention-based Intra-scale Feature Interaction; RepC3 stands for Re-parameterized CSP Bottleneck.
[0078] Example 3
[0079] This embodiment further defines Embodiment 1 and provides a further explanation of the training of the lightweight vehicle target detection model.
[0080] RT-DETR-R18, as a real-time end-to-end object detection model, uses a weighted combination of L1 loss and GIoU (Generalized Intersection over Union) loss for the bounding box regression task. The GIoU loss introduces a penalty term for the minimum bounding box on the basis of the traditional IoU loss, which solves the problem of gradient vanishing when the predicted box and the ground truth box do not overlap. The calculation method is shown in Equation (2).
[0081] (2)
[0082] Where IoU is the intersection-union ratio of the predicted box A and the ground truth box B; The area of the smallest axis-aligned bounding box that can simultaneously contain both the predicted box A and the ground truth box B; Let be the area of the union of the two frames.
[0083] While GIoU loss solves the gradient vanishing problem of IoU loss in non-overlapping cases, it degenerates into IoU loss in two specific scenarios: first, when the predicted bounding box and the ground truth bounding box are contained within each other; and second, when they are arranged horizontally or vertically parallel. In vehicle-occluded scenarios, the predicted bounding box and the ground truth bounding box often overlap significantly, causing the GIoU penalty term to fail, resulting in insufficient optimization and affecting localization accuracy. Simultaneously, distant small targets have extremely low pixel proportions; even with slight offsets in the predicted bounding box, the minimum bounding box increases dramatically due to the inclusion of a large number of background pixels, preventing the penalty term from forming an effective optimization signal, ultimately leading to gradient sparsity and optimization stagnation.
[0084] To address the aforementioned issues, this paper proposes a novel loss function, EPGIoU (Enhanced Precision and Generalized Intersection over Union). This function no longer relies solely on the minimum bounding box. Through a multi-constraint collaborative design involving a center distance normalization penalty term, an aspect ratio consistency penalty term, and an area difference optimization term, it provides stronger targeted optimization signals for small vehicle targets and alleviates constraint failure issues in occluded scenarios. Furthermore, normalization avoids penalty imbalances in extreme cases, effectively suppressing gradient fluctuations and ultimately improving the localization accuracy of small targets and densely packed vehicles. The calculation method for the EPGIoU loss is shown in Equation (3).
[0085] (3)
[0086] Where IoU is the intersection-union ratio of the predicted box A and the ground truth box B; The square of the Euclidean distance between the centers of predicted bounding box A and ground truth bounding box B; The minimum diagonal length of the bounding box between predicted box A and ground truth box B; and It is the width and height of the predicted bounding box A. and These are the width and height of the actual frame B; It is a scale factor; The area of the smallest axis-aligned bounding box that can simultaneously contain both the predicted box A and the ground truth box B; Let be the area of the union of the two frames.
[0087] The center distance normalization penalty term employs a normalization design strongly correlated with the target scale. Using the square of the diagonal length of the minimum bounding box as the normalization factor, it normalizes the Euclidean distance between the centers of the two boxes, achieving scale-adaptive penalty strength to address the multi-scale characteristics of targets in traffic scenarios. For small targets at long distances, the minute offset of their centers is easily masked by the center distance deviation of larger targets under traditional non-normalized distance constraints. However, the normalization mechanism of EPGioU ensures that the offset signal of small targets is accurately captured, avoiding dilution of the localization gradient and significantly improving the localization accuracy of vehicles targeting small targets at long distances.
[0088] Unlike the linear aspect ratio-independent penalty logic of traditional loss functions, the aspect ratio consistency penalty term innovatively adopts an exponential smoothing penalty paradigm to overcome the lack of targeted box shape constraints in GIoU. This penalty term uses an exponential function to smooth the aspect ratio deviation between the predicted and ground truth boxes, introducing a scale factor. Dynamically adapt to the aspect ratio distribution characteristics of vehicle targets. In vehicle occlusion scenarios, the occluded part of the target outline is prone to causing aspect ratio distortion of the predicted box. The exponential smoothing penalty can gently and efficiently drive the predicted box to fit the ground truth box, avoiding gradient fluctuations caused by linear penalties and significantly reducing the distortion level of the predicted box of occluded vehicles.
[0089] The area difference optimization term breaks through the single penalty logic of GIoU. It uses the minimum bounding box area as the benchmark to penalize the union area deviation. Even if the predicted box and the training box are highly overlapping in the occluded scene, it can still provide a stable optimization signal, while avoiding the penalty imbalance caused by the expansion of the minimum bounding box for small targets at a distance.
[0090] In summary, multi-constraint collaborative design can simultaneously solve the problems of penalty term failure in occluded scenarios and fuzzy localization of small targets at long distances, providing more accurate regression guidance for vehicle target detection.
[0091] Example 4
[0092] This embodiment is a further explanation of Embodiments 1-3, using specific experiments to verify the effectiveness of the method of the present invention.
[0093] 1. Dataset and Evaluation Metrics
[0094] This embodiment selects the UA-DETRAC public dataset for vehicle detection experiments. The dataset has an image resolution of 960×540 pixels, and labeled vehicles are divided into four categories: cars, vans, buses, and others. The training set contains 60 video sequences and 83,791 images, while the test set contains 40 video sequences and 56,340 images. Approximately 13,800 images were obtained from the original videos by extracting one frame every 10 frames. Of these, 10,000 images were selected and divided into three sets at an 8:1:1 ratio: 8,000 images for the training set, 1,000 images for the validation set, and 1,000 images for the test set.
[0095] This embodiment uses the BDD100K-Sub dataset for generalization experiments. The BDD100K dataset is a large-scale, publicly available driving video dataset released in 2018 by the Artificial Intelligence Laboratory at UC Berkeley. The dataset contains images with a resolution of 1280×720 pixels, and the labeled targets are divided into ten categories: car, truck, bus, train, motorcycle, bicycle, pedestrian, rider, traffic light, and traffic sign. The BDD100K-Sub dataset randomly selects 40,000 images from the BDD100K dataset, with 24,000 images for training, 6,000 for validation, and 10,000 for testing. During data processing, only vehicle and pedestrian category labels are retained, and categories with too few labels are removed. The BDD100K-Sub dataset ultimately covers seven target categories: car, truck, bus, motorcycle, bicycle, person, and rider.
[0096] To verify the performance of the proposed method, mean average precision (AP), precision, number of parameters, giga-floating-point operations per second (GFLOPS), and frames per second (FPS) were used as evaluation metrics. Here, mAP@0.5 represents the mean precision at an IoU of 0.5, and mAP@.5:.95 refers to calculating the AP at each of 10 different thresholds with a step size of 0.05 from IoU=0.5 to IoU=0.95, and then averaging these 10 APs. Precision represents the proportion of samples that actually belong to the positive class among all results predicted as positive by the model. Number of parameters represents the total number of trainable variables in the model during training, and the number of floating-point operations represents the total number of additions, subtractions, multiplications, divisions, and related compound operations performed on floating-point numbers. FPS represents the number of images detected per second, effectively reflecting the detection speed of the algorithm.
[0097] 2. Experimental Environment and Implementation Details
[0098] The experimental hardware configuration is as follows: the graphics card is an NVIDIA L40 with 40GB of video memory, and an 8-core CPU is used. All experiments in this embodiment were conducted in a Python development environment using Python 3.9 and CUDA 12.4; the deep learning model framework used was PyTorch 2.6.0 and Torchvision 0.21.0; the operating system was Ubuntu 22.04. To ensure the fairness and comparability of the model performance evaluation, the experimental conclusions of the method of this invention and the comparative methods were all obtained under a unified experimental environment. The experimental environment parameter settings are shown in Table 1.
[0099] Table 1 Experimental Environment Parameter Settings
[0100]
[0101] 3. Analysis of Experimental Results
[0102] 3.1 Ablation Experiment
[0103] To verify the optimization effect of the method of this invention on the RT-DETR model, the improvement effect was verified on the UA-DETRAC dataset, focusing on five main aspects: average accuracy, precision, number of parameters, computational cost, and inference speed. Ablation experiments were then conducted using the RT-DETR-R18 model as the base network. The experiment numbers and results are shown in Table 2, where "√" indicates that the method was used in the model.
[0104] Table 2 Ablation Experiment Results
[0105]
[0106] Table 2 shows the experimental results of the original RT-DETR model using the ResNet-18 backbone network, a standard encoder, and the GIoU loss function. Comparing the experimental RT-DETR with Experiment 1, it can be seen that after using the CGResNet network as the feature extraction backbone, the number of algorithm parameters and computational cost decreased by 29.9% and 26.1%, respectively, while mAP@0.5 decreased by only 1.8%, accuracy improved by 3.4%, and FPS improved by 3.4%. The fundamental reason for this phenomenon is that the local refinement design of the CGResNet network focuses on key details of the target, eliminates redundant noise, and enhances the difference between the target and similar backgrounds, effectively suppressing false positives to improve accuracy. However, the context aggregation design may lose some fine features, such as key localization information like vehicle edges, leading to predicted box offset and a decrease in the mAP@0.5 index.
[0107] Comparing Experiments 1 and 2, it can be seen that after introducing the BiFPN module in the feature fusion stage, mAP@0.5 improved by 4.4% with almost no change in model size, while the accuracy remained almost the same. This indicates that the optimized multi-scale feature weighted fusion mechanism can significantly improve the model's detection performance for vehicle targets. Its core advantage lies in optimizing the spatial alignment and scale adaptation of features, effectively compensating for the limitations of single-scale feature representation and strengthening the feature representation ability of targets at different scales. The stable accuracy indicates that the module maintains the model's suppression effect on false positives during adaptive aggregation.
[0108] The comparison between Experiment 2 and Experiment 3 shows that replacing the loss function with EPGIoU improved mAP@0.5 by 0.8%, but decreased precision by 1.4%. EPGIoU, based on IoU, not only focuses on overlapping regions but also strengthens the precise constraints on the center distance and aspect ratio of the bounding boxes, allowing the predicted boxes to fit the ground truth boxes more quickly. The slight decrease in precision indicates that the strong constraints of EPGIoU on the bounding boxes guide the model to more actively explore target regions in the image that are associated with vehicle features, leading to a slight increase in false positive predictions and lowering the precision.
[0109] In summary, the lightweight improvement of this invention reduces the number of algorithm parameters and computational cost by 26.4% and 18.0%, respectively, improves mAP@0.5 by 3.4%, increases accuracy by 2.0%, and improves detection speed by 2.6 percentage points. This demonstrates that the lightweight method achieves a good balance between algorithm size and performance.
[0110] 3.2 Comparative Experiment
[0111] Faster R-CNN, a landmark algorithm in two-stage object detection, demonstrates excellent performance in generalization ability and detection accuracy. The YOLO series models are representative algorithms in single-stage object detection, achieving high accuracy in a relatively short inference time. YOLOv5, YOLOv6, and YOLOv8 are typical representatives of the YOLO series algorithms, with YOLOv5 and YOLOv8 having the widest application range and the most deployment scenarios. YOLOv11 is the next-generation object detection model launched in 2024.
[0112] To further verify the performance advantages of the method of the present invention, it was compared with popular algorithm models in the field of object detection, such as Faster R-CNN, YOLOV5S, YOLOV6S, YOLOV8, and YOLOV11N. The results are shown in Table 3.
[0113] Table 3 Performance Comparison Results of Different Methods
[0114]
[0115] Analysis of the results in Table 3 shows that although the two-stage algorithm Faster R-CNN has higher detection accuracy and precision, it has the largest number of parameters and computational cost, which cannot meet the actual needs of edge device deployment. The improved model RT-DETR-light has only a 0.2% decrease in accuracy compared to Faster R-CNN, but its number of parameters and computational cost are 29% and 35% of Faster R-CNN, respectively. Although the mainstream YOLO series algorithms have an advantage in detection speed, their detection accuracy and precision are not as good as the algorithm proposed in this paper. Moreover, the improved model in this paper has a faster inference speed than the original model, which not only meets the real-time requirements of autonomous driving systems, but also has advantages in terms of the number of parameters and computational cost, making it more suitable for edge device deployment scenarios with limited hardware resources. Among all the models compared, the RT-DETR-tiny model proposed in this paper shows a high detection accuracy, reaching 75.0%. Compared with the YOLOV8S model of the same magnitude, the improved model has a 2.6% higher mAP@0.5 value and a 2.7% higher precision. Compared with the RT-DETR-R18 model of the same precision level, the number of parameters in this paper is 73.6% of itss.
[0116] This fully demonstrates that the proposed method can not only maintain high detection accuracy, but also achieve multiple optimizations in terms of model lightweighting, inference efficiency and hardware adaptability, providing a more balanced and practical solution for edge computing scenarios with high real-time requirements and limited hardware resources, such as autonomous driving.
[0117] 3.3 Analysis of the effectiveness of the loss function
[0118] To verify the effectiveness of the loss function EPGIoU, it was compared with existing methods such as GIoU, DIoU, SIoU, and EIoU, as shown in Table 4. The model using EPGIoU achieved a 0.8% improvement in mAP@0.5 compared to the baseline model, and significantly outperformed models using DIoU, SIoU, and EIoU. This phenomenon is essentially due to EPGIoU's multi-constraint collaborative design, which utilizes center distance normalization, aspect ratio exponential smoothing, and area difference optimization. This overcomes the challenges of insufficient optimization strength of traditional IoU loss in occluded scenarios and sparse gradients for distant small targets, thus demonstrating superior accuracy compared to the comparison methods. The EPGIoU proposed in this invention offers better accuracy in bounding box matching and localization, effectively identifying more real targets and directly enhancing the core performance of the target detection task.
[0119] Table 4 IoU Performance Evaluation Table
[0120]
[0121] To further compare the actual training performance of the loss function, the loss during the training process of the improved model and the baseline model is visualized, such as... Figure 4 and Figure 5 As shown in the figure, experimental results demonstrate that the model incorporating the EPGIoU loss function exhibits significant optimization characteristics in both the training and validation phases. Compared to the baseline model, its loss value decreases at a faster rate, enabling it to reach a stable convergence interval in fewer training iterations, effectively improving the model's training efficiency. Simultaneously, the improved model has a lower final convergence loss value, allowing for a more accurate fit to the task data distribution during training, while maintaining good generalization performance during validation without overfitting. Therefore, using EPGIoU as the loss function for RT-DETR-light can help the model accelerate convergence during training, maintain generalization ability, and positively impact detection performance.
[0122] 3.4 Visualization Analysis of Complex Occlusion Scenes
[0123] To further demonstrate the effectiveness of the proposed method in complex occlusion scenarios, four image samples with dense target characteristics were selected from the UA-DETRAC dataset. The improved model was then compared with the baseline model RT-DETR-R18 in terms of recognition visualization performance. The results are as follows: Figure 6As shown in the image, the first column contains four images selected from the dataset, while the second and third columns represent the visualization results of the baseline model and the improved model RT-DETR-light, respectively. The comparison reveals that in all scenarios, the baseline model RT-DETR-R18 is insufficient in detecting occluded vehicles and small, distant vehicles. Furthermore, the baseline model suffers from false detections, misclassifying background noise such as road shadows as vehicles in scenario four. In contrast, the improved lightweight model RT-DETR-light achieves enhanced detection coverage and recognition accuracy, effectively addressing the occlusion problem in complex scenes.
[0124] RT-DETR-light optimizes the three stages of feature extraction, feature fusion, and loss calculation, achieving both high detection coverage in occluded scenarios and robustness against background noise. Ultimately, it outperforms baseline models across the board in specific detection tasks.
[0125] 3.5 Visualization and Analysis of Heat Maps
[0126] To more intuitively evaluate the detection performance of the improved model, Grad-CAM visualization technology was used to generate attention heatmaps, showing the model's level of attention in different regions of the image. The red areas represent regions with strong model attention, while the blue areas represent regions with weaker attention. Figure 7 The heatmap comparison shown reveals the performance differences of different algorithms in the object detection task. The first column contains three images selected from the UA-DETRAC dataset, and the second and third columns are the heatmap visualization results of the baseline model and the improved model RT-DETR-light, respectively.
[0127] Comparative analysis shows that the RT-DETR-light model has advantages in multi-scale target focusing, adaptability to occluded scenes, and anti-interference capabilities. In Scenario 1, the improved model exhibits a more focused and clearer boundary for the attention distribution of distant, small-scale vehicles, effectively capturing the structural features of the targets without significant attention diffusion. Furthermore, the attention region boundaries for large and medium-sized vehicles at close range are independent and do not interfere with each other. In contrast, the baseline model's red high-attention region shows obvious diffusion, affecting the model's detection robustness and localization accuracy in complex traffic scenes. In occluded Scenario 2, the improved model demonstrates better attention focusing on overlapping vehicles, providing an independent and highly identifiable attention region for each occluded target, effectively avoiding attention aliasing in occluded scenes. In Scenarios 1 and 3, the baseline model exhibits a light red redundant attention region in the road blank area, while the improved model maintains a consistently low attention distribution in the road area, demonstrating superior anti-interference capabilities.
[0128] 3.6 Generalization Test
[0129] To further demonstrate the applicability and robustness of the improved method of this invention, detection performance was verified across scenes and in multiple environments on the BDD100K-Sub dataset. On the BDD100K-Sub dataset, RT-DETR-light was compared with other mainstream lightweight models YOLOV5S, YOLOV8, YOLOV9, YOLOV11N, and baseline models. The experimental results are shown in Table 5.
[0130] Table 5 Comparison results of generalization experiments
[0131]
[0132] Based on the results in Table 5, among the YOLO series algorithms, YOLOV9M, with a mAP@0.5 of 56.5% and an accuracy of 60.9%, exhibits the best detection accuracy. However, its high parameter count and computational cost result in an FPS of only 38.3 frames / s. YOLOV11N demonstrates a lightweight advantage with an FPS of 57.8 frames / s, but its detection accuracy is significantly lower than other models. The remaining YOLO models show a trade-off between higher accuracy, larger parameter count and computational cost, and slower inference speed. Among all the models compared, the RT-DETR-light model proposed in this invention demonstrates higher detection accuracy, reaching 57.8%, and a detection precision rate of 61.2%. Compared to the YOLOV8S model of similar scale, its mAP@0.5 is 4.4% higher, and its precision rate is 3.8% higher. Compared to the baseline model RT-DETR-R18, the RT-DETR-light model maintains excellent detection performance on this dataset, with no significant decrease in mAP@0.5 and accuracy. Even when faced with complex environmental interference and scene differences unique to the dataset, it can still accurately identify vehicle targets. This fully demonstrates that the improved model does not overfit on a specific dataset, but rather possesses strong environmental adaptability and cross-scene generalization ability, robustly handling diverse challenges in real-world driving scenarios and providing strong support for its practical deployment.
Claims
1. A lightweight vehicle target detection method based on RT-DETR, characterized in that, The method includes the following steps: S1. Data Acquisition and Division: Collect images of traffic vehicles and divide them into training and validation sets according to proportions; S2. Construction of a lightweight vehicle target detection model: Based on the RT-DETR model, the backbone network ResNet-18 of the RT-DETR model is replaced with an improved context-guided residual network. In the encoder part of the RT-DETR model, five bidirectional feature pyramid networks are introduced. The specific introduction method is as follows: The first bidirectional feature pyramid network receives AIFI-enhanced, 2x upsampled, and size-aligned P5 features, and performs bidirectional weighted fusion with the original P4 baseline features after channel unification. The second bidirectional feature pyramid network receives and fuses fused P4 features that have been 2x upsampled and size-aligned to the P3 scale, and performs bidirectional weighted fusion with the original P3 baseline features after channel unification. The third bidirectional feature pyramid network receives backbone network P2 features that have been convolutionally downsampled and size-aligned to the P3 scale, the original P3 baseline features, and the primary enhanced P3 features after top-down fusion, and performs weighted fusion. The fourth bidirectional feature pyramid network receives the final enhanced P3 features that have been convolutionally downsampled and size-aligned to the P4 scale, the original P4 baseline features, and the primary enhanced P4 features after top-down fusion, and performs weighted fusion. The fifth bidirectional feature pyramid network receives enhanced P4 features that have been convolutionally downsampled and size-aligned to the P5 scale, and the original P5 baseline features after channel unification and AIFI global attention encoding, and performs bidirectional weighted fusion. S3, Lightweight Vehicle Target Detection Model Training: The lightweight vehicle target detection model is trained using a training set. During training, the loss function EPGIoU is used. EPGIoU is designed through a multi-constraint collaborative design of center distance normalization penalty term, aspect ratio consistency penalty term, and area difference optimization term. The trained lightweight vehicle target detection model was validated using a validation set. The center distance normalization penalty term adopts a normalization design strongly correlated with the target scale. Using the square of the diagonal length of the minimum bounding box as the normalization factor, it normalizes and penalizes the Euclidean distance between the centers of the two boxes. This addresses the multi-scale characteristics of targets in traffic scenarios, achieving scale-adaptive penalty intensity. Specifically: ,in, The square of the Euclidean distance between the centers of predicted bounding box A and ground truth bounding box B; The minimum diagonal length of the bounding box between predicted box A and ground truth box B; The aspect ratio consistency penalty term uses an exponential function to smooth the aspect ratio deviation between the predicted and ground truth bounding boxes, and introduces a scale factor. The aspect ratio distribution characteristics of the vehicle target are dynamically adapted, specifically as follows: ,in, and It is the width and height of the predicted bounding box A. and These are the width and height of the actual frame B; It is a scale factor; S4. Use the trained lightweight vehicle target detection model to detect vehicle targets in traffic scenarios.
2. The lightweight vehicle target detection method based on RT-DETR according to claim 1, characterized in that, The improved context-guided residual network replaces the residual base module in the ResNet-18 backbone network of the RT-DETR model with a context-guided module.
3. The lightweight vehicle target detection method based on RT-DETR according to claim 2, characterized in that, The area difference optimization term penalizes the union area deviation based on the minimum bounding box area, and is used to provide a stable optimization signal. Specifically: ,in, The area of the smallest axis-aligned bounding box that can simultaneously contain both the predicted box A and the ground truth box B; Let the area be the union of the predicted bounding box A and the ground truth bounding box B.
4. The lightweight vehicle target detection method based on RT-DETR according to claim 3, characterized in that, The loss function EPGIoU is as follows: ,in, The intersection-union ratio (IUU) of the predicted bounding box A and the ground truth bounding box B.
5. A lightweight vehicle target detection system based on RT-DETR, characterized in that, The system includes: Data acquisition and segmentation module: Collect images of traffic vehicles and divide them into training and validation sets according to proportions; Lightweight vehicle target detection model construction module: Based on the RT-DETR model, the backbone network ResNet-18 of the RT-DETR model is replaced with an improved context-guided residual network. In the encoder part of the RT-DETR model, five bidirectional feature pyramid networks are introduced, specifically as follows: The first bidirectional feature pyramid network receives AIFI-enhanced, 2x upsampled, and size-aligned P5 features, and performs bidirectional weighted fusion with the original P4 baseline features after channel unification. The second bidirectional feature pyramid network receives and fuses fused P4 features that have been 2x upsampled and size-aligned to the P3 scale, and performs bidirectional weighted fusion with the original P3 baseline features after channel unification. The third bidirectional feature pyramid network receives backbone network P2 features that have been convolutionally downsampled and size-aligned to the P3 scale, the original P3 baseline features, and the primary enhanced P3 features after top-down fusion, and performs weighted fusion. The fourth bidirectional feature pyramid network receives the final enhanced P3 features that have been convolutionally downsampled and size-aligned to the P4 scale, the original P4 baseline features, and the primary enhanced P4 features after top-down fusion, and performs weighted fusion. The fifth bidirectional feature pyramid network receives enhanced P4 features that have been convolutionally downsampled and size-aligned to the P5 scale, and the original P5 baseline features after channel unification and AIFI global attention encoding, and performs bidirectional weighted fusion. Lightweight vehicle target detection model training module: The lightweight vehicle target detection model was trained using a training set. During training, the loss function EPGIoU was used, which was designed through a multi-constraint collaborative approach using a center distance normalization penalty term, an aspect ratio consistency penalty term, and an area difference optimization term. The trained lightweight vehicle target detection model was validated using a validation set. The center distance normalization penalty term adopts a normalization design strongly correlated with the target scale. Using the square of the diagonal length of the minimum bounding box as the normalization factor, it normalizes and penalizes the Euclidean distance between the centers of the two boxes. This addresses the multi-scale characteristics of targets in traffic scenarios, achieving scale-adaptive penalty intensity. Specifically: ,in, The square of the Euclidean distance between the centers of predicted bounding box A and ground truth bounding box B; The minimum diagonal length of the bounding box between predicted box A and ground truth box B; The aspect ratio consistency penalty term uses an exponential function to smooth the aspect ratio deviation between the predicted and ground truth bounding boxes, and introduces a scale factor. The aspect ratio distribution characteristics of the vehicle target are dynamically adapted, specifically as follows: ,in, and It is the width and height of the predicted bounding box A. and These are the width and height of the actual frame B; It is a scale factor; Target detection module: Uses a trained lightweight vehicle target detection model to detect vehicle targets in traffic scenarios.