Vehicle detection method and system based on improved YOLOv8n network

By introducing RFAConv and EMA modules into the YOLOv8n network, the existing vehicle detection model has been solved inadequate detection accuracy in long-distance, small-size vehicle detection and complex backgrounds, and high-precision and real-time vehicle detection effects are achieved.

CN119693890AActive Publication Date: 2025-03-25SHANDONG UNIV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411882482.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-03-25
Estimated Expiration
2044-12-19

AI Technical Summary

Technical Problem

The existing vehicle detection models have insufficient detection accuracy in long-distance, small-size vehicle detection and complex backgrounds, and the calculation overhead of high-precision models is relatively large, making it difficult to meet the real-time requirements.

Method used

By introducing the RFAConv module in the shallow feature extraction part of the YOLOv8n network, the receptive field and cross-feature weighting are dynamically adjusted to enhance attention to the key details of the vehicle; an EMA module is introduced in the neck network part, and a multi-scale parallel convolution and cross-space learning mechanism are adopted to capture the feature information of different vehicles.

Benefits of technology

It improves the detection accuracy and robustness of the vehicle detection model, enhances the adaptability to complex backgrounds and multi-lane scenes, and controls the computing overhead to meet real-time requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119693890A_ABST
    Figure CN119693890A_ABST
Patent Text Reader

Abstract

The invention provides a vehicle detection method and system based on an improved YOLOv8n network, an RFAConv module is deployed in a shallow feature extraction part, so that the RFAConv module is more focused on detail feature capture, the resolution of a feature map in shallow convolution is relatively high, a dynamic receptive field mechanism of the RFAConv module is combined, and the detection accuracy is improved. The attention of the model on key details such as vehicle edges and textures can be enhanced at the initial stage of feature extraction, and the method is particularly suitable for detecting small targets and partially shielded targets in vehicle detection; an EMA module is used for a neck network part and focuses on final feature optimization and accurate fusion of multi-scale features, the neck network is a key stage for finally generating a target detection result, feature expression of a target area can be further optimized by introducing multi-scale parallel convolution and a cross-space learning mechanism of the EMA module, and the target detection result is obtained. And the adaptability to complex backgrounds and multi-lane scenes is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of vehicle detection, and in particular relates to a vehicle detection method and system based on an improved YOLOv8n network. Background Art

