Lightweight automatic driving target detection method based on YOLOV5

By introducing the FasterNet module, the cross-scale feature fusion module RepC3 and the dynamic detection head in the YOLOV5 model, the problem between the size of the target detection model, the accuracy and real-time performance of the detection in the field of autonomous driving is solved, and efficient and accurate Target detection meets the demands of autonomous driving systems for resource-constrained environments.

CN118918557APending Publication Date: 2024-11-08KUNMING UNIV OF SCI & TECH
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202411136199.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

In the field of autonomous driving, it is difficult to weigh the size of the target detection model, detection accuracy and real-time performance. The existing deep learning models have high computational complexity and high resource consumption, making it difficult to achieve good performance in scenarios with high real-time requirements.

Method used

A lightweight autonomous driving target detection method based on YOLOV5 is proposed. By combining lightweight network module, cross-scale feature fusion and dynamic detection head, the model calculation burden is reduced, and the calculation efficiency and recognition accuracy are improved. Specific steps include introducing the FasterNet module, the cross-scale feature fusion module RepC3 and the Dynamic Head of the dynamic detection head, and optimizing the YOLOV5 model structure to adapt to resource-constrained environments.

Benefits of technology

While reducing the amount of parameters and calculations, the detection accuracy is maintained, the real-time performance of the model is improved, the demand for target detection in autonomous driving is met, and the model is efficient, accurate and practical.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118918557A_ABST
    Figure CN118918557A_ABST
Patent Text Reader

Abstract

The invention provides a lightweight automatic driving target detection method based on FCD-YOLOV5, and relates to the field of automatic driving target detection.The method comprises the steps that firstly, annotation data in a KITTI public data set is processed and converted into a polo format capable of being processed by a YOLOV5 model, categories of the same type are combined, redundant categories are removed, and then the annotation data in the KITTI public data set are obtained; and dividing the processed data set into a training set and a verification set in proportion. A lightweight FasterNet module is introduced into a backbone network of the YOLOV5, a reparameterization module RepC3 based on CNN cross-scale feature fusion is added into a neck network of the YOLOV5, and multi-scale features are rapidly processed through cross-scale fusion. A detection head in YOLOV5 is replaced by a Dynamic Head (Dyad) which unifies attention of scale perception, space perception and task perception, so that the representation capability of a target detection head is improved, and no calculation overhead is increased. According to the method, the parameter quantity of the target detection model is greatly reduced, and meanwhile, high detection precision can be kept.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of autonomous driving target detection and proposes a lightweight autonomous driving target detection method based on YOLOV5. Background Art

[0002] Autonomous driving technology has made great progress in recent years and has great potential in improving traffic safety, traffic efficiency and travel experience. Object detection, as an important component of the autonomous driving system, is responsible for identifying and locating various traffic participants on the road (such as vehicles, pedestrians and bicycles), and is the key to realizing autonomous driving functions.

[0003] Research in the field of object detection has made significant progress, especially the application of deep learning technology has greatly improved the accuracy and speed of detection. As a revolutionary object detection method, YOLO (You Only Look Once) occupies an important position in the field of real-time object detection with its efficient detection speed and good accuracy. As a newer version of the series, YOLOV5 further improves the detection performance and optimizes the model structure to adapt to a wider range of application needs.

[0004] In the application of autonomous driving, in addition to pursuing high accuracy and high speed, there are also strict restrictions on the resource consumption of the algorithm. Autonomous driving systems are usually deployed on vehicle computing platforms with limited computing resources, which requires the target detection algorithm to be not only efficient and accurate, but also have low computational complexity and memory requirements. Deep learning-based target detection algorithms, such as YOLO and Faster R-CNN, have made significant progress in accuracy, but their complex network structure and a large number of parameters lead to large model size, large amount of calculation, and slow inference speed, making it difficult to achieve good performance in autonomous driving scenarios with high real-time requirements. Although some lightweight target detection algorithms such as MobileNet and ShuffleNet have faster inference speed and smaller model size, their accuracy is often not as good as deep learning methods.

[0005] In summary, with the continuous advancement of autonomous driving technology and the increase in application demand, higher requirements are placed on target detection algorithms. The lightweight target detection algorithm based on YOLOV5 is proposed to meet these requirements. It aims to take into account the accuracy of target detection while significantly reducing the computational complexity and resource consumption of the model by streamlining the network structure and optimizing the calculation process. Summary of the invention

