Vehicle target detection method and system based on improved YOLOV12N

CN122473438BActive Publication Date: 2026-10-13NANCHANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610975830.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-07-02
Publication Date
2026-10-13
Estimated Expiration
2046-07-02

AI Technical Summary

Technical Problem

[0006]本申请提供一种基于改进YOLOV12N的车辆目标检测方法及系统,可以解决了现有车辆目标检测在复杂场景下因特征提取能力不足导致的对小目标及遮挡重叠目标漏检、误检的技术问题

Benefits of technology

通过主干网络中采用双分支结构设计的StarConverse2DC3k2模块,结合StarConverse2DBlock模块的频域特征重建与分支特征相乘增强非线性交互的特性,显著提升了特征提取的精准度与表达能力,有效改善了小目标与遮挡目标的检测效果;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122473438B_ABST
    Figure CN122473438B_ABST
Patent Text Reader

Abstract

The application discloses a vehicle target detection method and system based on improved YOLOV12N. The method constructs an improved model by reconstructing a backbone network and optimizing a loss function. The backbone network adopts a StarConverse2DC3k2 module to replace an original module, and the double branches of the StarConverse2DC3k2 module are spliced and output after being processed by a StarConverse2DBlock module. The Block module uses Converse2D deconvolution to solve the optimal solution of feature reconstruction in the frequency domain, and enhances the non-linear interaction by multiplying the branch features. The loss function adopts Inner-Wise-IoUv3, which allocates gradient gain through a dynamic non-monotonic focusing mechanism, and distinguishes overlapping targets by combining the similarity of the feature vectors of the intersection region of the predicted frame and the real frame. The vehicle image to be detected is input into the model to obtain the detection result. The application significantly improves the feature extraction accuracy and effectively improves the detection effect of small targets and occluded targets.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision technology, and specifically to a vehicle target detection method and system based on an improved YOLOv12N. Background Technology

[0002] Computer vision, as a crucial branch of artificial intelligence, is profoundly changing people's daily lives. This technology empowers machines to "see," enabling them to recognize and understand content in images and videos. From smartphones to industrial automation, computer vision applications are ubiquitous, significantly improving efficiency and convenience. Examples include facial recognition unlocking, medical image analysis, autonomous vehicles, video surveillance analysis, and smart home control. It has greatly propelled the intelligent transformation of society and the development of social productivity.

[0003] Currently, deep learning-based object detection algorithms are rapidly developing. For vehicle detection, recognition in some simple scenarios is no longer a problem. However, complex scenes present challenges due to variations in lighting, occlusion, and cluttered backgrounds. For example, glaring light can make object recognition unclear, vehicles blend into the background and are difficult to detect in low-light conditions at night, and rain, snow, and fog can also cause interference. Furthermore, complex scenes require real-time processing capabilities to quickly respond to environmental changes and ensure stable performance. Therefore, additional object detection techniques are needed to address these challenges, including image preprocessing, image enhancement, and image dehazing, to improve the anti-interference ability and fault tolerance in complex scenes, and to enhance the accuracy and robustness of the model.

[0004] Beyond the challenges posed by the aforementioned changes in scenarios, vehicle targets also involve the problem of densely packed targets, with a large number of small targets, leading to missed detections and misidentification. If the dataset resolution is insufficient, detecting these small vehicle targets becomes even more difficult. Furthermore, the illumination aperture of vehicle headlights significantly impacts the detection of object bounding boxes. Therefore, improving the accuracy and performance of vehicle target detection is crucial for optimizing traffic flow management, enhancing urban monitoring capabilities, and supporting urban and transportation planning.

[0005] In current research on deep learning object detection, the design of network frameworks can be mainly divided into the following two categories: The first type is a two-stage object detector based on candidate boxes. The main methods used by this type of object detector are: first, to extract features through the backbone network to process the target information features; second, to input the feature information into the region candidate box network to generate candidate regions; and then to detect and generate target bounding boxes from the candidate regions. The second type is a single-stage object detector based on regression calculation. This detector can directly generate detection results, namely class probabilities and bounding box coordinates, and can complete the detection in only one stage. Examples include SSD and YOLO. Summary of the Invention

[0006] This application provides a vehicle target detection method and system based on an improved YOLOV12N, which can solve the technical problem of missed detection and false detection of small targets and occluded / overlapping targets caused by insufficient feature extraction capabilities in complex scenarios in existing vehicle target detection.

