Method, system and equipment for dynamically detecting apparent diseases of concrete based on YOLOv8 improved model and medium

By building an improved YOLOv8 model and utilizing multi-branch downsampling, dynamic upsampling, and attention mechanisms to optimize the YOLOv8 model, the problems of missed detection and false detection in complex texture and multi-scale defect detection were solved, achieving efficient and accurate detection of concrete surface defects.

CN120673260APending Publication Date: 2025-09-19XIAN UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510817860.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

The existing YOLOv8 model has the problem of missed detection and false detection when dealing with complex textures and multi-scale defects, and its detection accuracy and stability are insufficient, making it difficult to meet the real-time detection needs of concrete buildings.

Method used

An improved YOLOv8 model is constructed. By combining data augmentation and transfer learning with the multi-branch downsampling module MBDM, the dynamic upsampling module DUM, and the SPPF-Attention module that introduces the attention mechanism LSKA, the network structure is optimized to improve detection accuracy and stability.

Benefits of technology

It significantly improves the ability to identify small target defects, enhances detection accuracy and stability, meets the real-time detection needs of concrete buildings, reduces missed detection rates, and improves detection efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120673260A_ABST
    Figure CN120673260A_ABST
Patent Text Reader

Abstract

The invention provides a concrete apparent disease dynamic detection method, system and device based on a YOLOv8 improved model and a medium, and belongs to the technical field of computer vision detection.The method comprises the steps that concrete apparent disease images are collected, data enhancement is conducted on the disease images, the position and category of the disease are marked through a marking tool, and the position and category of the disease are marked; obtaining a disease image data set; a YOLOv8 model is improved, the disease image data set is input into the YOLOv8 improved model, network parameters are initialized through transfer learning, and an SGD optimizer is adopted to train a training set part in the concrete disease data set in stages; and inputting the concrete apparent disease image into the YOLOv8 improved model so as to monitor, position and classify the concrete apparent disease area. The method effectively improves the detection precision and detection efficiency of concrete apparent diseases, and especially has significant advantages in a dense disease scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer vision detection technology, and specifically relates to a method, system, equipment and medium for dynamic detection of concrete surface defects based on an improved YOLOv8 model. Background Art

[0002] Concrete, due to its high strength, durability, and ease of molding, is widely used in modern construction and infrastructure projects. However, over time, concrete structures are susceptible to environmental erosion and other factors, resulting in surface defects such as cracks, corrosion, weathering, spalling, and exposed rebar. These defects not only affect the safety and durability of the structure but also complicate subsequent maintenance and repair. Therefore, efficient and accurate detection of concrete surface defects has become a key research focus in the intelligent operation and maintenance of concrete construction projects.

[0003] Traditional defect detection methods rely on manual inspections, which are labor-intensive, subjective, and inefficient. With the development of deep learning technology, object detection algorithms have been widely used in the field of concrete building structural health monitoring. The YOLO series of networks, as a typical single-stage object detection model, is suitable for real-time detection tasks in practical engineering due to its fast detection speed and high positioning accuracy. However, the original YOLOv8 architecture can miss or misdetect objects with complex textures, densely packed objects, or when dealing with defects with large scale variations, and still faces bottlenecks in accuracy and stability.

[0004] Therefore, how to structurally optimize the network based on YOLOv8 to improve the perception ability, detection accuracy, and detection stability of multi-scale disease characteristics is a technical problem that needs to be solved urgently. Summary of the Invention

[0005] The purpose of the present invention is to address the above-mentioned problems and provide a method, system, device and medium for dynamic detection of concrete surface defects based on an improved YOLOv8 model: In a first aspect, an embodiment of the present invention provides a method for dynamic detection of concrete surface defects based on an improved YOLOv8 model, comprising the following steps: S1. Collect concrete surface defect images, including five types of surface defect images: cracks, weathering, exposed reinforcement, corrosion, and spalling; S2. Perform data augmentation on the collected disease images and use annotation tools to label the locations and categories of the diseases to obtain a disease image dataset; S3. Build an improved YOLOv8 model, which includes a multi-branch downsampling module MBDM, a dynamic upsampling module DUM, and an SPPF-Attention module that introduces an attention mechanism LSKA; S4. Input the training set of disease image data into the YOLOv8 improved model, perform transfer learning and initialize network parameters, and use the SGD optimizer to train the YOLOv8 improved model for disease detection in stages; S5. Input the real-time concrete surface defect image into the trained YOLOv8 improved model to monitor, locate, and classify the areas of concrete surface defects.

[0006] Furthermore, the specific steps of step S2 are: S21. Perform data enhancement processing, including rotation, scaling, grayscale transformation, blur enhancement, and random cropping; S22. Use a labeling tool to label the location and category of the disease to obtain a disease image dataset, and divide the disease image dataset into a training set and a test set in a ratio of 9:1.

[0007] Furthermore, the specific steps of step S3 are: S31. Construct a multi-branch downsampling structure in the original Backbone downsampling path, use convolution kernels of different sizes to capture local and global features, and construct a multi-branch downsampling module MBDM; S32. Based on bilinear interpolation and dynamic weight allocation mechanism, a dynamic upsampling module DUM is constructed; S33. Based on the spatial pyramid pooling SPPF module, the LSKA attention mechanism is introduced to construct the SPPF-Attention module with the LSKA attention mechanism.

