Target detection method and device, equipment and storage medium

By integrating attention mechanism and deformable convolution on the Yolov7-Tiny model, an optimized weight model is built, which solves the contradiction between target detection accuracy and speed in the field of autonomous driving, and achieves efficient and accurate target detection.

CN119251785APending Publication Date: 2025-01-03HUAZHONG UNIV OF SCI & TECH +2
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411166800.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

Existing object detection algorithms are difficult to achieve efficient and accurate object detection in the field of autonomous driving, especially when dealing with complex scenarios and multi-variable targets. Although the lightweight model of a single-stage model improves speed but sacrifices accuracy, it is difficult to meet the automatic. Driving requirements.

Method used

Based on the Yolov7-Tiny model, the attention deformable convolution Yolov7-Tiny model is integrated to build the attention deformed convolution Yolov7-Tiny model, and optimize the weight model through pre-training and data enhancement to improve the accuracy and efficiency of detection.

Benefits of technology

It realizes more efficient and accurate object detection in the field of autonomous driving, improves detection accuracy and speed, is suitable for resource-constrained environments, taking into account real-time and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119251785A_ABST
    Figure CN119251785A_ABST
Patent Text Reader

Abstract

The invention discloses a target detection method, device and equipment and a storage medium, and relates to the technical field of automatic driving, the target detection method comprises the steps that a weight model is established, the weight model is obtained through training of an attention deformation convolution Yolov7-Tiny model, and the attention deformation convolution Yolov7-Tiny model is obtained based on the Yolov7-Tiny model; acquiring road condition information; and performing target detection on the road condition information by using the weight model to obtain a detection result. According to the method, on the basis of the Yov7-Tiny model, the attention mechanism and the deformable convolution are fused for improvement and training, the more efficient and accurate weight model is established, then the road condition information is collected, and finally the weight model is used for carrying out target detection on the road condition information, so that more efficient and accurate target detection is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of autonomous driving technology, and in particular to target detection methods, devices, equipment and storage media. Background Art

[0002] With the rapid growth of my country's economy, the increase in the number of cars has improved the convenience of life, but it has also brought increasingly serious traffic problems and frequent traffic accidents. Intelligent traffic assistance systems monitor and predict traffic conditions in real time, use target detection technology to provide key environmental perception capabilities, quickly identify potential dangers and warn drivers, thereby effectively reducing accidents and improving road safety and driving efficiency.

[0003] With the advancement of deep learning and artificial intelligence technology, object detection technology has made significant progress, especially in dealing with complex scenes and multi-changing targets. Although traditional methods are limited in generalization ability and performance due to hand-designed features, deep learning-based methods effectively improve the performance of object detection by automatically learning highly discriminative feature representations. Object detection methods are mainly divided into two-stage and single-stage. The former has high accuracy but low efficiency, while the latter has high efficiency but low accuracy. In the field of autonomous driving, the demand for fast and accurate recognition has made single-stage object detection algorithms the mainstream. Although their accuracy is close to that of two-stage methods, lightweight models often sacrifice accuracy while simplifying the structure to improve speed, which is still a challenge in current research. The existing practices are: (1) object detection algorithms based on traditional methods: feature-based object detection algorithms and sliding window-based object detection algorithms; (2) object detection algorithms based on deep learning: two-stage model-based object detection algorithms and single-stage model-based object detection algorithms.

[0004] Feature-based object detection algorithms rely on manually designed feature extractors, which not only require rich domain knowledge and experience, but also face design challenges and a large number of experimental adjustments. The sliding window method requires sliding multiple windows on the image and applying classifiers, which leads to high computational costs. The fixed window size and overlap problems increase the amount of computation and are not suitable for objects of variable scales. The two-stage model adds additional computational costs to the calculation of the recommended region, resulting in slow detection speed and large amount of computation. Although the single-stage model has advantages in speed and simplicity, it has low positioning accuracy, poor handling of occluded and deformed objects, and is prone to missed detection and false detection. Therefore, how to efficiently and accurately perform object detection has become an urgent problem to be solved.

[0005] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0006] The purpose of this application is to provide a target detection method, device, equipment and storage medium, aiming to solve the technical problem of how to perform target detection efficiently and accurately.

[0007] To achieve the above objectives, the present application proposes a target detection method, which comprises:

[0008] Establishing a weight model, wherein the weight model is obtained by training the attention deformation convolution Yolov7-Tiny model, and the attention deformation convolution Yolov7-Tiny model is obtained based on the Yolov7-Tiny model;

[0009] Get traffic information;

[0010] The weight model is used to perform target detection on the road condition information to obtain a detection result.

[0011] In one embodiment, the step of establishing a weight model includes:

[0012] Based on the Yolov7-Tiny model, construct the attention deformable convolution Yolov7-Tiny model;

[0013] Pre-train the attention deformable convolution Yolov7-Tiny model and save the pre-training weights;

[0014] Adjust the attention deformation convolution Yolov7-Tiny model according to the pre-trained weights, and use the training set to train the adjusted attention deformation convolution Yolov7-Tiny model until the overall loss value is the lowest, thereby obtaining a target weight model;

[0015] The target weight model is tested and verified according to the test set and the verification set to obtain a weight model.

[0016] In one embodiment, the step of constructing the attention deformable convolution Yolov7-Tiny model based on the Yolov7-Tiny model includes:

[0017] A deformable efficient layer aggregation network module is constructed through deformable convolution and efficient layer aggregation network modules, and the deformable efficient layer aggregation network module is introduced into the backbone network of the Yolov7-Tiny model to obtain an optimized backbone network;

[0018] Introducing the NAM attention mechanism, the SimAM attention mechanism and the RepConv module into the neck network of the Yolov7-Tiny model to obtain an optimized neck network;

[0019] According to the Yolov7-Tiny model, the optimized backbone network and the optimized neck network, an attention deformable convolution Yolov7-Tiny model is obtained.

[0020] In one embodiment, before the step of using the training set to train the adjusted attention deformable convolution Yolov7-Tiny model, the step further includes:

[0021] Perform data enhancement on the preset data set;

[0022] The enhanced data set is divided into a training validation set and a test set according to a first preset ratio;

[0023] The training validation set is divided into a training set and a validation set according to a second preset ratio.

[0024] In one embodiment, the step of performing data enhancement on the preset data set includes:

[0025] Segmenting the preset data set according to a third preset ratio to obtain a first data set and a second data set;

[0026] Using the Mosaic method to enhance the first data set;

[0027] The second data set is enhanced using the Mixup method.

[0028] In one embodiment, the step of using the training set to train the adjusted attention deformable convolution Yolov7-Tiny model until the overall loss value is the lowest to obtain the target weight model includes:

[0029] Build the attention deformable convolution Yolov7-Tiny model;

[0030] Set the overall loss function according to the preset coefficients, regression loss function, target loss function and category loss function;

[0031] Extracting feature information from the training set by constructing the attention deformable convolution Yolov7-Tiny model;

[0032] The weight parameters of the attention deformation convolution Yolov7-Tiny model are adjusted according to the feature information until the overall loss function reaches a minimum value to obtain a target weight model.

[0033] In one embodiment, the step of performing target detection on the road condition information using the weight model includes:

[0034] Convert the traffic information into a picture;

[0035] Resizing the image;

[0036] The weight model is used to perform target detection on the transformed image.

[0037] In addition, to achieve the above-mentioned purpose, the present application also proposes a target detection device, the device comprising:

[0038] A model building module, used to build a weight model, wherein the weight model is obtained by training the attention deformation convolution Yolov7-Tiny model, and the attention deformation convolution Yolov7-Tiny model is obtained based on the Yolov7-Tiny model;

[0039] An information acquisition module, used to obtain road condition information;

[0040] The target detection module is used to perform target detection on the road condition information using the weight model to obtain a detection result.

[0041] In addition, to achieve the above-mentioned purpose, the present application also proposes a target detection device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the target detection method described above.

[0042] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the target detection method described above are implemented.

[0043] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the target detection method described above are implemented.

[0044] One or more technical solutions proposed in this application have at least the following technical effects:

[0045] This application establishes a weight model, which is obtained by training the attention deformable convolution Yolov7-Tiny model, and the attention deformable convolution Yolov7-Tiny model is obtained based on the Yolov7-Tiny model; obtains road condition information; uses the weight model to perform target detection on the road condition information to obtain a detection result. Based on the Yolov7-Tiny model, the attention mechanism and deformable convolution are integrated for improvement and training, a more efficient and accurate weight model is established, and then road condition information is collected, and finally the weight model is used to perform target detection on the road condition information, thereby achieving more efficient and accurate target detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0047] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0048] Figure 1 A schematic diagram of a process flow provided for the first embodiment of the target detection method of the present application;

[0049] Figure 2 A schematic diagram of a flow chart provided for the second embodiment of the target detection method of the present application;

[0050] Figure 3 A schematic diagram of the structure of the attention deformation convolution Yolov7-Tiny model provided in Example 2 of the target detection method of this application;

[0051] Figure 4 A schematic diagram of the structure of a deformable high-efficiency layer aggregation network module provided in Example 2 of the target detection method of this application;

[0052] Figure 5 A schematic diagram of sampling points of deformable convolution provided in the second embodiment of the target detection method of the present application;

[0053] Figure 6 A schematic diagram of a channel attention module provided in Example 2 of the target detection method of this application;

[0054] Figure 7 A schematic diagram of a spatial attention module provided for the second embodiment of the target detection method of the present application;

[0055] Figure 8 A schematic diagram of the weight generation process of the SimAM attention module provided in Example 2 of the target detection method of this application;

[0056] Fig. 9 A schematic diagram of the conversion process of the re-parameterized convolutional layer provided in the second embodiment of the target detection method of the present application;

[0057] Fig.10 A comparison chart of experimental results of the attention deformation convolution Yolov7-Tiny model and other models provided in Example 2 of the target detection method of this application;

[0058] Fig.11 A brief flowchart of the target detection method provided in Example 2 of the present application;

[0059] Fig.12 This is a schematic diagram of the module structure of the target detection device according to an embodiment of the present application;

[0060] Fig.13 Schematic diagram of the device structure of the hardware operating environment involved in the target detection method in the embodiment of the present application.

[0061] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0062] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0063] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0064] At present, with the continuous development of deep learning and artificial intelligence technology, target detection technology is facing unprecedented development opportunities. The limitation of traditional target detection methods is that they are difficult to handle complex scenes, changing targets and occlusion problems. Manually designed features are difficult to generalize when involving a large number of different categories and backgrounds, and they perform poorly for targets of different scales, postures and lighting conditions. The target detection method based on deep learning can automatically learn more discriminative and generalized feature representations through an end-to-end learning framework, thus making significant progress in target detection tasks. The target detection method based on deep learning can be roughly divided into two categories: two-stage target detection and single-stage target detection. The two-stage detection network needs to generate candidate boxes first, and then use the algorithm to classify and detect the generated candidate boxes. The recognition accuracy is high but the recognition efficiency is low. The single-stage detection network can directly realize target detection by directly extracting features from the input. The recognition efficiency is high but the recognition accuracy is low. For target detection algorithms used in the field of autonomous driving, they need to ensure accurate recognition in a relatively short time. Although the two-stage target detection algorithm has been improved by researchers in recent years and its detection speed has gradually increased, its speed performance is still slightly lacking when applied in the field of autonomous driving. Therefore, the current mainstream model is mainly a single-stage target detection algorithm. After continuous innovation, the accuracy of the single-stage target detection algorithm is comparable to that of the two-stage target detection algorithm. However, most researchers have ignored the lightweight model of the single-stage target detection algorithm. Compared with the complete model, it simplifies the model structure, has a lower number of parameters, and has a faster detection speed. It is more suitable for use on autonomous driving platforms than the complete model. However, due to the simplified model structure, the detection accuracy of most lightweight models is difficult to meet the requirements of the field of autonomous driving.

[0065] The main solution of the embodiment of the present application is: by integrating the attention mechanism and deformable convolution for improvement and training on the basis of the Yolov7-Tiny model, a more efficient and accurate weight model is established, and then road condition information is collected, and finally the weight model is used to perform target detection on the road condition information, thereby achieving more efficient and accurate target detection.

[0066] It should be noted that the execution subject of the embodiments of the present application may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, an intelligent traffic assistance system, an automatic driving system, an in-vehicle system, etc. The following takes the intelligent traffic assistance system as an example to illustrate this embodiment and the following embodiments.

[0067] Based on this, the present application embodiment provides a target detection method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the target detection method of the present application.

[0068] In this embodiment, the target detection method includes steps S10 to S30:

[0069] Step S10, establishing a weight model, wherein the weight model is obtained by training the attention deformation convolution Yolov7-Tiny model, and the attention deformation convolution Yolov7-Tiny model is obtained based on the Yolov7-Tiny model;

[0070] It should be noted that the YOLOv7-Tiny model is a lightweight variant of the YOLOv7 (You Only Look Once version 7) target detection architecture. YOLOv7-Tiny aims to further improve detection speed and efficiency while ensuring a certain detection accuracy, making it suitable for resource-constrained environments such as embedded devices and mobile devices. The following are the main features of YOLOv7-Tiny: 1) Lightweight architecture: YOLOv7-Tiny uses smaller model parameters and computational complexity, reduces the number of network layers and parameters, making it more lightweight and suitable for running on hardware with limited resources. 2) Efficient feature extraction: Through improved convolution modules and feature extraction methods, YOLOv7-Tiny significantly improves the inference speed while maintaining high detection accuracy. 3) Real-time: Due to the simplification and optimization of the model, YOLOv7-Tiny can achieve real-time target detection on low-power devices, which is very suitable for application scenarios with high real-time requirements, such as drones, autonomous driving dashboards, and intelligent monitoring systems. 4) Compatibility: Despite the simplification, YOLOv7-Tiny still inherits the core architecture and training methods of YOLOv7, so it can take advantage of the existing pre-trained models and technical advantages of YOLOv7. 5) Applicable scenarios: YOLOv7-Tiny is particularly suitable for scenarios with limited computing resources and storage space, such as edge computing devices, embedded systems, and applications on mobile devices. In general, YOLOv7-Tiny provides an object detection solution that strikes a good balance between performance and resource requirements by optimizing model size and computational efficiency.

[0071] The Attention, Deformable convolution Yolov7-Tiny model (Attention, Deformable convolution, Wise-Yolov7-Tiny, ADW-Yolov7-Tiny) is an improved target detection model based on the YOLOv7-Tiny model, integrating the attention mechanism and deformable convolution. The weight model refers to the ADW-Yolov7-Tiny model with the best weight parameters obtained through experiments and training in this embodiment; having the best weight parameters means that under the weight parameters, the target detection effect of the ADW-Yolov7-Tiny model performs best, at least in experiments and training.

[0072] It is understandable that the Yolov7-Tiny model is a commonly used model for target detection, but it has problems such as insufficient detection capability for targets with large changes in contours, lack of feature extraction capability, and high computational complexity, so this application is improved on its basis to solve or improve these problems. This application performs target detection by establishing a more efficient and accurate weight model, so model establishment is an essential step.

[0073] Step S20, obtaining road condition information;

[0074] It should be noted that in this embodiment, the road condition information is real-time road condition information collected by the automatic driving system, which is collected through a variety of sensors and technical means to help the vehicle understand and respond to the surrounding traffic environment. It mainly includes the following contents: Lane information: including the location, type (solid line, dotted line), lane width and number of lanes. Vehicle information: the number, location, speed, direction and type of surrounding vehicles (sedans, trucks, motorcycles, etc.). Pedestrian information: the location, speed and direction of travel of pedestrians. Traffic signals: the status of traffic lights (red light, green light, yellow light) and countdown time, as well as the information of traffic signs (speed limit signs, stop signs, etc.). Obstacle information: the location, size and type of static and dynamic obstacles on the road (such as roadblocks, luggage, dropped goods, etc.). Road information: the slope, curvature, road surface conditions (slippery, potholes, snow, etc.), and the width and edge of the road. Weather information: current weather conditions, including rainfall, snowfall, haze and light, etc., which can be obtained through on-board meteorological sensors or interfaces with external meteorological services. GPS positioning information: The precise location and driving trajectory of the vehicle, which is achieved through the combination of GPS and high-precision maps. Traffic event information: Real-time updated information on traffic accidents, road construction, temporary traffic control, etc., which are usually obtained through the Internet of Vehicles or other external data sources. Ambient lighting information: The intensity of ambient light is detected by light sensors to adjust the vehicle's headlights and other visual systems.

