A vehicle detection method and system based on improved YOLOv8n network

By introducing the RFAConv and EMA modules into the YOLOv8n network, the vehicle detection model's ability to capture key details and multi-scale features is enhanced, solving the problem of insufficient detection accuracy of existing models in complex backgrounds and achieving efficient vehicle detection results.

CN119693890BActive Publication Date: 2025-10-03SHANDONG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing vehicle detection models perform poorly in long-distance or small-sized vehicle detection, especially in complex backgrounds where key targets are easily missed. High-precision models have high computational overhead and are difficult to meet real-time requirements.

Method used

The RFAConv module is used to dynamically adjust the receptive field and cross-feature weighting mechanism in the shallow feature extraction part to enhance the focus on key detail features of the vehicle; the multi-scale parallel convolution and cross-space learning mechanism of the EMA module are used in the neck network part to capture the characteristic information of different vehicles.

Benefits of technology

The detection accuracy and robustness of the vehicle detection model are improved, adapting to complex backgrounds and multi-lane scenarios, and the computational overhead is controlled within a reasonable range to meet the needs of real-time traffic monitoring systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119693890B_ABST
    Figure CN119693890B_ABST
Patent Text Reader

Abstract

The present invention proposes a vehicle detection method and system based on an improved YOLOv8n network. The RFAConv module is deployed in the shallow feature extraction part, so that it is more focused on capturing detailed 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. It is particularly suitable for detecting small targets and partially occluded targets in vehicle detection. The EMA module is used in the neck network part, focusing 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 expression of the target area can be further optimized, and the adaptability to complex backgrounds and multi-lane scenes can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of vehicle detection technology, 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 faces multiple challenges due to video quality issues.

[0004] For example, many models struggle with detecting long-range or small vehicles, and are particularly prone to missing key targets in complex backgrounds. Furthermore, the size and shape of vehicles in traffic scenes vary significantly, and existing models struggle with detecting small targets and at multiple scales. This is especially true in complex scenes, where detection accuracy decreases due to occlusion, lighting variations, or background interference (such as road markings or pedestrians). Furthermore, high-precision models often have high computational overhead, making it difficult to meet real-time requirements. Summary of the Invention

[0005] To overcome the above-mentioned shortcomings of the prior art, the present invention provides a vehicle detection method and system based on an improved YOLOv8n network. The YOLOv8n network is improved by the RFAConv module and the EMA module, which can highlight the key features of the vehicle area while weakening 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 solutions:

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

[0008] Obtaining an image of a vehicle 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 as follows: in the shallow feature extraction part, the RFAConv module is used to enhance the focus on key detail features of the vehicle by dynamically adjusting the receptive field and cross-feature weighting mechanism; 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.

