A Traffic Target Detection Method Based on Improved YOLO11n

By introducing SAM, CIM, and LargeKernelBlock modules into the YOLO11n model, the problems of small target omission, insufficient multi-scale feature interaction, and insufficient utilization of high-frequency edge information in traffic scenarios of the lightweight YOLO model are solved, and more efficient multi-scale target detection is achieved.

CN121582560BActive Publication Date: 2026-04-21SOUTHWEST PETROLEUM UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SOUTHWEST PETROLEUM UNIV
Filing Date
2026-01-28
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing lightweight YOLO models face challenges in traffic scenarios, including severe missed detections of small targets, insufficient multi-scale feature interaction, weak contextual modeling capabilities for large targets, and failure to explicitly utilize high-frequency edge information, resulting in limited detection performance.

Method used

The SAM spatial attention module, CIM feature interaction module, and LargeKernelBlock are introduced into the YOLO11n model to enhance the detection accuracy of small targets, multi-scale feature fusion, and large target context modeling capabilities, and to utilize high-frequency edge information.

Benefits of technology

It improves the detection accuracy of small targets, enhances the detection performance of multi-scale targets, strengthens the recognition ability of large targets, and effectively utilizes high-frequency edge information to improve the detection performance and robustness of the model in complex traffic scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121582560B_ABST
    Figure CN121582560B_ABST
Patent Text Reader

Abstract

This invention discloses a traffic target detection method based on an improved YOLO11n, belonging to the field of traffic target detection technology. The method includes: acquiring traffic scene image data to be detected and preprocessing it to obtain preprocessed traffic image data; constructing an improved YOLO11n neural network model; and inputting the preprocessed traffic image data into the pre-trained improved YOLO11n neural network model to obtain target detection results. This invention achieves accurate detection and feature enhancement of small, medium, and large-scale traffic targets, effectively improving the model's detection performance and robustness in complex traffic scenes without significantly increasing computational load.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to traffic target detection technology, and more particularly to a traffic target detection method based on an improved YOLO11n. Background Technology

[0002] Traffic object detection is a crucial application in computer vision, particularly in Intelligent Transportation Systems (ITS), autonomous driving, and traffic monitoring. With the development of deep learning technology, object detection methods, especially those based on Convolutional Neural Networks (CNNs), have become key technologies for achieving efficient and real-time traffic object detection. In particular, the YOLO (You Only Look Once) series of algorithms, due to their high detection speed and low computational cost, have become the mainstream choice for real-time object detection.

[0003] With the rapid development of Intelligent Transportation Systems (ITS) and autonomous driving technologies, high-precision, low-latency traffic target detection has become a critical fundamental task. In real-world traffic scenarios, target scales vary drastically (e.g., small vehicles in the distance, large trucks nearby), occlusion is severe, lighting is complex, and the detection accuracy requirements for small targets (e.g., pedestrians, traffic lights) are extremely high. Therefore, how to balance multi-scale target detection capabilities with real-time performance in lightweight models (such as the YOLO series) has become a current research hotspot.

[0004] In recent years, YOLOv5 / v8 / v10 models have improved detection performance by introducing CSP structures, PAN-FPN fusion, and attention mechanisms. The YOLO11n series, released in 2024, further reduced model size, optimizing backbone network design while maintaining high inference speed, making it suitable for edge device deployment. However, the original YOLO11n (nano version) faces three core challenges in traffic scenarios:

[0005] The detection of small targets is seriously flawed: shallow features lack effective spatial attention guidance, making it easy for small target features such as pedestrians and traffic lights to be submerged by background noise;

[0006] Insufficient multi-scale feature interaction: Features at each level in the backbone network are processed independently, lacking a dynamic information fusion mechanism across scales, making it difficult to coordinate local details with global semantics;

[0007] Weak ability to model the context of large targets: Deep features rely on standard 3×3 or 5×5 convolutions, which have limited receptive fields and insufficient understanding of the context of large vehicles or dense traffic flow at long distances.

[0008] High-frequency edge information is not explicitly utilized: the model does not enhance high-frequency information such as image gradients and contours, while edge features of traffic targets (such as vehicle contours and traffic light borders) are crucial for detection.