[0075] It is understandable that road condition information is collected through multiple sensors such as cameras, radars, millimeter-wave radars, ultrasonic sensors, GPS, IMU (inertial measurement unit), etc., and is processed and analyzed in real time by the central control unit of the autonomous driving system to ensure that the vehicle can operate safely and stably in various complex road environments.

[0076] Step S30: Use the weight model to perform target detection on the road condition information to obtain a detection result.

[0077] It should be noted that object detection is a computer vision technology that aims to identify and locate objects of interest (targets) in images or videos. It not only needs to determine the category of the target (for example, car, person, animal, etc.), but also needs to accurately give the location of each target in the image, usually in the form of a rectangular bounding box. Object detection has a wide range of applications in many fields, including autonomous driving, security monitoring, medical image analysis, and smart retail.

[0078] It is understandable that after establishing a more efficient and accurate weight model, using the weight model to detect targets on the collected road condition information can more efficiently obtain more accurate target detection results. For example, using the weight model to detect vehicles in road condition information can more quickly detect the shape, position on the road, and speed of the vehicle.

[0079] As an example, the step of using the weight model to perform target detection on the road condition information includes: converting the road condition information into a picture; transforming the size of the picture; and performing target detection on the transformed picture using the weight model.

[0080] The weight model established in this embodiment performs target detection on pictures or video frames, so the road condition information must first be converted into (several) pictures, and then the pictures are resized, pixel value normalized, color space converted, cropped, rotated, flipped, color jittered, or batch dimension added, etc., which helps to standardize the input and make it adapt to the input requirements of the model. Finally, the weight model is used to perform target detection on the transformed pictures, thereby improving the accuracy and efficiency of detection and ensuring the detection performance and stability of the model.

[0081] This embodiment provides a target detection method, by establishing a weight model, the weight model is obtained by training the attention deformable convolution Yolov7-Tiny model, and the attention deformable convolution Yolov7-Tiny model is obtained based on the Yolov7-Tiny model; obtaining road condition information; using the weight model to perform target detection on the road condition information to obtain a detection result. This embodiment improves the Yolov7-Tiny model by integrating the attention mechanism and deformable convolution to establish a more efficient and accurate weight model, then converts the collected road condition information into a picture, and then resizes the picture to adapt it to the input requirements of the model, and finally uses the weight model to perform target detection on the transformed picture, thereby improving the accuracy and efficiency of detection, and also ensuring the detection performance and stability of the model.

[0082] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can refer to the above introduction, and will not be repeated later. Figure 2 , Figure 2 This is a flow chart of the second embodiment of the target detection method of the present application. Step S10 of the target detection method includes steps S11 to S14:

[0083] Step S11, based on the Yolov7-Tiny model, construct an attention deformation convolution Yolov7-Tiny model;

[0084] It should be noted that the Yolov7-Tiny model and the Attention Deformed Convolution Yolov7-Tiny model (ADW-Yolov7-Tiny) have been explained and will not be repeated here.

[0085] It can be understood that the Yolov7-Tiny model is a lightweight target detection model that inherits the high efficiency characteristics of the YOLOv7 series and is further optimized to adapt to resource-constrained devices and real-time application scenarios. It has the advantages of lightweight design, high detection accuracy, and strong versatility. However, it also has relatively low detection accuracy, limited detection capabilities for small targets and dense targets, limited feature extraction capabilities, weak robustness and generalization capabilities, low flexibility and scalability, poor handling of occluded and deformed targets, prone to missed detections and false detections, and insufficient detection capabilities for targets with large changes in contours. Therefore, this embodiment chooses to improve the Yolov7-Tiny model to build a more efficient and accurate ADW-Yolov7-Tiny model.

[0086] As an example, based on the Yolov7-Tiny model, the steps of constructing the attention deformable convolution Yolov7-Tiny model specifically include: constructing a deformable efficient layer aggregation network module through deformable convolution and efficient layer aggregation network modules, and introducing the deformable efficient layer aggregation network module into the backbone network of the Yolov7-Tiny model to obtain an optimized backbone network; introducing the NAM attention mechanism, the SimAM attention mechanism and the RepConv module into the neck network of the Yolov7-Tiny model to obtain an optimized neck network; according to the Yolov7-Tiny model, the optimized backbone network and the optimized neck network, the attention deformable convolution Yolov7-Tiny model is obtained.

[0087] Deformable Convolution is an improved convolution operation that aims to enhance the ability of standard convolutional neural networks (CNNs) to handle geometric deformations. It enables the convolution operation to adapt to more complex deformations and feature structures by learning the sampling position of each convolution kernel on the input feature map. Advantages: Enhanced feature extraction capability: Deformable convolution can adapt to various complex geometric deformations in images, improving the flexibility and accuracy of feature extraction. Better handling of deformation and occlusion: Since the sampling position of the convolution kernel is no longer fixed, deformable convolution can better handle deformation and partial occlusion of the target. Improve model performance: In multiple computer vision tasks (such as target detection and semantic segmentation), the use of deformable convolution can significantly improve the performance and robustness of the model, so this application introduces it into the model and uses it to construct a deformation efficient layer aggregation network module.

[0088] The Efficient Layer Aggregation Network (ELAN) is a network architecture design concept proposed in recent years, which aims to improve the feature extraction ability and parameter efficiency of convolutional neural networks (CNNs). ELAN fuses features at multiple levels through efficient feature aggregation strategies, thereby enhancing the network's expressiveness. The Efficient Layer Aggregation Network module mainly includes the following parts: Input features: feature maps are obtained from multiple convolutional layers, and these feature maps contain semantic information at different levels. Feature aggregation: feature maps at different levels are aggregated by methods such as addition, splicing or weighted summation to fuse information from multiple layers of features. Output features: The aggregated feature maps are processed by subsequent convolutional layers or other network modules to generate the final output features. The aggregation of multiple layers of features enables the network to capture richer semantic information and enhances the expressiveness and recognition of features; through efficient feature aggregation strategies, redundant calculations and the number of parameters are reduced, and the parameter utilization efficiency of the network is improved. The network architecture integrating ELAN can significantly improve performance, so this application introduces it into the model.

[0089] The Deformable Efficient Layer Aggregation Network (D-ELAN) combines the advantages of deformable convolution and efficient layer aggregation network (ELAN), aiming to further improve the feature extraction capability and flexibility of convolutional neural networks (CNN), especially in dealing with complex deformations and geometric structures. Deformable convolution is introduced, so that the sampling position of the convolution kernel can be dynamically adjusted according to the input feature map, so as to better capture complex geometric deformations and features; combined with the hierarchical aggregation strategy of ELAN, the feature expression ability and robustness are improved by fusing features at different levels; through efficient feature aggregation and flexible convolution operations, the computational efficiency and parameter utilization of the model are improved, which is suitable for real-time applications and resource-constrained environments.

[0090] The deformable efficient layer aggregation network module consists of the following parts: Input features: feature maps are obtained from multiple convolutional layers or stages, which contain semantic information at different levels. Deformable convolution: Each convolutional layer uses deformable convolution to enhance feature extraction capabilities, so that the convolution kernel can adapt to the deformation of the input. Feature aggregation: feature maps of different levels are aggregated by concatenation or weighted summation to fuse information from multiple layers of features. Output features: the aggregated feature maps are processed by subsequent convolutional layers or other network modules to generate the final output features.