[0007] This invention is achieved through the following technical solution: In a first aspect, this application provides a vehicle target detection method based on an improved YOLOV12N, comprising the following steps: An improved YOLOv12N model is constructed by reconstructing the backbone network modules and optimizing the loss function strategy. In the improved YOLOv12N model backbone network, the original C3k2 module is replaced by the StarConverse2DC3k2 module. The StarConverse2DC3k2 module includes a first branch and a second branch. The first branch is processed sequentially through a first convolutional layer, a batch normalization layer, an activation function layer, and two consecutive StarConverse2DBlock modules. The second branch is processed by a StarConverse2DBlock module. The outputs of the first branch and the second branch are concatenated and then sequentially processed through a second convolutional layer, a batch normalization layer, and an activation function layer before outputting. The StarConverse2DBlock module uses Converse2D deconvolution to solve for the optimal solution of feature reconstruction in the frequency domain, and enhances nonlinear interaction through branch feature multiplication; The improved YOLOv12N model uses the Inner-Wise-IoUv3 loss function, which allocates differentiated gradient gains through a dynamic non-monotonic focusing mechanism and combines the similarity of feature vectors in the intersection region of the predicted box and the ground truth box to distinguish the internal content of overlapping targets. Acquire images of the vehicle to be detected; The vehicle image is input into the improved YOLOv12N model for feature extraction and target detection to obtain the vehicle target detection results.

[0008] Furthermore, the processing procedure of the StarConverse2DBlock module includes: The input feature map is received and processed sequentially through a 3×3 Converse2D deconvolution layer, a batch normalization layer, and an activation function layer to obtain a first intermediate feature map. The first intermediate feature map is divided into two sub-branches. The first sub-branch is processed by the fourth convolutional layer, the batch normalization layer and the activation function layer in sequence. The second sub-branch is processed by the fifth convolutional layer and the batch normalization layer in sequence. The outputs of the first sub-branch and the second sub-branch are multiplied element-wise to obtain the second intermediate feature map. The second intermediate feature map is processed by the sixth convolutional layer, the batch normalization layer, the seventh convolutional layer, the batch normalization layer, and the activation function layer to output the feature map of the StarConverse2DBlock module.

[0009] Furthermore, the seventh convolutional layer in the StarConverse2DBlock module is a Converse2D deconvolutional layer, which achieves feature reconstruction through frequency domain optimization.

[0010] Furthermore, before inputting the vehicle image into the improved YOLOv12N model, a step of data augmentation processing on the initial dataset is included, the data augmentation processing including at least one of the following: Mosaic enhancement, image blending, copy and paste, random flipping, random scaling, random color transformation, and random affine transformation.

[0011] Furthermore, the Inner-IoU loss function calculates the similarity of feature vectors within the intersection region of the predicted bounding box and the ground truth bounding box using the following formula: ; in, This represents the intersection area between the predicted bounding box and the ground truth bounding box. The feature vector at position p. To prevent division by zero of small constants.

[0012] Furthermore, the Wise-IoUv3 loss function introduces a dynamic non-monotonic focusing mechanism, which measures the anchor box quality by defining an outlier β, and assigns differentiated gradient gains to prediction boxes of different qualities based on the outlier β; the formula for calculating the outlier β is as follows: ; in, This is the exponential moving average of the moving average loss. The localization loss for the current sample. For moving average loss, This is the momentum coefficient.

[0013] Furthermore, the Wise-IoUv3 loss function uses the outlier β to calculate the non-monotonic focusing coefficient r, and adjusts the weight of the positioning loss based on the non-monotonic focusing coefficient r; the formula for calculating the non-monotonic focusing coefficient r is: ; in, and These are the preset hyperparameters.

[0014] Furthermore, the initial dataset is the UA-DETRAC dataset, and the method also includes preprocessing steps such as filtering, format conversion, and dividing the UA-DETRAC dataset into training and test sets.

[0015] Furthermore, the total loss function of the improved YOLOv12N model is composed of a weighted average of localization loss, confidence loss, and classification loss, with the Inner-Wise-IoUv3 loss function serving as the localization loss.