[0006] The present invention proposes a lightweight autonomous driving target detection method based on YOLOV5, which is used to solve the problem of difficult balance between target detection model size and detection accuracy and real-time performance in the field of autonomous driving in the prior art.

[0007] To achieve the above objectives, the present invention provides a lightweight autonomous driving target detection method based on YOLOV5, which provides an efficient, accurate and practical solution for deploying target detection models in resource-constrained environments by combining lightweight network modules, cross-scale feature fusion and dynamic detection heads. The specific steps are as follows:

[0008] S1: Obtain the KITTI dataset in the field of autonomous driving, process the labeled data, convert it from the KITTI-specific format to the YOLO format that the YOLOV5 model can process, merge categories of the same type to remove redundant categories, and divide it into training set and validation set according to the proportion.

[0009] S2: Integrate the FasterNet module into C3 in the backbone network of YOLOV5. Through its internal FasterNet_Block, combined with the multi-layer perceptron MLP and partial convolution, it can more effectively extract and fuse spatial features while reducing the computational burden of the model.

[0010] S3: The C3 module is adjusted in the neck network of YOLOV5, and the CNN-based Cross-scale Feature Fusion (CCFF) reparameterizable module RepC3 is incorporated. This modification maintains the advantages of CSP design and enhances the computational efficiency and overall performance of the model in the deployment and reasoning stages by integrating the reparameterizable RepConv block.

[0011] S4: The detection head of YOLOV5 has been redesigned and integrated with the dynamic detection head Dynamic Head. This mechanism integrates scale, space, and task-related attention characteristics into a single architecture, enhancing the model's responsiveness and recognition accuracy to various scales, positions, and task requirements.

[0012] S5: During the experiment, the standard YOLOV5n model and the optimized YOLOV5n lightweight model were trained on the preprocessed KITTI dataset, and then the experimental results of the two models were compared and analyzed.

[0013] As a preferred technical solution of the present invention, the specific steps of step S1 are as follows:

[0014] Get the KITTI public 2D object detection dataset, which includes real images collected in various scenarios, such as urban, rural and highway environments. The dataset consists of two parts: 7481 annotated images, which are used as training and validation sets for the model; 7518 unannotated images, of which 1000 are randomly selected as the test set. For the annotated images, we merge all vehicle categories into the "Car" class, merge the "Person_sitting" and "Pedestrian" categories, and exclude non-target categories labeled "DontCare" and "Misc". The processed dataset only includes three categories: 'Pedestrian', 'Car', and 'Cyclist'. The processed dataset is divided into training and validation sets in a ratio of 8:2, resulting in 5984 training set images, 1497 validation set images, and 1000 test set images. Processing the KITTI dataset in this way can simplify the data structure, improve the generalization performance of the model, and facilitate comparison and evaluation of the effects of the original YOLOV5 model and the improved lightweight model.

[0015] Preferably, the specific steps of S2 are as follows:

[0016] The C3 module in the backbone network of the original YOLOV5 model is improved to obtain the C3_Faster module that inherits the C3 module. The C3_Faster module is introduced in the 2nd, 4th, 6th, and 8th layers of the original algorithm backbone network. The convolutional block in the original C3 module is replaced by FasterNet_Block in this module. It retains the basic characteristics of the C3 module and further improves the feature extraction and processing capabilities by enhancing the convolutional block.

[0017] FasterNet_Block is the core of the entire C3_Faster. After the output feature map from the previous layer is input to C3_Faster, it first determines whether the number of channels C1 of the received input feature map matches the number of input channels C2 expected by the module. If the number of channels does not match, a 1×1 convolution layer that adjusts the number of channels is used to change the dimension of the feature map without changing its spatial dimension. After the channel adjustment, the feature map is passed to the FasterNet_Block sequence. The first operation is a partial convolution (Partial_conv), which is a special convolution operation that performs standard convolution on a portion of the channels of the feature map to reduce the computational burden and improve efficiency. The following is the FLOPs calculation formula for partial convolution:

[0018]

