Traffic target detection method and device based on YOLOv12n model, equipment and medium

CN122435571BActive Publication Date: 2026-08-28NANCHANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610855664.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-15
Publication Date
2026-08-28
Estimated Expiration
2046-06-15

AI Technical Summary

Technical Problem

其中,前者以高精度著称,后者则因推理效率高而更适用于实时交通感知场景,轻量化与高精度之间仍难以实现理想平衡,如何在资源受限的车载平台上兼顾检测准确性与实时性依旧是重要挑战

Benefits of technology

[0010] In this embodiment, the efficiency of the model is improved by replacing the convolutional module in the backbone network with the GCConv module; the bottleneck layer of the C3k2 module in the backbone network is replaced with the FCGA module, enabling the model to have global frequency domain awareness; and the global downsampling module is replaced with the DRFD module, enabling the model to better extract multi-scale information and reducing the impact of different types of traffic targets with huge scale differences on the detection process. For example, the original model has difficulty detecting small targets and distant targets, thereby improving the accuracy of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122435571B_ABST
    Figure CN122435571B_ABST
Patent Text Reader

Abstract

This application discloses a traffic target detection method, apparatus, device, and medium based on the YOLOv12n model, belonging to the field of target detection technology. The method includes the following steps: improving the backbone network and global downsampling module of the YOLOv12n model to obtain an improved YOLOv12n model; wherein the improvement includes: replacing the convolutional module in the backbone network with a GCConv module, replacing the bottleneck layer of the C3k2 module in the backbone network with a Fourier Convolutional Global Attention (FCGA) module, and replacing the global downsampling module with a Deep Robust Feature Downsampling (DRFD) module; iteratively optimizing and training the improved YOLOv12n model based on a training set to obtain a traffic target detection model; acquiring the image to be detected and inputting the image into the traffic target detection model to obtain the detection result. This application can balance detection accuracy and real-time performance during detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of target detection technology, specifically relating to a traffic target detection method, device, equipment, and medium based on the YOLOv12n model. Background Technology

[0002] With the rapid development of autonomous driving and assisted driving technologies, traffic object detection has become one of the core research directions in perception systems, such as traffic object detection technology based on deep learning. Its main task is to accurately identify key objects such as vehicles, pedestrians, non-motorized vehicles, and traffic signs in complex and dynamic traffic environments, providing reliable environmental information support for branch planning, behavior prediction, and decision control.

[0003] Currently, the mainstream technologies for traffic target detection based on deep learning mainly include two-stage detectors and single-stage detectors. The former is known for its high accuracy, while the latter is more suitable for real-time traffic perception scenarios due to its high inference efficiency. However, achieving an ideal balance between lightweight design and high accuracy remains difficult, and how to balance detection accuracy and real-time performance on resource-constrained in-vehicle platforms remains a significant challenge. Summary of the Invention

[0004] The purpose of this application is to provide a traffic target detection method, apparatus, device, and medium based on the YOLOv12n model, which can balance detection accuracy and real-time performance during detection.

[0005] To solve the above-mentioned technical problems, this application is implemented as follows: In a first aspect, embodiments of this application provide a traffic target detection method based on the YOLOv12n model, the method comprising: An improved YOLOv12n model is obtained by improving the backbone network and global downsampling module. The improvements include replacing the convolutional module in the backbone network with the GCConv module, replacing the bottleneck layer of the C3k2 module in the backbone network with the Fourier Convolutional Global Attention (FCGA) module, and replacing the global downsampling module with the Deep Robust Feature Downsampling (DRFD) module. The improved YOLOv12n model is iteratively optimized and trained based on the training set to obtain a traffic target detection model. The image to be detected is acquired and input into the traffic target detection model to obtain the detection result.

[0006] Secondly, embodiments of this application provide a traffic target detection device based on the YOLOv12n model, the traffic target detection device based on the YOLOv12n model comprising: An improvement module is used to improve the backbone network and global downsampling module of the YOLOv12n model to obtain an improved YOLOv12n model. The improvement includes: replacing the convolutional module in the backbone network with the GCConv module, replacing the bottleneck layer of the C3k2 module in the backbone network with the Fourier Convolutional Global Attention (FCGA) module, and replacing the global downsampling module with the Deep Robust Feature Downsampling (DRFD) module. The training module is used to iteratively optimize and train the improved YOLOv12n model based on the training set to obtain a traffic target detection model. The inference module is used to acquire the image to be detected and input the image to be detected into the traffic target detection model to obtain the detection result.

