Vehicle identification method based on improved YOLOv11 algorithm
By introducing the PConv and Dynamic Head modules into the YOLOv11 algorithm and optimizing the network structure, the YOLO algorithm's insufficient multi-feature extraction capability and model redundancy problems are solved, achieving lightweight and efficient vehicle detection suitable for autonomous driving systems.
Patent Information
- Application Number
- CN202510874373.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-09-23
AI Technical Summary
The existing YOLO algorithm has shortcomings in terms of limited multi-feature extraction capabilities, slow model convergence speed and large number of parameters, making it difficult to meet the requirements of autonomous driving technology for detection accuracy and lightweight.
The partial convolution (PConv) module and the dynamic head (Dynamic Head) module are introduced to optimize the YOLOv11 network structure. Partial convolution reduces redundant calculations, and the dynamic head enhances the multi-scale feature fusion capability to build a lightweight vehicle detection model.
It significantly reduces the model weight and improves vehicle recognition accuracy and robustness. It is suitable for embedded devices with limited computing resources and improves vehicle detection performance in autonomous driving scenarios.
Smart Images

Figure CN120689833A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of target detection, and in particular to a vehicle recognition method based on an improved YOLOv11 algorithm. Background Art
[0002] With the rapid development of autonomous driving technology, the vehicle's environmental perception capability has become key to achieving autonomous driving. As an important component of environmental perception, object detection's performance directly affects the safety and reliability of autonomous driving systems. In recent years, deep learning-based object detection algorithms have made significant progress. Among them, the YOLO (You Only Look Once) series of algorithms has been widely used in the field of real-time object detection due to its fast speed and easy implementation.
[0003] The YOLO algorithm can predict multiple targets in an image, their categories, and locations through a single forward propagation, and has a high detection speed. However, as autonomous driving technology places increasing demands on detection accuracy and lightweightness, the existing YOLO algorithm has shortcomings in the following aspects: 1. Limited multi-feature extraction capabilities: YOLO's multi-scale feature extraction still has room for optimization, and the accuracy of target detection in complex backgrounds needs to be improved. 2. Slow model convergence: During the training process, the model takes a long time to achieve good performance, which limits the rapid iteration and optimization of the algorithm. 3. Large number of parameters: In order to improve detection accuracy, it is usually necessary to increase the number of model parameters, which leads to an increase in model size and is not conducive to deployment on embedded devices with limited computing resources. Summary of the Invention
[0004] To address the above technical issues, the present invention provides a vehicle recognition method based on an improved YOLOv11 algorithm. By introducing a partial convolution (PConv) module and a dynamic head module, the existing model is significantly lightweighted, improving the accuracy and robustness of vehicle recognition. To address the shortcomings of existing technologies in feature extraction efficiency, multi-scale feature fusion, and high computational complexity, the present invention optimizes the network structure of the YOLOv11 algorithm, thereby lightweighting the network and improving vehicle detection performance in complex traffic environments in autonomous driving scenarios.
[0005] The technical solution is: S1, constructing a vehicle detection dataset and preprocessing it; The vehicle recognition dataset includes a training set, a validation set, and a test set. The dataset is divided into 2634 training sets, 966 validation sets, and 458 test sets. The pretreatment comprises the following steps: Filter the images and unify the image pixel size; The vehicle detection categories are divided into 12 types: 'bigbus', 'big truck', 'bus-l-', 'bus-s-', 'car', 'mid truck', 'small bus', 'small truck', 'truck-l-', 'truck-m-', 'truck-s-', and 'truck-xl-' to enhance the adaptability of the algorithm in diverse scenarios. Create an image dataset containing 2D bounding boxes. The image format is JPG. All images are from a highway environment. Perform data augmentation on the training set, including rotation, flipping, and scaling operations, to improve the generalization ability of the model.
[0006] S2. Build a data configuration file based on the preprocessed data set, set YOLOv11 model parameters, and build a basic YOLOv11 model; wherein the YOLOv11 model is its lightweight version YOLOv11n model; Based on the original network structure of YOLOv11, configure the initial parameters, including the number of network layers, learning rate, and batch size, and initialize the model weights.
[0007] S3. Optimize the structure of the YOLOv11n model. The optimization includes: A partial convolution (PConv) module is introduced into the backbone network to perform convolution operations on only some input channels to reduce redundant calculations. Integrate the Dynamic Head module into the network to enhance feature fusion capabilities using scale-aware, spatial-aware, and task-aware attention mechanisms. The optimized YOLOv11n model includes a backbone network, a neck network, and a head network. The backbone network is used to extract efficient spatial features, the neck network is used for feature fusion, and the head network is used for classification and bounding box regression. Partial Convolution (PConv) module: This module introduces partial convolution into the YOLOv11 backbone network. This module performs regular convolution operations on some channels of the input feature map and directly passes the remaining channels. This reduces redundant computation and memory access, thereby improving feature extraction efficiency. This module is particularly suitable for detecting small objects and vehicles in complex backgrounds. Dynamic Head: This feature is added to the YOLOv11 network. It uses a three-dimensional attention mechanism based on scale awareness, spatial awareness, and task awareness to enhance the fusion of multi-scale features and improve the model's detection accuracy for vehicles of different sizes and spatial positions. S4. Use the preprocessed dataset to iteratively train the optimized YOLOv11n model; Initialize model parameters using pre-trained weights; The stochastic gradient descent (SGD) optimizer is used, the number of iterations is set to 100, and mixed precision training technology is combined to accelerate the training process; The model weights are adjusted through the back-propagation algorithm and gradient descent optimization method until the loss function converges or the mAP value stabilizes.
[0008] S5. Use the validation set to verify the trained model, output the target category and corresponding bounding box, and implement the vehicle detection function; The validation set is used to evaluate the model performance. The indicators include precision, recall rate and mAP. The effect parameters of the original YOLOv11n model and the improved model are shown in the attached figure. Figure 6 , the original YOLOv11n model detection effect is as shown in the attached Figure 7 , the improved detection effect is as shown in the attached Figure 8 .
[0009] A computer device comprises a memory and a processor, wherein the memory is used to store a computer program, and wherein the processor is used to implement the steps of the method according to any one of claims 1 to 4 when executing the computer program.
[0010] A computer-readable storage medium storing a computer program, characterized in that when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
[0011] The beneficial effects of the technical solution provided by the embodiment of the present invention are: the improved YOLOv11 network of the present invention can significantly lightweight the model while speeding up the model's operation and improving the accuracy of target detection; through this method, a lightweight and efficient target detection solution is provided for the development of autonomous driving technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 It is the overall structural flow chart of the present invention.
[0013] Figure 2 It is a schematic diagram of the overall structure of the present invention based on YOLOv11.
[0014] Figure 3 This is a schematic diagram of the overall structure of the improved YOLOv11 of the present invention.
[0015] Figure 4 This is the effect diagram of the Pconv model of the present invention and the original convolution model.
[0016] Figure 5 Schematic diagram of the Dynamic Head model of the present invention.
[0017] Figure 6 This is a comparison chart of the data before and after the improved YOLOv11n of the present invention.
[0018] Figure 7 This is a diagram showing the detection effect of processing the vehicle dataset based on the YOLOv11 model.
[0019] Figure 8 This is a diagram showing the detection effect of the vehicle dataset processed based on the improved model YOLOv11 in the present invention. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. Of course, the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0021] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other.
[0022] Example 1: The present invention provides a vehicle identification method based on an improved YOLOv11 algorithm, the method flow chart is as follows Figure 1 As shown, the method includes the following steps: S1. Build a vehicle detection dataset and perform preprocessing; Create a vehicle detection dataset. The dataset contains images of 2D bounding boxes and JPG format images. All images in the dataset are from a highway environment. The dataset includes: 2634 training sets, 966 validation sets, and 458 test sets. The images are filtered and the image pixel size is unified to 640×480.
[0023] The vehicle detection is categorized into 12 types: 'big bus', 'big truck', 'bus-l-', 'bus-s-', 'car', 'midtruck', 'small bus', 'small truck', 'truck-l-', 'truck-m-', 'truck-s-', and 'truck-xl-'. This variety of label types enhances the algorithm's adaptability to diverse environments.
[0024] S2. Build a data configuration file based on the preprocessed data set, set the YOLOv11 model parameters, and build a basic YOLOv11 model; After preprocessing, build the dataset configuration file corresponding to the dataset, import the paths of the training set and validation set as well as the identification information in the dataset configuration file, modify the YOLOv11 parameters according to the experimental requirements, and adjust the input image size to 640×480; The number of model iterations is 100, the batch size is 4, and the number of detection object categories is 12. The present invention compares different model configuration files and selects the YOLOv11n model.
[0025] The YOLOv11 model is usually divided into multiple variants based on actual application requirements, such as YOLOv11n, YOLOv11s, YOLOv11m, YOLOv11l, etc. Among them, "n" stands for nano (lightweight), which is the model version with the fewest parameters and the lowest computational complexity in the YOLOv11 series.
[0026] Compared with the standard YOLOv11 model, the YOLOv11n model has the following characteristics: ① Fewer parameters: YOLOv11n adopts a shallower network structure and channel compression strategy, which greatly reduces the overall number of model parameters and is suitable for deployment on edge devices or mobile platforms; Lower computational complexity: The YOLOv11n model has significantly lower FLOPs than the standard version, improving inference speed while maintaining basic detection performance. ③ Stronger adaptability: YOLOv11n is particularly suitable for resource-constrained environments, such as in-vehicle systems and embedded vision devices, and is particularly suitable for real-time vehicle detection tasks in autonomous driving systems; Therefore, in the present invention, YOLOv11n is preferably selected as the basic model architecture, combined with structural optimization and lightweight strategy, which not only ensures detection accuracy but also meets high real-time and low power consumption requirements.
[0027] S3. Optimize the structure of the YOLOv11n model. The optimization includes: A partial convolution (PConv) module is introduced into the backbone network to perform convolution operations on only some input channels to reduce redundant calculations. Integrate the Dynamic Head module into the network to enhance feature fusion capabilities using scale-aware, spatial-aware, and task-aware attention mechanisms. The optimized YOLOv11n model includes a backbone network, a neck network, and a head network. The backbone network is used to extract efficient spatial features, the neck network is used for feature fusion, and the head network is used for classification and bounding box regression. The basic model structure of YOLOv11n is as follows Figure 2 As shown in the figure, this embodiment systematically optimizes the YOLOv11n model to meet the needs of lightweight vehicle detection. Specific improvements include: introducing partial convolution in the backbone network to improve feature extraction efficiency; integrating a dynamic head module in the network to enhance multi-scale feature fusion capabilities; These improvements aim to address the issues of redundant feature extraction, insufficient multi-scale target perception, and slow convergence of bounding box regression in the YOLOv11 algorithm, thereby improving the performance of vehicle detection while reducing the network structure. The improved model structure is shown in the attached figure. Figure 3 As shown, each optimization module is described in detail below; The core of PConv is to perform standard convolution operations on only some channels of the input feature map, and directly pass on the remaining channels, reducing redundant calculations while maintaining feature expression capabilities, as shown in the attached Figure 4 shown.
[0028] The mathematical expression of the partial convolution is:
[0029] in, F in is the input feature map, c is the total number of input channels, c p is the number of channels involved in convolution, Conv represents conventional convolution operation, and Concat represents feature concatenation.
[0030] Pconv only applies filters on a few input channels, while the rest of the channels remain unchanged, and the FLOPs are lower than regular convolution. The floating point operations (FLOPs) of PConv are only:
[0031] For the input feature map F in ∈R H×W×C (H is height, W is width, C is number of channels), according to the preset partial ratio r=c p / C(c p is the number of channels involved in convolution), the traditional partial ratio r=c p When / c=1 / 4, the FLOPs of PConv is only 1 / 16 of that of conventional Conv.
[0032] In addition, PConv has a smaller memory access volume. For r=1 / 4, it is only 1 / 4 of the regular convolution:
[0033] In this embodiment, PConv is embedded in multiple stages of the YOLOv11 backbone network (replacing standard convolutions in some C2f modules) to provide high-quality input for the subsequent neck network by extracting efficient spatial features layer by layer.
[0034] This embodiment introduces a dynamic head module into the network, using a multi-dimensional attention mechanism to uniformly enhance the scale perception, spatial perception, and task perception capabilities of features. The core of the dynamic head is to integrate the three key dimensions of object detection, scale, space, and task, into a dynamic head through the attention mechanism.
[0035] As attached Figure 5 The specific implementation steps are as follows: Input feature definition: Assume that the multi-scale feature tensor received by the network is F in ∈R L×S×C (L is the number of feature levels, S is the spatial dimension, and C is the number of channels).
[0036] Scale-aware attention (π L ): Dynamically weighted fusion of multi-scale features through linear transformation and hard-sigmoid function, and the features of each level Apply 1×1 convolution to generate weights ,Then the weighted features are calculated. This step enhances the adaptability of the model to vehicles of different sizes (such as small cars and buses); Scale-aware attention π L Dynamically fuse features of different scales according to semantic importance:
[0037] in f (·) is the linear function approximated by the 1×1 convolutional layer, σ (x) = max (0, min(1, (x+1) / 2)) is the hard-sigmoid function.
[0038] Spatial perception attention (π S ): Sparse sampling of the spatial position of the feature map based on deformable convolution, by learning the offset Δ p Each sampling point is adaptively adjusted to generate sparse features. This step enables the model to focus on key spatial locations in areas with dense or occluded vehicles.
[0039] Spatial Perception Attention π S Taking into account S The high dimensionality of ,focuses on the discriminative regions that coexist consistently between ,spatial locations and feature levels, and is decomposed into two steps: First, attention learning is made sparse by using deformable convolutions, and then features are aggregated across levels at the same spatial location:
[0040] Kis the number of sparse sampling locations, Indicates that in the spatial perception attention module, for the feature level and k The weights of the sparsely sampled locations, Position offset caused by self-learning space offset To focus on the discrimination area, is the position p k The self-learning importance scalar at .
[0041] Task-aware attention (π C ): Optimize feature responses for classification and regression tasks through adaptive activation in the channel dimension.
[0042] Task-aware attention π C It can achieve joint learning and representation of different objects, dynamically switching the opening and closing channels of functions to support different tasks:
[0043] in F c is the characteristic of channel c, [α1; α2; β1; β2] T = θ(·) is a hyperfunction that learns to control the activation threshold. θ(·) first performs global average pooling on the L×S dimension to reduce the dimensionality, then uses two fully connected layers and a normalization layer, and finally applies a shifted sigmoid function to normalize the output to [-1; 1]. The three attention mechanisms act on the input features in turn to form the dynamic head output W ( F ):
[0044] The introduction of Dynamic Head enables the network to dynamically adjust feature representations, significantly improving the ability to detect multi-scale targets. It performs well in the highway vehicle detection task of this embodiment, especially when dealing with targets with large scale differences, such as small vehicles and large trucks.
[0045] In this embodiment, Dynamic Head replaces the original head structure of YOLOv11, directly receives multi-scale feature output, and generates enhanced feature maps for subsequent bounding box prediction.
[0046] S4. Iteratively train the optimized YOLOv11n model using the preprocessed dataset. After the preprocessed dataset is divided into a training set, it is fed into the hyperparameter-optimized YOLOv11n network architecture for iterative training. Training is terminated when the number of training rounds reaches 100 epochs. At this point, the loss function curve of the model on the validation set tends to converge, and the mAP indicator fluctuation range is less than 1%, indicating that the model has achieved good performance. Finally, save the trained YOLOv11n model weight file for subsequent reasoning tasks.
[0047] S5. Use the validation set to verify the trained model, output the target category and corresponding bounding box, and implement the vehicle detection function; Based on the trained YOLOv11n model, highway vehicle video streams or static images are input into the model. Leveraging YOLOv11's multi-scale feature extraction capabilities, a convolutional neural network is used to perform feature extraction and spatial transformation on the input data. The model uses a non-maximum suppression algorithm in the output layer to process the prediction box, effectively filtering overlapping detection results, and ultimately outputs the vehicle bounding box with a confidence score and its corresponding category label. During the detection process, the system can display the detection results in real time.
[0048] Attachment Figure 6 The running results of the YOLOv11n basic model and the improved model show that the number of parameters has been reduced from 2,584,492 to 2,236,920, a decrease of about 13.4% (347,572 parameters). The model is more efficient in terms of storage requirements and memory usage, making it suitable for deployment on embedded devices or mobile devices. The computational workload is reduced: GFLOPs are reduced from 6.3 to 5.8, a reduction of approximately 7.9% (0.5 GFLOPs). This reduces the computational complexity of the model and potentially increases inference speed. The introduced PConv and DynamicHead optimize the model structure and reduce redundant calculations while maintaining the core feature extraction capabilities.
[0049] Attachment Figure 7 and attached Figure 8 For the detection results of the same picture, Figure 8 This is the improved YOLOv11. It can be seen that the improved vehicle detection is lightweight while making the model performance slightly improved.
[0050] Embodiment 2: This is the second embodiment of the present invention, which is different from the previous embodiment in that: The computer device can be a server, an embedded device, or intelligent hardware with certain processing capabilities. It includes hardware units such as a processor, memory, input / output interfaces, and a communication interface. The processor is used to load and execute the computer program of the present invention to complete the various processing tasks of the vehicle detection method; the memory is used to store the computer program and intermediate data, as well as trained model weight files; and the communication interface and input / output interface are used to exchange data and transmit control commands with external devices (such as cameras, vehicle buses, and display terminals).
[0051] In operation, the processor executes the program in the memory to implement the steps described in claims 1 to 4, including data preprocessing, model construction and optimization, model training, and detection result output. The processor can also cooperate with the communication interface to perform remote data synchronization and model updates.
[0052] The computer device's memory may include both volatile and non-volatile storage media. For example, volatile storage media may include random access memory (DRAM) and static random access memory (SRAM). Non-volatile memory may include read-only memory (ROM), magnetic tape, flash memory, hard disks, and other types of memory, as well as newer memory devices such as phase change memory (PCM), ferroelectric random access memory (FRAM), and resistive random access memory (ReRAM). These memory devices can be used to store the program code, model parameters, and operation log data of the present invention.
[0053] In addition, this embodiment further includes a computer-readable storage medium storing a computer program. When the program is executed on a processor, the program implements all steps of the above-described vehicle identification method. The storage medium may be a magnetic disk, an optical disk, a flash memory, a ROM, an EPROM, an EEPROM, a magnetic tape, a floppy disk, a memory card, or other medium capable of storing program code. The program may be stored in source code, object code, an executable file, or other form.
[0054] Through the hardware and software integration implementation method described in this embodiment, the present invention can be deployed on a variety of computing platforms and is suitable for smart car systems, edge servers, embedded terminals or cloud-based intelligent detection platforms, with high scalability and application flexibility.
[0055] For ordinary technicians in this field, the specific meanings of the above terms in the patent creation of this invention can be understood through specific circumstances.
[0056] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A vehicle recognition method based on an improved YOLOv11 algorithm, characterized in that: The following steps are involved: S1. Build a vehicle detection dataset and perform preprocessing; S2. Build a data configuration file based on the preprocessed data set, set the YOLOv11 model parameters, and build a basic YOLOv11 model; The YOLOv11 model is its lightweight version, the YOLOv11n model. S3. Optimize the structure of the YOLOv11n model. The optimization includes: A partial convolution (PConv) module is introduced into the backbone network to perform convolution operations on only some input channels to reduce redundant calculations. Integrate the Dynamic Head module into the network to enhance feature fusion capabilities using scale-aware, spatial-aware, and task-aware attention mechanisms. The optimized YOLOv11n model includes a backbone network, a neck network, and a head network. The backbone network is used to extract efficient spatial features, the neck network is used for feature fusion, and the head network is used for classification and bounding box regression. S4. Iteratively train the optimized YOLOv11n model using the preprocessed dataset. S5. Use the validation set to verify the trained model, output the target category and corresponding bounding box, and implement the vehicle detection function.
2. The vehicle recognition method based on the improved YOLOv11 algorithm according to claim 1, characterized in that: The partial convolution (PConv) module includes the following steps: Perform standard convolution operations on some channels of the input feature map to generate corresponding feature outputs; The remaining unconvolved input channels are passed directly and concatenated with the convolution output channels; The splicing results are then subjected to feature fusion through subsequent point convolution operations to generate an enhanced feature map; Among them, the ratio of the number of channels involved in convolution to the total number of channels is the partial ratio r = cp / c.
3. The vehicle recognition method based on the improved YOLOv11 algorithm according to claim 2, characterized in that: The Dynamic Head module includes: Scale-aware attention mechanism, which is used to dynamically weight and fuse different feature levels based on semantic information, enhancing the model's ability to recognize multi-scale objects; The spatially aware attention mechanism introduces deformable convolution to sparsely sample feature maps and aggregate cross-level features based on spatial locations to enhance the model's attention to discriminative regions. The task-aware attention mechanism adaptively activates channel-dimensional features to adapt feature representation to classification tasks and bounding box regression tasks respectively. The three attention mechanisms are nested and combined in sequence to form a dynamic head module.
4. The vehicle recognition method based on the improved YOLOv11 algorithm according to claim 3 is characterized in that: The training includes the following steps: The optimized YOLOv11n model was iteratively trained using the training set with 100 training rounds and a batch size of 4. The loss function and mean average precision (mAP) were monitored. Training was terminated and the model weight file was saved when the loss function on the validation set converged and the mAP fluctuation was less than 1%.
5. The vehicle recognition method based on the improved YOLOv11 algorithm according to claims 1-4, characterized in that: in, It also includes lightweight processing of the optimized YOLOv11n model, including: The partial convolution module (PConv) is used in the backbone network to reduce redundant calculations and memory access, thereby reducing the number of model parameters and floating-point operations (FLOPs). Optimize the structural depth and computational complexity of the dynamic head module.
6. A computer device comprising a memory and a processor, wherein the memory is used to store a computer program, wherein: The processor is configured to implement the steps of the method according to any one of claims 1 to 4 when executing the computer program.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Cited By
Road reconstruction and expansion old shoulder pavement milling boundary determination method based on image recognition
CN122335891A