[0019] in and are the height and width of the input feature map, respectively. is the size of the convolution kernel, is the number of partial convolution channels. = When , the FLOPs of partial convolution is only 1 / 2 of that of normal convolution. .

[0020] Next is an MLP layer, which is implemented through two 1×1 convolutional layers, first expanding the number of channels of the feature map and then reducing it back to the original number. This helps to enhance the representation ability of the model. Within each FasterNet_Block, the feature map processed by Partial_conv and MLP is added to the feature map before entering the FasterNet_Block to form a residual connection; this operation helps to alleviate the gradient vanishing problem and enhance the learning ability of the model when it is deep. Before adding the residual, DropPath regularization can be optionally applied, which is a way to randomly discard network connections to enhance the generalization ability of the model. After a series of FasterNet_Blocks, the C3_Faster module outputs the processed feature map.

[0021] Preferably, the specific steps of S3 are as follows:

[0022] The C3 module in the YOLOV5 neck network was modified, and the CNN-based cross-scale feature fusion technology RepC3 was added. RepC3 was introduced in the 13th, 18th, 21st, and 24th layers of the original algorithm neck network. RepC3 consists of three parts: the initial convolution layer, the RepConv sequence, feature fusion, and output adjustment.

[0023] The initial convolutional layer contains two 1×1 convolutional layers cv1 and cv2, which convert the number of channels of the input feature map from C1 to the hidden channel C. This transformation reduces the dimension of the feature map, thereby reducing the computational complexity and helping to extract a more compact feature representation. The main part of the RepConv sequence is RepConv, which is a re-parameterized module that includes training and deployment states. With this design, the model can learn features through different paths during training, and merge these paths into a more efficient convolution operation when deployed. In RepC3, the RepConv sequence enhances the feature representation of the hidden channel C by applying the RepConv layer multiple times. The feature fusion and output adjustment stage adds the feature map processed by the RepConv sequence with the output of cv2 through a 1×1 convolutional layer cv3, and adjusts the number of channels of the fused feature map from c to the number of output channels c2. This fusion method helps to combine features at different levels and enhance the model's ability to detect objects of different scales.

[0024] Processing flow of the RepC3 module: When the input feature map x enters the RepC3 module, it is first processed by two initial convolutional layers (cv1 and cv2), where the output of cv1 enters the RepConv sequence for deep feature extraction, and the output of cv2 is directly used for subsequent feature fusion. The feature map enhanced by the RepConv sequence is added to the output of cv2, and features at different levels are fused in this way. Finally, cv3 adjusts the number of channels of the fused feature map and outputs the final feature representation. This structural design enhances the YOLOV5 network's processing capabilities for complex scenes and multi-scale targets by introducing cross-scale feature fusion and re-parameterization technology, thereby improving the accuracy and robustness of the model.

[0025] Preferably, the specific steps of S4 are as follows:

[0026] The detection head of YOLOV5 is changed, and the dynamic detection head Dynamic Head is introduced. The detection head in the original algorithm is replaced by Dynamic Head. Compared with the stacking and jumping of the original convolution layer, the connection is used to extract and fuse features. The dynamic attention module of scale perception, space perception and task perception is introduced. It can dynamically adjust its processing strategy according to the current task requirements and the specific content of the feature map, and improve the expressiveness of the model through dynamic convolution and complex hierarchical structure. The detection head converts the attention function into three consecutive attentions, each of which focuses on only one angle. The expression formula is as follows:

[0027]

[0028] in There are three different attention functions acting on dimensions L, S, and C respectively.

[0029] The dynamic detection head enhances the model's detection capabilities for targets of different scales and shapes by introducing learnable dynamic mechanisms in the model head, such as dynamic convolution (DyConv), dynamic ReLU (DyReLU), and dynamic deformable convolution (DyDCNv2). The dynamic detection head (DyHeadBlock) integrates the above dynamic mechanisms and improves the adaptability and accuracy of the detection head by cascading features of different scales and dynamically adjusted convolution kernels.

[0030] Scale-aware attention ,dynamically fuse features according to the semantic importance at different scales.

[0031]

[0032] in is a linear function approximated by a 1x1 convolutional layer, is a hard Sigmoid function, the feature tensor .

