Crack defect detection method based on improved YOLOv8 model

By improving the YOLOv8 model, replacing the C2f module with a dynamic convolution layer and using Haar wavelet transformation, combined with the self-attention mechanism, the problems of insufficient model detection capabilities and feature interference are solved, and efficient and accurate crack detection is achieved.

CN119295391APending Publication Date: 2025-01-10NANJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 6 Cited by

Patent Information

Application Number
CN202411331117.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

In the crack detection, the detection capability is insufficient in the model scale, the parameter quantity and calculation cost are high when the model scale is increased, and the features extracted by traditional convolution kernels are easily interfering with information, ignoring the context information, affecting the detection accuracy.

Method used

The improved YOLOv8 model uses Haar wavelet transformation and Dyhead detection head to enhance feature correlation and context information utilization, and combines the self-attention mechanism to improve detection accuracy.

Benefits of technology

Without increasing the calculation cost, the detection accuracy and accuracy of the model are improved, information uncertainty is reduced, and the effect of crack detection is significantly improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119295391A_ABST
    Figure CN119295391A_ABST
Patent Text Reader

Abstract

The invention discloses a crack defect detection method based on an improved YOLOv8 model, and belongs to the technical field of target detection. The method comprises the steps of obtaining a crack common data set; performing data enhancement on the crack common data set, and dividing the crack common data set into a training set, a verification set and a test set according to a proportion; constructing a crack detection model of the improved YOLOv8 model; training and verifying the constructed crack detection model; and evaluating the final performance of the model through the four indexes. According to the invention, by modifying the Bottleneck structure of the C2f module, no extra FLOPs is brought; by adopting the HWD module, the relevance between the features is fully utilized, and more context information of the target object is reserved, so that other interference information mingled when the features are extracted by a convolution kernel is avoided, and the uncertainty of the information is effectively reduced; a Dyhead detection head is adopted to replace an original YOLOv8 detection head, a target detection head and attention are unified, the expression ability of the target detection head of the model is remarkably improved under the condition that the calculation amount is not increased, and the precision of the model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of target detection, and in particular relates to a crack defect detection method based on an improved YOLOv8 model. Background Art

[0002] Crack detection is of great significance in the fields of civil engineering, construction and transportation. With the acceleration of urbanization and the continuous expansion of infrastructure, the number of buildings and roads has increased rapidly. However, due to a variety of factors such as environmental changes, material aging and external loads, cracks will inevitably appear in structures such as walls and roads. These cracks not only affect the aesthetics of buildings and roads, but more importantly, they pose a threat to the safety and service life of the structure. Crack detection has therefore become a key link in ensuring structural safety and extending service life.

[0003] Traditional crack detection methods mainly rely on manual inspections. Although this method is direct, it has many shortcomings. First, manual inspection requires a lot of manpower and time, especially in the case of large areas or complex structures, and the efficiency is extremely low. Second, manual inspection is easily affected by subjective factors, and differences in experience and professional level between different inspectors may lead to differences in detection results. In recent years, with the rapid development of science and technology, especially the rise of computer vision and deep learning technology, target detection based on deep learning has gradually become a research hotspot. It is mainly divided into two categories. One is a two-stage target detection model based on candidate regions represented by MaskR-CNN, R-FCN, and Faster-RCNN; the RCNN detection model generates candidate regions in the first stage, and performs fine classification and bounding box regression on these regions in the second stage. This staged processing enables the model to locate and identify targets more accurately; the other is a single-stage target detection algorithm based on regression analysis represented by SSD and YOLO. The single-stage target detection model combines the candidate region generation and regression of target detection into a single process, reducing the calculation steps and requiring lower computing resources.