[0007] Thirdly, embodiments of this application provide a computer device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.

[0008] Fourthly, embodiments of this application provide a computer-readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0009] Fifthly, embodiments of this application also provide a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in the first aspect.

[0010] In this embodiment, the efficiency of the model is improved by replacing the convolutional module in the backbone network with the GCConv module; the bottleneck layer of the C3k2 module in the backbone network is replaced with the FCGA module, enabling the model to have global frequency domain awareness; and the global downsampling module is replaced with the DRFD module, enabling the model to better extract multi-scale information and reducing the impact of different types of traffic targets with huge scale differences on the detection process. For example, the original model has difficulty detecting small targets and distant targets, thereby improving the accuracy of the model. Attached Figure Description

[0011] Figure 1 This is a flowchart illustrating a traffic target detection method based on the YOLOv12n model provided in some embodiments of this application; Figure 2 This is a structural block diagram of an improved YOLOv12n model provided in some embodiments of this application; Figure 3 This is a structural block diagram of the GCConv module provided in some embodiments of this application; Figure 4 This is a structural block diagram of the C3k2_FCGA module provided in some embodiments of this application; Figure 5 This is a structural block diagram of an FCGA module provided in some embodiments of this application; Figure 6 This is a structural block diagram of the DRFD module provided in some embodiments of this application; Figure 7 This is a schematic diagram of the downsampling principle of the Cut branch provided in some embodiments of this application; Figure 8 This is a structural block diagram of a traffic target detection device based on the YOLOv12n model provided in some embodiments of this application; Figure 9 These are internal structural diagrams of a computer device provided in some embodiments of this application. Detailed Implementation

[0012] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0013] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0014] In one exemplary embodiment, this application proposes a traffic target detection method based on the YOLOv12n model. The following, in conjunction with the accompanying drawings, provides a detailed description of the traffic target detection method based on the YOLOv12n model provided by this application through specific embodiments and application scenarios.

[0015] Reference Figure 1 and Figure 2 The method includes steps 102-106. Wherein: Step 102: Improve the backbone network and global downsampling module of the YOLOv12n model to obtain an improved YOLOv12n model; wherein, the improvement includes: replacing the convolutional module in the backbone network with the Golden Cudgel Convolution (GCConv) module, replacing the bottleneck layer of the C3k2 module in the backbone network with the Fourier Convolution Global Attention (FCGA) module, and replacing the global downsampling module with the Deep Robust Feature Downsampling (DRFD) module.

[0016] In some embodiments, during the training phase, the GCConv module includes multiple first convolutional branches and residual branches, each of the first convolutional branches being used to perform convolution processing on the input of the GCConv module; the output of the GCConv module is obtained by adding the outputs of the multiple first convolutional branches and the output of the residual branches and then performing an activation operation; during the inference phase, the GCConv module includes a convolutional backbone, which is obtained by fusing the first convolutional branches and the residual branches.

[0017] In some embodiments, the first convolutional branch includes two branches consisting of 3×3Conv and 1×1Conv, and one branch consisting of two 1×1Conv; the convolutional backbone includes one 3×3Conv.

[0018] Specifically, such as Figure 3 As shown, in the GCConv module: when an image is input into the GCConv module, the GCConv module will present different structural forms depending on the training phase and the inference phase.

[0019] During the training phase, the GCConv module expands into a complex structure with multiple branches. The input image is first fed into multiple different branches simultaneously, which may include a main branch consisting of 3×3Conv and 1×1Conv, several extended branches consisting of 3×3Conv and 1×1Conv, a lightweight branch consisting of two 1×1Conv, and a residual branch enabled when the stride is 1.

[0020] It should be noted that for the residual branch, when the stride is 1, the GCConv module does not perform spatial downsampling on the input feature map. Therefore, the input and output features maintain the same spatial resolution, and the input features can be directly fused with the outputs of each convolutional branch through residual connections. Each branch independently performs convolution processing on the input feature map to learn different spatial or channel features. Subsequently, the features output by each branch are element-wise added and fused, and then nonlinearly mapped using the SiLU activation function to obtain the output features of the GCConv module.