[0009] The aforementioned issues limit the performance of existing lightweight YOLO models in practical applications such as complex traffic monitoring and vehicle forward-looking systems, necessitating an improved architecture that balances sensitivity to small targets, multi-scale collaboration, and large receptive field modeling capabilities. Summary of the Invention

[0010] To address the aforementioned shortcomings in existing technologies, this invention provides a traffic target detection method based on an improved YOLO11n, which solves the problems of insufficient accuracy in small target detection, insufficient multi-scale feature interaction, insufficient ability to model the context of large targets, and lack of effective utilization of high-frequency edge information in existing traffic target detection technologies.

[0011] To achieve the aforementioned objectives, the technical solution adopted by this invention is: a traffic target detection method based on an improved YOLOv11n, comprising:

[0012] Collect traffic scene image data to be detected and preprocess it to obtain preprocessed traffic image data;

[0013] Construct an improved YOLO11n neural network model;

[0014] The preprocessed traffic image data is input into a pre-trained improved YOLO11n neural network model to obtain the target detection results.

[0015] The beneficial effects of this invention are as follows:

[0016] 1. This invention improves the detection accuracy of small objects by introducing the SAM (Small-Object Attention Module) spatial attention module, which explicitly enhances spatial localization capabilities at the P3 layer and the backbone layer. The SAM module can accurately focus on small object regions, enhancing the model's perception of small objects and reducing missed detections and false detections.

[0017] 2. This invention achieves dynamic cross-scale feature fusion by introducing a CIM (Cross-Interaction Module) feature interaction module into the shallow Backbone and Head layers. The CIM module can enhance the interaction and information transmission between features at different scales, thereby improving the detection performance of multi-scale targets.

[0018] 3. This invention introduces LargeKernelBlock in the deep layers of P4 / P5 and Backbone, and uses larger convolutional kernels (such as 27×27) to expand the receptive field, which can effectively capture a wider range of contextual information and improve the ability to recognize large targets.

[0019] 4. This invention enhances the ability to perceive edge information by incorporating a high-frequency branch initialized by Sobel into the LargeKernelBlock module, ensuring that the model can better handle the edge features of traffic targets and reduce false detections and false negatives caused by blurred edges. Attached Figure Description

[0020] Figure 1 This is a flowchart of a traffic target detection method based on the improved YOLO11n.

[0021] Figure 2 A diagram of the improved YOLO11n neural network model constructed for this embodiment;

[0022] Figure 3 Here is a detailed structural diagram of the CIM feature interaction module;

[0023] Figure 4 Here is a detailed structural diagram of the SAM spatial attention module;

[0024] Figure 5 This is a structural diagram of the Large Kernel Block. Detailed Implementation

[0025] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.

[0026] like Figure 1 As shown, in one embodiment of the present invention, a traffic target detection method based on improved YOLOv11n includes the following steps:

[0027] S1. Collect the traffic scene image data to be detected and preprocess it to obtain the preprocessed traffic image data.

[0028] In this embodiment, the preprocessing of the traffic scene image data to be detected specifically involves resizing and standardizing the traffic scene image to be detected.

[0029] S2. Construct an improved YOLO11n neural network model.

[0030] The improved YOLO11n neural network model constructed in this embodiment is as follows: Figure 2 As shown. The specific method for constructing the improved YOLO11n neural network model is as follows:

[0031] In the backbone network of the original YOLO11n, the CIM feature interaction module is integrated in the shallow feature path, the SAM spatial attention module is integrated in the mid-level feature path, and the CIM feature interaction module and the Large Kernel Block module are integrated in the deep feature path. In the neck network of the original YOLO11n, the CIM feature interaction module and the SAM spatial attention module are integrated in the upsampling path, and the Large Kernel Block module and the CIM feature interaction module are integrated in the downsampling path. In the head network of the original YOLO11n, the SAM spatial attention module is integrated in the P3 feature layer, the Large Kernel Block module is integrated in the P4 feature layer, and the CIM feature interaction module is integrated in the P5 feature layer.