[0008] Furthermore, in step S31, the multi-branch downsampling module MBDM includes three parallel convolution branches and a feature fusion compression unit; Among them, the first convolution branch is the MaxPool branch, which includes a 1×1 convolution layer and a maximum pooling layer with a kernel size of 3×3. The 1×1 convolution layer is used to perform preliminary channel compression on the input feature map; the maximum pooling layer is used to extract the maximum value within the local receptive field of the input feature map; The second convolution branch is the AvgPool branch, which includes a 1×1 convolution layer and an average pooling layer Avg Pooling. The average pooling layer Avg Pooling is used to average the pixel values ​​in the local receptive field of the input feature map. The third convolution branch is a dilated convolution branch, which includes a 3×3 dilated convolution layer. The 3×3 dilated convolution layer is used to capture global context information by expanding the receptive field and enhance the understanding of the input feature map. The feature fusion compression unit is used to splice three parallel convolution branches and perform channel compression on the three spliced ​​parallel convolution branches through a 1×1 convolution layer to integrate effective information and improve network computing efficiency.

[0009] Furthermore, the specific steps of step S32 are: S321. Estimate the value of the new pixel by bilinear interpolation of the four neighboring pixels around the target pixel of the input feature map, and perform linear interpolation weighted average estimation in both horizontal and vertical directions to generate the value of the new pixel; S322. Perform weight enhancement and structural reconstruction on the input feature map to enhance the response of the diseased area; S323. Assigning differentiated weights to cracks, weathering, exposed reinforcement, corrosion, and spalling features in different regions of the input feature map; S324. Perform pixel shuffling on the input feature map, and dynamically generate the offset of the shuffled pixels at the sampling point. The calculation formula is:

[0010] Where, f (·) is the offset generation function, which uses multiple convolutional layers and nonlinear activation SiLU structure. X is the feature vector of the input feature map, θ is the weight of features in different regions of the input feature map; Offset (x,y) is the offset at the two-dimensional coordinates (x,y) of the sampling point.

[0011] Furthermore, the specific steps of step S33 are: S331. Perform channel compression on the input feature map through a 1×1 convolutional layer to reduce the feature dimension. The operation step is 1 and the padding is 0. Only the number of channels is changed without affecting the spatial dimension. S332. Using three parallel max pooling paths, each using three max pooling layers with different kernel sizes and increasing number of layers, with a step size of 1 for each pooling layer, and performing zero padding to obtain a pooled feature map to maintain the spatial dimension of the input feature map unchanged; S333. Concatenate the pooled feature map and the compressed feature map in the channel dimension, and fuse the channel information through a 1×1 convolution layer to construct a multi-scale fused feature map, and perform channel fusion on the multi-scale fused feature map through a 1×1 convolution layer; S334. The LSKA attention mechanism is introduced into the fusion feature map, and a large-core separable convolution structure is adopted to capture long-range dependencies in the horizontal and vertical directions respectively, and enhance the high perception capability with low computational complexity through series or parallel connections.

[0012] Furthermore, the specific steps of step S4 are: S41. In the model initialization phase, initial parameters are set and all training images are uniformly resized to a preset input resolution size before being input into the network; S42. Use the YOLOv8 composite loss function, which consists of three parts: bounding box loss, used to regress the predicted box position and size; target confidence loss, used to determine whether the target exists; and category classification loss, used to distinguish the disease type. S43. The SGD optimizer is used for parameter update, and the initial learning rate is set to 0.0001. During training, the batch size is set to 32, and the entire training cycle is set to 300 epochs. A phased freezing strategy is used for transfer learning. In the first 100 epochs of the initial training, the backbone network weights are frozen, and the Neck structure and Head part are trained; in the next 200 epochs, the entire network weights are unfrozen. Through full training, deep fine-tuning of model parameters is achieved, further improving the overall performance of the model in the task.

[0013] In a second aspect, an embodiment of the present invention further provides a system for dynamic detection of concrete surface defects based on an improved YOLOv8 model, comprising: Image acquisition module, used to collect concrete surface defect images, including five types of surface defect images: cracks, weathering, exposed reinforcement, corrosion, and spalling; The preprocessing module performs data enhancement on the collected disease images and uses annotation tools to mark the location and category of the diseases to obtain a disease image dataset; A model building module is used to build an improved YOLOv8 model. The improved YOLOv8 model includes a multi-branch downsampling module MBDM, a dynamic upsampling module DUM, and an SPPF-Attention module that introduces an attention mechanism LSKA. A model training module inputs the training set of the disease image data into the YOLOv8 improved model, performs transfer learning and initializes network parameters, and uses an SGD optimizer to train the YOLOv8 improved model's adaptability to disease detection in stages; The dynamic detection module is used to input real-time concrete surface defect images into the trained YOLOv8 improved model to monitor, locate and classify areas of concrete surface defects.

[0014] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of the method for dynamic detection of concrete surface defects based on the improved YOLOv8 model as described in the first aspect are implemented.

[0015] In a fourth aspect, an embodiment of the present invention further provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for dynamic detection of concrete surface defects based on the improved YOLOv8 model as described in the first aspect.