[0016] Secondly, this application provides a vehicle target detection system based on an improved YOLOV12N, comprising: An improved model building module is used to construct an improved YOLOv12N model by reconstructing the backbone network module and optimizing the loss function strategy; In the improved YOLOv12N model backbone network, the original C3k2 module is replaced by the StarConverse2DC3k2 module. The StarConverse2DC3k2 module includes a first branch and a second branch. The first branch is processed sequentially through a first convolutional layer, a batch normalization layer, an activation function layer, and two consecutive StarConverse2DBlock modules. The second branch is processed by a StarConverse2DBlock module. The outputs of the first branch and the second branch are concatenated and then sequentially processed through a second convolutional layer, a batch normalization layer, and an activation function layer before outputting. The StarConverse2DBlock module uses Converse2D deconvolution to solve for the optimal solution of feature reconstruction in the frequency domain, and enhances nonlinear interaction through branch feature multiplication; The improved YOLOv12N model uses the Inner-Wise-IoUv3 loss function, which allocates differentiated gradient gains through a dynamic non-monotonic focusing mechanism and combines the similarity of feature vectors in the intersection region of the predicted box and the ground truth box to distinguish the internal content of overlapping targets. The image acquisition module is used to acquire images of the vehicle to be detected. The vehicle target detection module is used to input the vehicle image into the improved YOLOv12N model for feature extraction and target detection, and to obtain the vehicle target detection results.

[0017] Compared with the prior art, the present invention has the following advantages and beneficial effects: By using the StarConverse2DC3k2 module with a dual-branch structure in the backbone network, and combining the characteristics of frequency domain feature reconstruction and branch feature multiplication to enhance nonlinear interaction of the StarConverse2DBlock module, the accuracy and expressive power of feature extraction are significantly improved, and the detection effect of small targets and occluded targets is effectively improved. The Inner-Wise-IoUv3 loss function used at the loss function level allocates differentiated gradient gains through a dynamic non-monotonic focusing mechanism. At the same time, it combines the similarity of feature vectors in the intersection area of ​​the predicted box and the ground truth box to distinguish the internal content of overlapping targets. This reduces gradient interference from low-quality samples and reduces mismatches in overlapping areas, making it more suitable for the needs of vehicle detection scenarios with many small targets and high occlusion overlap rates. Attached Figure Description

[0018] Figure 1 A flowchart illustrating the vehicle target detection method based on the improved YOLOV12N provided in this application embodiment; Figure 2 This is a structural diagram of the StarConverse2DBlock module provided in an embodiment of this application; Figure 3 A structural diagram of the StarConverse2DC3k2 module provided in the embodiments of this application; Figure 4 This is a diagram of the improved YOLOV12N vehicle detection network architecture provided in the embodiments of this application. Detailed Implementation

[0019] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.

[0020] First, some of the technical terms used in this application will be explained to help those skilled in the art understand this application.

[0021] YOLOV12N: You Only Look Once version 12 nano, a lightweight version 12 of the YOLO single-stage object detection algorithm; CBS: Convolution, Batch Normalization, SiLU activation function module; IoU: Intersection over Union; Converse2D: Converse2D Deconvolution; SiLU: Sigmoid Linear Unit; HSV: Hue, Saturation, Value; UA-DETRAC: Urban Traffic Surveillance Dataset for Detection, Tracking and Counting; CNN: Convolutional Neural Network; RWIoU: Region-wise Intersection over Union. Inner-IoU: Inner Intersection over Union; WIoUv3: Wise Intersection over Union version 3.

[0022] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0023] Firstly, such as Figure 1 As shown, this application provides a vehicle target detection method based on an improved YOLOv12N, including the following steps: Step S1: Construct an improved YOLOv12N model by reconstructing the backbone network modules and optimizing the loss function strategy; Step S2: Acquire an image of the vehicle to be detected; Step S3: Input the vehicle image into the improved YOLOV12N model for feature extraction and target detection, and obtain the target detection results of the vehicle.

[0024] This embodiment constructs an improved YOLOV12N model by reconstructing the backbone network module and optimizing the loss function strategy, which effectively improves the detection accuracy and speed of vehicles in complex scenarios and solves the problems of missed detection of small targets and difficulty in identifying occluded targets.

[0025] In one embodiment, step S1: constructing an improved YOLOv12N model by reconstructing the backbone network module and optimizing the loss function strategy, specifically includes the following steps: Step S11: Starting with the feature information output by the original C3k2 module, reconstruct the backbone network structure through dual-branch parallel processing to generate the optimized feature map of the StarConverse2DC3k2 module and obtain the basic improved backbone network features. like Figure 3 As shown, the StarConverse2DC3k2 module enhances feature representation capabilities by combining deep semantics with shallow details through dual-branch feature fusion.

