Vehicle detection method research for traffic monitoring
By designing efficient depth separation convolution modules and introducing small object detection layers, and using WIOU loss function, the problems of insufficient detection accuracy and high false detection rate in traffic monitoring scenarios are solved, which significantly improves the Accuracy and efficiency of vehicle inspection.
Patent Information
- Application Number
- CN202410682869.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-11-12
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The current YOLO series vehicle detection methods for the field of traffic monitoring have problems such as insufficient detection accuracy and high missed detection rate.
Design an efficient depth separable convolution module (EDSConv) to reconstruct the C2f module in YOLOv8n, introduce a small object detection layer, enhance the fusion effect of deep feature information and shallow feature information, and use WIOU loss function to replace the CIoU loss function. To improve the detection performance and efficiency of the model.
In traffic monitoring scenarios, the detection rate and accuracy of vehicle detection are improved, the impact of low-quality images on the network is reduced, the regression accuracy and convergence speed of the model are improved, and the detection accuracy and recall rate are significantly improved.
Smart Images

Figure CN118942047A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of deep learning and target detection, and in particular to a vehicle detection method for traffic monitoring. Background Art
[0002] As driverless technology and intelligent safety assistance systems enter a stage of rapid development, the requirements for the best route for path planning are becoming increasingly higher. Therefore, it is particularly important to build a smart transportation system. Accurate detection of moving vehicles through urban traffic monitoring can convey key information to road users to ensure efficient and stable traffic order in different scenarios. However, the accuracy of vehicle detection is crucial to the safety of future driverless cars. Therefore, it is very necessary to design a vehicle detection method with high detection accuracy and low false detection rate.
[0003] The vehicle target detection method based on deep learning has developed rapidly, and it is mainly divided into two categories: two-stage and one-stage. Although the two-stage method performs well in detection effect, it is inefficient because the detection needs to be divided into two stages, and is not suitable for vehicle detection tasks in traffic monitoring scenarios. The latest one-stage detection methods mainly include SSD series and YOLO series. Among them, YOLOv8, as the latest model in the YOLO series, has higher detection accuracy and smaller parameter amount. Therefore, in the vehicle detection task in the traffic monitoring scenario, the present invention adopts the YOLOv8n network for improvement and optimization.
[0004] In terms of vehicle detection in traffic monitoring, Zhou Fei et al. used FasterNet to replace the feature extraction part of the YOLOv8 backbone network and added a small target detection head to effectively improve the problem of poor small target vehicle detection effect, but it required too much computing resources, making mobile terminal deployment more difficult; Bie et al. added an attention mechanism to the YOLOv5n backbone network, greatly improving the feature extraction ability and lightweight effect of the model, which can meet the requirements of edge devices, but the types of detection scenes are small and lack applicability in real application scenarios; Guo et al. used sub-pixel convolution to replace the linear interpolation upsampling module in the original model, which can amplify the feature map of the target vehicle and further improve the detection accuracy, but also increased the number of model parameters; Zhao et al. integrated the lightweight network MobileViT as the backbone network in the YOLOv7 model and designed a new C3 module, which greatly enhanced the network's recognition accuracy for small target vehicles, but inevitably caused more computation.
[0005] From the above analysis, it can be seen that the current YOLO series of improved methods for the field of traffic monitoring still have problems such as insufficient detection accuracy and high false detection and missed detection rates. Summary of the invention
[0006] The technical problem to be solved by the present invention is how to improve the low accuracy and high false detection rate of the current traditional network model in urban road vehicle detection.
[0007] In order to solve the above problems, the technical solution adopted by the present invention is: a vehicle detection method for traffic monitoring, comprising the following steps:
[0008] S1: secondary processing of the selected dataset;
[0009] S2: Design an efficient depthwise separable convolution module (EDSConv), reconstruct the C2f module in YOLOv8n, further lightweight the network without affecting the accuracy of the model, and improve the detection performance of the model;
[0010] S3: Introduce a small target detection layer to enhance the fusion effect of deep feature information and shallow feature information, and further improve the recall and accuracy of model detection;
[0011] S4: The WIOU loss function is used to replace CIoU to reduce the impact of low-quality images on the network and further accelerate the regression accuracy and convergence speed of the network model.
[0012] The beneficial effects of adopting the above technical scheme are as follows: in the improved YOLOv8 method described in the present invention, an efficient depth-separable convolution module EDSConv is designed, and the C2f module is reconstructed based on the convolution module, so as to further lighten the network without affecting the accuracy of the model and improve the detection performance of the model; a small target detection head of 160×160 size is introduced to enhance the fusion effect of deep feature information and shallow feature information, and further improve the recall rate and accuracy of detection; the WIOU loss function is adopted to reduce the influence of low-quality images on the network, and further accelerate the regression accuracy and convergence speed of the network model. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments;
[0014] Figure 1 This is a diagram of the improved YOLOv8 network structure in the method described in an embodiment of the present invention;
[0015] Figure 2 This is a structural diagram of an efficient depthwise separable convolution module EDSConv in an embodiment of the present invention;
[0016] Figure 3 It is a structural diagram of a feature extraction module E-Bottleneck in an embodiment of the present invention;
[0017] Figure 4 Schematic diagram of the structure of the feature extraction module E-C2f in an embodiment of the present invention. DETAILED DESCRIPTION
[0018] The following is a detailed description of the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. The described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making innovative efforts are within the protection scope of the present invention.
[0019] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from the following description, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0020] like Figure 1 As shown, the embodiment of the present invention discloses a vehicle detection method for traffic monitoring, and the method comprises the following steps:
[0021] S1: Secondary processing of the used dataset;
[0022] Specifically, in this example, the Streets public dataset is downloaded as a vehicle detection dataset; the dataset contains only one category (Car), in which the training set, test set and validation set have 5248, 291 and 582 images respectively, including vehicle information in different scenes such as daytime, rainy days, occlusion, backlight, etc.; the training set uses data enhancement technology to randomly extract 2 to 4 images in different scenes and merge them to form an image of fixed size, which greatly improves the diversity of model training; but this may cause overfitting during testing, so the present invention performs secondary processing on the dataset; 200 and 300 images are randomly extracted from the test set and validation set respectively, and the images in the training set are replaced without duplication to improve the accuracy and stability of model training;
[0023] S2: Design an efficient depth-separable convolution module (EDSConv), and use this convolution module to reconstruct the Bottleneck structure; only replace the second layer of standard convolution in series in Bottleneck with an efficient depth-separable convolution module to form E-Bottleneck; replace the Bottleneck in the C2f module to form E-C2f. The dataset is extracted through the backbone network of the improved YOLOv8 network, which can further lighten the network without affecting the accuracy of the model and improve the detection performance of the model;
[0024] S3: Add a small target detection layer in the neck network to enhance the fusion effect of deep feature information and shallow feature information, and further improve the recall and accuracy of model detection;
[0025] S4: The WIOU loss function is used to replace CIoU to reduce the impact of low-quality images on the network and further accelerate the regression accuracy and convergence speed of the network model.
[0026] The above steps are described in detail below:
[0027] In step S2, an efficient depth-separable convolution module is designed for the improved YOLOv8 network. The specific structure is as follows: Figure 3 The detailed steps are as follows:
[0028] S21: Building efficient depthwise separable convolutions;
[0029] S22: constructing an efficient depthwise separable convolution module, wherein the efficient depthwise separable convolution module includes a common convolution, a batch normalization layer, and a SiLU activation function;
[0030] S23: construct feature extraction module E-Bottleneck;
[0031] S24: construct feature extraction module E-C2f;
[0032] S25: Construct an improved YOLOv8 vehicle detection method for traffic monitoring scenarios, and its specific structure Figure 1 shown.
[0033] Furthermore, in step S21, efficient depth-separable convolution is used to extract image features of different scales. The efficient depth-separable convolution is mainly divided into three stages. The specific structure is as follows: Figure 3 As shown in the figure, the specific feature extraction process is as follows:
[0034] First, the input channels of the efficient depthwise separable convolution are grouped and divided into four branches: Channel1, Channel2, Channel3 and Channel4. Standard convolutions with kernel sizes of 1×1, 3×3, 5×5 and 7×7 are used to extract image features. The number of channels in each branch is 1 / 4 of the original one, and they do not interfere with each other. The calculation process of this stage is as follows:
[0035] Y=Concat(Groups[Channel1(Conv1(X))+ Channel2(Conv2(X))+ Channel3(Conv3(X))+ Channel4(Conv4(X))])
[0036] Conv i =σ(f Ci )
[0037] Among them, f Ci represents a convolution operation with a convolution kernel size of i×i, σ represents the SiLU activation function, Concat represents a concatenation operation, Groups represents a channel grouping operation, Channeli represents different channel branches, and X∈R H×W×C is the feature map of the convolution input, and Y represents the feature output after convolution of different scales;
[0038] Next, through Concat splicing, the target feature information of different convolution sizes is fused so that all sub-features are aggregated again. The number of channels at this time is C at the time of input;
[0039] Finally, the processed Groups branch is concatenated with the unprocessed input branch, and a 1×1 convolution operation is performed to ensure further fusion of the input branch and processed branch feature information, while reducing the amount of network calculation and parameters. The calculation process of this stage is as follows:
[0040] Output = Conv1(Y+X)
[0041] Among them, Y∈R H’×W’×C’ is the feature map generated during concatenation, Conv i Represents the i×i standard convolution operation;
[0042] The input channels are grouped and convolution kernels of different sizes are used to obtain receptive fields of different scales, which greatly improves the model's ability to extract features of the target vehicle. In the feature fusion stage, since the input branch retains the global information of the original channel, after fusion with the processing branch, the 1×1 convolution is used to effectively improve the nonlinear fitting ability of the model and better learn target features at different scales.
[0043] Furthermore, in step S23, a feature extraction module E-Bottleneck is constructed, the specific structure of which is shown in FIG4 , and the specific steps are as follows:
[0044] Use efficient depthwise separable convolution EDSConv to construct the Bottleneck in the C2f module to form a new E-Bottleneck module;
[0045] E-Bottleneck first performs a 1×1 standard convolution on the input feature map to change the number of channels of the feature map; then it connects an efficient depthwise separable convolution in series and uses a residual connection to learn the residual between the original input and the convolution output, which helps alleviate the gradient vanishing problem during training and promotes faster convergence.
[0046] Furthermore, in step S24, a feature extraction module E-C2f is constructed, the specific structure of which is shown in Figure 5, and the specific steps are as follows:
[0047] Use one or more E-Bottlenecks to build a C2f module to form a new E-C2f module;
[0048] The E-C2f module first changes the number of channels of the feature map using a 1×1 standard convolution; then the number of channels is divided equally; the feature map of 1 / 2 of the channels passes through one or more E-Bottleneck modules and is concatenated with the other 1 / 2 unprocessed feature map; finally, the number of channels of the feature map is changed by another 1×1 standard convolution and output to the 3×3 convolution in the next backbone network.
[0049] Furthermore, the steps of adding a small target detection layer in step S3 are as follows:
[0050] S31: The neck network first undergoes two downsampling, Concat, and C2f series structures;
[0051] S32: A set of downsampling, Concat, C2f series structures, an additional detection head (a branch is drawn from the C2f module to connect the additional detection head) and a set of standard convolution, Concat, C2f series structures are newly added after the S31 structure;
[0052] S33: connects two groups of YOLOv8's original standard convolution, Concat, and C2f structures in series, and finally outputs four sizes of feature maps, respectively: 160×160, 80×80, 40×40, and 20×20.
[0053] Furthermore, the process of using the WIOU loss function in step S4 is as follows:
[0054] S41: WIoU improves the overall performance of the model by using a dynamic non-monotonic focusing mechanism and a gradient gain allocation strategy to reduce the competitiveness of high-quality anchor boxes while reducing the harmful gradients generated by low-quality anchor boxes; assuming that the corresponding position of (x, y) in the target box is (x gt ,y gt ), R WIOU Represents the loss of high-quality anchor boxes. The calculation formula of WIOUv1 is as follows:
[0055] L WIOUv1 =R WIOU ·L IOU
[0056]
[0057] S42: In order to avoid large harmful gradients from low-quality samples, the parameter β and WIOUv1 are introduced to construct WIOUv3; the loss function calculation formula of WIOUv3 is as follows:
[0058] L WIOUv3 =γ·L WIOUv1 ·L IoU
[0059]
[0060] Among them, α and β are constants and outliers respectively; the ratio of outlier IOU to mean IOU will change by γ as the number of training times changes, which effectively balances the gradient contribution of anchor boxes of different qualities during training and can improve the learning effect of the model on various targets;
[0070] The validation set is tested using the trained improved YOLOv8 vehicle detection method in traffic monitoring scenarios to generate detection frames. The generated detection images are compared with the images detected by the original YOLOv8n model. The average precision, mAP50-95 and recall rate of the vehicle detection dataset Streets in traffic monitoring scenarios of the present invention reach 89.1%, 53.8% and 82.6% respectively, which are improved by 2.2%, 1.7% and 3.9% respectively compared with the baseline model YOLOv8n.
[0071] The above is only one of the preferred embodiments of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the principles of the present invention are within the protection scope of the present invention.
Claims
1. A vehicle detection method for traffic monitoring, characterized by Bag The steps are as follows: S1: secondary processing of the selected dataset; S2: Design an efficient depthwise separable convolution module (EDSConv) and reconstruct the C2f module in YOLOv8n; S3: Introducing a small object detection layer to further improve the recall and accuracy of model detection; S4: WIOU is used to optimize the loss function to further accelerate the regression accuracy and convergence speed of the network model.
2. The vehicle detection method for traffic monitoring as claimed in claim 1, characterized in that: The step S1 specifically includes the following steps: S11: The selected data set contains only one type of annotation information, namely, vehicle (car); in order to avoid overfitting during testing, the data set is processed twice to improve the accuracy and stability of model training.
3. The vehicle detection method for traffic monitoring as claimed in claim 1, characterized in that: The improved YOLOv8 model in step S2 is constructed by the following method: S21: Building efficient depthwise separable convolutions; S22: constructing an efficient depthwise separable convolution module, wherein the efficient depthwise separable convolution module includes a common convolution, a batch normalization layer, and a SiLU activation function; S23: construct feature extraction module E-Bottleneck; S24: Construct feature extraction module E-C2f.
4. The vehicle detection method for traffic monitoring as claimed in claim 3 is characterized in that: The specific steps of constructing efficient depth-wise separable convolution in step S21 are as follows: First, the input channels of the efficient depthwise separable convolution are grouped and divided into 4 branches without interfering with each other. The calculation process of this stage is as follows: Y=Concat(Groups[Channel1(Conv1(X))+ Channel2(Conv2(X))+ Channel3(Conv3(X))+ Channel4(Conv4(X))]) Conv. i =σ(f Ci ) Among them, f Ci represents a convolution operation with a convolution kernel size of i×i, σ represents the SiLU activation function, Concat represents a concatenation operation, Groups represents a channel grouping operation, Channeli represents different channel branches, and X∈R H×W×C is the feature map of the convolution input, and Y represents the feature output after convolution of different scales; Then, through Concat splicing, all sub-features are aggregated again, and the number of channels at this time is C at the time of input; Finally, the processed Groups branch is concatenated with the unprocessed input branch and a 1×1 convolution operation is performed. The calculation process of this stage is as follows: Output = Conv1(Y+X) Among them, Y∈R H’×W’×C’ is the feature map generated during concatenation, Conv i Represents a standard i×i convolution operation.
5. The vehicle detection method for traffic monitoring as claimed in claim 3 is characterized in that: The steps of constructing the feature extraction module E-Bottleneck in step S23 are as follows: An efficient depth-wise separable convolution EDSConv is used to reconstruct the Bottleneck in the C2f module to form a new E-Bottleneck module.
6. The vehicle detection method for traffic monitoring as claimed in claim 3 is characterized in that: The steps of constructing the feature extraction module E-C2f in step S24 are as follows: Use one or more E-Bottlenecks to build a C2f module to form a new E-C2f module.
7. The vehicle detection method for traffic monitoring as claimed in claim 1, characterized in that: The process of introducing the small target detection layer in step S3 is as follows: S31: The neck network first undergoes two downsampling, Concat, and C2f series structures; S32: After this structure, a set of downsampling, Concat, C2f series structures, an additional detection head and a set of standard convolution, Concat, C2f series structures are newly added; S33: Finally, two groups of YOLOv8's original standard convolution, Concat, and C2f structures are connected in series.
8. The vehicle detection method for traffic monitoring as claimed in claim 1, characterized in that: The specific process in step S4 is as follows: S41: Assume that the corresponding position of (x, y) in the target box is (x gt ,y gt ), R WIOU Represents the loss of high-quality anchor boxes. The calculation formula of WIOUv1 is as follows: L WIOUv1 =R WIOU ·L IOU S42: Parameter β and WIOUv1 are introduced to construct WIOUv3. The loss function calculation formula of WIOUv3 is as follows: L WIOUv3 =γ·L WIOUv1 ·L IoU Among them, α and β are constants and outliers respectively; the ratio of outlier IOU to mean IOU will change by γ as the number of training times changes.