[0032] By introducing the SAM (Small-Object Attention Module), spatial localization capabilities are explicitly enhanced at the P3 layer and in the backbone, thereby improving the detection accuracy of small objects. The SAM module can accurately focus on small object regions, enhancing the model's perception of small objects and reducing false positives and false negatives. By introducing the CIM (Cross-Interaction Module) feature interaction module in the shallow backbone and head layers, dynamic cross-scale feature fusion is achieved. The CIM module strengthens the interaction and information transmission between features at different scales, improving the detection performance of multi-scale objects. (The last sentence is a repetition of the previous one and can be omitted.)

[0033] The specific structure of the CIM feature interaction module is as follows: Figure 3 As shown, it includes: a feature segmentation unit, a multi-scale convolutional unit, a scale equalization unit, a bidirectional attention unit, a global gating unit, a dynamic Gamma unit, and a feature fusion unit connected in sequence; wherein the output of the feature segmentation unit includes a first branch and a second branch, the multi-scale convolutional unit is connected to the first branch of the feature segmentation unit, and the second branch of the feature segmentation unit is connected to a 1×1 convolutional layer and a scale equalization unit in sequence.

[0034] The feature segmentation unit is used to divide the input feature x into two branches, namely a first branch and a second branch, through hard segmentation or soft segmentation. In the hard segmentation mode, the input channel is fixedly divided into the first branch and the second branch according to a preset segmentation ratio r=0.75. In the soft segmentation mode, a learnable parameter α is mapped to weights through a sigmoid function, and the input features are weighted and distributed to the two branches respectively, ensuring that the sum of the weights of the two branches is 1.

[0035] The multi-scale convolutional unit includes a 3×3 convolutional layer, a 5×5 convolutional layer and a 1×1 convolutional layer connected in sequence, which is used to extract multi-scale features from the output of the first branch to obtain the features of the first branch.

[0036] The 1×1 convolutional layer connected to the second branch is used to extract features from the output of the second branch to obtain the features of the second branch.

[0037] The scale equalization unit takes as input the convolutional features of the first and second branches (i.e., features of the first and second branches). First, it performs global average pooling on the features of both branches separately, then concatenates the pooling results. A 1×1 convolutional layer and a softmax function adaptively learn the weight ratio of the two branches. Finally, based on the learned weights, they are applied to the features of the two branches respectively, resulting in the weighted molecular features. y 1 and branch features y 2. Simultaneously, add these two weighted branch features together to generate a weighted summation fused feature. y ;

[0038] The bidirectional attention unit, comprising a spatial attention subunit and a channel attention subunit, is used to enhance the spatial and channel importance of the weighted summed features, resulting in spatially enhanced features. and channel enhancement features ;

[0039] The global gating unit is used to generate gating weights, dynamically balance the contributions of spatial enhancement features and channel enhancement features, and output fused features; its gating weights are defined as follows:

[0040]

[0041] In the formula, Indicates the output features of the scale equalization unit y Perform global average pooling. This represents a 1x1 convolution, where σ represents the sigmoid activation function. This is the gating weight.

[0042] The spatial augmentation features and channel augmentation features are fused using the generated gating weights to obtain the fused features. The process can be represented as follows:

[0043]

[0044] Dynamic Gamma units are used to generate scaling factors to adjust the scale of the fused features, resulting in scaled fused features. The scaling factor is defined as:

[0045]

[0046] In the formula, γ This represents the scaling factor.

[0047] The first feature fusion unit projects the input features from the CIM feature interaction module and concatenates them with the scaled fused features. It then further optimizes the concatenated features using two 1×1 convolutional layers. The calculation process is as follows:

[0048]

[0049] In the formula, This represents the final feature result output by CIM. Input features for the CIM feature interaction module The projected features are then processed by two 1×1 convolutional layers. and Used for further integration of the spliced ​​features.