[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.

[0003] The development of computer vision technology has made video-based vehicle detection possible. Although many object detection algorithms (CNN, YOLO series) have been applied to vehicle object detection, vehicle object detection and recognition in practical applications still face multiple challenges due to video quality.

[0004] For example, many models are not good at detecting long-distance or small-sized vehicles, and are prone to missing key targets, especially in complex backgrounds. In addition, the size and shape of vehicles in traffic scenes vary significantly, and existing models are not good at detecting small targets and multi-scales, especially in complex scenes where detection accuracy decreases due to occlusion, lighting changes, or background interference (such as markings, pedestrians). At the same time, high-precision models often have high computational overhead and are difficult to meet real-time requirements. Summary of the invention

[0005] In order to overcome the shortcomings of the above-mentioned prior art, the present invention provides a vehicle detection method and system based on an improved YOLOv8n network. The YOLOv8n network is improved by an RFAConv module and an EMA module, which can highlight the key features of the vehicle area and weaken the background area information, thereby improving the detection accuracy and robustness of the vehicle detection model.

[0006] In order to achieve the above object, the present invention adopts the following technical solution:

[0007] In a first aspect, the present invention provides a vehicle detection method based on an improved YOLOv8n network, comprising:

[0008] Acquire a vehicle image to be detected;

[0009] Inputting the vehicle image to be detected into the vehicle detection model to obtain a vehicle detection result of the vehicle image to be detected;

[0010] Among them, the vehicle detection model is obtained by training an improved YOLOv8n network; the improvement of the YOLOv8n network is: in the shallow feature extraction part, the RFAConv module is used to dynamically adjust the receptive field and cross-feature weighting mechanism to enhance the attention to the key detail features of the vehicle; in the neck network part, the multi-scale parallel convolution and cross-space learning mechanism of the EMA module are used to capture the feature information of different vehicles.

[0011] In a second aspect, the present invention provides a vehicle detection system based on an improved YOLOv8n network, comprising:

[0012] An acquisition module is configured to: acquire an image of a vehicle to be detected;

[0013] A detection module is configured to: input a vehicle image to be detected into a vehicle detection model to obtain a vehicle detection result of the vehicle image to be detected;

[0014] Among them, the vehicle detection model is obtained by training an improved YOLOv8n network; the improvement of the YOLOv8n network is: in the shallow feature extraction part, the RFAConv module is used to dynamically adjust the receptive field and cross-feature weighting mechanism to enhance the attention to the key detail features of the vehicle; in the neck network part, the multi-scale parallel convolution and cross-space learning mechanism of the EMA module are used to capture the feature information of different vehicles.

[0015] In a third aspect, the present invention provides an electronic device comprising a memory and a processor, and computer instructions stored in the memory and executed on the processor, wherein when the computer instructions are executed by the processor, the method described in the first aspect is performed.

[0016] In a fourth aspect, the present invention provides a computer-readable storage medium for storing computer instructions, wherein when the computer instructions are executed by a processor, the method described in the first aspect is performed.

[0017] In a fifth aspect, the present invention provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method described in the first aspect.

[0018] One or more of the above technical solutions have the following beneficial effects:

[0019] In the present invention, the RFAConv module is deployed in the shallow feature extraction part to make it more focused on capturing detail features. The feature map resolution in the shallow convolution is relatively high. Combined with the dynamic receptive field mechanism of the RFAConv module, the model's attention to key details such as vehicle edges and textures can be enhanced in the early stage of feature extraction, which is particularly suitable for detecting small targets and partially occluded targets. The EMA module is used in the neck network part to focus on the final feature optimization and the precise fusion of multi-scale features. The neck network is the key stage for finally generating the target detection results. By introducing the multi-scale parallel convolution and cross-space learning mechanism of the EMA module, the feature information of different vehicles can be captured, which can further optimize the feature expression of the target area and improve the adaptability to complex backgrounds and multi-lane scenes.

[0020] In the present invention, the EMA module is introduced. The EMA module significantly improves the model's feature expression ability for targets of different scales through multi-scale convolution branches and cross-space learning mechanism, and is particularly suitable for multi-lane traffic scenarios with mixed large and small vehicles.

[0021] In the present invention, the RFAConv module and the EMA module are used to improve the YOLOv8n network, which can highlight the key features of the vehicle area and weaken the background area information, thereby improving the detection accuracy and robustness of the vehicle detection model.

[0022] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0024] Figure 1 It is a basic structure diagram of YOLOv8 in Embodiment 1 of the present invention;

[0025] Figure 2 This is a schematic diagram of sharing attention weights between sliders in Embodiment 1 of the present invention;

[0026] Figure 3 Schematic diagram of the structure of the RAconv module in the first embodiment of the present invention;

[0027] Figure 4 This is a schematic diagram of the structure of the EMA module in the first embodiment of the present invention;

[0028] Figure 5 This is a schematic diagram of the improved YOLOv8 network structure in Embodiment 1 of the present invention;

[0029] Figure 6 Schematic diagram of detection based on the improved YOLOv8 network in Embodiment 1 of the present invention;

[0030] Figure 7 This is a schematic diagram of detection based on the YOLOv8 network in Example 1 of the present invention. DETAILED DESCRIPTION

[0031] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.

[0032] It should be noted that the terms used herein are for describing specific embodiments only and are not intended to be limiting of exemplary embodiments according to the present invention.

[0033] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.

[0034] Embodiment 1

[0035] This embodiment discloses a vehicle detection method based on an improved YOLOv8n network, including:

