Multi-scale target detection method for enhancing small target features
By improving the YOLOv8 network structure and combining the SPPFAPGC module and WIOU loss function, the problems of false detection, missed detection and low accuracy in urban road vehicle detection are solved, and the accuracy and recall rate of detection are improved, especially in complex traffic scenes and small targets. Inspection.
Patent Information
- Application Number
- CN202410656996.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2024-09-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing urban road vehicle target detection methods have problems such as false detection and missed detection, low accuracy and weak generalization ability. It is especially difficult to effectively detect small target vehicles in complex traffic scenes and occlusion situations.
A multi-scale target detection method is designed to enhance the characteristics of small targets, including the improved GAM-C2f backbone network, SPPFAPGC module, introduction of small target detection layer and WIOU loss function, balancing calculation efficiency and accuracy, and enhancing global information detection capabilities. Improve the fusion of local features and global features to improve bounding box regression performance.
It improves the accuracy and recall rate of vehicle detection in urban traffic scenarios, reduces the missed detection rate, and enhances the generalization ability of the model. In particular, the performance in small target vehicle detection is significantly improved.
Smart Images

Figure CN118587416A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of computer vision, image processing and target detection. Specifically, the present invention relates to a multi-scale target detection method based on YOLOv8 that enhances small target features. Background Art
[0002] As urban traffic problems become increasingly serious, finding effective methods to alleviate traffic congestion and improve the safety and efficiency of the traffic system has become a problem that traffic management departments need to solve urgently. At present, the main difficulties are as follows: (1) Occlusion problem. Due to the different distances at which vehicles enter the shooting range of traffic cameras, the vehicles behind may be blocked to varying degrees, resulting in missed detection and false detection in model detection; (2) Complex scenes. Due to the complex urban traffic environment, there are a large number of pedestrians, buildings and other interference factors. Therefore, the richness and diversity of training data are crucial to improving model performance and help improve the accuracy of the model; (3) Generalization ability. When the training data lacks training samples under different scenes, weather and lighting conditions, the generalization of the model will be reduced. Therefore, how to improve the accuracy and robustness of urban vehicle target detection while further reducing the missed detection rate has become a major challenge in this research field.
[0003] With the continuous development of deep learning and computer vision, urban road vehicle target detection has always been the focus of researchers and scholars, driving the breakthrough of many innovative technologies. However, in many application scenarios, higher requirements are placed on the accuracy and missed detection rate of vehicle detection. At present, target detection algorithms based on deep learning are mainly divided into two categories: two-stage (Fast RCNN, etc.) and one-stage (YOLO series, etc.). Although the two-stage method performs well in detection effect, it is slow and is not suitable for the task scenario of urban road vehicle target detection; the one-stage method only needs to perform one feature extraction to complete target detection, which is faster, but the accuracy may be slightly reduced.
[0004] Scholars at home and abroad have conducted a lot of in-depth research on how to solve these problems. Wang Haiqun et al. introduced an average pooling branch into the original SPPF network structure to compensate for the local information loss problem caused by maximum pooling, and achieved effective fusion of local features and global features, thus improving the detection accuracy of the model. Kang et al. introduced fuzzy entropy into the feature map to reduce the impact of uncertain factors such as lighting differences, occlusion, and weather on vehicle detection in actual scenes. Figure 2In the weighting, the uncertainty of the feature map is reduced, thereby improving the detector's focus on the target center, effectively improving the accuracy of target vehicle detection, but it also consumes more computing resources. Zhang Lifeng et al., in response to the problems of low accuracy of traditional vehicle target detection and high missed detection rate of overlapping targets, reconstructed the backbone network, added convolution operations and adjusted the number of input and output channels, strengthened the feature fusion ability of the network, and enhanced the detection performance of the model, which has strong practicality. Qiu et al. improved the feature extraction network by adopting a context information extraction structure to facilitate the detection of small target vehicles or occluded special vehicles, and used a lightweight convolution operation to effectively improve the average accuracy of the model, but whether it can be applied in complex urban traffic scenes needs further study.
[0005] From the above analysis, it can be seen that the current urban vehicle target detection method still has problems such as low accuracy, missed detection, and high false detection rate. Summary of the invention
[0006] The technical problem to be solved by the present invention is how to improve the problems of false detection, missed detection, low accuracy, weak generalization ability, etc. existing in 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 multi-scale target detection method for enhancing small target features, comprising the following steps:
[0008] S1: redistribute the data set;
[0009] S2: Design an improved GAM-C2f to replace the C2f in the YOLOv8n backbone network to balance the computational efficiency and accuracy of the model;
[0010] S3: Design a SPPFAPGC module to enhance the accuracy of global information detection of target vehicles and improve the richness of feature maps;
[0011] S4: Introduce a small target detection layer to enhance the detection capability of small target vehicles in the distance, realize the fusion of local features and global features, and improve the accuracy of the model;
[0012] S5: The WIOU loss function is used to replace CIoU to improve the bounding box regression performance of the network, and improve the convergence speed and regression accuracy of the model.
[0013] The beneficial effects of adopting the above technical scheme are as follows: in the improved YOLOv8 method described in the present invention, an improved GAM-C2f is designed to replace the C2f in the backbone network, which effectively balances the calculation efficiency and accuracy of the model; a new feature pyramid pooling structure SPPFAPGC module is constructed, and the accuracy of global information detection of the target vehicle is enhanced by average pooling, and the richness of the feature map is improved; a small target detection head with a size of 160×160 is introduced to enhance the detection capability of small target vehicles in the distance, enhance the fusion of local features and global features, and improve the accuracy of the model; and the WIOU optimization loss function is adopted to improve the bounding box regression performance of the network, and improve the convergence speed and regression accuracy of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments;
[0015] Figure 1 This is a diagram of the improved YOLOv8 network structure in the method described in an embodiment of the present invention;
[0016] Figure 2 2 is a structure diagram of a ghost convolution module GhostConv in an embodiment of the present invention;
[0017] Figure 3 This is a schematic diagram of the structure of the GBottleneck module in an embodiment of the present invention;
[0018] Figure 4 This is a schematic diagram of the structure of the GAM-C2f module in an embodiment of the present invention;
[0019] Figure 5 Schematic diagram of the structure of the feature pyramid pooling structure SPPFAPGC module in an embodiment of the present invention. DETAILED DESCRIPTION
[0020] The following is a detailed description of the scheme in the embodiment of the present invention in conjunction with the drawings in the embodiment of the present invention. The described embodiment is only a part of the embodiment of the present invention, not all embodiments. Based on the embodiment of the present invention, all other embodiments obtained by technicians in this field without making innovative work are within the scope of protection of the present invention.
[0021] In the following description, many detailed steps are clearly explained to facilitate a full understanding of the present invention, but the present invention can also be implemented in other ways different from the description. Technicians in this field can make relevant generalizations without violating the principles of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0022] like Figure 1As shown, an embodiment of the present invention discloses a multi-scale target detection method for enhancing small target features, the method comprising the following steps:
[0023] S1: secondary processing of the selected vehicle dataset;
[0024] Specifically, in this example, the selected data set uses the annotated open source data set Streets of the city of Chicago, Illinois, USA. The original data set only contains one type of annotation information for vehicles (car). The data set contains a large number of training scenes under daytime, nighttime, rainy days and building interference factors. Through data enhancement technology, 3 to 4 vehicle images in different scenes are randomly selected and merged to form an image of fixed size. In order to avoid the overfitting problem that may be caused by data enhancement during the training process of the model, the present invention performs secondary processing on the data set; 200 and 300 images are randomly selected from the test set and the validation set, respectively, and replaced with the images in the training set to improve the robustness and generalization of model training.
[0025] S2: Design an improved GAM-C2f to replace the C2f in the YOLOv8n backbone network to balance the computational efficiency and accuracy of the model;
[0026] S3: Design a SPPFAPGC module to enhance the accuracy of global information detection of target vehicles and improve the richness of feature maps;
[0027] S4: Introduce a small target detection layer to enhance the detection capability of small target vehicles in the distance, realize the fusion of local features and global features, and improve the accuracy of the model;
[0028] S5: The WIOU loss function is used to replace CIoU to improve the bounding box regression performance of the network, and improve the convergence speed and regression accuracy of the model.
[0029] The following is a detailed description of the above steps based on the specific content:
[0030] The method of designing an improved GAM-C2f for an improved YOLOv8 network in step S2 includes the following steps:
[0031] S21: Construct ghost convolution GhostConv;
[0032] S22: construct feature extraction module GBottleneck;
[0033] S23: The GBottleneck module includes a normal convolution, an average pooling layer, a maximum pooling layer, a batch normalization layer and a SiLU activation function;
[0034] S24: construct feature extraction module GAM-C2f;
[0035] S25: Build an improved YOLOv8 algorithm for urban vehicle target detection network model, its specific structure Figure 1 shown.
[0036] Furthermore, in step S21, ghost convolution GhostConv is constructed, and its specific structure is as follows: Figure 2 As shown in Figure 2, the specific feature extraction process is as follows:
[0037] First, the two sets of feature maps after traditional convolution and depth separation are spliced into the specified dimension to effectively fuse the multi-channel information; the calculation formula is as follows (excluding the bias term):
[0038] Y=X·f
[0039] Among them, X represents the input of the convolution, f represents the convolution operation, · represents the product operation, and Y represents the output feature map; the amount of calculation generated by this phantom convolution is:
[0040] n·h'·w'·c·k·k
[0041] Among them, c represents the number of input channels, n represents the number of output channels, h' and w' represent the height and width of the output feature map respectively, and k represents the size of the convolution kernel;
[0042] Next, a depth-wise separable convolution is applied to each channel feature map in Y, and a linear operation is performed (without normalization and linear activation), generate the complete Ghost feature map y ij , enhance features and increase channels, thereby further reducing the amount of calculation; the calculation formula is as follows:
[0043] 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:
[0044]
[0045] The computational cost of using Ghost convolution is as follows:
[0046]
[0047] Finally, the intrinsic feature map obtained by the first step and the Ghost feature map obtained by the second step are concatenated to maintain an intrinsic feature map consistent with the standard convolution output, which helps maintain the representation ability of the network and ensures that the model can adapt seamlessly when integrating the GhostConv module;
[0048] The calculation amount of standard convolution and Ghost convolution is compared as follows:
[0049]
[0050] Among them, h and w represent the height and width of the feature map. The output tensor after one convolution is n·h·w', n represents the number of output channels, d represents the size of the convolution kernel after linear transformation, s represents the number of transformations, and n / s represents the number of output channels at the first transformation. Therefore, the computational complexity of phantom convolution is reduced by s times compared to standard convolution, and more mapping information is obtained with less computational complexity and redundant information.
[0051] Furthermore, in step S22, a feature extraction module GBottleneck is constructed, and its specific structure is as follows: Figure 3 As shown, the specific steps are as follows:
[0052] First, GhostConv is used to replace the standard convolution in Bottleneck to generate more feature maps and reduce the original number of parameters and calculations.
[0053] Next, since GhostConv uses a hierarchical processing strategy for input information, the connection between channels is weakened to a certain extent, which may cause some channel information loss; therefore, the maximum pooling branch and the average pooling branch are additionally introduced in the feature input branch. The number of pooling operations on each branch is consistent with that of the convolution branch, which are two consecutive series pooling operations to make up for the local information loss problem that may be caused by large differences in vehicle information;
[0054] Finally, the residual connection is used to concatenate and fuse the three branches of different feature extraction operations with the initial feature information to obtain GBottleneck, which strengthens the connection between channels and enhances the feature expression ability.
[0055] Furthermore, in step S24, a feature extraction module GAM-C2f is constructed, and its specific structure is as follows: Figure 4 As shown, the specific steps are as follows:
[0056] Use one or more GBottleneck modules to replace the Bottleneck in C2f to obtain a new GAM-C2f module, which improves the detection accuracy of the model and further improves the performance of the improved network.
[0057] The GAM-C2f module first uses a 1×1 standard convolution on the input feature map to change the number of channels of the feature map; then the number of channels is divided equally; the feature map of 1 / 2 of the channels is processed by one or more GBottleneck modules and then 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.
[0059] Furthermore, in step S3, a new feature pyramid pooling structure SPPFAPGC is constructed, and the specific structure is as follows: Figure 5 As shown, the specific steps are as follows:
[0060] Replace the maximum pooling in SPPF with continuous average pooling to enhance the ability to extract global feature information and prevent the problem of insufficient feature extraction caused by maximum pooling;
[0061] The SPPFAPGC module first undergoes a 1×1 standard convolution to change the number of channels; then it connects a phantom convolution to reduce the number of parameters; then it uses three consecutive average pooling layers to extract global features to avoid the loss of some feature information; the feature information of the three average pooling operations is fused in parallel, and phantom convolution is used to further extract global information;
[0062] Finally, the deep feature extraction branch is spliced and fused with the shallow input feature branch again and further lightweight convolution is performed to obtain more detailed global features, alleviate the missed detection phenomenon caused by the large size differences of urban vehicles, and achieve more accurate deep feature extraction; the specific calculation process is as follows:
[0063] Y1=GhostConv(Conv(x))
[0064] Y2=Concat(Y1,Avg(Y1),Avg(Avg(Y1)),Avg(Avg(Avg(Y1))))
[0065] Y3=Concat(GhostConv(Y2),x)
[0066] Y=GhostConv(Y3)
[0067] Among them, Y1 represents the output of the first GhostConv, Y2 and Y3 represent the output after the first Concat and the second Concat respectively, and x∈R H×W×C Represents the feature map of the convolution input, and Y represents the final feature output of the feature pyramid pooling structure SPPFAPGC.
[0068] Furthermore, the steps of adding a small target detection layer in step S4 are as follows:
[0069] S41: The neck network first undergoes two downsampling, Concat, and C2f series structures;
[0070] S42: 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;
[0071] S43: connects two groups of YOLOv8's original standard convolution, Concat, and C2f structures in series, and finally outputs feature maps of four sizes, namely 160×160, 80×80, 40×40, and 20×20.
[0072] Furthermore, the process of using the WIOU loss function in step S5 is as follows:
[0073] S51: 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:
[0074] L WIOUv1 =R WIOU ·L IOU
[0075]
[0076] S52: 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:
[0077] L WIOUv3 =γ·L WIOUv1 ·L IoU
[0078]
[0079] Among them, α and β are constants and outliers respectively. The ratio of outlier IOU to mean IOU will change by γ with the change of training times, 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.
[0080] The urban vehicle target detection method of the trained improved YOLOv8 algorithm was used to test the validation set, and a detection frame was generated. The generated detection image was compared with the image detected by the original YOLOv8n model. The average precision and recall rate of the present invention were improved by 1.6% and 2.0% respectively, which effectively improved the problem of poor performance of small target vehicle detection in urban traffic scenarios; verification was performed on the small target dataset VisDrone2019, and the average precision and recall rate were also improved by 1.1% and 1.6% respectively, which fully demonstrated the effectiveness of the present invention.
[0081] 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 multi-scale target detection method for enhancing small target features, characterized in that The steps include: S1: secondary processing of the selected vehicle dataset; S2: Design an improved GAM-C2f to replace C2f, balancing the computational efficiency and accuracy of the model; S3: Construct a new SPPFAPGC module to enhance the accuracy of the model in detecting target vehicles and improve the richness of feature maps; S4: Introduce a small target detection layer to enhance the detection capability of small target vehicles in the distance and realize the fusion of local features and global features; S5: Use WIOU loss function to replace CIoU to improve the bounding box regression performance of the network and improve the convergence speed and regression accuracy of the model.
2. A multi-scale target detection method for enhancing small target features as claimed in claim 1, characterized in that: The step S1 specifically includes the following steps: S11: The training set in the selected data set randomly extracts 2 to 4 vehicle images in different scenes through data augmentation technology and merges them; the data set is processed twice, and 200 and 300 images are randomly selected from the test set and validation set respectively to replace the images in the training set.
3. A multi-scale target detection method for enhancing small target features as claimed in claim 1, characterized in that: In step S2, an improved GAM-C2f is designed and constructed by the following method: S21: Construct ghost convolution GhostConv; S21: construct feature extraction module GBottleneck; S22: Construct feature extraction module GAM-C2f.
4. A multi-scale target detection method for enhancing small target features as claimed in claim 3, characterized in that: The specific steps of constructing the ghost convolution GhostConv in step S21 are as follows: First, the two sets of feature maps after traditional convolution and depth separation are spliced into the specified dimension to effectively fuse the multi-channel information; the calculation formula is as follows (excluding the bias term): Y=X·f Among them, X represents the input of the convolution, f represents the convolution operation, · represents the product operation, and Y represents the output feature map; the amount of calculation generated by this phantom convolution is: n·h'·w'·c·k·k Among them, c represents the number of input channels, n represents the number of output channels, h' and w' represent the height and width of the output feature map respectively, and k represents the size of the convolution kernel; Next, a depth-wise separable convolution is applied to each channel feature map in Y, and a linear operation is performed j (without normalization and linear activation), generates the complete Ghost feature map y ij ; The calculation formula is as follows: The computational cost of using Ghost convolution is as follows: The calculation amount of standard convolution and Ghost convolution is compared as follows: Among them, h and w represent the height and width of the feature map. The output tensor after one convolution is n·h·w', n represents the number of output channels, d represents the size of the convolution kernel after linear transformation, s represents the number of transformations, and n / s represents the number of output channels at the first transformation.
5. A multi-scale target detection method for enhancing small target features as claimed in claim 3, characterized in that: The specific steps of constructing the feature extraction module GBottleneck in step S22 are as follows: First, GhostConv is used to replace the standard convolution in Bottleneck; the maximum pooling and average pooling branches are introduced to prevent local information loss; finally, the residual connection is used to fuse the three branches with different processing methods with the initial feature information to obtain GBottleneck.
6. A multi-scale target detection method for enhancing small target features as claimed in claim 3, characterized in that: The steps of constructing the feature extraction module GAM-C2f in step S23 are as follows: One or more GBottleneck modules are used to replace the Bottleneck in C2f to obtain a new GAM-C2f module, thereby improving the detection accuracy of the model.
7. A multi-scale target detection method for enhancing small target features as claimed in claim 1, characterized in that: The specific steps of constructing a new feature pyramid pooling structure SPPFAPGC module in step S3 are as follows: Replace the maximum pooling in SPPF with continuous average pooling; use GhostConv to replace part of the standard convolution; finally, concatenate the deep feature extraction branch with the shallow input feature branch; the specific calculation process is as follows: Y1=GhostConv(Conv(x)) Y2=Concat(Y1,Avg(Y1),Avg(Avg(Y1)),Avg(Avg(Avg(Y1)))) Y3=Concat(GhostConv(Y2),x) Y=GhostConv(Y3) Among them, Y1 represents the output of the first GhostConv, Y2 and Y3 represent the output after the first Concat and the second Concat respectively, and x∈R H×W×C Represents the feature map of the convolution input, and Y represents the final feature information output of SPPFAPGC.
8. A multi-scale target detection method for enhancing small target features as claimed in claim 1, characterized in that: The specific steps of improving the small target detection layer in step S4 are 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.
9. A multi-scale target detection method for enhancing small target features as claimed in claim 1, characterized in that: The specific process in step S5 is as follows: S51: WIoU improves the overall performance of the model by using a dynamic non-monotonic focusing mechanism and a gradient gain allocation strategy; 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: L WIOUv1 =R WIOU ·L IOU S52: Parameter β and WIOUv1 are introduced to construct WIOUv3. The 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 γ with the change of training times, effectively balancing the gradient contribution of anchor boxes of different qualities during training, and can improve the learning effect of the model on various targets.
Citation Information
Cited By
Intelligent detection method and system for multiple types of underwater diseases of hydraulic concrete structure
CN119579492A
