A traffic small target detection method based on double-flow multi-scale fusion
By improving feature extraction and fusion methods and utilizing deformable large kernel attention, frequency domain attention, and multi-scale sparse cross-attention modules, the problems of missed detection and background interference in small target detection in complex traffic scenarios are solved, achieving high-precision and fast target detection.
Patent Information
- Application Number
- CN202611112707.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-25
- Publication Date
- 2026-11-20
AI Technical Summary
Existing target detection algorithms suffer from weak features and missing edge information for small targets in complex traffic scenarios, making it easy to miss small targets such as vehicles and traffic signs; poor multi-scale feature fusion results affect the accuracy of target localization; and severe interference from complex backgrounds reduces the detection accuracy.
A traffic target detection method based on dual-stream multi-scale fusion is adopted. By improving the feature extraction and fusion methods through deformable large kernel attention enhancement, frequency domain attention enhancement, dual-stream multi-scale fusion and multi-scale sparse cross attention module, the target feature expression ability is enhanced and background interference is suppressed.
It significantly improves the detection and positioning accuracy of small targets, reduces the false negative rate, increases the detection speed, meets the needs of real-time applications, and adapts to the detection performance of targets of different scales.
Smart Images

Figure CN123142185A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computer vision and intelligent transportation technology, specifically to a method for detecting small targets in complex traffic scenes based on deep learning. This method achieves accurate detection of small targets such as vehicles and traffic signs in road monitoring, autonomous driving, and intelligent transportation systems by constructing a multi-scale feature fusion network, an attention enhancement mechanism, and a frequency domain feature modeling module. It can be used to improve the accuracy and real-time performance of traffic target recognition in complex environments. Background Technology
[0002] Currently, deep learning-based object detection methods have been widely applied in fields such as intelligent transportation, autonomous driving, and road monitoring, primarily for detecting targets such as vehicles, pedestrians, and traffic signs. Existing object detection algorithms mainly include detection methods based on convolutional neural networks (CNNs) and detection methods based on Transformers.
[0003] Among them, CNN-based object detection methods (such as YOLO, Faster R-CNN, etc.) typically consist of a feature extraction network, a feature fusion network, and a detection head. They extract target features from images through convolution operations and then use multi-scale feature fusion structures to enhance the detection capability of targets of different sizes.
[0004] In recent years, the DETR series of object detection methods based on Transformer have established global feature relationships in images by introducing a self-attention mechanism, achieving end-to-end object detection. Among them, RT-DETR improves object detection speed and real-time performance through a lightweight Transformer encoder, a multi-scale feature fusion module, and a detection decoder, making it suitable for real-time detection tasks in traffic scenarios.
[0005] Current traffic target detection methods still have the following problems in complex environments and small target detection tasks:
[0006] (1) Insufficient feature extraction capability for small targets leads to missed detection problems.
[0007] Vehicles, traffic signs, and other targets in traffic surveillance images are typically small in size and contain limited effective pixel information. Existing detection networks experience a continuous decrease in feature map resolution during multiple downsampling processes, leading to the loss of detailed information such as target edges and textures, making it difficult for the model to accurately identify small targets.
[0008] (2) The multi-scale feature fusion effect is limited, which affects the accuracy of target positioning.
[0009] Existing methods typically employ cross-scale fusion structures in FPN, PAN, or RT-DETR to fuse features from different levels. However, traditional fusion methods mainly use simple weighting or concatenation operations, lacking effective modeling of the relationships between features at different scales. This results in insufficient fusion of shallow spatial information and deep semantic information, reducing the object detection performance in complex scenes.
[0010] (3) Complex background interference is severe, which reduces the detection accuracy.
[0011] In real-world traffic environments, targets are easily affected by factors such as occlusion, lighting variations, and road textures. Existing attention mechanisms primarily enhance features in the spatial or channel domains, failing to fully utilize frequency domain information for target edge and texture feature extraction. Consequently, they are susceptible to background noise interference in low-resolution, weak-feature target detection. Addressing the shortcomings of existing small target detection methods in complex traffic scenarios, such as insufficient small target feature information, poor multi-scale feature fusion performance, severe interference from complex backgrounds, and the difficulty in balancing detection accuracy and real-time performance, this invention proposes a traffic small target detection method based on dual-stream multi-scale fusion. By optimizing feature extraction, feature fusion, and attention enhancement methods, it improves the accuracy and robustness of target detection in complex traffic environments. Summary of the Invention
[0012] Based on the above background description, the main problem that this invention addresses is as follows:
[0013] 1. To address the problem that existing target detection algorithms often miss small targets such as vehicles and traffic signs due to weak feature representation and missing edge information in complex traffic scenarios, a detection method that enhances the target feature representation capability is proposed to improve the model's ability to recognize low-resolution, small-sized targets.
[0014] 2. To address the problem that existing multi-scale feature fusion methods only employ simple splicing or weighted fusion, which cannot fully utilize the semantic and spatial information between features at different scales, resulting in insufficient target localization accuracy, a more effective multi-scale feature fusion method is proposed to improve the fusion effect of target features at different scales.
[0015] 3. To address the problem that existing detection methods are easily affected by background texture, occlusion, and lighting changes in complex traffic environments, leading to confusion between target features and background information, a feature enhancement method is proposed that can enhance target region features and suppress background interference, thereby improving the detection stability of the model in complex environments.
[0016] This invention proposes a traffic small target detection method based on dual-stream multi-scale fusion. This method is a target detection method based on deep learning. By improving the feature extraction network, feature fusion network and attention enhancement module, it improves the detection accuracy of small-sized targets in complex traffic scenarios.
[0017] A traffic target detection method based on dual-stream multi-scale fusion is proposed. The overall structure of the method mainly includes an input image module, a feature extraction module, a frequency domain feature enhancement module, a dual-stream multi-scale fusion module, and a target detection output module.
[0018] Includes the following steps:
[0019] Step S1: Image Input and Feature Extraction
[0020] Traffic scene images are acquired and input into a feature extraction network. Through multi-layer convolution operations, feature maps of different resolutions are extracted to obtain high-resolution feature maps containing shallow spatial information and low-resolution feature maps containing deep semantic information.
[0021] Step S2: Deformable macronucleus attention enhancement
[0022] The feature map extracted in step S1 is input into the deformable large kernel attention module. The large convolutional kernel is used to expand the feature perception range, and the spatial sampling offset is predicted by deformable convolution. The sampling position is dynamically adjusted according to the target shape to generate an enhanced multi-scale feature map.
[0023] Step S3: Frequency Domain Attention Enhancement
[0024] The enhanced high-level semantic feature map in step S2 is input to the frequency domain attention enhancement module. The spatial domain features are transformed to the frequency domain through Fourier transform. Attention weights are calculated in the frequency domain space to enhance the frequency components corresponding to the target edge and texture. Then, the spatial domain is restored through inverse Fourier transform to generate the frequency domain enhanced feature map.
[0025] Step S4: Two-stream multi-scale fusion
[0026] The shallow spatial feature map extracted in step S1 and the frequency domain enhanced feature map generated in step S3 are jointly input into the dual-stream multi-scale fusion module, which performs fusion through the following sub-steps:
[0027] Channel attention is calculated on high-level semantic features to generate channel-enhanced features, thereby strengthening important semantic information;
[0028] Spatial attention calculations are performed on low-level spatial features to generate spatially enhanced features, thereby strengthening target location information;
[0029] The channel enhancement feature is concatenated with the spatial enhancement feature to obtain a preliminary fusion feature;
[0030] Foreground attention maps and background attention maps are generated based on high-level semantic features. The foreground attention map is used to enhance the response of the target region in the low-level spatial features, and the background attention map is used to suppress the response of the background region in the low-level spatial features, thereby obtaining foreground enhancement features and background suppression features, respectively.
[0031] The foreground enhancement feature and the background suppression feature are concatenated and fused through convolution to obtain the dual-stream fused feature;
[0032] Step S5: Multi-scale sparse cross-attention fusion
[0033] The dual-stream fusion feature obtained in step S4 is input into the multi-scale sparse cross-attention module. Pooling operations at different scales are performed on the feature to extract multi-scale features. The features at each scale are added together to obtain the multi-scale fusion representation. The original feature and the multi-scale fusion representation are then used to construct a query matrix, a key matrix, and a value matrix, respectively. Cross-attention weights are calculated, and a Top-K sparse selection mechanism is used to retain the attention responses related to object detection, thereby generating sparsely optimized multi-scale fusion features.
[0034] Step S6: Target detection output
[0035] The sparsely optimized multi-scale fusion features obtained in step S5 are input into the detection decoder. Through target classification and bounding box regression, the category information and location information of target objects in the traffic scene are output to complete the small target detection.
[0036] Furthermore, the deformable large kernel attention module in step S2 specifically performs the following operations:
[0037] The input feature map is sequentially processed with standard convolution, batch normalization, and GELU activation to extract basic features;
[0038] The basic features are subjected to depthwise separable convolution and large-kernel depthwise separable convolution to expand the receptive field;
[0039] The spatial sampling offset is predicted on the feature map after the receptive field is expanded by an offset convolutional layer;
[0040] The feature map is deformably sampled based on the predicted offset to obtain features at an adaptive position.
[0041] The features at the adaptive position are convolved with a 1×1 convolution to generate attention weights;
[0042] The attention weights are multiplied element-wise with the basic features, then subjected to a 1×1 convolution and added to the residual of the original input features to obtain the enhanced feature map.
[0043] Furthermore, the frequency domain attention enhancement module in step S3 specifically performs the following operations:
[0044] The high-level semantic feature map of the input is subjected to Fast Fourier Transform to obtain the frequency domain features;
[0045] The query matrix, key matrix, and value matrix are generated using three learnable weight matrices.
[0046] Calculate the dot product between the query matrix and the transpose of the key matrix, divide by the scaling factor, and normalize using the Softmax function to obtain the frequency domain attention weights;
[0047] Multiplying the frequency domain attention weights by the value matrix yields the weighted frequency domain features;
[0048] Perform an inverse fast Fourier transform on the weighted frequency domain features to restore them to the spatial domain, thus obtaining the spatial domain enhanced features;
[0049] Meanwhile, the frequency domain autocorrelation of the input features is calculated and inversely transformed through the frequency domain residual fusion branch to obtain the residual fusion features;
[0050] The spatial domain enhancement features and the residual fusion features are concatenated and then convolved to obtain the final frequency domain enhancement feature map.
[0051] Further, in step S4, the foreground attention map and the background attention map are generated as follows: high-level semantic features are processed using convolution and upsampling operations, a foreground attention map is generated by the Sigmoid activation function, and the background attention map is obtained by subtracting the foreground attention map from the all-one matrix.
[0052] Furthermore, in step S4, when enhancing and suppressing low-level spatial features using the foreground attention map and the background attention map respectively, dilated convolution with different dilation rates is used to perform multi-scale dilated convolution operations on the weighted features, and the results under each dilation rate are spliced together to obtain foreground enhancement features and background suppression features respectively.
[0053] Furthermore, the multi-scale sparse cross-attention module in step S5 specifically performs the following operations:
[0054] The input dual-stream fusion features are subjected to average pooling at at least three different scales to obtain pooled features at multiple scales.
[0055] The pooling features at the multiple scales are added element by element to obtain a multi-scale fused representation;
[0056] The original input features are flattened and then linearly transformed to generate a query matrix. The multi-scale fusion representation is flattened, linearly transformed, and then split into a key matrix and a value matrix.
[0057] Calculate the dot product between the query matrix and the transpose of the key matrix and divide by the scaling factor to obtain the attention score matrix;
[0058] The attention score matrix is sparsely selected according to at least two different Top-K selection ratios, and the positions with the highest scores are retained. After being normalized by Softmax, the results under different sparsity ratios are weighted and summed to obtain the sparse attention weights.
[0059] Multiplying the sparse attention weights by the value matrix yields the sparsely optimized multi-scale fusion features.
[0060] Furthermore, the feature extraction network in step S1 adopts a backbone network based on a convolutional neural network, and the output includes at least a high-resolution low-semantic-level feature map and a low-resolution high-semantic-level feature map. The low-resolution high-semantic-level feature map is sequentially input to step S2 and step S3 for processing, and the high-resolution low-semantic-level feature map is directly input to step S4 for dual-stream fusion with frequency domain enhancement features.
[0061] Furthermore, the detection decoder in step S6 adopts a Transformer-based decoder structure, decodes the fused features through multi-layer cross-attention, outputs the classification scores and bounding box coordinates of multiple candidate targets in parallel, and outputs the final detection result after non-maximum suppression.
[0062] Furthermore, the traffic targets include at least vehicles, pedestrians, and traffic signs, and the traffic scene images are derived from road surveillance videos or real-time images captured by autonomous driving vehicle cameras.
[0063] A traffic small target detection system based on dual-stream multi-scale fusion is proposed, which uses the method described above to detect small targets in traffic scenarios.
[0064] The specific working process is as follows:
[0065] First, the collected traffic scene images are input into the detection network. The feature extraction module performs multi-level feature extraction on the input images to obtain multi-scale features containing target edges, textures, and semantic information.
[0066] In the feature extraction stage, a Deformable Large Kernel Attention Module (Deformable-LKA) is introduced. By expanding the feature perception range through a large convolutional kernel and combining it with deformable convolution to dynamically adjust the sampling position, the network can adaptively extract target features according to different target shapes, thereby enhancing the model's feature representation ability for small-sized targets with changing shapes.
[0067] Subsequently, the extracted high-level semantic features are input into the frequency domain attention enhancement module (FA-AIFI). Frequency information in the image is extracted through frequency domain transformation, and the frequency domain attention mechanism is used to enhance the edge and texture features of the target, while suppressing the interference information generated by complex backgrounds, thereby improving the model's ability to recognize weak feature targets.
[0068] Subsequently, features at different scales are input into the dual-stream multi-scale fusion module (DSMF). This module models the foreground and background information of the target through a dual-path structure, which enhances the features of the target region on the one hand and suppresses irrelevant background information on the other. At the same time, it combines a multi-scale sparse cross-attention mechanism to selectively fuse the correlation between features at different scales, enabling the network to make full use of shallow spatial information and deep semantic information.
[0069] After the above feature enhancement and fusion processing, the obtained fused features are input into the detection and decoding module. The final detection result is generated through target classification and bounding box prediction, so as to achieve accurate detection of small targets such as vehicles, pedestrians and traffic signs in traffic scenes.
[0070] This invention proposes a traffic target detection method based on dual-stream multi-scale fusion. Through the synergistic effect of four core modules—deformable large kernel attention enhancement, frequency domain attention enhancement, dual-stream multi-scale fusion, and multi-scale sparse cross-attention—significant performance improvements are achieved in target detection tasks in complex traffic scenes. Specifically, these improvements are reflected in the following aspects:
[0071] First, the detection accuracy for small targets is significantly improved. This invention achieves an APS of 35.7% for small target detection on the joint BDD100K and SODA-D test sets, a 5.6 percentage point improvement compared to the Transformer-based DETR baseline (30.1%), a 4.3 percentage point improvement compared to RT-DETR (31.4%), and a 2.5 percentage point improvement compared to ESDO (33.2%). This improvement is attributed to the deformable large kernel attention module, which dynamically adjusts the sampling position to effectively adapt to the shape changes and size differences of small targets, reducing feature loss. Simultaneously, the frequency domain attention enhancement module utilizes Fourier transform to extract the frequency components corresponding to the target edges and textures, enhancing weak feature responses in the frequency domain space and compensating for the lack of pixel information in small targets, thereby significantly reducing the false negative rate for small targets.
[0072] Second, the target localization accuracy and overall detection quality are optimal. The AP of this invention reaches 52.3%, higher than DETR (46.9%), Deformable DETR (48.2%), FSSD-DETR (49.3%), RT-DETR (48.4%), and ESDO (48.7%), indicating optimal overall detection performance under multiple cross-union ratio (CUP) thresholds. Particularly important is the AP75, reaching 55.4%, the highest among all comparison methods (exceeding RT-DETR's 52.7% and ESDO's 52.3%). Since AP75 uses a high CUP threshold of 0.75, it has extremely strict requirements for bounding box localization accuracy. This leading performance directly demonstrates the advantage of this invention in target boundary regression accuracy. This effect is attributed to the dual-stream multi-scale fusion module's dual-path modeling using foreground and background attention, which enhances target region features while effectively suppressing interference from complex backgrounds (such as road textures, occlusions, and areas of varying illumination), thereby reducing false detections and improving the fitting accuracy of bounding boxes.
[0073] Third, the multi-scale target detection capability is balanced and robust. The detection accuracy (APM) and APL of this invention on medium and large targets reach 55.4% and 66.2% respectively, both of which are among the top levels of the comparative methods. This shows that this invention does not sacrifice the performance of medium and large targets for the benefit of small targets. Instead, it selectively fuses features of different scales through a multi-scale sparse cross-attention module and uses a Top-K sparsity mechanism to filter redundant background responses, so that the network can maintain stable feature representation capability on targets of different sizes, thus achieving a full-scale range of improved detection performance.
[0074] Fourth, it balances detection speed and accuracy to meet the needs of real-time applications. The invention achieves an FPS of 66.7 frames per second, significantly higher than DETR (28.4), Deformable DETR (42.3), FSSD-DETR (46.3), RT-DETR (52.1), and ESDO (53.1), maintaining the fastest inference speed while achieving the highest detection accuracy. This real-time advantage mainly stems from the multi-scale sparse cross-attention module's Top-K selection mechanism, which significantly reduces redundant computations in attention calculations, lowering the model's computational complexity. This allows the invention to be deployed on resource-constrained embedded platforms, meeting the dual requirements of high accuracy and real-time performance in scenarios such as autonomous driving and intelligent traffic monitoring.
[0075] In summary, this invention achieves a synergistic improvement in feature enhancement and fusion efficiency by introducing deformable adaptive sampling and frequency domain enhancement mechanisms in the feature extraction stage and employing foreground / background dual-stream differential modeling and sparse cross-attention optimization in the feature fusion stage. It achieves the best overall performance in detection accuracy and inference speed in small target detection tasks in complex traffic scenarios, demonstrating significant technological advancement and practical application value. Attached Figure Description
[0076] Figure 1 This is a schematic diagram of the DSMF-DETR structure.
[0077] Figure 2 This is the D-LKA module architecture diagram.
[0078] Figure 3 This is the FA module architecture diagram.
[0079] Figure 4 This is the DSMF module architecture diagram.
[0080] Figure 5 This is the architecture diagram of the MSC (Multi-Scale Sparse Cross-Attention) module. Detailed Implementation
[0081] The components of the present invention are described in detail below with reference to the accompanying drawings.
[0082] 1. Deformable-LKA Feature Enhancement Module:
[0083] The Deformable-LKA (Deformable Large Kernel Attention) module enhances the network's ability to extract features from small targets in complex traffic scenes. Traditional convolutional operations use fixed sampling positions and fixed receptive fields, making it difficult to adapt to changes in the size and shape of targets such as vehicles and traffic signs. This module combines a large convolutional kernel structure with a deformable convolution mechanism to expand the network's receptive field without significantly increasing computational cost. It also dynamically adjusts the sampling region based on the target's spatial location, enabling the model to more accurately extract the edges, textures, and semantic information of small targets, thus improving target detection capabilities in complex environments.
[0084] Figure 2 D-LKA modular architecture.
[0085] The formulas for this module can be summarized as follows:
[0086] First, the input feature map is processed. Perform convolution and activation processing to extract basic features:
[0087]
[0088] in, The input feature map is represented by C, H, and W, which represent the number of channels, height, and width of the input feature map, respectively. Conv(F) represents the standard convolution operation performed on the input feature map F, which is used to complete local feature extraction and channel mapping. This indicates a batch normalization operation, used to normalize the convolution output to improve the stability of network training. This represents the Gaussian error linear unit activation function, used to perform nonlinear mapping on the normalized features; This represents the base feature map obtained after standard convolution, batch normalization, and GELU activation. Its spatial size and number of channels are determined based on the stride, padding, and output channel number of the convolutional layer.
[0089] Next, spatial features are extracted using depthwise separable convolution, and the receptive field is expanded by using large convolutional kernels:
[0090]
[0091] in, This indicates a depthwise convolution operation, which involves performing spatial convolution on each channel of the input feature map separately. This is used to extract local spatial features within a channel with low parameter and computational cost. Indicates the kernel size as The dilation rate is r, used for a depthwise dilation operation to further expand the effective receptive field and extract a larger range of contextual information; d represents the spatial size of the convolution kernel, and r represents the dilation interval between adjacent convolution sampling points; F_2 represents the spatial contextual feature map obtained after sequentially performing depthwise convolution and dilation depthwise convolution. In one embodiment, the depthwise convolution uses... Convolution kernel, dilated depthwise convolution uses The convolution kernel has an expansion rate r = 3.
[0092] Subsequently, the spatial offset is calculated using deformable convolution, and the sampling position is dynamically adjusted according to the target shape:
[0093]
[0094] in, This represents an offset prediction convolutional layer, used to predict the input feature map. Predict the spatial offset corresponding to each sampling position of deformable convolution; This represents the feature map obtained from the aforementioned large kernel spatial feature extraction process; This represents the two-dimensional offset of the nth sampling position in the horizontal and vertical directions. For a two-dimensional deformable convolution with N sampling positions, the number of offset channels in the output of the offset prediction convolutional layer is 2N, corresponding to the horizontal and vertical offsets of each sampling position, respectively.
[0095] Feature extraction is performed using the sampling positions after dynamic offset:
[0096]
[0097] in, Let represent the feature value of the deformable convolution output feature map at spatial location p; p represents the two-dimensional spatial coordinates of the current output feature point in the feature map; n represents the index of the sampling position in the convolution kernel; N represents the total number of sampling positions contained in the convolution kernel, when the convolution kernel size is 1. At times, there are usually ; p_n represents the learnable convolutional kernel weights corresponding to the nth sampling position; p_n represents the fixed coordinate offset of the nth sampling position in the standard convolution relative to the center position p. This represents the nth learnable spatial offset generated by the offset prediction convolutional layer. This represents the actual sampling position of the nth sampling point after dynamic offset. When the actual sampling position is a non-integer coordinate, the corresponding feature value is obtained through bilinear interpolation.
[0098] Then through Convolution generates attention weights:
[0099]
[0100] in, Indicates the kernel size as Pointwise convolution is used to sample deformable features. Perform channel mapping and cross-channel information fusion; This represents the attention response map generated from deformable large kernel features, and its spatial location is related to the base feature map. Correspondingly, it is used to characterize the importance of different channels and different spatial locations.
[0101] Finally, the attention-enhanced features are residually fused with the original input features to obtain the final output:
[0102]
[0103] in, Indicates the input feature map, This represents the feature map after enhancement by the Deformable-LKA module. This represents the sampling offset obtained from deformable convolution prediction.
[0104] in, This represents element-wise multiplication, and it represents the use of attention response maps. For basic feature maps Perform adaptive weighting; This represents pointwise convolution, used for channel fusion and channel number adjustment of weighted features; the symbol " " indicates element-wise addition; F represents the original input feature map of the module, which is added to the attention-enhanced feature through residual connections; This represents the output feature map obtained after deformable large kernel space modeling, attention enhancement, and residual fusion. The residual connections are used to preserve the original feature information and reduce the risk of feature degradation during network deepening.
[0105] 2. In the FA-AIFI frequency domain attention enhancement module, This represents the high-level semantic feature map output by the backbone network; This represents the Fast Fourier Transform, used to convert spatial domain features into complex frequency domain features; Indicates by Frequency domain characteristics obtained by Fast Fourier Transform; , and These represent the learnable projection matrices used to generate query features, key features, and value features, respectively. , and These represent the frequency domain query matrix, key matrix, and value matrix, respectively; the superscript H indicates the conjugate transpose of the complex matrix; The feature dimension of the key vector. is the scaling factor used to avoid excessively large matrix dot products; Softmax(\cdot) represents the normalization exponential function; This represents the frequency domain attention weight matrix calculated based on the query matrix and the key matrix; This represents the frequency domain enhancement feature obtained by weighting the value matrix using attention weights; This represents the inverse fast Fourier transform; This represents the spatial domain enhancement features recovered from the frequency domain enhancement features; The lightweight learnable transform in the frequency domain residual branch, in one implementation, sequentially includes a convolutional layer, a batch normalization layer, a GELU activation layer, another convolutional layer, and a sigmoid activation layer; the "" in the frequency domain residual formula "Indicates element-wise multiplication between frequency domain features; This indicates taking the amplitude of the inverse Fourier transform result; This represents the frequency-aware features generated by the frequency domain residual fusion branch; This represents pointwise convolution; This indicates feature concatenation along the channel dimension; This represents the output feature obtained after frequency domain attention enhancement and frequency domain residual fusion.
[0106] The FA-AIFI (Frequency Attention Augmented AIFI) module enhances the frequency domain feature representation of targets in complex traffic scenarios. Since small targets typically possess weak edge and texture information and are easily affected by background factors such as road texture and lighting variations, traditional spatial domain-based attention mechanisms struggle to fully extract effective target information. This module transforms spatial features to the frequency domain, establishes attention relationships in the frequency space, enhances target-related frequency information, and suppresses invalid background noise, thereby improving the model's ability to detect low-resolution, small-sized targets.
[0107] Figure 3 This is the FA module architecture diagram.
[0108] The formulas for this module can be summarized as follows:
[0109] First, input high-level semantic features Transform to the frequency domain using Fast Fourier Transform:
[0110]
[0111] Next, the query matrix, key matrix, and value matrix are generated using the learnable parameter matrix:
[0112]
[0113]
[0114]
[0115] Then, the frequency domain attention weights are calculated:
[0116]
[0117] Enhance frequency domain features using attention weights:
[0118]
[0119] Then, the spatial domain features are recovered using the inverse fast Fourier transform:
[0120]
[0121] Meanwhile, frequency information is further enhanced through frequency domain residual fusion branch:
[0122]
[0123] Finally, the frequency domain enhancement features and residual fusion features are concatenated:
[0124]
[0125] in, This indicates the input high-level semantic features. This represents the characteristics after frequency domain transformation. These represent the query matrix, key matrix, and value matrix, respectively. This indicates the output characteristics after enhancement by the FA-AIFI module.
[0126] 3. In the DSMF dual-stream multi-scale fusion module, X represents the input high-level semantic feature map, which contains strong category semantic information; Y represents the input low-level spatial feature map, which contains rich target edge, texture and location information. Indicates the kernel size as Convolutional mapping; and These represent the high-level semantic features and low-level spatial features after convolution processing, respectively. This indicates a global average pooling operation; This represents a multilayer perceptron; This represents the Sigmoid activation function; This represents the channel attention weights generated from high-level semantic features; This represents the semantically enhanced features after channel attention weighting; This indicates a batch normalization operation; This represents a spatial attention map generated from low-level spatial features. This represents the spatial enhancement feature after spatial attention weighting; the symbol " "" indicates element-wise multiplication. When the attention weights are not consistent with the number of channels in the input features, the attention weights are extended to the corresponding channels through broadcasting. This indicates feature stitching along the channel dimension; F_7 represents the preliminary fused feature obtained by stitching together channel enhancement features and spatial enhancement features; This indicates an upsampling operation, used to keep high-level features and low-level features consistent in spatial size; Represents the foreground attention map generated based on high-level semantic features; E represents a matrix of all ones with the same size as the foreground attention map; This represents a background attention map that complements foreground attention. This indicates the i-th dilated convolution operation with a preset dilation rate, where i represents the dilated convolution branch number. In one implementation, the dilation rates are set to 1, 3, 5, and 7, respectively. This represents the multi-scale foreground enhancement features obtained under foreground attention guidance. This represents the multi-scale background perception features obtained under background attention guidance; , This indicates that the two elements will be joined along the channel dimension; Indicates The output features of the DSMF module obtained after convolutional fusion.
[0127] The DSMF (Dual-Stream Multiscale Fusion) module enhances the information interaction between features at different scales, addressing the shortcomings of existing object detection networks, such as simplistic feature fusion methods and insufficient fusion of shallow spatial and deep semantic information. In complex traffic scenarios, small targets typically contain limited effective pixel information, leading to the loss of detailed information after multi-layer network processing. Furthermore, invalid information in the background region can negatively impact target feature representation. Therefore, this module constructs foreground information enhancement and background information suppression branches to model features in both target and non-target regions, respectively. By combining channel attention and spatial attention mechanisms, it achieves effective fusion of multi-scale features, improving the model's adaptability to small targets and complex background environments.
[0128] Figure 4 This is the DSMF module architecture diagram.
[0129] The formulas for this module can be summarized as follows:
[0130] First, the high-level semantic features of the input. and low-level spatial features Perform convolution processing separately:
[0131]
[0132]
[0133] Subsequently, channel attention is calculated on the high-level semantic features, and channel weights are obtained through global average pooling:
[0134]
[0135] Enhance important semantic information using channel weights:
[0136]
[0137] Simultaneously, spatial attention calculations are performed on low-level spatial features:
[0138]
[0139] Enhance target spatial location features using spatial attention:
[0140]
[0141] Subsequently, the channel enhancement features and spatial enhancement features are fused:
[0142]
[0143] Next, a foreground attention map is generated based on the high-level semantic features:
[0144]
[0145] Generate a background attention map from the foreground attention map:
[0146]
[0147] in, This represents a matrix consisting entirely of 1s.
[0148] Subsequently, the low-level spatial features are fused with foreground attention and background attention respectively:
[0149]
[0150]
[0151] in, This represents convolution operations with different dilation rates.
[0152] Finally, the foreground enhancement features and background suppression features are fused together:
[0153]
[0154] in, Y represents high-level semantic features, and Y represents low-level spatial features. This indicates the enhanced features after fusion by the DSMF module.
[0155] 4. In the MSC multi-scale sparse cross-attention module, X and Y represent two different levels or scales of feature maps input to the MSC module, where X is used to generate query features and Y is used to construct multi-scale key features and value features; This represents the average pooling operation at the i-th scale. , and These represent the features obtained under different pooling scales; This represents the multi-scale fusion representation obtained by aligning pooling features at each scale to size and adding them element by element. This represents flattening two-dimensional spatial features into a feature sequence; and Represents a learnable linear projection matrix; This represents the query matrix generated from the input feature X; This indicates that the projection result is divided into two parts along the feature dimension; K and V represent the key matrix and value matrix generated by multi-scale fusion features, respectively; the superscript T indicates matrix transpose; The key vector represents the feature dimension; M represents the attention score matrix calculated from the query matrix and the key matrix. This means retaining the k positions with the highest scores in each row of the attention score matrix and setting the remaining positions to negative infinity or a masked state; and This indicates two different amounts or proportions of sparse retention. and This represents the fusion coefficient of two sparse attention branches. The fusion coefficient can be set to a fixed value or obtained through training, and preferably satisfies the following conditions: , and ; This represents the sparse attention weights obtained under a single Top-K ratio; This represents the final sparse attention weights obtained after fusing different sparse ratios; This represents the multi-scale fusion feature obtained by weighting the value matrix V using sparse attention weights. The feature is then restored to the form of a spatial feature map as needed by the subsequent network.
[0156] The MSC (Multiscale Sparse Cross-Attention) module further optimizes the information interaction process between features at different scales, addressing the high computational complexity of traditional attention mechanisms and the presence of numerous redundant features in multi-scale fusion. In complex traffic scenarios, features at different scales simultaneously contain both target and background information. Directly performing global attention calculations would introduce a large number of invalid features, reducing detection efficiency. Therefore, this module employs multi-scale feature extraction, cross-attention calculation, and a Top-K sparse selection mechanism to retain only the important features relevant to target detection, achieving efficient multi-scale information fusion.
[0157] Figure 5 This is the architecture diagram of the MSC (Multi-Scale Sparse Cross-Attention) module.
[0158] The formulas for this module can be summarized as follows:
[0159] First, the input feature map Perform average pooling operations at different scales to extract multi-scale features:
[0160]
[0161]
[0162]
[0163] Fusing features at different scales:
[0164]
[0165] Then, input features and the fused multi-scale features Flatten the matrix and generate the query matrix, key matrix, and value matrix:
[0166]
[0167]
[0168] Calculate the attention relationship between features at different scales:
[0169]
[0170] Obtain the attention matrix:
[0171]
[0172] Then, a Top-K sparse selection method is used to filter invalid responses:
[0173]
[0174] To enhance the feature selection capability at different scales, different sparsity ratios are introduced for fusion:
[0175]
[0176] Finally, the value matrix is updated using the optimized attention weights:
[0177]
[0178] in, and These represent feature maps at different scales of the input. These represent the query matrix, key matrix, and value matrix, respectively. This represents the multi-scale fusion features after processing by the MSC module.
[0179] The entire segmentation process is as follows Figure 1 As shown: The image is input to DSMF-DETR, and after feature extraction and decoding by the model, the final output effect is obtained.
[0180] To verify the effectiveness of the proposed dual-stream multi-scale fusion-based traffic target detection method, AP, AP50, AP75, APS, APM, APL, and FPS were used as evaluation metrics. AP represents the average detection accuracy of the model at different intersection-union (IU) thresholds, used to comprehensively measure the overall detection performance of the model; a higher value indicates better detection performance. AP50 represents the average accuracy at an IU threshold of 0.50, mainly reflecting the model's basic target detection capability. AP75 represents the average accuracy at an IU threshold of 0.75, requiring higher target localization accuracy and reflecting the accuracy of bounding box prediction. APS, APM, and APL represent the detection accuracy of small, medium, and large targets, respectively, used to measure the model's ability to detect targets of different sizes. FPS represents the number of frames processed per second, used to evaluate the model's real-time detection speed; a higher value indicates faster inference speed.
[0181] Table 1. Performance comparison of different detection models on the joint BDD100K and SODA-D test sets.
[0182] Model AP AP50 AP75 APS APM APL FPS DETR 46.9 66.2 50.6 30.1 50.0 62.2 28.4 Deformable DETR 48.2 69.4 50.9 31.7 51.4 63.1 42.3 FSSD-DETR 49.3 72.8 52.1 33.1 53.2 71.4 46.3 RT-DETR 48.4 70.2 52.7 31.4 53.1 65.9 52.1 ESDO 48.7 72.9 52.3 33.2 52.5 65.1 53.1 DSMF-DETR(ours) 52.3 70.3 55.4 35.7 55.4 66.2 66.7
[0183] Experimental results show that the AP of the method of this invention reaches 52.3%, which is higher than that of DETR, Deformable DETR, FSSD-DETR, RT-DETR, and ESDO, indicating that the overall detection accuracy of this invention is higher. AP75 reaches 55.4%, the highest among all comparative methods, indicating that this invention can improve the target bounding box localization accuracy. APS reaches 35.7%, an improvement over existing methods, indicating that this invention has stronger detection capabilities for small-sized targets in complex traffic scenarios. Meanwhile, the APM of this invention reaches 55.4%, and APL reaches 66.2%, indicating good adaptability to targets of different scales. Although the AP50 of this invention is not the highest among all methods, the indicators that better reflect the overall detection quality and small target localization capability, such as AP, AP75, and APS, all achieve optimal results, demonstrating that this invention has significant advantages in improving detection accuracy and small target detection performance. Furthermore, the method of this invention achieves an FPS of 66.7, which is significantly higher than other comparative methods, indicating that it can maintain high real-time performance while improving detection performance, and can meet the application requirements for high-precision and fast target detection in scenarios such as autonomous driving and intelligent traffic monitoring.
Claims
1. A traffic small target detection method based on dual-stream multi-scale fusion, characterized in that, Includes the following steps: Step S1: Image Input and Feature Extraction Traffic scene images are acquired and input into a feature extraction network. Through multi-layer convolution operations, feature maps of different resolutions are extracted to obtain high-resolution feature maps containing shallow spatial information and low-resolution feature maps containing deep semantic information. Step S2: Deformable macronucleus attention enhancement The feature map extracted in step S1 is input into the deformable large kernel attention module. The large convolutional kernel is used to expand the feature perception range, and the spatial sampling offset is predicted by deformable convolution. The sampling position is dynamically adjusted according to the target shape to generate an enhanced multi-scale feature map. Step S3: Frequency Domain Attention Enhancement The enhanced high-level semantic feature map in step S2 is input to the frequency domain attention enhancement module. The spatial domain features are transformed to the frequency domain through Fourier transform. Attention weights are calculated in the frequency domain space to enhance the frequency components corresponding to the target edge and texture. Then, the spatial domain is restored through inverse Fourier transform to generate the frequency domain enhanced feature map. Step S4: Two-stream multi-scale fusion The shallow spatial feature map extracted in step S1 and the frequency domain enhanced feature map generated in step S3 are jointly input into the dual-stream multi-scale fusion module, which performs fusion through the following sub-steps: Channel attention is calculated on high-level semantic features to generate channel-enhanced features, thereby strengthening important semantic information; Spatial attention calculations are performed on low-level spatial features to generate spatially enhanced features, thereby strengthening target location information; The channel enhancement feature is concatenated with the spatial enhancement feature to obtain a preliminary fusion feature; Foreground attention maps and background attention maps are generated based on high-level semantic features. The foreground attention map is used to enhance the response of the target region in the low-level spatial features, and the background attention map is used to suppress the response of the background region in the low-level spatial features, thereby obtaining foreground enhancement features and background suppression features, respectively. The foreground enhancement feature and the background suppression feature are concatenated and fused through convolution to obtain the dual-stream fused feature; Step S5: Multi-scale sparse cross-attention fusion The dual-stream fusion feature obtained in step S4 is input into the multi-scale sparse cross-attention module. Pooling operations at different scales are performed on the feature to extract multi-scale features. The features at each scale are added together to obtain the multi-scale fusion representation. The original feature and the multi-scale fusion representation are then used to construct a query matrix, a key matrix, and a value matrix, respectively. Cross-attention weights are calculated, and a Top-K sparse selection mechanism is used to retain the attention responses related to object detection, thereby generating sparsely optimized multi-scale fusion features. Step S6: Target detection output The sparsely optimized multi-scale fusion features obtained in step S5 are input into the detection decoder. Through target classification and bounding box regression, the category information and location information of target objects in the traffic scene are output to complete the small target detection.
2. The method according to claim 1, characterized in that, The deformable large kernel attention module in step S2 specifically performs the following operations: The input feature map is sequentially processed with standard convolution, batch normalization, and GELU activation to extract basic features; The basic features are subjected to depthwise separable convolution and large-kernel depthwise separable convolution to expand the receptive field; The spatial sampling offset is predicted on the feature map after the receptive field is expanded by an offset convolutional layer; The feature map is deformably sampled based on the predicted offset to obtain features at an adaptive position. The features at the adaptive position are convolved with a 1×1 convolution to generate attention weights; The attention weights are multiplied element-wise with the basic features, then subjected to a 1×1 convolution and added to the residual of the original input features to obtain the enhanced feature map.
3. The method according to claim 1, characterized in that, The frequency domain attention enhancement module in step S3 specifically performs the following operations: The high-level semantic feature map of the input is subjected to Fast Fourier Transform to obtain the frequency domain features; The query matrix, key matrix, and value matrix are generated using three learnable weight matrices. Calculate the dot product between the query matrix and the transpose of the key matrix, divide by the scaling factor, and normalize using the Softmax function to obtain the frequency domain attention weights; Multiplying the frequency domain attention weights by the value matrix yields the weighted frequency domain features; Perform an inverse fast Fourier transform on the weighted frequency domain features to restore them to the spatial domain, thus obtaining the spatial domain enhanced features; Meanwhile, the frequency domain autocorrelation of the input features is calculated and inversely transformed through the frequency domain residual fusion branch to obtain the residual fusion features; The spatial domain enhancement features and the residual fusion features are concatenated and then convolved to obtain the final frequency domain enhancement feature map.
4. The method according to claim 1, characterized in that, In step S4, the foreground attention map and the background attention map are generated as follows: high-level semantic features are processed using convolution and upsampling operations, a foreground attention map is generated by the Sigmoid activation function, and the background attention map is obtained by subtracting the foreground attention map from the all-1 matrix.
5. The method according to claim 1, characterized in that, In step S4, when the foreground attention map and the background attention map are used to enhance and suppress low-level spatial features respectively, dilated convolution with different dilation rates is used to perform multi-scale dilated convolution operations on the weighted features, and the results under each dilation rate are spliced together to obtain foreground enhancement features and background suppression features respectively.
6. The method according to claim 1, characterized in that, The multi-scale sparse cross-attention module in step S5 specifically performs the following operations: The input dual-stream fusion features are subjected to average pooling at at least three different scales to obtain pooled features at multiple scales. The pooling features at the multiple scales are added element by element to obtain a multi-scale fused representation; The original input features are flattened and then linearly transformed to generate a query matrix. The multi-scale fusion representation is flattened, linearly transformed, and then split into a key matrix and a value matrix. Calculate the dot product between the query matrix and the transpose of the key matrix and divide by the scaling factor to obtain the attention score matrix; The attention score matrix is sparsely selected according to at least two different Top-K selection ratios, and the positions with the highest scores are retained. After being normalized by Softmax, the results under different sparsity ratios are weighted and summed to obtain the sparse attention weights. Multiplying the sparse attention weights by the value matrix yields the sparsely optimized multi-scale fusion features.
7. The method according to claim 1, characterized in that, The feature extraction network in step S1 adopts a backbone network based on a convolutional neural network, and the output includes at least a high-resolution low-semantic-level feature map and a low-resolution high-semantic-level feature map. The low-resolution high-semantic-level feature map is sequentially input to step S2 and step S3 for processing, and the high-resolution low-semantic-level feature map is directly input to step S4 for dual-stream fusion with frequency domain enhancement features.
8. The method according to claim 1, characterized in that, The detection decoder in step S6 adopts a Transformer-based decoder structure, decodes the fused features through multi-layer cross-attention, outputs the classification scores and bounding box coordinates of multiple candidate targets in parallel, and outputs the final detection result after non-maximum suppression.
9. The method according to claim 1, characterized in that, The traffic targets include at least vehicles, pedestrians, and traffic signs, and the traffic scene images are derived from road surveillance videos or real-time images captured by autonomous driving vehicle cameras.
10. A traffic small target detection system based on dual-stream multi-scale fusion, characterized in that, Small target detection in traffic scenarios is performed using the method described in any one of claims 1 to 9.