[0033] Spatial awareness attention , another spatially-aware attention module based on fused features is adopted to focus on discriminative regions that coexist consistently between spatial locations and feature levels. Considering the high dimensionality of S, this module is decomposed into two steps: first, using deformable convolution to make the attention learning sparse, and then aggregating features across layers at the same spatial location.

[0034]

[0035] Where K is the number of sparse sampling positions, is the position shifted by the self-learned spatial offset ∆pk, Position for self-learning Important scalar

[0036] Task-aware attention ,To achieve joint learning and generalization of different representations of objects, task-aware attention is deployed at the end, which dynamically switches the ON and OFF channels of features to support different tasks.

[0037]

[0038] in is the feature slice of the cth channel, is a hyperfunction that learns to control the activation threshold, First, global average pooling is performed on the L × S dimension to reduce the dimensionality, then two fully connected layers and a normalization layer are used, and finally the output is normalized to [−1, 1] using a shifted sigmoid function.

[0039] Dynamic Head is built on three 1x1 convolutional layers and a detection layer. These three convolutional layers process inputs from layers 18, 21, and 24 respectively. The outputs of these layers are processed by the RepC3 module. Through these three 1x1 convolutional layers, the number of channels of the feature map is uniformly adjusted for more efficient processing in the subsequent detection head. The detection layer aggregates the outputs of these three convolutional layers and uses multiple DyHead blocks including scale awareness, spatial awareness, and task awareness in DyHeadBlock. These blocks are stacked in sequence to process the input data. These mechanisms enable the detection head to dynamically adjust its internal parameters according to different input features, thereby optimizing the response to specific tasks. Finally, the fused feature map is used in the detection layer to produce the final detection results, including the location (bounding box), category, and confidence of the object. Top of the form

[0040] Preferably, the specific steps of S5 are as follows:

[0041] The original YOLOV5n network model and the improved lightweight YOLOV5n model were trained on the processed KITTI dataset, and then the experimental results were compared and analyzed. To ensure the rigor of the experiment, comparative experiments of C3_Faster, RepC3, and Dynamic Head single module improvements were set up respectively, and the impact of single modules on the model was demonstrated by analyzing the experimental results. Each group of experiments was conducted on the same device, and the experimental setting of the training round epochs was 200, the batch size batch_size was 32, and the input image size was set to 640×640. Finally, the parameters, calculation amount, average mean precision mAP50, mAP50:95, and frames per second FPS of the original model, the improved single module model, and the YOLOV5 experimental results were compared.

[0042] Beneficial effects achieved by the present invention:

[0043] The present invention proposes a lightweight autonomous driving target detection method based on YOLOV5, which is aimed at the problem of the difficulty in balancing the size of the target detection model with the detection accuracy and real-time performance in the field of autonomous driving. The lightweight FasterNet module is introduced to reduce the computational complexity while improving the network performance, and the reparameterizable module RepC3 based on the cross-scale feature fusion of CNN is added to quickly process multi-scale features through cross-scale fusion, while reducing the number of parameters and increasing the network depth to maintain the performance of the network. The Dynamic Head is used to replace the detection head in YOLOV5, unifying the attention of scale perception, space perception and task perception, and improving the representation ability of the target detection head. The above-mentioned improved algorithm can significantly reduce the number of parameters and the amount of calculation while maintaining the detection accuracy comparable to the original algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 It is a schematic diagram of the process of the present invention;

[0045] Figure 2 It is a schematic diagram of the YOLOV5 model structure of the present invention;

[0046] Figure 3 It is a schematic diagram of the structure of the FasterNet module;

[0047] Figure 4 It is a schematic diagram of the fusion module structure in CCFM;

[0048] Figure 5 This is a schematic diagram of the DyHeadBlock structure. DETAILED DESCRIPTION

[0049] The preferred embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the examples of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.

[0050] A specific example of the present invention discloses a lightweight autonomous driving target detection method based on YOLOV5, such as Figure 1 As shown, it mainly includes the following steps:

[0051] S1: Get the KITTI public 2D object detection dataset, which includes real images collected in various scenarios, such as urban, rural and highway environments. The dataset consists of two parts: 7481 annotated images, which are used as training and validation sets for the model; 7518 unannotated images, of which 1000 are randomly selected as the test set. For the annotated images, we merge all vehicle categories into the "Car" class, merge the "Person_sitting" and "Pedestrian" categories, and exclude non-target categories labeled "DontCare" and "Misc". The processed dataset only includes three categories: 'Pedestrian', 'Car', and 'Cyclist'. The processed dataset is divided into training and validation sets in a ratio of 8:2, and finally 5984 training set images, 1497 validation set images, and 1000 test set images are obtained.