[0091] The improved ADW-Yolov7-Tiny model consists of three parts: the backbone network, the neck network and the head network. Please refer to Figure 3 , Figure 3 The schematic diagram of the structure of the attention deformable convolution Yolov7-Tiny model provided in the second embodiment of the target detection method of the present application includes three parts: the backbone network (BackBone), the neck network (Neck) and the detection head / head network (DetectHead). Among them, Input: input layer, receiving image data. CBL: combination of convolutional layer (Convolutional layer), BN layer (Batch Normalization layer) and Leaky ReLU activation function. ELAN: Efficient Layer Aggregation Network module (Efficient Layer Aggregation Network). MP: Max Pooling layer (Max Pooling layer). D-ELAN: Deformable Efficient Layer Aggregation Network module (Deformable Efficient Layer Aggregation Network). SPPCSPC: Spatial Pyramid Pooling and Cross Stage Partial Connections (Spatial Pyramid Pooling with Cross Stage Partial Connections). Concat: Feature connection operation, used to connect features of different layers together. Upsample: Upsampling layer, used to increase the resolution of feature maps. NAM: Normalization-based Attention Mechanism. SimAM: Simple Attention Module. RepConv: Re-parameterized Convolution. YoloHead: YOLO detection head, used to generate the final target detection results. The figure shows the architecture of the attention deformable convolution Yolov7-Tiny model built on the Yolov7-Tiny model. The backbone network includes an input layer, multiple CBL, ELAN and D-ELAN modules, and an SPPCSPC module. The neck network processes feature maps through multiple feature connections, upsampling, and NAM attention mechanisms, and introduces the SimAM attention module. Finally, the detection head combines the RepConv module and the YOLO detection head to generate target detection results. The entire model optimizes the performance of feature extraction and target detection through the combination of various modules.

[0092] ①The backbone network consists of CBL module, efficient layer aggregation network module (ELAN module), deformable efficient layer aggregation network module (D-ELAN module), maximum pooling module (MP module) and SPPCSPC module. The CBL module is the basic module of the entire model, which consists of three basic operation layers: convolution layer, normalization layer and LReLU activation function. The ELAN module uses dense residual structure stacking to increase the model depth, thereby improving the accuracy of the network, and uses jump connection to prevent the network from gradient disappearance due to increased depth. The D-ELAN module is obtained by adding deformable convolution to the ELAN. The D-ELAN module strengthens the feature extraction ability of the model in the backbone network, so that the model can more accurately capture the target shape contour, thereby improving the detection accuracy of the model in complex traffic environments and reducing the missed detection rate. The MP module uses the maximum pooling layer to downsample the features, reduce the size of the feature map, reduce the amount of calculation and parameters of the model, and retain the main features of the original data to prevent the model from overfitting during training. The SPP module first uses a cross-stage local structure to divide the features into two paths, one of which is processed using a spatial pyramid pooling structure. Four different receptive fields are used in SPP to enable the model to better distinguish small and large targets; the other path uses conventional processing. The CSP structure reduces computational complexity while improving accuracy.

[0093] In order to solve the problem that when ordinary convolution blocks detect targets on traffic roads, due to their fixed convolution kernel structure, it is difficult to distinguish targets with large contour changes, which easily leads to missed detection and false detection. This application proposes a D-ELAN module in combination with deformable convolution. For the specific structure, please refer to Figure 4 , Figure 4A schematic diagram of the structure of a deformable efficient layer aggregation network module provided for the second embodiment of the target detection method of the present application, wherein D-ELAN: Deformable Efficient Layer Aggregation Network, used for efficient feature extraction. CBL: Combination of convolutional layer, BN layer (Batch Normalization layer) and Leaky ReLU activation function. D-CBL: Deformable Convolutional Block with Batch Normalization and Leaky ReLU, which adds a deformable convolution operation to enhance feature extraction capabilities. Concat: Feature connection operation, used to connect features of different layers together. The figure shows the architecture of the deformable efficient layer aggregation network module. The input feature map first undergoes preliminary feature extraction through the D-ELAN module and the CBL module, and then enters two parallel D-CBL modules to enhance feature expression. Then, these features are fused together through the feature connection (Concat) operation, and are further processed again through the CBL module, and finally the fused feature map is output. The whole process aims to improve the ability of feature extraction and fusion by using deformable convolution and efficient layer aggregation technology.

[0094] The deformable convolution module introduces a learnable position offset parameter in the traditional convolution. and the bias weight coefficient This allows the convolution area to dynamically cover the area around the detected object, which has a better effect on data with large contour changes. For specific sampling methods, please refer to Figure 5 , Figure 5 A schematic diagram of the sampling points of the deformable convolution provided in Example 2 of the target detection method of the present application shows the distribution of the sampling points of the deformable convolution kernel when performing the convolution operation. Unlike the regular sampling grid fixed by traditional convolution (such as a 3x3 convolution kernel), the sampling points of the deformable convolution can be dynamically adjusted according to the content of the input feature map to form an irregular sampling grid. The dense sampling points in the middle of the figure represent the area of ​​greater concern in the feature map, while the sparse sampling points on the outside represent the focus on the edge area of ​​the feature map. Through such sampling point adjustment, the deformable convolution can more flexibly capture complex geometric deformations and object boundary information, thereby improving the accuracy and effect of feature extraction. The sampling formula used in this application is as follows:

[0095]

[0096] In the formula, w k and p kare the weight and pre-specified offset of the kth position, ΔP k and Δm k They represent the learnable offset and offset weight coefficient of the kth position respectively.

[0097] ② The neck network adopts a path aggregation network (PAN) structure and combines it with the ELAN module to achieve feature fusion. The PAN structure enhances the feature information extracted by the backbone network by fusing the bottom-up and top-down pathways, while shortening the information transmission path, effectively utilizing the low-level positioning information, and improving the detection accuracy of the network. Finally, the model uses three detection heads of different scales to predict targets of different sizes. In addition, this application integrates the NAM attention mechanism and the SimAM attention mechanism in the neck network, and introduces a reparameterized convolution (RepConv) in the output layer of the neck network.

[0098] 1) NAM (Normalization-based Attention Module) attention mechanism is a normalization-based attention module designed to improve the ability of convolutional neural networks (CNNs) to model the importance of features. NAM captures the importance of different positions in the feature map by introducing normalization operations, thereby enhancing the network's feature expression capabilities. NAM uses the scaling factor of the normalization layer to represent the importance of features, and suppresses insignificant features through sparse regularization. The scaling factor can reflect the size of changes in each channel and the importance of channel changes. NAM does not require the use of fully connected layers and convolutional layers, thereby reducing the computational complexity and number of parameters introduced from the module. The channel attention module in NAM uses the scaling factor of the normalization layer to measure the weights of different channels, while the spatial attention module applies the scaling factor of the normalization layer to the spatial dimension and performs normalization operations on each pixel to calculate the weights of different pixels. Please refer to Figure 6 , Figure 6 Please refer to the schematic diagram of the channel attention module provided in the second embodiment of the target detection method of this application. Figure 7 , Figure 7 Schematic diagram of the spatial attention module provided for the second embodiment of the target detection method of the present application, wherein, γi: the encoding state in the encoder, which represents the intermediate representation of the input sequence after being processed by the encoder. ωi: the context vector in the decoder, which is usually the encoding state of the encoder or some transformation thereof, used for each step of the decoder generating the output sequence. αij: the attention weight, which represents the importance of the jth position in the input sequence to the decoder generating the i-th output. M c is the output feature of the channel module, M sis the output feature of the spatial module. λi: The encoding state in the encoder, which represents the intermediate representation of the input sequence after being processed by the encoder. αij: The attention weight, which represents the importance of the jth position in the input sequence to the decoder generating the i-th output. ωi: The context vector, which is the context information used by the decoder when generating the i-th output, usually the weighted sum of the encoding states. βi: The output of the decoder, which represents the output at the i-th time step generated by the decoder. Figure 6 A sequence-to-sequence model is presented that uses an attention mechanism. The input sequence is first processed by the encoder, which generates a series of encoded states γi. At each decoder step, the decoder generates a context vector ωi for the current step, which is a weighted sum of the encoded states, with weights calculated by the attention mechanism. The attention weight αij represents the importance of the jth position in the input sequence to the decoder generating the i-th output. This mechanism enables the decoder to dynamically focus on different parts of the input sequence when generating each output, improving the accuracy of translation or sequence generation. Figure 7 A sequence-to-sequence model based on the attention mechanism is presented. In this model, the input sequence is first processed by the encoder to generate a series of encoding states λi. At each step of the decoder, the attention mechanism calculates the attention weights αij based on the encoding state and the current decoding state. These weights are used to generate the context vector ωi of the current step, which is the weighted sum of the encoding states. The context vector ωi is used together with the previous state of the decoder to generate the output βi of the decoder. This mechanism enables the decoder to dynamically focus on different parts of the input sequence when generating each output, thereby improving the quality and accuracy of sequence generation.

