Adaptive attention fused vehicle detection method in congestion scene
By introducing an adaptive attention module and a dynamic weighted loss function into the YOLOv5 network, combined with the ConvMixer hybrid convolution module, the problems of low accuracy and high false negative rate in vehicle detection in traffic congestion scenarios are solved, achieving higher detection accuracy and robustness.
Patent Information
- Application Number
- CN202510937163.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-08
- Publication Date
- 2025-10-28
AI Technical Summary
Existing vehicle detection technologies suffer from missed detections and false detections in complex, obscured, and densely packed small-target scenarios, especially in traffic congestion where detection accuracy is low and the missed detection rate is high.
We employ a fusion adaptive attention approach, introducing CBAM and ECA attention modules into the YOLOv5 network, combining the dynamic weighting mechanism of Wise-IoUv3 and Focal loss functions to construct a joint loss function, and embedding the ConvMixer hybrid convolution module in the head network to enhance the accuracy of feature extraction and bounding box localization.
It improves the accuracy and robustness of vehicle detection, reduces detection errors caused by occlusion and size differences, and enhances the model's detection performance in complex traffic scenarios.
Smart Images

Figure CN120853136A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of vehicle detection technology, and in particular to a vehicle detection method in congested scenarios that incorporates adaptive attention. Background Technology
[0002] In traffic congestion, the varying distances and angles at which vehicles enter the video feed can lead to significant differences in vehicle size and shape. Furthermore, traffic congestion can cause vehicles to obstruct each other, resulting in lower detection accuracy and higher false negative rates. These factors pose significant challenges to urban vehicle detection, making the improvement of accuracy and recall in urban vehicle target detection a challenging task.
[0003] With the development of intelligent transportation systems, deep learning-based vehicle detection algorithms have become a key technology. Song et al. proposed the MEB-YOLO network, utilizing Mosaic and MixUp methods for data augmentation, introducing an ECA attention mechanism to reduce the influence of irrelevant features in the image, and constructing a neck network using a bidirectional feature pyramid network structure, enabling the model to correctly locate relatively small vehicles in complex environments. Wang et al. proposed a lossless cross-scale composite dilated residual network with fused attention, improving the feature extraction and representation capabilities for dense, partially occluded targets in complex road environments by modifying the SSD basic backbone network and dilated residual structure. Through the synergistic effect of novel multi-view aggregated dilated residual units, lossless cross-scale fusion modules, and coordinate attention mechanisms, the accuracy and robustness of traffic target detection were significantly improved. Lin et al. combined the YOLO algorithm with a convolutional fuzzy neural network (CFNN) to solve the problem of effectively detecting and predicting potential traffic risks in real-time traffic monitoring, providing a real-time detection and prediction system based on video images.
[0004] However, current vehicle detection technologies suffer from missed detections and false detections when dealing with complex occlusion and densely packed small targets, especially when there are many objects similar to the target in the background, resulting in unsatisfactory detection performance. Summary of the Invention
[0005] The technical problem this invention aims to solve is to address the shortcomings of the existing technology by providing a vehicle detection method in congested scenarios that integrates adaptive attention, thereby resolving the issues of low vehicle detection accuracy and high false negative rate in traffic congestion scenarios. The method includes the following steps:
[0006] Step 1: Obtain the vehicle category dataset and divide it into training, validation, and test sets according to the proportions.
[0007] Step 1.1: Obtain the vehicle category dataset, including vehicle images of various categories and the corresponding label for each vehicle image;
[0008] Step 1.2: Divide the vehicle category dataset into training, testing, and validation sets according to the proportions;
[0009] Step 2: Construct the YOLOv5 network model, which includes a backbone network, a neck network, and a head network. The backbone network includes multiple CSP modules, the neck network adopts the PANet architecture, and the head network includes three prediction branches.
[0010] Step 3: Construct an attention module based on the CBAM and ECA attention modules, and introduce the attention module into the backbone network of the YOLOv5 network model;
[0011] Step 3.1: Construct the CBAM attention module, which includes a channel attention submodule and a spatial attention submodule. Replace the channel attention submodule of the CBAM attention module with the ECA channel attention module to obtain the attention module. The ECA channel attention module includes a global average pooling layer, a one-dimensional local convolutional layer, and a Sigmoid activation function layer.
[0012] For the feature map F∈R of the input attention module C×H×W The global average feature value z of the feature map F is extracted using the global average pooling layer of the ECA channel attention module. c ∈R C ;
[0013] By modeling channel correlation through a one-dimensional local convolutional layer, the channel correlation vector a∈R of the c-th channel after one-dimensional local convolution is obtained. C The channel correlation vector a is mapped to channel weights M using a Sigmoid activation function layer. c Based on channel weight M c Channel weighting is applied to feature map F to obtain channel-weighted feature map F′;
[0014] Perform max pooling and average pooling on the channel-weighted feature map F′ to obtain the max-pooled feature map F′. max and the feature map F′ after average pooling avg The feature map F′ after max pooling max and the feature map F′ after average pooling avg The concatenation process involves using convolution and the sigmoid activation function to concatenate the feature maps [F′]. avg ;F′ max Mapped to a spatial weighted graph M s The spatial weighted graph M will be applied. s The feature map F′ after channel weighting is weighted and fused to obtain the feature map F″ output by the attention module;
[0015] Step 3.2: Introduce the attention module into the backbone network of the YOLOv5 network model, and add the attention module after each CSP module in the backbone network;
[0016] Step 4: Based on the Wise-IoUv3 loss function and the Focal loss function, and combined with the dynamic weighting mechanism, construct a joint loss function, and use the joint loss function to replace the loss function of the YOLOv5 network model;
[0017] Based on the Wise-IoUv3 loss function L WIoUv3 and Focal loss function L Focal And a joint loss function L is constructed by combining a dynamic weighting mechanism. Focal-WIoUv3 As shown in the formula below:
[0018]
[0019] Among them, w1, w2, w3, and w4 are all dynamically adjusted weights, and L WIoUv3 Let L be the Wise-IoUv3 loss function. Focal Focal loss function;
[0020] Step 5: Embed ConvMixer hybrid convolutional modules into the three prediction branches of the YOLOv5 network head network to perform fine fusion and recombination of multi-scale features; the ConvMixer hybrid convolutional module includes a PatchEmbedding layer and multiple ConvMixer Layer sub-modules.
[0021] The Patch Embedding layer processes the input feature map X of the ConvMixer hybrid convolution module sequentially using convolution, activation functions, and batch normalization to obtain the output feature map z0 of the Patch Embedding layer.
[0022] The ConvMixer Layer submodule comprises depthwise convolutional layers and pointwise convolutional layers. The depthwise convolutional layers include depthwise convolution operations (with the number of groups equal to the number of channels h), activation functions, and batch normalization. The pointwise convolutional layers include pointwise convolution operations, activation functions, and batch normalization. The ConvMixer Layer submodule employs a hybrid approach separating spatial and channel dimensions, passing the data sequentially through the depthwise and pointwise convolutional layers to obtain the output feature map z of the ConvMixer Layer submodule. l+1 ;
[0023] The ConvMixer hybrid convolution module is embedded into the back end of the Conv convolutional layer of the three prediction branches of the YOLOv5 network head network respectively.
[0024] Step 6: By introducing an attention module, a ConvMixer hybrid convolution module, and a joint loss function into the YOLOv5 network model, a YOLOv5 network model with adaptive attention is obtained. The YOLOv5 network model with adaptive attention is trained using the training set and validated using the validation set to obtain the trained model weights. The trained model weights are then used to detect congested vehicles from a monitoring perspective to obtain vehicle category information.
[0025] The beneficial effects of adopting the above technical solution are as follows: The vehicle detection method in congested scenarios provided by the present invention integrates adaptive attention, improves the YOLOv5 network model by introducing an attention module, a ConvMixer hybrid convolution module and a joint loss function, enhances the ability to extract key vehicle features and express multi-scale features, and optimizes the bounding box localization accuracy through a dynamic weighting mechanism, improves attention to difficult-to-detect targets, and improves the detection accuracy of the model, thus solving the problem of low detection accuracy and high false negative rate caused by mutual occlusion of vehicles in traffic congestion scenarios. Attached Figure Description
[0026] Figure 1 This is a flowchart of a vehicle detection method for congestion scenarios with fused adaptive attention, provided in an embodiment of the present invention.
[0027] Figure 2 This is a structural diagram of the attention module provided in an embodiment of the present invention;
[0028] Figure 3 This is a diagram of the backbone network structure of a YOLOv5 network model with an attention module provided in an embodiment of the present invention.
[0029] Figure 4 The diagram shows the head network structure of the YOLOv5 network model with the ConvMixer module introduced in this embodiment of the invention. Detailed Implementation
[0030] The specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples. The following examples are for illustrative purposes only and are not intended to limit the scope of the invention.
[0031] This embodiment presents a vehicle detection method in a congested scenario that incorporates adaptive attention, such as... Figure 1 As shown, it includes the following steps:
[0032] Step 1: Obtain the vehicle category dataset and divide it into training, validation, and test sets according to the proportions.
[0033] Step 1.1: Obtain the vehicle category dataset, including vehicle images of various categories and the corresponding label for each vehicle image;
[0034] In this embodiment, the vehicle categories include cars, buses, vans, and others;
[0035] Step 1.2: Divide the vehicle category dataset into training, testing, and validation sets according to the proportions;
[0036] In this embodiment, the vehicle category dataset is divided into a training set, a test set, and a validation set in a ratio of 8:1:1.
[0037] Step 2: Construct the YOLOv5 network model, which includes a backbone network, a neck network, and a head network. The backbone network includes multiple CSP modules, the neck network adopts the PANet architecture, and the head network includes three prediction branches.
[0038] A YOLOv5 network model is constructed, including a backbone network, a neck network, and a head network. The backbone network is used to acquire the input image, extract features from the input image, extract the feature map of the input image, and transmit it to the neck network. The neck network is used to perform multi-scale feature fusion on the feature map of the input image to obtain the fused feature map, which is then transmitted to the head network. The head network is used for regression prediction on the fused feature map and to detect the location and category of the target based on the feature map of the backbone network.
[0039] Step 3: Construct an attention module based on the CBAM and ECA attention modules, and introduce the attention module into the backbone network of the YOLOv5 network model;
[0040] Step 3.1: Construct the CBAM attention module, which includes a channel attention submodule and a spatial attention submodule. Replace the channel attention submodule of the CBAM attention module with the ECA channel attention module to obtain the attention module. The ECA channel attention module includes a global average pooling layer, a one-dimensional local convolutional layer, and a Sigmoid activation function layer.
[0041] Attention module such as Figure 2 As shown, for the feature map F∈R of the input attention module C×H×W Using the global average pooling layer of the ECA channel attention module, the global average feature value z∈R of the feature map F is extracted. C As shown in the formula below:
[0042]
[0043] Where C is the number of feature map channels, H is the feature map height, W is the feature map width, and z cF is the global average eigenvalue of the c-th channel. c,h,w Let f be the pixel value of the c-th channel, h-th row, and w-th column of feature map F;
[0044] Channel correlation is modeled using a one-dimensional local convolutional layer of the ECA channel attention module. After one-dimensional local convolution, the channel correlation vector a∈R of the c-th channel is obtained. C As shown in the formula below:
[0045] a = Conv1D(z) c ;k)
[0046] Where k is the size of the one-dimensional local convolution kernel, and Conv1D(·) is the one-dimensional local convolution;
[0047] The channel correlation vector a is mapped to channel weights M using a Sigmoid activation function layer of the ECA channel attention module. c As shown in the formula below:
[0048] M c =σ(a)
[0049] Where σ is the Sigmoid function;
[0050] Based on channel weight M c Channel weighting is applied to feature map F, as shown in the following formula:
[0051] F′=M c ⊙F
[0052] Where ⊙ represents the channel-wise dot product operation, F′∈R C×H×W This is the feature map after channel weighting;
[0053] In the spatial dimension, the attention module performs max pooling and average pooling on the channel-weighted feature map F′, respectively, to obtain the max-pooled feature map F′. max and the feature map F′ after average pooling avg The feature map F′ after max pooling max and the feature map F′ after average pooling avg The concatenation process involves using convolution and the sigmoid activation function to concatenate the feature maps [F′]. avg ;F′ max Mapped to a spatial weighted graph M s The spatial weighted graph M will be applied. s The feature map F′ after channel weighting is then weighted and fused to obtain the feature map F″ output by the attention module, as shown in the following formula:
[0054] F″=M s ⊙F′
[0055] Step 3.2: Introduce the attention module into the backbone network of the YOLOv5 network model, and add the attention module after each CSP module in the backbone network;
[0056] After introducing the attention module into the convolutional layers CSP1-1, CSP2-3, and CSP3-3 of the YOLOv5 backbone network, as follows: Figure 3 As shown, the feature extraction capability is enhanced through ECA channel attention and spatial attention. The attention module after the shallow convolutional layer CSP1-1 enhances the ability to capture vehicle details by highlighting details and edge information, while suppressing the interference of background noise; the attention module after the middle convolutional layer CSP2-3 focuses on the expression of contextual features, enhancing the network's ability to perceive vehicle features in occluded areas; the attention module after the deep convolutional layer CSP3-3 enhances the expression of global semantic features, thereby improving the network's ability to perceive occluded targets and complex backgrounds.
[0057] Step 4: Based on the Wise-IoUv3 loss function and the Focal loss function, and combined with the dynamic weighting mechanism, construct a joint loss function, and use the joint loss function to replace the loss function of the YOLOv5 network model;
[0058] The Wise-IoU v3 loss function introduces the concept of minimum closed box size and incorporates a quality score for the target based on traditional IoU to optimize the matching quality between the predicted box and the ground truth box. The Wise-IoU v3 loss function formula is as follows:
[0059]
[0060] L WIoUv3 =rL WIoUv1 ,
[0061] Where, x gt y gt Let x and y be the x and y coordinates of the points in the true bounding box, respectively, and let x and y be the x and y coordinates of the points in the predicted bounding box, respectively. g H g Let L be the width and height of the smallest closed bounding boxes of the ground truth box and the predicted box, respectively, and β be the IoU loss ratio used to represent the quality of the predicted box. * IoU L is the IoU loss value used to measure the quality of the match between the predicted bounding box and the ground truth bounding box. IoU The loss value is the original IoU, and r, δ, and α are hyperparameters used to control the gradient scaling magnitude;
[0062] The Focal loss function allocates more computational resources to the vehicle target rather than the background region by adjusting the weight of each sample. The Focal loss function is shown in the following formula:
[0063] L Focal = -α(1-p) γ vlog(p)-(1-α)p γ ×(1-v)log(1-p)
[0064] Where v is the label value of the sample, p is the positive sample confidence of the input sample, and α and γ are both hyperparameters;
[0065] In this embodiment, the hyperparameters α = 0.25 and γ = 2 are set;
[0066] Based on the Wise-IoUv3 loss function L WIoUv3 and Focal loss function L Focal And a joint loss function L is constructed by combining a dynamic weighting mechanism. Focal-WIoUv3 As shown in the formula below:
[0067]
[0068] Among them, w1, w2, w3, and w4 are all dynamically adjusted weights, and L WIoUv3 Let L be the Wise-IoUv3 loss function. Focal Focal loss function;
[0069] In the joint loss function L Focal-WIoUv3 In the middle, through and The dynamic weighting mechanism of the Sigmoid function dynamically adjusts weights w1 and w3 by comparing the difference between the CIoU loss and the Focal loss of YOLOv5. On one hand, when the difference between the CIoU loss and the Focal loss of YOLOv5 is large, the Sigmoid function automatically reduces the weight of the loss term with the larger difference, thus reducing its contribution to the total loss. This dynamic adjustment mechanism allows the network to adaptively focus on the more important loss components according to the current training scenario. In severely occluded scenarios, the features of occluded targets are often difficult to extract accurately, leading to classification difficulties. In this case, the value of the Focal loss function is usually large, while the value of the CIoU loss function of YOLOv5 is relatively small. Through the dynamic weighting mechanism, the weight of the Focal loss function is preferentially increased, making the network more inclined to focus on the classification of difficult samples, thereby enhancing the perception ability of occluded targets. On the other hand, when the matching quality of the target box is poor (such as the target box being significantly offset from the actual target), the value of the CIoU loss function of YOLOv5 is large. In this case, the joint loss function will preferentially optimize the bounding box regression, further improving the localization accuracy of the target box. Through this adaptive dynamic adjustment mechanism, the joint loss function achieves a balance between classification loss and regression loss, and can flexibly adjust the optimization focus in the case of occluded targets, targets with large size differences, and complex backgrounds.
[0070] Step 5: Embed ConvMixer hybrid convolutional modules into the three prediction branches of the YOLOv5 network head network to perform fine fusion and recombination of multi-scale features; the ConvMixer hybrid convolutional module includes a PatchEmbedding layer and multiple ConvMixer Layer sub-modules.
[0071] The Patch Embedding layer processes the input feature map X of the ConvMixer hybrid convolution module sequentially using convolution, activation functions, and batch normalization to obtain the output feature map z0 of the Patch Embedding layer, as shown in the following formula:
[0072] z0=BN(σ{Conv Cin→h (X, stride=p, kernel_size=p)})
[0073] Among them, C in The number of channels of the input feature map X for the ConvMixer hybrid convolutional module, Conv Cin→h To increase the number of channels from C in Transform to a convolutional layer of type h, where p is the batch size, and set Conv. Cin→h The stride and kernel size of the convolutional layer are both p, σ(·) is the activation function, and BN(·) is the batch normalization operation;
[0074] The ConvMixer Layer submodule includes a depthwise convolutional layer and a pointwise convolutional layer. The depthwise convolutional layer includes grouped convolution with the number of groups equal to the number of channels h, an activation function, and a batch normalization operation. The pointwise convolutional layer includes a 1×1 convolution, an activation function, and a batch normalization operation.
[0075] The ConvMixer Layer submodule employs a hybrid approach that separates spatial and channel dimensions, sequentially passing the data through depthwise convolutional layers and pointwise convolutional layers to obtain the feature map z output by the ConvMixer Layer submodule. l+1 As shown in the formula below:
[0076] z l =BN(σ{ConvDepthwise(z)) l-1 )})+z l-1
[0077] z l+1 =BN(σ{ConvPointwise(z l ′)})
[0078] Where ConvDepthwise(·) is the depthwise convolution operation, ConvPointwise is the pointwise convolution operation, and z l-1 z is the input feature map of the ConvMixer Layer submodule. l ′ represents the intermediate feature map output by the deep convolutional layer;
[0079] The ConvMixer hybrid convolution module is embedded into the back end of the Conv convolutional layer of the three prediction branches of the YOLOv5 network head network respectively.
[0080] In this embodiment, to further optimize the fusion and representation of multi-scale features, after patch embedding and multiple ConvMixer layers in the ConvMixer module, global pooling and flattening operations are performed, and then a fully connected layer is used to generate the classification output. The ConvMixer module is embedded into the back end of the Conv convolutional layers of the three prediction branches of CSP6 (80×80), CSP7 (40×40), and CSP8 (20×20), respectively, as follows: Figure 4As shown, the ConvMixer module utilizes deep convolution to enhance local feature extraction capabilities, while integrating global information through feature fusion operations, thereby improving the network's detection performance on targets at different scales. For the small target prediction branch with a scale of 80×80, the ConvMixer module significantly improves the ability to capture target details through fine-grained feature extraction; for the medium target prediction branches with scales of 40×40 and 20×20, and the large target prediction branch, respectively, ConvMixer enhances the overall consistency and boundary representation ability of the targets through global feature optimization.
[0081] Step 6: By introducing an attention module, a ConvMixer hybrid convolution module, and a joint loss function into the YOLOv5 network model, a YOLOv5 network model with adaptive attention is obtained. The YOLOv5 network model with adaptive attention is trained using the training set and validated using the validation set to obtain the trained model weights. The trained model weights are then used to detect congested vehicles from a monitoring perspective to obtain vehicle category information.
[0082] The vehicle detection method in congested scenarios with fusion adaptive attention provided in this embodiment is an improvement on the YOLO algorithm. It constructs an attention module by introducing an ECA channel attention module on top of the original CBAM attention module, and then incorporates this attention module into the convolutional layers of the YOLOv5 backbone network to enhance contextual information. This highlights key feature channels and spatial regions of vehicles under congested and occluded conditions, enhancing feature representation capabilities and reducing recognition difficulties caused by mutual occlusion between vehicles. Based on the Wise-IoUv3 loss function and the Focal loss function, and combined with a dynamic weighting mechanism, a joint... The loss function, combined with the feature enhancement effect of the attention module, improves the accuracy and matching quality of the target bounding box by assigning higher weights to occluded vehicles and introducing a dynamic weighting mechanism. This effectively reduces the localization deviation caused by occlusion and size differences in complex scenes, further enhancing the robustness and stability of the model. Three ConvMixer modules are introduced in the detection head to further refine the fusion and recombination of multi-scale features. By combining local feature extraction and global feature mixing, the model can extract effective features more fully when faced with partial occlusion and incomplete vehicle outlines, thereby improving the model's detection performance for multi-scale vehicles.
[0083] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope defined by the present invention.
Claims
1. A vehicle detection method in congested scenarios incorporating adaptive attention, characterized in that: Includes the following steps: Step 1: Obtain the vehicle category dataset and divide it into training, validation, and test sets according to the proportions. Step 2: Construct the YOLOv5 network model, which includes a backbone network, a neck network, and a head network. The backbone network includes multiple CSP modules, the neck network adopts the PANet architecture, and the head network includes three prediction branches. Step 3: Construct an attention module based on the CBAM and ECA attention modules, and introduce the attention module into the backbone network of the YOLOv5 network model; Step 4: Based on the Wise-IoUv3 loss function and the Focal loss function, and combined with the dynamic weighting mechanism, construct a joint loss function, and use the joint loss function to replace the loss function of the YOLOv5 network model; Step 5: Embed ConvMixer hybrid convolutional modules into the three prediction branches of the YOLOv5 network head network to perform fine fusion and recombination of multi-scale features; the ConvMixer hybrid convolutional module includes a PatchEmbedding layer and multiple ConvMixer Layer sub-modules. Step 6: By introducing an attention module, a ConvMixer hybrid convolution module, and a joint loss function into the YOLOv5 network model, a YOLOv5 network model with adaptive attention is obtained. The YOLOv5 network model with adaptive attention is trained using the training set and validated using the validation set to obtain the trained model weights. The trained model weights are then used to detect congested vehicles from a monitoring perspective to obtain vehicle category information.
2. The vehicle detection method in a congested scenario fused with adaptive attention as described in claim 1, characterized in that: Step 1 includes: Step 1.1: Obtain the vehicle category dataset, including vehicle images of various categories and the corresponding label for each vehicle image; Step 1.2: Divide the vehicle category dataset into training, testing, and validation sets according to the proportions.
3. The vehicle detection method in a congested scenario fused with adaptive attention as described in claim 2, characterized in that: Step 3 includes: Step 3.1: Construct the CBAM attention module, which includes a channel attention submodule and a spatial attention submodule. Replace the channel attention submodule of the CBAM attention module with the ECA channel attention module to obtain the attention module. The ECA channel attention module includes a global average pooling layer, a one-dimensional local convolutional layer, and a Sigmoid activation function layer. Step 3.2: Introduce the attention module into the backbone network of the YOLOv5 network model. Add the attention module after each CSP module in the backbone network.
4. The vehicle detection method in a congested scenario fused with adaptive attention as described in claim 3, characterized in that: The specific method for step 3.1 is as follows: For the feature map F∈R of the input attention module C×H×W The global average feature value z of the feature map F is extracted using the global average pooling layer of the ECA channel attention module. c ; By modeling channel correlation through a one-dimensional local convolutional layer, the channel correlation vector a∈R of the c-th channel after one-dimensional local convolution is obtained. C The channel correlation vector a is mapped to channel weights M using a Sigmoid activation function layer. c Based on channel weight M c Channel weighting is applied to feature map F to obtain channel-weighted feature map F′; Perform max pooling and average pooling on the channel-weighted feature map F′ to obtain the max-pooled feature map F′. max and the feature map F′ after average pooling avg The feature map F′ after max pooling max and the feature map F′ after average pooling avg The concatenation process involves using convolution and the sigmoid activation function to concatenate the feature maps [F′]. avg ;F′ max Mapped to a spatial weighted graph M s The spatial weighted graph M will be applied. s The feature map F′ after channel weighting is weighted and fused to obtain the feature map F″ output by the attention module.
5. The vehicle detection method in a congested scenario fused with adaptive attention as described in claim 4, characterized in that: The specific method for step 4 is as follows: Based on the Wise-IoUv3 loss function L WIoUv3 and Focal loss function L Focal And a joint loss function L is constructed by combining a dynamic weighting mechanism. Focal-WIoUv3 As shown in the formula below: Among them, w1, w2, w3, and w4 are all dynamically adjusted weights, and L WIoUv3 Let L be the Wise-IoUv3 loss function. Focal This is the Focal loss function.
6. The vehicle detection method in a congested scenario fused with adaptive attention as described in claim 5, characterized in that: The specific method for step 5 is as follows: The Patch Embedding layer processes the input feature map X of the ConvMixer hybrid convolution module sequentially using convolution, activation functions, and batch normalization to obtain the output feature map z0 of the Patch Embedding layer. The ConvMixer Layer submodule comprises depthwise convolutional layers and pointwise convolutional layers. The depthwise convolutional layers include depthwise convolution operations (with the number of groups equal to the number of channels h), activation functions, and batch normalization. The pointwise convolutional layers include pointwise convolution operations, activation functions, and batch normalization. The ConvMixer Layer submodule employs a hybrid approach separating spatial and channel dimensions, passing the data sequentially through the depthwise and pointwise convolutional layers to obtain the output feature map z of the ConvMixer Layer submodule. l+1 ; The ConvMixer hybrid convolution module is embedded into the back end of the Conv convolutional layer of the three prediction branches of the YOLOv5 network head network.
Citation Information
Cited By
Vehicle and pedestrian detection method based on lightweight dynamic convolution
CN121170724A
Unmanned aerial vehicle aerial photography low-visibility sea area target detection method, system and equipment
CN121544875A
Vehicle target detection method and system based on improved YOLOV12N
CN122473438A