[0026] Specifically, the module sets up a first branch and a second branch for parallel processing. The first branch is processed sequentially through a first convolutional layer (1x1 convolutional layer), a batch normalization layer, an activation function layer, and two consecutive StarConverse2DBlock modules (corresponding to the sub-modules processed by the fourth and fifth convolutional layers, respectively), extracting a deep feature map F1 rich in semantic information. The second branch is processed by a separate StarConverse2DBlock module (corresponding to the sub-module processed by the sixth convolutional layer), retaining a rich feature map F2 of edge and texture details. After concatenating F1 and F2, the output is sequentially processed through a second convolutional layer (1x1 convolutional layer), a batch normalization layer, and an activation function layer to obtain the optimized feature map of the StarConverse2DC3k2 module.

[0027] Step S12: Using the feature stream generated during the processing of the StarConverse2DC3k2 module as input, the nonlinear expression capability of the features is enhanced by multiplying the frequency domain features with the branch features, and the enhanced nonlinear feature mapping is obtained. Based on the improved backbone network features, the feature extraction capability of the backbone network is upgraded, and the upgraded backbone network is obtained. Specifically, the module's processing flow is as follows: the input feature map is processed sequentially through a 3x3 Converse2D deconvolution module (i.e., the seventh convolutional layer), a batch normalization layer, and a SiLU activation function layer to obtain a first intermediate feature map; the first intermediate feature map is divided into two sub-branches, the first sub-branch is processed sequentially through a fourth convolutional layer (1x1 convolutional layer), a batch normalization layer, and a SiLU activation function layer, and the second sub-branch is processed sequentially through a fifth convolutional layer (1x1 convolutional layer) and a batch normalization layer; element-wise multiplication is performed on the outputs of the two sub-branches to achieve non-linear interaction between features, resulting in a second intermediate feature map; the second intermediate feature map is processed sequentially through a sixth convolutional layer (1x1 convolutional layer), a batch normalization layer, a seventh convolutional layer (3×3 Converse 2D deconvolution module), a batch normalization layer, and a SiLU activation function layer to produce the module's final feature tensor.

[0028] like Figure 2 As shown, the StarConverse2DBlock module achieves feature reconstruction through the process of "frequency domain deconvolution → sub-branch feature interaction → nonlinear enhancement", in which the frequency domain deconvolution layer is the core optimization unit.

[0029] The Block module utilizes the Converse2D deconvolution module to achieve the optimal solution for feature reconstruction through frequency domain computation. It simplifies the complex spatial domain optimization problem into element-wise frequency domain operations via Fourier transform, obtaining the global optimal solution in one step. Furthermore, it enhances nonlinear interaction through branch feature multiplication. The first step is to calculate the bias as the regularization coefficient and use the Fourier transform to simplify the complex spatial domain optimization problem into element-wise frequency domain operations, thereby obtaining the global optimal solution in one step. The second step is to generate upsampled observations and initial estimates; The third step is to convert the convolution kernel to the frequency domain, perform optimization calculations in the frequency domain, and aggregate the frequency domain through segmentation and downsampling to obtain the frequency domain calculation results. The numerical stability and boundary quality are ensured by learnable regularization parameters and loop filling, which significantly improves the model's ability to accurately reconstruct features, more effectively eliminates boundary noise, and enhances robustness. The fourth step involves returning to the spatial domain via inverse Fourier transform, cropping the padding values, and applying an activation function to reconstruct a high-quality feature map.

[0030] Step S13: Using the total loss framework of the original YOLOV12N model as a basis, the gradient allocation strategy is optimized by weighted combination of Wise-IoUv3 and Inner-IoU to establish the localization constraint criteria for the improved backbone network. Specifically, the total loss of the improved YOLOv12n model is composed of a weighted average of localization loss, confidence loss, and classification loss, with the weights allocated as follows: localization loss λ=0.8, confidence loss λ=0.3, and classification loss λ=0.2 (consistent with the original YOLOv12N total loss framework). The Inner-Wise-IoUv3 loss function uses Wise-IoUv3 as its base (weight 0.7) and combines it with Inner-IoU as an auxiliary constraint (weight 0.3). By dynamically adjusting the gradient contributions of both, it utilizes the dynamic non-monotonic focusing mechanism of Wise-IoUv3 to reduce interference from low-quality samples, and reduces mismatches of overlapping targets through the internal feature similarity constraint of Inner-IoU. The Inner-Wise-IoUv3 loss function serves as the localization loss. Wise-IoUv3 assigns differentiated gradient gains to prediction boxes of different qualities through a dynamic non-monotonic focusing mechanism, first defining outlier degree. The formula for describing the quality of the anchor frame is as follows: Equation (1) in, This is the exponential moving average of the moving average loss. The localization loss for the current sample. For moving average loss, This is the momentum coefficient.