[0021] It should be noted that during training, the multi-branch structure of the GCConv module can extract information in a richer way, thereby improving the model's expressive power.

[0022] During the inference phase, the GCConv module no longer retains the multi-branch structure from training. Instead, it fuses the convolutions and biases from all branches into a single equivalent convolution using a reparameterization technique. Based on this, the input feature map to the GCConv module only needs to pass through one equivalent convolution and one SiLU activation function to obtain the output, achieving almost the same expressive power as the training phase, but with a significantly reduced computational cost. Therefore, the entire process becomes very simple during inference. Specifically, after the input feature map enters the GCConv module, it directly passes through a fused 3×3 Conv, followed by an activation function, to obtain the final result.

[0023] It should be noted that by adopting a "multi-branch training, single-branch inference" design, the GCConv module significantly improves inference efficiency while ensuring model performance.

[0024] In some embodiments, such as Figure 4 As shown, after replacing the bottleneck layer of the C3k2 module in the backbone network with the FCGA module, the C3k2_FCGA module is obtained to capture the global receptive field.

[0025] The FCGA module includes at least a normalization layer, a second convolutional branch, a Fourier branch, a Softmax layer, and a 1×1 Conv layer. The normalization layer performs layer normalization on the input of the FCGA module, and after processing, it is input to the second convolutional branch and the Fourier branch respectively. The processing results of the second convolutional branch and the Fourier branch are multiplied element-wise. The product is then subjected to soft selection by the Softmax layer to obtain attention features. The 1×1 Conv layer is used to reconstruct the attention features to have the same spatial size as the input of the FCGA module. The reconstructed attention features are added to the input of the FCGA module to obtain the output of the FCGA module.

[0026] In some embodiments, the second convolutional branch includes a 3×3 Conv; the Fourier branch includes a Fourier transform module, a 3×3 Conv, and an inverse Fourier transform module; the Fourier transform module is used to perform a 2D Fourier transform on the input of the Fourier branch to obtain frequency domain features; the 3×3 Conv is used to perform a convolution operation on the frequency domain features to obtain convolved frequency features; the inverse Fourier transform module is used to map the convolved frequency features back to the spatial domain, that is, to restore the amplitude and phase information in the frequency dimension to the pixel / feature response relationship in the spatial location, so as to recover the spatial feature representation suitable for subsequent processing of the convolutional neural network.

[0027] Specifically, such as Figure 5 As shown, in the FCGA module: For the Fourier branch, the normalized input is transformed into the spectral domain through a Fourier transform combined with a 3×3 Conv, thereby extracting frequency information. Specifically, the spatial features are mapped to the spectral domain using a two-dimensional Real Fast Fourier Transform (RFFT), followed by further processing of the spectrum using 3×3 Conv. Then, the spectral features are reprojected back into the spatial domain using an Inverse Fast Fourier Transform (IFFT). This process, combining the Fourier transform and the inverse transform, effectively manipulates the entire image's spectrum, thereby capturing information from the global receptive field.

[0028] For the second convolution branch, the normalized input is processed by 3×3 Conv to form the value features corresponding to the Fourier branch.

[0029] Subsequently, the two branches are multiplied element-wise and then the attention distribution across spatial locations is formed using a softmax function. After soft selection, the resulting attention features are reorganized to the same spatial size as the original input and then combined with the residual connections to obtain enhanced features with global frequency awareness, thereby improving the model's accuracy.

[0030] In some embodiments, the DRFD module includes three downsampling branches and a 1×1 Conv; each downsampling branch is used to downsample the input of the DRFD module; the outputs of each downsampling branch are merged by the 1×1 Conv after channel splicing to obtain the output of the DRFD module.

[0031] In some embodiments, the three downsampling branches are a Cut branch, a convolutional downsampling branch, and a max-pooling downsampling branch; wherein, the Cut branch is used to perform channel transformation on the input of the DRFD module and downsampling in the spatial dimension; the inputs of the convolutional downsampling branch and the max-pooling downsampling branch are provided by grouped convolutions, which are used to perform depthwise convolutions on the input of the DRFD module to increase the number of channels; the convolutional downsampling branch is used to perform spatial downsampling on the output of the grouped convolutions and perform nonlinear mapping through the GELU activation function; the max-pooling downsampling branch is used to perform max-pooling on the output of the grouped convolutions.

