Road defect detection method based on improved YOLOv8s model
By introducing the C2F-FASTER-EMA module and the SimSPPF module in the YOLOV8S model, combined with the context guidance module, the problem of insufficient road defect detection speed and accuracy in existing technology has been solved, and high-efficiency road defect detection has been achieved.
Patent Information
- Application Number
- CN202411517813.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-01-24
AI Technical Summary
The existing YOLOv8 model cannot meet the requirements of detection speed and accuracy in road defect detection.
By introducing the C2f-faster-EMA module and simSPPF module into the YOLOv8s model, the number of parameters is reduced, the detection speed is improved, and the feature extraction capability is enhanced through the context guidance module.
With the increasing calculation complexity, improve the detection accuracy and processing speed, and meet the needs of road safety operation and maintenance.
Smart Images

Figure CN119360212A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of road defect detection, and more specifically to a road defect detection method based on an improved YOLOv8s model. Background Art
[0002] With the development of urbanization, road construction has become a very important task. However, due to the long-term operation of roads under high load, coupled with natural factors (such as weather, seasonal changes, etc.), some damage and defects will occur, which will affect driving safety and driving comfort. If they are not inspected and maintained in time, it will bring harm to people's passage. In order to improve road performance and ensure driving safety, it is imperative to adopt fast and accurate road defect detection methods. In the field of road maintenance, detailed detection of road defects is of greater importance to achieve these goals.
[0003] YOLOv8 is the latest version of the YOLO object detection and image segmentation model developed by Ultralytics. It is a cutting-edge, state-of-the-art (SOTA) model that builds on the success of previous YOLO and introduces new features and improvements to further improve performance and flexibility. Although YOLOv8 can be used for road defect detection, its current detection speed and accuracy cannot meet the needs of road safety operation and maintenance. Therefore, how to provide a road defect detection method based on an improved YOLOv8s model is a problem that technicians in this field urgently need to solve. Summary of the invention
[0004] In view of this, the present invention provides a road defect detection method based on an improved YOLOv8s model, introducing a C2f-faster-EMA module and a simSPPF module in a backbone network feature extraction network, reducing the number of parameters to increase the detection speed and improve the detection accuracy of the model.
[0005] In order to achieve the above object, the present invention provides the following technical solutions:
[0006] A road defect detection method based on an improved YOLOv8s model comprises the following steps:
[0007] S1, collecting road images with different types of crack defects, and inputting the collected road images into a sample model to generate defect samples;
[0008] S2, divide the defect samples into training set and test set, and train the improved YOLOv8s model;
[0009] S3, collecting the road image to be detected and inputting it into the trained YOLOv8s model, and the feature extraction network in the YOLOv8s model extracts the features of the road image to be detected;
[0010] S4. The feature fusion network in the YOLOv8s model fuses the features of the road image to be detected;
[0011] S5, the object detection network in the YOLOv8s model performs defect detection;
[0012] The output network in S6 and YOLOv8s models outputs the detection results to complete the road defect detection.
[0013] Optionally, in the feature extraction network, the C2f module in the YOLOv8s model is replaced by a C2f-faster-EMA module, the downsampling convolution module is replaced by a context-guided module, and the SPPF module is replaced by a simSPPF module, wherein the C2f-faster-EMA module includes a first CBS unit, a Split layer, a first EMA-faster unit, a second EMA-faster unit, a third EMA-faster unit, a Concat layer, and a second CBS unit connected in sequence, the Concat layer is also connected to the Split layer, the first EMA-faster unit, and the second EMA-faster unit, respectively, and the first CBS unit and the second CBS unit are both composed of a convolutional layer, a batch normalization layer, and an activation function connected in sequence.
[0014] Optionally, the context guidance module includes a local feature extraction unit, a surrounding feature extraction unit, a joint feature extraction unit and a global context feature extraction unit, the local feature extraction unit and the surrounding feature extraction unit are connected to the joint feature extraction unit, and the joint feature extraction unit is connected to the global context feature extraction unit.
[0015] Optionally, the simSPPF module includes a first CBR unit, a first Maxpool2d unit, a second Maxpool2d unit, a third Maxpool2d unit, a Concat layer and a second CBR unit connected in sequence, the Concat layer is also connected to the first Maxpool2d unit and the second Maxpool2d unit respectively, and the first CBR unit and the second CBR unit are both composed of a convolutional layer, a batch normalization layer and an activation function connected in sequence.
[0016] Optionally, the target detection network includes a scale-aware attention module, a space-aware attention module, and a task-aware attention module.
[0017] Optionally, the scale-aware attention module includes an Avgpool layer, a 1×1 convolution layer, a ReLU activation function, and a Hardsigmoid activation function connected in sequence.
[0018] Optionally, the spatial perception attention module includes an Index layer, a 3×3 convolution layer, an Offset layer, and a Sigmoid activation function, the Index layer is connected to the 3×3 convolution layer, and the 3×3 convolution layer is connected to the Offset layer and the Sigmoid activation function, respectively.
[0019] Optionally, the task-aware attention module includes an Avgpool layer, a first fully convolutional layer, a ReLU activation function, a second fully convolutional layer, and a Normalize layer connected in sequence.
[0020] Optionally, S6 and later versions also include:
[0021] S7. Conduct road defect analysis based on the type and severity of road defects to determine the degree of hazard.
[0022] It can be seen from the above technical solutions that, compared with the prior art, the present invention provides a road defect detection method based on an improved YOLOv8s model, which has the following beneficial effects: the present invention replaces the traditional C2f module with the C2f-faster-EMA module, and enhances feature extraction by using partial convolution combined with multi-scale attention, thereby improving the spatial feature representation without increasing the computational complexity, thereby improving the detection accuracy; the SPPF module is replaced by the SimSPPF module, and the simpler ReLU activation function is used to further optimize the computational efficiency, thereby speeding up the processing speed while maintaining high accuracy; the present invention adopts a context-guided module, which can ensure the model's detection ability for different scales and scenes, thereby improving the detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0024] Figure 1 The figure is a flow chart of the road defect detection method of the present invention. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0026] The embodiment of the present invention discloses a road defect detection method based on an improved YOLOv8s model. Figure 1 As shown, the following steps are included:
[0027] S1, collecting road images with different types of crack defects, and inputting the collected road images into a sample model to generate defect samples;
[0028] S2, divide the defect samples into training set and test set, and train the improved YOLOv8s model;
[0029] S3, collecting the road image to be detected and inputting it into the trained YOLOv8s model, and the feature extraction network in the YOLOv8s model extracts the features of the road image to be detected;
[0030] S4. The feature fusion network in the YOLOv8s model fuses the features of the road image to be detected;
[0031] S5, the object detection network in the YOLOv8s model performs defect detection;
[0032] The output network in S6 and YOLOv8s models outputs the detection results to complete the road defect detection.
[0033] Furthermore, in the feature extraction network, the C2f module in the YOLOv8s model is replaced by a C2f-faster-EMA module, the downsampling convolution module is replaced by a context-guided module, and the SPPF module is replaced by a simSPPF module, wherein the C2f-faster-EMA module includes a first CBS unit, a Split layer, a first EMA-faster unit, a second EMA-faster unit, a third EMA-faster unit, a Concat layer, and a second CBS unit connected in sequence, the Concat layer is also connected to the Split layer, the first EMA-faster unit, and the second EMA-faster unit, respectively, and the first CBS unit and the second CBS unit are both composed of a convolutional layer, a batch normalization layer, and an activation function connected in sequence.
[0034] Furthermore, in an embodiment of the present invention, the EMA-faster unit includes a partial convolution layer, a CBS unit, a 1×1 convolution layer and an EMA unit connected in sequence, and the partial convolution uses 1 / 4 of the input channels for convolution operation, while the remaining channels remain unchanged, which can improve the overall detection efficiency. A 1×1 convolution layer is set after the CBS unit to reduce the number of channels in the output of the CBS unit to the state before its expansion.
[0035] Furthermore, in an embodiment of the present invention, the feature extraction network includes 1 convolution layer, 4 context-guided modules, 4 C2f-faster-EMA modules and 1 simSPPF module, and the convolution layer, the first context-guided module, the first C2f-faster-EMA module, the second context-guided module, the second C2f-faster-EMA module, the third context-guided module, the third C2f-faster-EMA module, the fourth context-guided module, the fourth C2f-faster-EMA module, and the simSPPF module are connected in sequence, wherein the outputs of the second C2f-faster-EMA module, the third C2f-faster-EMA module, and the simSPPF module are connected to the feature fusion network;
[0036] The feature fusion network includes 4 C2f-faster-EMA modules, 4 Concat layers, 2 upsampling units, and 2 convolutional layers, among which the first upsampling unit, the first Concat layer, the fifth C2f-faster-EMA module, the second upsampling unit, the second Concat layer, the sixth C2f-faster-EMA module, the first convolutional layer, the third Concat layer, the seventh C2f-faster-EMA module, the second convolutional layer, the fourth Concat layer, and the eighth C2f-faster-EMA module are connected in sequence, the first upsampling unit and the fourth Concat layer are both connected to the simSPPF module, the first Concat layer is also connected to the third C2f-faster-EMA module, the second Concat layer is also connected to the second C2f-faster-EMA module, and the sixth C2f-faster-EMA module, the seventh C2f-faster-EMA module, and the eighth C2f-faster-EMA module are all connected to the target detection network.
[0037] Furthermore, the context guidance module includes a local feature extraction unit, a surrounding feature extraction unit, a joint feature extraction unit and a global context feature extraction unit. The local feature extraction unit and the surrounding feature extraction unit are connected to the joint feature extraction unit, and the joint feature extraction unit is connected to the global context feature extraction unit.
[0038] The local feature extraction unit learns local features from the surrounding 8 adjacent feature vectors. The surrounding feature extraction unit can effectively learn the surrounding context information. The joint feature extraction unit connects the features output by the local feature extraction unit and the surrounding feature extraction unit. The global context feature extraction unit performs weighted operations to obtain the final output features.
[0039] Furthermore, the simSPPF module includes a first CBR unit, a first Maxpool2d unit, a second Maxpool2d unit, a third Maxpool2d unit, a Concat layer and a second CBR unit connected in sequence. The Concat layer is also connected to the first Maxpool2d unit and the second Maxpool2d unit respectively. The first CBR unit and the second CBR unit are both composed of a convolutional layer, a batch normalization layer and an activation function connected in sequence.
[0040] Furthermore, the object detection network includes a scale-aware attention module, a space-aware attention module and a task-aware attention module.
[0041] Furthermore, the scale-aware attention module includes an Avgpool layer, a 1×1 convolutional layer, a ReLU activation function, and a Hardsigmoid activation function, which are connected sequentially.
[0042]
[0043] Where D L represents the scale-aware attention module, σ represents the Hardsigmoid activation function, and f represents a 1×1 convolutional layer.
[0044] Furthermore, the spatial perception attention module includes an Index layer, a 3×3 convolution layer, an Offset layer, and a Sigmoid activation function. The Index layer is connected to the 3×3 convolution layer, and the 3×3 convolution layer is connected to the Offset layer and the Sigmoid activation function, respectively.
[0045]
[0046] Where D S represents the spatial perception attention module,
[0047] Furthermore, the task-aware attention module includes an Avgpool layer, a first fully convolutional layer, a ReLU activation function, a second fully convolutional layer, and a Normalize layer, which are connected in sequence.
[0048] D C (F)·F=max(α 1 (F)·F C +β 1 (F),α2 (F)·F C +β 2 (F)
[0049] Where D C represents the task-aware attention module, α 1 , β 1 , α 2 , β 2 is a hyperfunction that controls the activation threshold.
[0050] Furthermore, in an embodiment of the present invention, the sample model adopts a generative adversarial network, whose basic framework is composed of a generator and a discriminator, wherein the generator can generate new sample data by learning the distribution of real data combined with input random noise, and the discriminator can distinguish whether the input sample is a real data sample or a network generated sample. The collected road images with different types of crack defects are input into the sample model, and multiple iterations are performed to obtain a large number of defect samples for subsequent training and verification of the improved YOLOv8s model.
[0051] Furthermore, after S6, it also includes:
[0052] S7. Conduct road defect analysis based on the type and severity of road defects to determine the degree of hazard.
[0053] Furthermore, in the embodiment of the present invention, the road defect types are divided into five types: cracks, block cracks, transverse cracks, longitudinal cracks, and potholes, and the defect type, defect area, and defect perimeter are used as evaluation indicators of the degree of hazard;
[0054] Different weights are set for defect types and their corresponding areas and perimeters. Specifically, the different consequences of each type of defect on road safety are determined, and an impact coefficient is assigned to each consequence according to the severity of all consequences. The actual impact coefficient of each type is calculated based on the impact coefficient assignment, and the defect type weight is calculated based on the actual impact coefficients of different types. Similarly, the weights of the area and perimeter corresponding to each defect type are calculated based on the impact coefficients of area and perimeter on different defects.
[0055] The calculation of the degree of harm is as follows:
[0056] Q=a(sw1+lw2)
[0057] Where Q is the hazard level evaluation score, a is the weight of different types of defects, s is the defect area, w1 is the weight corresponding to the area, l is the defect perimeter, and w2 is the weight corresponding to the perimeter.
[0058] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0059] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A road defect detection method based on an improved YOLOv8s model, characterized in that: The following steps are involved: S1, collecting road images with different types of crack defects, and inputting the collected road images into a sample model to generate defect samples; S2, divide the defect samples into training set and test set, and train the improved YOLOv8s model; S3, collecting the road image to be detected and inputting it into the trained YOLOv8s model, and the feature extraction network in the YOLOv8s model extracts the features of the road image to be detected; S4. The feature fusion network in the YOLOv8s model fuses the features of the road image to be detected; S5, the object detection network in the YOLOv8s model performs defect detection; The output network in S6 and YOLOv8s models outputs the detection results to complete the road defect detection.
2. A road defect detection method based on an improved YOLOv8s model according to claim 1, characterized in that: In the feature extraction network, the C2f module in the YOLOv8s model is replaced by the C2f-faster-EMA module, the downsampling convolution module is replaced by the context-guided module, and the SPPF module is replaced by the simSPPF module. The C2f-faster-EMA module includes a first CBS unit, a Split layer, a first EMA-faster unit, a second EMA-faster unit, a third EMA-faster unit, a Concat layer, and a second CBS unit connected in sequence. The Concat layer is also connected to the Split layer, the first EMA-faster unit, and the second EMA-faster unit, respectively. The first CBS unit and the second CBS unit are both composed of a convolutional layer, a batch normalization layer, and an activation function connected in sequence.
3. A road defect detection method based on an improved YOLOv8s model according to claim 2, characterized in that: The context guidance module includes a local feature extraction unit, a surrounding feature extraction unit, a joint feature extraction unit and a global context feature extraction unit. The local feature extraction unit and the surrounding feature extraction unit are connected to the joint feature extraction unit, and the joint feature extraction unit is connected to the global context feature extraction unit.
4. A road defect detection method based on an improved YOLOv8s model according to claim 2, characterized in that: The simSPPF module includes a first CBR unit, a first Maxpool2d unit, a second Maxpool2d unit, a third Maxpool2d unit, a Concat layer, and a second CBR unit connected in sequence. The Concat layer is also connected to the first Maxpool2d unit and the second Maxpool2d unit respectively. The first CBR unit and the second CBR unit are both composed of a convolutional layer, a batch normalization layer, and an activation function connected in sequence.
5. A road defect detection method based on an improved YOLOv8s model according to claim 1, characterized in that: The object detection network includes a scale-aware attention module, a space-aware attention module, and a task-aware attention module.
6. A road defect detection method based on an improved YOLOv8s model according to claim 5, characterized in that: The scale-aware attention module consists of an Avgpool layer, a 1×1 convolutional layer, a ReLU activation function, and a Hardsigmoid activation function, which are connected sequentially.
7. A road defect detection method based on an improved YOLOv8s model according to claim 5, characterized in that: The spatial perception attention module includes an Index layer, a 3×3 convolution layer, an Offset layer, and a Sigmoid activation function. The Index layer is connected to the 3×3 convolution layer, and the 3×3 convolution layer is connected to the Offset layer and the Sigmoid activation function respectively.
8. A road defect detection method based on an improved YOLOv8s model according to claim 5, characterized in that: The task-aware attention module consists of an Avgpool layer, a first fully convolutional layer, a ReLU activation function, a second fully convolutional layer, and a Normalize layer, which are connected sequentially.
9. A road defect detection method based on an improved YOLOv8s model according to claim 1, characterized in that: S6 and later also include: S7. Conduct road defect analysis based on the type and severity of road defects to determine the degree of hazard.
Citation Information
Cited By
Unmanned aerial vehicle small target detection method and device based on IASL-YOLO
CN119919837A
Unmanned aerial vehicle small target detection method and device based on iasl-yolo
CN119919837B
Road defect detection method and device, computer equipment and storage medium
CN120107231A
Unmanned missile loading vehicle road defect detection method and related device
CN121032954A