Road vehicle detection method and system based on improved YOLOv7
By introducing BoTNet layer, CHM module and BiFPN structure into the YOLO v7 model, the problems of slow detection speed and low accuracy in road vehicle detection are solved, and more efficient feature extraction and fusion are achieved, and detection accuracy and processing capabilities are improved.
Patent Information
- Application Number
- CN202411092377.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-08-09
AI Technical Summary
In road vehicle detection tasks, the prior art has problems such as slow detection speed, low detection accuracy, and complex background interference.
Adopting the improved YOLO v7 model, by introducing BoTNet layer and CHM modules into the backbone network, the feature extraction capability is increased, and BiFPN structure is applied to the Neck layer for multi-scale feature fusion, and the lightweight decoupling head is used in the detection head part to reduce Parameters and calculation amount.
It improves detection speed and accuracy, and can more effectively handle complex backgrounds and vehicle targets of different sizes to meet the needs of actual scenarios.
Smart Images

Figure CN119206428A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of target detection in traffic scenes, and specifically relates to a road vehicle detection method and a system thereof based on improved YOLO v7. Background Art
[0002] With the rapid development of cities, traffic flow continues to increase, and traffic management and safety have become the focus of people's attention. As one of the key technologies in traffic management and intelligent transportation systems, vehicle detection has always received extensive attention and research. In recent years, vehicle detection methods based on deep learning have made significant research progress in the fields of vehicle identification, traffic flow monitoring, and intelligent transportation systems.
[0003] Traditional vehicle detection methods are mainly based on sensor technology, such as geomagnetic sensors, microwave radars, etc. However, these sensors have some limitations, such as difficult installation, high cost, and low detection accuracy. In contrast, vehicle detection methods based on deep learning have higher flexibility, lower cost, and better detection accuracy, which has greatly improved the detection accuracy and robustness of vehicle detection methods. However, in the current road vehicle detection tasks, there are problems such as slow detection speed, low detection accuracy, and complex background interference.
[0004] YOLO is a one-stage target detection algorithm. Compared with other deep learning models, it does not have the complex detection process of two-stage algorithms. It only needs to input the image into the network to get the result, and can detect objects in real time and efficiently. In addition, the YOLO model uses a feature pyramid to extract features from images, and uses a multi-scale feature fusion mechanism to help extract object information of different scales, which can accurately and efficiently detect objects.
[0005] Based on the above situation, in order to better realize the detection of road vehicles, the present invention introduces YOLO into road vehicle detection and proposes a road vehicle detection method and system based on improved YOLO v7. Summary of the invention
[0006] The purpose of the present invention is to provide a road vehicle detection method and system based on improved YOLOv7 in view of the defects and problems existing in the prior art. The present invention solves the problems of slow detection speed, low detection accuracy, complex background interference, etc. in the road vehicle detection task, and can well meet the requirements in actual scenes.
[0007] The present invention adopts the following technical scheme:
[0008] The road vehicle detection method based on the improved YOLO v7 includes the following steps:
[0009] Step 1: Collect vehicle image data on the road;
[0010] Step 2: preprocessing the collected vehicle image data;
[0011] Step 3: After preprocessing, a vehicle data set is produced and divided into a training set and a validation set;
[0012] Step 4: Use the improved YOLO v7 model to train the dataset to obtain a vehicle target detector;
[0013] Step 5: Use the vehicle target detector obtained in step 4 to detect the image or video to be tested and obtain the detection result.
[0014] Furthermore, in step 1, the vehicle road image data collection method includes: obtaining image data by photographing road vehicles with a camera; or obtaining image data through an open source vehicle dataset.
[0015] Furthermore, in step 2, median filtering and histogram equalization are used for image preprocessing, that is, the vehicle road image data collected in step 1 is denoised using median filtering, and then contrast and clarity are enhanced through histogram equalization.
[0016] Furthermore, the detailed process of step 3 includes:
[0017] Step 31, converting the vehicle road image data format into image data in PASCAL VOC format;
[0018] Step 32: Use LabelImg to manually annotate the vehicles in each image in the dataset, with the minimum bounding rectangle of the annotated target as the true box.
[0019] Step 33: Randomly divide the data set into training set and validation set in a ratio of 8:2.
[0020] Furthermore, in step 4, the improved YOLO v7 model includes: adding two BoTNet layers in the Backbone of YOLO v7 (i.e., replacing the two ELAN layers with BotNet to improve the network and reduce the number of parameters), and the BoTNet structure process includes: the feature map passes through a 1x1 convolution layer to reduce or increase the number of channels, then passes through a multi-head self-attention (MHSA) layer, and then passes through a 1x1 convolution layer again to restore the number of channels to obtain a new feature map, and finally the original input feature map and the new feature map are spliced.
[0021] Furthermore, in step 4, the improved YOLO v7 model includes: adding a network structure CHM (Multi-Convolutional Hybrid Module) module for enhancing feature representation on the Neck input of YOLO v7, and the CHM module process includes: sending the input feature map to the CHM module, first using 1x1 convolution to perform linear transformation and channel integration of features, and then using convolution kernels of different sizes (such as 3x3, 1x3, 3x1, 5x5, etc.) to perform convolution operations on the feature map, and then splicing or weighted fusion of feature maps obtained by different convolutions in the channel dimension, and then applying 1x1 convolution to the fused feature map to integrate features, and finally splicing the feature map obtained by directly performing 1x1 convolution operation with the input feature map.
[0022] Furthermore, in step 4, the improved YOLO v7 model includes: applying the BiFPN multi-scale feature fusion structure to the Neck layer of YOLO v7.
[0023] Furthermore, in step 4, the improved YOLO v7 model includes: the final detection head (Decoupled Head) adopts a simple lightweight decoupled head, and reduces the number of parameters and the amount of calculation of the decoupled head by pruning and quantization.
[0024] Furthermore, in step 4, the detailed process of training the data set includes:
[0025] Step 41: Input the images in the dataset into the Darknet-53 improved by the YOLO v7 backbone network for feature extraction. The existing backbone network consists of four ELAN layers. The first and fourth ELAN layers are replaced with BoTNet layers to obtain three effective feature layers of output, which are 20x20, 40x40, and 80x80 in scale.
[0026] Step 42, the three effective feature layers obtained in step 41 are subjected to feature fusion processing by the BiFPN structure in Neck, wherein the 40x40 and 80x80 scale effective feature layers are subjected to feature enhancement by the CHM module; for the minimum scale 20x20 feature layer, after spatial pyramid pooling and cross-stage partial channel connection (SPPCSPC), the feature map p1 is obtained, p1 is upsampled and concat with the 40x40 feature layer to obtain p2; p2 is upsampled and concat with the 80x80 feature layer to obtain p3; BiFPN multi-scale feature fusion makes p3 downsampled again and concat with p2 and the 40x40 feature layer to obtain M1; M1 is downsampled again and concat with p1 to obtain Q2.
[0027] Step 43: Input the feature maps p3, M1, and Q2 obtained in step 42 into the lightweight decoupling head used for dimensional conversion. Then the algorithm directly predicts the probability of the object to be detected and the bounding box information to generate the bounding box, and uses non-maximum suppression (NMS) to remove redundant boxes to obtain the final predicted box.
[0028] Step 44: At the end of each training cycle, the final prediction box of step 43 and the true box calculate the classification confidence loss, the frame regression loss and the target confidence loss, so as to perform back propagation to update the parameters and optimize the network.
[0029] Step 45, determine whether the number of training rounds reaches the set number, if yes, execute step 46; if no, return to execute step 41.
[0030] Step 46: After the training is completed, a vehicle target detector is obtained according to the training results.
[0031] The preferred embodiment of the present invention introduces the BoTNet layer and the CHM module at a specific position of the network to perform feature enhancement, uses the BiFPN structure applied to the Neck layer of YOLOv7 to strengthen feature fusion, and finally adopts a lightweight decoupling head to reduce the number of parameters and calculations, thereby solving the problems of slow detection speed, low detection accuracy, complex background interference, etc. in road vehicle detection tasks.
[0032] Furthermore, in step 4, different combinations of parameters (batch size, learning rate, etc.) are optimized on the validation set through a hyperparameter search verification method to obtain the vehicle detector performance.
[0033] The present invention also discloses a road vehicle detection system based on improved YOLO v7, based on the above method, including the following modules:
[0034] Image data acquisition module: collects image data of vehicles on the road;
[0035] Preprocessing module: preprocesses the collected vehicle image data and divides it into training set and verification set;
[0036] Vehicle data set production module: produces vehicle data sets after preprocessing;
[0037] Training module: Use the YOLO v7 model to train the dataset to obtain a vehicle target detector;
[0038] Detection module: Use the obtained vehicle target detector to detect the test image or video to obtain the detection result.
[0039] The beneficial effects of the present invention are:
[0040] (1) The image preprocessing process effectively improves the image quality and helps to enhance the detection effect.
[0041] (2) The present invention improves the YOLO v7 model by replacing the redundant residual blocks in the backbone network with BoTNet. This architecture replaces the 3x3 spatial convolution with Multi-Head Self-Attention (MHSA) in the last three bottleneck blocks of ResNet, thereby improving the network while reducing the number of parameters and minimizing the delay overhead.
[0042] (3) The present invention enhances feature representation by introducing a multi-convolutional hybrid module (CHM) at the input position of the YOLO v7Neck layer. The module uses a multi-branch convolutional structure to extract multiple semantic information, while retaining the feature information of small targets and extracting as much rich context information as possible, thereby improving the feature representation capability of small target objects.
[0043] (4) The present invention improves the efficiency of feature fusion by applying the BiFPN structure to the YOLO v7Neck layer. The BiFPN structure introduces bidirectional connections between the levels of the feature pyramid, allowing information in the network to flow from higher-level features to lower-level features, and from lower-level features to higher-level features. By integrating feature information at different levels, it helps to capture multi-scale features. It also introduces weighted feature fusion to ensure optimal feature integration. This structure effectively improves the network's ability to handle objects of different sizes and complexities.
[0044] (5) For the Head part of YOLO v7, the present invention is equipped with a lighter decoupling head, which reduces the number of parameters and the amount of calculation of the decoupling head through pruning and quantization, thereby facilitating improving the inference speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention 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, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 The present invention is a general flow chart of a road vehicle detection method based on improved YOLO v7 according to a preferred embodiment of the present invention;
[0047] Figure 2 A schematic diagram of the YOLO v7 training process improved by the preferred embodiment of the present invention;
[0048] Figure 3 The structure diagram of the improved CHM module proposed in the preferred embodiment of the present invention;
[0049] Figure 4 The structure diagram of the YOLO v7 model improved by the preferred embodiment of the present invention;
[0050] Figure 5 The following is a block diagram of a road vehicle detection system based on improved YOLO v7 according to a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0051] The following describes the embodiments of the present invention through specific embodiments, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0052] like Figure 1 As shown, this embodiment is a road vehicle detection method based on improved YOLO v7, including the following steps:
[0053] Step 1: Collect vehicle image data on the road;
[0054] Step 2: preprocessing the collected vehicle image data;
[0055] Step 3: After preprocessing, a vehicle data set is produced and divided into a training set and a validation set;
[0056] Step 4: Use the improved YOLO v7 model to train the data set to obtain a vehicle target detector; use the hyperparameter search verification method to optimize the parameters of the target detector on the verification set;
[0057] Step 5: Use the detector obtained in step 4 to detect the test image or video to obtain the detection result.
[0058] The above steps are described in more detail as follows.
[0059] In step 1, the data set of this embodiment is an image data set obtained by photographing road vehicles with a camera.
[0060] In step 2, median filtering and histogram equalization are used for image preprocessing, so as to remove noise, enhance contrast and clarity of the collected road vehicle image data.
[0061] Further, step 3 specifically includes:
[0062] Step 31, converting the vehicle road image data format into image data in PASCAL VOC format;
[0063] Step 32: Use LabelImg to manually annotate the vehicles in each image in the dataset, with the minimum bounding rectangle of the annotated target as the true box.
[0064] Step 33: randomly divide the data set into training set and validation set in a ratio of 8:2, and generate train.txt and val.txt files to save the corresponding image lists.
[0065] In step 4, the improvement of the YOLO v7 network model in this embodiment specifically includes:
[0066] First, replace the first and fourth ELAN layers in Bockbone with BoTNet layers. The steps are as follows:
[0067] 1) Add the definition module BoTNet in common.py;
[0068] 2) Add the class name and modify the yolo.py configuration;
[0069] 3) Modify the YOLO v7 yaml configuration file to add BoT;
[0070] 4) Modify train.py.
[0071] Next, the proposed improved CHM module is added to the input of the Neck layer. The specific steps include:
[0072] 1) Add the definition module CHM in common.py;
[0073] 2) Add the class name and modify the yolo.py configuration;
[0074] 3) Modify the YOLO v7 yaml configuration file to add CHM;
[0075] 4) Modify train.py.
[0076] Then, the BiFPN structure is applied to the Neck layer. The specific steps include:
[0077] 1) Add the BiFPN module in common.py;
[0078] 2) Add the class name to the yolo.py file;
[0079] 4) Replace all Concat in the yaml file with BiFPN_Add.
[0080] 5) Modify train.py.
[0081] Finally, by replacing the improved decoupling head into the YOLO v7 model, the steps include:
[0082] 1) Create a head.py file in the models folder and paste it into it;
[0083] 2) Import the decoupling header module in the yolo.py file;
[0084] 3) Modify the common.py file;
[0085] 4) Find the Detect section in the YOLO v7 yaml file and replace the original decoupled header with the lightweight decoupled header.
[0086] like Figure 2 As shown, in step 4, the process of improving the YOLO v7 model training data set specifically includes the following steps:
[0087] Step 41: Input the images in the dataset into the Darknet-53 improved by the YOLO v7 backbone network for feature extraction. The existing backbone network consists of four ELAN layers. The first and fourth ELAN layers are replaced with BoTNet layers to obtain three effective feature layers of output, which are 20x20, 40x40, and 80x80 in scale.
[0088] Step 42, the three effective feature layers obtained in step 41 are further subjected to feature fusion processing by the BiFPN structure in Neck, wherein the 40x40 and 80x80 scale effective feature layers are first subjected to feature enhancement by the CHM module; and the smallest scale 20x20 feature layer is first subjected to spatial pyramid pooling and cross-stage partial channel connection (SPPCSPC) to obtain feature map p1, p1 is upsampled and concat with the 40x40 feature layer to obtain p2; p2 is upsampled and concat with the 80x80 feature layer to obtain p3; BiFPN multi-scale feature fusion makes p3 downsampled and concat with p2 and the 40x40 feature layer to obtain M1; M1 is downsampled and concat with p1 to obtain Q2, and finally 3 feature maps of different sizes are output corresponding to the size of the feature map output by the backbone network.
[0089] Step 43: Input the feature maps p3, M1, and Q2 output from step 42 into the lightweight decoupling head used for dimensional conversion, then directly predict the probability of the object to be detected and the bounding box information to generate the bounding box, and use non-maximum suppression (NMS) to remove redundant boxes to obtain the final predicted box.
[0090] Step 44, at the end of each training cycle, the final prediction box of step 43 and the true box calculate the classification confidence loss, the frame regression loss and the target confidence loss, where the target confidence loss and the classification confidence loss are calculated using binary cross entropy, that is:
[0091]
[0092] Where n is the number of samples, y i is the binary label value of the i-th sample 0 or 1 (ground truth), p(y i )=1 is the model’s predicted value for the i-th sample, that is, the probability that the model predicts the i-th sample label value to be 1.
[0093] The border regression loss is calculated using CIOU Loss, namely:
[0094]
[0095] in,
[0096]
[0097] Among them, IOU is the intersection-union ratio, that is, the ratio of the intersection and union of two boxes, d is the Euclidean distance between the center points of the predicted box and the real box, c is the diagonal distance of the minimum circumscribed rectangle of the two boxes, (w gt ,h gt ) and (w, h) are the width and height of the real box and the predicted box respectively, and υ is the correction factor used to further adjust the loss function to consider the shape and direction of the target box.
[0098] Then back propagation is performed to update parameters and optimize the network.
[0099] Step 45: Repeat steps 41-44 until the set number of iterations is reached.
[0100] Step 46: After the training is completed, a target detector with the best detection effect (i.e., the best PR curve) will be obtained according to the training results.
[0101] In this embodiment, in step 4, the hyperparameter search verification method is used to try different combinations of parameters (batch size, learning rate, etc.), for example, by setting the batch-size to 32 and the learning rate to 0.001 on the verification set to optimize the detector model performance.
[0102] In step 5, the target detector obtained in step 4 is used to detect the test image or video to obtain a detection result.
[0103] In summary, the preferred embodiment of the present invention discloses a road vehicle detection method based on improved YOLO v7, comprising the following steps: step 1: collecting vehicle road images; step 2: preprocessing the collected vehicle road image data by denoising, enhancing contrast and clarity; step 3: making the image into a data set after preprocessing, and dividing it into a training set and a verification set in a ratio of 8:2; step 4: introducing the BoTNet layer into the YOLO v7 backbone network to improve the network and reduce the number of parameters; adding a CHM module at the input of the Neck layer to improve the feature enhancement capability; and applying BiFPN in the path aggregation network to further enhance the feature fusion capability of the network; using the improved YOLO v7 model to train the data set to obtain a target detector; using the hyperparameter search verification method to optimize the target detector on the verification set; step 5: using the detector obtained in step 4 to detect the test image or video to obtain the detection result. The present invention introduces the BoTNet layer in the YOLO v7 network to reduce the number of parameters and minimize the delay, and adds a CHM module before the Neck input to improve the feature enhancement capability. At the same time, BiFPN is applied to the Neck layer to enhance the feature fusion capability. The accuracy of target detection is improved without affecting the reasoning speed, and real-time target detection and tracking of daily road vehicles can be achieved.
[0104] like Figure 5 As shown, this embodiment discloses a road vehicle detection system based on improved YOLO v7, based on the above method embodiment, including the following modules:
[0105] Image data acquisition module: collects image data of vehicles on the road;
[0106] Preprocessing module: preprocesses the collected vehicle image data and divides it into training set and verification set;
[0107] Vehicle data set production module: produces vehicle data sets after preprocessing;
[0108] Training module: Use the YOLO v7 model to train the dataset to obtain a vehicle target detector; use the hyperparameter search verification method to optimize the vehicle target detector on the verification set;
[0109] Detection module: Use the obtained vehicle target detector to detect the test image or video to obtain the detection result.
[0110] For other contents of this embodiment, please refer to the above method embodiment.
[0111] The beneficial effects of the present invention are:
[0112] (1) The image preprocessing process can effectively improve the image quality and help enhance the detection effect.
[0113] (2) The present invention improves the YOLO v7 model by replacing the redundant residual blocks in the backbone network with BoTNet. This architecture replaces the 3x3 spatial convolution with Multi-Head Self-Attention (MHSA) in the last three bottleneck blocks of ResNet, thereby improving the network while reducing the number of parameters and minimizing the delay overhead.
[0114] (3) The present invention enhances feature representation by introducing a multi-convolutional hybrid module (CHM) at the input position of the YOLO v7Neck layer. The module uses a multi-branch convolutional structure to extract multiple semantic information, while retaining the feature information of small targets and extracting as much rich context information as possible, thereby improving the feature representation capability of small target objects.
[0115] (4) The present invention improves the efficiency of feature fusion by applying the BiFPN structure to the YOLO v7Neck layer. The BiFPN structure introduces bidirectional connections between the feature pyramid levels, allowing information in the network to flow from higher-level features to lower-level features, and from lower-level features to higher-level features. By integrating feature information at different levels, it helps to capture multi-scale features. It also introduces weighted feature fusion to achieve optimal feature integration. This structure can effectively improve the network's ability to process complex and different-sized objects.
[0116] (5) For the Head part of YOLO v7, it is equipped with a lighter decoupling head. Through pruning and quantization, the number of parameters and the amount of calculation of the decoupling head are reduced, which helps to improve the reasoning speed.
[0117] The embodiments described above are merely descriptions of preferred implementations of the present invention and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope of the present invention.
Claims
1. A road vehicle detection method based on improved YOLOv7, characterized in that: The following steps are involved: Step 1: Collect vehicle image data on the road; Step 2: preprocessing the collected vehicle image data; Step 3: After preprocessing, a vehicle data set is produced and divided into a training set and a validation set; Step 4: Use the YOLO v7 model to train the data set to obtain a vehicle target detector; Step 5: Use the vehicle target detector obtained in step 4 to detect the image or video to be tested and obtain the detection result.
2. The road vehicle detection method based on improved YOLOv7 as claimed in claim 1, characterized in that: In step 1, the vehicle image data collection method includes: obtaining image data by photographing road vehicles with a camera; or obtaining image data through an open source vehicle dataset.
3. The road vehicle detection method based on improved YOLOv7 as claimed in claim 1, characterized in that: In step 2, median filtering and histogram equalization are used for image preprocessing.
4. The road vehicle detection method based on improved YOLOv7 as claimed in claim 1, characterized in that: Step 3 The detailed process includes: Step 31, converting the vehicle road image data format into image data in PASCAL VOC format; Step 32: Use LabelImg to label the vehicles in each image in the dataset, and use the minimum bounding rectangle of the labeled target as the true box; Step 33: Randomly divide the data set into training set and validation set in a ratio of 8:
2.
5. The road vehicle detection method based on improved YOLOv7 as claimed in claim 1, characterized in that: In step 4, the improvements to the YOLO v7 model include: adding BotNet to Backbone, adding a CHM module, a network structure for enhancing feature representation, to the Neck input, using the BiFPN multi-scale feature fusion structure in the Neck layer, and using a lightweight decoupling head in the detection head.
6. The road vehicle detection method based on improved YOLOv7 as claimed in claim 5, characterized in that: The BoTNet structural process includes: the feature map passes through a 1x1 convolution layer to reduce or increase the number of channels, then passes through a multi-head self-attention layer, and then passes through a 1x1 convolution layer again to restore the number of channels to obtain a new feature map, and finally the original input feature map and the new feature map are spliced.
7. The road vehicle detection method based on improved YOLOv7 as claimed in claim 5, characterized in that: The CHM module process includes: inputting the feature map into the CHM module, first using 1x1 convolution to perform linear transformation and channel integration of the features, then using convolution kernels of different sizes to perform convolution operations on the feature map, and then splicing or weighted fusion of the feature maps obtained by different convolutions in the channel dimension, and then applying 1x1 convolution to the fused feature map to integrate the features, and finally splicing the feature map after the integrated features and the input feature map after the 1x1 convolution operation.
8. The road vehicle detection method based on improved YOLOv7 according to any one of claims 5 to 7, characterized in that: In step 4, the training data set is as follows: Step 41: Input the images in the dataset into Darknet-53 of the YOLOv7 backbone network for feature extraction. The backbone network consists of four ELAN layers. The first and fourth ELAN layers are replaced with BoTNet layers to obtain three effective feature layers of output, which are 20x20, 40x40, and 80x80 in scale respectively. Step 42, the three effective feature layers obtained in step 41 are subjected to feature fusion processing through the BiFPN structure in Neck, wherein the effective feature layers of 40x40 and 80x80 scales are subjected to feature enhancement through the CHM module; for the minimum scale 20x20 feature layer, after spatial pyramid pooling and cross-stage partial channel connection, feature map p1 is obtained, p1 is upsampled and concatted with the 40x40 feature layer to obtain p2; p2 is upsampled and concatted with the 80x80 feature layer to obtain p3; BiFPN multi-scale feature fusion causes p3 to be downsampled and concatted with p2 and the 40x40 feature layer to obtain M1; M1 is downsampled and concatted with p1 to obtain Q2; Step 43: input the feature maps p3, M1, and Q2 obtained in step 42 into the adopted lightweight decoupling head for dimensional conversion, directly predict the probability of the object to be detected and the bounding box information to generate the bounding box, and use non-maximum suppression to remove redundant boxes to obtain the final predicted box; Step 44: The final predicted box of step 43 and the real box calculate the classification confidence loss, the frame regression loss and the target confidence loss, so as to perform back propagation to update the parameters and optimize the network; Step 45, determine whether the number of training rounds reaches the set number, if yes, execute step 46; if no, return to execute step 41; Step 46: After the training is completed, a vehicle target detector is obtained according to the training results.
9. The road vehicle detection method based on improved YOLOv7 as claimed in claim 1, characterized in that: In step 4, the performance of the vehicle target detector is optimized by performing different combinations of parameters through hyperparameter search verification on the validation set.
10. A road vehicle detection system based on improved YOLOv7, based on the method according to any one of claims 1 to 9, characterized in that: Includes the following modules: Image data acquisition module: collects image data of vehicles on the road; Preprocessing module: preprocesses the collected vehicle image data and divides it into training set and verification set; Vehicle data set production module: produces vehicle data sets after preprocessing; Training module: Use the YOLO v7 model to train the dataset to obtain a vehicle target detector; Detection module: Use the obtained vehicle target detector to detect the test image or video to obtain the detection result.
Citation Information
Patent Citations
Method and device for detecting damaged area in road, electronic equipment and readable storage medium
CN116797815A
Significance target detection method fusing mixed attention
CN117935031A
Detection method using fusion network based on attention mechanism, and terminal device
US11222217B1
Cited By
Fruit target and picking point synchronous detection method and system
CN119851266A