[0031] Based on outlier Calculate the non-monotonic focusing coefficient r: Equation (2) in, For low-quality samples, gradient decay rate This is the gradient gain threshold; Where α and δ are preset hyperparameters. The Wise-IoUv3 loss function is ultimately expressed as: Equation (3) In the formula, For Wise-IoUv3 loss; The basic loss is Wise-IoUv1; This is a distance penalty term; This is the standard IoU loss.

[0032] Among them, distance penalty item The calculation formula is: Equation (4) In the formula, , x and y are the coordinates of the center of the ground truth bounding box, respectively; x and y are the coordinates of the center of the predicted bounding box. , The width and height of the actual bounding box.

[0033] when When δ = , the anchor box will obtain the highest gradient gain. Since LIoU is dynamic, the anchor box quality division criteria are adaptively adjusted with the training process to achieve dynamic optimization allocation of gradient gain.

[0034] Inner-IoU distinguishes overlapping targets by measuring the similarity of feature vectors within the intersection region of the predicted bounding box and the ground truth bounding box, thus accurately locating and optimizing the target. The calculation formula is: Equation (5) in, This represents the intersection area between the predicted bounding box and the ground truth bounding box. Let p be the predicted feature vector. Let p be the true feature vector. To prevent small constants from being divided by zero, It is an L2 norm.

[0035] Inner-IoU loss The calculation method is as follows: Equation (6) In the formula, For standard intersection-union ratio, This represents internal similarity.

[0036] Step S14: Integrate the upgraded backbone network with the established positioning constraint criteria to assemble the improved YOLOv12N model. Preferably, during the model building process, only the feature extraction module and loss function of the backbone network are improved, while the original YOLOV12N detection head and neck network design is retained to maintain the lightweight characteristics and real-time detection capability of the model.

[0037] This embodiment enhances the multi-scale feature fusion capability of the backbone network through the StarConverse2DC3k2 module, improves the detection accuracy of small and occluded targets by utilizing the frequency domain optimization characteristics of Converse2D deconvolution, reduces the interference of low-quality samples through the dynamic gradient allocation mechanism of the Inner-Wise-IoUv3 loss function, and alleviates the problem of mismatch of overlapping targets by combining internal feature similarity constraints, thus providing a high-precision and robust model foundation for vehicle detection in complex traffic scenarios.

[0038] The improved YOLOv12N network structure is as follows: Figure 4As shown, the input is a 640×640×3 RGB image. Initial downsampling is performed using two convolutional layers with a stride of 2, reducing the feature map resolution to 320×320×16 and 160×160×32 respectively. In the backbone network, a custom StarConverse2DC3k2 module replaces the original C3k2 module. This dual-branch structure extracts semantically rich deep features and preserves shallow details of edge textures. The frequency domain deconvolution of the StarConverse2DBlock module, combined with the multiplication of branch features, enhances non-linear interactions. The A2C2f module is embedded at different depths to mine multi-scale features. The neck network uses a top-down and bottom-up path aggregation structure to splice and fuse deep semantic features with shallow spatial features across layers, generating three sets of multi-scale feature maps of 80×80×64, 40×40×128, and 20×20×256. Finally, three parallel detection heads output bounding box coordinates, class confidence, and location confidence for large, medium, and small targets, respectively. While retaining the lightweight characteristics of the original YOLOV12N, the detection accuracy of small targets and occluded targets in complex traffic scenarios is significantly improved.

[0039] In one embodiment, step S2: acquiring the image of the vehicle to be detected specifically includes the following steps: Step S21: Collect and organize the vehicle image data sources to be detected, parse and annotate the original video streams, and obtain an initial image dataset containing multiple scenes and weather conditions. Specifically, the data source used was the UA-DETRAC dataset, which was collected from 24 urban road monitoring points in Beijing and Tianjin. It consisted of 10 hours of video streams recorded by a Canon EOS 550D camera with a resolution of 960×540, covering typical traffic scenarios such as urban streets, highways, and intersections.

[0040] The video sequence consists of 100 independent videos, of which 60 segments (approximately 82,085 frames) are used for the training set and 40 segments (approximately 56,167 frames) are used for the test set, ensuring temporal continuity and scene independence.