[0099] The NAM attention mechanism includes the following steps: Feature normalization: Normalize the input feature map (such as Layer Normalization or Batch Normalization) to calculate the normalized feature map. Attention weight calculation: Based on the normalized feature map, calculate the attention weight of each position. A common method is to generate an attention map through global average pooling or global maximum pooling. Feature weighting: Multiply the calculated attention weight by the original feature map element by element to generate a weighted feature map. Output features: Output the weighted feature map as the input of the subsequent network module. The NAM attention mechanism improves the detection network's ability to identify and locate targets by strengthening the attention to key areas in the feature map.

[0100] 2) SimAM (Simple Attention Module) is a simple and efficient attention mechanism designed to improve the feature expression ability of convolutional neural networks (CNNs). SimAM focuses on the attention calculation of each feature point, adjusts the importance of the feature based on its local response, and thus enhances the performance of the model. The SimAM attention mechanism is derived from neuroscience theory. The module can derive 3D attention weights for feature maps without additional parameters. In neuroscience, information-rich neurons exhibit different discharge patterns from other surrounding neurons, and usually inhibit surrounding neurons when activated, that is, spatial inhibition. In other words, neurons with spatial inhibition effects have higher importance than other neurons. The way to find such neurons is to measure the linear separability between neurons. Therefore, the following energy function is defined in the ADW-Yolov7-Tiny model:

[0101]

[0102] In the formula, t and x t are the target neurons and other neurons of a single channel in the input feature; i represents the index in the spatial dimension; M is the number of neurons in a single channel; w t and b t are the corresponding weight and bias parameters.

[0103] Minimizing the above formula is equivalent to training the linear separability between neuron t and other neurons in the same channel. The formula is simplified by binarizing the labels and adding regularization terms to obtain the final formula definition of the energy function:

[0104]

[0105] The final analytical solution of the above energy function is obtained by calculation:

[0106]

[0107] In the formula, and Represents the mean and variance of all neurons in the channel except t.

[0108] Assuming that all pixels in a single channel follow the same distribution, use the same conclusion to calculate the mean and variance of all neurons to obtain the solution to the energy formula:

[0109]

[0110] In the formula, The SimAM attention module uses a scaling operator to refine the features based on the energy function. The refinement process is as follows:

[0111]

[0112] In the formula, E is all the channels and spaces Group them and use the Sigmoid function to limit their value range. Figure 8 , Figure 8 A schematic diagram of the weight generation process of the SimAM attention module provided in the second embodiment of the target detection method of the present application, wherein X: input tensor, usually represents input data, such as feature representation of a picture or text, and in this embodiment is an input feature. C, H and W represent the number of channels, height and width of the feature map, respectively. WQ: query weight matrix, used to map the input to the query vector space. WK: key weight matrix, used to map the input to the key vector space. WV: value weight matrix, used to map the input to the value vector space. Attention: attention mechanism, which obtains attention weights by calculating the similarity between the query and the key, and then weights the value. Output: output tensor, which is the result of the attention mechanism, is used for subsequent processing or output. This figure shows the application process of the attention mechanism in deep learning. The input tensor X is converted into query, key and value vectors through a series of weight matrices (query WQ, key WK, value WV). Then, by calculating the similarity between the query and the key, the attention weights are obtained, and these weights are used to weight the value vectors to generate the output of the attention mechanism. This mechanism enables the model to dynamically focus on different parts when processing input, improving the effect of processing complex tasks (such as machine translation, image recognition, etc.).

[0113] 3) Reparameterized Convolution (RepConv) is used to use different convolution structures in the training and inference stages to improve the performance and efficiency of the model. The core idea is to use complex, multi-branch convolution structures in the training stage to capture more feature representations, and simplify these structures into a standard convolution operation in the inference stage to speed up inference and reduce computational overhead. When training the RepConv module, additional branches are introduced on the basis of ordinary 3×3 convolution to avoid the gradient vanishing after multiple convolutions, and to better extract feature information from sample data. Then, during the inference process, the additional branches are merged into the main branch using the reparameterization technology, and the convolution structure is converted into an ordinary single-branch structure, which improves the detection accuracy while maintaining the same detection speed as ordinary convolution. The advantage of using a reparameterized network is that the convolution calculation speed is very fast. The GPU is optimized for 3×3 convolution, and the speed can reach four times that of 1×1 and 5×5 convolution. At the same time, the single-channel architecture can quickly perform parallel processing, which can speed up the calculation speed, and the single-channel architecture is very memory-saving. Please refer to Fig. 9 , Fig. 9 A schematic diagram of the conversion process of the re-parameterized convolution layer provided in Example 2 of the target detection method of the present application, wherein 3x3: represents a 3x3 convolution kernel. 1x1: represents a 1x1 convolution kernel. Arrow: represents the process of operation or conversion. μ, σ, γ, β are the cumulative average, standard deviation, learning scale factor and deviation of the BN layer after 3×3conv. B is the deviation of the converted 3x3 convolution. The figure shows that the initial convolution layer contains a 3x3 convolution kernel and a 1x1 convolution kernel, which are convolved separately to obtain a series of feature maps; these feature maps are combined to obtain new feature maps; then, multiple 3x3 convolution kernels are used to perform convolution operations on the new feature maps; finally, all feature maps are merged into one feature map. In short, the figure shows that the input feature map is convolved using multiple convolution kernels (such as 3x3 and 1x1), and the results of these operations are merged to obtain a final feature map. This method can improve the representation ability and performance of the model.

[0114] ③The main structure of the head network is the detection head (YoloHead). YoloHead is a module responsible for converting the feature maps output by the backbone network and feature pyramid network (FPN) into target detection results. YoloHead mainly consists of three parts: anchor box, classification head and regression head. Anchor Box is responsible for locating the position and size of the prediction box, the classification head is responsible for predicting the category of the target object, and the regression head is responsible for predicting the offset of the box.

[0115] The ADW-Yolov7-Tiny model strengthens the feature extraction capability of the backbone network by constructing the D-ELAN module in the backbone network, so that the model can more accurately capture the target shape contour, thereby improving the detection accuracy of the model in complex traffic environments and reducing the missed detection rate; the NAM attention mechanism is used in the neck network to enhance the extracted feature information from both channel and spatial directions, and the enhanced feature information is processed through the SimAM attention mechanism to obtain feature information containing 3D weights, enriching the feature information of the model and improving the detection capability; the RepConv module is also added to the neck network to improve the learning ability of the model during training without changing the reasoning ability.

[0116] Step S12, pre-training the attention deformation convolution Yolov7-Tiny model and saving the pre-training weights;

[0117] It should be noted that weights refer to the numerical values ​​of various parameters in the model, which are learned through optimization algorithms (such as gradient descent) during training. These weights include the weights of the convolution kernel, the bias term, the mean and variance of the batch normalization layer, etc. These weights determine the model's ability to extract features and detect targets from the input data. The weights mainly include: Convolution layer weights: Each convolution layer has a set of weights (convolution kernels) used to perform convolution operations on the input feature map. Bias term: Each convolution layer usually also has a corresponding bias term to help adjust the convolution results. Batch normalization parameters: Each batch normalization layer contains mean, variance, scaling, and offset parameters, which are used to normalize the convolution output. Pre-trained weights are usually weights obtained by training on large datasets (such as ImageNet, COCO, etc.), which can be used as the initial weights of the model.