[0032] Specifically, such as Figure 6 As shown, for the input feature map, the DRFD module first sends its input features into three parallel downsampling branches for processing.

[0033] The first branch is the Cut branch, such as... Figure 7 As shown, the Cut module performs channel transformation on the input features and downsamples them in the spatial dimension to obtain a feature map with half resolution and expanded channel number.

[0034] The second branch is the convolutional downsampling branch. First, a depthwise convolution is applied to the input features to increase the number of channels. Then, spatial downsampling is achieved through a depthwise separable convolution with a stride of 2. Next, a non-linear mapping is performed using the GELU activation function, and batch normalization is employed to enhance training stability. The third branch is the max-pooling downsampling branch. Max pooling is used to reduce spatial resolution, while batch normalization is combined to process the output features. The features obtained from the three branches are concatenated along the channel dimension and then fused through a 1×1 Conv layer, integrating the features obtained from multi-branch downsampling into the final output. This output feature retains rich semantic information while achieving efficient spatial dimensionality downsampling, providing a multi-scale and information-rich representation for subsequent feature processing.

[0035] This embodiment extracts structural, convolutional semantic, and saliency cues through three parallel branches—Cut downsampling, convolutional downsampling, and max pooling downsampling—after receiving the input feature map. After channel concatenation, multi-branch feature fusion is achieved through 1×1 Conv, thereby obtaining output features that combine multi-scale information and efficient downsampling capabilities, thus improving the accuracy of the model.

[0036] Step 104: Iteratively optimize and train the improved YOLOv12n model based on the training set to obtain the traffic target detection model.

[0037] In some embodiments, images can be filtered from a driving video dataset to construct the dataset, thus ensuring that the images cover a variety of scenes, weather conditions, and time periods.

[0038] Subsequently, the original label files were converted to YOLO format annotation files to facilitate subsequent training and validation. The dataset was divided into training, validation, and test sets in a 7:1:2 ratio, ensuring a reasonable data distribution among the three sets and effectively supporting model training and evaluation.

[0039] Regarding weather conditions, the dataset can include six different weather scenarios: sunny, cloudy, overcast, rainy, snowy, and foggy. This is designed to help the model cope with changing weather conditions.

[0040] In terms of scenarios, the dataset covers six common environment types: residential areas, highways, city streets, parking lots, gas stations, and tunnels. This diversity of scenarios enhances the model's adaptability to real-world applications.

[0041] In terms of time periods, the dataset can include three time periods: dawn / dusk, daytime, and nighttime. Among them, daytime and nighttime are the main focus, which further enriches the time dimension of the dataset and improves the model's ability to recognize different lighting conditions.

[0042] To enhance the diversity and complexity of the dataset, this embodiment introduces a variety of image enhancement techniques during the optimization process of the training set.

[0043] First, a mosaic enhancement technique was used. This technique involves randomly selecting four images and performing data augmentation operations independently, and then stitching these four images together into a new image, thereby effectively increasing the diversity and complexity of the dataset.

[0044] Secondly, an image blending technique was adopted, which involves randomly selecting two images and blending them in a certain proportion, while adjusting the classification labels according to the blending proportion, thereby further enriching the expression of the data.

[0045] Another important enhancement strategy is the copy-paste strategy, which involves randomly selecting two images and pasting the target region from one image onto the other to simulate object occlusion and overlap, thereby improving the robustness of the model.

[0046] In addition to the three methods mentioned above, random flipping technology is employed, which simulates image changes at different angles by randomly flipping the image horizontally or vertically. Random scaling technology is used to adjust the size of the image, either shrinking or enlarging it, thereby simulating the visual effects of objects at different scales.

[0047] In addition, random color transformation technology was used, which randomly adjusts the hue, saturation and brightness of the image in the HSV color space to adapt to image changes under different lighting conditions.

[0048] Finally, random affine transformation was employed, which is used for operations such as image rotation, translation, scaling, and shearing to simulate various transformations of objects in three-dimensional space, further increasing the diversity of the dataset.

