A road defect detection method based on an RDD-YOLOv8 model
By introducing the RD attention mechanism and the FEAIOU loss function, the RDD-YOLOv8 model solves the contradiction between small target detection and computational complexity in the YOLO model, achieving efficient and accurate road defect detection and adapting to different environmental changes.
Patent Information
- Application Number
- CN202511535530.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2045-10-27
AI Technical Summary
Existing YOLO-based road defect detection models have weak response to small target defect features and there is a contradiction between computational complexity and real-time requirements. They are difficult to meet the power consumption, memory and inference speed requirements of edge devices, and have poor generalization performance in complex environments.
The RDD-YOLOv8 model is adopted, and the feature extraction capability and detection accuracy are enhanced by introducing the RD attention mechanism and FEAIOU loss function, thereby optimizing the deployment and detection efficiency of the model on edge devices.
It improves the accuracy and efficiency of road defect detection, enhances the model's adaptability to complex environments, meets the detection needs under different regional and climatic conditions, and reduces computational complexity and the number of parameters.
Smart Images

Figure CN120997223B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the interdisciplinary field of computer vision, deep learning and intelligent transportation, and specifically relates to a road defect detection method based on the RDD-YOLOv8 model. Background Technology
[0002] In a human-vehicle-road collaborative intelligent transportation system, roads, as core infrastructure, directly determine traffic safety and efficiency based on their health status. During long-term service, roads are susceptible to defects such as transverse cracks, longitudinal cracks, network cracks, and potholes due to the combined effects of environmental erosion (e.g., rainwater, freeze-thaw cycles), cyclic loads (e.g., vehicle traffic) and material aging. If these defects are not detected and repaired in a timely manner, they will not only accelerate road surface damage and lead to a surge in maintenance costs, but may also cause safety accidents such as vehicle bumps and loss of control, posing a serious threat to driving safety. Therefore, developing high-precision and high-efficiency road defect detection technology is a key requirement in the field of intelligent transportation infrastructure operation and maintenance.
[0003] Current road defect detection technologies are mainly divided into three categories: 1) Manual inspection methods: These rely on manual visual inspection or measurement with simple tools, and have inherent defects such as strong subjectivity, low coverage, poor data consistency (large deviations when recording the same defect multiple times), and low efficiency, making it difficult to meet the needs of large-scale road maintenance. 2) Traditional vehicle-mounted sensing methods: These collect road surface data based on equipment such as vibration sensors and lidar. Although they achieve partial digitization, they are limited by sampling density and detection speed (data accuracy decreases when vehicle speed exceeds 60km / h), and the equipment cost is high, making large-scale promotion difficult. 3) Digital image processing methods: These extract defect features through traditional algorithms such as edge detection, threshold segmentation, or wavelet multi-scale analysis. However, their feature representation ability is limited to manually designed low-level features, such as grayscale and edges. Under changes in lighting, noise interference (such as road stains and markings), and complex texture backgrounds (such as asphalt pavement particles), the generalization performance drops sharply, resulting in high false negative and false positive rates.
[0004] In recent years, deep learning methods based on convolutional neural networks (CNNs) have significantly improved the accuracy of road defect detection due to their powerful feature learning capabilities. Among them, the YOLO series of algorithms, as a typical one-stage detection algorithm, has become the mainstream choice for road defect detection because it balances detection speed and accuracy. However, existing YOLO-based detection models still face two major challenges in engineering applications: on the one hand, the feature response of small target defects (such as microcracks) is weak and easily drowned out by background noise; on the other hand, there is a contradiction between the computational complexity of the model and the real-time requirements, making it difficult to meet the strict constraints of edge devices in terms of power consumption, memory, and inference speed. Summary of the Invention
[0005] The purpose of this invention is to provide a road defect detection method based on the RDD-YOLOv8 model, thereby solving the problems mentioned in the background art.
[0006] To solve the above-mentioned technical problems, the present invention adopts the following solution:
[0007] A road defect detection method based on the RDD-YOLOv8 model includes the following steps:
[0008] Step S1: Construct a road defect dataset, specifically including:
[0009] Step S1.1: Collect several road defect images, including five types of road defects: transverse cracks, longitudinal cracks, network cracks, potholes, and repairs.
[0010] Step S1.2: Use the Labelimg annotation tool to annotate the bounding boxes of all collected images. The annotation information includes the defect category and the corresponding bounding box coordinates.
[0011] Step S1.3: All the labeled road defect images constitute a dataset. The dataset is then randomly divided into a training set, a validation set, and a test set in a sample ratio of 7:2:1.
[0012] Step S2: Construct and train a road defect detection model, specifically including:
[0013] Step S2.1: Based on the YOLOv8n algorithm, an RDD-YOLOv8 model for road defect detection is formed by designing the RD attention mechanism and the FEAIOU loss function. The YOLOv8n algorithm includes a backbone feature extraction network, a neck feature fusion network, and a head detection network. The RD attention mechanism is used to enhance the defect feature extraction capability. The FEAIOU loss function is used to optimize the matching accuracy between the ground truth bounding box and the predicted bounding box in the head detection network.
[0014] Step S2.2: Training and optimizing the road defect detection algorithm model, specifically: First, preprocess the images of the training set and validation set in step S1; then, use SGD as the optimizer to train the RDD-YOLOv8 model constructed in step S2.1 using the training set; after each round of training, calculate the model's precision, recall, mean precision (mAP), floating-point operations (FLOPs), and parameter count (Params) on the validation set to obtain the optimal algorithm model.
[0015] Step S3: Edge Deployment and Detection, specifically: First, deploy the best algorithm model RDD-YOLOv8 trained in Step S2.2 to the edge computing device; then, collect images or video streams of the road to be detected, preprocess them, and input them into the deployed RDD-YOLOv8 model; after model inference, output the category, bounding box coordinates, and confidence of the road defect, thus completing the road defect detection.
[0016] Further optimization is achieved by the following step S2.1: the RD attention mechanism includes a channel attention submodule and a spatial attention submodule; the RD attention mechanism is integrated into the SPPF module of the YOLOv8n algorithm backbone feature extraction network to obtain the SPPF-RD module. The input of the SPPF-RD module is the C5 feature map of the YOLOv8n backbone network, and the output is the enhanced feature map weighted by RD attention.
[0017] Further optimization is achieved by implementing the RD attention mechanism in step S2.1 as follows:
[0018] First, the input feature map x Perform max pooling, median pooling, and average pooling operations respectively to obtain pooling features. P max 、P Med 、P Avg ,in:
[0019] ;
[0020] ;
[0021] ;
[0022] Secondly, P max 、P Med 、P Avg Input fully connected layers respectively F C The channels are then fused and the channel attention weights are obtained using the Sigmoid activation function σ(). A Chenel ;
[0023] ;
[0024] Third, utilize channel attention weights A Chenel With input feature map x Element-wise multiplication yields preliminary optimized features. Arefine :
[0025] ;
[0026] Finally, the initial optimized features A refine Spatial attention weights are obtained through processing using the Spatial Attention Module (SAM). A SAM This will initially optimize the features. A refine Spatial attention weights A SAM Element-wise multiplication, combined with 1×1 convolution to adjust the dimensions, and then fused with the original input feature map, yields the output of the RD attention mechanism;
[0027] .
[0028] Further optimization is achieved by defining the FEAIOU loss function in step S2.1 as follows:
[0029] ;
[0030] In the above formula, B p and B g S represents the regions of the predicted bounding box and the ground truth bounding box, respectively; p S represents the area of the prediction box. g Represents the actual area of the bounding box. d This represents the Euclidean distance between the center coordinates of the ground truth bounding box and the center coordinates of the predicted bounding box. c This represents the diagonal distance between the smallest bounding rectangle of the ground truth bounding box and the predicted bounding box; w g and h g These are the width and height of the actual bounding box, respectively; w p and h p These are the width and height of the prediction bounding box, respectively. λ For global equilibrium hyperparameters; α This is a hyperparameter used to adjust the influence of the ratio of the predicted bounding box area to the ground truth bounding box area. β The weight for the angle evaluation is generally set to 0.2; w c and h c Let represent the width and height of the minimum bounding rectangles of the predicted bounding box and the ground truth bounding box, respectively, and let represent the penalty term for the width difference between the ground truth bounding box and the predicted bounding box. This represents the penalty term for the height difference between the ground truth bounding box and the predicted bounding box. Indicates the angle penalty item. This indicates that the Euclidean distance between elements is calculated, and L represents the loss function Loss.
[0031] Further optimization is achieved by setting the parameters of the SGD optimizer in step S2.2 as follows: learning rate of 0.01, momentum of 0.937, and weight decay coefficient of 0.0005; and training hyperparameters as follows: batch size of 16 and number of iterations of 200.
[0032] mAP includes mAP0.5 when the IOU threshold is 0.5 and mAP0.5:0.95 when the IOU threshold is in the range of 0.5~0.95; the model with the highest mAP0.5 on the validation set is selected as the best RDD-YOLOv8 model.
[0033] Compared with the prior art, the present invention has the following beneficial effects:
[0034] 1. This invention enhances the model's ability to identify complex defects and predict and classify them by constructing an RD attention mechanism module and introducing a novel FEAIOU loss function, thereby improving detection accuracy and efficiency.
[0035] 2. On test sets for different scenarios, such as sunny days, cloudy days, asphalt roads, and cement roads, the mAP0.5 fluctuation of RDD-YOLOv8 is small, far lower than that of traditional digital image processing methods, indicating that the model has strong adaptability to environmental changes and can meet the road detection needs under different regions and climate conditions. Attached Figure Description
[0036] Figure 1 This is a flowchart of a road defect detection method based on the RDD-YOLOv8 model;
[0037] Figure 2 This is a road defect category map;
[0038] Figure 3 This is a diagram of an RDD-YOLOv8 model;
[0039] Figure 4 This is a network framework diagram of the RD attention mechanism;
[0040] Figure 5 This is a network structure diagram of the SPPF-RD module;
[0041] Figure 6 These are PR curves before and after the improvement;
[0042] Figure 7 This is a comparison chart of the road defect detection results. Detailed Implementation
[0043] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0044] like Figure 1 As shown, a road defect detection method based on the RDD-YOLOv8 model includes the following steps:
[0045] Step S1: Construct a road defect dataset, specifically including:
[0046] Step S1.1: Collect a number of road defect images, including five types of road defects: transverse cracks, longitudinal cracks, network cracks, potholes, and repairs, resulting in a total of 5480 photos. For example... Figure 2 As shown, where, Figure 2 Image (a) in the image shows a transverse crack in the road. Figure 2 Image (b) shows a longitudinal crack image of the road. Figure 2 Image (c) in the image shows a network of cracks in the road surface. Figure 2 Image (d) in the image represents a road pothole. Figure 2 (e) in the image represents the road defect repaired image. These images are sourced from the RDD2022 China dataset, road defect images obtained online, screenshots from road inspection videos, and on-site road defect images.
[0047] Step S1.2: Use the Labelimg annotation tool to annotate the bounding boxes of all collected images. The annotation information includes the defect category and the corresponding bounding box coordinates. The annotation results are verified, and samples with bounding box offsets exceeding 5 pixels or incorrect category annotations are removed to ensure the accuracy of the dataset annotation.
[0048] Step S1.3: All the labeled road defect images constitute a dataset. The dataset is then randomly divided into a training set, a validation set, and a test set in a sample ratio of 7:2:1.
[0049] Step S2: Construct and train a road defect detection model, specifically including:
[0050] Step S2.1: Based on the YOLOv8n algorithm, an RDD-YOLOv8 model for road defect detection is formed by designing the RD attention mechanism and the FEAIOU loss function, as follows: Figure 3 As shown.
[0051] The YOLOv8n algorithm includes a backbone feature extraction network, a neck feature fusion network, and a head detection network.
[0052] The RD attention mechanism is used to enhance defect feature extraction capabilities, and it includes a channel attention submodule and a spatial attention submodule. The RD attention mechanism is integrated into the SPPF module of the YOLOv8n algorithm's backbone feature extraction network to obtain the SPPF-RD module. The input of the SPPF-RD module is the C5 feature map of the YOLOv8n backbone network, and the output is an enhanced feature map weighted by RD attention, such as... Figure 5 As shown.
[0053] like Figure 4 As shown, the implementation process of the RD attention mechanism is as follows:
[0054] First, the input feature map x Perform max pooling, median pooling, and average pooling operations respectively to obtain pooling features. P max 、P Med 、P Avg ,in:
[0055] ;
[0056] ;
[0057] ;
[0058] Secondly, P max 、P Med 、P Avg Input fully connected layers respectively F C The channels are then fused and the channel attention weights are obtained using the Sigmoid activation function σ(). A Chenel ;
[0059] ;
[0060] Third, utilize channel attention weights A Chenel With input feature map x Element-wise multiplication yields preliminary optimized features. A refine :
[0061] ;
[0062] Finally, the initial optimized featuresA refine Spatial attention weights are obtained through processing using the Spatial Attention Module (SAM). A SAM This will initially optimize the features. A refine Spatial attention weights A SAM Element-wise multiplication, combined with 1×1 convolution to adjust the dimensions, and then fused with the original input feature map, yields the output of the RD attention mechanism;
[0063] .
[0064] The FEAIOU loss function is used to optimize the matching accuracy between ground truth bounding boxes and predicted bounding boxes in the head detection network;
[0065] The expression for the FEAIOU loss function is as follows:
[0066] ;
[0067] In the above formula, B p and B g S represents the regions of the predicted bounding box and the ground truth bounding box, respectively; p S represents the area of the prediction box. g Represents the actual area of the bounding box. d This represents the Euclidean distance between the center coordinates of the ground truth bounding box and the center coordinates of the predicted bounding box. c This represents the diagonal distance between the smallest bounding rectangle of the ground truth bounding box and the predicted bounding box; w g and h g These are the width and height of the actual bounding box, respectively; w p and h p These are the width and height of the prediction bounding box, respectively. λ For global equilibrium hyperparameters; α This is a hyperparameter used to adjust the influence of the ratio of the predicted bounding box area to the ground truth bounding box area. β The weight for the angle evaluation is generally set to 0.2; w c and h c Let represent the width and height of the minimum bounding rectangles of the predicted bounding box and the ground truth bounding box, respectively. This represents the penalty term for the width difference between the ground truth bounding box and the predicted bounding box. This represents the penalty term for the height difference between the ground truth bounding box and the predicted bounding box. Indicates the angle penalty item. This indicates that the Euclidean distance between elements is calculated, and L represents the loss function Loss.
[0068] Step S2.2: Training and optimizing the road defect detection algorithm model, specifically: First, preprocess the images in the training and validation sets from Step S1; then, use SGD as the optimizer with a learning rate of 0.01, momentum of 0.937, and weight decay coefficient of 0.0005; the training hyperparameters are set as follows: batch size of 16 and iterations of 200. Train the RDD-YOLOv8 model constructed in Step S2.1 using the training set; after each training round, calculate the model's precision, recall, mean precision (mAP), floating-point operations (FLOPs), and parameter count (Params) on the validation set to obtain the optimal algorithm model; mAP includes mAP0.5 when the IOU threshold is 0.5 and mAP0.5:0.95 when the IOU threshold is in the range of 0.5~0.95; select the model with the highest mAP0.5 on the validation set as the optimal RDD-YOLOv8 model.
[0069] Step S3: Edge Deployment and Detection, specifically: First, deploy the best algorithm model RDD-YOLOv8 trained in Step S2.2 to the edge computing device; then, collect images or video streams of the road to be detected, preprocess them, and input them into the deployed RDD-YOLOv8 model; after model inference, output the category, bounding box coordinates, and confidence of the road defect, thus completing the road defect detection.
[0070] Experiments and Verification: 1) Experimental Environment: Windows 10, CPU model: Intel Core™ i5-12400F, GPU model: NVIDIA GeForce RTX 3090, deep learning framework: Torch-2.3.1+CUDA 12.2, programming language: Python 3.8.19. The optimizer was SGD, the experimental settings were 200 epochs and 8 batch sizes.
[0071] 2) Evaluation Metrics: To evaluate the performance of the RDD-YOLOv8 algorithm model in road defect detection, precision (P), recall (R), mean average precision (mAP), floating-point operations (Flops), and parameters (Params) were selected as evaluation metrics. Precision represents the percentage of correctly predicted positive samples; recall represents the percentage of correctly predicted positive samples; a higher mean average precision (mAP) indicates better prediction performance. mAP is obtained by integrating the PR curve from the mean precision (AP) and is divided into two types: mAP0.5 and mAP0.5-0.95. mAP0.5 represents the mean average precision when the Intersection over Union (IOU) threshold is 0.5, and mAP0.5:0.95 represents the mean average precision when the IOU is between 0.5 and 0.95. Floating-point operations (Flops) represent the computational power required by the algorithm model during calculation and are an important indicator of computational complexity, measured in gigabytes (G). Params represent the number of parameters in an algorithm model and are an important indicator of the size of the algorithm model, measured in megabytes (M).
[0072] 3) Ablation experiment results and analysis:
[0073] To verify the individual and combined effects of the FEAIOU loss function and the RD attention mechanism, ablation experiments were conducted, and the results are shown in Table 1. " " indicates the use of the FEAIOU loss function or RD attention mechanism, and "-" indicates its absence. Experiment 1 indicates that neither the FEAIOU loss function nor the RD attention mechanism was introduced; the YOLOv8n algorithm achieved precision, recall, mean accuracy (mAP0.5), and mean precision (mAP0.5:0.95) of 87%, 80.3%, 87.3%, and 56.9%, respectively, with FLOPs and Params reaching 8.1G and 3.01M, respectively. Experiment 2 indicates that the YOLOv8n algorithm... Based on the 8n algorithm, the FEAIOU loss function was introduced. After the improvement, the FLOPs and Params of the algorithm remained unchanged. The precision, recall, mean precision (mAP0.5) and mAP0.5:0.95 reached 87.2%, 81.6%, 89%, and 59%, respectively, which were improved by 0.2, 1.3, 1.7, and 2.1 percentage points compared with the original algorithm. This proves that the FEAIOU loss function can better perform prediction and classification tasks while maintaining a lightweight approach, thus improving detection accuracy.
[0074] Experiment 3 shows that by introducing the RD attention mechanism into the YOLOv8n algorithm, the FLOPs of the improved algorithm remain unchanged. However, the introduction of the RD attention mechanism leads to an increase in the computational cost (Params), which eventually reaches 3.08M, an increase of 0.07M compared to the original algorithm. In terms of detection accuracy, although the precision and recall are lower than before the improvement, the mean precision (mAP0.5) and mAP0.5:0.95 of the key indicators reach 90.4% and 60.7% respectively, which are 3.1 and 3.8 percentage points higher than before the improvement. This indicates that although the RD attention mechanism can generate a small number of parameters, it can significantly improve the detection accuracy.
[0075] Experiment 4 shows that by simultaneously introducing FEAIOU and RD attention mechanisms into the YOLOv8n algorithm, the algorithm's lightweightness slightly decreased, with Params increasing by 0.01M and GFLOPs rising by 0.2G. However, the detection accuracy improved significantly. Precision, Recall, and Mean Accuracy (mAP0.5) and mAP0.5:0.95 reached 89%, 85.8%, 91.6%, and 63.8%, respectively, representing improvements of 2, 5.5, 4.3, and 6.9 percentage points compared to the original algorithm. This demonstrates that the RDD-YOLOv8 algorithm significantly improves detection accuracy.
[0076] Table 1 Ablation Experiment Results
[0077]
[0078] 4) Verification of testing results:
[0079] To verify the superior performance of the improved algorithm RDD-YOLOv8 in road defect detection, the improved algorithms Faster-RCNN, Mask-RCNN, RT-DETR, and YOLO series algorithms were compared. The results of the comparison experiment are shown in Table 2.
[0080] Table 2 clearly shows that the improved algorithm has a significant advantage in detection accuracy, with clear superiority in precision, recall, mean precision (mAP0.5), and mAP0.5:0.95. In terms of lightweight design, it achieves 8.3G FLOPs, second only to YOLOv8n and YOLOv5n, and its params reach 3.03M, also demonstrating a smaller parameter count. In summary, the RDD-YOLOv8 algorithm significantly improves detection accuracy while maintaining a sufficiently lightweight design.
[0081] Table 2 Comparison of experimental results
[0082]
[0083] The PR curves of each experiment in the experimental results are compared, and the comparison results are as follows: Figure 6 As shown. Among them, Figure 6 In Figure (a), the PR curve of YOLOv8n in Experiment 1 is shown. Figure 6 In Figure (b), the PR curve after introducing the FEAIOU loss function in Experiment 2 is shown. Figure 6 In Figure (c), the PR curve after introducing the RD attention mechanism in Experiment 3 is shown. Figure 6 In Figure (d), the PR curve of the improved RDD-YOLOv8 algorithm in Experiment 4 is shown. The horizontal axis of the PR curve represents recall, and the vertical axis represents precision. The curves in the coordinate system represent the average precision for each category. The blue curve represents the mean average precision for each category, i.e., mAP0.5. D00 represents a longitudinal crack, D10 represents a transverse crack, D20 represents a network crack, D40 represents a pothole, and Repair represents a repair.
[0084] Figure 6 In Experiment 3 (d), the improved algorithm achieved an average detection accuracy of 92.3%, slightly lower than the 93% level in Experiment 3. However, for the other metrics, including the average accuracy of the three categories D00, D10, D20 and D40 and the mAP0.5 metric, the improved algorithm outperformed the original algorithm, demonstrating the superiority of the improved algorithm.
[0085] Five road defect detection images were randomly selected from the test set and fed into the algorithms before and after the improvement, resulting in a comparison of detection performance, as shown in the figure below. Figure 7 As shown, where, Figure 7 (a) shows the detection results of the YOLOv8n algorithm. Figure 7 (b) shows the detection results of the RDD-YOLOv8 model. The labels on the bounding boxes in the figure indicate the defect type and the probability of classifying it as that defect type, such as... Figure 7 In the third image of (b), the orange box marked D20 0.64 indicates that the road defect is a network crack with a probability of 0.64.
[0086] pass Figure 7 The first image in (a) and Figure 7 The first image in (b), and Figure 7 The second image in (a) and Figure 7 Comparing the second image in (b), the RDD-YOLOv8 algorithm outperforms the YOLOv8n algorithm in detecting single defects. In particular, the improved algorithm also performs excellently when facing complex road detection tasks. Figure 7 The third image in (a) and Figure 7Comparing the third figure in (b), the improved algorithm has better detection accuracy than the original algorithm, indicating that the improved algorithm can effectively improve the detection accuracy of road defect categories.
[0087] Based on the above-described preferred embodiments of the present invention, and through the foregoing description, those skilled in the art can make various changes and modifications without departing from the inventive concept. The technical scope of this invention is not limited to the contents of the specification, but must be determined according to the scope of the claims.
Claims
1. A road defect detection method based on the RDD-YOLOv8 model, characterized in that, Includes the following steps: Step S1: Construct a road defect dataset, specifically including: Step S1.1: Collect several road defect images, including five types of road defects: transverse cracks, longitudinal cracks, network cracks, potholes, and repairs. Step S1.2: Use the Labelimg annotation tool to annotate the bounding boxes of all collected images. The annotation information includes the defect category and the corresponding bounding box coordinates. Step S1.3: All the labeled road defect images constitute a dataset. The dataset is then randomly divided into a training set, a validation set, and a test set in a sample ratio of 7:2:
1. Step S2: Construct and train a road defect detection model, specifically including: Step S2.1: Based on the YOLOv8n algorithm, an RDD-YOLOv8 model for road defect detection is formed by designing the RD attention mechanism and the FEAIOU loss function; The YOLOv8n algorithm includes a backbone feature extraction network, a neck feature fusion network, and a head detection network. The RD attention mechanism is used to enhance the defect feature extraction capability, and the FEAIOU loss function is used to optimize the matching accuracy between the ground truth bounding box and the predicted bounding box in the head detection network. The RD attention mechanism includes a channel attention submodule and a spatial attention submodule. The RD attention mechanism is integrated into the SPPF module of the YOLOv8n algorithm backbone feature extraction network to obtain the SPPF-RD module. The input of the SPPF-RD module is the C5 feature map of the YOLOv8n backbone network, and the output is an enhanced feature map weighted by RD attention. The implementation process of the RD attention mechanism is as follows: First, the input feature map x Perform max pooling, median pooling, and average pooling operations respectively to obtain pooling features. P max 、 P Med 、P Avg ,in: ; ; ; Secondly, P max 、P Med 、P Avg Input fully connected layers respectively F C The channels are then fused and the channel attention weights are obtained using the Sigmoid activation function σ(). A Chenel ; ; Third, utilize channel attention weights A Chenel With input feature map x Element-wise multiplication yields preliminary optimized features. A refine : ; Finally, the initial optimized features A refine Spatial attention weights are obtained through processing using the Spatial Attention Module (SAM). A SAM This will initially optimize the features. A refine Spatial attention weights A SAM Element-wise multiplication, combined with 1×1 convolution to adjust the dimensions, and then fused with the original input feature map, yields the output of the RD attention mechanism; ; The expression for the FEAIOU loss function is: ; In the above formula, B p and B g S represents the regions of the predicted bounding box and the ground truth bounding box, respectively; p S represents the area of the prediction box. g Represents the actual area of the bounding box. d This represents the Euclidean distance between the center coordinates of the ground truth bounding box and the center coordinates of the predicted bounding box. c This represents the diagonal distance between the smallest bounding rectangle of the ground truth bounding box and the predicted bounding box; w g and h g These are the width and height of the actual bounding box, respectively; w p and h p These are the width and height of the prediction bounding box, respectively. λ For global equilibrium hyperparameters; α This is a hyperparameter used to adjust the influence of the ratio of the predicted bounding box area to the ground truth bounding box area. β The evaluation weight for the angle is set to 0.2; w c and h c Let represent the width and height of the minimum bounding rectangles of the predicted bounding box and the ground truth bounding box, respectively. This represents the penalty term for the width difference between the ground truth bounding box and the predicted bounding box. This represents the penalty term for the height difference between the ground truth bounding box and the predicted bounding box. Indicates the angle penalty item. This indicates the calculation of the Euclidean distance between elements, where L represents the loss function Loss; Step S2.2: Training and optimizing the road defect detection algorithm model, specifically: First, preprocess the images in the training and validation sets from step S1; then, using SGD as the optimizer, train the RDD-YOLOv8 model constructed in step S2.1 using the training set; after each round of training, calculate the model's precision, recall, mean average precision (mAP), floating-point operations (FLOPs), and parameters (Params) on the validation set to obtain the optimal algorithm model; Step S3: Edge Deployment and Detection, specifically: First, deploy the best algorithm model RDD-YOLOv8 trained in Step S2.2 to the edge computing device; then, collect images or video streams of the road to be detected, preprocess them, and input them into the deployed RDD-YOLOv8 model; after model inference, output the category, bounding box coordinates, and confidence of the road defect, thus completing the road defect detection.
2. The road defect detection method based on the RDD-YOLOv8 model according to claim 1, characterized in that, In step S2.2, the parameters of the SGD optimizer are set as follows: learning rate is 0.01, momentum is 0.937, and weight decay coefficient is 0.0005; the training hyperparameters are set as follows: batch size is 16, and iteration rounds are 200; mAP includes mAP0.5 when the IOU threshold is 0.5 and mAP0.5:0.95 when the IOU threshold is in the range of 0.5~0.95.
Citation Information
Patent Citations
Aluminum material image defect detection method based on self-adaptive anchor frame
CN112085735A
Non-motor vehicle microscopic trajectory data mining method
CN117765416A