A vehicle detection method based on road semantic information guiding spatial attention

By building a GA-YOLO model, combining it with the SENet channel attention and Grad-CAM modules, and using road semantic labels to guide feature attention, the problems of false detection and missed detection of small vehicle targets in drone aerial videos are solved, achieving efficient and accurate vehicle detection.

CN117830965BActive Publication Date: 2025-10-21SOUTH CHINA UNIV OF TECH +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311707575.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-13
Publication Date
2025-10-21
Estimated Expiration
2043-12-13

AI Technical Summary

Technical Problem

The detection of small vehicle targets in drone aerial videos and images faces the problems of false detection and missed detection caused by non-road background noise, resulting in reduced detection accuracy and difficulty in balancing algorithm efficiency and accuracy.

Method used

A spatial attention vehicle detection method based on road semantic information guidance is adopted. By constructing a GA-YOLO model, combining the SENet channel attention module and the Grad-CAM module, the road semantic labels are used to guide feature attention, thereby improving detection accuracy and efficiency.

Benefits of technology

The accuracy and model interpretability of small target detection in drone aerial photography vehicles are improved, high inference efficiency is maintained, and the interpretability of the model is improved while maintaining accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117830965B_ABST
    Figure CN117830965B_ABST
Patent Text Reader

Abstract

The application discloses a vehicle detection method based on road semantic information guided spatial attention, comprising the following steps: constructing a UAV road vehicle dataset, constructing and training a GA-YOLO vehicle target detection model, including a target detection branch and a semantic information branch, obtaining the last layer channel feature weight and the attention distribution diagram of the target detection branch main network, calculating the channel attention loss and the semantic feature loss, and taking the classification loss, the confidence loss and the bounding box loss of the target detection branch as the total loss to supervise the training of the GA-YOLO vehicle target detection model, so as to realize the spatial attention of the road semantic information guided vehicle detection model; and reasoning the GA-YOLO vehicle target detection model, inputting a video frame or an image to be detected into the target detection branch, and obtaining a predicted bounding box. The application can further improve the UAV aerial image vehicle small target detection accuracy and keep a high reasoning efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer target detection, and in particular to a vehicle detection method based on guiding spatial attention based on road semantic information. Background Art

[0002] Traffic target detection is an important task in the field of computer vision. Timely detection of vehicles and other targets in traffic scenes helps prevent traffic accidents, reduce casualties and property losses, and plays an important role in urban planning, traffic management and traffic safety.

[0003] Compared to traditional fixed surveillance cameras, drone-based surveillance systems offer advantages such as low maintenance costs, ease of deployment, high maneuverability, and a wide field of view. The high mobility of drones enables flexible video data collection regardless of geographic location. When detecting vehicles on different road sections, drones can effectively avoid obstructions by adjusting their flight altitude and position without interfering with traffic. Furthermore, integrating target detection algorithms into drones allows for more accurate high-altitude detection of targets, reducing installation and maintenance costs and enhancing the intelligence of traffic regulation. Consequently, target detection and tracking have entered the era of large-scale drones, playing an increasingly important role in tasks such as smart cities, traffic monitoring, and disaster prevention.

[0004] The widespread use of drones in transportation systems has spurred the development of drone target detection methods for collecting real-time traffic information. However, due to the small size and high density of vehicle targets from an aerial perspective, vehicle detection in drone imagery faces many challenges, including the following:

[0005] (1) There is an inherent contradiction between wide field of view and small targets. In order to capture a larger range and more vehicles, the vehicle targets in UAV images are usually small, which requires a high level of small target detection capability of the algorithm.

[0006] (2) The scenes in UAV images are complex, and target missed detection and false detection caused by non-road background noise greatly affect the accuracy of target detection;

[0007] (3) It is difficult to balance the accuracy of small target detection and the efficiency of the algorithm. There is a challenge in maintaining and improving the accuracy while increasing the complexity of the algorithm as little as possible. Summary of the Invention