[0036] Acquire a vehicle image to be detected;

[0037] Inputting the vehicle image to be detected into the vehicle detection model to obtain a vehicle detection result of the vehicle image to be detected;

[0038] Among them, the vehicle detection model is obtained by training an improved YOLOv8n network; the improvement of the YOLOv8n network is: in the shallow feature extraction part, the RFAConv module is used to dynamically adjust the receptive field and cross-feature weighting mechanism to enhance the attention to the key detail features of the vehicle; in the neck network part, the multi-scale parallel convolution and cross-space learning mechanism of the EMA module are used to capture the feature information of different vehicles.

[0039] This embodiment integrates the RFAConv (Receptive-Field Attention Convolution) and EMA (Efficient Multi-Scale Attention) modules into the YOLOv8 network; the RFAConv module enhances the detail capture capability, can dynamically adjust the receptive field to more finely extract vehicle detail features, and improve small target detection performance; the EMA module significantly enhances the feature capture capability of multi-scale targets through multi-scale parallel convolution and cross-space learning mechanisms. The EMA module combined with the RFAConv module can highlight the regional features of vehicles while reducing background interference. In addition, the improved YOLOv8 network is used for vehicle detection. This method improves detection accuracy while controlling the computational overhead within a reasonable range, meeting the dual requirements of efficiency and performance of real-time traffic monitoring systems.

[0040] like Figure 1As shown in the figure, YOLOv8 (You Only Look Once, Version 8) is the latest version of the YOLO series. It inherits the real-time characteristics of the YOLO series models and has made significant optimizations in network architecture design, computational efficiency, and detection accuracy. It adopts a modular network structure, including a deeper backbone network and a lightweight neck network, and combines technologies such as CSPNet (Cross Stage Partial Network) and PANet (Path Aggregation Network) to enhance the adaptability to multi-resolution target features. In addition, YOLOv8 improves the expression ability of multi-scale targets by introducing enhanced feature pyramids (FPN) and path aggregation networks (PAN), and uses multi-layer convolution and dynamic allocation mechanisms to optimize the processing of spatial information, further enhancing the adaptability to complex scenes.

[0041] In terms of efficiency and applicability, YOLOv8 significantly reduces computational complexity through network pruning and quantization techniques, enabling it to run efficiently in embedded devices or resource-limited edge computing environments. With the help of optimized loss functions and hyperparameter adjustment strategies, the model not only converges faster, but also has strong generalization capabilities, making it suitable for a variety of tasks such as vehicle detection, pedestrian detection, and industrial quality inspection. Whether in different resolutions, lighting conditions, or complex scenes, YOLOv8 can provide stable performance and is an ideal choice for traffic monitoring, unmanned driving, and security. Specifically, this study uses the YOLOv8n network structure. Compared with other network results, YOLOv8n is an ideal choice for vehicle detection and traffic monitoring due to its lightweight and high efficiency. It can achieve fast inference under low computational overhead (GFLOPs) and limited hardware resources, and can meet the real-time processing requirements of high frame rate videos. It is particularly suitable for large-scale traffic monitoring and embedded device scenarios.

[0042] In the existing YOLO network, the fixed receptive field mechanism of the convolution layer limits the ability to capture details, especially when dealing with vehicles at long distances, small targets or in complex backgrounds, the detection performance is relatively insufficient. The RFAConv module replaces the traditional convolution operation and effectively improves the model's detection accuracy for vehicles of different scales and positions by dynamically adjusting the receptive field.

[0043] In this embodiment, the improvement of the YOLOv8 network is specifically as follows: in the shallow feature extraction part of the YOLOv8 network, RFAConv modules are added before the input of the second C2f module and the third C2f module respectively; in the neck network part, EMA modules are added after the output of the first Concat module and the second Concat module respectively.

[0044] Figure 2 and Figure 3 The problem of shared attention weights of sliders and the structural diagram of RFAConv are shown respectively. The RFAConv module introduces receptive field spatial features and dynamic convolution parameters, making the YOLO network more adaptable when detecting vehicles of different sizes and locations.