[0004] Although the above methods have made significant progress, they still have the following disadvantages: (1) When using the target detection algorithm for crack detection, if the model scale is small, the corresponding detection ability is also weak. However, as the model scale increases, the corresponding number of parameters and FLOPs will also increase. It is true that large pre-trained models can learn more diverse features and have better detection capabilities. However, applications on mobile devices usually require fast inference, and large pre-trained models are difficult to deploy due to high computational costs. (2) The YOLOv8 backbone network adopts the idea of ​​multi-scale feature fusion, but simple feature concatenation cannot fully utilize the correlation between features and will also introduce irrelevant information into the network, thereby ignoring the contextual information between features of different scales. The lost contextual information, such as crack boundaries, scales, and textures, is very important for accurate positioning in crack detection. (3) Limited by traditional standard convolution, its local features are often confined to square areas. However, cracks are usually long and narrow, and there are cracks with obvious scale differences in the crack image. Therefore, the features extracted by standard convolution are inevitably mixed with other interference information.

[0005] Therefore, how to solve the problem of other interfering information mixed in the features extracted by the convolution kernel, thereby improving the accuracy of the information obtained by the model is the technical problem that the present invention aims to solve. Summary of the invention

[0006] The purpose of the present invention is to provide a crack defect detection method based on an improved YOLOv8 model to solve the problems raised in the above background technology.

[0007] The object of the present invention is achieved by: a crack defect detection method based on an improved YOLOv8 model, characterized in that the method comprises the following steps:

[0008] Step S1: Obtain a public crack dataset;

[0009] Step S2: perform data enhancement on the public crack dataset and divide the crack dataset into a training set, a validation set, and a test set in proportion;

[0010] Step S3: construct a crack detection model of the improved YOLOv8 model;

[0011] Step S4: input the crack image data set produced in step S2 into the constructed crack detection model for training and verification, to obtain a trained crack detection network model;

[0012] Step S5: Test the effect of the trained model on the test set and evaluate the final performance of the model through four indicators.

[0013] Preferably, the step S1 of learning the potential representation of the brain sMRI image by image reconstruction comprises the following specific operations:

[0014] In step S2, data enhancement is performed on the crack public dataset, specifically:

[0015] The crack defect dataset is augmented by random cutting, flipping and rotation operations, and the dataset is processed by mosaic data enhancement. Mosaic data enhancement stitches four images together through rotation, scaling, translation and other operations to form a new image data; the original length and width of the image are scaled to h*640 pixel resolution or 640*w pixel resolution in the same proportion using an adaptive image scaling method, where h and w are both less than or equal to 640 pixels. Images with h and w less than 640 pixels are complemented to a uniform size of 640*640 by adding black borders.

[0016] Preferably, the crack detection model includes a C2f_DynamicConv module, which is a module that combines all C2f modules in the original YOLOv8 model;

[0017] Replace all C2f modules in the backbone network and neck structure of the original YOLOv8 model with C2f_DynamicConv modules.

[0018] Preferably, the C2f_DynamicConv module is constructed by replacing the second convolution operation in the Bottleneck structure of the C2f module with a dynamic convolution layer, and the output calculation formula of the dynamic convolution layer is:

[0019] Y=X*W ′ ;

[0020] in, is the parameter of the i-th dynamic convolution kernel, α i is the corresponding dynamic coefficient, which is dynamically generated with different inputs, and the calculation formula is:

[0021] α = softmax(MLP(Pool(X)));

[0022] Among them, X is the input feature, MLP (Pool (X)) performs a pooling operation on the input feature X to obtain low-dimensional features, and then passes these low-dimensional features to MLP;

[0023] The C2f_DynamicConv module performs HWD processing, and replaces the ordinary convolutional layer with the HWD module at positions P3 / 8, P4 / 16, and P5 / 32;

[0024] The HWD module includes a lossless feature encoding block and a feature learning representation block. The lossless feature encoding block uses Haar wavelet transform to reduce the spatial resolution of the feature map while retaining all information;

[0025] When Haar wavelet transform is used to describe the image decomposition process with a resolution of H×W, H 0 and H 1 They represent low-pass and high-pass decomposition filters respectively, which are used to extract low-frequency and high-frequency information from the image respectively. The symbol ↓2 represents downsampling.

[0026] Preferably, the Haar wavelet transform generates four components: a low frequency component (A) and high frequency components of a horizontal component (H), a vertical component (V) and a diagonal component (D);

[0027] The size of each component is The resolution of each component is also reduced to The Haar wavelet transform encodes part of the information in the spatial dimension into the channel dimension without losing any information; the low-frequency component and the three high-frequency components are then concatenated along the channel dimension to form a new tensor, and the subsequent convolutional layer extracts features from the resulting components to reduce the spatial resolution;