[0008] To overcome the shortcomings and deficiencies of existing drone-based traffic detection technologies, this paper leverages the advantages of drones to provide a vehicle detection method that guides spatial attention based on road semantic information. This method addresses the issue of small vehicle target detection models in drone aerial videos and images being affected by false and missed detections caused by non-road background noise when extracting global features, which can reduce vehicle detection accuracy. The proposed method improves the accuracy of small vehicle target detection in drone aerial videos, maintains high inference efficiency, and significantly enhances model interpretability while maintaining accuracy. This approach is crucial for understanding black-box model outputs and guiding network improvements.

[0009] In order to solve the above technical problems, the present invention adopts the following technical solutions:

[0010] A vehicle detection method based on guiding spatial attention based on road semantic information, comprising:

[0011] Construct a drone road vehicle dataset. Specifically, use a hovering drone to collect road traffic scene videos, annotate vehicle rectangular bounding boxes and road area masks, and use them to divide the dataset into training and validation sets.

[0012] Build a GA-YOLO vehicle target detection model, including:

[0013] The object detection branch is used to extract image deep features and predict object bounding boxes and categories, including the backbone network, SENet channel attention module, neck network and object detection head connected in sequence;

[0014] It is used to generate semantic labels for roads in traffic scenes and supervise the network training feature attention to focus on the semantic information branch of the road area;

[0015] Train the GA-YOLO vehicle target detection model. Specifically, the Grad-CAM module is used to obtain the channel feature weights and attention distribution map of the last layer in the target branch backbone network. The channel attention loss and semantic feature loss are calculated with the SENet channel attention module and road semantic labels, respectively. These are then combined with the classification loss, confidence loss, and bounding box loss of the target detection branch as the total loss to supervise the training of the GA-YOLO vehicle target detection model.

[0016] Infer the GA-YOLO vehicle target detection model. Input the video frame or image to be detected into the target detection branch of the trained GA-YOLO vehicle target detection model to obtain the predicted bounding box. The predicted target bounding box and its category are output to realize the detection of small vehicle targets in traffic scenes.

[0017] Furthermore, the target detection branch is based on the YOLOv5 network and includes:

[0018] Backbone network: Specifically, CSP-Darknet53. The dataset is input into the backbone network and passes through five CBS convolutional layers and four C3 modules to obtain multiple feature maps of different sizes.

[0019] The SENet channel attention module uses global average pooling to aggregate the information of each channel feature map into a scalar, and then maps the scalar into a new weight scalar through two fully connected layers. This scalar is then used to weight the feature maps of each channel to enhance the expressiveness between channels, including Squeeze and Excitation operations.

[0020] Neck network: It is composed of the spatial pyramid pooling SPPF module, FPN and PAN feature pyramid modules.

[0021] Object detection head: performs object detection on the feature map output by the neck network and outputs the predicted box and category.

[0022] Furthermore, it also includes a Grad-CAM module for obtaining the feature weights and attention distribution maps of the feature map channels in the backbone network.

[0023] Furthermore, the semantic information branch is constructed based on the PIDNet deep learning network. The original image is input into the PIDNet deep learning network to obtain the corresponding traffic scene road semantic label result, which serves as a supervisory signal to guide spatial feature attention.

[0024] Furthermore, the PIDNet deep learning network consists of three branches: the proportional branch (P branch) that parses and saves the detail information in the high-resolution feature map, the integral channel (I branch) that aggregates high-level semantic information, and the differential channel (D branch) that predicts boundary information.

[0025] Furthermore, the Grad-CAM module is used to obtain the feature weights and attention distribution maps of the feature map channels in the backbone network, specifically:

[0026] The Grad-CAM module defines the output value as the average value of the gradient of the last layer of the feature map of the target detection branch backbone network as the weight of the feature map;

[0027] The Grad-CAM module applies the ReLU activation function to the weighted feature map to eliminate signal interference irrelevant to the target category in the activation map and filter out background irrelevant to the road foreground.

[0028] The weights calculated based on the average gradient of the feature map are weighted summed up on the original feature map of the last layer of the target detection branch backbone network to generate the attention distribution map of the class activation.