[0016] It can be seen from the above technical solutions that this application has the following advantages: The multi-branch downsampling module samples input features from different scales and angles to capture rich and diverse feature information; the dynamic upsampling module adaptively performs upsampling operations based on the characteristics of the down-sampled features to achieve accurate feature recovery and fusion. The two work together to enhance the richness of feature expression and the effect of feature fusion, thereby improving detection accuracy. The SPPF-Attention module, which introduces the attention mechanism LSKA, can prevent the model from ignoring small targets due to relatively weak feature information when facing small targets, enabling the model to keenly capture the characteristics of small defect targets, improve its response capability to small targets, and significantly enhance the model's recognition ability for small targets. The improved YOLOv8 model constructed by the present invention retains the original lightweight characteristics of YOLOv8. While ensuring the model has powerful detection capabilities, it effectively controls the number of model parameters and computational complexity. This enables the model to quickly process image data during operation, meeting the urgent need for real-time identification of concrete defects in the engineering field. Whether it is immediate detection at the construction site or in a long-term monitoring system, it can quickly provide detection results and improve work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solution of the present invention, the following is a brief introduction to the drawings required for the description. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 The figure is a flow chart of the method for dynamic detection of concrete surface defects based on the improved YOLOv8 model of the present invention.

[0019] Figure 2 Schematic diagram of the system for dynamic detection of concrete surface defects based on the improved YOLOv8 model of the present invention. DETAILED DESCRIPTION

[0020] The various embodiments of the present invention will be described more fully below in detail in the specific steps of the method for dynamic detection of concrete surface defects based on the improved YOLOv8 model. The present invention can have various embodiments, and adjustments and changes can be made therein. However, it should be understood that there is no intention to limit the various embodiments of the present invention to the specific embodiments disclosed herein, and the present invention should be understood to cover all adjustments, equivalents, and / or alternatives falling within the spirit and scope of the various embodiments of the present invention.

[0021] In order to make the purpose, features, and advantages of the present invention more obvious and easy to understand, the technical solutions protected by the present invention will be clearly and completely described below using specific embodiments and drawings. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0022] See also Figure 1 FIG. 1 is a flow chart of a method for dynamic detection of concrete surface defects based on an improved YOLOv8 model in a specific embodiment. The method includes the following steps: S1. Collect concrete surface defect images, including five types of surface defect images: cracks, weathering, exposed reinforcement, corrosion, and spalling; It should be noted that by collecting images of five types of concrete surface defects, a dataset covering multiple scenes and different lighting conditions can be constructed. After annotation and enhancement, sufficient samples are provided for the model, enabling the improved YOLOv8 model to learn the characteristics of various defects, improve detection comprehensiveness, adapt to multiple scenes such as bridges and tunnels, reduce missed detections and false detections, and enhance the model's generalization ability. S2. Perform data augmentation on the collected disease images and use annotation tools to label the locations and categories of the diseases to obtain a disease image dataset; It should be noted that data augmentation of disease images can expand sample diversity, improve the model's adaptability to different lighting and angles, and reduce overfitting. Using labelimg to accurately annotate locations and categories creates a clearly structured disease image dataset, which is divided into training and test sets at a 9:1 ratio. This provides the model with high-quality training samples, ensuring detection accuracy and generalization capabilities. S3. Build an improved YOLOv8 model, which includes a multi-branch downsampling module MBDM, a dynamic upsampling module DUM, and an SPPF-Attention module that introduces an attention mechanism LSKA; It should be noted that the MBDM module extracts edge, texture and global features in parallel through multiple branches. After fusion, it alleviates the missed detection of small targets caused by downsampling, improves the feature retention rate of small cracks and weak edges, and enhances the ability to express multi-scale defects. The DUM module is based on bilinear interpolation and dynamic weight allocation. It adaptively focuses on the defect area through pixel rearrangement and offset function, overcomes the blurring phenomenon of traditional fixed interpolation in the reconstruction of small target areas such as peeling edges, and improves the feature response of small targets. The SPPF-Attention module introduces the LSKA attention mechanism. Through multi-scale pooling combined with channels and space, it suppresses background redundancy while highlighting small target areas under complex backgrounds, significantly improving the problem of missed detection of small targets. S4. Input the training set of disease image data into the YOLOv8 improved model, perform transfer learning and initialize network parameters, and use the SGD optimizer to train the YOLOv8 improved model for disease detection in stages; It should be noted that transfer learning is used to initialize parameters and YOLOv8 pre-trained weights are used to accelerate convergence and improve stability in the early stages of training. The phased training strategy can avoid large fluctuations in low-level feature parameters during the initial training process, improving the stability and convergence efficiency of model training. Combined with the SGD optimizer, the training efficiency and accuracy are balanced, allowing the model to quickly adapt to diseased data and reduce overfitting. S5. Input the real-time concrete surface defect image into the trained YOLOv8 improved model to monitor, locate, and classify the areas of concrete surface defects; It should be noted that the trained improved YOLOv8 model can accurately monitor, locate, and classify concrete surface defects. Through multi-module collaboration, it can accurately detect five types of defects, including cracks and corrosion. It meets the real-time detection needs of multiple scenarios such as bridges and tunnels. It is suitable for defect detection under complex lighting and backgrounds. The detection results can output location boxes, categories, and confidence levels, significantly improving the efficiency and automation level of engineering inspections. This embodiment uses a multi-branch downsampling module and a dynamic upsampling module to collaborate, and introduces an attention mechanism to construct an improved YOLOv8 model. This model is adaptable to a variety of concrete structure scenarios and disease types. The dataset covers a variety of concrete structures such as bridges, tunnels, and building areas. It has strong versatility and scalability, facilitating further industrial deployment.

