Road vehicle detection method and system based on improved yolov7
Patent Information
- Application Number
- CN202411092377.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2044-08-09
AI Technical Summary
本发明解决了在道路车辆检测任务中存在的检测速度慢和检测精度低、复杂背景干扰等问题,能够很好地满足实际场景中的要求
[0040](1)、图像预处理过程有效改善图像质量,有利于增强检测效果。
Smart Images

Figure CN119206428B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of target detection technology in traffic scenarios, specifically relating to a road vehicle detection method and system based on an improved YOLO v7. Background Technology
[0002] With the rapid development of cities and the continuous increase in traffic flow, traffic management and safety have become key concerns. Vehicle detection, as a crucial technology in traffic management and intelligent transportation systems, has received widespread attention and research. In recent years, deep learning-based vehicle detection methods have made significant progress in areas such as vehicle recognition, traffic flow monitoring, and intelligent transportation systems.
[0003] Traditional vehicle detection methods primarily rely on sensor technologies such as geomagnetic sensors and microwave radar. However, these sensors have limitations, including difficult installation, high cost, and low detection accuracy. In contrast, deep learning-based vehicle detection methods offer greater flexibility, lower cost, and better detection accuracy, resulting in significant improvements in both accuracy and robustness. However, current road vehicle detection tasks still face challenges such as slow detection speed, low accuracy, and interference from complex backgrounds.
[0004] YOLO is a one-stage object detection algorithm. Compared to other deep learning models, it does not have the complex detection process of two-stage algorithms. It only requires inputting an image into the network to obtain results, enabling real-time and efficient object detection. Furthermore, the YOLO model uses a feature pyramid approach to extract features from images and employs a multi-scale feature fusion mechanism to help extract object information at different scales, enabling accurate and efficient object detection.
[0005] Based on the above situation, in order to better detect road vehicles, this invention introduces YOLO into road vehicle detection and proposes a road vehicle detection method and system based on an improved YOLO v7. Summary of the Invention
[0006] The purpose of this invention is to provide a road vehicle detection method and system based on an improved YOLOv7, addressing the deficiencies and problems existing in the prior art. This invention solves the problems of slow detection speed, low detection accuracy, and interference from complex backgrounds in road vehicle detection tasks, and can well meet the requirements of real-world scenarios.
[0007] The present invention adopts the following technical solution:
[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: Preprocess the collected vehicle image data;
[0011] Step 3: After preprocessing, a vehicle dataset is created and divided into a training set and a validation set;
[0012] Step 4: Train the dataset using the improved YOLO v7 model 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 results.
[0014] Furthermore, in step 1, the methods for acquiring vehicle road image data include: obtaining image data by taking pictures of road vehicles through 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 and road image data collected in step 1 are denoised using median filtering, and then enhanced in contrast and sharpness using histogram equalization.
[0016] Furthermore, step 3 includes the following detailed process:
[0017] Step 31: Convert the vehicle road image data format to PASCAL VOC format image data;
[0018] Step 32: Use LabelImg to manually annotate the vehicles in each image of the dataset, and use the smallest bounding rectangle of the annotated target as the ground truth bounding box.
[0019] Step 33: Randomly divide the dataset into training and validation sets in an 8:2 ratio.
[0020] Furthermore, in step 4, the improved YOLO v7 model includes: adding two BoTNet layers to the YOLO v7 backbone (i.e., replacing the two ELAN layers with BotNet to improve the network and reduce the number of parameters). The BoTNet structure process includes: the feature map passes through a 1x1 convolutional layer to reduce or increase the number of channels, then through a multi-head self-attention (MHSA) layer, then through another 1x1 convolutional layer to restore the number of channels to obtain a new feature map, and finally concatenating the original input feature map and the new feature map.
[0021] Furthermore, in step 4, the improved YOLO v7 model includes adding a CHM (Multi-Convolutional Hybrid Module) network structure to the Neck input of YOLO v7 to enhance feature representation. The CHM module process includes: feeding the input 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 (e.g., 3x3, 1x3, 3x1, 5x5, etc.) to perform convolution operations on the feature map, then concatenating or weighting the feature maps obtained through different convolutions in the channel dimension, then applying 1x1 convolution to the fused feature map to integrate the features, and finally concatenating it with the feature map obtained by directly performing 1x1 convolution operations on 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 and lightweight decoupled head, and the number of parameters and computational load of the decoupled head are reduced through pruning and quantization.
[0024] Furthermore, in step 4, the detailed process of training the dataset includes:
[0025] Step 41: Input the images in the dataset into Darknet-53, an improved version of the YOLO v7 backbone network, for feature extraction. The existing backbone network consists of four ELAN layers. Replace the first and fourth ELAN layers with BoTNet layers to obtain three effective feature layers with scales of 20x20, 40x40, and 80x80.
[0026] Step 42: The three effective feature layers obtained in Step 41 are processed by the BiFPN structure in Neck for feature fusion. The 40x40 and 80x80 scale effective feature layers are enhanced by the CHM module. For the smallest scale 20x20 feature layer, after spatial pyramid pooling and cross-stage partial channel connection (SPPCSPC), feature map p1 is obtained. p1 is upsampled and concatenated with the 40x40 feature layer to obtain p2. p2 is upsampled and concatenated with the 80x80 feature layer to obtain p3. BiFPN multi-scale feature fusion causes p3 to be downsampled and concatenated with p2 and the 40x40 feature layer to obtain M1. M1 is downsampled and concatenated 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 for dimension transformation. Then, the algorithm will directly predict the probability of the object to be detected and the bounding box information to generate bounding boxes, and use non-maximum suppression (NMS) to remove redundant boxes to obtain the final predicted boxes.
[0028] Step 44: At the end of each training cycle, the final predicted bounding box and the ground truth bounding box from Step 43 are used to calculate the classification confidence loss, bounding box regression loss, and target confidence loss, thereby performing backpropagation to update parameters and optimize the network.
[0029] Step 45: Determine if the number of training rounds has reached the set number. If yes, proceed to step 46; otherwise, return to step 41.
[0030] Step 46: After training, the vehicle target detector will be obtained based on the training results.
[0031] The preferred embodiment of this invention introduces a BoTNet layer and a CHM module at specific locations in the network for feature enhancement, and uses a BiFPN structure applied to the Neck layer of YOLOv7 to strengthen feature fusion. Finally, a lightweight decoupling head is used to reduce the number of parameters and computational load, thus solving the problems of slow detection speed, low detection accuracy, and complex background interference in road vehicle detection tasks.
[0032] Furthermore, in step 4, the performance of the vehicle detector is optimized by combining different parameters (batch size, learning rate, etc.) on the validation set through hyperparameter search validation.
[0033] This invention also discloses a road vehicle detection system based on an improved YOLO v7, which, based on the above method, includes the following modules:
[0034] Image data acquisition module: Acquires image data of vehicles on the road;
[0035] Preprocessing module: preprocesses the acquired vehicle image data and divides it into training and validation sets;
[0036] Vehicle dataset creation module: Creates a vehicle dataset after preprocessing;
[0037] Training module: The YOLO v7 model is used to train the dataset to obtain the vehicle target detector;
[0038] Detection module: Uses the obtained vehicle target detector to detect the image or video to be tested and obtain the detection results.
[0039] The beneficial effects of this invention are:
[0040] (1) Image preprocessing effectively improves image quality and helps enhance detection results.
[0041] (2) This invention improves the YOLO v7 model by replacing the redundant residual blocks in the backbone network with BoTNet. This architecture improves the network by replacing the 3x3 spatial convolution with Multi-Head Self-Attention (MHSA) in the last three bottleneck blocks of ResNet, thereby reducing the number of parameters and minimizing latency 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. This module uses a multi-branch convolutional structure to extract multiple semantic information, and extracts as much rich contextual information as possible while retaining the feature information of small targets, thereby improving the feature representation capability of small target objects.
[0043] (4) This invention improves the efficiency of feature fusion by applying the BiFPN structure to the YOLO v7Neck layer. The BiFPN structure introduces bidirectional connections between feature pyramid levels, enabling information to flow from higher-level features to lower-level features and vice versa. By integrating feature information from different levels, it helps capture multi-scale features. It also introduces weighted feature fusion to ensure optimal feature integration. This structure effectively improves the network's ability to process 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. By pruning and quantization, the number of parameters and computation of the decoupling head are reduced, thereby improving the inference speed. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 This is a flowchart illustrating a preferred embodiment of the road vehicle detection method based on an improved YOLO v7.
[0047] Figure 2 This is a schematic diagram of the improved YOLO v7 training process according to a preferred embodiment of the present invention;
[0048] Figure 3 This is a structural diagram of the improved CHM module proposed in a preferred embodiment of the present invention;
[0049] Figure 4 This is a structural diagram of the improved YOLO v7 model according to a preferred embodiment of the present invention;
[0050] Figure 5 This is a block diagram of a road vehicle detection system based on an improved YOLO v7, which is a preferred embodiment of the present invention. Detailed Implementation
[0051] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.
[0052] like Figure 1 As shown in the figure, this embodiment of a road vehicle detection method based on an improved YOLO v7 includes the following steps:
[0053] Step 1: Collect vehicle image data on the road;
[0054] Step 2: Preprocess the collected vehicle image data;
[0055] Step 3: After preprocessing, a vehicle dataset is created and divided into a training set and a validation set;
[0056] Step 4: Train the dataset using the improved YOLO v7 model to obtain a vehicle target detector; optimize the parameters of the target detector on the validation set using the hyperparameter search validation method.
[0057] Step 5: Use the detector obtained in Step 4 to detect the test image or video and obtain the detection results.
[0058] The steps described above are explained in more detail below.
[0059] In step 1, the dataset in this embodiment is an image dataset obtained by taking pictures of road vehicles through a camera.
[0060] In step 2, median filtering and histogram equalization are used for image preprocessing to denoise, enhance contrast and sharpness of the acquired road vehicle image data.
[0061] Furthermore, step 3 specifically includes:
[0062] Step 31: Convert the vehicle road image data format to PASCAL VOC format image data;
[0063] Step 32: Use LabelImg to manually annotate the vehicles in each image of the dataset, and use the smallest bounding rectangle of the annotated target as the ground truth bounding box.
[0064] Step 33: Randomly divide the dataset into training and validation sets in an 8:2 ratio, and generate train.txt and val.txt files to save the corresponding image lists.
[0065] In step 4, the improvements to the YOLO v7 network model in this embodiment specifically include:
[0066] First, replace the first and fourth ELAN layers in Bockbone with BoTNet layers. The specific steps include:
[0067] 1) Add the BoTNet module definition to common.py;
[0068] 2) Add the class name and modify the yolo.py configuration;
[0069] 3) Modify the YOLO v7 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, and the specific steps include:
[0077] 1) Add the BiFPN module to common.py;
[0078] 2) Add the class name to the yolo.py file;
[0079] 4) Replace all instances of Concat in the YAML file with BiFPN_Add.
[0080] 5) Modify train.py.
[0081] Finally, by replacing the improved decoupling head in the YOLO v7 model, the specific steps include:
[0082] 1) Create a new file named head.py in the models folder and paste it into the model folder;
[0083] 2) Import the decoupling header module into the yolo.py file;
[0084] 3) Modify the common.py file;
[0085] 4) In the YOLO v7 yaml file, find the Detect section and replace the original decoupling header with a lightweight decoupling header.
[0086] like Figure 2 As shown, step four, the process of improving the YOLO v7 model training dataset, specifically includes the following steps:
[0087] Step 41: Input the images in the dataset into Darknet-53, an improved version of the YOLO v7 backbone network, for feature extraction. The existing backbone network consists of four ELAN layers. Replace the first and fourth ELAN layers with BoTNet layers to obtain three effective feature layers with scales of 20x20, 40x40, and 80x80.
[0088] Step 42: The three effective feature layers obtained in Step 41 are further fused using the BiFPN structure in Neck. The 40x40 and 80x80 scale effective feature layers are first enhanced by the CHM module. The smallest scale 20x20 feature layer is first processed by spatial pyramid pooling and cross-stage partial channel connection (SPPCSPC) to obtain feature map p1. p1 is upsampled and concatenated with the 40x40 feature layer to obtain p2. p2 is upsampled and concatenated with the 80x80 feature layer to obtain p3. BiFPN multi-scale feature fusion causes p3 to be downsampled and concatenated with p2 and the 40x40 feature layer to obtain M1. M1 is downsampled and concatenated with p1 to obtain Q2. Finally, three 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 in step 42 into the lightweight decoupling head for dimension transformation. Then, directly predict the probability of the object to be detected and the bounding box information to generate bounding boxes. Use non-maximum suppression (NMS) to remove redundant boxes to obtain the final predicted boxes.
[0090] Step 44: At the end of each training cycle, the final predicted bounding boxes from Step 43 are compared with the ground truth bounding boxes to calculate the classification confidence loss, bounding box regression loss, and target confidence loss. The target confidence loss and classification confidence loss are calculated using binary cross-entropy, i.e.:
[0091]
[0092] Where n is the number of samples, y i It is the binary label value of the i-th sample, which is either 0 or 1 (ground truth), p(y i ) = 1 is the model's prediction for the i-th sample, that is, the probability that the model predicts the label value of the i-th sample to be 1.
[0093] The bounding box regression loss is calculated using CIOU Loss, i.e.:
[0094]
[0095] in,
[0096]
[0097] Where IOU is the intersection-union ratio, which is the ratio of the intersection to the union of two bounding boxes; d is the Euclidean distance between the center points of the predicted box and the ground truth box; c is the diagonal distance between the minimum bounding rectangles of the two boxes; (w gt h gt (w, h) and (w, h) are the width and height of the ground truth bounding box and the predicted bounding box, respectively, and υ is a correction factor used to further adjust the loss function, taking into account the shape and orientation of the target bounding box.
[0098] This allows for backpropagation 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 training, a target detector with the best detection performance (i.e., the best PR curve) will be obtained based on the training results.
[0101] In this embodiment, step 4 uses a hyperparameter search validation method to represent trying different combinations of parameters (batch size, learning rate, etc.), for example, optimizing the detector model performance on the validation set by setting the batch-size to 32 and the learning rate to 0.001.
[0102] In step 5, the target detector obtained in step 4 is used to detect the test image or video to obtain the detection result.
[0103] In summary, the preferred embodiment of this invention discloses a road vehicle detection method based on an improved YOLO v7, comprising the following steps: Step 1: Acquiring vehicle and road images; Step 2: Preprocessing the acquired vehicle and road image data by denoising, enhancing contrast, and improving sharpness; Step 3: After preprocessing, creating a dataset from the images and dividing it into a training set and a validation set in an 8:2 ratio; Step 4: Introducing a 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 feature enhancement capabilities; and applying BiFPN in the path aggregation network to further enhance the network's feature fusion capabilities; training the dataset using the improved YOLO v7 model to obtain a target detector; and optimizing the target detector on the validation set using a hyperparameter search validation method; Step 5: Using the detector obtained in Step 4 to detect test images or videos to obtain detection results. This invention introduces a BoTNet layer into the YOLO v7 network to reduce the number of parameters and minimize latency, and adds a CHM module before the Neck input to improve feature enhancement capabilities. At the same time, BiFPN is applied to the Neck layer to enhance feature fusion capabilities. Without affecting inference speed, this invention improves the accuracy of target detection and enables real-time target detection and tracking of vehicles on daily roads.
[0104] like Figure 5 As shown, this embodiment discloses a road vehicle detection system based on an improved YOLO v7. Based on the above method embodiment, it includes the following modules:
[0105] Image data acquisition module: Acquires image data of vehicles on the road;
[0106] Preprocessing module: preprocesses the acquired vehicle image data and divides it into training and validation sets;
[0107] Vehicle dataset creation module: Creates a vehicle dataset after preprocessing;
[0108] Training module: The YOLO v7 model is used to train the dataset to obtain the vehicle target detector; the vehicle target detector is optimized on the validation set using a hyperparameter search validation method.
[0109] Detection module: Uses the obtained vehicle target detector to detect the image or video to be tested and obtain the detection results.
[0110] Other aspects of this embodiment can be found in the above method embodiments.
[0111] The beneficial effects of this invention are:
[0112] (1) Image preprocessing can effectively improve image quality and enhance detection results.
[0113] (2) This invention improves the YOLO v7 model by replacing the redundant residual blocks in the backbone network with BoTNet. This architecture improves the network by replacing the 3x3 spatial convolution with Multi-Head Self-Attention (MHSA) in the last three bottleneck blocks of ResNet, thereby reducing the number of parameters and minimizing latency overhead.
[0114] (3) This invention enhances feature representation by introducing a multi-convolutional hybrid module (CHM) at the input position of the YOLO v7Neck layer. This module uses a multi-branch convolutional structure to extract multiple semantic information, which can extract more rich contextual information while retaining the feature information of small targets, thereby improving the feature representation capability of small target objects.
[0115] (4) This invention improves the efficiency of feature fusion by applying the BiFPN structure to the YOLO v7Neck layer. The BiFPN structure introduces bidirectional connections between feature pyramid levels, enabling information to flow from higher-level features to lower-level features and vice versa. By integrating feature information from different levels, it helps capture multi-scale features. Furthermore, it introduces weighted feature fusion, achieving optimal feature integration. This structure effectively improves the network's ability to process complex objects of varying sizes.
[0116] (5) For the Head part of YOLO v7, a lighter decoupling head is provided. Through pruning and quantization, the number of parameters and computation of the decoupling head are reduced, which helps to improve the inference speed.
[0117] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made by those skilled in the art to the technical solutions of the present invention without departing from the spirit of the present invention should fall within the protection scope of the present invention.
Claims
1. A road vehicle detection method based on an improved YOLOv7, characterized in that, Includes the following steps: Step 1: Collect vehicle image data on the road; Step 2: Preprocess the collected vehicle image data; Step 3: After preprocessing, a vehicle dataset is created and divided into a training set and a validation set; Step 4: Train the dataset using the YOLO v7 model to obtain the 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 results; In step 4, the training dataset is as follows: Step 41: Input the images in the dataset into the Darknet-53 of the YOLOv7 backbone network for feature extraction. The backbone network consists of four ELAN layers. Replace the first and fourth ELAN layers with BoTNet layers to obtain three effective feature layers with scales of 20x20, 40x40, and 80x80 respectively. Step 42: The three effective feature layers obtained in Step 41 are processed by the BiFPN structure in Neck for feature fusion. The 40x40 and 80x80 scale effective feature layers are enhanced by the CHM module. For the smallest scale 20x20 feature layer, after spatial pyramid pooling and cross-stage partial channel connection, feature map p1 is obtained. p1 is upsampled and concatenated with the 40x40 feature layer to obtain p2. p2 is upsampled and concatenated with the 80x80 feature layer to obtain p3. BiFPN multi-scale feature fusion causes p3 to be downsampled and concatenated with p2 and the 40x40 feature layer to obtain M1. M1 is downsampled and concatenated with p1 to obtain Q2. Step 43: Input the feature maps p3, M1, and Q2 obtained in step 42 into the lightweight decoupling head for dimension transformation, directly predict the probability of the object to be detected and the bounding box information to generate bounding boxes, and use non-maximum suppression to remove redundant boxes to obtain the final predicted boxes. In steps 44 and 43, the final predicted bounding boxes and ground truth bounding boxes are compared to calculate the classification confidence loss, bounding box regression loss, and target confidence loss. This allows for backpropagation to update parameters and optimize the network. Step 45: Determine if the set number of training rounds has been reached. If yes, proceed to step 46; otherwise, return to step 41. Step 46: Training ends, and the vehicle target detector is obtained based on the training results; The CHM module process includes: inputting the feature map into the CHM module, processing it first with five 1x1 convolutions, then processing the feature map after the first 1x1 convolution with a first 3x3 convolution; processing the feature map after the second 1x1 convolution with a first 1x3 convolution, a first 3x1 convolution, and a second 3x3 convolution; processing the feature map after the third 1x1 convolution with a second 3x1 convolution, a second 1x3 convolution, and a third 3x3 convolution; processing the feature map after the fourth 1x1 convolution with a 5x5 convolution and a fourth 3x3 convolution; and then concatenating the feature maps processed by the first 3x3 convolution, the second 3x3 convolution, the third 3x3 convolution, the fourth 3x3 convolution, and the fifth 1x1 convolution.
2. The road vehicle detection method based on improved YOLOv7 as described in claim 1, characterized in that: In step 1, the vehicle image data acquisition methods include: obtaining image data by taking pictures of road vehicles through a camera; or obtaining image data through an open-source vehicle dataset.
3. The road vehicle detection method based on improved YOLOv7 as described 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 the improved YOLOv7 as described in claim 1, characterized in that: Step 3 includes the following detailed process: Step 31: Convert the vehicle road image data format to PASCAL VOC format image data; Step 32: Use LabelImg to label the vehicles in each image of the dataset, and use the smallest bounding rectangle of the labeled target as the ground truth bounding box; Step 33: Randomly divide the dataset into training and validation sets in an 8:2 ratio.
5. The road vehicle detection method based on the improved YOLOv7 as described in claim 1, characterized in that: The BoTNet architecture process includes: the feature map passes through a 1x1 convolutional layer to reduce or increase the number of channels, then through a multi-head self-attention layer, and then through another 1x1 convolutional layer to restore the number of channels to obtain a new feature map. Finally, the original input feature map and the new feature map are concatenated.
6. The road vehicle detection method based on improved YOLOv7 as described in claim 1, characterized in that: In step 4, the performance of the vehicle target detector is optimized by combining different parameters on the validation set through hyperparameter search validation.
7. A road vehicle detection system based on an improved YOLOv7, wherein the method described in any one of claims 1-6 is characterized in that, Includes the following modules: Image data acquisition module: Acquires image data of vehicles on the road; Preprocessing module: preprocesses the acquired vehicle image data and divides it into training and validation sets; Vehicle dataset creation module: Creates a vehicle dataset after preprocessing; Training module: The YOLO v7 model is used to train the dataset to obtain the vehicle target detector; Detection module: Uses the obtained vehicle target detector to detect the image or video to be tested and obtain the detection results.