[0029] Furthermore, the GA-YOLO vehicle target detection model is trained using five loss functions, specifically:

[0030] Attention loss: used for the channel attention self-supervision strategy. The attention loss is calculated by combining the 1×1×C feature map weight tensor generated by the Squeeze operation of the SENet module with the feature map weight output by the feature gradient GAP calculated by the Grad-CAM model backpropagated to the last layer of the backbone network. KL divergence is introduced as the loss function.

[0031] Semantic feature loss: This is used to guide the spatial attention of the object detection branch to focus on the road area in the scene. The semantic feature loss is calculated by combining the road semantic label map generated by the PIDNet network and the attention distribution map backpropagated to the last layer of the backbone network via the Grad-CAM module. Binary cross entropy is introduced as the semantic feature loss function.

[0032] Classification loss of the target detection branch: used to determine whether the model can accurately classify the target into the correct category;

[0033] Confidence loss of the target detection branch: used to measure the difference between the bounding box predicted by the model and the true box;

[0034] Bounding box loss for object detection branch: measures the difference between the bounding box predicted by the model and the true bounding box.

[0035] Furthermore, the target detection classification loss and confidence loss of the target detection model training are calculated based on the binary cross entropy loss function, and the bounding box loss is calculated using the CIOU loss function.

[0036] Furthermore, in the vehicle target detection stage, after using the target detection branch to obtain the predicted bounding box, confidence threshold filtering and non-large value suppression are performed, and then the target predicted bounding box and its category are output.

[0037] Furthermore, the drone is equipped with a high-definition camera and hovers over the road, with the camera perpendicular to the ground to collect traffic videos.

[0038] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0039] 1. This paper proposes a GA-YOLO model training framework, which guides the spatial information of feature maps by introducing road semantic information, establishes the model's channel and spatial attention mechanism, and focuses spatial attention on road pavement foreground information, thereby improving detection accuracy.

[0040] 2. This paper introduces the SENet channel attention module based on the relationship between feature map channels and uses Grad-CAM to realize self-supervised training of channel information.

[0041] 3. The present invention only uses the target detection branch of the GA-YOLO vehicle target detection model training framework in the inference stage of the GA-YOLO vehicle target detection model, maintaining the lightweight model and high inference efficiency.

[0042] 4. The Grad-CAM module used in the present invention can obtain the convolutional layer feature weights and attention maps, greatly improving the interpretability of the model while maintaining accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 It is a workflow diagram of the present invention;

[0044] Figure 2 This is a structural diagram of the GA-YOLO vehicle target detection model training framework proposed in this invention;

[0045] Figure 3 Schematic diagram of the SENet channel attention module of the present invention;

[0046] Figure 4 Schematic diagram of the semantic information branch PIDNet network of the present invention;

[0047] Figure 5 This invention Figure 4 Schematic diagram of the PIDNet-Bag module;

[0048] Figure 6 is a schematic diagram of the Grad-CAM module of the present invention;

[0049] Figure 7 This is a flowchart of the GA-YOLO vehicle target detection model reasoning proposed in this invention. DETAILED DESCRIPTION

[0050] The present invention will be further described in detail below with reference to the examples, but the embodiments of the present invention are not limited thereto.

[0051] This embodiment provides a method for detecting vehicles in drone aerial photography based on guiding spatial attention based on road semantic information. The overall process is as follows: Figure 1 As shown, the following steps are included:

[0052] Step 1: Use a quadrotor drone to hover 230 meters above the road. The onboard camera records and collects traffic scene video perpendicular to the ground. Then, the video is frame-processed, and the vehicle rectangular bounding boxes and road area masks are annotated according to vehicle type. The training set and validation set are divided into a ratio of 8:2.

[0053] Step 2: Propose the GA-YOLO vehicle target detection model training framework, such as Figure 2As shown in the figure, the framework is a traffic object detection model training framework that uses road semantic information to guide spatial attention. It consists of an object detection branch and a semantic information branch. The object detection branch consists of a sequential connection between the backbone network, the SENet channel attention module, the neck network, and the object detection head. The semantic information branch consists of a pre-trained PIDNet semantic segmentation network.