[0050] Specifically, when the input feature map x Upon entering the CIM module, the system is first divided into two branches according to a predefined segmentation ratio: a main branch x1 and an auxiliary branch x2. The main branch x1 undergoes a series of multi-scale convolutions (3×3, 5×5, 1×1) to extract rich structural information and multi-scale contextual features, resulting in the first branch features. The auxiliary branch x2, however, undergoes only a lightweight 1×1 convolution to obtain the second branch features, preserving local details and small object information from the input features. Next, the scale equalization unit concatenates the global average pooling results of the two branch features and feeds them into a 1×1 convolution and a softmax function to adaptively learn the weight ratio between the first and second branches, generating two normalized weights w1 and w2. These weights dynamically balance the importance of the main and auxiliary branches, preventing features from the large convolution branch from dominating. The learned weights are then applied to the two branch features respectively, resulting in weighted branch features y1 and y2, which are then summed using weighted methods. Obtain features y .

[0051] Based on this, feature y is fed into the spatial attention subunit and channel attention subunit of the bidirectional attention unit, generating two attention maps: spatial attention enhances the response of the main branch features in key regions, while channel attention strengthens the semantic discrimination ability of the auxiliary branch. After corresponding weighting, spatially enhanced features and channel-enhanced features are obtained, respectively. Subsequently, the global gating unit (gate) adaptively controls the fusion ratio of the two enhanced features using a gating factor generated by global average pooling, outputting the fused feature. The dynamic gamma unit further adjusts the scale of the fused feature using a dynamic scaling factor and uses DropPath to improve the robustness and generalization performance of the model. Finally, the first feature fusion unit projects the input features from the CIM feature interaction module and concatenates them with the scaled fused feature, then integrates them through two 1x1 convolution layers to obtain the final feature result.

[0052] The entire connection process realizes an organic closed loop from input → dual-branch feature extraction → dynamic weighted fusion → attention enhancement → gating adjustment → residual fusion, which enables CIM to significantly improve feature interaction and scale adaptation capabilities while maintaining semantic integrity.

[0053] The specific structure of the SAM spatial attention module is as follows: Figure 4 As shown, it includes: parallel local branches and global branches, as well as a position guidance unit and a second feature fusion unit connected in sequence; the local branches include consecutive 3×3 convolutional layers and 1×1 convolutional layers; the global branches include a 1×k convolutional layer, a batch normalization layer, a SILU activation function, a k×1 convolutional layer, a batch normalization layer, a SILU activation function, and a 1×1 convolutional layer connected in sequence; the position guidance unit includes a 3×3 convolutional layer, a batch normalization layer, a ReLU activation function, a 1×1 convolutional layer, and a sigmoid activation function connected in sequence; the outputs of the local branches, global branches, and position guidance units are all used as inputs to the second feature fusion unit;

[0054] Local branches are used to output local feature maps;

[0055] The global branch is used to output the global feature map;

[0056] The location guidance unit is used to generate a spatial attention weight map;

[0057] The second feature fusion unit is used to output a feature enhancement map based on the local feature map, the global feature map, and the spatial attention weight map.

[0058] Specifically, when the input features enter the SAM module, they are first fed into two parallel branches: a local branch (local detail path) and a global branch (global kernel path). The local branch consists of consecutive 3×3 and 1×1 convolutions, primarily focusing on preserving the detailed texture and edge information of the target, suitable for representing the local features of small targets. The global branch employs a "decompositional large convolutional kernel" structure (first 1×k followed by k×1 depthwise separable convolutions), expanding the receptive field without significantly increasing computational cost, thereby capturing a wider range of contextual and spatial relationship information. The output features of these two branches... and They maintain consistency in spatial dimensions, but differ in semantic focus.

[0059] Next, a high-resolution position guidance unit (pos_guidance) is used to generate a spatial attention weight map to adaptively determine the importance of different spatial locations. This unit generates the spatial weight map by passing the input features through 3×3 convolutions, batch normalization, ReLU, 1×1 convolutions, and a sigmoid activation function. Its expression is:

[0060]

[0061] in It is the sigmoid activation function. The value ranges from 0 to 1, representing the degree of preference for "global features" and "local features" at each location. The generated weight map can automatically adjust the region of interest based on the feature response, achieving dynamic weighting at the spatial level; that is, in regions with higher weights, the response of the global branch dominates, while in regions with lower weights, the response of the local branch is stronger. In this way, SAM can adaptively balance local and global information at different spatial locations, thus becoming more sensitive to the shape edges and spatial positioning of small targets.