[0049] This embodiment, through the combined use of the above image enhancement techniques, effectively expands and optimizes the dataset, not only improving the diversity of model training but also enhancing its generalization ability in complex environments. This ensures that the trained model can perform well in different scenarios and conditions, thereby avoiding the problem of missed detections and false detections that the model is prone to in complex scenarios, especially in rainy or snowy weather, strong light reflection, and severe occlusion, thus improving the accuracy of the model.

[0050] Step 106: Obtain the image to be detected and input the image to be detected into the traffic target detection model to obtain the detection result.

[0051] In some embodiments, the image to be detected can be extracted from a real-time video stream provided by the vehicle during its operation, such as a keyframe.

[0052] In some embodiments, the detection result may be a preselected box with category confidence.

[0053] This embodiment improves model efficiency by replacing the convolutional module in the backbone network with the GCConv module; it enables the model to have global frequency domain awareness by replacing the bottleneck layer of the C3k2 module in the backbone network with the FCGA module; and it enables the model to better extract multi-scale information by replacing the global downsampling module with the DRFD module, reducing the impact of different types of traffic targets with huge scale differences on the detection process. For example, the original model has difficulty detecting small targets and distant targets, thereby improving the accuracy of the model.

[0054] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0055] Based on the same inventive concept, this application also provides a YOLOv12n-based traffic target detection device for implementing the aforementioned YOLOv12n-based traffic target detection method. The solution provided by this device is similar to the implementation described in the above method. Therefore, the specific limitations of the one or more YOLOv12n-based traffic target detection device embodiments provided below can be found in the limitations of the YOLOv12n-based traffic target detection method described above, and will not be repeated here.

[0056] In one exemplary embodiment, such as Figure 8 As shown, a traffic target detection device based on the YOLOv12n model is provided, including: an improvement module 100, a training module 200, and an inference module 300, wherein: An improvement module 100 is used to improve the backbone network and global downsampling module of the YOLOv12n model to obtain an improved YOLOv12n model. The improvement includes: replacing the convolutional module in the backbone network with the GCConv module, replacing the bottleneck layer of the C3k2 module in the backbone network with the Fourier Convolutional Global Attention (FCGA) module, and replacing the global downsampling module with the Deep Robust Feature Downsampling (DRFD) module.

[0057] The training module 200 is used to iteratively optimize and train the improved YOLOv12n model based on the training set to obtain a traffic target detection model.

[0058] The inference module 300 is used to acquire the image to be detected and input the image to be detected into the traffic target detection model to obtain the detection result.

[0059] In one embodiment, during the training phase, the GCConv module includes multiple first convolutional branches and residual branches, each of the first convolutional branches being used to perform convolution processing on the input of the GCConv module; the output of the GCConv module is obtained by adding the outputs of the multiple first convolutional branches and the output of the residual branches and then performing an activation operation; during the inference phase, the GCConv module includes a convolutional backbone, which is obtained by fusing the first convolutional branches and the residual branches.

[0060] In one embodiment, the first convolutional branch includes two branches consisting of 3×3Conv and 1×1Conv, and one branch consisting of two 1×1Conv.

[0061] The convolutional backbone consists of one 3×3 Conv.

[0062] In one embodiment, the FCGA module includes at least a normalization layer, a second convolutional branch, a Fourier branch, a Softmax layer, and a 1×1 Conv layer.

[0063] The normalization layer is used to perform layer normalization processing on the input of the FCGA module. After processing, the input is fed into the second convolution branch and the Fourier branch respectively. The processing results of the second convolution branch and the Fourier branch are multiplied element-wise. The product is then subjected to soft selection by the Softmax layer to obtain the attention features. The 1×1Conv layer is used to reorganize the attention features into the same spatial size as the input of the FCGA module. The reorganized attention features are added to the input of the FCGA module to obtain the output of the FCGA module.

[0064] In one embodiment, the second convolutional branch includes a 3×3 Conv; the Fourier branch includes a Fourier transform module, a 3×3 Conv, and an inverse Fourier transform module; the Fourier transform module is used to perform a 2D Fourier transform on the input of the Fourier branch to obtain frequency domain features; the 3×3 Conv is used to perform a convolution operation on the frequency domain features to obtain convolved frequency features; the inverse Fourier transform module is used to map the convolved frequency features back to the spatial domain.