[0028] The feature learning representation block adjusts the number of channels of the feature map through 1×1 standard convolution, batch normalization layer and SILU activation function to align with the subsequent layers and filter redundant information, so that the subsequent layers can learn features more effectively.

[0029] Preferably, the crack detection model adds a Dyhead module before the second convolution operation of the head prediction part in the original YOLOv8 model, and its scale-aware attention calculation formula is:

[0030]

[0031] Among them, F is the feature tensor, f(·) is a linear function, and σ(x) is an activation function;

[0032] The calculation formula of its spatial perception attention is:

[0033]

[0034] Where K is the number of sparse sampling locations, p k +Δp k is the convolution kernel offset learned by deformable convolution, Δm k For position p k The self-learning importance scalar of ;

[0035] The calculation formula of its task-aware attention is:

[0036] π C (F)·F=max(α 1 (F)·F c +β 1 (F),α 2 (F)·F c +β 2 (F));

[0037] Among them, F C is the feature slice of the Cth channel.

[0038] Preferably, in step S4, the crack image data set is input into the constructed network model for training and verification to obtain a trained crack detection network model, specifically:

[0039] Starting from the first training cycle of the crack detection network model, the Adam optimizer was used in the early stage for fast convergence, and the learning rate was set to 0.01; when the validation set loss did not decrease for a long time, the subsequent training adopted stochastic gradient descent optimization;

[0040] Before switching to stochastic gradient descent optimization, gradually reduce the learning rate of Adam through the learning rate scheduler to ensure that Adam does not produce too large updates in the later stages of training, making the switch smoother;

[0041] When switching to stochastic gradient descent optimization, the learning rate is set to 0.001, the momentum is set to 0.937, the weight decay coefficient is 0.0005, the training batch size is 16, and training is continued until the model training epoch reaches 400.

[0042] Compared with the prior art, the present invention has the following improvements and advantages:

[0043] 1. By modifying the Bottleneck structure of the C2f module, the Bottleneck is replaced with dynamic convolution without reducing the detection accuracy, which increases the number of parameters without bringing additional FLOPs; by adopting the HWD module, the correlation between features is fully utilized and more contextual information of the target object is retained, avoiding other interference information when the convolution kernel extracts features, effectively reducing the uncertainty of information and improving the accuracy of the model.

[0044] 2. By replacing the original detection head of YOLOv8 with the Dyhead detection head, the Dyhead detection head unifies the target detection head and attention, and realizes scale perception, spatial perception and task perception by coherently combining multiple self-attention mechanisms between feature levels, between spatial positions and within output channels. It significantly improves the expressiveness of the model's target detection head without increasing the amount of computation and improves the accuracy of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 The figure is an overall flow chart of the method of the present invention.

[0046] Figure 2 This is a partial structural diagram of the improved neck structure.

[0047] Figure 3 This is the structure diagram of the improved C2f_DynamicConv module.

[0048] Figure 4 This is a diagram of the dynamic convolution structure used in the present invention.

[0049] Figure 5 Schematic diagram of the new convolution kernel calculation of the HWD module used in the present invention.

[0050] Figure 6 This is a schematic diagram of the head prediction part used in the present invention.

[0051] Figure 7 This is a structural diagram of the head prediction part used in the present invention.

[0052] Figure 8 This is a comparison chart of the crack detection effects of the model of the present invention and the YOLOv3 model.

[0053] Fig. 9 This is a comparison chart of the crack detection effects of the model of the present invention and the YOLOv5 model.

[0054] Fig.10 This is a comparison chart of the crack detection effects of the model of the present invention and the YOLOv6 model.

[0055] Fig.11 This is a comparison chart of the crack detection effects of the model of the present invention and the YOLOv8 model.

[0056] Fig.12 This is a comparison chart of the crack detection effects of the invented model and the YOLOv9 model.

[0057] Fig.13 This is a comparison chart of the crack detection effects of the model of the present invention and the YOLOv10 model. DETAILED DESCRIPTION

[0058] The present invention is further summarized below with reference to the accompanying drawings.