[0023] Furthermore, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process in this embodiment, another dynamic detection method for concrete surface defects based on the improved YOLOv8 model is provided. The method includes the following steps: S1. Collect concrete surface defect images, including cracks, weathering, exposed reinforcement, corrosion, and spalling; For example, we used 4096 publicly available CODEBRIM datasets and expanded field images. The image sources included surface shots of actual engineering structures and industrial scene images. We constructed an image dataset covering five types of concrete surface defects: cracks, weathering, exposed reinforcement, corrosion, and spalling. It should be noted that the collected images come from diverse sources and cover multiple scenes, providing sufficient samples for the model; S2. Perform data enhancement on the collected disease images and use annotation tools to annotate the locations and categories of the diseases to obtain a disease image dataset; the specific steps of step S2 are: S21. Perform data enhancement processing, including rotation, scaling, grayscale transformation, blur enhancement, and random cropping; For example, when enhancing data, a multi-dimensional strategy is used to expand sample diversity: the image is randomly rotated by ±30° to simulate different shooting angles, scaled to 0.5-1.5 times the original size to cover multi-scale features, brightness and contrast are adjusted through grayscale transformation to adapt to different lighting conditions, Gaussian blur is used to enhance texture robustness, and random cropping is performed to simulate local disease scenes; S22. Use a labeling tool to label the location and category of the disease to obtain a disease image dataset, and divide the disease image dataset into a training set and a test set in a ratio of 9:1; For example, the labelimg tool was used to annotate the 4096 enhanced images, with the coordinates and categories of the disease bounding boxes annotated in YOLO format. This generated a dataset containing 26,300 annotated boxes. The dataset was randomly divided into a training set of 3686 images and a test set of 410 images in a 9:1 ratio. Stratified sampling was used during the division to ensure a balanced distribution of disease categories in each subset, providing structured samples for model training. It should be noted that multi-dimensional data enhancement expands sample diversity, allowing the model to adapt to different angles, scales, lighting, and local scenes, improving generalization capabilities and reducing overfitting; using labelimg for precise annotation and dividing the data set into 9:1 stratified sampling to ensure sample structure and balanced category distribution, providing a high-quality data foundation for model training; S3. Build an improved YOLOv8 model, which includes a multi-branch downsampling module MBDM, a dynamic upsampling module DUM, and an SPPF-Attention module that introduces an attention mechanism LSKA. The specific steps of step S3 are: S31. Construct a multi-branch downsampling structure in the original Backbone downsampling path, use convolution kernels of different sizes to capture local and global features, and construct a multi-branch downsampling module MBDM; In step S31, the branch downsampling module MBDM includes three parallel convolution branches and a feature fusion compression unit; Among them, the first convolution branch is the MaxPool branch, which includes a 1×1 convolution layer and a maximum pooling layer with a kernel size of 3×3. The 1×1 convolution layer is used to perform preliminary channel compression on the input feature map; the maximum pooling layer is used to extract the maximum value within the local receptive field of the input feature map; The second convolution branch is the AvgPool branch, which includes a 1×1 convolution layer and an average pooling layer. The average pooling layer is used to input pixel values ​​within the local receptive field of the feature map. The third convolution branch is a dilated convolution branch, which includes a 3×3 dilated convolution layer. The 3×3 dilated convolution layer is used to capture global context information by expanding the receptive field and enhance the understanding of the input feature map. A feature fusion compression unit is used to splice three parallel convolution branches and perform channel compression on the spliced ​​three parallel convolution branches through a 1×1 convolution layer; For example, taking the input feature map dimension H×W×C as an example, the number of channels is first compressed to C / 2 through 1×1 convolution, and then high-response features such as crack edges and spalling boundaries are extracted through 3×3 maximum pooling, with an output dimension of H / 2×W / 2×C / 2; 1×1 convolution is used to compress the channel to C / 2, and 3×3 average pooling is used to extract texture transition information in the weathered area, with an output dimension of H / 2×W / 2×C / 2; 3×3 dilated convolution is directly used to expand the receptive field to capture global semantics such as spalling range, with an output dimension of H / 2×W / 2×C; S32. Based on bilinear interpolation and dynamic weight allocation mechanism, a dynamic upsampling module DUM is constructed; the specific steps of step S32 are: S321. Estimate the value of the new pixel by bilinear interpolation of the four neighboring pixels around the target pixel of the input feature map, and perform linear interpolation weighted average estimation in both horizontal and vertical directions to generate the value of the new pixel; For example, the weighted average is to generate the value of the new pixel by performing linear interpolation in both horizontal and vertical directions, and the calculation formula is:

[0024] Wherein, x1 and x2 are the horizontal coordinates of two known data points, y1 and y2 are the vertical coordinates of two known data points, x and y are the horizontal and vertical coordinates of the interpolation point, A11 is the function value corresponding to the known data point with coordinates (x1, y1), A12 is the function value corresponding to the known data point with coordinates (x2, y1), A21 is the function value corresponding to the known data point with coordinates (x1, y2), and A22 is the function value corresponding to the known data point with coordinates (x2, y2). B1 is the horizontal direction, linear interpolation of A11 and A12, the first column of horizontal coordinates is the intermediate difference result at x, B2 is the horizontal direction, linear interpolation of A11 and A12, the second column of horizontal coordinates is the intermediate interpolation result at x, and P is the vertical direction linear interpolation of B1 and B2, the interpolation result at coordinates (x, y); S322. Perform weight enhancement and structural reconstruction on the input feature map to enhance the response of the diseased area; For example, when the input feature map is weighted and restructured, the feature map X after bilinear interpolation is used. interp The dimension is H×W×C. First, a lightweight convolutional neural network is used to generate a dynamic weight map W: a 1×1 convolutional layer is used to interp Convolution is performed, and the output dimension is H×W×C. Then the weight is normalized to the [0,1] interval by the Sigmoid activation function, so that the weight value of the key area such as the edge of the disease and the crack is higher than the background; the weight map W is mapped to the feature map X interp Multiply element by element to obtain a weighted feature map to enhance the response to the diseased area; S323. Assign weights to the cracks, weathering, exposed reinforcement, corrosion, and spalling features in different regions of the input feature map; For example, a lightweight convolutional network performs semantic parsing on the input feature map, outputting a weight map with dimensions H×W×5, with 5 channels corresponding to five types of defects. After SiLU activation, the weight values ​​are mapped to the interval [0, 1]. The weights of crack areas converge to 0.7-0.9, while those of background areas are reduced to 0.1-0.3 to reduce background interference on the detection results. For corrosion spot areas, the network learns their grayscale unevenness characteristics, assigning a weight of 0.8 to enhance the response, while suppressing the 0.2 weight of the concrete substrate. S324. Perform pixel shuffling on the input feature map, and dynamically generate the offset of the shuffled pixels at the sampling point. The calculation formula is:

[0025] Where, f (·) is the offset generation function, which uses multiple convolutional layers and nonlinear activation SiLU structure. X is the feature vector of the input feature map, θ is the weight of features in different regions of the input feature map; Offset (x, y) is the offset at the two-dimensional coordinate (x, y) of the sampling point, which includes two channels: horizontal Offset(x) and vertical Offset(y), which are used to guide the dynamic adjustment of the sampling point in space. For example, when the input feature map X dimension is 32×32×64, the feature map is first rearranged in channel space through a pixel shuffling operation, rearranging it from 32×32×64 to 64×64×16, achieving resolution improvement and channel compression. A three-layer convolutional network structure is used to generate offsets. The first layer is a 3×3×16×8 convolution followed by SiLU activation; the second layer is a 3×3×8×4 convolution followed by SiLU activation; and the third layer is a 3×3×4×2 convolution. Ultimately, a 64×64×2 offset map Offset is generated, corresponding to the two-dimensional offset of each pixel. For feature points in crack areas, the network learns to highlight edge features, and the output offset range is concentrated in the range of (-2, +1) to (+2, -1), guiding the sampling points to focus on the crack tip area. For exposed rebar areas, the offset is concentrated in the range of (+1, +1) to (+3, +3), covering the rust edge area, which helps to enhance local anchoring ability and improve the response accuracy of the diseased area. S33. Based on the spatial pyramid pooling SPPF module, the LSKA attention mechanism is introduced to construct the SPPF-Attention module with the LSKA attention mechanism. The specific steps of step S33 include: S331. Perform channel compression on the input feature map through a 1×1 convolutional layer to obtain a compressed feature map, with a step size of 1 and padding of 0, which only changes the number of channels without affecting the spatial dimension. For example, taking the input feature map dimension H×W×128 as an example, a 1×1 convolution kernel is used to perform channel compression on it, and the output dimension is H×W×64, the number of channels is halved and the spatial size remains unchanged; S332. Using three parallel max pooling paths, each using three max pooling layers with different kernel sizes and increasing number of layers, with a step size of 1 for each pooling layer, and performing zero padding to obtain a pooled feature map to maintain the spatial dimension of the input feature map unchanged; For example, the dimension of the feature map after channel compression is 64×64×64, and the maximum pooling of 5×5, 9×9, and 13×13 kernels is used respectively. After zero padding, the output dimension is 64×64×64. S333. Concatenate the pooled feature map and the compressed feature map in the channel dimension, and fuse the channel information through a 1×1 convolution layer to construct a multi-scale fused feature map, and perform channel fusion on the multi-scale fused feature map through a 1×1 convolution layer; For example, the 5×5, 9×9, and 13×13 pooled feature maps are concatenated with the compressed feature map along the channel to obtain a 64×64×256 multi-scale fusion feature map. Channel fusion is performed through 1×1 convolution to output a 64×64×64 feature map, effectively integrating cross-scale information such as crack direction and exposed rebar distribution. S334. Introducing the LSKA attention mechanism in the fused feature map, using a large-kernel separable convolutional structure to capture long-range dependencies in the horizontal and vertical directions, and enhancing high perception capabilities with low computational complexity through series or parallel connections; For example, the LSKA attention mechanism is introduced to the fused feature map: 15×1 and 1×15 depthwise separable convolutions are used to extract horizontal and vertical long-range dependencies, respectively. The two are connected in parallel and then connected to the channel attention module. The 1×1 convolution is compressed to 16 channels, and the weights are generated by Sigmoid. The weights are multiplied element-wise with the fused feature map to achieve attention modulation. It should be noted that the MBDM module extracts edge, texture, and global features in parallel through three branches, and after channel fusion compression, it alleviates the information loss problem of traditional downsampling. The DUM module uses dynamic weight allocation and offset generation function to assign higher weights to the diseased area. Combined with pixel shuffling operations, it improves the clarity of the diseased area in the feature map. The SPPF-Attention module introduces LSKA attention, which captures long-range dependencies through multi-scale pooling and large-kernel separable convolution, suppresses background interference, and significantly reduces the missed detection rate. S4. Input the training set of the disease image data into the YOLOv8 improved model, perform transfer learning and initialize the network parameters, and use the SGD optimizer to train the YOLOv8 improved model's adaptability to disease detection in stages. The specific steps of step S4 are: S41. In the model initialization phase, initial parameters are set and all training images are uniformly resized to a preset input resolution size before being input into the network; For example, during the model initialization phase, the pre-trained weights of the YOLOv8 official dataset are directly loaded, and transfer learning is used to accelerate convergence. At the same time, the pixel size of 4096 disease images is unified to 640×640 pixels, and bilinear interpolation is used to maintain edge clarity. This ensures that the input size meets the requirements of the improved YOLOv8 model network architecture. This enables the model to have basic feature extraction capabilities at the beginning of training, reduces oscillations caused by random initialization, and improves training stability. S42. Use the YOLOv8 composite loss function, which consists of three parts: bounding box loss, used to regress the predicted box position and size; target confidence loss, used to determine whether the target exists; and category classification loss, used to distinguish the disease type. For example, the YOLOv8 composite loss function uses CIoU loss as the bounding box loss, which improves the crack positioning accuracy by calculating the distance, overlap rate, and aspect ratio between the predicted box and the true box. The target confidence loss uses binary cross entropy, with a confidence threshold of 0.25 to suppress background false detection. The category classification loss uses cross entropy to support multi-classification of five types of diseases. S43. SGD optimizer is used for parameter updates, with an initial learning rate of 0.0001. During training, the batch size is set to 32, and the entire training cycle is set to 300 epochs. A phased freezing strategy is used for transfer learning. In the first 100 epochs of training, the backbone network weights are frozen, and the neck structure and head are trained. In the next 200 epochs, the full network weights are unfrozen. Through full training, the model parameters are deeply fine-tuned to further improve the overall performance of the model in the task. For example, the SGD optimizer is used to train the improved YOLOv8 model, with a batch size of 32 and a total cycle of 300 epochs. The backbone network is frozen for the first 100 epochs, and only the neck and head are fine-tuned to avoid damaging the underlying features. The entire network is unfrozen for the next 200 epochs, and the learning rate is decayed using a cosine annealing strategy to gradually optimize the model from global features to local details. It should be noted that the model was initialized with YOLOv8 pre-trained weights and the image size was unified to accelerate convergence. A composite loss function was used to improve detection accuracy. The SGD optimizer was combined with a staged freezing strategy to first fix the backbone network to train the neck or head, and then fine-tune the entire network to reduce overfitting and improve the overall performance of the model. S5. Input the real-time concrete surface defect image into the trained YOLOv8 improved model to monitor, locate, and classify the areas of concrete surface defects; For example, the concrete surface defect image to be detected is resized to 640×640 pixels through bilinear interpolation, and the pixel values ​​are normalized to [0, 1] before being input into the trained YOLOv8 improved model. The model extracts multi-scale features through the backbone network, and the neck adopts the PAFPN structure to achieve top-down and bottom-up path fusion of multi-scale features to enhance feature expression capabilities. The head outputs the prediction box coordinates, target confidence, and five defect categories. The DIoU-NMS algorithm is used to filter redundant boxes, and finally outputs the detection box with category labels. To comprehensively evaluate the model's performance in actual defect detection tasks, we calculated the detection accuracy indicators for five typical concrete defects, including cracks, corrosion, exposed rebar, spalling, and weathering, on the test set. The evaluation indicators used the mainstream evaluation system for current target detection tasks, including: AP: Calculate the average precision of each type of disease to measure the recognition accuracy of the model for each type of disease; mAP: Take the average AP of the five diseases to comprehensively reflect the overall detection level of the model; The comparison of AP values ​​of concrete apparent disease detection by YOLOv8 and the model of the present invention is shown in Table 1: Table 1 Comparison of AP values ​​of concrete apparent disease detection between YOLOv8 and the proposed model

[0026] It should be noted that the improved YOLOv8 model outperforms the original YOLOv8 in all disease categories, with an average mAP improvement of 4.1 percentage points, which is particularly significant in the small target corrosion, exposed rebar, and spalling detection scenarios.

[0027] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0028] like Figure 2 As shown below, an embodiment of a system for dynamic detection of apparent defects in concrete based on the improved YOLOv8 model provided by an embodiment of the present invention is provided. This system and the dynamic detection method for apparent defects in concrete based on the improved YOLOv8 model of the above embodiments belong to the same inventive concept. For details not fully described in the embodiment of the dynamic detection system for apparent defects in concrete based on the improved YOLOv8 model, reference can be made to the embodiment of the dynamic detection method for apparent defects in concrete based on the improved YOLOv8 model.