[0062] After obtaining the weight map, the spatial attention weights are applied to global and local features through the second feature fusion unit, focusing on global features. and local features After weighting each component separately, the results are summed to obtain the fused result. Its expression is:

[0063]

[0064] Here, ⊙ represents element-wise multiplication.

[0065] The fusion result is then linearly projected onto the input features of the SAM module. The input features are concatenated along the channel dimension, resulting in a channel count equal to the sum of the original input feature channels and the fused feature channels. The concatenation is then performed using a 1×1 convolution, while also incorporating a learnable scaling parameter. θ The fusion result is scaled in a learnable manner to obtain the output features. Its expression is:

[0066]

[0067] The entire process forms a lightweight residual attention structure: the input undergoes local-global parallel feature extraction → spatial guided fusion → channel compression → residual correction.

[0068] The structure of the Large Kernel Block is as follows: Figure 5 As shown, it includes: multiple parallel convolutional branches, which together form a large kernel branch group. Different convolutional branches use convolutional kernels of different sizes. Each convolutional branch is responsible for spatial context modeling at different scales. The features output by each convolutional branch are uniformly projected to the same channel dimension through a 1×1 convolution. The Large Kernel Block also includes fine-grained branches and high-frequency edge branches that run parallel to the large kernel branch group. The large kernel branch group, fine-grained branches, and high-frequency edge branches are all connected to an adaptive alignment unit, which is connected to the third feature fusion module.

[0069] The fine-grained branch consists of a 3×3 convolutional layer, used to preserve the basic texture and spatial details of the features;

[0070] High-frequency edge branches are used to extract edge and gradient information from input features;

[0071] The adaptive alignment unit is used to spatially align the outputs of different branches; the adaptive alignment unit supports two strategies for spatial alignment of the outputs of different branches: pruning and upsampling.

[0072] The third feature fusion module is used to fuse the aligned features.

[0073] The third feature fusion module integrates features according to the configured fusion mode to obtain aggregated features. Fusion modes include concatenation fusion mode, attention fusion mode, weighted fusion mode, and summation fusion mode.

[0074] The convolution kernels in the large kernel branch group are configured to operate in either a first mode or a second mode.

[0075] When operating in the first mode, the convolutional kernels in the large kernel branch group adopt a depth-separable convolutional structure;

[0076] When operating in the second mode, the convolution kernels in the large kernel branch group adopt a standard convolution structure.

[0077] The Large Kernel Block is configured to operate in either basic or enhanced mode.

[0078] When operating in basic mode, the Large Kernel Block does not enable high-frequency edge branches;

[0079] When operating in enhanced mode, the Large Kernel Block enables high-frequency edge branches.

[0080] Specifically, when the input features enter the Large Kernel Block, they are first copied and fed into multiple parallel convolutional branches. These branches use convolutional kernels of different sizes (e.g., 27×27, 19×10, 7×3, etc.), with each branch responsible for modeling the spatial context at different scales: large kernels (e.g., 27×27) capture global shape information that depends on long-range dependencies and large objects, while smaller kernels (e.g., 3×3, 7×7) focus more on local details and edge structures. When operating in the first mode, the convolutional kernels in the large kernel branch group employ a depthwise separable convolutional structure to reduce computation while maintaining receptive field advantage. The features output by each branch are then uniformly projected to the same channel dimension through a 1×1 convolution.

[0081] In addition to these large kernel branches, the module also includes a fine-grained branch, consisting of a 3×3 convolution, to preserve basic texture and spatial details. The output of the fine-grained branch is also projected through a 1×1 convolution to maintain channel consistency with the main branch features.

[0082] When the Large Kernel Block is configured to operate in enhancement mode, it additionally enables a high-frequency branch. This branch is initialized using a Sobel-like convolutional kernel, extracting edge and gradient information from the input features, essentially acting as a learnable "edge detector." After activation with BatchNorm and SiLU, the edge features are mapped to the same dimension and added to the subsequent multi-branch fusion, thereby injecting high-frequency details into the global context and avoiding excessive smoothing of the large convolutional features.