[0041] The dataset mainly includes four vehicle categories: cars, buses, vans, and others. It contains 8,250 unique vehicles with 1.21 million manually annotated bounding boxes. The average vehicle density per frame is 8.6 vehicles, which can fully simulate high-volume traffic pressure.

[0042] Regarding weather, the dataset includes four scenarios: cloudy, nighttime, sunny, and rainy; regarding occlusion, it covers three scenarios: unobstructed, partially obstructed, and heavily obstructed; and regarding vehicle motion, it includes four types: constant speed, acceleration, turning, and stationary.

[0043] Step S22: Perform various data augmentation operations on the initial image dataset. After feature perturbation and scene simulation, an expanded set of vehicle images to be detected is generated. Data augmentation includes the following operations: Mosaic enhancement involves randomly selecting four images, performing independent augmentation on each, and then stitching them together to form a single image. Image mixing: Two sample images are randomly selected and mixed proportionally, and the classification results are distributed in the same proportion. Copy and paste a random subset of an image to a random location in another image to simulate object occlusion and overlap in a real-world scene. Random Flip: Performs a horizontal or vertical flip on the image; Random scaling: Randomly adjusts the image size to simulate targets at different scales; Random color transformation: Randomly adjusts the hue, saturation, and brightness channel values ​​in the HSV color space; random affine transformation performs a linear transformation and translation operation that includes rotation, translation, scaling, and shearing.

[0044] Preferably, during data augmentation, the weights of each augmentation operation are adjusted according to the actual needs of the scene to be detected. For example, in areas where nighttime scenes account for a high proportion, the weight of random color transformation is increased to simulate different lighting conditions; in areas with severe occlusion, the weight of copy-paste operation is increased to enhance the model's ability to recognize overlapping targets. In specific implementation, the probability of each augmentation operation can be dynamically adjusted based on statistical data from actual traffic scenarios. For example, for rain and fog weather datasets, the weights of random color transformation and random scaling are increased to simulate changes in target features under low visibility conditions.

[0045] This embodiment acquires vehicle images from standardized traffic scene data sources and expands the dataset diversity by combining diverse data enhancement operations. This effectively covers vehicle features under complex weather, occlusion, and multi-scale scenarios, providing a sufficient and representative sample base for subsequent model training and inference, and improving the model's adaptability and detection robustness to different traffic scenarios.

[0046] In one embodiment, step S3: Inputting the vehicle image into the improved YOLOv12N model for feature extraction and target detection, and obtaining the vehicle target detection result, specifically includes the following steps: Step S31: Convert the image of the vehicle to be detected into an input format that is adapted to the improved YOLOV12N model. After size normalization and numerical standardization, a standardized image is obtained. Specifically, the preprocessing process maintains the original aspect ratio of the image, scales the image to the input resolution required by the model, and maps the pixel values ​​to a uniform numerical range to eliminate numerical differences between different acquisition devices and ensure the consistency of model inference.

[0047] Step S32: Input the standardized image into the backbone network of the improved YOLOV12N model, and extract multi-scale vehicle features through the dual-branch feature fusion processing of the StarConverse2DC3k2 module to obtain a deep feature map rich in semantic information. Specifically, each StarConverse2DC3k2 module in the backbone network mines deep semantics through two consecutive StarConverse2DBlock modules in the first branch, while a single StarConverse2DBlock module in the second branch preserves shallow details. The feature map output after splicing takes into account both semantic abstraction and spatial accuracy, effectively capturing the subtle features of small targets and occluded targets.

[0048] Step S33: Input the deep feature map into the detection head of the improved YOLOV12N model, and generate preliminary detection results including location, category and confidence by bounding box coordinate regression and vehicle category probability calculation. Specifically, the detection head uses the original three-layer detection structure of YOLOV12N, which corresponds to large, medium and small scale targets respectively, to ensure that vehicle features at each scale can be accurately identified and avoid missed detections due to scale changes.

[0049] Preferably, random operations during training are disabled during the inference phase, and the model parameters and the running mean of batch normalization are fixed to ensure the stability and repeatability of the detection results.

[0050] This embodiment utilizes hierarchical feature extraction and precise detection head inference, leveraging the improved YOLOv12N model's adaptability to complex scenes, to efficiently output the location, category, and confidence information of vehicle targets. This achieves a balance between high accuracy and real-time performance, effectively addressing the shortcomings of traditional detection methods such as missed detection of small targets and mismatched occluded targets.