[0029] The system includes: Image acquisition module, used to collect concrete surface disease images, including five types of surface disease images: cracks, weathering, exposed reinforcement, corrosion, and spalling; The preprocessing module is used to perform data enhancement on the collected disease images and use annotation tools to mark the location and category of the diseases to obtain a disease image dataset; A model building module is used to build an improved YOLOv8 model. The improved YOLOv8 model includes a multi-branch downsampling module MBDM, a dynamic upsampling module DUM, and an SPPF-Attention module that introduces an attention mechanism LSKA. A model training module is used to input the disease image dataset into the YOLOv8 improved model, initialize network parameters through transfer learning, and train the YOLOv8 improved model in stages using the SGD optimizer; The dynamic detection module is used to input real-time concrete surface defect images into the trained YOLOv8 improved model to monitor, locate and classify areas of concrete surface defects; This embodiment realizes dynamic detection of concrete surface defects through the interactive collaboration of the image acquisition module, the preprocessing module, the model construction module, the model training module and the dynamic detection module.

[0030] The method for dynamic detection of concrete surface defects based on the improved YOLOv8 model provided in the embodiments of the present application can be applied to electronic devices. Those skilled in the art will understand that the electronic device structure involved in the embodiments of the present invention does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. In the embodiments of the present invention, the electronic device includes but is not limited to laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of the present application described and / or required herein.

[0031] The electronic device may include a processor, an external memory interface, an internal memory, a universal serial bus (USB) interface, a charging management module, a power management module, a battery, a wireless communication module, an audio module, a speaker, a microphone, a sensor module, a button, a camera, a display, and a SIM card interface, etc.

[0032] It is understood that the structures illustrated in the embodiments of the present application do not constitute specific limitations on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown, or combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0033] A processor may include one or more processing units, such as a central processing unit (CPU), an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors.

[0034] The processor can be the nerve center and command center of the electronic device. The controller can generate operation control signals based on the instruction opcode and timing signal to complete the control of instruction fetching and execution.

[0035] The processor may also include a memory for storing instructions and data. In some embodiments, the memory in the processor is a cache memory. This memory can store instructions or data that the processor has just used or is reusing. If the processor needs to use the instruction or data again, it can directly call it from the memory. This avoids repeated accesses, reduces processor latency, and thus improves system efficiency.

[0036] The electronic device implements the method of dynamic detection of concrete surface defects based on the YOLOv8 improved model of the present application, which collects concrete surface defect images, including five types of surface defect images: cracks, weathering, exposed reinforcement, corrosion, and spalling; performs data enhancement on the collected defect images, and uses annotation tools to annotate the locations and categories of the defects to obtain a defect image dataset; constructs a YOLOv8 improved model, which includes a multi-branch downsampling module MBDM, a dynamic upsampling module DUM, and an SPPF-Attention module that introduces an attention mechanism LSKA; inputs the training set of the defect image data into the YOLOv8 improved model, and through transfer learning and initialization of network parameters, uses an SGD optimizer to train the YOLOv8 improved model for its adaptability to defect detection in stages; inputs real-time concrete surface defect images into the trained YOLOv8 improved model, and performs steps such as monitoring, locating, and classifying areas of concrete surface defects, thereby effectively improving the detection accuracy of concrete surface defects, especially in dense defect scenarios with significant advantages.

[0037] The storage medium provided in this application stores a program product that can implement a method for dynamic detection of concrete surface defects based on the improved YOLOv8 model.

[0038] In some possible implementations, the method for dynamic detection of concrete surface defects based on the improved YOLOv8 model disclosed herein can be implemented in the form of a program product, which includes program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of various exemplary implementations of the present disclosure described in the above "Exemplary Method" section of this specification.

[0039] The storage medium of the present disclosure can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but not limited to, a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0040] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily 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 is not limited to the embodiments shown herein but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for dynamic detection of concrete surface defects based on an improved YOLOv8 model, characterized in that: The method comprises the following steps: S1. Collect concrete surface defect images, including five types of surface defect images: cracks, weathering, exposed reinforcement, corrosion, and spalling; S2. Perform data augmentation on the collected disease images and use annotation tools to label the locations and categories of the diseases to obtain a disease image dataset; S3. Build an improved YOLOv8 model, which includes a multi-branch downsampling module MBDM, a dynamic upsampling module DUM, and an SPPF-Attention module that introduces an attention mechanism LSKA; S4. Input the training set of disease image data into the YOLOv8 improved model, perform transfer learning and initialize network parameters, and use the SGD optimizer to train the YOLOv8 improved model for disease detection in stages; S5. Input the real-time concrete surface defect image into the trained YOLOv8 improved model to monitor, locate, and classify the areas of concrete surface defects.

2. The method for dynamic detection of concrete surface defects based on the improved YOLOv8 model according to claim 1 is characterized in that: The specific steps of step S2 are: S21. Perform data enhancement processing, including rotation, scaling, grayscale transformation, blur enhancement, and random cropping; S22. Use a labeling tool to label the location and category of the disease to obtain a disease image dataset, and divide the disease image dataset into a training set and a test set in a ratio of 9:

1.

3. The method for dynamic detection of concrete surface defects based on the improved YOLOv8 model according to claim 1 is characterized in that: The specific steps of step S3 are: S31. Construct a multi-branch downsampling structure in the original Backbone downsampling path, use convolution kernels of different sizes to capture local and global features, and construct a multi-branch downsampling module MBDM; S32. Based on bilinear interpolation and dynamic weight allocation mechanism, a dynamic upsampling module DUM is constructed; S33. Based on the spatial pyramid pooling SPPF module, the LSKA attention mechanism is introduced to construct the SPPF-Attention module with the LSKA attention mechanism.