[0083] The outputs of each branch are input into an adaptive alignment unit for spatial alignment. The adaptive alignment unit supports two strategies: pruning and upsampling. If upsampling is used, all outputs are upsampled to the maximum branch size to preserve details of large branches; if the default mode is used, all features are pruned to the minimum branch size to avoid introducing spurious features through interpolation.

[0084] Simultaneously, the input features of the Large Kernel Block are aligned to the same size, facilitating subsequent residual connections. After the multi-branch features are formed and aligned, the third feature fusion module employs different fusion strategies based on the fusion parameters.

[0085] The concatenation fusion mode specifically involves concatenating the outputs of the aligned branches along the channel dimension and then fusing the features through 1×1 convolution dimensionality reduction. This mode preserves the complete information of each branch, allowing features from large-kernel convolution branches, small convolution branches, and fine-grained branches to be utilized simultaneously. Concatenation fusion is suitable for scenarios where multiple scale targets coexist, such as traffic monitoring where large vehicles (buses, trucks), medium-sized vehicles (cars), and small targets (pedestrians, bicycles) appear simultaneously. In such cases, concatenation fusion can fully preserve the multi-scale information of different branches, thereby improving the model's ability to detect various types of targets.

[0086] The attention fusion mode specifically involves generating spatial attention weights through edge-guided attention units, and then weighting and fusing the outputs of each aligned branch according to these spatial attention weights. The specific method for generating spatial attention weights through edge-guided attention units is as follows:

[0087] Edge feature maps are extracted from the input features of the Large Kernel Block using an edge extractor; the edge feature maps are then concatenated with the aggregated features output by the third feature fusion module along the channel dimension to obtain the concatenated features; spatial attention weights are generated based on the concatenated features through 1×1 convolution and a sigmoid activation function.

[0088] Optional edge-guided attention (SGA) can further enhance small targets or edge features. This mode is suitable for scenarios that require emphasizing local details or small targets, such as detecting pedestrians, motorcycles, or road cracks in nighttime traffic or complex road conditions. Through edge guidance, the model can focus on the edge features of small targets while maintaining global contextual information, thereby improving the accuracy and robustness of small target detection.

[0089] The weighted fusion mode works by assigning different weights to each branch using learnable branch weight parameters, and then weighting and fusing the outputs of the aligned branches based on these weights. This approach allows the model to automatically learn the importance of different branches from the training data, thus adapting to the detection needs of targets at different scales. Weighted fusion is suitable for situations where the target scale distribution is uneven or the scene changes dynamically. For example, during the day when traffic is heavy, larger convolutional branches may be given higher weights, while at night or when small targets account for a high proportion, the weights of smaller convolutional branches are automatically increased. This mode does not require manual weight setting and can automatically optimize the feature fusion effect based on the data.

[0090] The summation-fusion mode involves averaging the outputs of the aligned branches. This method is simple and efficient, does not add extra learnable parameters, and is suitable for scenarios with limited computing resources or requiring real-time inference. For example, in real-time video analysis of urban traffic monitoring, the summation-fusion mode can be used to quickly output detection results, reducing computational overhead while preserving multi-scale information. Although the fusion method is simple, it can still effectively utilize the feature information of different branches, improving the overall detection performance of the model.

[0091] Finally, the fused features are further integrated through a 1×1 convolution, followed by channel-aligned residual projection. If layer_scale is enabled, the fused result is first multiplied by a learnable scaling factor γ, then subjected to random residual regularization via DropPath, and finally added to the residual for output.

[0092] S3. Input the preprocessed traffic image data into the pre-trained improved YOLO11n neural network model to obtain the target detection results.

[0093] For example, the detection of targets such as pedestrians, traffic lights, and road signs.

[0094] In this embodiment, the training process of the improved YOLO11n neural network model includes the following steps:

[0095] Traffic scene image data is collected, preprocessed and labeled, and a training dataset is constructed. The traffic scene image data includes targets such as vehicles, pedestrians, and traffic lights.