[0065] In one embodiment, the DRFD module includes three downsampling branches and a 1×1 Conv.

[0066] Each of the downsampling branches is used to downsample the input of the DRFD module respectively; the output of each downsampling branch is merged by a 1×1Conv after channel splicing operation to obtain the output of the DRFD module.

[0067] In one embodiment, the three downsampling branches are the Cut branch, the convolutional downsampling branch, and the max pooling downsampling branch.

[0068] The Cut branch is used to perform channel transformation on the input of the DRFD module and downsample it in the spatial dimension; the inputs of the convolutional downsampling branch and the max-pooling downsampling branch are provided by grouped convolutions, which are used to perform depthwise convolutions on the input of the DRFD module to increase the number of channels; the convolutional downsampling branch is used to perform spatial downsampling on the output of the grouped convolutions and perform nonlinear mapping through the GELU activation function; the max-pooling downsampling branch is used to perform max-pooling on the output of the grouped convolutions. The various modules in the traffic target detection device based on the YOLOv12n model described above can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0069] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a traffic target detection method based on the YOLOv12n model. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0070] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0071] In one embodiment, a computer-readable storage medium is provided, on which a program or instructions are stored, which, when executed by a processor, implement the steps in the above-described method embodiments.

[0072] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0073] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0074] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0075] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A traffic target detection method based on the YOLOv12n model, characterized in that, The traffic target detection method based on the YOLOv12n model includes: The backbone network and global downsampling module of the YOLOv12n model are improved to obtain an improved YOLOv12n model. The improvements include: replacing the convolutional modules in the backbone network with the Golden Cudgel Convolution GCConv module, replacing the bottleneck layer of the C3k2 module in the backbone network with the Fourier Convolution Global Attention FCGA module, and replacing the global downsampling module with the Deep Robust Feature Downsampling (DRFD) module. The improved YOLOv12n model is iteratively optimized and trained based on the training set to obtain a traffic target detection model. The image to be detected is acquired and input into the traffic target detection model to obtain the detection result; During the training phase, the GCConv module includes multiple first convolutional branches and residual branches. Each first convolutional branch is used to perform convolution processing on the input of the GCConv module. The output of the GCConv module is obtained by adding the outputs of the multiple first convolutional branches and the output of the residual branch and then performing an activation operation. During the inference phase, the GCConv module includes a convolutional backbone, which is obtained by fusing the first convolutional branches and the residual branches. The first convolutional branch includes two branches consisting of 3×3Conv and 1×1Conv, and one branch consisting of two 1×1Conv; The convolutional backbone includes a 3×3Conv obtained by fusing the two branches consisting of 3×3Conv and 1×1Conv, the branch consisting of two 1×1Conv, and the convolution and bias in the residual branch through reparameterization techniques; The FCGA module includes at least a normalization layer, a second convolutional branch, a Fourier branch, a Softmax layer, and a 1×1 Conv layer; The normalization layer is used to perform layer normalization processing on the input of the FCGA module. After processing, the results are input to the second convolutional branch and the Fourier branch respectively. The processing results of the second convolutional branch and the Fourier branch are multiplied element-wise. The product is then subjected to soft selection by the Softmax layer to obtain the attention features. The 1×1Conv layer is used to reorganize the attention features into the same spatial size as the input of the FCGA module. The reorganized attention features are added to the input of the FCGA module to obtain the output of the FCGA module. The second convolutional branch includes a 3×3 Conv; the Fourier branch includes a Fourier transform module, a 3×3 Conv, and an inverse Fourier transform module; the Fourier transform module is used to perform a 2D Fourier transform on the input of the Fourier branch to obtain frequency domain features; the 3×3 Conv is used to perform a convolution operation on the frequency domain features to obtain convolved frequency domain features; the inverse Fourier transform module is used to map the convolved frequency domain features back to the spatial domain; The DRFD module includes 3 downsampling branches and 1×1 Conv; Each of the downsampling branches is used to downsample the input of the DRFD module; the output of each downsampling branch is then fused by a 1×1 Conv after a channel splicing operation to obtain the output of the DRFD module. The three downsampling branches are the Cut branch, the convolutional downsampling branch, and the max pooling downsampling branch; The Cut branch is used to perform channel transformation on the input of the DRFD module and downsample it in the spatial dimension; the inputs of the convolutional downsampling branch and the max pooling downsampling branch are provided by grouped convolutions, which are used to perform depthwise convolutions on the input of the DRFD module to increase the number of channels; the convolutional downsampling branch is used to perform spatial downsampling on the output of the grouped convolutions and perform nonlinear mapping through the GELU activation function; the max pooling downsampling branch is used to perform max pooling on the output of the grouped convolutions.