4. The method for dynamic detection of concrete surface defects based on the improved YOLOv8 model according to claim 3 is characterized in that: In step S31, the multi-branch downsampling module MBDM includes three parallel convolution branches and a feature fusion compression unit; Among them, the first convolution branch is the MaxPool branch, which includes a 1×1 convolution layer and a maximum pooling layer with a kernel size of 3×3. The 1×1 convolution layer is used to perform preliminary channel compression on the input feature map; the maximum pooling layer is used to extract the maximum value within the local receptive field of the input feature map; The second convolution branch is the AvgPool branch, which includes a 1×1 convolution layer and an average pooling layer Avg Pooling. The average pooling layer Avg Pooling is used to average the pixel values ​​in the local receptive field of the input feature map. The third convolution branch is a dilated convolution branch, which includes a 3×3 dilated convolution layer. The 3×3 dilated convolution layer is used to capture global context information by expanding the receptive field and enhance the understanding of the input feature map. The feature fusion compression unit is used to splice three parallel convolution branches and perform channel compression on the three spliced ​​parallel convolution branches through a 1×1 convolution layer to integrate effective information and improve network computing efficiency.

5. The method for dynamic detection of concrete surface defects based on the improved YOLOv8 model according to claim 3 is characterized in that: The specific steps of step S32 are: S321. Estimate the value of the new pixel by bilinear interpolation of the four neighboring pixels around the target pixel of the input feature map, and perform linear interpolation weighted average estimation in both horizontal and vertical directions to generate the value of the new pixel; S322. Perform weight enhancement and structural reconstruction on the input feature map to enhance the response of the diseased area; S323. Assigning differentiated weights to cracks, weathering, exposed reinforcement, corrosion, and spalling features in different regions of the input feature map; S324. Perform pixel shuffling on the input feature map, and dynamically generate the offset of the shuffled pixels at the sampling point. The calculation formula is: Where, f (·) is the offset generation function, which uses multiple convolutional layers and nonlinear activation SiLU structure. X is the feature vector of the input feature map, θ is the weight of features in different regions of the input feature map; Offset (x,y) is the offset at the two-dimensional coordinates (x,y) of the sampling point.

6. The method for dynamic detection of concrete surface defects based on the improved YOLOv8 model according to claim 3 is characterized in that: The specific steps of step S33 are: S331. Perform channel compression on the input feature map through a 1×1 convolutional layer to reduce the feature dimension. The operation step is 1 and the padding is 0. Only the number of channels is changed without affecting the spatial dimension. S332. Using three parallel max pooling paths, each using three max pooling layers with different kernel sizes and increasing number of layers, with a step size of 1 for each pooling layer, and performing zero padding to obtain a pooled feature map to maintain the spatial dimension of the input feature map unchanged; S333. Concatenate the pooled feature map and the compressed feature map in the channel dimension, and fuse the channel information through a 1×1 convolution layer to construct a multi-scale fused feature map, and perform channel fusion on the multi-scale fused feature map through a 1×1 convolution layer; S334. The LSKA attention mechanism is introduced into the fusion feature map, and a large-core separable convolution structure is adopted to capture long-range dependencies in the horizontal and vertical directions respectively, and enhance the high perception capability with low computational complexity through series or parallel connections.

7. The method for dynamic detection of concrete surface defects based on the improved YOLOv8 model according to claim 1 is characterized in that: The specific steps of step S4 are: S41. In the model initialization phase, initial parameters are set and all training images are uniformly resized to a preset input resolution size before being input into the network; S42. Use the YOLOv8 composite loss function, which consists of three parts: bounding box loss, used to regress the predicted box position and size; target confidence loss, used to determine whether the target exists; and category classification loss, used to distinguish the disease type. S43. The SGD optimizer is used for parameter update, and the initial learning rate is set to 0.0001. During training, the batch size is set to 32, and the entire training cycle is set to 300 epochs. A phased freezing strategy is used for transfer learning. In the first 100 epochs of the initial training, the backbone network weights are frozen, and the Neck structure and Head part are trained; in the next 200 epochs, the entire network weights are unfrozen. Through full training, deep fine-tuning of model parameters is achieved, further improving the overall performance of the model in the task.

8. A system for dynamic detection of concrete surface defects based on the improved YOLOv8 model, characterized in that: include: Image acquisition module, used to collect concrete surface disease images, including five types of surface disease images: cracks, weathering, exposed reinforcement, corrosion, and spalling; The preprocessing module performs data enhancement on the collected disease images and uses annotation tools to mark the location and category of the diseases to obtain a disease image dataset; A model building module is used to build an improved YOLOv8 model. The improved YOLOv8 model includes a multi-branch downsampling module MBDM, a dynamic upsampling module DUM, and an SPPF-Attention module that introduces an attention mechanism LSKA. A model training module inputs the training set of the disease image data into the YOLOv8 improved model, performs transfer learning and initializes network parameters, and uses an SGD optimizer to train the YOLOv8 improved model's adaptability to disease detection in stages; The dynamic detection module is used to input real-time concrete surface defect images into the trained YOLOv8 improved model to monitor, locate and classify areas of concrete surface defects.

9. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method implements the steps of the method for dynamic detection of concrete surface defects based on the improved YOLOv8 model according to any one of claims 1 to 7.

10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for dynamic detection of concrete surface defects based on the improved YOLOv8 model as described in any one of claims 1 to 7 are implemented.