[0054] It should be noted that the GA-YOLO vehicle target detection model in the accompanying figure is called the GA-YOLO model.

[0055] (1) The target detection branch described in step 2 is based on the YOLOv5 network, and the SENet channel attention module is embedded between the backbone network and the neck network. That is, the structure is a sequential connection of the backbone network, the channel attention module, the neck network, and the target detection head. The backbone feature extraction network described in step 2 is CSP-Darknet53. The training dataset is input into the backbone feature extraction network, and after passing through 5 CBS convolutional layers and 4 C3 modules, multiple feature maps of different sizes are obtained.

[0056] The SENet channel attention module described in step 2 uses global average pooling to aggregate the feature map information of each channel and obtain a scalar, which reflects the global importance of the corresponding channel. Then, through two fully connected layers, the scalar is mapped to a new weight scalar, and finally the scalar is used to weight the feature map of the channel to enhance the expressive power between channels. Figure 3 As shown in Figure 2, SENet specifically includes Squeeze operation and Excitation operation.

[0057] Squeeze operation: F sq (·), use global average pooling to encode the C×H×W size feature map and obtain the feature map weight tensor z with a dimension of 1×1×C, as shown in formulas (1) and (2):

[0058]

[0059] z=[z1,z2,L,z c ] (2)

[0060] Excitation operation: F ex (·), using two layers of fully connected operations to learn the nonlinear relationship between channels, as shown in formula (3):

[0061] s=F ex (z,W)=σ(g(z,W))=σ(W2(δ(W1z))) (3)

[0062] Where W1 and W2 correspond to the weights of the two fully connected layers, δ is the ReLU activation function, and σ is the Sigmoid function. The original feature map is multiplied by the learned weight parameters to output a visual channel attention map.

[0063] The neck network described in step 2 is sequentially spliced ​​by the spatial pyramid pooling SPPF module and the FPN+PAN feature pyramid module to achieve feature fusion at different levels and the transmission of semantic and position information, thereby improving the accuracy and speed of target detection.

[0064] The object detection head module described in step 2 is responsible for object detection on feature maps of 80x80, 40x40, and 20x20 scales. The detection head outputs three feature maps, each with 3*(C+5) channels, where C is the number of categories and 5 is the horizontal coordinate, vertical coordinate, width, height, and confidence level of the predicted box center. Furthermore, the feature map is divided into grids based on its size, and the feature vector corresponding to each grid contains three anchors for object prediction and regression.

[0065] (2) The semantic information branch described in step 2 is trained with the UAV road vehicle dataset described in step 1 to obtain a PIDNet semantic segmentation network (proportional-integral-differential controller architecture) to conduct in-depth analysis and understanding of the traffic environment, generate semantic information of the road foreground of the traffic scene, and introduce road semantics to guide the spatial information of the feature map.

[0066] The PIDNet network structure described in step 2 is as follows Figure 4 As shown in the figure, it consists of a proportional branch (P branch), an integral channel (I branch), and a differential channel (D branch). The I branch is regarded as a backup of the other two branches so that it can obtain the required semantic information. Unlike the D branch that adds features, the P branch uses the Pag module to selectively learn useful semantic features from the I branch. In order to aggregate contextual information of different scales while maintaining a high inference speed, PIDNet proposes an improved pyramid pooling module PAPPM. PIDNet designs the Bag module to fuse the 3-branch information, as shown in the figure. Figure 5 As shown in the figure, it is used to balance details and context information, using boundary information D to guide the fusion of detail branch P and context branch I. Through the Bag module, the model more specifically increases the focus on detail branches in boundary areas and the context branches in the interior areas of objects, improving the model's performance in various scenarios.

[0067] The original image is input into the pre-trained PIDNet described in step 2, and the corresponding traffic scene road semantic label result is obtained through forward reasoning, which serves as a supervisory signal to guide spatial feature attention.