[0045] The working principle of the RFAConv module includes the following points:

[0046] (1) The RFAConv module uses an efficient group convolution method to independently extract spatial features in each receptive field, avoiding detail loss caused by parameter sharing. This ability to dynamically adjust convolution parameters makes it particularly suitable for the diverse features presented by vehicles in traffic scenes due to changes in position and perspective.

[0047] (2) Cross-feature weighting: The RFAConv module generates attention weights by globally pooling the feature maps of each receptive field; these weights are then normalized through Softmax and multiplied with the original feature maps to form weighted features.

[0048] In traffic flow prediction, this mechanism can effectively highlight the key feature areas of the vehicle (such as the front and outline) and weaken the interference information in the background (such as road markings, obstructions, etc.), thereby improving the vehicle recognition ability of the YOLO model in complex scenes. The calculation formula can be expressed as:

[0049] F = Softmax(g 1×1 (AvgPool(X)))×ReLU(Norm(g k×k (X)))=A rf ×F rf

[0050] Among them, g i×i represents a grouped convolution of size i×i, k represents the size of the convolution kernel, Norm represents normalization, X represents the input feature map of the RFAConv module, and F is composed of the attention map A. rf and the transformed receptive field spatial feature F rf Multiply them together to get .

[0051] Specifically, the RFAConv module enhances the ability to capture detailed features by dynamically adjusting the weight of the receptive field, and can extract the edge and texture information of the vehicle more finely, which is particularly suitable for the detection of long-distance vehicles or partially occluded targets. In addition, this embodiment deploys the RFAConv module in the shallow feature extraction part to make it more focused on capturing detailed features. In shallow feature extraction, the RFAConv module takes advantage of the high-resolution feature map and combines the dynamic receptive field mechanism of the RFAConv module to adapt to the diverse features of vehicles in traffic scenes due to changes in size, angle and illumination. At the same time, the weighting mechanism of RFAConv can highlight the key features of the vehicle area and reduce background interference, such as markings, obstructions, etc., so that the model can show higher robustness and detection accuracy in dense or complex vehicle scenes.

[0052] The existing YOLO network has deficiencies in the fusion of multi-scale features and adaptability to complex scenes in the neck network. Although it can receive multi-scale feature maps from the backbone network, the feature fusion is not sufficient when dealing with targets with significant size differences, especially in the detection of small targets at a distance and large targets at a close distance. In addition, the existing neck network has limited modeling capabilities for long-range dependencies, making it difficult to accurately distinguish the boundaries between multiple lanes or densely packed vehicles, especially in complex scenes with occlusions, which can easily lead to false detections or missed detections.

[0053] like Figure 4 As shown in the figure, the EMA module uses multi-scale parallel convolution and cross-space learning mechanism to significantly enhance the YOLO model's detection ability for multi-scale targets and complex scenes.

[0054] The specific design of the EMA module is as follows:

[0055] (1) Multi-scale parallel branches: The core design of the EMA module is to introduce 1×1 convolution branches and 3×3 convolution branches, which are used to capture local details and global context information respectively. In traffic flow prediction, the scale of vehicles will change significantly due to distance and angle changes. The 1×1 convolution can focus on the detailed features of small-scale vehicles, while the 3×3 convolution can capture a wider range of background and context information. This multi-scale branch structure can be executed in parallel in the convolutional layer of the YOLO model to simultaneously identify large and small vehicles with high accuracy.

[0056] (2) Cross-spatial learning: The EMA module uses a cross-spatial attention aggregation method to capture pixel-level global spatial information by performing matrix dot multiplication operations on the outputs of 1×1 and 3×3 convolution branches. This mechanism strengthens the vehicle association modeling capabilities in multi-lane and large-viewing-angle-change scenarios, and significantly improves the boundary resolution capabilities between densely packed objects.

