A road crack detection system and working method based on YOLOv5s
Through the YOLOv5s-based pavement crack detection system, using improved detection algorithms and attention mechanisms, automated and high-precision pavement crack detection is achieved, solving the problems of low efficiency, high cost and poor safety in the existing technology.
Patent Information
- Application Number
- CN202411860999.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-04-04
AI Technical Summary
The existing road crack detection system relies on manual inspection, is inefficient and cost-effective, and traditional cameras are installed on cars, and limited viewing angles may miss fine cracks, and inspectors are facing potential dangers.
The road surface crack detection system based on YOLOv5s is adopted, including image input module, crack selection module, report output module, data storage module and parameter setting module. Through the improved YOLOv5s detection algorithm, K-Means++ clustering algorithm, SENet attention mechanism, Canny algorithm and WIoU loss function, a pavement crack detection model is established to achieve automated detection and precise identification.
It improves the speed and accuracy of road crack detection, reduces the dependence of manual detection, reduces the detection cost, enhances the safety of inspectors, and can easily monitor road cracks.
Smart Images

Figure CN119762460A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of crack detection, and in particular to a road crack detection system and a working method based on YOLOv5s. Background Art
[0002] With the improvement of living standards, more and more families have purchased motor vehicles. On the one hand, the increasing number of motor vehicles has brought convenience to people's lives. On the other hand, a large number of motor vehicles has also led to a large-scale increase in traffic congestion rates year by year, which has brought huge pressure on road infrastructure, making road maintenance and maintenance work extremely large and more difficult. Transportation infrastructure plays a vital role in various social fields. It plays a vital role in ensuring the efficiency of transportation services and maximizing economic development. At the same time, natural disasters, strong light, rainfall, earthquakes, natural weathering and frequent use will bring huge impacts and challenges to roads. With the improvement of the utilization rate of transportation infrastructure, pavement cracks will have a significant adverse impact on the safety of people and vehicles on the road. The detection and repair of pavement cracks have received more and more attention, which is directly related to the safety of pedestrians and the business safety related to transportation infrastructure.
[0003] In recent years, drone technology has been widely used in many fields such as reconnaissance, agriculture and forestry, and disaster relief due to its many advantages such as speed, accuracy, and safety. Through drone technology, road cracks can be discovered and located more quickly, thereby more effectively ensuring people's safety and the reliability of the transportation system. This expanded application not only promotes the advancement of road monitoring technology, but also makes positive contributions to improving the management level of the overall transportation infrastructure. The existing road crack system has the following problems: 1. Traditionally, road crack inspections are usually done manually. Manual inspections of roads and determination of damaged areas are completely dependent on the experience of inspectors, which not only consumes a lot of human resources, but also has disadvantages such as low efficiency and high cost. 2. Installing cameras directly on the car for data collection may miss some minor cracks due to the limited viewing angle, and there may be potential danger when inspectors are in contact with high-speed vehicles for a long time. Summary of the invention
[0004] The object of the present invention is to solve at least one of the technical drawbacks.
[0005] To this end, an object of the present invention is to propose a pavement crack detection system and working method based on YOLOv5s to solve the problems mentioned in the background technology and overcome the shortcomings of the prior art.
[0006] In order to achieve the above-mentioned purpose, an embodiment of one aspect of the present invention provides a road crack detection system based on YOLOv5s, including an image input module, a crack selection module, a report output module, a data storage module and a parameter setting module. The image input module is used to select different types of local files for input, the crack selection module automatically aligns the imported road cracks, and performs type selection detection on the imported images. The system selects one of the crack types for detection according to different detection type requirements. The report output module is used to export the detection results. The data storage module facilitates saving the detected pictures or videos to a specified folder. The parameter setting module can adjust relevant parameters to filter the detection results.
[0007] Another aspect of the present invention provides a working method of a road crack detection system based on YOLOv5s, comprising the following steps: A. Establish a pavement crack detection model through the improved YOLOv5s detection algorithm; B. Use K-Means++ clustering algorithm to adjust the prior frame to improve the accuracy of the model; C. Introduce SENet attention mechanism and establish feature extraction model; D. Establish a form recognition model through the Canny algorithm; E. Introduce the WIoU loss function to replace the CIoU loss function and establish a loss function model.
[0008] Preferably, any of the above schemes further comprises the following steps: 1) Upload the file and then perform the test. 2) Modify the backbone network of the YOLOv5s network, which is dedicated to the detection of road cracks, 3) Train multiple times, select the best model weight, and save the detection model and weight. 4) Obtain the road crack images in the local file from the front end, put them into the saved model for prediction, and return the predicted result images to the front end through the back end, and present the photos before and after the detection on the web page. 5) Some vision-guided robot picking systems are deployed on edge devices with limited computing resources, effectively controlling the model parameters, computing power, memory access, etc. of target detection at the edge with limited computing resources, and performing lightweight design on the model.
[0009] Preferably, any of the above schemes comprises the lightweight design of the model including knowledge distillation, weight quantization, compression model of pruning operations and direct training of lightweight network models, and a lightweight network is designed through deep separable convolution for detecting pavement cracks.
[0010] Preferably, any of the above schemes comprises modifying the anchor box size of YOLOv5s, re-adjusting and optimizing the anchor box by using the K-Means++ clustering algorithm, using 3 anchor boxes for small scale, medium scale and large scale respectively, and selecting the clustering number k as 9 for a total of 9 groups of anchor box data. After several rounds of iterations, a new prior anchor box size can be obtained, and finally normalization processing is performed.
[0011] Preferably, any of the above schemes comprises modifying the anchor generation mechanism in the YOLOv5s network structure, and the main steps of the modification are as follows: 1. Count the frequency of the area and aspect ratio of the real annotation box; 2. The aspect ratio selects the interval value with the highest frequency, and the pavement crack area selects the middle and upper quantiles and is selected according to the input ratio. The two values are used as the main basis of the anchor mechanism; 3. Finally, four combinations of anchor sizes with aspect ratios of 1:1.2 and 1:1.6 and areas of 256 and 512 are determined.
[0012] Preferably, any of the above schemes introduces an attention mechanism into YOLOv5s in establishing the feature extraction model, and further introduces a SENet attention mechanism in establishing the feature extraction model, which reduces the dimension of input data while maintaining important information by adaptively learning and adjusting the weights of feature channels. The main operation process of the SENet attention mechanism is: First, a squeeze operation is performed, and a global average pooling operation is performed on the feature map after the convolution operation to obtain the global compressed feature value of the current feature map; Secondly, the excitation operation is performed to calculate the weights of different channels and the relationship between channels; The feature map with superimposed weights is then used as the input of the next layer.
[0013] Preferably, any of the above schemes is that the form recognition model is established to extract pavement crack edge information through the Canny algorithm, the Canny finds an optimal edge detection algorithm and the meaning of optimal edge detection, the optimal edge detection algorithm can identify as many actual edges in the image as possible, the optimal edge detection includes an optimal positioning criterion and a one-to-one correspondence between the detection point and the edge point, the position of the edge point detected by the optimal positioning criterion is closest to the position of the actual edge point, or the degree to which the detected edge deviates from the true edge of the object due to noise is minimized.
[0014] Preferably, any of the above schemes adopts IoU-Loss as a loss function in the establishment of the loss function model, and the loss function model also introduces a minimum bounding box. The loss function model adds the evaluation indicators of the center point distance between the predicted bounding box and the actual bounding box and the diagonal distance of the minimum rectangular box on the basis of GIoU. The YOLOv5s model adopts CIoU (Complete-IoU) as the loss function, considers the consistency of the aspect ratio between the predicted value and the true value bounding box on the basis of DIoU, and adds a penalty term for the aspect ratio. The establishment of the loss function model proposes a dynamic non-monotonic focusing mechanism, replaces IoU with "outliers" to evaluate the quality of the anchor box, and adopts a gradient gain allocation strategy to evaluate the quality of the anchor box by replacing IoU, focusing on the quality difference of the anchor box. On this basis, WIoUv1 with a two-layer attention mechanism is obtained, the first layer is the distance attention function, and the second layer amplifies the cross-linking of the ordinary quality anchor box and reduces the cross-linking of the high-quality anchor box; WIoUv1 is defined as shown in Formulas 2.1 and 2.2; (2.1) (2.2) in, and are the width and height of the minimum bounding rectangle of the predicted box and the real box, respectively. is the minimum diagonal length of the bounding box, represents the separation operation, making it a constant without gradient. Then the outlier degree is used to describe the quality of the anchor box: (2.3) in, is a sliding average.
[0015] The preferred solution is to use WIoUv3 to reduce the competitiveness of high-quality anchor frames, reduce the harmful gradients generated by low-quality anchor frames, and focus on optimizing low-quality anchor frames, thereby improving the performance of the overall detector; WIoUv3 uses outlier Construct a non-monotonic focusing coefficient and obtain the bounding box loss WIoUv3 calculation as shown in Equations 2.4 and 2.5: (2.4) , (2.5).
[0016] in, WIoUv3 is the bounding box loss. WIoUv3 is used in YOLOv5s, and the CIoU loss function is replaced by the WIoUv3 loss function.
[0017] Compared with the prior art, the present invention has the following advantages and beneficial effects: 1. The road crack detection system and working method based on YOLOv5s constructs a road crack dataset for a specific scenario and divides it into 4 categories of road cracks, which makes the detection of road cracks faster.
[0018] 2. This YOLOv5s-based pavement crack detection system and working method uses the K-Means++ clustering algorithm to adjust and re-cluster its prior frame to address the low-precision problem of pavement cracks caused by environmental factors, realizes accurate clustering analysis of the data set, and embeds the SE attention module into the neck network layer of the YOLOv5s network model to reduce the missed detection rate and improve the overall detection performance.
[0019] 3. The road crack detection system and working method based on YOLOv5s combines road crack detection with drones, improves the YOLOv5s target detection network, and improves form recognition, achieving low-cost equipment and high-precision detection.
[0020] 4. The pavement crack detection system and working method based on YOLOv5s introduces the WIoU loss function to replace the CIoU loss function, accelerates the convergence speed of the model, and further improves the accuracy and speed of the network for multi-scale and multi-category pavement crack detection. It not only improves the accuracy of model detection, but also makes it easier for staff to monitor pavement cracks. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a schematic diagram of the overall structure of the system of the present invention; Figure 2 is a flow chart of the method of the present invention; Figure 3 This is the WIoU principle diagram of the present invention. DETAILED DESCRIPTION
[0022] The present invention is further described below in conjunction with the accompanying drawings, but the protection scope of the present invention is not limited to the following description.
[0023] Embodiment 1: Figure 1As shown, a road crack detection system based on YOLOv5s includes an image input module, a crack selection module, a report output module, a data storage module and a parameter setting module. The image input module is used to select different types of local files for input. The crack selection module automatically aligns the imported road cracks and performs type selection detection on the imported images. The system selects one of the crack types for detection according to different detection type requirements. The report output module is used to export the detection results. The data storage module is convenient for saving the detected pictures or videos to a specified folder. The parameter setting module can adjust relevant parameters to screen the detection results.
[0024] like Figure 2 As shown, a working method of a road crack detection system based on YOLOv5s includes the following steps: A. Establish a pavement crack detection model through the improved YOLOv5s detection algorithm; It is necessary to upload the file, then perform the detection, and finally complete the detection. The backbone network of the YOLOv5s network is modified, and the network is dedicated to the detection of road cracks. After multiple trainings, the best model weights are selected, and the detection model and weights are saved. The road crack picture in the local file is obtained from the front end, and the saved model is put into the prediction. The predicted result picture is returned to the front end through the back end, and the photos before and after the detection are presented on the web page. Some vision-guided robot picking systems are deployed on edge devices with limited computing resources. It is crucial to effectively control the model parameter amount, calculation amount, memory access amount, etc. of target detection at the edge end with limited computing resources. In order to improve the speed and accuracy of the model and reduce the number of model parameters, this design studies the lightweight of the model. The lightweight network mainly includes knowledge distillation, weight quantization, compression model of pruning operation, and direct training of lightweight network model. The present invention directly designs a lightweight network for road crack detection through deep separable convolution. In order to further improve the speed of the model, the anchor box size of YOLOv5s is modified, and the K-Means++ clustering algorithm is used to readjust and optimize the anchor box; the principle of the K-means++ clustering algorithm is as follows: first randomly select a sample point from the data set as the first initialized cluster center. Assume Indicates that The pavement disease dataset is a dataset of samples, of which The anchor box position of each sample is By calculating the anchor box position of each sample in the dataset With the initial cluster center The Euclidean distance between To determine the possibility of each pixel becoming the next cluster centroid. Calculated according to the formula.
[0025] (3.1) The probability Pi of a sample being selected as the next cluster center is calculated. The larger the value Pi is, the farther the sample is from the cluster center, and the more likely it is to be distinguished from other samples. In this case, the sample anchor box with a larger value is selected as the next cluster center. The expression of probability Pi is shown in the formula.
[0026] (3.2) Repeat the above calculation steps until a total of 9 cluster centers are selected. For each sample in the data set, calculate the distance from the sample to the 9 cluster centers, and then assign it to the class corresponding to the cluster center with the smallest distance, and update the cluster center until the center position of the cluster no longer changes. Generate 9 anchor boxes for 3 feature maps of different sizes, and assign them to 3 different feature map sizes according to their sizes, and finally get a new prior anchor box scale.
[0027] Three anchor frames are used for small scale, medium scale and large scale respectively, with a total of 9 groups of anchor frame data, so the number of clusters k is selected as 9. After several rounds of iterations, a new prior anchor frame size can be obtained (as shown in Table 1), and then normalized. The anchor generation mechanism in the YOLOv5s network structure is modified. The main steps of the modification are as follows: 1. The frequency of the area and aspect ratio of the real annotation box is counted; 2. The aspect ratio selects the interval value with the highest frequency, and the pavement crack area selects the middle and upper quantiles and is selected according to the input ratio. The values of the two are used as the main basis of the anchor mechanism; 3. Finally, the four combinations of anchor sizes with aspect ratios of 1:1.2 and 1:1.6 and areas of 256 and 512 are determined.
[0028] Table 1 Anchor box information FeatureMap AnchorBoxSize 28×28 (27×20);(44×61);(45×152) 14×14 (83×360);(109×100);(118×26) 7×7 (185×180);(290×59);(398×202) B. Use K-Means++ clustering algorithm to adjust the prior frame to improve the accuracy of the model; C. Introduce SENet attention mechanism and establish feature extraction model; When performing convolution calculations, the YOLOv5s algorithm may lose target information due to the small size of the detected target. In the images taken by drones, when the area and pixel ratio of the detected target are small, the network model's detection of small targets is easily affected by factors such as the complex background of high-altitude shooting and flight altitude, resulting in missed detection and false detection. To solve this problem, the attention mechanism is introduced into YOLOv5s by drawing on the way humans observe the outside world. In the field of deep learning, the attention mechanism enables the model to focus more on the important parts of the target during training, while ignoring information irrelevant to the target, thereby improving the accuracy of target detection. By imitating the human visual attention mechanism, this technology enables the network to process small targets more specifically, thereby alleviating detection problems caused by factors such as complex backgrounds.
[0029] Hu et al. proposed SENet (Squeeze-and Excitation Network), which is a typical channel attention mechanism, mainly composed of compression modules and excitation modules. It is usually used to help the model focus on the most relevant information of the current task when processing data, rather than treating all inputs uniformly. In addition, it can also help the model understand and learn the input data more effectively, and improve the detection accuracy of the model. SENet pays more attention to the differences between each channel in the feature map, and adjusts the weight of attention according to these differences, thereby enhancing the attention to important features. In convolutional neural networks, feature maps can be shared throughout the network, so all input information needs to be considered, but this can easily lead to problems such as increased network computation and overfitting. To solve these problems, the SENet attention mechanism is introduced. By adaptively learning to adjust the weights of feature channels, the dimension of input data is reduced while maintaining important information, thereby improving the generalization performance of the model.
[0030] SENet's squeezing operation compresses the channel dimension of the input feature map into a global descriptor, and the excitation operation generates a channel-specific weight vector based on the squeezing result, which is mainly used to regulate the importance of each channel. The main operation process of SENet is: first perform the squeezing operation, perform the global average pooling operation on the feature map after the convolution operation, and obtain the global compressed feature quantity of the current feature map. Secondly, perform the excitation operation to calculate the weights of different channels and the relationship between channels. Finally, the feature map with superimposed weights is used as the input of the next layer D. Establish a form recognition model through the Canny algorithm; This paper uses the Canny algorithm to extract the edge information of pavement cracks. The goal of Canny is to find an optimal edge detection algorithm. The meaning of optimal edge detection is as follows: 1. Optimal detection: The algorithm can identify as many actual edges in the image as possible, and the probability of missing the real edge and the probability of misdetecting non-edges are as small as possible. 2. Optimal positioning criterion: The position of the detected edge point is closest to the position of the actual edge point, or the degree to which the detected edge deviates from the real edge of the object due to noise is minimized. 3. One-to-one correspondence between detection points and edge points: The edge points detected by the operator should correspond one-to-one to the actual edge points.
[0031] E. Introduce the WIoU loss function to replace the CIoU loss function and establish a loss function model; As a loss function, IoU-Loss is usually used to measure the similarity between the predicted bounding box and the actual bounding box, focusing on the overlap between the predicted result and the actual situation. As the most commonly used bounding box similarity measurement method, IoU is widely used in target detection tasks. In pavement crack detection, the use of IoU may result in the predicted bounding box not intersecting with the actual situation. In this case, IoU is zero, resulting in ineffective optimization. To solve this problem, GIoU (Generalized Intersection over Union) introduces the minimum bounding box to solve the problem that the predicted bounding box does not intersect with the actual bounding box. DIoU (Distance-IoU) adds the evaluation indicators of the center point distance between the predicted bounding box and the actual bounding box and the diagonal distance of the minimum rectangular box on the basis of GIoU. When the center points of the two bounding boxes are the same but the aspect ratios are different, the DIoU indicator degenerates to IoU. The YOLOv5s model uses CIoU (Complete-IoU) as the loss function. On the basis of DIoU, it considers the consistency of the aspect ratio between the predicted and true bounding boxes and adds a penalty term for the aspect ratio. CIoU is relatively complex in the calculation process, requires a lot of computing power, and consumes training time. WIoU (Wise-IoU) proposes a dynamic non-monotonic focusing mechanism. It uses "outliers" instead of IoU to evaluate the quality of anchor boxes, and adopts a gradient gain allocation strategy. By replacing IoU to evaluate the quality of anchor boxes, it focuses on the quality differences of anchor boxes. There are three versions of WIoU. WIoUv1 reduces the geometric penalty and improves the generalization ability of the model with minimal training intervention when the anchor box matches the target box well. A good loss function is needed to weaken the penalty of geometric factors, so that the model can obtain better generalization ability. On this basis, WIoUv1 with a two-layer attention mechanism is obtained. The first layer is the distance attention function, and the second layer amplifies the cross-linking of ordinary quality anchor boxes and reduces the cross-linking of high-quality anchor boxes. The definition of WIoUv1 is shown in Equations 4.1 and 4.2.
[0032] (4.1) (4.2) in, and are the width and height of the minimum bounding rectangle of the predicted box and the real box, respectively. is the minimum diagonal length of the bounding box, represents the separation operation, making it a constant without gradient. Then the outlier degree is used to describe the quality of the anchor box: (4.3) in, is a sliding average.
[0033] This paper adopts WIoUv3 to reduce the competitiveness of high-quality anchor frames, reduce the harmful gradients generated by low-quality anchor frames, and focus on optimizing low-quality anchor frames, thereby improving the performance of the overall detector; WIoUv3 uses outlier Construct a non-monotonic focusing coefficient and obtain the bounding box loss WIoUv3 calculation as shown in Equations 4.4 and 4.5: (4.4) , (4.5).
[0034] in, WIoUv3 is the bounding box loss. WIoUv3 is used in YOLOv5s, and the CIoU loss function is replaced by the WIoUv3 loss function.
[0035] During the inspection, the first step is to determine the flying height of the drone to collect road images and enable the system to detect the input image files. The system then loads drone data, preprocesses data, selects damage types, outputs results, displays interfaces, generates inspection reports, and checks damage types and locations. Finally, the staff can use the inspection report to check the type and location of road damage. The pavement crack detection system based on deep learning uses the PyTorch1.8.1 deep learning framework, the OpenCV computer vision processing open source software library, and the PyQt5 interface framework, and is developed using the Python language to form a pavement crack detection system.
[0036] YOLOv5 (You Only Look Once version 5) is a single-stage detector released by Uitralytics LLC in June 2020. It can detect multiple targets in images or videos in real time. According to their width and depth, it is mainly divided into four models: YOLOv5s, YOLOv5m, YOLOv5l and YOLOv5x. The difference between them is mainly reflected in the model size, among which YOLOv5s is the smallest model and YOLOv5x is the largest model. Its main features are fast speed, high accuracy, and support for target detection on images of different sizes and resolutions. In terms of network architecture, a backbone network based on FPN (Feature Pyramid Network) is adopted, in which the CSP (Cross Stage Partial) module is used to improve the effect of feature maps. The SPP (SpatialPyramidPooling) module and the PAN (PathAggregationNetwork) module are used to better handle targets of different sizes. The Mosaic data enhancement method is also introduced to combine multiple different images into a large image to expand the data set and improve the generalization ability of the model. In addition, it also uses FocalLoss similar to RetinaNet to alleviate the problem of sample imbalance and further improve the accuracy of the model. This system uses the lightweight network ShuffleNetV2 as the backbone network. For different feature extraction networks, comparative experiments are conducted on its own data sets many times. It can be found that ShuffleNetV2 not only has a small number of parameters, but also has a faster detection speed. The detection part of YOLOv5s can be mainly divided into four modules: (1) Input: The YOLOv5s model uses Mosaic data enhancement at the input to effectively improve the target detection performance. Data enhancement techniques such as color transformation, random scaling, and random cropping are introduced to enhance the robustness of the dataset. In terms of anchor frame processing, operations such as Autoanchor and adaptive image scaling are used to enrich the dataset and calculate the optimal anchor frame value, thereby improving the target detection speed.
[0037] (2) Backbone network: The backbone network of YOLOv5s adopts the CSPDarkNet53 network structure, which mainly includes the Focus module, Conv module, C3 module and SPP module for feature extraction. These modules form a label set of the input image by learning the feature labels of the input image. The backbone network selected for this system is ShuffleNetV2. ShuffleNetV2 is constructed using a deep residual network, which can ensure that a deeper network can be trained without gradient disappearance. It is also a relatively lightweight network that can minimize the amount of computation and memory usage while ensuring high detection accuracy.
[0038] Focus module: The Focus layer is a special downsampling method in YOLOv5s. Its main purpose is to reduce the number of layers, parameters, FLOPS, CUDA memory, and increase forward and backward speeds while minimizing the impact on mAP. Its operation is similar to neighboring downsampling, converting the information on the wh plane to the channel dimension, and then extracting different features through 3*3 convolution. This method can reduce the information loss caused by downsampling.
[0039] (3) Neck network: It adopts FPN+PAN structure. FPN is used as the enhancement structure of the pyramid to transmit the semantic features of the high-level network through downsampling, while PAN focuses on positioning information and transmits the positioning features of the underlying network through upsampling. The semantic and positioning information are comprehensively used to improve the network performance.
[0040] (4) Output: The head part of YOLOv5s acts as a classifier and regressor, and is mainly responsible for judging whether the features passed down by the neck network contain the corresponding object. The detection head of YOLOv5s includes three output layers of different sizes, which are used to predict the position and category information of small targets, medium targets and large targets respectively, effectively integrating multi-scale information and improving the accuracy of target detection.
[0041] In summary, the road crack detection system and working method based on YOLOv5s constructs a road crack dataset for a specific scenario and divides it into 4 categories of road cracks. The detection speed of road cracks is faster. In view of the low precision problem of road cracks caused by environmental factors, the K-Means++ clustering algorithm is used to adjust and re-cluster the prior frame to achieve accurate clustering analysis of the data set. The SE attention module is embedded in the neck network layer of the YOLOv5s network model to reduce the missed detection rate and improve the overall detection performance; the road crack detection is combined with drones, the YOLOv5s target detection network is improved, and the form recognition is improved to achieve low equipment cost and high detection accuracy; the WIoU loss function is introduced to replace the CIoU loss function to accelerate the convergence speed of the model and further improve the accuracy and speed of the network for multi-scale and multi-category road crack detection. It not only improves the accuracy of model detection, but also facilitates the staff to monitor road cracks.
[0042] Although the embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and cannot be understood as limiting the present invention. Those skilled in the art may change, modify, replace and modify the above embodiments within the scope of the present invention without departing from the principles and purpose of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A road crack detection system based on YOLOv5s, characterized by: It includes an image input module, a crack selection module, a report output module, a data storage module and a parameter setting module. The image input module is used to select different types of local files for input. The crack selection module automatically aligns the imported pavement cracks and performs type selection detection on the imported images. The system selects one of the crack types for detection according to different detection type requirements. The report output module is used to export the detection results. The data storage module facilitates saving the detected pictures or videos to a specified folder. The parameter setting module can adjust relevant parameters to filter the detection results.
2. A working method of a road crack detection system based on YOLOv5s, characterized in that: The following steps are involved: A. Establish a pavement crack detection model using the YOLOv5s detection algorithm; B. Use K-Means++ clustering algorithm to adjust the prior frame to improve the accuracy of the model; C. Introduce SENet attention mechanism and establish feature extraction model; D. Establish a form recognition model through the Canny algorithm; E. Introduce the WIoU loss function to replace the CIoU loss function and establish a loss function model.
3. The working method of a road crack detection system based on YOLOv5s according to claim 2, characterized in that: The step A also includes the following steps: 1) Upload the file and then perform the test. 2) Modify the backbone network of the YOLOv5s network, which is dedicated to the detection of road cracks, 3) Train multiple times, select the best model weight, and save the detection model and weight. 4) Obtain the road crack images in the local file from the front end, put them into the saved model for prediction, and return the predicted result images to the front end through the back end, and present the photos before and after the detection on the web page. 5) Some vision-guided robot picking systems are deployed on edge devices with limited computing resources, effectively controlling the model parameters, computing power, memory access, etc. of target detection at the edge with limited computing resources, and performing lightweight design on the model.
4. The working method of a road crack detection system based on YOLOv5s according to claim 3 is characterized in that: The lightweight design of the model includes knowledge distillation, weight quantization, a compression model of pruning operations, and direct training of a lightweight network model. A lightweight network is designed through deep separable convolution for the detection of road cracks.
5. The working method of a road crack detection system based on YOLOv5s according to claim 4 is characterized in that: The modification of YOLOv5s includes modifying the anchor box size of YOLOv5s, using the K-Means++ clustering algorithm to readjust and optimize the anchor box, using 3 anchor boxes for small scale, medium scale and large scale respectively, and a total of 9 groups of anchor box data, and selecting the number of clustering clusters k as 9. After several rounds of iterations, a new prior anchor box size can be obtained, and finally normalization is performed.
6. The working method of a road crack detection system based on YOLOv5s according to claim 5, characterized in that: The modification of YOLOv5s includes modifying the anchor generation mechanism in the YOLOv5s network structure. The main steps of the modification are as follows:
1. Count the frequency of the area and aspect ratio of the real annotation box; 2. The aspect ratio selects the interval value with the highest frequency, and the pavement crack area selects the middle and upper quantiles and is selected according to the input ratio. The two values are used as the main basis of the anchor mechanism; 3. Finally, four combinations of anchor sizes with aspect ratios of 1:1.2 and 1:1.6 and areas of 256 and 512 are determined.
7. The working method of a road crack detection system based on YOLOv5s according to claim 2, characterized in that: The feature extraction model is established by introducing an attention mechanism in YOLOv5s. The feature extraction model is also established by introducing a SENet attention mechanism, which adaptively learns and adjusts the weights of feature channels to reduce the dimension of input data while maintaining important information. The main operation process of the SENet attention mechanism is: First, a squeeze operation is performed, and a global average pooling operation is performed on the feature map after the convolution operation to obtain the global compressed feature value of the current feature map; Secondly, the excitation operation is performed to calculate the weights of different channels and the relationship between channels; The feature map with superimposed weights is then used as the input of the next layer.
8. The working method of a road crack detection system based on YOLOv5s according to claim 2, characterized in that: The form recognition model is established by using the Canny algorithm to extract the edge information of pavement cracks. The Canny algorithm finds an optimal edge detection algorithm and the meaning of optimal edge detection. The optimal edge detection algorithm can identify as many actual edges in the image as possible. The optimal edge detection includes an optimal positioning criterion and a one-to-one correspondence between the detection point and the edge point. The position of the edge point detected by the optimal positioning criterion is closest to the position of the actual edge point, or the degree to which the detected edge deviates from the real edge of the object due to noise is minimized.
9. The working method of a road crack detection system based on YOLOv5s according to claim 2, characterized in that: The establishment of the loss function model adopts IoU-Loss as a loss function. The loss function model also introduces the minimum bounding box. The loss function model adds the evaluation indicators of the center point distance between the predicted bounding box and the actual bounding box and the diagonal distance of the minimum rectangular box on the basis of GIoU. The YOLOv5s model adopts CIoU (Complete-IoU) as the loss function. On the basis of DIoU, the consistency of the aspect ratio between the predicted value and the true value bounding box is considered, and a penalty term is added for the aspect ratio. The establishment of the loss function model proposes a dynamic non-monotonic focusing mechanism, which uses "outliers" instead of IoU to evaluate the quality of the anchor frame, and adopts a gradient gain allocation strategy to evaluate the quality of the anchor frame by replacing IoU, focusing on the quality difference of the anchor frame. On this basis, WIoUv1 with a two-layer attention mechanism is obtained. The first layer is the distance attention function, and the second layer amplifies the cross-linking of the ordinary quality anchor frame and reduces the cross-linking of the high-quality anchor frame; WIoUv1 is defined as shown in Formulas 1.1 and 1.2; L_WIoUv1=R_WIoU L_IoU (1.1) R_WIoU=exp[(〖(x-x_gt)〗^2+〖(y-y_gt)〗^2) / 〖(W_g^2+H_g^2)〗^* ] (1.2) Among them, W_g and H_g are the width and height of the minimum bounding rectangle of the predicted box and the real box, respectively, W_g^2+H_g^2 is the length of the minimum diagonal of the bounding box, and * represents the separation operation, which makes it a constant without gradient. Then the outlier degree is used to describe the quality of the anchor box: β=(L_IoU^*) / (L_IoU ) ̅ ∈[0,+∞) (1.3) Among them, (L_IoU) ̅ is the sliding average.
10. The working method of a road crack detection system based on YOLOv5s according to claim 9, characterized in that: WIoUv3 is used to reduce the competitiveness of high-quality anchor boxes, reduce the harmful gradients generated by low-quality anchor boxes, and focus on optimizing low-quality anchor boxes, thereby improving the performance of the overall detector; WIoUv3 uses the outlier degree β to construct a non-monotonic focusing coefficient, and the bounding box loss WIoUv3 is calculated as shown in Equations 1.4 and 1.5: L_WIoUv3=〖rL〗_WIoUv1 (1.4) r=β / (δα^(β-δ) ), β=(L_IoU^*) / (L_IoU ) ̅ ∈[0,+∞) (1.5); Among them, L_WIoUv3 is the bounding box loss WIoUv3. WIoUv3 is used in YOLOv5s, and the WIoUv3 loss function is used instead of the CIoU loss function.
Citation Information
Cited By
Deep learning-based pavement crack detection and damage degree quantification method
CN120953164A