[0051] Secondly, this application provides a vehicle target detection system based on an improved YOLOV12N, comprising: An improved model building module is used to construct an improved YOLOv12N model by reconstructing the backbone network module and optimizing the loss function strategy; In the improved YOLOv12N model backbone network, the original C3k2 module is replaced by the StarConverse2DC3k2 module. The StarConverse2DC3k2 module includes a first branch and a second branch. The first branch is processed sequentially through a first convolutional layer, a batch normalization layer, an activation function layer, and two consecutive StarConverse2DBlock modules. The second branch is processed by a StarConverse2DBlock module. The outputs of the first branch and the second branch are concatenated and then sequentially processed through a second convolutional layer, a batch normalization layer, and an activation function layer before outputting. The StarConverse2DBlock module uses Converse2D deconvolution to solve for the optimal solution of feature reconstruction in the frequency domain, and enhances nonlinear interaction through branch feature multiplication; The improved YOLOv12N model uses the Inner-Wise-IoUv3 loss function, which allocates differentiated gradient gains through a dynamic non-monotonic focusing mechanism and combines the similarity of feature vectors in the intersection region of the predicted box and the ground truth box to distinguish the internal content of overlapping targets. The image acquisition module is used to acquire images of the vehicle to be detected. The vehicle target detection module is used to input the vehicle image into the improved YOLOv12N model for feature extraction and target detection, and to obtain the vehicle target detection results.

[0052] The functions of each module in the vehicle target detection system based on the improved YOLOV12N correspond to the steps in the vehicle target detection method embodiment based on the improved YOLOV12N. Their functions and implementation processes will not be described in detail here.

[0053] Thirdly, embodiments of this application also provide a readable storage medium.

[0054] This application stores a vehicle target detection program based on improved YOLOv12N on a readable storage medium, wherein when the vehicle target detection program based on improved YOLOv12N is executed by a processor, it implements the steps of the vehicle target detection method based on improved YOLOv12N as described above.

[0055] The method implemented when the vehicle target detection program based on the improved YOLOV12N is executed can be referred to in various embodiments of the vehicle target detection method based on the improved YOLOV12N in this application, and will not be repeated here.

[0056] It should be noted that the sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0057] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device to execute the methods described in the various embodiments of this application.

[0058] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A vehicle target detection method based on an improved YOLOv12N, characterized in that, Includes the following steps: An improved YOLOv12N model is constructed by reconstructing the backbone network modules and optimizing the loss function strategy. In the improved YOLOv12N model backbone network, the original C3k2 module is replaced by the StarConverse2DC3k2 module. The StarConverse2DC3k2 module includes a first branch and a second branch. The first branch is processed sequentially through a first convolutional layer, a batch normalization layer, an activation function layer, and two consecutive StarConverse2DBlock modules. The second branch is processed by a StarConverse2DBlock module. The outputs of the first branch and the second branch are concatenated and then sequentially processed through a second convolutional layer, a batch normalization layer, and an activation function layer before outputting. The StarConverse2DBlock module uses Converse2D deconvolution to solve for the optimal solution of feature reconstruction in the frequency domain, and enhances nonlinear interaction through branch feature multiplication; The processing procedure of the StarConverse2DBlock module includes: The input feature map is received and processed sequentially through a 3×3 Converse2D deconvolution layer, a batch normalization layer, and an activation function layer to obtain a first intermediate feature map. The first intermediate feature map is divided into two sub-branches. The first sub-branch is processed by the fourth convolutional layer, the batch normalization layer and the activation function layer in sequence. The second sub-branch is processed by the fifth convolutional layer and the batch normalization layer in sequence. The outputs of the first sub-branch and the second sub-branch are multiplied element-wise to obtain the second intermediate feature map. The second intermediate feature map is processed by the sixth convolutional layer, the batch normalization layer, the seventh convolutional layer, the batch normalization layer, and the activation function layer to output the feature map of the StarConverse2DBlock module; The improved YOLOv12N model uses the Inner-Wise-IoUv3 loss function, which allocates differentiated gradient gains through a dynamic non-monotonic focusing mechanism and combines the similarity of feature vectors in the intersection region of the predicted box and the ground truth box to distinguish the internal content of overlapping targets. The Inner-Wise-IoUv3 loss function uses Wise-IoUv3 as its base and Inner-IoU as an auxiliary constraint, dynamically adjusting the gradient contributions of both. Wise-IoUv3 introduces a dynamic non-monotonic focusing mechanism, defining an outlier β to measure anchor box quality and assigning differentiated gradient gains to predicted boxes of different qualities based on this outlier β. Inner-IoU calculates the feature vector similarity within the intersection region of the predicted and ground truth boxes using the following formula. : in, This represents the intersection area between the predicted bounding box and the ground truth bounding box. Let p be the predicted feature vector. Let p be the true feature vector. To prevent small constants from being divided by zero, It is an L2 norm; Acquire images of the vehicle to be detected; The vehicle image is input into the improved YOLOv12N model for feature extraction and target detection to obtain the vehicle target detection results.