[0068] Step 3: Based on the Grad-CAM module, the feature map channel feature weights and attention distribution map of the last layer of the backbone network are obtained. The attention loss is calculated with the 1×1×C feature map weight tensor generated by the Squeeze operation of the SENet module. The semantic feature loss is calculated with the road semantic label map generated by PIDNet. The classification loss, confidence loss, and bounding box loss of the target detection branch are combined to jointly supervise the training of the vehicle detection model.

[0069] (1) The Grad-CAM module described in step 3 is a module that visually analyzes the output feature map of the target detection branch backbone network of the GA-YOLO framework based on the improved Class Activation Map (CAM), as shown in Figure 6 For a given convolutional neural network, CAM outputs the feature average of each feature map of the last convolution layer through global average pooling (GAP), as shown in formula (4):

[0070]

[0071] Among them, W, H represent the width and height of the feature map, f k (x, y) represents the value at position (x, y) in the feature map of the kth channel. Assume that the total number of channels in the output feature map is K. After the GAP operation, a one-dimensional vector that aggregates the global spatial information of the feature map is obtained, as shown in formula (5):

[0072] G=[g1,…,g k ,…,g K ] T (5)

[0073] The size of the feature map changes from K×H×W to K×1×1, and then passes through a fully connected layer to obtain the result output, as shown in formula (6):

[0074] O=W T G (6)

[0075] in is the weight of the fully connected layer, C is the number of categories, and the CAM for a specific category c is calculated by formula (7):

[0076]

[0077] Among them, W k,c The element in the kth row and cth column of the fully connected layer weight matrix represents the weight of the global information of the kth feature map on the model's predicted output category c. This weight is used to perform a weighted summation of the original feature maps to generate a class activation attention distribution map.

[0078] According to the characteristic that the size of the feature gradient value during the back propagation of the model can reflect the importance of the extracted features, the method of obtaining the feature map weight by CAM is improved. That is, the Grad-CAM module in step 3 defines the average value of the output value to the feature map gradient as the weight of the feature map, as shown in formula (8):

[0079]

[0080] in, It represents the gradient of the output value O with respect to the value at (x, y) in the feature map of the kth channel of the last convolutional layer. The final Grad-CAM output result is shown in formula (9):

[0081]

[0082] The Grad-CAM module in step 3 applies the ReLU activation function to the weighted feature map, eliminating signal interference from the activation map that is not related to the target class and filtering out background that is not related to the road foreground. This weight is used to perform a weighted summation of the original feature map to generate an attention distribution map of the class activation.

[0083] (2) The attention loss, semantic feature loss, object detection classification loss, confidence loss, and bounding box loss described in step 3 are calculated as follows:

[0084] The SENet channel attention module described in step 3 is used for the channel attention self-supervision strategy. The attention loss is calculated by combining the 1×1×C feature map weight tensor generated by the SENet module Squeeze operation with the feature map weight output by the feature gradient GAP calculated by backpropagating Grad-CAM to the last layer of the backbone network. The Kullback-Leibler (KL) divergence is introduced as the loss function. The KL divergence measures the similarity between the two weight distributions. The attention loss function is shown in formula (10):

[0085]

[0086] Among them, y o is the feature map weight calculated by SENet, y t is the feature map weight output by Grad-CAM.

[0087] The semantic feature loss described in step 3 is used to guide the spatial attention of the object detection branch to focus on the road area of ​​the scene. The semantic feature loss is calculated by combining the road semantic label map generated by PIDNet and the attention distribution map back-propagated to the last layer of the backbone network by Grad-CAM. Binary cross entropy (BCE) is introduced as the semantic feature loss function, as shown in formula (11):

[0088] Lsem (x,y)=-(ylog(x)+(1-y)log(1-x)) (11)

[0089] Among them, x is the probability value of the pixel in the attention map output by Grad-CAM being a road area, and y is the image semantic label output by PIDNet.