[0118] It can be understood that this embodiment uses the VOC data set to pre-train the ADW-Yolov7-Tiny model, which enhances the parameters of the improved network so that it can better identify targets.

[0119] Step S13, adjusting the attention deformation convolution Yolov7-Tiny model according to the pre-training weights, and using the training set to train the adjusted attention deformation convolution Yolov7-Tiny model until the overall loss value is the lowest, thereby obtaining a target weight model;

[0120] It should be noted that the training set in this embodiment is processed from the KITTI dataset, a public dataset widely used in autonomous driving and computer vision research, and is used to fit the model. The model continuously adjusts its parameters on the training set through optimization algorithms (such as gradient descent) so that it can achieve good performance on the training data. The overall loss value refers to the value of the loss function, which is an indicator used to measure the difference between the model prediction results and the true annotations, guiding the model to continuously optimize parameters during the training process, thereby improving the prediction accuracy.

[0121] It is understandable that when training a model on a specific task and dataset, the model weights are continuously adjusted through the optimization algorithm until the overall loss value is minimized, so that it can better adapt to the task requirements.

[0122] As an example, before the step of using the training set to train the adjusted attention deformable convolution Yolov7-Tiny model, it also includes: performing data augmentation on a preset data set; dividing the enhanced data set into a training validation set and a test set according to a first preset ratio; dividing the training validation set into a training set and a validation set according to a second preset ratio.

[0123] The preset data set in this embodiment refers to the KITTI data set, which is a public data set widely used in autonomous driving and computer vision research, mainly containing various sensor data collected by cars driving in urban environments. These data sets are very useful for training and evaluating autonomous driving systems, target detection, semantic segmentation and other tasks. The data content mainly includes: Image data: The KITTI data set contains a large number of RGB images, which are collected by on-board cameras on city streets, covering various traffic scenes. LiDAR data: The data set also contains LiDAR data, which provides three-dimensional point cloud information about the surrounding environment, including obstacles, roads, etc. Annotation information: Each sample has detailed annotation information, including the bounding box, category, three-dimensional position, etc. of the target. This annotation information is very important for training and evaluating tasks such as target detection and target tracking. Other data: The data set also contains other sensor data such as GPS trajectory and IMU data, which provides more information about vehicle position, posture, etc. Its rich data content and detailed annotation information make it an ideal benchmark for training and evaluating various algorithms.

[0124] Data augmentation is a common technique used in training machine learning models, especially deep learning models. It generates new samples by performing various transformations on the training data, thereby increasing the amount of data, improving the generalization ability of the model, and reducing overfitting.

[0125] Training set: used to fit the model. The model continuously adjusts its parameters on the training set through optimization algorithms (such as gradient descent) so that it can achieve good performance on the training data.

[0126] Validation set: Model evaluation and selection: During the training process, the validation set is used to evaluate the performance of the model and select the best model structure and hyperparameters. Prevent overfitting: By monitoring the performance of the model on the validation set, the model can be prevented from overfitting on the training set. Common methods include early stopping, which stops training when the performance on the validation set no longer improves. Parameter adjustment: The validation set helps select the best hyperparameter combination to make the model perform better on unseen data.

[0127] Test set: Final evaluation: After model training and validation are completed, the test set is used to perform a final evaluation of the model to understand how the model performs in real applications. Performance measurement: The test set provides an independent evaluation standard to measure the generalization ability and robustness of the model.

[0128] In this embodiment, the first preset ratio and the second preset ratio are both 9:1. There is no fixed standard for the specific ratio, which is usually determined based on the size of the data set, the complexity of the task, and the needs of the actual application.

[0129] As an example, the step of performing data enhancement on a preset data set includes: dividing the preset data set according to a third preset ratio to obtain a first data set and a second data set; enhancing the first data set using a Mosaic method; and enhancing the second data set using a Mixup method.

[0130] In this embodiment, the third preset ratio is 1:1, and the preset data set is randomly divided. 50% of the data is used as the first data set, and the Mosaic method is used to enhance the data. The other 50% of the data is used as the second data set, and the Mixup method is used to enhance the data. This increases the diversity of samples, improves the robustness and generalization ability of the model, reduces overfitting, and thus improves the performance of the model on unseen data.

[0131] The method of Mosaic data enhancement is mainly to randomly select four pictures from the input data, and then randomly splice them in a random proportion through random scaling, random cropping, random distribution, etc. Each image occupies a part of the entire new image to simulate a variety of scenes. The specific steps are as follows: ① Randomly select four images (A, B, C, D) from the training data set. ② Then define the basic data enhancement operation set op. In this method, the set includes basic operations (HSV hue transformation, image flipping, image scaling, image cropping, etc.). ③ Randomly select one or more data enhancements in the defined operation set op to form a data enhancement algorithm (op1, op2, op3, op4), and transform the four images (A, B, C, D) through the composed data enhancement algorithm to obtain a new image. ④ Then combine the four newly obtained pictures to form a new photo according to the four different directions of upper left, upper right, lower left, and lower right. The specific fusion process is shown in the following formula: Mosaic(A,B,C,D)=Concatenate(op1(A),op2(B),op3(C),op4(D)), where Concatenate(·) is the operation of stitching the four processed images together.

[0132] Mixup mainly randomly selects two different input samples, and then performs random scaling, random flipping, color gamut transformation and other operations on the two different input samples, and then stacks one of the samples and fuses it to another picture to generate a new training sample. ① Randomly select two images (A, B) from the training data set. ② Randomly generate a mixing coefficient λ through the algorithm, which usually obeys the Beta distribution, that is, λ~Beta(α,α), where α is a hyperparameter. This mixing coefficient is used to control the degree of fusion of the two samples. ③ The two samples are then weighted and fused according to the mixing coefficient λ to generate a new sample. Similarly, the labels corresponding to the samples are also weighted and fused according to the mixing coefficient λ to generate new sample labels. The specific fusion process is shown in the following formula:

[0133]

[0134] In the formula, x A and x B are the features of the two input samples; y A and B is the corresponding true label; is the fused feature, is the fused label; λ obeys Beta distribution, that is, λ~Beta(α,α), and in this embodiment, λ=0.7.

[0135] As an example, the adjusted attention deformation convolution Yolov7-Tiny model is trained using a training set until the overall loss value is the lowest, and the step of obtaining a target weight model includes: building the attention deformation convolution Yolov7-Tiny model; setting the overall loss function according to preset coefficients, regression loss function, target loss function and category loss function; extracting feature information in the training set through the built attention deformation convolution Yolov7-Tiny model; adjusting the weight parameters of the attention deformation convolution Yolov7-Tiny model according to the feature information until the overall loss function reaches the minimum value, and obtaining the target weight model.

[0136] This embodiment requires training of the improved ADW-Yolov7-Tiny model, so it needs to be built first. The preset coefficients are the distribution coefficients, including α, β and γ, α is set to 1.9, δ is set to 3; set the loss function used in this application. The loss function is an indicator used to measure the difference between the model prediction result and the actual annotation, guiding the model to continuously optimize the parameters during the training process, thereby improving the prediction accuracy. The specific loss function is as follows: L = αL reg +βL obj +γL cls , where α, β and γ are distribution coefficients, which are used to set the weights between different loss functions; L reg is the regression loss, L obj and L cls They are target loss and classification loss respectively. Regression loss L reg Specific calculation formula: L reg =σRL IoU ,

[0137] In the formula, β is the data outlier degree, In this embodiment, α is set to 1.9 and δ is set to 3;

[0138] W g and H g is the size of the smallest true box.

[0139] Target loss L obj Used to calculate the confidence loss of the prediction box and the category loss L cls The loss of the target category and the true label category corresponding to the prediction box. The specific calculation formulas of the target loss and category loss in this embodiment are as follows:

[0140]

[0141] Where N is the number of samples; y represents the true label; and p represents the predicted label.