[0057] The EMA module is integrated into the neck network of the YOLO network to enhance the multi-scale feature fusion capability. The EMA module enhances the adaptability of the model to complex traffic scenes by capturing the feature information of vehicles of different sizes. In addition, its cross-space learning mechanism strengthens the modeling capability of pixel-level global relationships and adapts to the distribution of vehicles in multiple lanes and complex backgrounds. Finally, the attention mechanism of the EMA module further optimizes the feature map, highlights the feature weights of the target area, and ensures the accuracy and robustness of the final detection results, even in scenes with severe occlusion or dense vehicles. High detection accuracy can be maintained.

[0058] The neck network of the YOLO network is the key stage for generating the final target detection results. By introducing the multi-scale parallel convolution and cross-space learning mechanism of the EMA module, the feature expression of the target area can be further optimized and the adaptability to complex backgrounds and multi-lane scenes can be improved.

[0059] Although YOLOv8n is a lightweight model suitable for real-time detection, its detection accuracy in traffic scenes can approach the level of larger models after combining RFAConv and EMA modules. Especially when dealing with complex traffic scenes (such as multi-lane, occlusion, and long-distance vehicle detection), YOLOv8n achieves the best balance between performance and efficiency with its high efficiency and flexibility, making it an ideal choice for actual traffic detection applications.

[0060] like Figure 5 As shown in the figure, this embodiment uses the RFAConv module placed in the shallow feature extraction part of YOLOv8n to capture local details and enhance the quality of initial features. The EMA module is placed in the neck network part of YOLOv8n to fuse multi-scale information and enhance the robustness of global features. This design combines the characteristics of the two modules, which can not only improve the network's sensitivity to small targets and local details, but also enhance the modeling capabilities of multi-scale and global features, thereby achieving the best performance in traffic vehicle detection tasks.

[0061] Integrating RFAConv and EMA modules in the YOLOv8n network enables the model to strike a balance between capturing detailed features and global context information. RFAConv and EMA each focus on different feature attention directions:

[0062] 1. Complementarity between local details and global information: RFAConv provides more sophisticated local feature processing capabilities by extracting spatial features of the receptive field. It generates different weights for each region within the receptive field, avoiding information loss caused by parameter sharing, allowing the model to focus more accurately on the key details of each vehicle (such as the front and rear of the vehicle). Introducing RFAConv in the shallow convolution part of the YOLOv8n network can ensure that the model accurately weights the important detail areas in the image in the early stage, enhancing the model's recognition effect on small vehicles or occluded vehicles.

[0063] 2. Relatively speaking, the EMA module provides good global information capture capabilities by using multi-scale convolution and cross-space feature fusion in the convolution operations of the middle and later layers. Its multi-scale convolution structure can extract features at different scales, making the model more sensitive to the contours of distant vehicles and large-scale feature information. The cross-space matrix dot multiplication operation further enhances the attention to the global context at the pixel level, enabling the model to cope with densely packed vehicles in traffic scenes, thereby better detecting vehicles in multiple lanes.

[0064] 3. Strengthening of multi-scale information and long-range dependencies: In actual traffic scenarios, the size and position of vehicles change significantly with factors such as viewing angle and distance. RFAConv and EMA modules complement each other in capturing multi-scale information through their own mechanisms.

[0065] In summary, the RFAConv module uses local receptive field features to ensure that the model can independently weight according to local spatial differences when dealing with small-scale vehicles, thereby increasing attention to vehicle details. This is particularly effective for dealing with close-range or small-sized vehicles, and can maintain high detail accuracy. The EMA module simultaneously extracts features at different scales through 1×1 and 3×3 convolution branches, building efficient perception capabilities for targets of different sizes. In large-scale traffic scenes, the multi-scale feature aggregation of the 3×3 convolution branch helps capture the overall contour and background information of the vehicle, while the 1×1 convolution branch retains local fine features, thereby ensuring accuracy in long-distance and multi-scale vehicle detection. In addition, the cross-space learning mechanism of the EMA module fuses features from the 1×1 and 3×3 branches through matrix dot multiplication operations. This mechanism not only captures global contextual relationships, but also enhances the modeling of long-range dependencies, enabling the model to better identify vehicles in complex traffic environments.