[0059] like Figure 1 As shown, a crack defect detection method based on an improved YOLOv8 model comprises the following steps:

[0060] Step S1: Obtain a public crack dataset;

[0061] The method of the present invention obtains three public data sets, including CFD data set, Crack-2 data set, and Crack500 data set; the CFD data set consists of 146 images with a size of 480×320, and all images have manually marked real crack contours; the background of the data set is complex, including shadows, oil spots, water stains and zebra crossings.

[0062] The Crack-2 dataset contains a total of 1551 static images captured from various road and wall scenes, with an image size of approximately 416×416 pixels.

[0063] The Crack-500 dataset is specifically designed for detecting and identifying concrete cracks. It contains 2493 images and corresponding pixel-level annotations with an image resolution of 2000×1500. These images are from different concrete structures and are taken at different angles and lighting conditions. Therefore, the dataset contains crack images under shadows, occlusions, and different lighting conditions.

[0064] Step S2: perform data enhancement on the public crack dataset and divide the crack dataset into a training set, a validation set, and a test set in proportion;

[0065] The data enhancement for the crack public dataset is as follows:

[0066] The crack defect dataset is augmented by random cutting, flipping and rotation operations, and the dataset is processed by mosaic data enhancement. Mosaic data enhancement stitches four images together through rotation, scaling, translation and other operations to form a new image data; the original length and width of the image are scaled to h*640 pixel resolution or 640*w pixel resolution in the same proportion using an adaptive image scaling method, where h and w are both less than or equal to 640 pixels, and images with h and w less than 640 pixels are complemented to a uniform size of 640*640 by adding black borders; and the dataset is divided into training set, validation set and test set in a ratio of 7:2:1.

[0067] Step S3: construct a crack detection model of the improved YOLOv8 model;

[0068] The original YOLOv8 model consists of three main modules, namely the backbone network, the neck network and the head network; the backbone network includes a series of convolutional layers, C2f modules and residual connections, and the C2f module includes CBS blocks (convolution, batch normalization, activation function); the backbone network is responsible for extracting multi-level features from the input image for use by the subsequent neck module.

[0069] The neck network uses a combination of feature pyramid network and path aggregation network, both of which include C2f modules; the neck network fuses and optimizes the multi-scale features from the backbone network, and then passes the feature map to the head network. The head network contains multiple detection layers, which predict the fused feature map from the neck network at each scale, including the location of the target bounding box, target classification and confidence estimation, and finally generates the detection result;

[0070] The C2f module of the original YOLOv8 model first consists of a convolutional block that receives the input feature map and generates an intermediate feature map. The generated intermediate feature map is split into two parts, one part is directly passed to the final Concat block, and the other part is passed to multiple Bottleneck blocks for further processing. The feature maps input to these Bottleneck blocks are processed through a series of convolution, normalization, and activation operations, and the final feature map is concatenated with the directly passed feature map in the Concat block. The concatenated feature map is input to a final convolutional block for further processing to generate the final output feature map. In the detection head module of the head network, after the feature map of the input detection head is operated by two convolutional blocks, the track for bounding box prediction outputs a Conv2d layer to obtain the bounding box loss; the track for category prediction outputs a Conv2d layer to obtain the category loss.

[0071] like Figure 2 As shown, the C2f modules in the backbone network and neck structure of the original YOLOv8 model are replaced with all C2f modules of the C2f_DynamicConv module;

[0072] The C2f_DynamicConv module is constructed by replacing the second convolution operation in the Bottleneck structure of the C2f module with a dynamic convolution layer. The output calculation formula of the dynamic convolution layer is:

[0073] Y=X*W ′ ;

[0074] in, is the parameter of the i-th dynamic convolution kernel, α i is the corresponding dynamic coefficient, which is dynamically generated with different inputs. The general method is based on the input generation of the MLP module; Figure 4 As shown, the MLP module applies compression and excitation modules to calculate the kernel attention weights {α M}; The global spatial information is first compressed and fused into a vector by global average pooling; then two fully connected layers (with a ReLU layer in the middle) and softmax are used to generate normalized attention weight coefficients for the M convolution kernels, calculated as:

[0075] α = softmax(MLP(Pool(X)));

[0076] Among them, α∈R M , X is the input feature, MLP (Pool (X)) performs a pooling operation on the input feature X to obtain low-dimensional features, and then passes these low-dimensional features to MLP;

[0077] like Figure 3 As shown in the figure, the DynamicBottleneck module is used to replace the Bottleneck module in C2f, and the DynamicConv_C2f module is proposed to replace all C2f modules in the original YOLOv8 algorithm. In the DynamicConv_C2f module, the feature map is first input into the convolution block. The convolution block generates an intermediate feature map after extracting the basic features of the input image. The intermediate feature map is divided into two parts after passing through the Split layer. One part is directly passed to the Concat block, and the other is passed as input to the serial DynamicBottleneck module. After dynamic convolution processing in n DynamicBottleneck modules, the finally generated feature map is spliced ​​and fused with the directly transmitted feature map in the Concat block, so that the model can comprehensively utilize multi-scale and multi-level information.

[0078] like Figure 5 As shown in the figure, HWD processing is performed after the C2f_DynamicConv module. The HWD module replaces the ordinary convolution layer at positions P3 / 8, P4 / 16, and P5 / 32. The HWD module consists of two main blocks. One is the lossless feature encoding block, and the other is the feature learning representation block. The lossless feature encoding block uses Haar wavelet transform to effectively reduce the spatial resolution of the feature map while retaining all the information. When using Haar wavelet transform to describe the image decomposition process with a resolution of H×W, H 0 and H 1 Represent low-pass and high-pass decomposition filters, respectively, which are used to extract low-frequency and high-frequency information from the image, respectively. The symbol ↓2 represents downsampling. The Haar wavelet transform thus produces four components: a low-frequency component (A), and high-frequency components in the horizontal (H), vertical (V), and diagonal (D) directions. The size of each component is The resolution of each component is also reduced to The number of channels in the feature map has become four times the original number, which means that the Haar wavelet transform can encode part of the information in the spatial dimension into the channel dimension without losing any information. The low-frequency component and the other three high-frequency components are then concatenated along the channel dimension to form a new tensor. The subsequent convolutional layer can extract features from the resulting components, thereby reducing the spatial resolution. The lossless feature encoding block can capture more detailed information in the scale feature map, especially the edge and texture features in the image, thereby improving the accuracy and robustness of crack detection. The feature learning block aims to adjust the number of channels of the feature map to align with the subsequent layers through 1×1 standard convolution, batch normalization layer and SILU activation function, and filter redundant information as much as possible, so that the subsequent layers can learn features more effectively.

[0079] like Figure 7 As shown in , the Dyhead module is added before the second convolution operation of the head prediction part in the original YOLOv8 model; Figure 6 As shown, the scale-aware attention calculation formula is:

[0080]

[0081] Among them, F is the feature tensor, f(·) is a linear function, and σ(x) is an activation function;

[0082] The calculation formula of its spatial perception attention is:

[0083]

[0084] Where K is the number of sparse sampling locations, p k +Δp k is the convolution kernel offset learned by deformable convolution, Δm k For position p k The self-learning importance scalar of ;

[0085] The calculation formula of its task-aware attention is:

[0086] π C (F)·F=max(α 1 (F)·F c +β 1 (F),α 2 (F)·F c +β 2 (F));

[0087] Among them, F C is the feature slice of the Cth channel.

[0088] Step S4: Input the crack image data set produced in step S2 into the constructed network model for training and verification to obtain a trained crack detection network model, specifically:

[0089] The preprocessed crack data set was input into the improved network for 400 iterations of training; starting from the first training cycle of the model, the Adam optimizer was used in the early stage for fast convergence, and the learning rate was set to 0.01. Since the Adam optimizer performs well in processing high-dimensional sparse gradients, it can help the model quickly learn effective feature representations. When the validation set loss does not decrease for a long time, the subsequent training uses stochastic gradient descent optimization. Before switching to stochastic gradient descent optimization, the learning rate of Adam is gradually reduced through the learning rate scheduler to ensure that Adam does not generate too large updates in the later stage of training, so as to make the switching smoother. When switching to stochastic gradient descent optimization, the learning rate is set to 0.001, the momentum is set to 0.937, the weight decay coefficient is 0.0005, the training batch size is 16, and the training is continued until the model training rounds reach 400. At the same time, in order to obtain the best generalization ability and prevent overfitting, the early stopping method is introduced in the training process.