[0090] The classification loss of the target detection branch in step 3 is used to determine whether the model can accurately classify the target into the correct category; the confidence loss is used to measure the difference between the bounding box predicted by the model and the true box; the bounding box loss is used to measure the difference between the bounding box predicted by the model and the true (label) bounding box. cls and confidence loss L obj The loss is calculated based on the binary cross entropy loss function, the same as formula (11). The bounding box loss is calculated using the CIOU loss function, assuming that the coordinates of the upper left corner and lower right corner of the predicted bounding box are (x p1 ,y p1 )、(x p2 ,y p2 ), the coordinates of the upper left corner and lower right corner of the label bounding box are (x l1 ,y l1 )、(x l2 ,y l2 ), bounding box loss L box As shown in formulas (12) to (15):

[0091] L box =1-CIOU (12)

[0092]

[0093]

[0094]

[0095] Among them, ρ is the distance between the center points of the prediction box and the label box, c is the diagonal length of the minimum enclosing rectangle of the prediction box and the label box, ν is the similarity of the aspect ratio of the prediction box and the label box, and α is the influencing factor of ν.

[0096] In summary, the total loss Loss is the weighted sum of the attention loss, semantic feature loss, classification loss, confidence loss, and bounding box loss described in step 3, and is calculated as shown in formula (16):

[0097] Loss=aL att +bL sen +cL cls +dL obj +eL box (16)

[0098] Among them, a~e are the weight coefficients of the five losses, with values ​​of a=1.0, b=1.0, c=0.5, d=1.0, and e=0.05.

[0099] Step 4: Complete the GA-YOLO vehicle target detection model training based on the GA-YOLO framework described in step 2. Only the GA-YOLO target detection branch is used during vehicle target model inference to ensure a simple and efficient network. Figure 7 As shown in the figure, the video frame or image to be detected is input, and the model is inferred to the detection head to output the original predicted bounding box. The candidate predicted bounding boxes are post-processed with confidence threshold and non-maximum suppression, and the processed target bounding box and its category are output.

[0100] (1) The object detection inference model described in step 4 only uses the object detection branch of the GA-YOLO framework described in step 2, and adds post-processing operations to the original output of the detection head to finally output high-quality object bounding boxes and their categories.

[0101] (2) Post-processing operations are performed on the candidate predicted bounding boxes as described in step 4, including confidence threshold filtering and non-maximum suppression (NMS).

[0102] Confidence threshold filtering is to delete the predicted bounding boxes whose confidence is lower than the confidence threshold. The confidence threshold is set to 0.45.

[0103] Non-maximum suppression is used to eliminate redundant predictions and filter high-quality detection results. The steps are as follows: First, all candidate prediction bounding boxes are grouped by category label and sorted within each group by confidence. The highest-confidence bounding boxes are placed first in the result sequence. Second, the remaining bounding boxes are traversed and their intersection-over-union (IoU) with the current highest-confidence bounding box is calculated. If the IoU is greater than a preset IoU threshold, the bounding box is removed. This process is repeated for the remaining bounding boxes until all bounding boxes have been processed. The IoU threshold is set to 0.45.

[0104] Finally, the processed target prediction box and its category are output to realize small vehicle target detection in traffic scenes.

[0105] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be considered as equivalent replacement methods and are included in the scope of protection of the present invention.

Claims

1. A vehicle detection method based on guiding spatial attention based on road semantic information, characterized in that: include: Construct a UAV road vehicle dataset. Specifically, use a hovering drone to collect road traffic scene videos, annotate vehicle rectangular bounding boxes and road area masks, and use them to divide the dataset into training and validation sets. Build the GA-YOLO vehicle target detection model, including: The object detection branch is used to extract image deep features and predict object bounding boxes and categories, including a backbone network, a SENet channel attention module, a neck network, a Grad-CAM module, and an object detection head connected in sequence. The Grad-CAM module is used to obtain the feature weights and attention distribution maps of the feature map channels in the backbone network; It is used to generate semantic labels for roads in traffic scenes, and supervise the network training feature attention to focus on the semantic information branch of the road area; the semantic information branch is built based on the PIDNet deep learning network. The original image is input into the PIDNet deep learning network to obtain the semantic label result of the corresponding traffic scene road, which serves as a supervisory signal to guide spatial feature attention; The PIDNet deep learning network consists of three branches: the proportional branch (P branch) that parses and preserves the detail information in the high-resolution feature map, the integral channel (I branch) that aggregates high-level semantic information, and the differential channel (D branch) that predicts boundary information. Training the GA-YOLO vehicle target detection model involves obtaining the last layer of channel feature weights and attention distribution maps in the target branch backbone network, respectively calculating the channel attention loss and semantic feature loss with the SENet channel attention module and road semantic labels, and combining these with the classification loss, confidence loss, and bounding box loss of the target detection branch as the total loss to supervise the training of the GA-YOLO vehicle target detection model. The video frame or image to be detected is input into the target detection branch of the trained GA-YOLO vehicle target detection model to obtain the predicted bounding box, and the target predicted bounding box and its category are output to realize the detection of small vehicle targets in traffic scenes.