[0066] The improved YOLOv8 method based on RFAConv and EMA modules proposed in this embodiment greatly improves the applicability and detection effect of the model in traffic vehicle detection, and is suitable for deployment in actual traffic flow monitoring systems. In daily traffic flow monitoring and road safety management, the combination of RFAConv and EMA enables the model to have strong anti-interference ability and detail sensitivity, and can ensure high detection accuracy even in complex traffic scenes (such as night, rain and fog), providing more reliable detection results.

[0067] The improved YOLOv8 proposed in this implementation is experimentally verified for vehicle detection, specifically:

[0068] Hardware equipment: The training is carried out on NVIDIA RTX3080 and 13th Gen Intel(R)Core(TM)i5-13600KF3.50GHz devices to ensure the efficiency of the training process and the stability of the results.

[0069] Dataset: We use a self-made traffic vehicle dataset, which consists of different conditions and traffic densities, including many challenging scenes where vehicles, bicycles, and pedestrians move between each other. It contains 30,000 vehicle images in different traffic scenarios including distance, weather, etc., and is used to evaluate the accuracy of the model in traffic vehicle detection tasks.

[0070] Model comparison: The following four models are trained and tested using the same dataset to evaluate the effectiveness of different modules:

[0071] Model 1: Ordinary YOLOv8 network;

[0072] Model 2: YOLOv8+RFAConv;

[0073] Model 3: YOLOv8+EMA;

[0074] Model 4: Combination model of YOLOv8+RFAConv and EMA.

[0075] Evaluation indicators: Precision, recall, mean average precision (mAP) and computing speed (GFLOPs) are used as the performance measurement criteria of the model, and the values ​​are shown in Table 1. In addition, the vehicle detection results of the improved detection algorithm proposed in this study and the traditional YOLOv8 algorithm are shown in the following table. Figure 6 , Figure 7 shown.

[0076] Table 1: Comparison of experimental results

[0077]

[0078] This experiment verifies the effectiveness of integrating the RFAConv and EMA modules in the YOLOv8 network, and compares the performance of different models in the traffic vehicle detection task in detail. Based on the experimental data, the following key conclusions can be drawn:

[0079] Detection accuracy is significantly improved: Experimental results show that the model with RFAConv and EMA is significantly better than the ordinary YOLOv8 in terms of accuracy (Precision = 0.90896) and mAP (0.86848). The RFAConv module strengthens the capture of local detail features, and the EMA module enhances the model's adaptability to complex backgrounds and multi-scale targets through multi-scale feature fusion.

[0080] Computational efficiency remains reasonable: Although the operation speed of the model integrating RFAConv and EMA modules has increased slightly (from 6.9GFLOPs to 7.4-7.5GFLOPs), the increase in computational overhead is relatively moderate compared to the performance improvement. Especially in application scenarios such as real-time traffic monitoring, the advantage of improved accuracy can effectively compensate for the slightly higher computational cost. This efficiency-performance balance is particularly important for traffic flow monitoring systems that require real-time, high-precision detection.

[0081] The modules complement each other and are suitable for complex traffic scenarios: Experimental results show that the RFAConv module is good at local feature extraction, while the EMA module strengthens global spatial feature learning. In complex traffic scenarios, the scale, perspective, occlusion, etc. of vehicles vary greatly. Combining the two into YOLOv8 can stably detect vehicles in different scenarios and is not easily affected by background interference. RFAConv focuses on the changes in details within each receptive field and is suitable for identifying smaller or partially occluded vehicles; EMA excels in capturing multi-scale information and long-distance dependencies, and is more suitable for identifying vehicles in dense traffic or multi-lane scenarios.

