An improved autonomous driving target detection method based on YOLOv8
By optimizing the YOLOv8 model, the accuracy of autonomous driving target detection in complex backgrounds is improved, the problem of dense small target detection is solved, false detection and missed detection is reduced, and traffic safety is improved.
Patent Information
- Application Number
- CN202411649311.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2044-11-19
AI Technical Summary
The existing autonomous driving target detection methods have low detection accuracy for dense small targets in complex contexts, resulting in mis-detection and missed inspection problems, affecting traffic safety.
By optimizing the YOLOv8 model, replace the SPPF module in the trunk part as the improved SPPF module, add a small object detection layer, and add an improved ACCoM module between the trunk and neck part to improve the robustness and detection accuracy of the model.
The optimized model significantly improves the detection accuracy of dense small targets in a complex context, reduces false and missed inspections, reduces traffic safety risks, and provides more reliable guarantees for autonomous driving.
Smart Images

Figure CN119152200B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of autonomous driving, and in particular to the field of autonomous driving target detection technology based on improved YOLOv8. Background Art
[0002] Autonomous driving technology has become a research hotspot in the automotive industry and artificial intelligence. Its core lies in the collaborative work of three core systems: environmental perception, path planning, and motion control. The environmental perception system uses sensors such as lidar, millimeter-wave radar, and high-definition cameras to collect information such as road conditions, vehicles, pedestrians, and traffic signs in real time; the decision-making system determines the best driving path, timing, and speed based on the perception data according to traffic rules and driving strategies to ensure safe and smooth driving; the motion control system is responsible for converting decisions into specific control actions, such as acceleration, braking, and steering. These three systems complement each other and together constitute the core functions of autonomous vehicles, ensuring that vehicles can drive safely and autonomously in complex environments. Among them, target detection technology is the key to the environmental perception system, which can help the system accurately identify and understand the surrounding environment.
[0003] Object detection technology has evolved from sliding window methods that rely on handcrafted features to two-stage and one-stage detection strategies based on deep learning. Two-stage detectors first generate a series of candidate boxes, and then classify and regress these candidate regions, such as RCNN and its deformations, which have high accuracy but slow speed. One-stage detectors represented by YOLO perform classification and regression directly on feature maps, which makes their detection faster but sometimes less accurate. Since YOLO was first proposed in 2015, it has undergone multiple generations of improvements, continuously improving speed and accuracy.
[0004] Current autonomous driving target detection methods usually focus only on identifying one or a few specific types of targets, such as vehicles, pedestrians, traffic signs, and lane lines. This limitation reduces the applicability and flexibility of detection methods in a wider range of environments. In addition, research in the detection field is mostly focused on Transformer architecture, segmentation and other methods. In order to strike a balance between accuracy and speed, this paper optimizes the YOLOv8 model and applies it to target detection to alleviate common problems such as false detection and missed detection of targets during the detection process. Summary of the invention
[0005] In view of the above problems, the purpose of the present invention is to propose an improved automatic driving target detection method based on YOLOv8. By optimizing and improving the YOLOv8 model and using the data set for training, an optimized model is obtained to achieve multi-target detection, and improve the detection accuracy of the model for dense small targets in complex backgrounds, effectively reducing false detections and missed detections, thereby reducing traffic safety risks and providing safe and reliable protection for automatic driving.
[0006] The method comprises the following steps:
[0007] S1. Establishment and division of data sets, and preprocessing;
[0008] S2. Build the basic YOLOv8s model;
[0009] S3. Optimize the YOLOv8s model, specifically:
[0010] S31, replacing the SPPF module in the backbone of the YOLOv8s model with an improved SPPF module, wherein the improved SPPF module adds adaptive average pooling and adaptive maximum pooling respectively between the first convolutional layer and the first splicing module from the input end of the SPPF module;
[0011] S32. Add a small object detection layer to the head of the YOLOv8s model.
[0012] S33, add 4 improved ACCoM modules between the trunk and neck of the YOLOv8s model;
[0013] S4, use the preprocessed data set to iteratively train the optimized YOLOv8s model;
[0014] S5. Use the trained YOLOv8s model to detect the target.
[0015] Furthermore, the data set is divided into a training set, a validation set and a test set at a ratio of 7:2:1 at random; and the preprocessing is to manually label the training set, the validation set and the test set according to 11 categories of labels using the make sense website.
[0016] Furthermore, the YOLOv8s model is a version of the YOLOv8 model; the construction of the basic YOLOv8s model means adjusting the YOLOv8s model and configuring corresponding training parameters, including setting the number of training rounds to 150.
[0017] Furthermore, three detection heads are set by default in the head part of the YOLOv8s model: the first detection head, the second detection head and the third detection head; upsampling, splicing and C2f modules are added after the second C2f module from the bottom to the top of the neck part of YOLOv8s; convolution, splicing and C2f modules are added before the first convolution module from the top to the bottom of the neck part; and a small target detection head is added after the third C2f module of the bottom-up branch of the improved neck part, named the fourth detection head.
[0018] Furthermore, in the improved ACCoM module, specifically: the CA and SA modules of the original current layer of the ACCoM module are replaced by the SimAM attention mechanism module.
[0019] Furthermore, an improved ACCoM module is added between the first C2f module of the trunk of the YOLOv8s model from the input end and the third splicing module of the bottom-up branch of the neck of the YOLOv8s model from the input end, and is named Sim-ACCoM1 module; an improved ACCoM module is added between the second C2f module of the trunk of the YOLOv8s model from the input end and the second splicing module of the bottom-up branch of the neck of the YOLOv8s model from the input end, and is named Sim-ACCoM 2 modules; an improved ACCoM module is added between the third C2f module from the input end of the trunk of the YOLOv8s model and the first splicing module from the input end of the bottom-up branch of the neck of the YOLOv8s model, and is named Sim-ACCoM3 module; an improved ACCoM module is added after the improved SPPF module in the trunk of the YOLOv8s model and is named Sim-ACCoM4 module; Sim-ACCoM1 module and Sim-ACCoM4 module only contain one adjacent branch.
[0020] Furthermore, the Sim-ACCoM1 module, the Sim-ACCoM2 module, the Sim-ACCoM3 module and the Sim-ACCoM4 module receive feature maps of different levels of the trunk from the current branch and the adjacent branches, respectively, wherein the feature map from the previous branch level is named , the feature map from the current branch level is named and the feature map from the next branch level is named , the optimization is completed and the optimized YOLOv8s model is obtained.
[0021] Furthermore, the iterative training is as follows: inputting the training set in the preprocessed data set into the optimized YOLOv8s model and adjusting the parameters for training until the number of training rounds reaches 150 and the training is stopped. At this time, the loss function or the mAP value has stabilized, and a trained YOLOv8s model is obtained.
[0022] The beneficial effects of the method of the present invention are:
[0023] By replacing the SPPF module of the backbone part of the YOLOv8s model with an improved SPPF module, the model can describe the features more comprehensively and improve the robustness of the model. In addition, a small target detection layer is added to the head part to further improve the detection accuracy of small targets, thereby effectively alleviating the problem of false detection and missed detection of targets. At the same time, four improved ACCoM modules are added between the backbone part and the neck part. By inputting the feature maps of different levels of the backbone part of the YOLOv8s model into the improved ACCoM module and concatenating them in the neck part, the fusion of features of different scales is achieved, which helps to capture the multi-scale contextual information of the target. The optimized model can be integrated into the vehicle camera monitoring system, which can detect and identify the target objects in the monitoring screen in real time, help reduce traffic safety risks, and show a wide range of use value and application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 Schematic diagram of the optimized YOLOv8s model in an embodiment of the present invention;
[0025] Figure 2 Schematic diagram of the structure of the Sim-ACCoM module in an embodiment of the present invention;
[0026] Figure 3 Schematic diagram of the structure of the SA module in the Sim-ACCoM module in an embodiment of the present invention;
[0027] Figure 4 Schematic diagram of the SimAM module in the Sim-ACCoM module in an embodiment of the present invention;
[0028] Figure 5 This is a schematic diagram of the structure of the SPPF module before improvement in an embodiment of the present invention;
[0029] Figure 6 It is a schematic diagram of the improved structure of the SPPF module in an embodiment of the present invention. DETAILED DESCRIPTION
[0030] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0031] This embodiment provides an improved autonomous driving target detection method based on YOLOv8. The network model diagram of the method is as follows: Figure 1 , the method comprises the following steps:
[0032] S1. Establish and divide the data set and perform preprocessing.
[0033] The relevant operations of step S1 are introduced with a specific example:
[0034] Create a dataset named Car dataset. The Car dataset is adapted from the A2D2 dataset of Audi Autonomous Driving. The Car dataset extracts images containing 3D bounding boxes from the A2D2 dataset and selects one frame out of every two frames for sampling, containing a total of 6249 png images. The dataset includes different road scenes, such as highways, villages, and cities. The background includes elements such as the sky, buildings, cars, pedestrians, roads, and trees. The weather conditions cover sunny days, cloudy days, rainy days, etc., aiming to increase the diversity of the dataset and improve the performance of the model in practical applications. The dataset is randomly divided into training set, validation set, and test set in a ratio of 7:2:1 to improve the robustness and generalization ability of the model.
[0035] The divided Car dataset was manually annotated through the make sense website, and the annotation labels of the dataset were divided into 11 categories in total, including: car, van, bus, truck, building, person, traffic light, traffic signal, lamp, rider, bike; the rich label types enhance the adaptability and flexibility of the algorithm in a wide range of environments.
[0036] YOLOv8s is a model of YOLOv8. It performs data enhancement on the labeled data set. The data enhancement method is the default enhancement method when training the YOLOv8s model, including mosaic enhancement (Mosaic), mixed enhancement (Mixup), random perturbation (Random Perspective) and color perturbation (HSV augment) and other data enhancement technologies. Mosaic refers to randomly cropping four pictures and then splicing them into one picture as training data. The advantages are increasing data diversity, improving model robustness, and strengthening the effect of batch normalization layer (Batch Norm2d); Mixup is a data enhancement technology based on linear interpolation, which aims to create new training data by fusing two different training samples. At the same time, the corresponding labels are also linearly interpolated. The advantage is that it can form a smooth transition in the feature space, which helps the model adapt to unseen data distribution and improve the generalization of the model; Random Perspective includes angle, scaling, etc.; HSV augment random color perturbation, color transformation, and horizontal and vertical flipping of pictures, etc. These enhancement methods help improve the performance and adaptability of the model in various complex scenarios.
[0037] S2. Build a basic YOLOv8s model.
[0038] The relevant operations of step S2 are introduced with a specific example:
[0039] The present invention compares different model configuration files, selects the YOLOv8s model, adjusts and configures the corresponding training parameters, including setting the number of training rounds to 150, so that it is more suitable for detection tasks.
[0040] S3. Optimize the YOLOv8s model, specifically:
[0041] S31, replacing the SPPF module in the backbone of the YOLOv8s model with an improved SPPF module, wherein the improved SPPF module adds adaptive average pooling and adaptive maximum pooling respectively between the first convolutional layer and the first splicing module from the input end of the SPPF module;
[0042] S32. Add a small object detection layer to the head of the YOLOv8s model.
[0043] S33, add 4 improved ACCoM modules between the trunk and neck of the YOLOv8s model;
[0044] The relevant operations of step S3 are introduced with a specific example:
[0045] Replace the SPPF module in the backbone of the YOLOv8s model with the improved SPPF module. The original SPPF module is as follows: Figure 5 As shown in Figure 1, it mainly consists of a layer of convolution (Conv) and three maximum pooling (Maxpool2d) operations, and finally outputs through concatenation and convolution layers. The formula is shown in the following formula (1), where X represents the input feature map, represents a convolutional layer with batch normalization and ReLU activation function, Represents a splicing operation:
[0046] (1)
[0047] The improved SPPF module is as follows: Figure 6 As shown, a layer of adaptive average pooling is added to the input based on the SPPF module ( ) and adaptive max pooling ( ), and finally output through concatenation and convolution layers, the formula is shown in the following formula (2):
[0048]
[0049] (2)
[0050] Through this method, the improved SPPF module can make the model focus on both the overall feature distribution and the significant features through adaptive average pooling and maximum pooling respectively, which can describe the features more comprehensively and increase the robustness of the model to features of different scales.
[0051] The detection head of the head network in the YOLOv8s model has three detection heads of different sizes by default. The first detection head, the second detection head, and the third detection head correspond to three convolutional layers of different sizes, and each convolutional layer produces feature maps of different scales, with sizes of 80×80×128, 40×40×256, and 20×20×512, respectively. For dense small targets taken at a distance in the picture, it is necessary to add a small target detection head with an output size of 160×160×64 to the model. The specific operation steps are as follows: add upsampling, splicing, and C2f modules after the second C2f module from the bottom to the top of the neck part of YOLOv8s; add convolution, splicing, and C2f modules before the first convolution module from the top to the neck part; and add a small target detection head after the third C2f module of the bottom-up branch of the improved neck part, named the fourth detection head, to improve the detection effect of small targets. Improve the detection accuracy of dense small targets in complex backgrounds and reduce false detections and missed detections.
[0052] An improved ACCoM module is added between the first C2f module from the input end of the trunk of the YOLOv8s model and the third splicing module from the input end of the bottom-up branch of the neck part of the YOLOv8s model, and is named Sim-ACCoM1 module; an improved ACCoM module is added between the second C2f module from the input end of the trunk of the YOLOv8s model and the second splicing module from the input end of the bottom-up branch of the neck part of the YOLOv8s network, and is named Sim-ACCoM2 module; an improved ACCoM module is added between the third C2f module from the input end of the trunk of the YOLOv8s network and the first splicing module from the input end of the bottom-up branch of the neck part of the YOLOv8s model, and is named Sim-ACCoM3 module; an improved ACCoM module is added after the improved SPPF module in the trunk of the YOLOv8s model, and is named Sim-ACCoM4. In particular, for the Sim-ACCoM1 module and the Sim-ACCoM4 module, the design contains only one adjacent branch due to their special locations.
[0053] The module structure of Sim-ACCoM is as follows Figure 2 As shown in Figure 1, the specific implementation process includes: the Sim-ACCoM1 module, the Sim-ACCoM2 module, the Sim-ACCoM3 module and the Sim-ACCoM4 module receive the feature maps of different levels of the trunk from the current branch and the adjacent branches respectively, among which the feature map from the previous branch level is named , the feature map from the current branch level is named and the feature map from the next branch level is named Sim-ACCoM1 only receives the feature maps of the current branch and the next branch level, and Sim-ACCoM4 only receives the improved SPPF module as the feature maps of the current branch level and the previous branch level.
[0054] right Perform downsampling (D) operation on An upsampling (U) operation is performed to keep the sizes of the feature maps of the three layers consistent.
[0055] In the Sim-ACCoM1 module, Sim-ACCoM2 module, Sim-ACCoM3 module and Sim-ACCoM4 module, respectively Perform dilated convolution operations with different dilation rates, adjust the number of channels through convolution after splicing, and obtain an enhanced feature map containing rich contextual information Then, a simple, parameter-free SimAM attention mechanism module is applied to replace the original CA and SA attention mechanism modules in the current layer of the ACCoM module, and the ACCoM module is renamed as the Sim-ACCoM module. The SimAM attention mechanism module infers the three-dimensional attention weights without increasing the network parameters, thereby removing redundant information and generating effective feature maps. , and for the maximum pooling downsampling operation and bilinear interpolation upsampling operations Perform SA (Spatial Attention) spatial attention mechanism operation to generate and , highlighting important spatial location information for subsequent enhanced alignment and feature fusion and helping to capture multi-scale contextual information of the target.
[0056] Formula (3) represents the overall process of the SimAM attention mechanism module, F(·) is the processing definition of Sim-ACCoM, t represents the serial number of the Sim-ACCoM attention mechanism module, is the output feature of the t-th Sim-ACCoM attention mechanism module, which is expressed in the formula Definition of input:
[0057] (3)
[0058] The SA module structure is as follows Figure 3 As shown in the figure, the specific implementation process of the module is:
[0059] Input feature map: Input feature map X, the shape is C×H×W, where C is the number of channels, H and W are the height and width of the feature map; Extract spatially significant information: Perform the maximum value (max) operation along the channel dimension to generate a single-channel feature map with a shape of 1×H×W. This step can extract the maximum value of each pixel position in different channels, that is, , retaining the significant features of the input feature map in the spatial dimension; local relationship capture and normalization: capture local spatial relationships through single-channel convolution operations, further refine spatial feature information, and normalize the convolution output to the [0,1] interval to generate a spatial attention map Output with a shape of 1×H×W to quantify the importance of each spatial position in the feature map;
[0060] The above steps are expressed by formula (4), where Represents the Sigmoid activation function:
[0061] (4)
[0062] The main function of the SA module is to emphasize important spatial positions in the input feature map, suppress irrelevant or unimportant areas, increase the model's attention to the target spatial position, and help the model better capture and represent important local features.
[0063] SimAM modules such as Figure 4 As shown in the figure, the specific implementation process of the module is:
[0064] (1) Generate 3D weights: First, process the input feature map X and generate the corresponding 3D attention weights. These weights can be used to mark the significance of different positions in the feature map and highlight important information. This module is based on the spatial inhibition theory of neuroscience, proposes an energy function to mine the importance of each neuron, and derives a fast solution, where the minimum energy function is shown in formula (5). is the minimum energy function for each neuron, is the regularization coefficient, and Respectively represent the mean and variance of all neurons in the channel except the target neuron t. The lower the energy of formula (5), the greater the difference between neuron t and the surrounding neurons, and the higher its importance;
[0065] (5)
[0066] (2) Extension: Normalize the weights in the channel dimension to generate spatially consistent weights;
[0067] (3) Fusion: Enhance the features according to the definition of the attention mechanism, compress the expanded 3D weights through the Sigmoid function, and fuse them with the input feature map to generate the final output feature map, thereby enhancing the model's attention to key features.
[0068] The SimAM module is different from the original CA and SA modules in the current layer. It can treat different positions and channels differently, that is, it can provide three-dimensional attention weights for feature maps and evaluate the importance of each position and each channel. Compared with the original ACCoM module, the Sim-ACCoM module reduces the number of parameters and calculations while improving the accuracy of the model's target detection in complex environments.
[0069] The enhanced Respectively , Perform element-wise multiplication to get and , and finally , , and The feature maps are added and fused to obtain the output feature maps. , , as well as , this module enhances the feature representation by combining the features of the current layer, the previous layer, and the next layer, and by fusing and coordinating these feature maps to improve the model's perception of contextual information and target details, as shown in formula (6), where Represents Element-wiseAddition, that is, element-by-element addition:
[0070] (6)
[0071] , , as well as The neck network is spliced to achieve effective fusion of features of different scales and capture multi-scale context information of the target. The optimization is now complete and the optimized YOLOv8s model is obtained.
[0072] S4. Use the preprocessed dataset to iteratively train the optimized YOLOv8s model.
[0073] The relevant operations of step S4 are introduced with a specific example:
[0074] The training set in the preprocessed dataset is input into the optimized YOLOv8s model and the parameters are adjusted for training until the training number reaches 150 rounds and the training is stopped. At this time, the loss function or mAP value has stabilized, and the trained YOLOv8s model is obtained.
[0075] S5. Use the trained YOLOv8s model to detect the target.
Claims
1. An improved autonomous driving target detection method based on YOLOv8, characterized in that: The method comprises the following steps: S1. Establishment and division of data sets, and preprocessing; S2. Build the basic YOLOv8s model; S3. Optimize the YOLOv8s model, specifically: S31, replacing the SPPF module in the backbone of the YOLOv8s model with an improved SPPF module, wherein the improved SPPF module adds adaptive average pooling and adaptive maximum pooling respectively between the first convolutional layer and the first splicing module from the input end of the SPPF module; S32. Add a small object detection layer to the head of the YOLOv8s model. S33, add 4 improved ACCoM modules between the trunk and neck of the YOLOv8s model; In the improved ACCoM module, the specific improvements are: replacing the CA and SA modules of the original current layer of the ACCoM module with the SimAM attention mechanism module; An improved ACCoM module is added between the first C2f module in the trunk of the YOLOv8s model from the input end and the third splicing module in the neck of the YOLOv8s model from the bottom up from the input end, and is named Sim-ACCoM1 module; an improved ACCoM module is added between the second C2f module in the trunk of the YOLOv8s model from the input end and the second splicing module in the neck of the YOLOv8s model from the bottom up from the input end, and is named Sim-ACCoM2 module. Block; add an improved ACCoM module between the third C2f module from the input end of the trunk of the YOLOv8s model and the first splicing module from the input end of the bottom-up branch of the neck of the YOLOv8s model, and name it Sim-ACCoM3 module; add an improved ACCoM module after the improved SPPF module in the trunk of the YOLOv8s model, and name it Sim-ACCoM4 module; only one adjacent branch is included for the Sim-ACCoM1 module and the Sim-ACCoM4 module; S4, use the preprocessed data set to iteratively train the optimized YOLOv8s model; S5. Use the trained YOLOv8s model to detect the target.
2. The improved automatic driving target detection method based on YOLOv8 according to claim 1, characterized in that: The data set is divided into a training set, a validation set and a test set at a ratio of 7:2:1 at random; the preprocessing is to manually label the training set, the validation set and the test set according to 11 categories of labels using the make sense website.
3. The improved automatic driving target detection method based on YOLOv8 according to claim 1, characterized in that: The YOLOv8s model is a version of the YOLOv8 model; the construction of the basic YOLOv8s model means adjusting the YOLOv8s model and configuring the corresponding training parameters, including setting the number of training rounds to 150.
4. The improved automatic driving target detection method based on YOLOv8 according to claim 1, characterized in that: By default, three detection heads are set in the head part of the YOLOv8s model: the first detection head, the second detection head, and the third detection head; an upsampling, splicing, and C2f module are added after the second C2f module from the bottom to the top of the neck part of YOLOv8s; and a convolution, splicing, and C2f module are added before the first convolution module from the top to the bottom of the neck part; and a small target detection head is added after the third C2f module of the bottom-up branch of the improved neck part, named the fourth detection head.
5. The improved autonomous driving target detection method based on YOLOv8 according to claim 1, characterized in that: The Sim-ACCoM1 module, Sim-ACCoM2 module, Sim-ACCoM3 module and Sim-ACCoM4 module receive feature maps of different levels of the trunk from the current branch and the adjacent branches respectively, where the feature map from the previous branch level is named , the feature map from the current branch level is named and the feature map from the next branch level is named , the optimization is completed and the optimized YOLOv8s model is obtained.
6. The improved autonomous driving target detection method based on YOLOv8 according to claim 1, characterized in that: The iterative training is as follows: the training set in the preprocessed data set is input into the optimized YOLOv8s model and the parameters are adjusted for training until the number of training rounds reaches 150 and the training is stopped. At this time, the loss function or the mAP value has stabilized, and a trained YOLOv8s model is obtained.
Citation Information
Patent Citations
Road pedestrian and vehicle detection algorithm based on improved YOLOv5s
CN116740679A
Automatic driving target detection method based on OD-YOLO
CN116824543A