[0052] S2: Improve the C3 module in the backbone network of the original YOLOV5 model to obtain the C3_Faster module that inherits the C3 module. The C3_Faster module is introduced into the 2nd, 4th, 6th, and 8th layers of the original algorithm backbone network, and the convolutional blocks in the original C3 module are replaced by FasterNet_Block in this module.

[0053] FasterNet_Block is the core of the C3_Faster module. First, if the number of channels C1 of the input feature map does not match the module's expected C2, a 1x1 convolution layer is used to adjust the number of channels without changing the spatial dimension. The adjusted feature map enters the FasterNet_Block sequence and first performs a partial convolution (Partial_conv) operation, which performs standard convolution on a portion of the channels to reduce the computational burden. The FLOPs of this operation are calculated as formula (1):

[0054] (1)

[0055] in and are the height and width of the input feature map, respectively. is the size of the convolution kernel, is the number of partial convolution channels. = When , the FLOPs of partial convolution is only 1 / 2 of that of normal convolution. .

[0056] The output of the FasterNet_Block goes to the MLP layer, which is implemented by two 1x1 convolutions, first expanding the number of channels in the feature map, and then reducing it back to the original number. In FasterNet_Block, the processed feature map forms a residual connection with the input feature map, which helps alleviate the gradient vanishing problem and enhances deep learning capabilities. The optional DropPath regularization helps improve the generalization of the model. After a series of FasterNet_Block processing, the C3_Faster module outputs the final feature map.

[0057] S3: The C3 module in the YOLOV5 neck network was modified, and the CNN-based cross-scale feature fusion technology RepC3 was added. RepC3 was introduced in the 13th, 18th, 21st, and 24th layers of the neck network of the original algorithm.

[0058] RepC3 consists of three parts: initial convolution layer, RepConv sequence, feature fusion and output adjustment. The initial convolution layer contains two 1×1 convolution layers cv1 and cv2, which convert the number of channels of the input feature map from C1 to the hidden channel C. This transformation reduces the dimension of the feature map, thereby reducing the computational complexity and helping to extract a more compact feature representation. The main part of the RepConv sequence is RepConv, which is a re-parameterized module that includes training and deployment states. With this design, the model can learn features through different paths during training, and merge these paths into a more efficient convolution operation when deployed. In RepC3, the RepConv sequence enhances the feature representation of the hidden channel C by applying the RepConv layer multiple times. The feature fusion and output adjustment stage adds the feature map processed by the RepConv sequence with the output of cv2 through a 1×1 convolution layer cv3, and adjusts the number of channels of the fused feature map from c to the number of output channels c2. This fusion method helps to combine features at different levels and enhance the model's ability to detect objects of different scales. RepConv includes multiple parallel convolution paths that can be fused into a single efficient convolution operation during inference. RepConv is shown in formula (2):

[0059] (2)

[0060] in is the input feature map, Indicates the output, For input The result of applying a larger convolution, For input The result of applying the auxiliary convolution, is equivalent to an identity map.

[0061] In order to improve computational efficiency during model deployment or inference, these different convolution paths are usually merged into a single convolution operation through weight fusion, which can be achieved by reconstructing the convolution kernel weights, as shown in formula (3): (3)

[0062] In this fusion process, all the convolution kernels (including the convolution kernel for identity mapping) and the weights of identity mapping are merged into one convolution kernel to perform with higher efficiency at inference time.

[0063] S4: Change the detection head of YOLOV5 and introduce the dynamic detection head Dynamic Head (Dyhead). Replace the detection head in the original algorithm with Dynamic Head. Compared with the original stacking and jump connection of convolutional layers to extract and fuse features, a scale-aware, space-aware and task-aware dynamic attention module is introduced. It can dynamically adjust its processing strategy according to the current task requirements and the specific content of the feature map, and improve the expressiveness of the model through dynamic convolution and complex hierarchical structure. The detection head converts the attention function into three consecutive attentions, each of which focuses on only one angle. The expression formula is as follows:

[0064] (4)

[0065] in There are three different attention functions acting on dimensions L, S, and C respectively.

[0066] The dynamic detection head enhances the model's detection capabilities for targets of different scales and shapes by introducing learnable dynamic mechanisms in the model head, such as dynamic convolution (DyConv), dynamic ReLU (DyReLU), and dynamic deformable convolution (DyDCNv2). The dynamic detection head (DyHeadBlock) integrates the above dynamic mechanisms and improves the adaptability and accuracy of the detection head by cascading features of different scales and dynamically adjusted convolution kernels.

[0067] Scale-aware attention , dynamically fuse features according to the semantic importance of different scales, as shown in formula (5):

[0068] (5)

[0069] in is a linear function approximated by a 1x1 convolutional layer, is a hard Sigmoid function, the feature tensor .

[0070] Spatial awareness attention , another spatially aware attention module based on fused features is used to focus on discriminative regions that coexist consistently between spatial locations and feature levels. Considering the high dimensionality of S, this module is decomposed into two steps: first, deformable convolution is used to make the attention learning sparse, and then features are aggregated across layers at the same spatial location, as shown in formula (6):

[0071] (6)

[0072] in is the number of sparse sampling positions, is the position shifted by the self-learned spatial offset ∆pk, Position for self-learning Important scalar.

[0073] Task-aware attention ,To achieve joint learning and generalization of different representations of objects, task-aware attention is deployed at the end, which dynamically switches the ON and OFF channels of features to support different tasks.

[0074] (7)

[0075] in is the feature slice of the cth channel, is a hyperfunction that learns to control the activation threshold, , first perform global average pooling on the L × S dimension to reduce the dimensionality, then use two fully connected layers and a normalization layer, and finally use the shifted sigmoid function to normalize the output to [−1, 1].

[0076] Dynamic Head consists of three 1x1 convolutional layers and a detection layer. These three convolutional layers process inputs from layers 18, 21, and 24 respectively. The outputs of these layers are processed by the RepC3 module. Through these three 1x1 convolutional layers, the number of channels of the feature map is uniformly adjusted for more efficient processing in the subsequent detection head. The detection layer aggregates the outputs of these three convolutional layers and uses multiple DyHead blocks including scale perception, spatial perception, and task perception in DyHeadBlock, which are stacked in sequence to process the input data. These mechanisms enable the detection head to dynamically adjust its internal parameters according to different input features, thereby optimizing the response to specific tasks. Finally, the fused feature map is used in the detection layer to produce the final detection result, including the location (bounding box), category, and confidence of the object.

[0077] S5: The original YOLOV5n network model and the improved lightweight YOLOV5n model are trained on the processed KITTI dataset, and then the experimental results are compared and analyzed. To ensure the rigor of the experiment, comparative experiments of C3_Faster, RepC3, and Dynamic Head single module improvements are set up respectively, and the impact of single modules on the model is demonstrated by analyzing the experimental results. Each group of experiments is conducted on the same device, and the experimental setting of the training round epochs is 200, the batch_size is 32, and the input image size is 640×640. Finally, the parameters, calculation amount, average mean precision mAP50, mAP50:95, and frames per second FPS of the original model, the improved single module model, and the YOLOV5 experimental results are compared.

[0078] Experimental example:

[0079] The experimental environment of the present invention is shown in Table 1.

[0080] Table 1 Experimental environment

[0081] The experimental results are shown in Table 2.

[0082] Table 2 Ablation experiment

[0083] Table 2 compares the experimental results of the original YOLOV5n, the original model after adding a single module, and YOLOV5n on the test set.