[0082] Practical application value for traffic vehicle detection: Through experimental verification, the integration of RFAConv and EMA modules not only improves the detection capability of the YOLOv8 network, but also has good computational efficiency, making it suitable for efficient traffic flow detection systems. This method can significantly improve the detection accuracy of traffic monitoring in practical applications, providing more reliable technical support for traffic flow management and road safety monitoring.

[0083] This experiment verifies the actual effect of RFAConv and EMA modules in traffic vehicle detection. The combination of the two enhances local detail capture and global feature modeling, making the YOLOv8 model perform well in traffic scenes of different complexities, providing important support for building a stable and reliable vehicle detection system. Future research can further optimize the network structure on this basis and combine more advanced attention mechanisms to achieve higher real-time performance and detection accuracy.

[0084] Embodiment 2

[0085] The purpose of this embodiment is to provide a vehicle detection system based on an improved YOLOv8n network, including:

[0086] An acquisition module is configured to: acquire an image of a vehicle to be detected;

[0087] A detection module is configured to: input a vehicle image to be detected into a vehicle detection model to obtain a vehicle detection result of the vehicle image to be detected;

[0088] Among them, the vehicle detection model is obtained by training an improved YOLOv8n network; the improvement of the YOLOv8n network is: in the shallow feature extraction part, the RFAConv module is used to dynamically adjust the receptive field and cross-feature weighting mechanism to enhance the attention to the key detail features of the vehicle; in the neck network part, the multi-scale parallel convolution and cross-space learning mechanism of the EMA module are used to capture the feature information of different vehicles.

[0089] In further embodiments, there is also provided:

[0090] An electronic device includes a memory and a processor, and computer instructions stored in the memory and executed on the processor, wherein when the computer instructions are executed by the processor, the method described in Embodiment 1 is performed. For the sake of brevity, no further description is given here.

[0091] It should be understood that in this embodiment, the processor may be a central processing unit CPU, and the processor may also be other general-purpose processors, digital signal processors DSP, application-specific integrated circuits ASIC, off-the-shelf programmable gate arrays FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0092] The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.

[0093] A computer-readable storage medium is used to store computer instructions. When the computer instructions are executed by a processor, the method described in embodiment 1 is completed.

[0094] The method in the first embodiment can be directly embodied as a hardware processor, or a combination of hardware and software modules in the processor. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware. To avoid repetition, it will not be described in detail here.

[0095] A computer program product includes a computer program, and when the computer program is executed by a processor, the method described in the first embodiment is implemented.

[0096] The present invention also provides at least one computer program product tangibly stored on a non-transitory computer-readable storage medium. The computer program product includes computer executable instructions, such as instructions included in a program module, which are executed in a device on a real or virtual processor of the target to perform the process / method as described above. Typically, program modules include routines, programs, libraries, objects, classes, components, data structures, etc. that perform specific tasks or implement specific abstract data types. In various embodiments, the functions of program modules can be combined or divided between program modules as needed. Machine executable instructions for program modules can be executed in local or distributed devices. In distributed devices, program modules can be located in local and remote storage media.

[0097] The computer program code for implementing the method of the present invention can be written in one or more programming languages. These computer program codes can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the computer or other programmable data processing device, causes the function / operation specified in the flow chart and / or block diagram to be implemented. The program code can be executed completely on a computer, partially on a computer, as an independent software package, partially on a computer and partially on a remote computer or completely on a remote computer or server.

[0098] In the context of the present invention, computer program codes or related data may be carried by any appropriate carrier to enable a device, apparatus or processor to perform the various processes and operations described above. Examples of carriers include signals, computer readable media, etc. Examples of signals may include electrical, optical, radio, acoustic or other forms of propagation signals, such as carrier waves, infrared signals, etc.

[0099] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with this embodiment can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0100] Although the above describes the specific implementation mode of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.

Claims