2. A traffic target detection device based on the YOLOv12n model, characterized in that, The traffic target detection device based on the YOLOv12n model includes: An improvement module is used to improve the backbone network and global downsampling module of the YOLOv12n model to obtain an improved YOLOv12n model. The improvement includes: replacing the convolutional module in the backbone network with the GCConv module, replacing the bottleneck layer of the C3k2 module in the backbone network with the Fourier Convolutional Global Attention (FCGA) module, and replacing the global downsampling module with the Deep Robust Feature Downsampling (DRFD) module. The training module is used to iteratively optimize and train the improved YOLOv12n model based on the training set to obtain a traffic target detection model. The inference module is used to acquire the image to be detected and input the image to be detected into the traffic target detection model to obtain the detection result; During the training phase, the GCConv module includes multiple first convolutional branches and residual branches. Each first convolutional branch is used to perform convolution processing on the input of the GCConv module. The output of the GCConv module is obtained by adding the outputs of the multiple first convolutional branches and the output of the residual branch and then performing an activation operation. During the inference phase, the GCConv module includes a convolutional backbone, which is obtained by fusing the first convolutional branches and the residual branches. The first convolutional branch includes two branches consisting of 3×3Conv and 1×1Conv, and one branch consisting of two 1×1Conv; The convolutional backbone includes a 3×3Conv obtained by fusing the two branches consisting of 3×3Conv and 1×1Conv, the branch consisting of two 1×1Conv, and the convolution and bias in the residual branch through reparameterization techniques; The FCGA module includes at least a normalization layer, a second convolutional branch, a Fourier branch, a Softmax layer, and a 1×1 Conv layer; The normalization layer is used to perform layer normalization processing on the input of the FCGA module. After processing, the results are input to the second convolutional branch and the Fourier branch respectively. The processing results of the second convolutional branch and the Fourier branch are multiplied element-wise. The product is then subjected to soft selection by the Softmax layer to obtain the attention features. The 1×1Conv layer is used to reorganize the attention features into the same spatial size as the input of the FCGA module. The reorganized attention features are added to the input of the FCGA module to obtain the output of the FCGA module. The second convolutional branch includes a 3×3 Conv; the Fourier branch includes a Fourier transform module, a 3×3 Conv, and an inverse Fourier transform module; the Fourier transform module is used to perform a 2D Fourier transform on the input of the Fourier branch to obtain frequency domain features; the 3×3 Conv is used to perform a convolution operation on the frequency domain features to obtain convolved frequency domain features; the inverse Fourier transform module is used to map the convolved frequency domain features back to the spatial domain; The DRFD module includes 3 downsampling branches and 1×1 Conv; Each of the downsampling branches is used to downsample the input of the DRFD module; the output of each downsampling branch is then fused by a 1×1 Conv after a channel splicing operation to obtain the output of the DRFD module. The three downsampling branches are the Cut branch, the convolutional downsampling branch, and the max pooling downsampling branch; The Cut branch is used to perform channel transformation on the input of the DRFD module and downsample it in the spatial dimension; the inputs of the convolutional downsampling branch and the max pooling downsampling branch are provided by grouped convolutions, which are used to perform depthwise convolutions on the input of the DRFD module to increase the number of channels; the convolutional downsampling branch is used to perform spatial downsampling on the output of the grouped convolutions and perform nonlinear mapping through the GELU activation function; the max pooling downsampling branch is used to perform max pooling on the output of the grouped convolutions.

3. A computer device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the traffic target detection method based on the YOLOv12n model as described in claim 1.

4. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the traffic target detection method based on the YOLOv12n model as described in claim 1.

Citation Information

Patent Citations

  • Traffic target detection method and system based on improved YOLOv8n

    CN118552929A

  • Road traffic vehicle target detection method based on deep learning

    CN120708026A