[0084] It can be seen from the table that after adding the FasterNet module, the decrease in the algorithm's mAP50 and mAP50:95 has almost no effect on performance, the number of parameters is reduced by 9.55%, and the amount of calculation is reduced by -12.20%. Introducing the CCFF module in the neck network, the number of parameters (Parameters) and the amount of calculation are greatly reduced, while mAP50 and mAP50:95 only slightly decrease. After replacing the detection head with Dyhead, mAP50 increases by 0.009, and the number of parameters and the amount of calculation increase slightly. The experimental results of the YOLOV5n model obtained after adding the three modules to YOLOV5n show the most obvious reduction in the number of parameters and the amount of calculation; the number of parameters is reduced by 34.45%, the amount of calculation is reduced by 19.51%, while mAP50 only decreases by 0.004, and mAP50:95 decreases by 0.005; FPS is improved by 21.2 compared with the baseline model. The algorithm generally meets the model size, accuracy and real-time requirements for model deployment to vehicle-mounted edge devices. Through the above comparative analysis of experimental results, the proposed lightweight autonomous driving target detection method based on YOLOV5 can meet the needs of target detection in autonomous driving, and effectively solves the problem of difficult balance between target detection model size and detection accuracy and real-time performance in the field of autonomous driving.

Claims

1. A lightweight autonomous driving target detection method based on YOLOV5, characterized in that: The following steps are involved: S1. Obtain the KITTI dataset in the field of autonomous driving, select the labeled data from it for processing, convert it from the KITTI-specific format to the YOLO format that the YOLOV5 model can process, merge the categories of the same type to remove redundant categories, and divide it into training set and validation set according to the proportion; S2. In the backbone network of the original YOLOV5 model, the C3 module is improved to create the C3_Faster module. The new module uses FasterNet_Block to replace the convolutional blocks in the original C3 module. S3, improve the C3 module in the YOLOV5 neck network and introduce RepC3 based on CNN cross-scale feature fusion; S4. Change the detection head of YOLOV5 and introduce the dynamic detection head Dynamic Head, which unifies the attention of scale perception, space perception and task perception in one framework, improving the adaptability and accuracy of the model to different scales, positions and task requirements; S5. The original YOLOV5n network model and the improved lightweight YOLOV5n model are trained on the processed KITTI dataset respectively, and the experimental results are compared and analyzed.

2. According to a lightweight autonomous driving target detection method based on YOLOV5 according to claim 1, it is characterized in that: The specific steps of S1 are as follows: Get the KITTI public 2D object detection dataset as the training set and validation set of the model; divide the processed dataset into training set and validation set according to the ratio, randomly select 1000 unlabeled pictures as the test set, merge all vehicle categories in the labeled categories into the "Car" category, merge the "Person_sitting" category and the "Pedestrian" category into one category, remove the unconventional target categories "DontCare" and "Misc" in the labeled pictures, and finally obtain a dataset containing three categories: 'Pedestrian', 'Car', and 'Cyclist'.

3. The lightweight autonomous driving target detection method based on YOLOV5 according to claim 1, characterized in that: The specific steps of S2 are as follows: FasterNet_Block is the core of the entire C3_Faster. After the output feature map from the previous layer is input to C3_Faster, it first determines whether the number of channels C1 of the received input feature map matches the number of input channels C2 expected by the module. If the number of channels does not match, a 1×1 convolution layer that adjusts the number of channels is used to change the dimension of the feature map without changing its spatial dimension. The first operation is partial convolution. The FLOPs calculation formula for partial convolution is: ; in and are the height and width of the input feature map, respectively. is the size of the convolution kernel, is the number of partial convolution channels, and the partial ratio is = When , the FLOPs of partial convolution is only 1 / 2 of that of normal convolution. ; The output of the FasterNet_Block processing enters the MLP layer, which is implemented through two 1×1 convolutional layers. First, the number of channels of the feature map is expanded, and then reduced back to the original number. In each FasterNet_Block, the feature map processed by Partial_conv and MLP will be added to the feature map before entering the FasterNet_Block to form a residual connection. After being processed by FasterNet_Block, the C3_Faster module outputs the processed feature map.

