Night vehicle detection method and system based on improved YOLOv5 convolutional neural network
By improving the ASPP structure and attention mechanism of the YOLOv5 convolutional neural network, the problems of small target detection and light interference in nighttime vehicle detection are solved, thereby improving detection accuracy and precision.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SOUTH CHINA UNIV OF TECH
- Filing Date
- 2023-03-16
- Publication Date
- 2026-05-01
AI Technical Summary
The existing YOLOv5 convolutional neural network has difficulties in detecting small targets and is subject to interference from complex background lighting in nighttime vehicle detection. It is also unable to effectively extract multi-scale information and perform spatial information weighting.
An improved ASPP structure is adopted to replace the SPP structure. Combined with SE and CA attention mechanisms, multi-scale information is extracted and important features are weighted to eliminate light interference.
It improved the accuracy of nighttime vehicle detection, especially the detection accuracy of small targets, and effectively reduced the false detection rate.
Smart Images

Figure CN116524319B_ABST
Abstract
Description
A Nighttime Vehicle Detection Method and System Based on an Improved YOLOv5 Convolutional Neural Network Technical Field
[0001] This invention relates to the field of vehicle-to-everything (V2X) target detection, specifically to a nighttime vehicle detection method and system based on an improved YOLOv5 convolutional neural network. Background Technology
[0002] Intelligent Transportation Systems (ITS) are modern intelligent solutions for traffic management, and vehicle detection plays a crucial role in improving the overall level of urban traffic management. Currently, research on vehicle detection systems in daytime scenarios is abundant and yields significant results. However, in nighttime scenarios, the background for target detection differs considerably from that during the day, and vehicle characteristics change significantly. Therefore, networks that perform well in vehicle recognition during the day are not suitable for nighttime scenarios.
[0003] Currently, common methods for nighttime vehicle target detection are divided into traditional vehicle target detection and deep learning-based vehicle target detection. Traditional vehicle target detection mainly involves manually extracting features and then using a classifier to distinguish whether the area belongs to a vehicle. Deep learning-based target detection is further divided into two-stage detection and one-stage detection. Two-stage detection algorithms, such as Faster-RCNN and the SDD series, first extract candidate boxes and then perform classification regression. One-stage detection algorithms are based on regression and obtain the final detection result through one forward propagation. One-stage detection algorithms, such as the YOLO series, are faster. However, using the YOLOv5 convolutional neural network for nighttime vehicle detection has several problems: First, due to insufficient light in nighttime environments, the overall features of vehicles are not obvious, and vehicle details and edge features are lost. When using distinctive headlights for vehicle recognition, the small area of the headlights makes it difficult to detect "small targets." The original YOLOv5 convolutional neural network uses the SPP structure to extract information from different receptive domains, but this module cannot fully integrate local and global information, easily leading to the loss of "small targets." Second, the complex lighting conditions at night, including different light sources such as advertising lights and streetlights, can interfere with vehicle detection. The original YOLOv5 convolutional neural network cannot weight spatial information to eliminate interference from complex lighting. Summary of the Invention
[0004] To overcome the shortcomings and deficiencies of existing technologies, this invention provides a nighttime vehicle detection method and system based on an improved YOLOv5 convolutional neural network. This invention uses an improved ASPP structure instead of the SPP structure. The improved ASPP structure obtains different receptive fields by setting different expansion rates for the convolutional layers, extracting multi-scale information. The invention also incorporates SE (Squeeze and Excitation) attention mechanism and CA (Coordinate Attention) attention mechanism into the head detection head of the YOLOv5 convolutional neural network to eliminate the interference of complex background lighting on nighttime vehicle detection and improve the accuracy of nighttime vehicle detection.
[0005] To achieve the above objectives, the present invention adopts the following technical solution:
[0006] This invention provides a nighttime vehicle detection method based on an improved YOLOv5 convolutional neural network, comprising the following steps:
[0007] Obtain the nighttime vehicle dataset, perform data augmentation preprocessing on the nighttime vehicle dataset, and divide the nighttime vehicle dataset into training and test datasets;
[0008] An improved YOLOv5 convolutional neural network was constructed, which includes an improved Backbone network, a Neck network, and an improved Head detection head.
[0009] The improved Backbone network includes a Focus submodule, a CBL submodule, a CSP submodule, and an improved ASPP submodule. The Focus submodule performs slicing operations on the input feature map, the CBL submodule performs convolution operations on the new image, the CSP submodule splits the input feature map into two branches for convolution operations, and the improved ASPP submodule uses convolutional layers and pooling layers with different dilation rates to obtain different receptive fields and extract multi-scale feature information.
[0010] The Neck network adopts an FPN+PAN structure;
[0011] The improved Head structure includes a CA attention submodule, a first Conv submodule, an SE attention submodule, and a second Conv submodule. The CA attention submodule performs global average pooling and feature map concatenation on the input feature map. The first Conv submodule performs convolutional dimensionality reduction on the concatenated feature map output by the CA attention submodule. The SE attention submodule performs compression operation on each channel of the input feature map. The second Conv submodule performs channel multiplication on the compressed vector output by the SE attention submodule through a fully connected layer and an activation function.
[0012] The improved YOLOv5 convolutional neural network was trained using the training dataset, and the trained weight file was saved.
[0013] The saved weight file is used to detect vehicles on the test dataset, and the nighttime vehicle detection results are output.
[0014] As a preferred technical solution, the data augmentation preprocessing of the nighttime vehicle dataset specifically includes:
[0015] A nighttime vehicle dataset was constructed by selecting nighttime images from the UA-DETRAC dataset, and all data labels were normalized to vehicle labels.
[0016] Mosaic data augmentation was used for data augmentation preprocessing. Nighttime vehicle images were randomly selected, randomly scaled, and then randomly distributed and stitched together.
[0017] As a preferred technical solution, the Focus submodule slices the width and height information of the input feature map.
[0018] As a preferred technical solution, the CBL submodule consists of a conv convolutional layer, a BN layer, and a LeakyRelu activation function.
[0019] As a preferred technical solution, the CSP submodule splits the input feature map into two branches for convolution operations. One branch is convolved and then passed through multiple residual structures for another convolution operation, while the other branch is directly convolved. Finally, the outputs of the two branches are concatted.
[0020] As a preferred technical solution, the improved ASPP submodule uses convolutional layers and pooling layers with different dilation rates to obtain different receptive fields and extract multi-scale feature information, specifically including:
[0021] The input feature map of the improved ASPP structure is passed through a Con1×1 convolutional layer with a first dilation rate, a Con3×3 convolutional layer with a second dilation rate, a Con3×3 convolutional layer with a third dilation rate, a Con3×3 convolutional layer with a fourth dilation rate, a Pool1×1 pooling layer, and concatenated together, then connected to a Con1×1 convolutional layer to extract multi-scale feature information.
[0022] As a preferred technical solution, the CA attention submodule performs global average pooling and feature map concatenation on the input feature map, specifically including:
[0023] The CA attention submodule first performs global average pooling on the input feature map X in both the width and height directions, generating feature maps of size C×H×1 and C×1×W respectively:
[0024]
[0025]
[0026] Where C represents the number of feature map channels, W represents the width, and H represents the height;
[0027] The feature maps in the width and height directions of the global receptive field are concatenated and then input into a convolutional layer with a shared 1×1 kernel. The batch-normalized feature maps are then input into an activation function to obtain the feature maps.
[0028] f=σ(F1([z h ,z w ])
[0029] Where F1 represents the feature map after batch normalization, f represents the feature map obtained after activation function, and σ represents the activation function;
[0030] The feature map f is convolved with a 1×1 kernel according to its original height and width to obtain a feature map F with the same number of channels as the original. h and F w After passing through the activation function, the attention weights g of the feature map in height and width are obtained respectively. h And the attention weights g in the width direction w :
[0031] g h =σ(F h (f h ))
[0032] g w =σ(F w (f w ))
[0033] We obtain feature maps with attention weights in the width and height directions:
[0034]
[0035] As a preferred technical solution, the SE attention submodule performs compression operations on each channel of the input feature map, specifically including:
[0036] The SE attention submodule performs compression on each channel of the input feature map to obtain the output vector Z. It compresses the H×W pixels of channel c using global average pooling, specifically as follows:
[0037]
[0038] By performing channel multiplication on the vector Z through two fully connected layers using an activation function, we obtain the channel weight value S, which is specifically expressed as follows:
[0039] S = F ex (Z,W)=σ(g(Z,W))=σ(W2δ(W1,Z))
[0040] The generated feature vector is multiplied by the corresponding channel of the feature map, and redundant boxes with confidence scores greater than the threshold are removed by non-maximum suppression to obtain the final predicted box. The confidence score of the predicted box is then calculated.
[0041] As a preferred technical solution, the confidence level of the predicted bounding box is calculated, specifically expressed as follows:
[0042] Confidence = P r (object)×IOU
[0043] Among them, P r (object) represents the probability that the current predicted bounding box contains an object, and IOU represents the intersection-union ratio between the predicted bounding box and the ground truth bounding box.
[0044] The present invention also provides a nighttime vehicle detection system based on an improved YOLOv5 convolutional neural network, comprising: a dataset acquisition module, a preprocessing module, a dataset partitioning module, a network construction module, a network training module, and a detection result output module;
[0045] The dataset acquisition module is used to acquire a nighttime vehicle dataset;
[0046] The preprocessing module is used to perform data augmentation preprocessing on the nighttime vehicle dataset;
[0047] The dataset partitioning module is used to partition the training dataset and the test dataset;
[0048] The network building module is used to build an improved YOLOv5 convolutional neural network, which includes an improved Backbone network, a Neck network, and an improved Head detection head.
[0049] The improved Backbone network includes a Focus submodule, a CBL submodule, a CSP submodule, and an improved ASPP submodule. The Focus submodule performs slicing operations on the input feature map, the CBL submodule performs convolution operations on the new image, the CSP submodule splits the input feature map into two branches for convolution operations, and the improved ASPP submodule uses convolutional layers and pooling layers with different dilation rates to obtain different receptive fields and extract multi-scale feature information.
[0050] The Neck network adopts an FPN+PAN structure;
[0051] The improved Head structure includes a CA attention submodule, a first Conv submodule, an SE attention submodule, and a second Conv submodule. The CA attention submodule performs global average pooling and feature map concatenation on the input feature map. The first Conv submodule performs convolutional dimensionality reduction on the concatenated feature map output by the CA attention submodule. The SE attention submodule performs compression operation on each channel of the input feature map. The second Conv submodule performs channel multiplication on the compressed vector output by the SE attention submodule through a fully connected layer and an activation function.
[0052] The network training module is used to train the improved YOLOv5 convolutional neural network using the training dataset and save the trained weight file.
[0053] The detection result output module is used to detect the test dataset using the saved weight file and output the nighttime vehicle detection results.
[0054] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0055] (1) In the Backbone network of YOLOv5 convolutional neural network, the present invention uses an improved ASPP structure instead of an SPP structure. The improved ASPP structure obtains different receptive fields by setting different expansion rates for the convolutional layers, extracts multi-scale information, strengthens the detection of "small targets" in vehicle detection, and improves the accuracy of "small target" detection.
[0056] (2) This invention incorporates SE (Squeeze and Excitation) attention mechanism and CA (Coordinate Attention) attention mechanism into the Head detection head of YOLOv5 convolutional neural network. The SE attention mechanism automatically acquires the importance of each feature channel through learning, and then enhances significant features and suppresses or weakens non-significant features according to their importance. The CA attention mechanism decomposes channel attention into two 1-dimensional feature encoding processes, which aggregate features along two spatial directions respectively. It not only acquires information between channels, but also considers positional information related to direction, which helps the model to better locate and identify targets. Integrating the SE attention mechanism and CA attention mechanism into different positions of the Head detection head can eliminate the interference of complex background lighting on nighttime vehicle detection. Attached Figure Description
[0057] Figure 1 is a flowchart illustrating the nighttime vehicle detection method based on the improved YOLOv5 convolutional neural network of the present invention.
[0058] Figure 2 is a schematic diagram of the overall network structure of the improved YOLOv5 convolutional neural network of the present invention;
[0059] Figure 3 is a schematic diagram of the network structure of the improved ASPP submodule of the present invention;
[0060] Figure 4 is a schematic diagram of the network structure of the improved Head structure of the present invention; Detailed Implementation
[0061] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0062] Example 1
[0063] As shown in Figure 1, this embodiment provides a nighttime vehicle detection method based on an improved YOLOv5 convolutional neural network, including the following steps:
[0064] Step 1: Select nighttime images from the UA-DETRAC dataset to construct a nighttime vehicle dataset, and enable Mosaic data augmentation on the image data;
[0065] Step 1 is as follows:
[0066] 101: Filter out nighttime vehicle images from the UA-DETRAC dataset;
[0067] 102: Since this invention does not require further classification of vehicle categories, all data tags are normalized to vehicle tags;
[0068] 103: Enable Mosaic data augmentation, randomly use 4 images, randomly scale them, and then randomly distribute and stitch them together to enrich the background of the input images;
[0069] Step 2: Construct an improved YOLOv5 convolutional neural network, using the improved ASPP structure instead of the SPP structure for "small object" detection, and incorporating an attention mechanism to eliminate the influence of complex lighting;
[0070] As shown in Figure 2, the improved YOLOv5 convolutional neural network includes an improved Backbone network, a Neck network, and an improved Head detection head. The improved Backbone network includes a Focus submodule, a CBL submodule, a CSP submodule, and an improved ASPP (Atrous Spatial Pyramid Pooling) submodule. The Neck network adopts an FPN+PAN structure. As shown in Figure 4, the improved Head structure includes a CA attention submodule, a first Conv submodule, an SE attention submodule, and a second Conv submodule.
[0071] Step 2 is as follows:
[0072] 201: The Focus submodule performs slicing operations on the input image, slicing the W (width) and H (height) information of the input image to expand the image space channels. After slicing, the input image's three RGB channels become 12 channels, resulting in a new image.
[0073] 202: The CBL submodule consists of a conv convolutional layer, a BN layer, and a LeakyRelu activation function. It performs convolution operations on the new image to obtain a double-downsampled feature map without information loss.
[0074] 203: The CSP submodule splits the input feature map into two branches. One branch is convolved and then passed through multiple residual structures, and then another convolution operation is performed. The other branch is directly convolved. Then the two branches are concatted to extract rich gradient features.
[0075] 204: As shown in Figure 3, the input data of the improved ASPP structure passes through a Con1×1 convolutional layer with an expansion rate of 1, a Con3×3 convolutional layer with an expansion rate of 5, a Con3×3 convolutional layer with an expansion rate of 9, a Con3×3 convolutional layer with an expansion rate of 13, and a Pool1×1 pooling layer, and is then concatenated and connected to a Con1×1 convolutional layer. The improved ASPP structure uses convolutional layers and pooling layers with different expansion rates to obtain different receptive fields and extract multi-scale feature information.
[0076] 205: The Neck network in this embodiment adopts an FPN+PAN structure. The FPN structure conveys strong semantic features through a top-down path, while the PAN structure conveys strong localization features through a bottom-up path. The FPN+PAN structure integrates low-level, mid-level, and high-level feature information.
[0077] 206: The CA attention submodule first performs global average pooling on the input feature map X along both the W (width) and H (height) directions, generating feature maps of size C×H×1 and C×1×W respectively, where C represents the number of feature map channels.
[0078]
[0079]
[0080] Next, the feature maps in the width and height directions of the global receptive field are concatenated together, and then fed into a shared 1×1 convolutional layer, i.e., the first Conv submodule, to reduce its dimension to C / r. Then, the batch-normalized feature map F1 is fed into the σ (Sigmoid) activation function to obtain a feature map f of the form 1×(W×H)×C / r.
[0081] f=σ(F1([z h ,z w (3)
[0082] The feature map f is convolved with a 1×1 kernel according to its original height and width to obtain a feature map F with the same number of channels as the original. h and F w After passing through the σ(Sigmoid) activation function, the attention weights g of the feature map in height and width are obtained respectively. h And the attention weights g in the width direction w :
[0083] g h =σ(F h (f h (4)
[0084] g w =σ(F w (f w (5)
[0085] Finally, we obtain the feature map with attention weights in the width and height directions:
[0086]
[0087] 207: The SE attention submodule first performs compression operations on each channel of the input X to obtain the output Z. Through global average pooling, it compresses H×W pixels of channel c:
[0088]
[0089] Through two fully connected layers W1 and W2, the vector Z obtained in the previous step is multiplied by the σ (Sigmoid) function to obtain the desired channel weight values S. After passing through two fully connected layers, i.e. the second Conv submodule, different values in S represent the weight information of different channels, assigning different weights to the channels.
[0090] S = F ex (Z,W)=σ(g(Z,W))=σ(W2δ(W1,Z)) (8)
[0091] The generated feature vector S (1×1×C) is multiplied by the feature map U (H×W×C) for corresponding channels. That is, the H×W values of each channel in the feature map U are multiplied by the weights of the corresponding channels in S.
[0092]
[0093] 208: Redundant boxes with confidence scores greater than a threshold are removed using non-maximum suppression to obtain the final predicted boxes; the confidence score of the predicted bounding boxes is calculated:
[0094] Confidence = P r (object)×IOU (10)
[0095] Among them, P r (object) represents the probability that the current predicted bounding box contains an object, and IOU represents the intersection-union ratio between the predicted bounding box and the ground truth bounding box;
[0096] Step 3: Train the improved YOLOv5 convolutional neural network using the training dataset and save the optimal weight file;
[0097] Step 3 specifically involves: inputting the training set obtained in Step 1 into the improved YOLOv5 convolutional neural network in Step 2 for training, and saving the weight file with the best performance for detection on the test dataset;
[0098] Step 4: Use the saved weight file to test the test dataset and evaluate the network performance.
[0099] Step 4 is as follows:
[0100] 401: Build an improved YOLOv5 model using the best-performing weight file and perform detection on the test dataset;
[0101] 402: Evaluate the performance of the improved YOLOv5 from three dimensions: precision, recall, and AP. Sort the predicted bounding boxes by confidence. A predicted bounding box with an IoU (Intersection over Union) greater than a certain threshold of 0.5 is designated as a TP (True Positive). The remaining bounding boxes that do not match the ground truth are designated as FPs (False Positives) for that category. Ground truth bounding boxes that do not match the predicted bounding boxes are designated as FNs (False Negatives) for that category. Calculate the number of TPs, FPs, and FNs in the network.
[0102] The accuracy of the computational model measures its ability to accurately determine whether a model is a positive example.
[0103]
[0104] Accuracy alone cannot determine the quality of a model. If too many false negatives are detected while all the actual positives are true, even with high accuracy, the model's performance will still fall short of expectations. In this case, recall should be calculated. Recall is the ratio of the number of correctly identified positives to the total number of true positives in that class.
[0105]
[0106] Based on precision and recall, point interpolation is used to calculate average precision (AP). In 101-point interpolation, the shape of the precision-recall curve is the maximum precision [0, 0.01, 0.02, ... 1] over an average of 101 equally spaced recall levels.
[0107]
[0108]
[0109] This embodiment replaces the SPP structure with an improved ASPP structure in the Backbone network to obtain different receptive fields, extract multi-scale information, and improve the accuracy of "small target" detection. Based on this, an attention mechanism is incorporated into the Head detection head to weight important and unimportant information, thereby improving the accuracy of the improved YOLOv5 convolutional neural network under complex lighting backgrounds. Results show that the improved YOLOv5 convolutional neural network achieves an accuracy of 86.1%, a recall of 65%, and an AP0.5 of 73.2% for nighttime vehicle detection, representing improvements over the original YOLOv5's accuracy of 71.2%, recall of 56.9%, and AP0.5 of 64.1%.
[0110] The experimental results above demonstrate that the improved YOLOv5 convolutional neural network in this embodiment can effectively reduce the false detection rate and, to a certain extent, reduce false vehicle detections, further improving detection accuracy.
[0111] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any changes, modifications, substitutions, combinations, or simplifications made without departing from the spirit and principle of the present invention shall be considered equivalent substitutions and shall be included within the protection scope of the present invention.
Claims
1. A nighttime vehicle detection method based on an improved YOLOv5 convolutional neural network, characterized in that, The process includes the following steps: acquiring a nighttime vehicle dataset; performing data augmentation preprocessing on the nighttime vehicle dataset; and dividing the nighttime vehicle dataset into training and testing datasets; constructing an improved YOLOv5 convolutional neural network, which includes an improved Backbone network, a Neck network, and an improved Head detection head; the improved Backbone network includes a Focus submodule, a CBL submodule, a CSP submodule, and an improved ASPP submodule. The Focus submodule slices the input feature map to obtain a new image, the CBL submodule performs convolution operations on the new image, and the CSP submodule slices the input feature map to obtain a new image. The input feature map is split into two branches for convolution operations. The improved ASPP submodule uses convolutional layers and pooling layers with different dilation rates to obtain different receptive fields and extract multi-scale feature information. The Focus submodule slices the width and height information of the input feature map. The CBL submodule consists of a conv convolutional layer, a BN layer, and a LeakyReLU activation function. The CSP submodule splits the input feature map into two branches for convolution operations. One branch performs convolution followed by multiple residual structures and then another convolution operation, while the other branch performs convolution directly. Finally, the outputs of the two branches are concatenated. The improved ASPP submodule... Different receptive fields are obtained by using convolutional layers and pooling layers with different dilation rates to extract multi-scale feature information. Specifically, the input feature map of the improved ASPP structure is passed through a Con1×1 convolutional layer with a first dilation rate, a Con3×3 convolutional layer with a second dilation rate, a Con3×3 convolutional layer with a third dilation rate, a Con3×3 convolutional layer with a fourth dilation rate, and a Pool1×1 pooling layer, and then concatenated together and connected to a Con1×1 convolutional layer to extract multi-scale feature information. The Neck network adopts an FPN+PAN structure. The improved Head detection head includes a CA attention submodule, a first Conv submodule, and an SE attention submodule. The system comprises a first Conv submodule and a second Conv submodule. The CA attention submodule performs global average pooling and feature map concatenation on the input feature map. The first Conv submodule performs convolutional dimensionality reduction on the concatenated feature map output by the CA attention submodule. The SE attention submodule compresses each channel of the input feature map. The second Conv submodule performs channel multiplication on the compressed vector output by the SE attention submodule through a fully connected layer and an activation function. The improved YOLOv5 convolutional neural network is trained using the training dataset, and the trained weight file is saved. The saved weight file is used to detect vehicles on the test dataset, and the nighttime vehicle detection results are output.
2. The nighttime vehicle detection method based on the improved YOLOv5 convolutional neural network according to claim 1, characterized in that, The data augmentation preprocessing for the nighttime vehicle dataset specifically includes: constructing a nighttime vehicle dataset by selecting nighttime images from the UA-DETRAC dataset and normalizing all data labels to vehicle labels; and performing data augmentation preprocessing using Mosaic data augmentation by randomly selecting nighttime vehicle images, randomly scaling them, and then randomly distributing and stitching them together.
3. The nighttime vehicle detection method based on the improved YOLOv5 convolutional neural network according to claim 1, characterized in that, The CA attention submodule performs global average pooling and feature map concatenation on the input feature map. Specifically, the CA attention submodule first performs global average pooling on the input feature map X in both the width and height directions, generating feature maps of size C×H×1 and C×1×W respectively. Where C represents the number of feature map channels, W represents the width, and H represents the height; the feature maps in the width and height directions of the global receptive field are concatenated, and the concatenated feature maps are input into a shared 1×1 convolutional layer. The batch-normalized feature maps are then input into an activation function to obtain the feature map: f=σ(F1([z h ,z w Where F1 represents the feature map after batch normalization, f represents the feature map obtained after activation function, and σ represents the activation function; convolving feature map f with 1×1 kernel according to its original height and width yields feature map F with the same number of channels as the original. h and F w After passing through the activation function, the attention weights g of the feature map in height and width are obtained respectively. h And the attention weights g in the width direction w :g h =σ(F h (f h ))g w =σ(F w (f w We obtain feature maps with attention weights in the width and height directions:
4. The nighttime vehicle detection method based on the improved YOLOv5 convolutional neural network according to claim 3, characterized in that, The SE attention submodule performs a compression operation on each channel of the input feature map. Specifically, the SE attention submodule performs a compression operation on each channel of the input feature map to obtain an output vector Z. Then, through global average pooling, it compresses the H×W pixels of channel c, as follows: By performing channel multiplication on the vector Z through two fully connected layers using an activation function, we obtain the channel weight value S, specifically expressed as: S = F ex (Z,W)=σ(g(Z,W))=σ(W2δ(W1,Z)) multiplies the generated feature vector with the corresponding channel of the feature map, and removes redundant boxes with confidence greater than the threshold by non-maximum suppression to obtain the final predicted box, and calculates the confidence of the predicted box.
5. The nighttime vehicle detection method based on the improved YOLOv5 convolutional neural network according to claim 4, characterized in that, The confidence score of the predicted bounding box is calculated as follows: Confidence = P r (object)×IOU where P r (object) represents the probability that the current predicted bounding box contains an object, and IOU represents the intersection-union ratio between the predicted bounding box and the ground truth bounding box.
6. A nighttime vehicle detection system based on an improved YOLOv5 convolutional neural network, characterized in that, include: The system includes modules for dataset acquisition, preprocessing, dataset partitioning, network construction, network training, and detection result output. The dataset acquisition module is used to acquire a nighttime vehicle dataset; the preprocessing module is used to perform data augmentation preprocessing on the nighttime vehicle dataset. The dataset partitioning module is used to partition the training dataset and the test dataset; the network construction module is used to construct an improved YOLOv5 convolutional neural network, which includes an improved Backbone network, a Neck network, and an improved Head detection head; the improved Backbone network includes a Focus submodule, a CBL submodule, a CSP submodule, and an improved ASPP submodule. The Focus submodule slices the input feature map to obtain new images, the CBL submodule performs convolution operations on the new images, and the CSP submodule splits the input feature map into two branches for convolution operations. The improved ASPP submodule uses convolutional and pooling layers with different dilation rates to obtain different receptive fields and extract multi-scale feature information; the Focus submodule slices the width and height information of the input feature map; the CBL submodule consists of conv convolutional layers, BN layers, and LeakyReLU activation functions; the CSP submodule splits the input feature map into two branches for convolution operations, one branch is convolved and then passed through multiple residual structures for another convolution operation, and the other branch is directly convolved, and finally the outputs of the two branches are concat. The improved ASPP submodule uses convolutional and pooling layers with different dilation rates to obtain different receptive fields and extract multi-scale feature information; the Focus submodule slices the width and height information of the input feature map; the CBL submodule consists of conv convolutional layers, BN layers, and LeakyReLU activation functions; the CSP submodule splits the input feature map into two branches for convolution operations, one branch is convolved and then passed through multiple residual structures for another convolution operation, and the other branch is directly convolved, and finally the outputs of the two branches are concat. The improved ASPP structure extracts multi-scale feature information by passing the input feature map through a Con1×1 convolutional layer with a first dilation rate, a Con3×3 convolutional layer with a second dilation rate, a Con3×3 convolutional layer with a third dilation rate, a Con3×3 convolutional layer with a fourth dilation rate, and a Pool1×1 pooling layer, concatenating them together and connecting them to a Con1×1 convolutional layer to extract multi-scale feature information. The Neck network adopts an FPN+PAN structure. The improved Head detection head includes a CA attention submodule, a first Conv submodule, an SE attention submodule, and a second Conv submodule. The attention submodule performs global average pooling and feature map concatenation on the input feature map. The first Conv submodule performs convolutional dimensionality reduction on the concatenated feature map output by the CA attention submodule. The SE attention submodule compresses each channel of the input feature map. The second Conv submodule performs channel multiplication on the compressed vector output by the SE attention submodule through a fully connected layer and an activation function. The network training module trains the improved YOLOv5 convolutional neural network using the training dataset and saves the trained weight file. The detection result output module uses the saved weight file to detect vehicles on the test dataset and outputs the nighttime vehicle detection results.
Citation Information
Patent Citations
Night vehicle detection method based on improved YOLOv3 convolutional neural network
CN110909666A
X-ray weld defect detection method based on convolutional neural network
CN113674247A