[0142] The overall loss function consists of preset coefficients, regression loss function, target loss function and category loss function; the regression loss function is used to measure the difference between the target box position predicted by the model and the actual target box position; the target loss function is used to measure whether the model correctly detects the target object; the category loss function is used to measure the model's classification accuracy of the target object category; the preset coefficients are used to adjust the weights of each loss function to balance the contribution of each loss item to the overall loss. The constructed ADW-Yolov7-Tiny model is used to forward propagate the samples in the training set to extract feature information, including the location, category information and attention weight of the target object. The extracted feature information is compared with the true label to calculate the overall loss function, and the result of each batch of training is obtained through the overall loss function. The weight parameters of the model are adjusted through algorithms such as gradient descent or back propagation to minimize the overall loss function. During the optimization process, the parameters of the model are continuously adjusted according to the feedback information of the training set so that it can better adapt to the training data and have good generalization ability. After each batch of training, the attention deformation convolution Yolov7-Tiny model is evaluated using the verification set, and the weight model with the smallest value of the overall loss function is saved. This process may require multiple iterations until the model converges to the optimal solution and obtains the target weight model. The true label represents the correct answer or true state of each sample in the data set. In this embodiment, it represents its correct category and position. Each batch of training is a complete forward propagation and a complete back propagation of the data. Each batch of training uses the same training set and the model parameters are also the same. It is only through repeated training that the performance of the model approaches that of the training set, that is, the data obtained by the model for target detection is getting closer and closer to the actual data.

[0143] Step S14, testing and verifying the target weight model according to the test set and the verification set to obtain a weight model.

[0144] It should be noted that the validation set is used to evaluate the performance of the model and perform hyperparameter tuning during the training process. The data in the validation set does not participate in the training of the model, but is used to select the best model parameters and structure. The test set is used to finally evaluate the generalization ability and performance of the model. The data in the test set does not participate in the training and verification of the model, but is used to evaluate the performance of the model in real scenarios.

[0145] Understandably, this step is the last step in the model development process, and it involves evaluating and validating the trained target weight model using the test set and validation set to ensure that the model performs well on unseen data. Evaluate the model using the validation set: Input the samples in the validation set into the trained target weight model, and calculate the performance indicators of the model on the validation set, such as accuracy, precision, recall, F1 score, etc. Evaluate the model using the test set: Input the samples in the test set into the trained target weight model, and also calculate the performance indicators of the model on the test set. These performance indicators can help evaluate the generalization ability, accuracy and robustness of the model, and whether the model meets the needs of practical applications. Based on the evaluation results on the test set and validation set, the best target weight model is selected as the final model. The best model is usually the model that performs best on the validation set, but the performance on the test set also needs to be considered to ensure that the model has good generalization ability. Once the best weight model is selected, it can be saved for subsequent deployment and application. In practical applications, the best trained model can be deployed in a production environment for real-time object detection tasks. In order to prove the practical benefits of this application, we conducted a model experiment comparison on the KITTI dataset, selected Yolov4-Tiny, Yolov5-N (r6.1), Yolox-Tiny, Yolov7-Tiny and the improved model ADW-Yolov7-Tiny for training on dataset A1, obtained the model parameter files after the corresponding model training, and used the parameter files to identify the test set B. For the experimental results, please refer to Fig.10 , Fig.10The experimental results comparison chart of the attention deformation convolution Yolov7-Tiny model and other models provided in the second embodiment of the target detection method of this application, where mAP@0.5:0.95 represents the average mAP at different IoU thresholds (from 0.5 to 0.95, step size 0.05) (0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95). mAP refers to the average accuracy of all categories; Parameters represents the number of parameters of the model; GFLOPs represents the amount of calculation of the model; FPS stands for frame rate per second (Frame Per Second), that is, the number of pictures that can be processed per second. Under the same input size of 416×416, the algorithm proposed in this application has better detection performance than the Yolov7-Tiny algorithm, and the model calculation complexity is also lower. A certain improvement has been achieved in the mAP indicator, with mAP increased from 56.2 to 59, and the improved model has higher detection accuracy. In addition, the computational complexity of the improved model is reduced from 13.1GFLOPs to 11.0GFLOPs. This shows that the improved model can maintain a high accuracy while having a lower computational cost, and is more suitable for resource-constrained scenarios. Compared with other classic algorithms, the performance of the model has also been significantly improved. Compared with Yolov4-Tiny, its mAP value has increased from 13.5 to 59, and the model performance has been greatly improved; compared with Yolov5-N (r6.1), the model detection speed can still maintain 101FPS, which can meet the real-time requirements, and the mAP value has increased from 31.9 to 59; compared with Yolox-Tiny, the computational complexity has dropped from 13.1GFLOPs to 11GFLOPs, and the mAP value of the model has increased by 9.4%, which has a certain improvement in performance. It proves that the proposed model can well balance real-time and accuracy. In summary, the algorithm proposed in this application has good real-time and accuracy, and can be applied in the field of autonomous driving.

[0146] This embodiment is based on the Yolov7-Tiny model to construct an attention deformation convolution Yolov7-Tiny model; pre-train the attention deformation convolution Yolov7-Tiny model and save the pre-training weights; adjust the attention deformation convolution Yolov7-Tiny model according to the pre-training weights; divide the preset data set according to a third preset ratio to obtain a first data set and a second data set; enhance the first data set using the Mosaic method; enhance the second data set using the Mixup method; divide the enhanced data set into a training verification set and a test set according to a first preset ratio; divide the training verification set into a training set and a verification set according to a second preset ratio; construct a deformation efficient layer aggregation network module through deformable convolution and efficient layer aggregation network modules, and introduce the deformation efficient layer aggregation network module into the backbone of the Yolov7-Tiny model network to obtain an optimized backbone network; introduce the NAM attention mechanism, SimAM attention mechanism and RepConv module into the neck network of the Yolov7-Tiny model to obtain an optimized neck network; obtain the attention deformation convolution Yolov7-Tiny model according to the Yolov7-Tiny model, the optimized backbone network and the optimized neck network; set the overall loss function according to the preset coefficient, regression loss function, target loss function and category loss function; extract the feature information in the training set by constructing the attention deformation convolution Yolov7-Tiny model; adjust the weight parameters of the attention deformation convolution Yolov7-Tiny model according to the feature information until the overall loss function reaches the minimum value to obtain the target weight model; test and verify the target weight model according to the test set and the validation set to obtain the weight model.This embodiment improves the flexibility and accuracy of the model for feature extraction by introducing the attention mechanism and deformable convolution; provides good initial parameters by pre-training and saving weights, promotes rapid convergence of the model, and improves initial performance; optimizes the initial state of the model by using pre-trained weights, accelerates the subsequent training process, and improves the training effect; ensures the application of different data enhancement methods and increases data diversity by segmenting the data set; increases data diversity and complexity by using the Mosaic method to enhance data, and improves the adaptability of the model to different scenarios; enhances data by using the Mixup method to enhance data, enhances the robustness of the model, and improves the model's ability to handle uncertainty and fuzzy data; ensures the fairness and reliability of model evaluation by reasonably segmenting data; ensures the performance evaluation of the model during the training process by segmenting the training validation set; improves the backbone network by introducing the deformable efficient layer aggregation network module The feature extraction ability and efficiency of the network are improved, and the overall performance of the model is enhanced; by introducing the NAM attention mechanism, SimAM attention mechanism and RepConv module, the feature fusion and processing ability of the neck network is optimized, and the accuracy of target detection is improved; by integrating the optimized modules, a high-performance target detection model is constructed, the overall detection effect is improved, and a model architecture suitable for target detection tasks is constructed, which improves the detection performance of the model; by setting the overall loss function, the various losses are balanced, the model training process is optimized, and the overall improvement of the model is ensured; by extracting feature information in the training set, the model's ability to recognize target features is enhanced; by adjusting the weight parameters, the model parameters are optimized, the detection accuracy and performance of the model are improved, and an efficient and accurate ADW-Yolov7-Tiny model is obtained; through testing and verification, the generalization ability and actual performance of the model are evaluated, ensuring the stable performance of the model on different data sets.

[0147] For example, to help understand the implementation process of the target detection method obtained by combining this embodiment with the above-mentioned embodiment 1, please refer to Fig.11 , Fig.11 A brief flowchart of a target detection method is provided, specifically:

[0148] The detailed steps of building and optimizing the attention deformable convolution Yolov7-Tiny model are shown. First, the attention deformable convolution Yolov7-Tiny model is built based on the Yolov7-Tiny model, pre-trained and the pre-trained weights are saved, and then the model is adjusted according to these weights. Next, the preset data set is divided into the first data set and the second data set according to the third preset ratio, and the two data sets are enhanced using the Mosaic method and the Mixup method respectively. The enhanced data set is divided into the training validation set and the test set according to the first preset ratio, and the training validation set is then divided into the training set and the validation set according to the second preset ratio. The deformable efficient layer aggregation network module is constructed by the deformable convolution and efficient layer aggregation network modules, and introduced into the backbone network of the Yolov7-Tiny model to obtain the optimized backbone network; the NAM attention mechanism, the SimAM attention mechanism and the RepConv module are introduced into the neck network of the model to obtain the optimized neck network. Finally, the attention deformable convolution Yolov7-Tiny model is formed by combining the optimized backbone network and the neck network. After setting the overall loss function, the model is used to extract the feature information of the training set, and the model weight parameters are adjusted according to these feature information until the overall loss function reaches the minimum value to obtain the target weight model. Finally, the target weight model is tested and verified using the test set and validation set to obtain the final weight model.

[0149] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the target detection method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0150] This application also provides a target detection device, please refer to Fig.12 , the target detection device comprises:

[0151] A model building module 10 is used to build a weight model, wherein the weight model is obtained by training the attention deformation convolution Yolov7-Tiny model, and the attention deformation convolution Yolov7-Tiny model is obtained based on the Yolov7-Tiny model;

[0152] An information acquisition module 20, used to acquire road condition information;

[0153] The target detection module 30 is used to perform target detection on the road condition information using the weight model to obtain a detection result.

[0154] The target detection device provided by the present application adopts the target detection method in the above embodiment, which can solve the technical problem of how to efficiently and accurately detect targets. Compared with the prior art, the beneficial effects of the target detection device provided by the present application are the same as the beneficial effects of the target detection method provided by the above embodiment, and other technical features in the target detection device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0155] The present application provides a target detection device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the target detection method in the above-mentioned embodiment one.

[0156] Reference below Fig.13 , which shows a schematic diagram of the structure of a target detection device suitable for implementing the embodiment of the present application. The target detection device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.13 The target detection device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0157] like Fig.13As shown, the target detection device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the target detection device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the target detection device to communicate with other devices wirelessly or by wire to exchange data. Although the target detection device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0158] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0159] The target detection device provided by the present application adopts the target detection method in the above embodiment, which can solve the technical problem of how to efficiently and accurately detect targets. Compared with the prior art, the beneficial effects of the target detection device provided by the present application are the same as the beneficial effects of the target detection method provided by the above embodiment, and the other technical features in the target detection device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0160] It should be understood that the various parts disclosed in this application can be implemented with hardware, software, firmware or a combination thereof. In the description of the above-mentioned embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner. The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in this application, which should be included in the protection scope of this application. Therefore, the protection scope of this application shall be based on the protection scope of the claims.

[0161] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the target detection method in the above-mentioned embodiment.

[0162] The computer-readable storage medium involved in this application can take a variety of physical forms, including but not limited to USB flash drives, electrical, magnetic, optical, electromagnetic, infrared or semiconductor systems and devices, and combinations thereof. These media can be wires with electrical connections, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), and other optical-magnetic storage devices. These media can store program codes for use by or in combination with the execution system, and the program codes can be transmitted through transmission media such as wires, optical cables, and radio frequencies. The above-mentioned computer-readable storage medium can be included in the target detection device; it can also exist alone without being assembled into the target detection device.

[0163] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the target detection device, the target detection device: establishes a weight model, which is obtained by training the attention deformation convolution Yolov7-Tiny model, and the attention deformation convolution Yolov7-Tiny model is obtained based on the Yolov7-Tiny model; obtains road condition information; uses the weight model to perform target detection on the road condition information to obtain a detection result.

[0164] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0165] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0166] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0167] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned target detection method, and can solve the technical problem of how to efficiently and accurately perform target detection. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the target detection method provided in the above-mentioned embodiment, and will not be repeated here.

[0168] The present application also provides a computer program product, including a computer program, which implements the steps of the target detection method as described above when the computer program is executed by a processor. The computer program product provided by the present application can solve the technical problem of how to efficiently and accurately perform target detection. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the target detection method provided by the above embodiment, and will not be repeated here.

[0169] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A target detection method, characterized in that: The method comprises: Establishing a weight model, wherein the weight model is obtained by training the attention deformation convolution Yolov7-Tiny model, and the attention deformation convolution Yolov7-Tiny model is obtained based on the Yolov7-Tiny model; Get traffic information; The weight model is used to perform target detection on the road condition information to obtain a detection result.

2. The method according to claim 1, characterized in that The step of establishing the weight model comprises: Based on the Yolov7-Tiny model, construct the attention deformable convolution Yolov7-Tiny model; Pre-train the attention deformable convolution Yolov7-Tiny model and save the pre-training weights; Adjust the attention deformation convolution Yolov7-Tiny model according to the pre-trained weights, and use the training set to train the adjusted attention deformation convolution Yolov7-Tiny model until the overall loss value is the lowest, thereby obtaining a target weight model; The target weight model is tested and verified according to the test set and the verification set to obtain a weight model.

3. The method according to claim 2, characterized in that The steps of constructing the attention deformation convolution Yolov7-Tiny model based on the Yolov7-Tiny model include: A deformable efficient layer aggregation network module is constructed through deformable convolution and efficient layer aggregation network modules, and the deformable efficient layer aggregation network module is introduced into the backbone network of the Yolov7-Tiny model to obtain an optimized backbone network; Introducing the NAM attention mechanism, the SimAM attention mechanism and the RepConv module into the neck network of the Yolov7-Tiny model to obtain an optimized neck network; According to the Yolov7-Tiny model, the optimized backbone network and the optimized neck network, an attention deformable convolution Yolov7-Tiny model is obtained.

4. The method according to claim 2, characterized in that Before the step of using the training set to train the adjusted attention deformable convolution Yolov7-Tiny model, it also includes: Perform data enhancement on the preset data set; The enhanced data set is divided into a training validation set and a test set according to a first preset ratio; The training validation set is divided into a training set and a validation set according to a second preset ratio.

5. The method according to claim 4, characterized in that The step of performing data enhancement on the preset data set includes: Segmenting the preset data set according to a third preset ratio to obtain a first data set and a second data set; Using the Mosaic method to enhance the first data set; The second data set is enhanced using the Mixup method.

6. The method according to claim 2, characterized in that The step of using the training set to train the adjusted attention deformable convolution Yolov7-Tiny model until the overall loss value is the lowest to obtain the target weight model includes: Build the attention deformable convolution Yolov7-Tiny model; Set the overall loss function according to the preset coefficients, regression loss function, target loss function and category loss function; Extracting feature information from the training set by constructing the attention deformable convolution Yolov7-Tiny model; The weight parameters of the attention deformation convolution Yolov7-Tiny model are adjusted according to the feature information until the overall loss function reaches a minimum value to obtain a target weight model.

7. The method according to claim 1, characterized in that The step of using the weight model to perform target detection on the road condition information includes: Convert the traffic information into a picture; Resizing the image; The weight model is used to perform target detection on the transformed image.

8. A target detection device, characterized in that: The device comprises: A model building module, used to build a weight model, wherein the weight model is obtained by training the attention deformation convolution Yolov7-Tiny model, and the attention deformation convolution Yolov7-Tiny model is obtained based on the Yolov7-Tiny model; An information acquisition module, used to obtain road condition information; The target detection module is used to perform target detection on the road condition information using the weight model to obtain a detection result.

9. A target detection device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the target detection method according to any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the target detection method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Intelligent ancient dam identification method and system based on historical image and deep learning

    CN119693740A

  • Cross-domain adaptive three-dimensional target detection method based on energy model and related device

    CN121686437A

  • Cross-domain adaptive three-dimensional target detection method based on energy model and related device

    CN121686437B