2. The vehicle target detection method based on the improved YOLOv12N according to claim 1, characterized in that, The seventh convolutional layer in the StarConverse2DBlock module is a Converse2D deconvolutional layer, which achieves feature reconstruction through frequency domain optimization.

3. The vehicle target detection method based on the improved YOLOv12N according to claim 1, characterized in that, Before inputting the vehicle images into the improved YOLOv12N model, a step of data augmentation processing on the initial dataset is included, the data augmentation processing including at least one of the following: Mosaic enhancement, image blending, copy and paste, random flipping, random scaling, random color transformation, and random affine transformation.

4. The vehicle target detection method based on the improved YOLOv12N according to claim 1, characterized in that, The Wise-IoUv3 loss function, serving as the base in the Inner-Wise-IoUv3 loss function, introduces a dynamic non-monotonic focusing mechanism. It measures the anchor box quality by defining an outlier β and assigns differentiated gradient gains to prediction boxes of different qualities based on this outlier β. The formula for calculating the outlier β is as follows: ; in, This is the exponential moving average of the moving average loss. The localization loss for the current sample. For moving average loss, This is the momentum coefficient.

5. The vehicle target detection method based on the improved YOLOv12N according to claim 4, characterized in that, In the Inner-Wise-IoUv3 loss function, the Wise-IoUv3 base function uses the outlier β to calculate the non-monotonic focusing coefficient r, and adjusts the weight of the localization loss based on the non-monotonic focusing coefficient r; the formula for calculating the non-monotonic focusing coefficient r is: ; in, and These are the preset hyperparameters.

6. The vehicle target detection method based on the improved YOLOv12N according to claim 3, characterized in that, The initial dataset is the UA-DETRAC dataset, and the method further includes preprocessing steps such as filtering, format conversion, and dividing the UA-DETRAC dataset into training and test sets.

7. The vehicle target detection method based on the improved YOLOv12N according to claim 1, characterized in that, The total loss function of the improved YOLOv12N model is composed of a weighted average of localization loss, confidence loss, and classification loss, with the Inner-Wise-IoUv3 loss function serving as the localization loss.

8. A vehicle target detection system based on an improved YOLOv12N, used to implement the vehicle target detection method based on an improved YOLOv12N as described in any one of claims 1-7, characterized in that, include: An improved model building module is used to construct an improved YOLOv12N model by reconstructing the backbone network module and optimizing the loss function strategy; In the improved YOLOv12N model backbone network, the original C3k2 module is replaced by the StarConverse2DC3k2 module. The StarConverse2DC3k2 module includes a first branch and a second branch. The first branch is processed sequentially through a first convolutional layer, a batch normalization layer, an activation function layer, and two consecutive StarConverse2DBlock modules. The second branch is processed by a StarConverse2DBlock module. The outputs of the first branch and the second branch are concatenated and then sequentially processed through a second convolutional layer, a batch normalization layer, and an activation function layer before outputting. The StarConverse2DBlock module uses Converse2D deconvolution to solve for the optimal solution of feature reconstruction in the frequency domain, and enhances nonlinear interaction through branch feature multiplication; The improved YOLOv12N model uses the Inner-Wise-IoUv3 loss function, which allocates differentiated gradient gains through a dynamic non-monotonic focusing mechanism and combines the similarity of feature vectors in the intersection region of the predicted box and the ground truth box to distinguish the internal content of overlapping targets. The image acquisition module is used to acquire images of the vehicle to be detected. The vehicle target detection module is used to input the vehicle image into the improved YOLOv12N model for feature extraction and target detection, and to obtain the vehicle target detection results.

Citation Information

Patent Citations

  • Improved YOLOv11 unmanned aerial vehicle small target detection method

    CN119992524A

  • Underwater target detection method based on YOLOv8

    CN120259860A