[0090] Step S5: Test the effect of the trained model on the test set and evaluate the final performance of the model through four indicators.

[0091] In order to verify the superiority of the present invention over other advanced target detection algorithms, the present invention adds a comparative experiment to compare the model of the present invention with YOLOv3 ( Figure 8 )、YOLOv5( Fig. 9 )、YOLOv6( Fig.10 )、YOLOv8( Fig.11 )、YOLOv9( Fig.12 )、YOLOv10( Fig.13 ), SSD, and Faster-RCNN models were compared on the same device and three data sets. The comparison of the detection effect data on the Crack500 data set is shown in Table 1:

[0092] algorithm P / % R / % mAP50 / % mAP50:95 / % F1 / % GFLOPs YOLOv3-tiny 81.8 69.7 76.5 55.5 75 19 YOLOv5 81.9 69.4 78.1 55.2 75 7.2 YOLOv6 83.5 69.5 76.7 54.7 76 11.9 YOLOv8 81.2 70.4 77.3 54.8 75 8.1 YOLOv9 88 77.2 85.9 65.7 82 7.8 YOLOv10 87.5 71.8 82.6 62.2 79 8.4 SSD 75.4 60.5 70.6 50.4 67 62.4 Faster-RCNN 78.2 70.1 74.9 54.8 74 370.1 Model of the present invention 90.2 84.9 91.1 73.5 88 8

[0093] As shown in Table 1, the average accuracy of the model of the present invention is the highest, reaching 91.1%, the precision is 90.2%, the recall rate is 84.9%, and the floating point operation volume is only 8G. Compared with other series of YOLO detection algorithms and SSD and Faster-RCNN detection algorithms, the performance is better, and a trade-off is achieved between detection accuracy and calculation volume. From any perspective, it fully demonstrates the superiority of the network model proposed in the present invention in the crack image detection task.

[0094] like Figure 8 , 9 As shown in , 10, 11, 12, and 13, it can be seen from the figures that for small and narrow cracks such as transverse cracks and longitudinal cracks, the confidence of the prediction frame of the model of the present invention is the best, which is better than other models. For large cracks with irregular shapes, as shown in the second row of images, the model of the present invention can accurately divide the size of the prediction frame according to the label, paving the way for subsequent crack parameter extraction, and the prediction frame confidence is the highest. It can be seen that the model of the present invention can achieve relatively excellent detection results when processing various types of cracks.

[0095] The above description is only an embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims

1. A crack defect detection method based on an improved YOLOv8 model, characterized in that: The method comprises the following steps: Step S1: Obtain a public crack dataset; Step S2: perform data enhancement on the public crack dataset and divide the crack dataset into a training set, a validation set, and a test set in proportion; Step S3: construct a crack detection model of the improved YOLOv8 model; Step S4: input the crack image data set produced in step S2 into the constructed network model for training and verification, to obtain a trained crack detection network model; Step S5: Test the effect of the trained model on the test set and evaluate the final performance of the model through four indicators.

2. A crack defect detection method based on an improved YOLOv8 model according to claim 1, characterized in that: In step S2, data enhancement is performed on the crack public dataset, specifically: The crack defect dataset is augmented by random cutting, flipping and rotation operations, and the dataset is processed by mosaic data enhancement. Mosaic data enhancement stitches four images together through rotation, scaling, translation and other operations to form a new image data; the original length and width of the image are scaled to h*640 pixel resolution or 640*w pixel resolution in the same proportion using an adaptive image scaling method, where h and w are both less than or equal to 640 pixels. Images with h and w less than 640 pixels are complemented to a uniform size of 640*640 by adding black borders.

3. A crack defect detection method based on an improved YOLOv8 model according to claim 1, characterized in that: The crack detection model includes a C2f_DynamicConv module, which is a module that converts all C2f modules in the original YOLOv8 model; Replace all C2f modules in the backbone network and neck structure of the original YOLOv8 model with C2f_DynamicConv modules.