1. A vehicle detection method based on an improved YOLOv8n network, characterized in that: include: Acquire a vehicle image to be detected; Inputting the vehicle image to be detected into the vehicle detection model to obtain a vehicle detection result of the vehicle image to be detected; Among them, the vehicle detection model is obtained by training an improved YOLOv8n network; the improvement of the YOLOv8n network is: in the shallow feature extraction part, the RFAConv module is used to dynamically adjust the receptive field and cross-feature weighting mechanism to enhance the attention to the key detail features of the vehicle; in the neck network part, the multi-scale parallel convolution and cross-space learning mechanism of the EMA module are used to capture the feature information of different vehicles.

2. A vehicle detection method based on an improved YOLOv8n network as claimed in claim 1, characterized in that: In the shallow feature extraction part, the RFAConv module is used to enhance the focus on the key detail features of the vehicle by dynamically adjusting the receptive field and cross-feature weighting mechanism. Specifically: Using the group convolution of the RFAConv module, spatial features are extracted independently in each receptive field; Generate attention weights by globally pooling the spatial features of each receptive field; The generated attention weights are normalized by Softmax, and the normalized results are multiplied by the original feature map of the input of the RFAConv module to obtain the weighted features.

3. A vehicle detection method based on an improved YOLOv8n network as claimed in claim 1, characterized in that: In the neck network part, the multi-scale parallel convolution and cross-space learning mechanism of the EMA module are used to capture the characteristic information of different vehicles. Specifically: Capture local details and global context information of vehicles through multi-scale branches respectively; Using the cross-spatial attention aggregation method, the output results of the multi-scale branches are matrix-multiplied to capture pixel-level global spatial information.

4. A vehicle detection method based on an improved YOLOv8n network as claimed in claim 1, characterized in that: Multi-scale branches are used to capture the local details and global context information of the vehicle respectively. Specifically, 1×1 convolution branches and 3×3 convolution branches are used to capture local details and global context information respectively.

5. A vehicle detection method based on an improved YOLOv8n network as claimed in claim 1 or 2, characterized in that: The RFAConv module is used to dynamically adjust the weight of the receptive field, enhance the ability to capture detailed features, and finely extract the edge and texture information of the vehicle; the weighting mechanism of the RFAConv module is used to highlight the key features of the vehicle area.

6. A vehicle detection system based on an improved YOLOv8n network, characterized in that: include: An acquisition module is configured to: acquire an image of a vehicle to be detected; A detection module is configured to: input a vehicle image to be detected into a vehicle detection model to obtain a vehicle detection result of the vehicle image to be detected; Among them, the vehicle detection model is obtained by training an improved YOLOv8n network; the improvement of the YOLOv8n network is: in the shallow feature extraction part, the RFAConv module is used to dynamically adjust the receptive field and cross-feature weighting mechanism to enhance the attention to the key detail features of the vehicle; in the neck network part, the multi-scale parallel convolution and cross-space learning mechanism of the EMA module are used to capture the feature information of different vehicles.

7. A vehicle detection system based on an improved YOLOv8n network as claimed in claim 6, characterized in that: In the detection module, the RFAConv module is used to dynamically adjust the weight of the receptive field, enhance the ability to capture detailed features, and finely extract the edge and texture information of the vehicle; the weighting mechanism of the RFAConv module is used to highlight the key features of the vehicle area.

8. An electronic device, characterized in that: The method comprises a memory and a processor, and computer instructions stored in the memory and executed on the processor, wherein when the computer instructions are executed by the processor, the method according to any one of claims 1 to 5 is completed.

9. A computer-readable storage medium, characterized in that: Used to store computer instructions, which, when executed by a processor, complete the method described in any one of claims 1 to 5.

10. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Solar cell surface defect detection method and system based on improved YOLOv8

    CN117994210A

  • Deep learning-based abnormal facility detection method and apparatus, and electronic device

    CN118608774A

  • Product small target defect detection method based on YoloV8

    CN118628885A

  • Urban vehicle target detection method based on improved YOLOv8

    CN118823301A

  • KR20230053347A