2. The vehicle detection method according to claim 1, characterized in that: The target detection branch is based on the YOLOv5 network and includes: Backbone network: Specifically, CSP-Darknet53. The dataset is input into the backbone network and passes through five CBS convolutional layers and four C3 modules to obtain multiple feature maps of different sizes. SENet channel attention module: uses global average pooling to aggregate the information of each channel feature map into a scalar, and then maps the scalar into a new weight scalar through two fully connected layers. This scalar is then used to weight the feature maps of each channel to enhance the expressiveness between channels, including Squeeze and Excitation operations; Neck network: It is composed of the spatial pyramid pooling SPPF module, FPN and PAN feature pyramid modules. Object detection head: performs object detection on the feature map output by the neck network and outputs the predicted box and category.

3. The vehicle detection method according to claim 1, characterized in that: The Grad-CAM module is used to obtain the feature weights and attention distribution maps of the feature map channels in the backbone network, specifically: The Grad-CAM module defines the output value as the average value of the gradient of the last layer of the feature map of the target detection branch backbone network as the weight of the feature map; The Grad-CAM module applies the ReLU activation function to the weighted feature map to eliminate signal interference irrelevant to the target category in the activation map and filter out background irrelevant to the road foreground. The weights calculated based on the average gradient of the feature map are weighted summed up on the original feature map of the last layer of the target detection branch backbone network to generate the attention distribution map of the class activation.

4. The vehicle detection method according to claim 1, characterized in that: The GA-YOLO vehicle target detection model is trained using five loss functions, specifically: Attention loss: used for the channel attention self-supervision strategy. The attention loss is calculated by combining the 1×1×C feature map weight tensor generated by the Squeeze operation of the SENet module with the feature map weight output by the feature gradient GAP calculated by the Grad-CAM model backpropagated to the last layer of the backbone network. KL divergence is introduced as the loss function. Semantic feature loss: This is used to guide the spatial attention of the object detection branch to focus on the road area in the scene. The semantic feature loss is calculated by combining the road semantic label map generated by the PIDNet network and the attention distribution map backpropagated to the last layer of the backbone network via the Grad-CAM module. Binary cross entropy is introduced as the semantic feature loss function. Target detection classification loss: used to determine whether the model can accurately classify the target into the correct category; Object detection confidence loss: used to measure the difference between the bounding box predicted by the model and the true box; Object detection bounding box loss: used to measure the difference between the bounding box predicted by the model and the true bounding box.

5. The vehicle detection method according to claim 4, characterized in that: The target detection model training target detection classification loss and confidence loss are both calculated based on the binary cross entropy loss function, and the bounding box loss is calculated based on the CIOU loss function. The vehicle detection method according to claim 1 , wherein: In the vehicle target detection stage, after using the target detection branch to obtain the predicted bounding box, confidence threshold filtering and non-large value suppression are performed, and the target predicted bounding box and its category are output.

7. The vehicle detection method according to any one of claims 1 to 6, characterized in that: The drone is equipped with a high-definition camera and hovers over the road, with the camera perpendicular to the ground to collect traffic videos.

Citation Information

Patent Citations

  • Unmanned aerial vehicle image traffic target detection method based on attention mechanism and re-parameterization

    CN116363532A

  • Weakly Supervised Image Segmentation Via Curriculum Learning

    US20210027098A1