Road surface disease influence area automatic calculation method based on improved YOLOv8 algorithm
By improving the YOLOv8 algorithm and combining deformable convolution and instance segmentation techniques, the problems of low accuracy and efficiency in road surface defect detection have been solved, achieving efficient and accurate defect area calculation and supporting intelligent decision-making in road maintenance management.
Patent Information
- Application Number
- CN202510698735.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-10-21
AI Technical Summary
Existing methods for detecting road surface defects suffer from insufficient detection accuracy, large area calculation errors, and low efficiency in automated detection, making it difficult to meet the needs of road maintenance and management.
By employing an improved YOLOv8 algorithm, combined with deformable convolutional modules, feature pyramid networks, and cascaded instance segmentation units, efficient identification and automated area calculation of road surface defects are achieved through dataset preparation, model training, and instance segmentation.
It improves the accuracy and robustness of pavement defect identification, enables rapid and accurate calculation of defect impact area, and supports intelligent decision-making in road maintenance management.
Smart Images

Figure CN120823255A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of road engineering and pavement disease detection, and in particular to a method for automatically calculating the affected area of pavement diseases based on an improved YOLOv8 algorithm. Background Art
[0002] Asphalt pavements are widely used on highways and urban roads due to their durability and driving comfort. However, under the influence of factors such as long-term traffic loads, temperature fluctuations, material aging, and construction quality, asphalt pavements are prone to various defects such as potholes, rutting, cracks, and repairs. These defects not only affect driving safety and comfort but also accelerate structural damage, shortening the road's service life. Therefore, accurately and efficiently detecting pavement defects and quantifying their impact are crucial for road maintenance decision-making and optimizing repair resources.
[0003] Currently, pavement defect detection methods are primarily divided into two categories: manual inspection and automated inspection. Traditional manual inspection relies on visual observation by inspectors or the measurement of defect dimensions using simple tools. This is subject to significant subjectivity, low efficiency, and high cost. Furthermore, manual inspection often requires lane closures, disrupting normal traffic flow and making it difficult to achieve large-scale, high-frequency defect monitoring.
[0004] In recent years, with the advancement of computer vision and deep learning technologies, automated pavement defect detection methods based on image processing and object detection algorithms have gradually become a research hotspot. For example, traditional image processing methods (such as edge detection and threshold segmentation) or convolutional neural network (CNN)-based models (such as Faster R-CNN and the YOLO series of algorithms) are used to identify and classify pavement defects. However, existing methods still have the following limitations: 1) Insufficient detection accuracy: Complex road surface backgrounds (such as shadows, stains, and road marking interference) can easily lead to false or missed detections, affecting the accuracy of defect identification; 2) Poor robustness: The algorithms have limited adaptability to different lighting conditions, shooting angles, and changes in defect morphology; 3) Low automated detection efficiency and lack of quantification capabilities: Most methods only achieve the location and classification of defects, failing to accurately calculate the actual affected area, making it difficult to meet the needs of quantitative assessment of defect severity in maintenance management.
[0005] Therefore, there is an urgent need for a pavement disease detection and area calculation method with high accuracy, high efficiency and adaptability to complex road conditions to provide reliable data support for pavement maintenance. Summary of the Invention
[0006] The problem to be solved by the present invention is to provide a method for automatically calculating the affected area of pavement defects based on the improved YOLOv8 algorithm, which is used to solve the problems of insufficient pavement defect identification accuracy, large area calculation errors and low automated detection efficiency in the prior art.
[0007] The present invention adopts the following technical solution: a method for automatically calculating the affected area of pavement damage based on an improved YOLOv8 algorithm, comprising the following steps:
[0008] Step 1: Dataset preparation: Collect and preprocess pavement damage image data, annotate the preprocessed images, and divide the annotated images into training, validation, and test sets.
[0009] Step 2: Build an improved YOLOv8 object detection model, including a deformable convolution module, an optimized feature pyramid network, and a cascaded instance segmentation unit. It also uses a U-Net++ structure with an attention mechanism to determine the type of disease.
[0010] Step 3: Use the training set to train the improved YOLOv8 object detection model, evaluate the model on the validation set, and adjust the model parameters based on the evaluation results. Use the trained YOLOv8 object detection model to predict the test set, combining the cascaded instance segmentation strategy to obtain the type of pavement damage and the location and size of the damage area.
[0011] Step 4: Calculate the affected area of pavement damage: Based on the pixel-level segmentation results and spatial calibration parameters, combined with the type and size of the damage, calculate and automatically evaluate the actual affected area of the pavement damage;
[0012] Step 5: Optimize the YOLOv8 target detection model and perform real-time detection of the area affected by road damage.
[0013] Preferably, in step 1, the data set preparation includes the following sub-steps:
[0014] Step 1.1. Data Collection: Use road inspection vehicles or drones to collect high-resolution image data of asphalt pavement defects, including potholes, rutting, and repairs.
[0015] Step 1.2, Image Preprocessing: Preprocess the collected pavement damage images, including: denoising, image enhancement, brightness adjustment, and maintain the consistency of data input;
[0016] Step 1.3: Annotate the image, including the disease type and disease area;
[0017] Step 1.4: Divide the labeled images into training set, validation set, and test set.
[0018] Preferably, in step 2, an improved YOLOv8 target detection model is constructed, and the optimization measures include:
[0019] Step 2.1: Model architecture optimization
[0020] Based on YOLOv8, CSPNet is selected as the backbone network and integrated with an improved feature pyramid network (FPN+PAN structure) to enhance the multi-scale feature extraction capability and improve the small target disease detection performance;
[0021] Step 2.2, convolution structure enhancement:
[0022] Introducing a deformable convolution network (DCN) module into the detection head to adapt the convolution kernel to the shape and scale of the disease, improving the detection ability of irregular areas;
[0023] Step 2.3: Anchor frame and detection strategy optimization:
[0024] Generate multi-scale anchor boxes through K-Means++ and combine it with the anchor-free mechanism to dynamically match the target shape to improve positioning accuracy;
[0025] Step 2.4, loss function improvement:
[0026] CIoU loss is introduced for bounding box regression, and Focal Loss is used to balance the proportion of category samples and improve recognition robustness in complex scenarios.
[0027] Preferably, in step 3, a cascade instance segmentation strategy is adopted to perform pixel-level segmentation and area calculation of the diseased area, specifically including:
[0028] Step 3.1: Instance segmentation model construction:
[0029] Based on the detection results of the YOLOv8 target detection model, Mask R-CNN or SegFormer instance segmentation network is used to generate diseased area masks;
[0030] Step 3.2, segmentation network optimization:
[0031] The ResNeXt backbone network and DCN module are introduced into Mask R-CNN to improve the segmentation ability of edge diseased areas; Balanced L1 Loss is used to smooth edge contours to avoid misclassification;
[0032] Step 3.3: Calculation of disease-affected area:
[0033] Calculate the actual affected area of the disease based on the number of mask pixels and the image calibration ratio;
[0034] Step 3.4, precision control mechanism:
[0035] Determine whether the disease size segmentation result is less than the preset threshold. If so, specify the disease quantification calculation method and indicators; otherwise, repeat steps 3.1 to 3.3 to perform disease size segmentation.
[0036] Preferably, in step 3, training the improved YOLOv8 target detection model also includes using a transfer learning method to load the YOLOv8 weights pre-trained on a large-scale general dataset as an initialization model and fine-tune it on a local disease image dataset to improve the convergence speed and generalization ability of the model under small sample conditions.
[0037] Preferably, in step 4, the actual affected area of the pavement damage is calculated and automatically evaluated as follows:
[0038] Step 4.1: Introduce the instance segmentation model and calculate the damage rate of the disease:
[0039] Based on the damage area calculated by the mask, calculate the damage rate of the damage according to the set assessment standards;
[0040] Step 4.2: Automatically generate a test report:
[0041] An inspection report is automatically generated based on the calculation results. The report includes information on the type of damage, area, and damage rate, providing intelligent support for road maintenance decisions.
[0042] Preferably, optimizing the YOLOv8 target detection model also includes introducing an AdamW optimizer to improve the convergence speed and stability of the YOLOv8 target detection model.
[0043] Preferably, in step 4, the disease-affected area is calculated by:
[0044] For pits and grooves, calculate the area of the minimum circumscribed rectangle;
[0045] For rutting, calculate the contour area.
[0046] Preferably, in step 5, the YOLOv8 target detection model is optimized, and the road surface disease affected area is detected in real time, as follows:
[0047] Step 5.1: Use TensorRT to optimize the inference of the YOLOv8 object detection model. Use layer fusion and precision quantization to accelerate the model inference process and improve the real-time performance of disease detection and area calculation.
[0048] Step 5.2: Introduce a dynamic image segmentation mechanism to maintain disease recognition accuracy at high speeds. Use inter-frame differencing to reduce repeated calculations and improve real-time detection efficiency.
[0049] Step 5.3: Compare the calculated pavement damage affected area with the actual measured value to evaluate the accuracy of the calculation method.
[0050] Compared with the prior art, the present invention adopts the above technical solution and has the following technical effects:
[0051] 1. The method of the present invention realizes efficient identification of pavement defects and automatic area calculation without manual intervention by improving the YOLOv8 target detection model and introducing instance segmentation technology.
[0052] 2. The improved YOLOv8 target detection model of the present invention can quickly detect diseased targets, and the instance segmentation network further realizes the accurate segmentation of diseases, improves the accuracy of disease recognition (accuracy reaches 91.5%), and can maintain strong robustness in complex road scenes.
[0053] 3. The inference speed of the improved YOLOv8 target detection model in this invention is significantly improved. It can quickly complete the processing of a large number of road images and the calculation of the area affected by the disease. It has the ability of real-time detection and provides intelligent support for road maintenance and management. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 This is a flowchart of the method for automatically calculating the area affected by pavement damage according to the present invention;
[0055] Figure 2 This is the network structure diagram of the improved YOLOv8 target detection model of the present invention;
[0056] Figure 3 This is a road image and its annotation diagram according to an embodiment of the present invention. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions of the application are further elaborated in detail below with reference to the accompanying drawings. The described embodiments are only a part of the embodiments involved in the present invention. All non-innovative embodiments of other researchers in this field on this embodiment fall within the scope of protection of the present invention. At the same time, the step numbers in the embodiments of the present invention are only set for the convenience of explanation and description, and the order between the steps is not limited in any way. The execution order of each step in the embodiment can be adaptively adjusted according to the understanding of those skilled in the art.
[0058] In one embodiment of the present invention, a method for automatically calculating the affected area of pavement damage based on an improved YOLOv8 algorithm is provided. Figure 1 As shown, the following steps are included:
[0059] 1. Dataset Preparation
[0060] (1) Data collection: Use road inspection vehicles or drones to collect road surface images and high-resolution asphalt pavement damage image data. To ensure the diversity of the dataset, it is necessary to collect data from different road sections and weather conditions, and include different types of damage, such as potholes, patches, rutting, and other common deformation-related damages.
[0061] (2) Image preprocessing: In order to obtain high-quality data, the collected images need to be preprocessed, including denoising, image cropping, image enhancement, brightness adjustment and other operations to ensure the consistency of data input.
[0062] In this embodiment, an image enhancement algorithm based on convolution filtering is preferably used to improve the recognition effect of the model.
[0063] (3) Annotate the preprocessed images, including the disease type and disease area, and divide the annotated images into training set, verification set and test set.
[0064] In this embodiment, labeling software (such as LabelImg or Labelme) is used to label the disease areas and disease types of 100 images. Figure 3 As shown in Figure 3, the annotated images are further divided into training set, validation set and test set with a ratio of approximately 6:2:2.
[0065] 2. Build an improved YOLOv8 target detection model
[0066] (1) Model architecture optimization:
[0067] This embodiment uses YOLOv8 as the basic target detection model. Compared with YOLOv5, YOLOv8 has a simpler model structure, lower computational complexity, and faster inference speed, making it suitable for real-time road damage detection.
[0068] CSPNet (Cross Stage Partial Network) is preferably used as the basic backbone network of YOLOv8 to improve the efficiency of feature extraction and network depth, and is integrated with the improved feature pyramid network (FPN+PAN structure) to enhance the multi-scale feature extraction capability and improve the small target disease detection performance.
[0069] (2) Convolutional structure enhancement:
[0070] A deformable convolution module is introduced into the detection head to make the convolution kernel adapt to the shape and scale of the disease, thereby improving the detection ability of irregular areas.
[0071] (3) Anchor Box Optimization:
[0072] This embodiment uses the K-Means++ algorithm to automatically generate multi-scale anchor frames and dynamically adjust the size of the anchor frames to adapt to the different shapes and sizes of disease targets, reducing the inconvenience of manual parameter adjustment and improving the detection adaptability of different disease types.
[0073] The anchor-free mechanism of YOLOv8 is optimized to further improve the flexibility and accuracy of target positioning, especially when the target boundaries are complex.
[0074] (3) Loss function improvement:
[0075] The improved CIoU (Complete Intersection over Union) loss function is used to ensure a more accurate match between the disease bounding box and the actual disease area, especially in scenes with complex disease morphology, to maintain high accuracy.
[0076] Focal Loss is introduced to reduce the impact of the imbalance in the ratio of positive and negative samples, focusing on optimizing the detection of small or occluded disease areas.
[0077] In this embodiment, the improved YOLOv8 target detection model has the following structure: Figure 2 As shown in Figure 2, the input end uses the Mosaic data enhancement method.
[0078] First, the single-channel GPR pavement structure internal crack grayscale image is converted into a three-channel image by batch modifying the depth parameter in the XML file (copying it three times) so as to be input into the input layer of the model.
[0079] Then, the Mosaic method is used to perform random cropping, scaling cropping and other simple enhancement methods for splicing, and finally the adaptive anchor frame calculation is performed to improve the detection effect of ground penetrating radar images of small target crack features.
[0080] In particular, the head introduces an attention mechanism on the original basis. After entering the network, it extracts the features of internal cracks in sequence. The neck is a multi-scale feature extraction network. The improved version adds a detection layer (152×152×255) for small-scale targets. Therefore, the head outputs prediction boxes at four scales.
[0081] 3. Model training
[0082] The improved YOLOv8 object detection model was trained using the training set and evaluated on the validation set, with model parameters adjusted based on the evaluation results. The trained YOLOv8 object detection model was used to predict the test set to obtain the type of pavement damage and the location and size of the damaged area.
[0083] In this example, 60 labeled images are used as the training set for training, and 20 labeled images are used for verification. Set the learning rate to 0.00125, optimizer to Momentum, momentum to 0.9, and number of training epochs to 100.
[0084] 4. Calculation of the area affected by pavement damage
[0085] Perform refined calculations based on instance segmentation as follows:
[0086] (1) Introducing instance segmentation model:
[0087] Based on the detection results of YOLOv8, a mainstream instance segmentation model (such as Mask R-CNN or SegFormer) is used to perform fine segmentation of the diseased area. The segmentation model generates a mask for each diseased area to achieve pixel-level accurate segmentation of the diseased area.
[0088] Preferably, the mainstream instance segmentation model in this embodiment is Mask R-CNN.
[0089] (2) Model optimization strategy:
[0090] The feature extraction part of Mask R-CNN is optimized, ResNeXt is selected as the backbone network, and Deformable Convolution is combined to enhance the network's ability to segment complex edges.
[0091] The Balanced L1 Loss function is used to optimize the segmentation accuracy of the disease mask to ensure smooth edges of the segmented disease area and avoid pixel misclassification.
[0092] (3) Calculation of mask area:
[0093] The actual affected area of the disease is calculated by segmenting the disease mask. The formula is:
[0094] The formula is:
[0095]
[0096] Where A is the total area of disease, P i is the area weight of each pixel, S is the physical size conversion ratio of the image, and the formula converts the total number of segmented mask pixels into the actual disease area.
[0097] Furthermore, area calculation and automatic evaluation are performed as follows:
[0098] (1) Based on the instance segmentation model, calculate the damage rate of the disease:
[0099] Based on the damage area calculated by the mask, the damage rate of the damage is calculated in accordance with the requirements of the Highway Technical Condition Assessment Standard (JTG 5210-2018). The damage rate calculation formula is:
[0100]
[0101] Among them, A d is the area affected by the disease, A t is the total area of the detection area;
[0102] (2) Automatically generate test reports:
[0103] An inspection report is automatically generated based on the calculation results. The report contains information such as the type of disease, area, and damage rate, providing intelligent support for road maintenance decisions.
[0104] In this embodiment, the area affected by the disease is calculated as follows:
[0105] The trained improved YOLOv8 model is used to predict the test set to obtain the disease type and the location and size information of the diseased area.
[0106] For example, the predictions might be:
[0107] Slot: upper left corner coordinate (100,100), width 50, height 30
[0108] Patch: upper left corner coordinates (200,200), width 80, height 40
[0109] Calculate the affected area of the disease based on the disease type and size information. For example:
[0110] Pit: Calculate the minimum circumscribed rectangle area, which is (50*30) = 1500 pixels.
[0111] Inpainting: Calculate the area of the rectangle, which is (80*40)=3200 pixels.
[0112] By using tools such as a ruler to actually measure some images in the test set, the size information of the disease is recorded, and the calculated affected area is compared with the actual measurement value to evaluate the accuracy of the calculation method.
[0113] 5. System optimization and real-time detection
[0114] (1) TensorRT is preferably used for model inference optimization to further improve the inference speed of the YOLOv8 target detection model and realize real-time road disease detection and area calculation.
[0115] (2) A dynamic image segmentation mechanism is introduced to ensure that a high level of disease recognition accuracy can be maintained even at high speeds; repeated calculations are reduced through the inter-frame difference method, thereby improving the efficiency of real-time detection.
[0116] (3) Compare the calculated impact area with the actual measured value to evaluate the accuracy of the calculation method.
[0117] In particular, in an embodiment of the present invention, as a preferred solution:
[0118] (1) Model selection: It is preferred to use the YOLOv8 model in combination with the SegFormer segmentation network to balance detection speed and segmentation accuracy.
[0119] (2) Adaptive anchor frame adjustment: The K-Means++ algorithm is used to dynamically adjust the size of the anchor frame to improve the detection adaptability of different disease types.
[0120] (3) Global optimization strategy: By introducing the AdamW optimizer, the convergence speed and stability of the model are improved.
[0121] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. An automated calculation method for the affected area of pavement damage based on an improved YOLOv8 algorithm, characterized in that: The steps include: Step 1: Dataset preparation: Collect and preprocess pavement damage image data, annotate the preprocessed images, and divide the annotated images into training, validation, and test sets. Step 2: Build an improved YOLOv8 object detection model, including a deformable convolution module, an optimized feature pyramid network, and a cascaded instance segmentation unit. It also uses a U-Net++ structure with an attention mechanism to determine the type of disease. Step 3: Use the training set to train the improved YOLOv8 object detection model, evaluate the model on the validation set, and adjust the model parameters based on the evaluation results. Use the trained YOLOv8 object detection model to predict the test set, combining the cascaded instance segmentation strategy to obtain the type of pavement damage and the location and size of the damage area. Step 4: Calculate the affected area of pavement damage: Based on the pixel-level segmentation results and spatial calibration parameters, combined with the type and size of the damage, calculate and automatically evaluate the actual affected area of the pavement damage; Step 5: Optimize the YOLOv8 target detection model and perform real-time detection of the area affected by road damage.
2. The method for automatically calculating the area affected by pavement damage according to claim 1, characterized in that: In step 1, the data set preparation includes the following sub-steps: Step 1.
1. Data Collection: Use road inspection vehicles or drones to collect high-resolution image data of asphalt pavement defects, including potholes, rutting, and repairs. Step 1.2, Image Preprocessing: Preprocess the collected pavement damage images, including: denoising, image enhancement, brightness adjustment, and maintain the consistency of data input; Step 1.3: Annotate the image, including the disease type and disease area; Step 1.4: Divide the labeled images into training set, validation set, and test set.
3. The method for automatically calculating the area affected by pavement damage according to claim 1, characterized in that: In step 2, an improved YOLOv8 target detection model is constructed. The optimization measures include: Step 2.1: Model architecture optimization Based on YOLOv8, CSPNet is selected as the backbone network and integrated with the improved feature pyramid network to enhance the multi-scale feature extraction capability and improve the small target disease detection performance; Step 2.2, convolution structure enhancement: A deformable convolution module is introduced into the detection head to adapt the convolution kernel to the shape and scale of the defect, improving the detection capability of irregular areas. Step 2.3: Anchor frame and detection strategy optimization: Generate multi-scale anchor boxes through K-Means++ and combine it with the anchor-free mechanism to dynamically match the target shape to improve positioning accuracy; Step 2.4, loss function improvement: CIoU loss is introduced for bounding box regression, and Focal Loss is used to balance the proportion of category samples and improve recognition robustness in complex scenarios.
4. The method for automatically calculating the area affected by pavement damage according to claim 3, characterized in that: In step 3, a cascade instance segmentation strategy is used to perform pixel-level segmentation and area calculation of the diseased area, specifically including: Step 3.1: Instance segmentation model construction: Based on the detection results of the YOLOv8 target detection model, Mask R-CNN or SegFormer instance segmentation network is used to generate diseased area masks; Step 3.2, segmentation network optimization: The ResNeXt backbone network and DCN module are introduced into Mask R-CNN to improve the segmentation ability of edge diseased areas; Balanced L1 Loss is used to smooth edge contours to avoid misclassification; Step 3.3: Calculation of disease-affected area: Based on the number of mask pixels and the image calibration ratio, the actual affected area of the disease is calculated using the following formula: Where A is the total area of disease, P i is the area weight of each pixel, and S is the physical size conversion ratio of the image; Step 3.4, precision control mechanism: Determine whether the disease size segmentation result is less than the preset threshold. If so, specify the disease quantification calculation method and indicators; otherwise, repeat steps 3.1 to 3.3 to perform disease size segmentation.
5. The method for automatically calculating the area affected by pavement damage according to claim 4, characterized in that: In step 4, the actual affected area of pavement damage is calculated and automatically assessed as follows: Step 4.1: Introduce the instance segmentation model and calculate the damage rate of the disease: Based on the damage area calculated by the mask and in accordance with the set assessment standards, the damage rate of the damage is calculated using the following formula: Among them, A d is the area affected by the disease, A t is the total area of the detection area; Step 4.2: Automatically generate a test report: An inspection report is automatically generated based on the calculation results. The report includes information on the type of damage, area, and damage rate, providing intelligent support for road maintenance decisions.
6. The method for automatically calculating the area affected by pavement damage according to claim 5, characterized in that: In step 4, the area affected by the disease is calculated using the following methods: For pits and grooves, calculate the area of the minimum circumscribed rectangle; For rutting, calculate the contour area.
7. The method for automatically calculating the area affected by pavement damage according to claim 5, characterized in that: In step 5, the YOLOv8 object detection model is optimized and the area affected by road damage is detected in real time using the following method: Step 5.1: Use TensorRT to optimize the inference of the YOLOv8 object detection model. Use layer fusion and precision quantization to accelerate the model inference process and improve the real-time performance of disease detection and area calculation. Step 5.2: Introduce a dynamic image segmentation mechanism to maintain disease recognition accuracy at high speeds. Use inter-frame differencing to reduce repeated calculations and improve real-time detection efficiency. Step 5.3: Compare the calculated pavement damage affected area with the actual measured value to evaluate the accuracy of the calculation method.
8. The method for automatically calculating the area affected by pavement damage according to claim 1, characterized in that: In step 3, the improved YOLOv8 object detection model is trained, which also includes using the transfer learning method. By loading the YOLOv8 weights pre-trained on a large-scale general dataset as the initialization model and fine-tuning it on a local disease image dataset, the model's convergence speed and generalization ability under small sample conditions are improved.
9. The method for automatically calculating the area affected by pavement damage according to claim 1, characterized in that: In step 4, the YOLOv8 target detection model is optimized, which also includes the introduction of the AdamW optimizer to improve the convergence speed and stability of the YOLOv8 target detection model.