4. The lightweight autonomous driving target detection method based on YOLOV5 according to claim 1, characterized in that: The specific steps of step S3 are as follows: RepC3 consists of three parts: initial convolution layer, RepConv sequence, feature fusion and output adjustment; The initial convolution layer contains two 1×1 convolution layers cv1 and cv2, which convert the number of channels of the input feature map from C1 to the hidden channel C; The main part of the RepConv sequence is RepConv, which is a re-parameterized module that includes training and deployment states. Through this design, the model can learn features through different paths during training, and merge these paths into a more efficient convolution operation when deployed; In RepC3, the RepConv sequence enhances the feature representation of the hidden channel C by applying the RepConv layer multiple times. In the feature fusion and output adjustment stage, a 1×1 convolutional layer cv3 is used to add the feature map processed by the RepConv sequence and the output of cv2, and the number of channels of the fused feature map is adjusted from c to the number of output channels c2; The processing flow of the RepC3 module: When the input feature map x enters the RepC3 module, it is first processed by two initial convolutional layers cv1 and cv2, where the output of cv1 enters the RepConv sequence for deep feature extraction, and the output of cv2 is directly used for subsequent feature fusion. The feature map enhanced by the RepConv sequence is added to the output of cv2. In this way, features at different levels are fused. Finally, cv3 adjusts the number of channels of the fused feature map and outputs the final feature representation.

5. The lightweight autonomous driving target detection method based on YOLOV5 according to claim 1, characterized in that: The specific steps of S4 are as follows: The detection head converts the attention function into three consecutive attentions, each of which focuses on only one angle, expressed as follows: ; in are three different attention functions acting on dimensions L, S, and C respectively; The dynamic detection head enhances the model's ability to detect objects of different scales and shapes by introducing a learnable dynamic mechanism in the head of the model. The dynamic detection head integrates the above dynamic mechanism and improves the adaptability and accuracy of the detection head by cascading features of different scales and dynamically adjusting convolution kernels. Scale-aware attention , dynamically fuse features according to the semantic importance of different scales, the formula is as follows: ; in is a linear function approximated by a 1x1 convolutional layer, is a hard Sigmoid function, the feature tensor ; Spatial awareness attention , another spatially aware attention module based on fused features is used to focus on the discriminative areas that coexist consistently between spatial positions and feature levels. Considering the high dimensionality of S, this module is decomposed into two steps: first, deformable convolution is used to make the attention learning sparse, and then features are aggregated across layers at the same spatial position. The formula is as follows: ; Where K is the number of sparse sampling positions, is the position shifted by the self-learned spatial offset ∆pk, Position for self-learning Important scalar of Task-aware attention ,To achieve joint learning and generalization of different representations of objects, task-aware attention is deployed at the end, which dynamically switches the ON and OFF channels of the ,function to support different tasks; ; in is the feature slice of the cth channel, is a hyperfunction that learns to control the activation threshold, First, global average pooling is performed on the L × S dimension to reduce the dimensionality, then two fully connected layers and a normalization layer are used, and finally the output is normalized to [−1, 1] using the shifted sigmoid function; Dynamic Head is built on three 1x1 convolutional layers and one detection layer. These three convolutional layers process the inputs from the 18th, 21st and 24th layers respectively, all of which are improved RepC3 layers. Through these three 1x1 convolutional layers, the number of channels of the feature map is uniformly adjusted. The detection layer aggregates the outputs of these three convolutional layers and uses multiple DyHead blocks including scale perception, spatial perception and task perception in DyHeadBlock. These blocks are stacked in sequence to process the input data.

6. The lightweight autonomous driving target detection method based on YOLOV5 according to claim 1, characterized in that: The specific steps of step S5 are as follows: The original YOLOV5n network model and the improved lightweight YOLOV5n model were trained on the processed KITTI dataset respectively. To ensure the rigor of the experiment, comparative experiments of C3_Faster, RepC3, and Dynamic Head single module improvements were set up respectively. The impact of the single module on the model was proved by analyzing the experimental results. Each group of experiments was carried out on the same device. The experimental training round epochs was set to 200, the batch size batch_size was set to 32, and the input image size was set to 640×640. Finally, the parameters, calculation amount, average mean accuracy mAP50, mAP50:95 and frames per second FPS of the original model, the improved single module model, and the YOLOV5 experimental results were compared.

Citation Information

Cited By

  • Production line aluminum alloy ingot surface defect detection method, device and system and storage medium

    CN119671975A

  • Urban scale solid waste landfill site identification method based on artificial intelligence target identification algorithm

    CN120544041A

  • Coordinated multi-scale feature enhancement network-based driving scene multi-task perception method

    CN120564151A

  • A Multi-Task Perception Method for Driving Scenes Based on Coordinated Multi-Scale Feature Enhancement Networks

    CN120564151B

  • Multi-scale road vehicle detection method based on re-parameterized visual converter

    CN120564164A