[0096] S01. Data Acquisition: Collect image data containing vehicles, pedestrians, and traffic lights from traffic monitoring cameras, vehicle cameras, and public datasets.

[0097] S02, Data Preprocessing: Perform size standardization, color normalization, and data enhancement on the acquired image data;

[0098] S03. Data labeling: Using bounding box labeling, vehicles, pedestrians, and traffic lights in the image are labeled with their categories and locations.

[0099] S04. Dataset partitioning: Divide the labeled data into training set, validation set and test set according to the preset ratio.

[0100] Model training using datasets:

[0101] S11, Training parameter initialization: Set the learning rate, batch size, optimizer type, and loss function weights;

[0102] S12, Multi-stage training: Pre-trained weights are initialized, and alternating optimization is performed using frozen training and full parameter training;

[0103] S13, Model Validation: Evaluate the model performance on the validation set and adjust the training strategy based on the evaluation results;

[0104] S14, Model Saving: Saves the optimal model parameters during training.

[0105] To verify the beneficial effects of the present invention, based on quantitative results on the same dataset, the improved YOLO11n neural network model proposed in this invention is compared with the existing YOLO model. The comparison results are shown in Table 1.

[0106] Table 1

[0107]

[0108] The comparison results show that the improved YOLO11n provided by this invention exhibits excellent performance in multiple indicators.

[0109] This invention proposes a multi-scale traffic target detection method based on an improved YOLO11n. By introducing a Small-object Attention Module (SAM), a Cross-Interaction Module (CIM), and a LargeKernelBlock into the YOLO11n backbone and feature benfm fusion network (Neck), it achieves accurate detection and feature enhancement of small, medium, and large-scale traffic targets. Without significantly increasing the computational load, it effectively improves the detection performance and robustness of the model in complex traffic scenarios.

Claims

1. A traffic target detection method based on an improved YOLOv11n, characterized in that, include: Collect traffic scene image data to be detected and preprocess it to obtain preprocessed traffic image data; Construct an improved YOLO11n neural network model; The preprocessed traffic image data is input into a pre-trained improved YOLO11n neural network model to obtain the target detection results; The specific method for constructing the improved YOLO11n neural network model is as follows: In the backbone network of the original YOLO11n, the CIM feature interaction module is integrated in the shallow feature path, the SAM spatial attention module is integrated in the middle feature path, and the CIM feature interaction module and the Large Kernel Block module are integrated in the deep feature path. In the original YOLO11n neck network, the CIM feature interaction module and the SAM spatial attention module are integrated in the upsampling path, and the Large Kernel Block module and the CIM feature interaction module are integrated in the downsampling path. In the original YOLO11n head network, the SAM spatial attention module is integrated in the P3 feature layer, the Large Kernel Block module is integrated in the P4 feature layer, and the CIM feature interaction module is integrated in the P5 feature layer. The Large Kernel Block includes multiple parallel convolutional branches, which together form a large kernel branch group. Different convolutional branches use convolutional kernels of different sizes. Each convolutional branch is responsible for spatial context modeling at different scales. The features output by each convolutional branch are uniformly projected to the same channel dimension through a 1×1 convolution. The Large Kernel Block also includes fine-grained branches and high-frequency edge branches that run parallel to the large kernel branch group. The large kernel branch group, fine-grained branches, and high-frequency edge branches are all connected to an adaptive alignment unit, which is connected to the third feature fusion module.

2. The method according to claim 1, characterized in that, The specific structure of the CIM feature interaction module includes: a feature segmentation unit, a multi-scale convolution unit, a 1×1 convolutional layer, a scale equalization unit, a bidirectional attention unit, a global gating unit, a dynamic Gamma unit, and a first feature fusion unit; The feature segmentation unit is used to segment the input feature map into two branches, including a first branch and a second branch; Multi-scale convolutional units are used to extract multi-scale features from the output of the first branch to obtain the features of the first branch. A 1×1 convolutional layer is used to extract features from the output of the second branch, thus obtaining the features of the second branch; The scale equalization unit is used to adaptively learn the weight ratio of the first branch and the second branch based on the features of the first branch and the second branch, and to perform a weighted summation of the features of the first branch and the second branch, and output the weighted summation features. The bidirectional attention unit, including the spatial attention subunit and the channel attention subunit, is used to enhance the spatial importance and channel importance of the weighted summed features, resulting in spatially enhanced features and channel-enhanced features. A global gating unit is used to generate gating weights, dynamically balance the contributions of spatial enhancement features and channel enhancement features, and output fused features. Dynamic Gamma units are used to generate scaling factors to scale the fused features and obtain scaled fused features. The first feature fusion unit is used to concatenate the input features of the CIM feature interaction module with the scaled fused features, and further optimize the concatenated features through two 1×1 convolutional layers.

