A rapid detection method and system for pavement distress based on the YOLOv7 algorithm
By improving the YOLOv7 algorithm, utilizing depthwise separable convolution and heavily parameterized convolution, and combining it with an ultra-lightweight network architecture, we have achieved rapid and high-precision detection of road surface defects, overcoming the shortcomings of existing algorithms in terms of speed and accuracy, and making it suitable for mobile platforms.
Patent Information
- Application Number
- CN202311103573.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-30
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2043-08-30
AI Technical Summary
Existing road surface defect detection algorithms struggle to improve both speed and accuracy simultaneously. Traditional methods are inefficient and highly susceptible to weather conditions, while machine learning methods suffer from parameter dependence and diverse processing methods in practical applications.
An improved YOLOv7 algorithm is adopted, which uses depthwise separable convolution, heavily parameterized convolution and coordinate attention operations, combined with the ultra-lightweight network architecture Mobile One and Slim-Neck, to perform multi-layer feature extraction and fusion, thereby achieving fast and high-precision road surface defect detection.
It improves the accuracy and speed of detection, reduces model parameters and complexity, making detection more efficient and accurate, and is suitable for deployment on mobile platforms.
Smart Images

Figure CN117058459B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer vision technology, specifically to a method and system for rapid detection of road surface defects based on the YOLOv7 algorithm. Background Technology
[0002] The statements in this section are merely background information relating to this disclosure and do not necessarily constitute prior art.
[0003] Roads are a crucial component of the transportation system, and their quality directly impacts traffic safety and efficiency. With my country's rapid economic development, road usage intensity is continuously increasing, making pavement damage a significant issue in road construction and maintenance. Early detection and timely repair of pavement damage can effectively reduce the extent of road damage, decrease maintenance costs, and extend road lifespan.
[0004] Traditional methods for detecting road surface defects primarily rely on manual inspection, where workers visually inspect the road surface for damage and then repair it. However, this method has many limitations, such as low efficiency, low accuracy, and susceptibility to weather conditions. Early road surface defect detection algorithms mainly employed image processing methods for image preprocessing and feature extraction. As research deepened, it was discovered that road surface defect images possess strong edge characteristics, leading researchers to study edge detection algorithms. However, existing algorithms face challenges in practical applications, such as dependence on manually set parameters and the need for different processing methods for different types of defects. With the development of machine learning technology, increasing research has begun applying it to road surface defect detection. These methods can automatically learn and classify features in images, thereby achieving road surface defect detection with better performance and robustness compared to traditional image processing methods. In recent years, with the rapid development of deep learning technology, more and more research has begun applying it to road surface defect detection. However, current research on machine learning algorithms largely focuses on "improving speed while maintaining accuracy" or "improving accuracy while maintaining speed," and no algorithm has yet been able to simultaneously improve both the speed and accuracy of model detection. Summary of the Invention
[0005] To address the aforementioned issues, this disclosure proposes a rapid pavement distress detection method and system based on the YOLOv7 algorithm. To overcome the shortcomings of existing pavement distress detection algorithms, such as complex models, low accuracy, and slow speed, the existing YOLOv7 algorithm is improved to perform rapid and high-precision pavement distress detection. This enables fast and accurate detection and labeling of pavement distress, achieving both speed and accuracy in pavement distress detection. Furthermore, it is suitable for deployment on mobile platforms, demonstrating significant advantages in engineering applications.
[0006] To achieve the above objectives, the present disclosure adopts the following technical solution:
[0007] One or more embodiments provide a method for rapid detection of pavement defects based on the YOLOv7 algorithm, including the following steps:
[0008] Acquire images of the road surface to be identified and perform preprocessing;
[0009] The preprocessed image is compressed to higher dimensions, and multi-layer feature extraction is performed using depthwise separable convolution. Pooling features with different receptive fields are extracted from the top layer image and then stacked.
[0010] After performing coordinate attention operations on the output features of each layer, the top-down upsampling and bottom-up downsampling are fused together to perform multi-scale feature fusion on the features of each layer, resulting in a feature map with enhanced features.
[0011] The enhanced feature map is subjected to target detection and reparameterized convolution operations, and the classification results are used to obtain the identification results of pavement defects.
[0012] One or more embodiments provide a rapid pavement distress detection system based on the YOLOv7 algorithm, including:
[0013] Preprocessing module: configured to acquire the road surface image to be identified and perform preprocessing;
[0014] Backbone feature extraction network: It is configured to perform dimensionality compression on the preprocessed image, use depthwise separable convolution for multi-layer feature extraction, and perform pooling feature extraction on the top layer image with different receptive fields and stack them.
[0015] Enhanced feature extraction network: It is configured to perform coordinate attention operation on the output features of each layer, and then fuse top-down upsampling and bottom-up downsampling to perform multi-scale feature fusion of the features of each layer to obtain the feature map after feature enhancement.
[0016] Output network: It is configured to perform object detection and reparameterized convolution operations on the feature maps after feature enhancement, and obtain the identification results of road surface defects after classification.
[0017] Compared with the prior art, the beneficial effects of this disclosure are as follows:
[0018] In this disclosure, depthwise separable convolution and reparameterized convolution are used to process images, which can reduce the parameters and complexity of the YOLOv7 algorithm model. At the same time, coordinate attention operation is used to enhance the recognition effect of effective feature layers, thereby improving the accuracy of road defect detection.
[0019] The advantages of this disclosure, as well as its additional advantages, will be described in detail in the following specific embodiments. Attached Figure Description
[0020] The accompanying drawings, which form part of this disclosure, are used to provide a further understanding of this disclosure. The illustrative embodiments of this disclosure and their descriptions are used to explain this disclosure and do not constitute a limitation thereof.
[0021] Figure 1 This is a flowchart of the detection method of Embodiment 1 of this disclosure;
[0022] Figure 2 This is a schematic diagram of the YOLOv7 algorithm model structure constructed according to Embodiment 1 of this disclosure;
[0023] Figure 3 This is a network architecture diagram of the backbone network Mobile One in Embodiment 1 of this disclosure;
[0024] Figure 4 This is a structural diagram of the coordinate attention mechanism of Embodiment 1 of this disclosure;
[0025] Figure 5 This is a schematic diagram of the GSConv convolution operation in Slim-Neck according to Embodiment 1 of this disclosure. Detailed Implementation
[0026] The present disclosure will be further described below with reference to the accompanying drawings and embodiments.
[0027] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of this disclosure. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure pertains.
[0028] It should be noted that the terminology used herein is for descriptive purposes only and is not intended to limit the exemplary embodiments according to this disclosure. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof. It should be noted that, without conflict, the various embodiments and features within those embodiments can be combined with each other. The embodiments will now be described in detail with reference to the accompanying drawings.
[0029] Example 1
[0030] In one or more of the technical solutions disclosed in the embodiments, such as Figures 1 to 5As shown, a rapid detection method for pavement defects based on the YOLOv7 algorithm can be implemented by constructing a YOLOv7 algorithm model, including the following steps:
[0031] Step 1: Obtain the road surface image to be identified and perform preprocessing;
[0032] Step 2: Perform dimensionality compression on the preprocessed image, use depthwise separable convolution to extract multi-layer features, and perform pooling feature extraction on the top layer image with different receptive fields and stack them.
[0033] Step 3: After performing coordinate attention operations on the output features of each layer, fuse top-down upsampling and bottom-up downsampling to perform multi-scale feature fusion on the features of each layer, and obtain the feature map after feature enhancement.
[0034] Step 4: Perform target detection and reparameterized convolution (RepConv convolution) operations on the enhanced feature map, and obtain the identification results of pavement defects after classification.
[0035] In this embodiment, depthwise separable convolution and reparameterized convolution are used to process the image, which can reduce the parameters and complexity of the YOLOv7 algorithm model. At the same time, coordinate attention operation is used to enhance the recognition effect of the effective feature layer, thereby improving the accuracy of road defect detection.
[0036] Step 1 involves preprocessing the acquired image, including the following steps:
[0037] Step 11: Adjust the size of the acquired road surface image and perform a sample transformation operation to obtain the transformed sample;
[0038] Specifically, sample transformation operations may include flipping, symmetry, scaling and width twisting, as well as randomly adjusting brightness and contrast, cropping and splicing the samples before mixing.
[0039] Step 12: Perform dual data augmentation on the transformed samples using Mosaic and MixUp.
[0040] Mosaic data augmentation stitches together multiple different images into a single large image. MixUp data augmentation, on the other hand, uses linear interpolation to generate a new image from two different images.
[0041] Specifically, dual data augmentation using Mosaic and MixUp includes the following steps:
[0042] Mosaic data augmentation: Four different images are randomly selected from the dataset and then stitched together into a large image. The position of each sub-image pixel is also randomly offset and scaled, resulting in a composite image containing four different sub-images.
[0043] MixUp data augmentation: Generates a new image by linearly interpolating two different images.
[0044] Double data augmentation can be achieved by randomly selecting datasets and performing Mosaic and MixUp operations, or performing both operations simultaneously.
[0045] Steps 2 to 4 above can be implemented in the YOLOv7 algorithm model, and the model structure is as follows: Figure 2 As shown, it includes: a backbone feature extraction network (abbreviated as Backbone), a reinforcement feature extraction network (abbreviated as Slim Neck), and an output network (abbreviated as Head).
[0046] The backbone feature extraction network (abbreviated as Backbone) is used to perform dimensionality compression on the preprocessed image. It uses depthwise separable convolution to extract features in multiple layers, and performs pooling feature extraction on the top layer image with different receptive fields and stacks them. The backbone feature extraction network implements the process in step 2.
[0047] The enhanced feature extraction network (Slim Neck) is configured to perform attention operations on the coordinates of the output feature results from each layer, and then fuse top-down upsampling and bottom-up downsampling to perform multi-scale feature fusion of the features from each layer, resulting in a feature-enhanced feature map used to implement step 2.
[0048] The output network (Head) is configured to perform reparameterized convolution (RepConv convolution) on the feature maps after feature enhancement, and the classification results are used to obtain the identification results of road surface defects.
[0049] In some embodiments, the backbone feature extraction network includes multiple cascaded Mobile One Block modules, with the last Mobile One Block module connected to the SPPCSCP module.
[0050] In this embodiment, five Mobile One Block modules are configured, such as... Figure 2 As shown, they are Mobile OneBlock0, Mobile One Block1, Mobile One Block2, Mobile One Block3 and Mobile OneBlock4, respectively.
[0051] Specifically, the structure of the Mobile One Block module can be as follows: Figure 3 As shown, the Mobile One Block includes sequentially performing depthwise convolution and pointwise convolution, followed by batch normalization and activation operations after depthwise convolution, and then performing batch normalization and activation operations after pointwise convolution, to achieve image upscaling and compression processing.
[0052] like Figure 3 As shown, depthwise convolution includes three branches during training: a concatenated batch normalized deep convolution layer with a kernel size of 1, a concatenated batch normalized deep convolution layer with a kernel size of 3, and a batch normalization layer. During inference, the refactored parameter is a concatenated batch normalized deep convolution layer with a kernel size of 3. Pointwise convolution includes two branches during training: a concatenated batch normalized pointwise convolution layer with a kernel size of 1 and a batch normalization layer. During inference, the refactored parameter is a single concatenated batch normalized pointwise convolution layer with a kernel size of 1×1. During training, the three branches of the depthwise convolution are summed, passed through an activation function, and used as the input to the pointwise convolution part, which is then activated again. During inference, the depthwise convolution part is activated and then passed through an activation function as the input to the pointwise convolution part, which is then activated again.
[0053] This embodiment creatively proposes to use the ultra-lightweight network architecture Mobile One as the network architecture, so as to significantly reduce the number of parameters while improving model accuracy.
[0054] The SPPCSCP module is used to extract pooled features from images with different receptive fields and stack them to increase the range of receptive range for the target.
[0055] Optionally, the structure of the SPPCSCP module can be as follows: Figure 2 As shown, the process can be divided into two branches. The first branch performs three standard convolutions on the input, followed by max pooling with a set kernel size (e.g., 5, 9, or 13). The results of the three pooling operations are then stacked with the results of the three standard convolutions, and finally, a standard convolution is performed. The second branch performs one standard convolution on the input. The results from the two branches are then stacked and then subjected to another standard convolution. The standard convolution operation is a concatenation of convolution, batch normalization, and activation function activation.
[0056] In this embodiment, the backbone network performs up-dimensional compression on the input image features, extracts the image's feature information, and finally outputs three effective feature layers. The top SPPCSCP module performs pooling feature extraction on the image with different receptive fields and stacks them to improve the receptive range for the target.
[0057] In some embodiments, the enhanced feature extraction network is configured to perform coordinate attention operations on the output features of each layer, then fuse top-down upsampling and bottom-up downsampling to perform multi-scale feature fusion of the features of each layer, thereby obtaining a feature map with enhanced features.
[0058] In step 3, the features of each layer output by the backbone feature extraction network are subjected to coordinate attention operation, which is specifically implemented in the coordinate attention module (CA) to enhance the network's consideration of the effective feature layers in the channel direction, thereby improving the performance and accuracy of the model.
[0059] Coordinate attention operations include average pooling on two coordinates of the input image, channel stacking and convolution, batch normalization and non-linear activation, convolution and activation to obtain the output image.
[0060] Coordinate attention operation module, such as Figure 4 As shown, the input to output includes an average pooling layer (Avg Pool), a channel stacking and convolution operation module (Concat Conv), a batch normalization and non-linear activation layer (BN+NL), a regular convolutional layer (Conv), and a sigmoid activation layer.
[0061] Specifically, the calculation process for the coordinate attention operation is as follows:
[0062]
[0063] In the formula, y c (i,j) represents the output feature value at coordinate (i,j) in channel C, x c (i,j) represents the input feature value with coordinates (i,j) in channel C. The weights on the x-coordinate in channel C. This represents the weight on the y-coordinate of channel C.
[0064] Weight The calculation method is as follows:
[0065] g h =σ(C h (f h ))
[0066] In the formula, σ represents the activation operation performed using the Sigmoid activation function. Figure 4 Implemented in the Sigmoid activation layer; C h For convolution operations on the x-axis, f h The eigenvalues are the eigenvalues on the x-coordinate.
[0067] Weight The calculation method is as follows:
[0068] g w =σ(C w (f w ))
[0069] In the formula, σ is the Sigmoid operation, and C w For convolution operations on the y-axis, f w The eigenvalues are the eigenvalues on the y-coordinate.
[0070] The eigenvalue f on the x-coordinate h With the eigenvalue f on the y-coordinate w The calculation formula is as follows:
[0071] f=δ(C1([z h ,z w ]))
[0072] In the formula, δ represents the batch normalization and nonlinear activation layer. Figure 4 Implemented in batch normalization and non-linear activation layers; C1 is for channel stacking and convolution operations, in Figure 4 Implemented in the channel stacking and convolution operation module; z h ,z w The 1D average pooling results for the x and y coordinates are respectively, in... Figure 4 It is implemented in two average pooling layers.
[0073] The one-dimensional average pooling result for the x and y coordinates is calculated using the following formula:
[0074]
[0075] In the formula, W is the width of the input feature map, and x c (h,i) represents the eigenvalues at the x-coordinate in channel C.
[0076]
[0077] In the formula, H is the height of the input feature map, and x c (j,w) represents the eigenvalues at the y-coordinate in channel C.
[0078] In some embodiments, the output network (Head), such as Figure 2 As shown, it includes a YoloHead module and a reparameterized convolution module connected in sequence.
[0079] The enhanced feature extraction network in this embodiment is based on the Slim-Neck design paradigm of GSConv convolution. It uses GSConv convolution to simplify and optimize the Neck network, and creatively designs a Slim Neck network suitable for YOLOv7. While ensuring learning ability, it reduces the computational cost by 60%-70%.
[0080] Optionally, a feature enhancement branch is set in the Slim Neck feature extraction network, corresponding to the effective output layer of the backbone feature extraction network. Each branch includes a GSConv convolutional module, a channel stacking module (Concat), and a MultiConcat Block module connected in sequence. The branches are sampled through FPN and PAN structures. The FPN structure performs upsampling from top to bottom, and the PAN structure performs downsampling from bottom to top. The image is fused at multiple scales through the joint structure of FPN and PAN to finally obtain the output feature map.
[0081] Optionally, the MultiConcat Block module includes multiple branches of GSConv convolutional modules, and each branch of GSConv convolutional modules is cascaded with one or more GSConv convolutional modules to form a stacked structure of GSConv convolutional modules.
[0082] A specific structure, the MultiConcat Block module in this embodiment, is as follows: Figure 2 As shown, the module contains four branches. The first branch performs one GSConv convolution. The result of the second branch's GSConv convolution is used as the input to the third branch. The result of the third branch's two GSConv convolutions is used as the input to the fourth branch. The fourth branch performs two GSConv convolutions. The results from the four branches are then stacked by channel and subjected to another GSConv convolution.
[0083] Optionally, the convolution process of each of the above GSConv convolutional modules includes performing a convolution operation on the input image, followed by a depthwise convolution operation, stacking the output feature map after the depthwise convolution operation with the feature map after the ordinary convolution operation, and finally performing a shuffling operation to output the feature map, such as... Figure 5 As shown, the calculation process is as follows:
[0084] Y=Shuffle(Concat(Conv(X),DWConv(Conv(X))))
[0085] In the formula, Y is the output feature map, Shuffle is the shuffling operation, Concat is the channel stacking operation, Conv is the ordinary convolution operation, and DWConv is the depthwise convolution operation.
[0086] The ultra-lightweight network architecture Mobile One and Slim-Neck employed in this embodiment significantly reduces the number of model parameters and model complexity by leveraging depthwise separable convolutions and reparameterization. Compared to the traditional YOLOv7 architecture, the number of model parameters is reduced by 78%, image processing speed is three times faster, and performance is also significantly improved. The smaller model parameter size also facilitates deployment on mobile platforms.
[0087] The YoloHead module, which is the detection head, predicts the location of the target (bounding boxes) and performs bounding box selection based on the extracted features;
[0088] The reparameterized convolution module is configured to perform reparameterized convolutions.
[0089] In this embodiment, the Head end borrows from the RepVGG structure and introduces a reparameterized convolution method. By using the idea of reparameterization, redundant parameters are reduced while maintaining the model depth.
[0090] Furthermore, it also includes a method for training the YOLOv7 algorithm model, comprising the following steps:
[0091] Step S1: Obtain historical images of the road surface, label them to obtain label files, and construct a dataset;
[0092] This step involves preparing the dataset. The Labelimg software can be used to manually annotate the road surface damage images and obtain label files with damage location information.
[0093] Step S2: Preprocess the data in the dataset;
[0094] Specifically, before inputting the dataset into the YOLOv7 algorithm model, it can be uniformly and adaptively scaled to 640×640. Mosaic and MixUp data augmentation can be performed by flipping, symmetry, scaling, twisting the length and width, randomly adjusting brightness and contrast, cropping and stitching, and sample mixing. At the same time, adaptive initial anchor box calculation is performed on the label file based on the Kmeans++ clustering algorithm.
[0095] Step S3: Dataset splitting. The training set and test set are split in a 9:1 ratio, with 10% of the data in the dataset used for validation during the training process.
[0096] Step S4: Using the image data in the training set as input and the corresponding labels as output, train the YOLOV7 algorithm model described above in this embodiment. Based on the network weights trained in ImageNet-1K, perform transfer learning. After iterative training, obtain the optimal model parameters and the trained YOLOV7 algorithm model.
[0097] Step S5: Verify the performance of the YOLOv7 algorithm model using the partitioned test set. Iterate the above training process until the performance requirements are met, and obtain the trained YOLOv7 algorithm model.
[0098] The trained YOLOv7 algorithm model is deployed to a local platform to identify road surface images collected locally, thus obtaining information on road surface defects.
[0099] Deep learning relies on large datasets, but data acquisition and annotation are costly in road surface defect detection, making it difficult to build custom datasets. Therefore, this embodiment employs transfer learning, training the network based on ImageNet-1K network weights, and using the public dataset RDD2022_China_MotorBike for model training and validation. This dataset, collected from real-world motor vehicle data, has a complex background, reflecting actual engineering conditions. Labelimg software was used for defect annotation. The dataset contains 1978 images, including 4456 road surface defects of different sizes, including 2402 longitudinal cracks, 1008 transverse cracks, 579 network cracks, 209 potholes, and 258 repairs.
[0100] In step S4, Focal-EIoU Loss is introduced to replace CIoU Loss in the traditional YOLOv7 algorithm. This accelerates the convergence speed, better balances the imbalance of samples, and improves the accuracy of the regression results.
[0101] Effective crossover ratio loss L EIOU The specific calculation formula is as follows:
[0102]
[0103] In the formula: b, w, and h are the center point, width, and height of the predicted bounding box for the image target, respectively, and h gt ,w gt ,b gt These represent the center point, width, and height of the actual bounding box of the image target, respectively, ρ 2 (b,b gt ),ρ 2 (w,w gt ),ρ 2 (h,h gt ) represent the Euclidean distances between the center point, width, and height of the predicted bounding box and the actual bounding box, respectively, where c, c w ,c h These are the minimum closure diagonal distance, width, and height that simultaneously contain both the predicted bounding box and the actual bounding box;
[0104] Dynamically scaled cross-entropy loss LFocal The specific calculation formula is as follows:
[0105] L Focal =-α t (1-p t ) γ ln(p t )
[0106] In the formula: α t γ is the adjustment coefficient, p t To predict the probability magnitude.
[0107] Focal-EIoU Loss is obtained by integrating EIoU Loss and Focal Loss. It is based on the calculation form of dynamically scaled cross-entropy loss (Focal Loss) and uses the effective cross-union ratio loss (EIoU Loss) as the adjustment coefficient α. t Combining this with dynamically scaled cross-entropy loss (Focal Loss), we obtain the formula for calculating the Focal-EIoU Loss function, as follows:
[0108] L Focal_EIOU =-(1-IoU) γ ln(Iou)L EIoU
[0109] In the formula: IOU=|A∩B| / |A∪B|, γ is the adjustment coefficient.
[0110] A represents the model's predicted result, and B represents the actual result.
[0111] In step S5, the performance of the YOLOv7 algorithm model is evaluated. Specifically, the evaluation metrics can include multiple metrics such as precision, recall, F1 score, average precision (mAP), and frames per second (FPS) to verify the performance of the YOLOv7 algorithm model.
[0112] Accuracy is the ratio of the number of correctly detected targets to the total number of targets in all detected results, as shown in the following formula:
[0113]
[0114] In the formula: TP represents True Positive, which is the number of targets correctly detected; FP represents False Positive, which is the number of targets incorrectly detected.
[0115] Recall: Recall is the ratio of the number of correct targets detected to the total number of true targets. The formula is as follows:
[0116]
[0117] In the formula: FN represents false negatives, i.e., the number of targets that were not correctly detected. F1 Score: The F1 score is the harmonic mean of precision and recall, and the formula is as follows:
[0118]
[0119] Average Precision (mAP): Average precision is a crucial performance indicator for object detection algorithms. It provides a comprehensive evaluation of accuracy and is typically calculated using the Pascal VOC evaluation method. The Pascal VOC method calculates the average precision for each class as the average AP value across different thresholds, where the AP value is obtained by calculating the area under the precision-recall curve. The formula is as follows:
[0120]
[0121] Frames Per Second (FPS): Frames per second is an important metric for measuring the detection speed in object detection algorithms. It is typically defined as the number of images detected per second. The higher the FPS threshold, the faster the detection speed. The formula is as follows:
[0122]
[0123]
[0124] In the formula: Tack_time represents the detection time, Test_size represents the number of images processed, and Time represents the total time required to process Test_size images.
[0125] Example 2
[0126] Based on Example 1, this example provides a rapid pavement distress detection system based on the YOLOv7 algorithm, including:
[0127] Preprocessing module: configured to acquire the road surface image to be identified and perform preprocessing;
[0128] Backbone feature extraction network: It is configured to perform dimensionality compression on the preprocessed image, use depthwise separable convolution for multi-layer feature extraction, and perform pooling feature extraction on the top layer image with different receptive fields and stack them.
[0129] Enhanced feature extraction network: It is configured to perform coordinate attention operation on the output features of each layer, and then fuse top-down upsampling and bottom-up downsampling to perform multi-scale feature fusion of the features of each layer to obtain the feature map after feature enhancement.
[0130] Output network: It is configured to perform object detection and reparameterized convolution operations on the feature maps after feature enhancement, and obtain the identification results of road surface defects after classification.
[0131] It should be noted that the modules in this embodiment correspond to the steps in embodiment 1, and each network module corresponds to the construction of the YOLOv7 algorithm model. Their specific implementation processes are the same and will not be repeated here.
[0132] The above description is merely a preferred embodiment of this disclosure and is not intended to limit this disclosure. Various modifications and variations can be made to this disclosure by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
[0133] While the specific embodiments of this disclosure have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of this disclosure. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of this disclosure are still within the scope of protection of this disclosure.
Claims
1. A rapid detection method for pavement defects based on the YOLOv7 algorithm, characterized in that, Includes the following steps: Acquire images of the road surface to be identified and perform preprocessing; The preprocessed image is compressed to higher dimensions, and multi-layer feature extraction is performed using depthwise separable convolution. Pooling features with different receptive fields are extracted from the top layer image and then stacked. After performing coordinate attention operations on the output features of each layer, the top-down upsampling and bottom-up downsampling are fused together to perform multi-scale feature fusion on the features of each layer, resulting in a feature map with enhanced features. The enhanced feature map is subjected to parametric convolution and target detection, and the classification results are obtained to identify road surface defects. It also includes building the YOLOv7 algorithm model, including: a backbone feature extraction network, an enhanced feature extraction network, and an output network; The backbone feature extraction network consists of multiple cascaded Mobile One Block modules, with the last Mobile One Block module connected to the SPPCSCP module. The Mobile One Block module performs depthwise convolution and pointwise convolution sequentially. After depthwise convolution, batch normalization and activation operations are performed. After pointwise convolution, batch normalization and activation operations are performed again to achieve image upscaling and compression. To enhance the feature extraction network, a feature enhancement branch is set for the effective output layer of the backbone feature extraction network. Each branch includes a GSConv convolutional module, a channel stacking module, and a MultiConcat Block module connected in sequence. Sampling between branches is performed through FPN and PAN structures. The MultiConcat Block module includes multiple branches of GSConv convolutional modules, and each branch of GSConv convolutional modules is cascaded with one or more GSConv convolutional modules to form a stacked structure of GSConv convolutional modules.
2. The method for rapid detection of pavement defects based on the YOLOv7 algorithm as described in claim 1, characterized in that: The backbone feature extraction network is used to perform dimensionality compression on the preprocessed image. It uses depthwise separable convolution to extract features in multiple layers and performs pooling feature extraction on the top layer image with different receptive fields and stacks them. The enhanced feature extraction network is configured to perform coordinate attention operations on the output features of each layer, then fuse top-down upsampling and bottom-up downsampling to perform multi-scale feature fusion of the features of each layer, resulting in a feature map with enhanced features. The output network is configured to perform reparameterized convolution operations on the feature maps after feature enhancement, and the classification results are used to obtain the identification results of road surface defects.
3. The method for rapid detection of pavement defects based on the YOLOv7 algorithm as described in claim 1, characterized in that: The SPPCSCP module has two branches. The first branch performs three standard convolutions on the input, followed by max pooling with a set kernel size. The max pooling result is then stacked with the result after the three standard convolutions, and then a standard convolution is performed again. The second branch performs a standard convolution on the input; then the results from the two branches are stacked by channels and then subjected to a standard convolution again. The standard convolution operation is a concatenation of convolution, batch normalization, and activation function activation.
4. The method for rapid detection of pavement defects based on the YOLOv7 algorithm as described in claim 1, characterized in that, The convolution process of the GSConv convolution module includes: performing a normal convolution operation on the input image, then performing a depthwise convolution operation, stacking the output feature map after the depthwise convolution operation with the feature map after the normal convolution operation through channels, and finally performing a shuffle operation to output the feature map.
5. The method for rapid detection of pavement defects based on the YOLOv7 algorithm as described in claim 1, characterized in that: The output network consists of a YoloHead module and a reparameterized convolution module connected in sequence; The YoloHead module is a detection head that predicts the location of the target and performs bounding selection based on the extracted features. The reparameterized convolution module is configured to perform reparameterized convolutions.
6. The method for rapid detection of pavement defects based on the YOLOv7 algorithm as described in claim 1, characterized in that: Coordinate attention operations include average pooling on two coordinates of the input image, channel stacking and convolution, batch normalization and non-linear activation, convolution and activation to obtain the output image.
7. The method for rapid detection of pavement defects based on the YOLOv7 algorithm as described in claim 1, characterized in that: It also includes methods for training YOLOv7 algorithm models, including the following steps: Obtain historical images of road surfaces, label them to obtain tag files, and construct a dataset; Preprocess the data in the dataset; The dataset is divided into training and testing sets according to a set ratio; The YOLOv7 algorithm model is trained by taking the image data in the training set as input and the corresponding labels as output. The network weights trained on ImageNet-1K are used for transfer learning. After iterative training, the optimal model parameters are obtained, and the trained YOLOv7 algorithm model is obtained. The performance of the YOLOv7 algorithm model is verified using a partitioned test set. The above training process is iterated until the performance requirements are met, and a trained YOLOv7 algorithm model is obtained.
8. The method for rapid detection of pavement defects based on the YOLOv7 algorithm as described in claim 7, characterized in that, The loss function used in training integrates the effective cross-union ratio loss and the dynamically scaled cross-entropy loss to obtain the loss function. Specifically, it is based on the calculation form of the dynamically scaled cross-entropy loss, and the effective cross-union ratio loss is used as a adjustment coefficient to combine with the dynamically scaled cross-entropy loss to obtain the loss function calculation formula. Evaluation metrics for validating the performance of the YOLOv7 algorithm model include: accuracy, recall, F1 score, average precision, and frames per second.
9. A rapid pavement distress detection system based on the YOLOv7 algorithm, characterized in that, include: Preprocessing module: configured to acquire the road surface image to be identified and perform preprocessing; Backbone feature extraction network: It is configured to perform dimensionality compression on the preprocessed image, use depthwise separable convolution for multi-layer feature extraction, and perform pooling feature extraction on the top layer image with different receptive fields and stack them. Enhanced feature extraction network: It is configured to perform coordinate attention operation on the output features of each layer, and then fuse top-down upsampling and bottom-up downsampling to perform multi-scale feature fusion of the features of each layer to obtain the feature map after feature enhancement. Output network: The feature map is configured to perform target detection and reparameterized convolution operations, and the classification results are used to obtain the identification results of road surface defects; It also includes building the YOLOv7 algorithm model, including: a backbone feature extraction network, an enhanced feature extraction network, and an output network; The backbone feature extraction network consists of multiple cascaded Mobile One Block modules, with the last Mobile One Block module connected to the SPPCSCP module. The Mobile One Block module performs depthwise convolution and pointwise convolution sequentially. After depthwise convolution, batch normalization and activation operations are performed. After pointwise convolution, batch normalization and activation operations are performed again to achieve image upscaling and compression. To enhance the feature extraction network, a feature enhancement branch is set for the effective output layer of the backbone feature extraction network. Each branch includes a GSConv convolutional module, a channel stacking module, and a MultiConcat Block module connected in sequence. Sampling between branches is performed through FPN and PAN structures. The MultiConcat Block module includes multiple branches of GSConv convolutional modules, and each branch of GSConv convolutional modules is cascaded with one or more GSConv convolutional modules to form a stacked structure of GSConv convolutional modules.