4. A crack defect detection method based on an improved YOLOv8 model according to claim 3, characterized in that: The C2f_DynamicConv module is constructed by replacing the second convolution operation in the Bottleneck structure of the C2f module with a dynamic convolution layer. The output calculation formula of the dynamic convolution layer is: Y=X*W ′ ; in, is the parameter of the i-th dynamic convolution kernel, α i is the corresponding dynamic coefficient, which is dynamically generated with different inputs, and the calculation formula is: α = softmax(MLP(Pool(X))); Among them, X is the input feature, MLP (Pool (X)) performs a pooling operation on the input feature X to obtain low-dimensional features, and then passes these low-dimensional features to MLP; The C2f_DynamicConv module performs HWD processing, and replaces the ordinary convolutional layer with the HWD module at positions P3 / 8, P4 / 16, and P5 / 32; The HWD module includes a lossless feature encoding block and a feature learning representation block. The lossless feature encoding block uses Haar wavelet transform to reduce the spatial resolution of the feature map while retaining all information; When Haar wavelet transform is used to describe the image decomposition process with a resolution of H×W, H0 and H1 represent low-pass and high-pass decomposition filters, respectively. These two filters are used to extract low-frequency and high-frequency information from the image, respectively. The symbol ↓2 represents downsampling.

5. A crack defect detection method based on an improved YOLOv8 model according to claim 4, characterized in that: The Haar wavelet transform generates four components: a low-frequency component (A) and high-frequency components in the horizontal (H), vertical (V) and diagonal directions (D); The size of each component is The resolution of each component is also reduced to The Haar wavelet transform encodes part of the information in the spatial dimension into the channel dimension without losing any information; the low-frequency component and the three high-frequency components are then concatenated along the channel dimension to form a new tensor, and the subsequent convolutional layer extracts features from the resulting components to reduce the spatial resolution; The feature learning representation block adjusts the number of channels of the feature map through 1×1 standard convolution, batch normalization layer and SILU activation function to align with the subsequent layers and filter redundant information, so that the subsequent layers can learn features more effectively.

6. The crack defect detection method based on the improved YOLOv8 model according to claim 1, characterized in that: The crack detection model adds a Dyhead module before the second convolution operation of the head prediction part in the original YOLOv8 model, and its scale-aware attention calculation formula is: Among them, F is the feature tensor, f(·) is a linear function, and σ(x) is an activation function; The calculation formula of its spatial perception attention is: Where K is the number of sparse sampling locations, p k +Δp k is the convolution kernel offset learned by deformable convolution, Δm k For position p k The self-learning importance scalar of ; The calculation formula of its task-aware attention is: p C (F)·F=max(α 1 (F)·F c +b 1 (F),a 2 (F)·F c +b 2 (F)); Among them, F C is the feature slice of the Cth channel.

7. The crack defect detection method based on the improved YOLOv8 model according to claim 1, characterized in that: In step S4, the crack image data set is input into the constructed network model for training and verification to obtain a trained crack detection network model, which is specifically: Starting from the first training cycle of the crack detection network model, the Adam optimizer was used in the early stage for fast convergence, and the learning rate was set to 0.01; when the validation set loss did not decrease for a long time, the subsequent training adopted stochastic gradient descent optimization; Before switching to stochastic gradient descent optimization, gradually reduce the learning rate of Adam through the learning rate scheduler to ensure that Adam does not produce too large updates in the later stages of training, making the switch smoother; When switching to stochastic gradient descent optimization, the learning rate is set to 0.001, the momentum is set to 0.937, the weight decay coefficient is 0.0005, the training batch size is 16, and training is continued until the model training epoch reaches 400.

Citation Information

Cited By

  • Digital printing defect detection method based on lightweight network

    CN120411118A

  • A digital printing defect detection method based on lightweight network

    CN120411118B

  • Mixed concrete surface crack segmentation method, system and device and medium

    CN122049872A

  • A method, system, device and medium for crack segmentation on concrete surface

    CN122049872B

  • Road defect detection method based on YOLO-MSD

    CN122368057A