3. The method according to claim 1, characterized in that, The specific structure of the SAM spatial attention module includes: parallel local branches, global branches, and a location guidance unit, as well as a second feature fusion unit. The local branches consist of sequentially connected 3×3 convolutional layers and 1×1 convolutional layers. The global branches consist of sequentially connected 1×k convolutional layers, batch normalization layers, SILU activation functions, k×1 convolutional layers, batch normalization layers, SILU activation functions, and 1×1 convolutional layers. The location guidance unit consists of sequentially connected 3×3 convolutional layers, batch normalization layers, ReLU activation functions, 1×1 convolutional layers, and sigmoid activation functions. The outputs of the local branches, global branches, and the location guidance unit all serve as inputs to the second feature fusion unit. Local branches are used to output local feature maps; The global branch is used to output the global feature map; The location guidance unit is used to generate a spatial attention weight map; The second feature fusion unit is used to output a feature enhancement map based on the local feature map, the global feature map, and the spatial attention weight map.

4. The method according to claim 1, characterized in that, The fine-grained branch consists of a 3×3 convolutional layer, used to preserve the basic texture and spatial details of the features; High-frequency edge branches are used to extract edge and gradient information from input features; The adaptive alignment unit is used to spatially align the outputs of different branches; The third feature fusion module is used to fuse the aligned features to obtain aggregated features.

5. The method according to claim 4, characterized in that, The convolutional kernels in the large kernel branch group are configured to operate in either a first mode or a second mode. When operating in the first mode, the convolutional kernels in the large kernel branch group adopt a depth-separable convolutional structure; When operating in the second mode, the convolution kernels in the large kernel branch group adopt a standard convolution structure.

6. The method according to claim 5, characterized in that, The Large Kernel Block is configured to operate in either basic or enhanced mode. When operating in basic mode, the Large Kernel Block does not enable high-frequency edge branches; When operating in enhanced mode, the Large Kernel Block enables high-frequency edge branches.

7. The method according to claim 6, characterized in that, The adaptive alignment unit employs two strategies—pruning and upsampling—to spatially align the outputs of different branches.

8. The method according to claim 7, characterized in that, The third feature fusion module performs feature fusion according to the configured fusion mode, including splicing fusion mode, attention fusion mode, weighted fusion mode, and summation fusion mode; The splicing and fusion mode specifically involves splicing the outputs of the aligned branches along the channel dimension and then performing feature fusion through 1×1 convolution dimensionality reduction. The attention fusion mode is as follows: spatial attention weights are generated by edge-guided attention units, and the outputs of each aligned branch are weighted and fused according to the spatial attention weights. The weighted fusion mode is as follows: different weights are assigned to each branch through learnable branch weight parameters, and the outputs of the aligned branches are weighted and fused according to the obtained weights. The summation and fusion mode specifically involves averaging the outputs of the aligned branches.

9. The method according to claim 8, characterized in that, The specific method for generating spatial attention weights through edge-guided attention units is as follows: Edge feature maps are extracted from the input features of the Large Kernel Block using an edge extractor; the edge feature maps are then concatenated with the aggregated features output by the third feature fusion module along the channel dimension to obtain the concatenated features; spatial attention weights are generated based on the concatenated features through 1×1 convolution and a sigmoid activation function.

Citation Information

Patent Citations

  • Small target detection method based on improved YOLOv8n

    CN116895007A

  • Automobile central control screen small target detection method based on YOLOv11 improvement

    CN121415218A