[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 as follows: in the shallow feature extraction part, the RFAConv module is used to enhance the focus on key detail features of the vehicle by dynamically adjusting the receptive field and cross-feature weighting mechanism; 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.

[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 the computer instructions, when executed by the processor, perform the method described in the first aspect.

[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 implements the method described in the first aspect when executed by a processor.

[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, so that it can focus more on capturing detailed 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 especially suitable for detecting small targets and partially occluded targets; the EMA module is used in the neck network part, focusing on the final feature optimization and precise fusion of multi-scale features. The neck network is the key stage for finally generating 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 this invention, the EMA module is introduced. The EMA module significantly improves the model's ability to express features of targets of different scales through multi-scale convolution branches and cross-space learning mechanism. It 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 be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The accompanying drawings, 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 This is a basic structural diagram of YOLOv8 in Example 1 of the present invention;

[0025] Figure 2 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 Example 1 of the present invention;

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

[0028] Figure 5 Schematic diagram of the improved YOLOv8 network structure in Example 1 of the present invention;

[0029] Figure 6 Schematic diagram of detection based on the improved YOLOv8 network in Example 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 intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as 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 particular embodiments only and are not intended to limit the exemplary embodiments according to the present invention.

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

[0034] Example 1

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

[0036] Obtaining an image of a vehicle 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 as follows: in the shallow feature extraction part, the RFAConv module is used to enhance the focus on key detail features of the vehicle by dynamically adjusting the receptive field and cross-feature weighting mechanism; 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.

[0039] This embodiment integrates the RFAConv (Receptive-Field Attention Convolution) and EMA (Efficient Multi-Scale Attention) modules into the YOLOv8 network; among them, the RFAConv module enhances the detail capture capability, can dynamically adjust the receptive field to more finely extract vehicle detail features, and improve the 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 mechanism. The EMA module, combined with the RFAConv module, can highlight the vehicle area features while reducing background interference. In addition, the improved YOLOv8 network is used for vehicle detection. This method improves the detection accuracy while controlling the computational overhead within a reasonable range, meeting the dual requirements of efficiency and performance of the real-time traffic monitoring system.

[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 significantly optimizes network architecture design, computational efficiency, and detection accuracy. It adopts a modular network structure, including a deeper backbone network and a lightweight neck network. At the same time, it combines technologies such as CSPNet (Cross Stage Partial Network) and PANet (Path Aggregation Network) to enhance its adaptability to multi-resolution target features. In addition, YOLOv8 improves the representation of multi-scale targets by introducing an enhanced feature pyramid (FPN) and a path aggregation network (PAN). It also uses multi-layer convolution and dynamic allocation mechanisms to optimize the processing of spatial information, further enhancing its adaptability to complex scenes.

[0041] In terms of efficiency and applicability, YOLOv8 significantly reduces computational complexity through network pruning and quantization techniques, enabling efficient operation on embedded devices or resource-constrained edge computing environments. Leveraging an optimized loss function and hyperparameter tuning strategy, the model not only converges faster but also exhibits strong generalization capabilities, making it suitable for a variety of tasks such as vehicle detection, pedestrian detection, and industrial quality inspection. YOLOv8 delivers stable performance across diverse resolutions, lighting conditions, and complex scenarios, making it an ideal choice for traffic monitoring, autonomous driving, and security. Specifically, this study utilized the YOLOv8n network architecture. Compared to other network architectures, YOLOv8n's lightweight and efficient performance makes it an ideal choice for vehicle detection and traffic monitoring. It achieves fast inference with low computational overhead (GFLOPs) and limited hardware resources, meeting the real-time processing requirements of high-frame-rate video, making it particularly suitable for large-scale traffic monitoring and embedded device scenarios.

[0042] In existing YOLO networks, the fixed receptive field of the convolutional layer limits its ability to capture detail, especially when dealing with small objects at long distances or in complex backgrounds. The RFAConv module replaces the traditional convolution operation and dynamically adjusts the receptive field, effectively improving the model's detection accuracy for vehicles of varying scales and positions.

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

[0044] Figure 2 and Figure 3 The problem of slider shared attention weights and the structural diagram of RFAConv are respectively shown. 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 positions.

[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 within each receptive field, avoiding detail loss caused by parameter sharing. This ability to dynamically adjust convolution parameters makes it particularly suitable for the diverse characteristics of 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 by 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 a vehicle (such as the front and outline) while weakening interference information in the background (such as road markings, obstructions, etc.), thereby improving the YOLO model's ability to identify vehicles in complex scenarios. Its 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 weights of the receptive field, and can extract the edge and texture information of the vehicle more finely, which is especially 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, so that it focuses more 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 exhibits higher robustness and detection accuracy in scenes with dense or complex vehicles.

[0052] The existing YOLO network's neck network lacks the ability to fuse multi-scale features and adapt to complex scenarios. While capable of receiving multi-scale feature maps from the backbone network, feature fusion is insufficient when dealing with objects of significantly different sizes. This is particularly true for detecting small objects at a distance and large objects at close range. Furthermore, the neck network's limited ability to model long-range dependencies makes it difficult to accurately distinguish boundaries between multiple lanes or densely packed vehicles. This makes false detections and missed detections more likely, especially in complex scenarios with occlusions.

[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 ability to detect 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 can vary 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 background and context information on a larger scale. This multi-scale branch structure can be executed in parallel in the convolutional layers of the YOLO model to achieve high-precision recognition of both large and small vehicles.

[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 the 1×1 and 3×3 convolution branches. This mechanism strengthens the vehicle association modeling capabilities in multi-lane and viewpoint-variable scenarios and significantly improves the ability to resolve boundaries between densely packed objects.

[0057] The EMA module is integrated into the YOLO network's neck network to enhance multi-scale feature fusion capabilities. By capturing the characteristic information of vehicles of varying sizes, the EMA module enhances the model's adaptability to complex traffic scenarios. Furthermore, its cross-spatial learning mechanism strengthens the modeling of pixel-level global relationships, adapting to vehicle distribution in multiple lanes and complex backgrounds. Finally, the EMA module's attention mechanism further optimizes feature maps, highlighting the feature weights of target regions, ensuring the accuracy and robustness of the final detection results, even in scenes with severe occlusion or dense traffic.

[0058] The neck network of the YOLO network is the key stage in 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 scenarios can approach the level of larger models when combined with RFAConv and EMA modules. Especially when dealing with complex traffic scenarios (such as multi-lane, occlusion, and long-distance vehicle detection), YOLOv8n, with its efficient and flexible features, achieves an optimal balance between performance and efficiency, making it an ideal choice for practical traffic detection applications.

[0060] like Figure 5 As shown, 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 YOLOv8n core network to fuse multi-scale information and enhance the robustness of global features. This design combines the characteristics of these two modules, improving the network's sensitivity to small objects and local details while enhancing the modeling capabilities of multi-scale and global features, thereby achieving optimal performance in traffic vehicle detection tasks.

[0061] Integrating RFAConv and EMA modules into 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 refined local feature processing capabilities by extracting spatial features from 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 more accurately focus on the key details of each vehicle (such as the front and rear). Introducing RFAConv in the shallow convolutional layer of the YOLOv8n network ensures that the model accurately weights important detail areas in the image from an early stage, enhancing the model's recognition of small or occluded vehicles.

[0063] 2. Comparatively speaking, the EMA module utilizes multi-scale convolution and cross-spatial feature fusion in convolution operations in mid- and late-layer layers, providing excellent global information capture capabilities. Its multi-scale convolutional structure extracts features at different scales, making the model more sensitive to the outlines of distant vehicles and large-scale feature information. Cross-spatial matrix dot products further enhance attention to pixel-level global context, enabling the model to cope with densely packed traffic scenarios and better detect vehicles in multiple lanes.

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

[0065] In summary, the RFAConv module leverages local receptive field features to ensure that the model independently weights local spatial differences when processing small-scale vehicles, enhancing its focus on vehicle details. This is particularly effective for processing close-range or small vehicles, maintaining high detail accuracy. The EMA module simultaneously extracts features at different scales through 1×1 and 3×3 convolutional branches, building efficient perception capabilities for objects of varying sizes. In large-scale traffic scenarios, the multi-scale feature aggregation of the 3×3 convolutional branch helps capture the overall outline and background information of the vehicle, while the 1×1 convolutional branch preserves fine local features, ensuring accurate detection of vehicles at long distances and at multiple scales. Furthermore, the EMA module's cross-spatial learning mechanism fuses features from the 1×1 and 3×3 branches through matrix dot products. This mechanism not only captures global context 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 the RFAConv and EMA modules proposed in this example significantly improves the model's applicability and effectiveness in traffic vehicle detection, making it suitable for deployment in actual traffic flow monitoring systems. In daily traffic flow monitoring and road safety management, the combination of RFAConv and EMA gives the model strong anti-interference capabilities and detail sensitivity, ensuring high detection accuracy and providing more reliable detection results even in complex traffic scenarios (such as at night, in rain and fog).

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

[0068] Hardware: The training was conducted on NVIDIA RTX3080 and 13th Gen Intel(R) Core(TM) i5-13600KF 3.50GHz devices, ensuring efficient training and stable results.

[0069] Dataset: We use a self-made traffic vehicle dataset, which consists of various conditions and traffic densities, including many challenging scenarios involving vehicles, bicycles, and pedestrians. The dataset contains 30,000 vehicle images in various traffic scenarios, including distance and weather conditions, and is used to evaluate the accuracy of the model in traffic vehicle detection tasks.

[0070] Model comparison: The following four models were 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: Combined 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 standards 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 Table 1. Figure 6 、 Figure 7 shown.

[0076] Table 1: Comparison of experimental results

[0077]

[0078] This experiment verified the effectiveness of integrating the RFAConv and EMA modules in the YOLOv8 network and compared 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] Significantly improved detection accuracy: Experimental results show that the model incorporating RFAConv and EMA significantly outperforms standard YOLOv8 in terms of accuracy (Precision = 0.90896) and mAP (0.86848). The RFAConv module enhances the capture of local detail features, while the EMA module enhances the model's adaptability to complex backgrounds and multi-scale objects through multi-scale feature fusion.

[0080] Computational efficiency remains reasonable: Although the computational speed of the model integrating the RFAConv and EMA modules increases slightly (from 6.9 GFLOPs to 7.4–7.5 GFLOPs), the increase in computational overhead is relatively modest compared to the performance improvement. In applications such as real-time traffic monitoring, the improved accuracy effectively offsets 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's strengths and are suitable for complex traffic scenarios: Experimental results show that the RFAConv module excels at local feature extraction, while the EMA module strengthens global spatial feature learning. In complex traffic scenarios, vehicles vary significantly in scale, perspective, occlusion, and other factors. Combining the two into YOLOv8 enables stable vehicle detection in diverse scenarios, while being less susceptible to background interference. RFAConv focuses on detailed variations within each receptive field, making it suitable for identifying small or partially occluded vehicles. EMA, on the other hand, excels at capturing multi-scale information and long-range dependencies, making it more suitable for identifying vehicles in dense traffic or multi-lane scenarios.

[0082] Practical Application Value for Traffic Vehicle Detection: Experimental verification demonstrates that the integration of RFAConv and EMA modules not only enhances the detection capabilities of the YOLOv8 network but also offers improved computational efficiency, making it suitable for efficient traffic flow detection systems. This approach 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 validated the effectiveness of the RFAConv and EMA modules in traffic vehicle detection. By combining these two modules, which enhance local detail capture and global feature modeling, the YOLOv8 model performs exceptionally well in traffic scenarios of varying complexity, providing crucial support for building a stable and reliable vehicle detection system. Future research can build on this foundation by further optimizing the network structure and incorporating more advanced attention mechanisms to achieve even higher real-time performance and detection accuracy.

[0084] Example 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 as follows: in the shallow feature extraction part, the RFAConv module is used to enhance the focus on key detail features of the vehicle by dynamically adjusting the receptive field and cross-feature weighting mechanism; 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.

[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 by the processor. When the computer instructions are executed by the processor, the method described in Example 1 is performed. For the sake of brevity, no further details are given here.

[0091] It should be understood that in this embodiment, the processor may be a central processing unit (CPU), or may be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), off-the-shelf field-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 any conventional processor, etc.

[0092] The memory may include a read-only memory and a random access memory, and provides 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, and when the computer instructions are executed by a processor, the method described in embodiment 1 is performed.

[0094] The method in Example 1 can be directly implemented as being executed by a hardware processor, or by a combination of hardware and software modules within the processor. The software module can be located in a storage medium well-established in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. The storage medium is located in the memory, and the processor reads the information in the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, a detailed description is not given here.

[0095] A computer program product includes a computer program, and when the computer program is executed by a processor, the method described in embodiment 1 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 contained in program modules, which are executed in a device on a real or virtual processor of a target to perform the process / method described above. Generally, 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 functionality of program modules can be combined or divided between program modules as needed. The machine-executable instructions for the 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 a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the computer or other programmable data processing device, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on a computer, partially on a computer, as an independent software package, partially on a computer and partially on a remote computer, or entirely on a remote computer or server.

[0098] In the context of the present invention, computer program code or related data can 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, and the like. Examples of signals include electrical, optical, radio, acoustic, or other forms of propagated signals, such as carrier waves, infrared signals, and the like.

[0099] Those skilled in the art will appreciate that the units and algorithm steps of the various examples 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. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0100] Although the above describes the specific embodiments 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 any 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: Obtaining an image of a vehicle 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 as follows: in the shallow feature extraction part, RFAConv modules are added before the input of the second C2f module and the third C2f module respectively, and the RFAConv module is used to enhance the attention to the key detail features of the vehicle by dynamically adjusting the receptive field and cross-feature weighting mechanism; in the neck network part, EMA modules are added after the output of the first Concat module and the second Concat module respectively, and 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, RFAConv modules are added before the input of the second and third C2f modules respectively. The RFAConv modules enhance the focus on key details 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, EMA modules are added after the output of the first and second Concat modules, respectively. The multi-scale parallel convolution and cross-space learning mechanism of the EMA modules are used to capture the characteristic information of different vehicles. Specifically: Capture local details and global context information of the vehicle separately through multi-scale branches; Using the cross-spatial attention aggregation method, the output results of the multi-scale branches are subjected to matrix dot multiplication operations to capture pixel-level global spatial information.

4. A vehicle detection method based on an improved YOLOv8n network as claimed in claim 3, 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 described 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 as follows: in the shallow feature extraction part, RFAConv modules are added before the input of the second C2f module and the third C2f module respectively, and the RFAConv module is used to enhance the attention to the key detail features of the vehicle by dynamically adjusting the receptive field and cross-feature weighting mechanism; in the neck network part, EMA modules are added after the output of the first Concat module and the second Concat module respectively, and 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 according to any one of claims 1 to 5.

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

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