A method for detecting cracks in lightweight concrete composite slabs
By using the YOLOv8 lightweight multi-scale contextual feature fusion model, the accuracy and efficiency issues of existing crack detection technologies in complex environments are solved, achieving high-precision and fast crack detection and quantification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2026-03-10
AI Technical Summary
Existing crack detection technologies suffer from low efficiency and low accuracy in narrow spaces, low light conditions, or complex background environments.
A lightweight multi-scale contextual feature fusion model based on YOLOv8 is adopted, including a crack feature extraction module, a crack feature fusion module, and a crack detection module. Through multi-scale feature fusion and contextual guidance, combined with an attention mechanism, high-precision crack detection is achieved.
Maintaining high detection accuracy under complex backgrounds or different lighting conditions, reducing computational complexity, suitable for resource-constrained equipment, achieving fast and accurate crack detection, and automatically quantifying crack length and width.
Smart Images

Figure CN119850700B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of crack detection, and in particular to a lightweight concrete composite slab crack detection method. BACKGROUND
[0002] The concrete composite slab is an important component of the fabricated building, which is integrally combined by the interface treatment of the prefabricated slab and the cast-in-place concrete layer, has the characteristics of high construction efficiency, strong bearing capacity and high resource utilization rate, and is widely used in industrial plants, bridge engineering and residential buildings. Due to the influence of stress concentration, environmental humidity fluctuation, temperature change and improper construction operation during the stacking storage and construction process of the composite slab, cracks are prone to occur at the bottom plate position. If these cracks are not detected and repaired in time, they may extend to the interface layer, thereby causing the degradation of the overall structural performance, and even causing serious safety hazards.
[0003] At present, the methods for detecting concrete cracks mainly include manual detection and machine vision detection. The manual detection relies on experienced personnel to use visual inspection or measurement tools to check cracks, which is simple to operate and has low cost. However, this method has low detection efficiency, especially in narrow spaces or environments with insufficient light, the detection accuracy is difficult to guarantee, and false positives or false negatives are easily caused by human factors, which cannot meet the needs of modern engineering for efficient and accurate crack detection. The machine vision detection method relying on gray value difference or edge information has good effect under the condition of simple background and uniform light, but in a complex background, the noise resistance is poor, and the crack segmentation accuracy is limited. SUMMARY
[0004] In view of the above analysis, the embodiments of the present application aim to provide a lightweight concrete composite slab crack detection method to solve the problems of low detection efficiency and low detection accuracy in narrow spaces, insufficient light or complex background environments of the existing crack detection technology.
[0005] The main purpose of the present application is achieved by the following technical solutions:
[0006] The present application provides a lightweight concrete composite slab crack detection method, comprising the following steps:
[0007] Obtain the surface image of the concrete composite slab to be detected and perform preprocessing to obtain a processed image;
[0008] The processed image is subjected to crack detection by a trained crack detection model to obtain a crack detection result in the image; wherein the crack detection model is a lightweight multi-scale context feature fusion model based on YOLOv8, comprising a crack feature extraction module, a crack feature fusion module and a crack detection module; the crack feature extraction module is configured to extract different scale features of the image; the crack feature fusion module is configured to fuse the features of different scales to obtain a fusion enhanced feature map, a multi-scale fusion feature map and a context guided fusion feature map; the crack detection module obtains a crack detection box and a crack segmentation mask based on the fusion enhanced feature map, the multi-scale fusion feature map and the context guided fusion feature map.
[0009] Based on the crack segmentation mask, the width and length of the cracks of the concrete composite slab are obtained.
[0010] Further, in the crack detection module, the fusion enhanced feature map, the multi-scale fusion feature map and the context guided fusion feature map pass through a detection layer respectively to obtain a fusion enhanced detection feature map, a multi-scale fusion detection feature map and a context guided fusion detection feature map, and then the fusion enhanced detection feature map, the multi-scale fusion detection feature map and the context guided fusion detection feature map are subjected to dimension reshaping respectively and then tensor splicing to obtain a target detection box.
[0011] The fusion enhanced feature map, the multi-scale fusion feature map and the context guided fusion feature map pass through a feature fusion convolutional layer respectively to obtain a fusion enhanced convolutional feature map, a multi-scale fusion convolutional feature map and a context guided fusion convolutional feature map, and then the fusion enhanced convolutional feature map, the multi-scale fusion convolutional feature map and the context guided fusion convolutional feature map are subjected to dimension reshaping respectively and then tensor splicing to obtain a mask coefficient.
[0012] The context guided fusion feature map is subjected to convolution and up-sampling operation by a mask prototype layer to obtain a mask prototype.
[0013] The mask coefficient and the mask prototype are subjected to matrix multiplication to obtain the crack segmentation mask.
[0014] The target detection box is subjected to non-maximum suppression processing to obtain the crack detection box.
[0015] Further, the detection layer comprises one standard convolution and group normalization layer, two detail enhancement convolution and group normalization layers and one convolutional layer, which are configured to convert the input feature map into a feature map containing target detection related information.
[0016] The feature fusion convolutional layer includes a standard convolutional and group normalization layer, a detail enhancement convolutional and group normalization layer, and a convolutional layer, used to convert the input feature map into a feature map containing mask-related information.
[0017] The mask prototype layer includes a convolutional layer, an upsampling layer, and two convolutional layers of different scales, used to obtain the mask prototype.
[0018] Furthermore, the crack feature extraction module includes a first convolution module, four convolutional feature fusion modules, a spatial pyramid pooling module, and an attention mechanism module; wherein,
[0019] The processed image is passed through the first convolution module to obtain feature map F1;
[0020] The feature map F1 is downsampled sequentially through four convolutional feature fusion modules to obtain feature maps F2, F3, F4 and F5 respectively;
[0021] The feature map F5 undergoes multi-scale pooling and feature fusion through the spatial pyramid pooling module;
[0022] The output feature map of the spatial pyramid pooling layer is used by the attention mechanism module to generate an attention weight map, which adjusts the importance of each region in the output feature map of the spatial pyramid pooling layer to obtain the crack extraction feature map output by the crack feature extraction module.
[0023] Furthermore, the convolutional feature fusion module includes a convolutional module and a multi-scale feature fusion module; wherein,
[0024] The convolution module includes convolutional layers, batch normalization layers, and activation functions, and is used to extract features from the input feature map.
[0025] The multi-scale feature fusion module includes several local multi-scale feature fusion modules and an output module connected in sequence, and the output feature maps of each local multi-scale feature fusion module are stitched together in the output module.
[0026] Furthermore, the local multi-scale feature fusion module includes a first convolutional layer, a first segmentation layer, a second convolutional layer, a third convolutional layer, a feature concatenation layer, a fourth convolutional layer, and an output layer; wherein,
[0027] The input feature map of the local multi-scale feature fusion module is processed by extracting features through the first convolutional layer and then by channel segmentation in the first segmentation layer. The output feature map of the first convolutional layer is divided into a first sub-feature map of the first output feature map and a second sub-feature map of the first output feature map.
[0028] The first sub-feature map of the first output feature map is segmented by the second segmentation layer after features are extracted by the second convolutional layer. The output feature map of the second convolutional layer is divided equally to obtain the first sub-feature map of the second output feature map and the second sub-feature map of the second output feature map. The second convolutional layer is a grouped convolution, and the number of channels is the number of channels of the first convolutional layer divided by 2 and rounded down.
[0029] The first sub-feature map of the second output feature map extracts features through the third convolutional layer to obtain the third output feature map; wherein, the third convolutional layer is a grouped convolution, and the number of channels is the number of channels of the first convolutional layer divided by 4 and rounded down;
[0030] The second sub-feature map of the first output feature map, the second sub-feature map of the second output feature map, and the third output feature map are concatenated in the channel dimension at the feature concatenation layer to obtain the concatenated feature map.
[0031] The concatenated feature map is passed through the fourth convolutional layer to reduce the number of channels, and the number of channels of the resulting feature map is the same as the input feature map of the local multi-scale feature fusion module.
[0032] The output feature map of the fourth convolutional layer is added to the input feature map of the local multi-scale feature fusion module at the output layer to obtain the output feature map of the local multi-scale feature fusion module.
[0033] Furthermore, the crack feature fusion module includes two multi-dimensional feature fusion modules and two multi-dimensional enhanced feature fusion modules connected in sequence; wherein,
[0034] The multi-dimensional feature fusion module includes an upsampling layer, a context feature fusion module, and a multi-scale feature fusion module;
[0035] The multidimensional enhanced feature fusion module includes a convolution module, a context feature fusion module, and a multi-scale feature fusion module.
[0036] Furthermore, in the first multi-dimensional feature fusion module, after the crack extraction feature map passes through the upsampling layer, it is fused with the feature map F4 in the context feature fusion module. The resulting features are then fused into a fused feature map through local multi-scale feature fusion in the multi-scale feature fusion module.
[0037] In the second multi-dimensional feature fusion module, the fused feature map is upsampled and then fused with the feature map F3 in the context feature fusion module. The resulting feature map is then fused with the feature map F3 in the multi-scale feature fusion module to obtain a fused enhanced feature map.
[0038] In the first multidimensional enhanced feature fusion module, the fused enhanced feature map is passed through the convolution module and then fused with the fused feature map in the context feature fusion module. The resulting features are then fused locally through the multi-scale feature fusion module to obtain a multi-scale fused feature map.
[0039] In the second multi-dimensional enhanced feature fusion module, the multi-scale fused feature map is passed through the convolution module and then fused with the crack extraction feature map in the context feature fusion module. The resulting features are then fused locally through the multi-scale feature fusion module to obtain the context-guided fused feature map.
[0040] Furthermore, the context feature fusion module includes a channel attention module, a spatial attention module, and a feature concatenation module; wherein,
[0041] The channel attention module is used to concatenate the first input feature map and the second input feature map in the channel dimension, process the concatenated feature map using the SE attention mechanism, and then split the processed feature map into a first weighted feature map and a second weighted feature map with the same number of channels as the first input feature map and the second input feature map.
[0042] The spatial attention module is used to perform weighted fusion of the first weighted feature map and the second weighted feature map with the first input feature map and the second input feature map, respectively.
[0043] The feature concatenation module is used to concatenate the channel dimensions of the two weighted and fused feature maps obtained by the spatial attention module to obtain the output feature map of the context feature fusion module.
[0044] Furthermore, based on the crack segmentation mask of the image, the width of the cracks in the concrete composite slab is obtained, including:
[0045] Based on the crack segmentation mask, connected component labeling is performed to obtain the coordinates of each connected component;
[0046] For each point in each connected domain, a binary search algorithm is used to determine the maximum radius of the intersection between the circle centered at each point and the crack boundary.
[0047] After subtracting 1 from the maximum radius, the radius value is gradually increased with a preset floating-point precision until the inscribed circle is tangent to the boundary, thus obtaining the maximum width of the crack;
[0048] Based on the crack segmentation mask of the image, the length of the crack in the concrete composite slab is obtained, including:
[0049] Based on the crack segmentation mask, the skeleton structure of the crack is extracted using a skeleton extraction algorithm;
[0050] The endpoints of the skeleton structure of the crack are identified by convolution operation, and the gradients of each skeleton endpoint in the x and y directions are calculated using the Sobel operator to determine the preferred growth direction of each skeleton endpoint.
[0051] Based on the preferred growth direction of each skeleton endpoint, a region growing algorithm is used to repair the fractured crack skeleton and obtain the complete crack skeleton.
[0052] The total length of the crack is obtained by traversing the complete skeleton pixels of the crack.
[0053] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:
[0054] 1. The crack detection model used in this invention can extract crack features of different scales from the input image. Even under complex backgrounds or different lighting conditions, it can maintain high detection accuracy. Through lightweight design, the computational complexity and number of parameters are reduced, enabling the model to run efficiently on resource-constrained devices. This lightweight design ensures the real-time performance of the model and can meet the needs of rapid on-site detection.
[0055] 2. This invention can not only detect the existence and location of cracks, but also automatically quantify the length and width of cracks through crack segmentation masks, providing reliable data support for engineering decisions.
[0056] 3. In the present invention, through the collaborative work of the crack feature extraction module and the crack feature fusion module, the model can extract and fuse crack features of different scales in the image, including low-level edge and texture information and high-level semantic information. This multi-scale feature fusion helps the model to more accurately identify and locate cracks, and can maintain high detection accuracy even in complex backgrounds or cracks of different sizes.
[0057] 4. The context feature fusion module of the present invention utilizes an attention mechanism to enhance the context perception capability of crack features. The model can better understand the environment and background of the crack, thereby effectively suppressing the interference of background noise during the detection process, highlighting the features of the crack area, and further improving the accuracy of detection.
[0058] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description
[0059] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.
[0060] Figure 1 This is a schematic flowchart of a method for detecting cracks in lightweight concrete composite slabs according to an embodiment of the present invention.
[0061] Figure 2 This is a schematic diagram of the crack detection model in an embodiment of the present invention;
[0062] Figure 3 This is a schematic diagram of the structure of the local multi-scale feature fusion module of the multi-scale feature fusion module in an embodiment of the present invention;
[0063] Figure 4 This is a schematic diagram of the context feature fusion module in an embodiment of the present invention;
[0064] Figure 5 This is a schematic diagram of the crack detection module in an embodiment of the present invention. Detailed Implementation
[0065] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.
[0066] A specific embodiment of the present invention discloses a method for detecting cracks in lightweight concrete composite slabs, such as... Figure 1 As shown, it includes the following steps S1-S3:
[0067] Step S1: Obtain the surface image of the concrete composite slab to be inspected and perform preprocessing to obtain the processed image.
[0068] Specifically, an image acquisition device mounted on a slide rail is used to photograph the surface of the concrete composite slab to be inspected. This device uses a 135° field-of-view and 12-megapixel ultra-wide-angle camera for image acquisition. The high resolution and wide field of view of the camera allow for capturing a larger visible area, helping to obtain more comprehensive crack information. A stepper motor drives the image acquisition device on the slide rail to move slowly and smoothly to capture clear images.
[0069] The surface image is preprocessed, including adjusting the image size using OpenCV. In this embodiment, the image size is 640×640. Then, a filtering algorithm is used to reduce noise in the image, improve image quality, and make the crack features clearer.
[0070] Step S2: The processed image is subjected to crack detection using a trained crack detection model to obtain crack detection results in the image; wherein, the crack detection model is a lightweight multi-scale contextual feature fusion model based on YOLOv8, including a crack feature extraction module, a crack feature fusion module, and a crack detection module; the crack feature extraction module is used to extract features of different scales of the image; the crack feature fusion module is used to fuse features of different scales to obtain a fusion enhancement feature map, a multi-scale fusion feature map, and a context-guided fusion feature map; the crack detection module obtains crack detection boxes and crack segmentation masks based on the fusion enhancement feature map, the multi-scale fusion feature map, and the context-guided fusion feature map.
[0071] Specifically, such as Figure 2 As shown, the crack detection model in this embodiment is based on the YOLOv8 architecture. It captures crack details and overall information of different sizes and shapes in the image through multi-scale feature extraction. It fuses these features of different scales to combine local details and global context information, and finally achieves accurate crack localization and pixel-level segmentation. It has a lightweight design, is suitable for real-time detection, and can effectively reduce the probability of false detection and false negative detection.
[0072] Furthermore, the crack feature extraction module includes a first convolution module, four convolutional feature fusion modules, a spatial pyramid pooling module, and an attention mechanism module; wherein,
[0073] In the crack feature extraction module, the processed image is passed through the first convolution module to obtain feature map F1.
[0074] Specifically, the first convolutional module includes a convolutional layer with 3 kernels, a stride of 2, and 64 channels, a batch normalization layer, and an activation function connected in sequence, used to reduce spatial resolution and extract low-level edge and texture information.
[0075] The feature map F1 is downsampled sequentially through four convolutional feature fusion modules to obtain feature maps F2, F3, F4 and F5 respectively.
[0076] Furthermore, the convolutional feature fusion module includes a convolutional module and a multi-scale feature fusion module.
[0077] Specifically, in each convolutional feature fusion module, features at the current scale are extracted and fused with previous features. In this way, as the modules delve deeper, the model can extract features from details to the whole layer by layer, and gradually fuse feature information at different scales to form a multi-level, multi-scale feature representation. This layer-by-layer feature extraction and fusion helps the model capture crack information at different levels in the image, improving the accuracy and robustness of crack detection.
[0078] Furthermore, the convolution module includes a convolutional layer, a batch normalization layer, and an activation function, used to extract features from the input feature map and perform downsampling.
[0079] Specifically, the number of channels in the convolutional layers of the four convolutional feature fusion modules increases exponentially, resulting in a multiplied increase in the number of channels in the extracted feature maps, thus extracting more features. In this embodiment, the convolutional layer in the first convolutional feature fusion module has a kernel of 3, a stride of 2, and 128 channels; the convolutional layer in the second convolutional feature fusion module has a kernel of 3, a stride of 2, and 256 channels; the convolutional layer in the third convolutional feature fusion module has a kernel of 3, a stride of 2, and 512 channels; and the convolutional layer in the fourth convolutional feature fusion module has a kernel of 3, a stride of 2, and 1024 channels.
[0080] It should be noted that the number of channels in a convolutional layer determines how many different features that convolutional layer can learn. Increasing the number of channels in a convolutional layer can enhance the network's feature learning and expressive capabilities.
[0081] Furthermore, the multi-scale feature fusion module includes several local multi-scale feature fusion modules and an output module connected in sequence, and the output feature maps of each local multi-scale feature fusion module are stitched together in the output module.
[0082] Specifically, the multi-scale feature fusion module incorporates the concept of multi-scale feature fusion. By introducing local multi-scale features, it can effectively extract features of different scales of cracks and enhance the expressive power of crack regions.
[0083] It should be noted that the number of local multi-scale feature fusion modules in the multi-scale feature fusion module is usually set to a relatively small value, because the more modules there are, the greater the computational load used by the entire model. For example, in this embodiment, the number of local multi-scale feature fusion modules can be set to 3.
[0084] Furthermore, the local multi-scale feature fusion module includes a first convolutional layer, a first segmentation layer, a second convolutional layer, a second segmentation layer, a third convolutional layer, a feature splicing layer, a fourth convolutional layer, and an output layer.
[0085] Specifically, such as Figure 3 As shown, the local multi-scale feature fusion module can extract feature information of different scales and levels from the input feature map through continuous convolution and segmentation operations, enabling the model to capture both the detailed and overall features of the crack, thus improving its ability to recognize cracks of different sizes and shapes.
[0086] Furthermore, after the input feature map of the local multi-scale feature fusion module extracts features through the first convolutional layer, it performs channel segmentation in the first segmentation layer, and the output feature map of the first convolutional layer is evenly divided into the first sub-feature map of the first output feature map and the second sub-feature map of the first output feature map.
[0087] Specifically, the first convolutional layer has 3 convolutional kernels, and the number of input and output channels is equal to that of the input feature map, which is used to perform preliminary feature extraction on the input feature map.
[0088] In the first segmentation layer, the output feature map of the first convolutional layer is divided into two parts in the channel dimension, providing different feature subsets for subsequent multi-scale feature extraction and fusion, so that the model can process these two parts of features separately.
[0089] The first sub-feature map of the first output feature map is segmented by the second segmentation layer after features are extracted by the second convolutional layer. The output feature map of the second convolutional layer is divided equally to obtain the first sub-feature map of the second output feature map and the second sub-feature map of the second output feature map. The second convolutional layer is a grouped convolution, and the number of channels is the number of channels of the first convolutional layer divided by 2 and rounded down.
[0090] Specifically, in the second convolutional layer, the first sub-feature map output by the first segmentation layer is further extracted using a grouped convolutional structure. This reduces the number of channels in the output feature map, thereby reducing the computational load, while preserving the feature information between different channels, making the feature information more concentrated and optimized.
[0091] The output feature map of the second convolutional layer is further divided into two parts along the channel dimension, which further refines the multi-scale representation of the features, enabling the model to perform more in-depth analysis and fusion of features at different scales.
[0092] Furthermore, the first sub-feature map of the second output feature map extracts features through the third convolutional layer to obtain the third output feature map; wherein, the third convolutional layer is a grouped convolution, and the number of channels is the number of channels of the first convolutional layer divided by 4 and rounded down.
[0093] Specifically, the first sub-feature map output by the second segmentation layer is further processed using a grouped convolutional structure for feature extraction, which further reduces the number of channels and extracts deeper feature information, helping the model capture more abstract and high-level feature representations.
[0094] Furthermore, the second sub-feature map of the first output feature map, the second sub-feature map of the second output feature map, and the third output feature map are concatenated in the channel dimension at the feature concatenation layer to obtain the concatenated feature map.
[0095] Specifically, by stitching together the feature maps, feature information at different scales and levels is integrated to form a comprehensive feature representation.
[0096] Furthermore, the concatenated feature map is passed through the fourth convolutional layer to reduce the number of channels, and the number of channels of the resulting feature map is the same as the input feature map of the local multi-scale feature fusion module.
[0097] Specifically, the fourth convolutional layer is a 1x1 convolutional layer used to reduce the number of channels to be the same as the number of channels in the input feature map.
[0098] Furthermore, the output feature map of the fourth convolutional layer is added to the input feature map of the local multi-scale feature fusion module at the output layer to obtain the output feature map of the local multi-scale feature fusion module.
[0099] Specifically, the output feature map of the fourth convolutional layer is added to the input feature map of the local multi-scale feature fusion module to achieve residual connection, which preserves the information in the original input feature map and supplements the new features after multi-scale feature extraction and fusion, thereby enhancing the feature representation ability and robustness of the model.
[0100] The local multi-scale feature module, by employing a grouped convolutional structure and residual connection mechanism, significantly reduces the amount of computation and parameters while maintaining the feature extraction effect. This enables the model to perform more efficient feature processing with limited computing resources, making it more suitable for real-time or resource-constrained crack detection scenarios. Through residual connections and multi-scale feature fusion, the module enhances the model's robustness to noise and interference. Even under complex backgrounds or undesirable data conditions, the model can detect cracks more accurately, improving the reliability of crack detection.
[0101] Furthermore, the feature map F5 undergoes multi-scale pooling and feature fusion through the spatial pyramid pooling module.
[0102] Specifically, the spatial pyramid pooling module includes multiple pooling layers, each corresponding to a specific scale. Through pooling operations at different scales, the spatial pyramid pooling module generates pooling features at multiple scales from the feature map F5. These features contain information at different scales, which can better describe the crack features in the image.
[0103] Pooling features of different scales are fused by feature concatenation, so that the fused feature map can capture both local details and global contextual information in the image.
[0104] Furthermore, the output feature map of the spatial pyramid pooling layer is used by the attention mechanism module to generate an attention weight map, which adjusts the importance of each region in the output feature map of the spatial pyramid pooling layer to obtain the crack extraction feature map output by the crack feature extraction module.
[0105] Specifically, the attention mechanism module employs the SegNext attention mechanism, which adaptively enhances crack edge information while suppressing background noise. It dynamically adjusts the attention weights for different regions, prioritizing crack edge details and effectively reducing interference from the background, enabling the model to allocate computational resources more precisely.
[0106] Furthermore, the crack feature fusion module includes two multi-dimensional feature fusion modules and two multi-dimensional enhanced feature fusion modules connected in sequence.
[0107] Specifically, the crack feature fusion module is used to effectively integrate crack features extracted from different scales and levels to obtain a more comprehensive, accurate and discriminative feature representation, thereby improving the performance of crack detection.
[0108] Furthermore, the multi-dimensional feature fusion module includes an upsampling layer, a context feature fusion module, and a multi-scale feature fusion module.
[0109] Specifically, through the multi-dimensional feature fusion module, the crack extraction feature map is comprehensively optimized and enhanced in terms of resolution, detail information, contextual information, and multi-scale information.
[0110] Furthermore, in the first multi-dimensional feature fusion module, after the crack extracted feature map passes through the upsampling layer, it is fused with the feature map F4 in the context feature fusion module. The resulting features are then fused into a fused feature map through local multi-scale feature fusion in the multi-scale feature fusion module.
[0111] Specifically, after the crack extraction feature map has undergone deep processing by the convolutional neural network, its spatial resolution may have been reduced. The upsampling layer amplifies these low-resolution feature maps to a higher resolution, so that they match the original input image or a higher-resolution feature map.
[0112] Furthermore, the context feature fusion module includes a channel attention module, a spatial attention module, and a feature splicing module.
[0113] Specifically, such as Figure 4 As shown, the context fusion feature module is a module used to integrate local features and global context information in an image, and is used to generate feature representations containing rich semantic information and spatial correlation, thereby improving the model's ability to understand and analyze image content.
[0114] Furthermore, the channel attention module is used to concatenate the first input feature map and the second input feature map in the channel dimension, process the concatenated feature map using the SE attention mechanism, and then split the processed feature map into a first weighted feature map and a second weighted feature map with the same number of channels as the first input feature map and the second input feature map.
[0115] Specifically, the two input feature maps are concatenated along the channel dimension, integrating the information from both maps and providing a richer feature base for subsequent attention mechanism processing. The SE mechanism compresses the feature maps using global pooling to obtain a global feature vector; then, it performs a non-linear transformation on the global feature vector through two fully connected layers to generate a weight vector; finally, the weight vector is multiplied channel-by-channel with the concatenated feature map to weight the feature channels, highlighting important channels and suppressing less important ones. The weighted feature maps each contain the feature information weighted by the channel attention mechanism, providing a weighted feature base for the subsequent spatial attention module.
[0116] Furthermore, the spatial attention module is used to perform weighted fusion of the first weighted feature map and the second weighted feature map with the first input feature map and the second input feature map, respectively.
[0117] Specifically, the weighted fusion operation employs element-wise multiplication, multiplying the weights in the weighted feature map with the feature values in the input feature map. This weights the features at different spatial locations in the input feature map, highlighting important spatial features and suppressing unimportant ones. Through weighted fusion, the spatial attention module strengthens the spatial correlations in the feature maps, enabling the model to focus more on important regions in the image related to the target object, while suppressing interfering features from the background, thus improving the model's understanding and analysis of the image's spatial structure.
[0118] Furthermore, the feature concatenation module is used to concatenate the channel dimensions of the two weighted fused feature maps obtained by the spatial attention module to obtain the output feature map of the context feature fusion module.
[0119] Specifically, the two weighted and fused feature maps obtained by the spatial attention module are concatenated along the channel dimension. The concatenated feature map integrates the feature information processed by channel attention and spatial attention, forming a comprehensive feature representation. The output feature map of the context feature fusion module contains rich semantic information and spatial correlation, which can provide strong feature support for subsequent image processing and analysis tasks, helping the model to complete the task more accurately.
[0120] The output feature map of the context feature fusion module is processed by the multi-scale feature fusion module to further fuse specific detail features and multi-scale features.
[0121] Furthermore, in the second multi-dimensional feature fusion module, after the fused feature map passes through the upsampling layer, it is fused with the feature map F3 in the context feature fusion module. The resulting features are then fused locally through the multi-scale feature fusion module to obtain a fused enhanced feature map.
[0122] Specifically, the fused feature map, through the second multi-dimensional feature fusion module, performs multi-scale feature re-fusion, contextual information enhancement, and channel information optimization, making the feature representation more comprehensive, balanced, refined, and efficient. It contains rich detailed features and extensive contextual information, while highlighting important channel features, thereby better capturing target and scene information in the image and improving the model's adaptability and understanding accuracy in complex scenes.
[0123] Furthermore, the multidimensional enhanced feature fusion module includes a convolution module, a context feature fusion module, and a multi-scale feature fusion module.
[0124] Specifically, through the multi-dimensional enhanced feature fusion module, the model can fully mine and integrate multi-dimensional feature information in the image, generating richer, more accurate and robust feature representations, thereby significantly improving the ability to understand and analyze image content.
[0125] Furthermore, in the first multidimensional enhanced feature fusion module, the fused enhanced feature map is passed through the convolution module and then fused with the fused feature map in the context feature fusion module. The resulting features are then fused locally through the multi-scale feature fusion module to obtain a multi-scale fused feature map.
[0126] Specifically, the fused and enhanced feature map is downsampled through a convolutional module to extract deep-level feature information. The contextual feature fusion module fuses local features with global contextual information, so that the features not only contain detailed information but also encompass the overall structure and semantic information of the image. The multi-scale feature fusion module further integrates feature details at different scales, enabling the features to simultaneously describe local regions and the overall scene in the image, thus enhancing the multi-dimensional expressive power of the features.
[0127] It should be noted that the convolutional module of the first multidimensional enhanced feature fusion module includes a convolutional layer with a kernel of 3, a stride of 2, and 256 channels, a batch normalization layer, and an activation function.
[0128] Furthermore, in the second multi-dimensional enhanced feature fusion module, the multi-scale fused feature map is passed through the convolution module and then fused with the crack extraction feature map in the context feature fusion module. The resulting features are then fused locally through the multi-scale feature fusion module to obtain a context-guided fused feature map.
[0129] Specifically, after further feature extraction, the multi-scale fusion feature map is deeply fused with the crack extraction feature map in the context feature fusion module, combining local and global information. The resulting features are then integrated with feature details at different scales through the multi-scale feature fusion module, ultimately generating a context-guided fusion feature map that can accurately describe crack features and guide context information.
[0130] It should be noted that the convolutional module of the second multidimensional enhanced feature fusion module includes a convolutional layer with a kernel of 3, a stride of 2, and 512 channels, a batch normalization layer, and an activation function.
[0131] Furthermore, in the crack detection module, after the fusion enhancement feature map, multi-scale fusion feature map, and context-guided fusion feature map are respectively passed through the detection layer to obtain the fusion enhancement detection feature map, multi-scale fusion detection feature map, and context-guided fusion detection feature map, the fusion enhancement detection feature map, multi-scale fusion detection feature map, and context-guided fusion detection feature map are respectively dimensionally reshaped and then tensor spliced to obtain the target detection box.
[0132] Specifically, such as Figure 5 As shown, the crack detection module introduces mask prototyping, enabling the model to complete target detection and segmentation tasks in a single forward propagation, thereby significantly enhancing the model's ability to capture crack contours and edges, and making it suitable for detecting complex backgrounds and irregular crack shapes.
[0133] Furthermore, the detection layer includes a standard convolutional and group normalization layer, two detail enhancement convolutional and group normalization layers, and a convolutional layer, used to convert the input feature map into a feature map containing object detection information.
[0134] Specifically, the detection layer is used to predict the target detection box, that is, to determine the location and size of the crack in the image. It extracts information related to the location and shape of the crack from the comprehensive feature map. By learning the feature patterns and spatial distribution of the crack, the detection layer can accurately predict the bounding box of the crack, including the location, category and confidence level of the crack.
[0135] The standard convolutional and group normalization layers of the detection layer are convolutional layers with a kernel of 3, a stride of 1, and 64 channels. After performing convolution operations on the input features, group normalization is performed.
[0136] It should be noted that group normalization involves dividing the channels of the feature map into several groups and normalizing the features within each group. Compared with batch normalization, group normalization does not depend on the batch size, making it more suitable for small batches or single samples. It helps stabilize the training process, accelerates model convergence, and improves the model's adaptability to features at different scales.
[0137] The detail enhancement convolution and group normalization layer of the detection layer is a deconvolution layer with a kernel of 3, a stride of 1, and 64 channels. After restoring the low-resolution feature map to the high-resolution pixel space, group normalization is performed to enhance the detail features in the feature map.
[0138] The feature maps output by the detail-enhancing convolution and group normalization layers are integrated and optimized through a convolutional layer with a kernel of 1, a stride of 1, and 65 channels, highlighting important feature channels and suppressing unimportant feature channels.
[0139] The three input feature maps are passed through a detection layer to further extract features relevant to the crack detection task. These features are then optimized and filtered. The resulting fused enhanced detection feature map, multi-scale fused detection feature map, and context-guided fused detection feature map are dimensionally reshaped to ensure they have the same dimensions. Tensor concatenation is then performed to integrate feature information from different processing paths, enabling more complex feature combinations and analysis. For example, dimensionality reshaping and tensor concatenation are implemented using the `view()` and `torch.cat()` functions in PyTorch.
[0140] Furthermore, the fusion enhancement feature map, multi-scale fusion feature map, and context-guided fusion feature map are respectively passed through a feature fusion convolutional layer to obtain the fusion enhancement convolutional feature map, multi-scale fusion convolutional feature map, and context-guided fusion convolutional feature map. Then, the fusion enhancement convolutional feature map, multi-scale fusion convolutional feature map, and context-guided fusion convolutional feature map are dimensionally reshaped and tensor concatenated to obtain the mask coefficients.
[0141] Furthermore, nonmaximum suppression processing is applied to the target detection box to obtain the crack detection box.
[0142] Specifically, the nonmaximum suppression process is used to filter out the best bounding boxes and remove unnecessary overlapping bounding boxes, which can ensure that each detected crack has a clear, non-overlapping bounding box.
[0143] Furthermore, the feature fusion convolutional layer includes a standard convolutional layer with a group normalization layer, a detail enhancement convolutional layer with a group normalization layer, and a convolutional layer, used to convert the input feature map into a feature map containing mask-related information.
[0144] Specifically, the mask coefficients represent the weight or importance of each pixel or region in the segmentation task. Their function is to control the contribution of different regions to the final segmentation result, or to weight different features when calculating the mask.
[0145] The standard convolutional and group normalization layers of the feature fusion convolutional layer are convolutional layers with a kernel of 3, a stride of 1, and 256 channels. After performing convolution operations on the input features, group normalization is performed.
[0146] The detail enhancement convolution and group normalization layer of the feature fusion convolution layer is a deconvolution layer with a kernel of 3, a stride of 1, and 256 channels. After restoring the low-resolution feature map to the high-resolution pixel space, group normalization is performed to enhance the detailed features in the feature map.
[0147] The feature maps output by the detail-enhancing convolution and group normalization layers are integrated and optimized through a convolutional layer with a kernel of 1, a stride of 1, and 32 channels, highlighting important feature channels and suppressing unimportant feature channels.
[0148] The three input feature maps are passed through a feature fusion convolutional layer to further extract features related to mask coefficient calculation. These features are then optimized and filtered. The resulting fused enhanced convolutional feature map, multi-scale fused convolutional feature map, and context-guided fused convolutional feature map are dimensionality-reshaped to ensure they have the same dimensions. Tensor concatenation is then performed to integrate feature information from different processing paths, enabling more complex feature combinations and analysis. For example, dimensionality reshaping and tensor concatenation are implemented using the `view()` and `torch.cat()` functions in PyTorch.
[0149] Furthermore, the context-guided fusion feature map is convolved and upsampled through a mask prototype layer to obtain a mask prototype.
[0150] Specifically, the mask prototype is a learned standard template or shape that represents the shape of a standard crack or target. It is a "template" for a certain target or region learned by the network and plays a reference and guiding role in the mask generation process.
[0151] Furthermore, the mask prototype layer includes a convolutional layer, an upsampling layer, and two convolutional layers of different scales, used to obtain the mask prototype.
[0152] Specifically, the convolutional layer of the mask prototype layer is a convolutional layer with a kernel of 3, a stride of 1, and 256 channels, used to extract local features from the input feature map.
[0153] The upsampling layer of the mask prototype layer is used to recover the spatial information lost due to previous convolution or pooling operations, providing a higher resolution feature map for subsequent mask prototype generation.
[0154] The second convolutional layer of the mask prototype layer is a convolutional layer with a kernel size of 3, a stride of 1, and 256 channels.
[0155] The third convolutional layer of the mask prototype layer is a convolutional layer with a kernel of 1, a stride of 1, and 32 channels, used to generate the mask prototype.
[0156] Furthermore, the mask coefficients and the mask prototype are multiplied by a matrix to obtain the crack segmentation mask.
[0157] Specifically, the mask coefficients and the mask prototype play complementary roles in mask generation. The mask prototype provides the basic shape and spatial structure of the target, while the mask coefficients dynamically adjust the weights and positions of these shapes based on the actual features and contextual information in the image, thereby generating the final accurate mask.
[0158] Furthermore, the crack detection model is trained using the following method:
[0159] Construct a training dataset for the crack detection model; wherein the training data includes a set of crack images, category labels and bounding boxes corresponding to cracks in each image, and segmentation mask labels for each image.
[0160] Specifically, the image set including cracks comprises multiple publicly available crack datasets and self-collected images containing cracks. The crack datasets and self-collected crack images undergo preprocessing, including affine transformation, normalization, and dimensionality conversion. Specifically, the OpenCV `warpAffine()` function is used to perform affine transformation on the images in the crack image set to adapt to the model input size requirements. Normalization involves normalizing the images in the crack image set, converting pixel values from 0-255 to 0-1 to accelerate model convergence. Dimensionality conversion involves converting the images in the crack image set from BHWC (batch, height, width, channel) format to BCHW (batch, channel, height, width) format to adapt to the model input requirements while improving computational efficiency and performance.
[0161] Since only a portion of the images in the publicly available crack dataset contain the label format required for YOLO training, the unlabeled data is labeled using Labelme annotation software to obtain the category labels and bounding boxes corresponding to the cracks.
[0162] The image annotated using Labelme software is analyzed to extract the coordinate information of the labeled polygons. Then, the OpenCV `fillPoly()` function is used to create a mask image as a segmentation mask label based on the polygon coordinate information. This mask image is a binary image where the pixel values of the target region are specific values, such as 255, and the pixel values of the background region are different values, such as 0.
[0163] Furthermore, the training dataset is loaded, and the crack detection model is trained using a total loss function consisting of the target prediction box loss function, the mask loss function, the category loss function, and the distributed focus loss function. The model parameters are updated using gradient backpropagation, and training ends when the loss function values converge, resulting in a trained crack detection model.
[0164] Specifically, the target prediction box loss function (Box Loss) is used to measure the difference between the position and size of the predicted box and the ground truth box. It is usually calculated using IoU (Intersection over Union) loss, that is, the IoU value between the predicted box and the ground truth box is calculated, and then 1 is subtracted from the IoU value to obtain the loss value.
[0165] The mask loss function is used to measure the difference between the predicted instance segmentation mask and the ground truth mask. It is usually calculated by comparing the pixel-level differences between the predicted mask and the ground truth mask. For example, the binary cross-entropy loss is used to measure the similarity between the predicted mask and the ground truth mask.
[0166] The category loss function (Cls Loss) is used to measure the difference between the predicted category probability and the true category. For example, it is calculated using the binary cross-entropy loss, which calculates the difference between the predicted category probability and the true category label, and then calculates the loss value using the cross-entropy formula.
[0167] The Distributed Focus Loss (DFL loss) is used to optimize the regression of the predicted bounding box. It takes into account the uncertainty of the target box and reduces the focus on easily classified samples by adjusting the weights of the loss function, and focuses more on difficult-to-classify samples. Its core idea is to use the cross-entropy function to optimize the probability of the two positions to the left and right of the label, so that the network distribution focuses on the vicinity of the label value.
[0168] The total loss function is the sum of the target prediction box loss function, the mask loss function, the category loss function, and the distributed focus loss function.
[0169] It should be noted that the training ends when the number of training sessions reaches a preset value, or when the training effect does not improve in 50 consecutive batches, triggering the early stop strategy.
[0170] Step S3: Based on the crack segmentation mask, obtain the width and length of the cracks in the concrete composite slab.
[0171] Specifically, because segmentation masks achieve fine-grained division of image regions by classifying and labeling each pixel, each pixel is assigned a label to indicate whether it belongs to a crack or the background, thereby accurately separating objects in the image from the background.
[0172] Furthermore, based on the crack segmentation mask of the image, the width of the cracks in the concrete composite slab is obtained, including the following steps S311-S313:
[0173] Step S311: Based on the crack segmentation mask, perform connected component labeling to obtain the coordinates of each connected component.
[0174] Specifically, the crack width is estimated by calculating the distance from each point in the connected region to the crack boundary. The connected region is an image region consisting of foreground pixels with the same pixel value and adjacent positions.
[0175] Step S312: For each point in each connected domain, use a binary search algorithm to determine the maximum radius of the intersection between the circle centered at each point and the crack boundary.
[0176] Specifically, starting from an initial radius, the radius value is gradually increased or decreased, checking whether a circle with the current radius intersects the crack boundary. If they intersect, the radius is increased; if they do not intersect, the radius is decreased. Through continuous iteration, the maximum radius at which a circle centered at that point intersects the crack boundary is finally determined.
[0177] Step S313: After subtracting 1 from the maximum radius, gradually increase the radius value with a preset floating-point precision until the inscribed circle is tangent to the boundary, thus obtaining the maximum width of the crack.
[0178] Specifically, subtract 1 from the determined maximum radius to obtain an initial radius value. Then, gradually increase the radius value with a preset floating-point precision, for example, 0.1. After each increase, check whether the circle with the current radius is tangent to the crack boundary. When a radius value is found that makes the circle tangent to the boundary, that radius value is the maximum width of the crack.
[0179] Furthermore, based on the crack segmentation mask of the image, the length of the crack in the concrete composite slab is obtained, including the following steps S321-S324:
[0180] Step S321: Based on the crack segmentation mask, use a skeleton extraction algorithm to extract the skeleton structure of the crack.
[0181] Specifically, the skeleton structure of the crack is extracted from the crack segmentation mask and used as the basis for subsequent length calculation. The skeleton structure is the center line of the crack and can represent the shape and direction of the crack.
[0182] The skeleton extraction algorithm gradually shrinks the crack area through iterative erosion operations until only a skeleton line with a width of one pixel remains. For example, the skeleton extraction algorithm can be a thinning algorithm, including the Zhang-Suen thinning algorithm and the Guo-Hall thinning algorithm.
[0183] Step S322: Identify the endpoints of the skeleton structure of the crack through convolution operation, and use the Sobel operator to calculate the gradient of each skeleton endpoint in the x and y directions to determine the preferred growth direction of each skeleton endpoint.
[0184] Specifically, the endpoints of the crack skeleton structure are identified, and the preferred growth direction of these endpoints in the crack extension direction is determined, providing a basis for subsequent crack repair.
[0185] The endpoints of the skeleton structure are those points on the skeleton that do not branch further; they mark the start, end, or branch points of cracks.
[0186] The gradient is a vector representing the direction and magnitude of the maximum rate of change at a point. The Sobel operator is a commonly used edge detection operator that can effectively calculate the gradient information of pixels in an image. By calculating the gradient of each skeleton endpoint, the preferred growth direction of the endpoint in the crack extension direction can be determined.
[0187] Step S323: Based on the preferred growth direction of each skeleton endpoint, use a region growing algorithm to repair the fractured crack skeleton and obtain the complete crack skeleton.
[0188] Specifically, the region growing algorithm is an iterative process. Starting from the endpoints of the crack skeleton, it gradually expands to the endpoints of adjacent crack skeletons according to the growth criterion, which is implemented in the gradient direction, and marks these pixels as visited until all broken crack parts are connected to form a continuous crack skeleton.
[0189] Step S324: Traverse the complete skeleton pixels of the crack to obtain the total length of the crack.
[0190] Specifically, starting from one end of the crack skeleton, the process traverses the pixels one by one along the skeleton until the other end is reached. During the traversal, the distance between adjacent pixels is calculated and these distances are summed to obtain the total length of the crack. In this embodiment, the Euclidean distance algorithm can be used to calculate the distance between adjacent pixels.
[0191] The target detection bounding box and geometric information (length and width) of the crack extracted by the model can be sent to the operation terminal, where the detection results are displayed in real time in the visual control interface.
[0192] In summary, the lightweight concrete composite slab crack detection method of this invention has the following beneficial effects:
[0193] 1. The crack detection model used in this invention can extract crack features of different scales from the input image. Even under complex backgrounds or different lighting conditions, it can maintain high detection accuracy. Through lightweight design, the computational complexity and number of parameters are reduced, enabling the model to run efficiently on resource-constrained devices. This lightweight design ensures the real-time performance of the model and can meet the needs of rapid on-site detection.
[0194] 2. This invention can not only detect the existence and location of cracks, but also automatically quantify the length and width of cracks through crack segmentation masks, providing reliable data support for engineering decisions.
[0195] 3. In the present invention, through the collaborative work of the crack feature extraction module and the crack feature fusion module, the model can extract and fuse crack features of different scales in the image, including low-level edge and texture information and high-level semantic information. This multi-scale feature fusion helps the model to more accurately identify and locate cracks, and can maintain high detection accuracy even in complex backgrounds or cracks of different sizes.
[0196] 4. The context feature fusion module of the present invention utilizes an attention mechanism to enhance the context perception capability of crack features. The model can better understand the environment and background of the crack, thereby effectively suppressing the interference of background noise during the detection process, highlighting the features of the crack area, and further improving the accuracy of detection.
[0197] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A lightweight concrete composite slab crack detection method, characterized by, The method comprises the following steps: acquire the surface image of the concrete composite slab to be detected and pre-process the image to obtain a processed image; wherein an image acquisition device installed on a sliding rail is used to take a picture of the surface of the concrete composite slab to be detected; perform crack detection on the processed image through a trained crack detection model to obtain a crack detection result in the image; wherein the crack detection model is a lightweight multi-scale context feature fusion model based on YOLOv8, comprising a crack feature extraction module, a crack feature fusion module and a crack detection module; the crack feature extraction module is used to extract different scale features of the image; the crack feature fusion module is used to fuse the features of different scales to obtain a fusion enhanced feature map, a multi-scale fusion feature map and a context guided fusion feature map; the crack detection module obtains a crack detection frame and a crack segmentation mask based on the fusion enhanced feature map, the multi-scale fusion feature map and the context guided fusion feature map; the crack feature extraction module comprises a first convolution module, four convolution feature fusion modules, a spatial pyramid pooling module and an attention mechanism module; wherein the four convolution feature fusion modules are sequentially down-sampled, and the channel number of the convolution layers in them is doubled; the convolution feature fusion module comprises a convolution module and a multi-scale feature fusion module; the multi-scale feature fusion module comprises a plurality of local multi-scale feature fusion modules and an output module connected in sequence, and the output feature maps of the local multi-scale feature fusion modules are spliced in the output module; wherein the local multi-scale feature module adopts a grouped convolution structure and a residual connection mechanism; based on the crack segmentation mask, the width and length of the crack of the concrete composite slab are obtained; wherein the length of the crack is obtained by: based on the crack segmentation mask, using a skeleton extraction algorithm to extract the skeleton structure of the crack; through convolution operation, the end points of the skeleton structure of the crack are identified, and the gradients of each skeleton end point in the x and y directions are calculated using a Sobel operator to determine the priority direction of the growth of each skeleton end point; based on the priority direction of the growth of each skeleton end point, a region growing algorithm is used to repair the broken crack skeleton to obtain a complete skeleton of the crack; the total length of the crack is obtained by traversing the complete skeleton pixel points of the crack.
2. The method of claim 1, wherein, In the crack detection module, the fusion enhanced feature map, the multi-scale fusion feature map and the context guided fusion feature map pass through detection layers respectively to obtain a fusion enhanced detection feature map, a multi-scale fusion detection feature map and a context guided fusion detection feature map, and then the fusion enhanced detection feature map, the multi-scale fusion detection feature map and the context guided fusion detection feature map are respectively subjected to dimension remodeling and tensor splicing to obtain a target detection frame. The fusion enhanced feature map, the multi-scale fusion feature map and the context guided fusion feature map are respectively subjected to dimension remodeling and tensor splicing after being subjected to feature fusion convolutional layer to obtain a mask coefficient; The context guided fusion feature map is subjected to convolution and up-sampling operation by a mask prototype layer to obtain a mask prototype; The mask coefficient and the mask prototype are subjected to matrix multiplication to obtain the crack segmentation mask; The target detection frame is subjected to non-maximum suppression processing to obtain the crack detection frame.
3. The method of claim 2, wherein, The detection layer includes one standard convolution and group normalization layer, two detail enhancement convolution and group normalization layers and one convolution layer, which are used to convert the input feature map into a feature map containing target detection related information; The feature fusion convolutional layer includes one standard convolution and group normalization layer, one detail enhancement convolution and group normalization layer and one convolution layer, which are used to convert the input feature map into a feature map containing mask related information; The mask prototype layer includes one convolution layer, one up-sampling layer and two convolution layers of different scales, which are used to obtain a mask prototype.
4. The method of claim 1, wherein, In the crack feature extraction module, The processed image is subjected to the first convolution module to obtain a feature map F1; The feature map F1 is sequentially subjected to down-sampling by four convolution feature fusion modules to obtain a feature map F2, a feature map F3, a feature map F4 and a feature map F5, respectively; The feature map F5 is subjected to multi-scale pooling and feature fusion by the spatial pyramid pooling module; The output feature map of the spatial pyramid pooling layer is subjected to the attention mechanism module to generate an attention weight map, adjust the importance of each region in the output feature map of the spatial pyramid pooling layer, and obtain a crack extraction feature map output by the crack feature extraction module.
5. The method of claim 4, wherein, In the convolution feature fusion module, the convolution module includes a convolution layer, a batch normalization layer and an activation function, which are used to extract features from the input feature map.
6. The method of claim 5, wherein, The local multi-scale feature fusion module includes a first convolution layer, a first segmentation layer, a second convolution layer, a second segmentation layer, a third convolution layer, a feature splicing layer, a fourth convolution layer and an output layer; wherein, The input feature map of the local multi-scale feature fusion module is subjected to feature extraction by the first convolution layer and is subjected to channel segmentation in the first segmentation layer to obtain a first sub-feature map of the first output feature map and a second sub-feature map of the first output feature map by equally dividing the output feature map of the first convolution layer; The first sub-feature map of the first output feature map is subjected to feature extraction by the second convolution layer and is subjected to channel segmentation in the second segmentation layer to obtain a first sub-feature map of the second output feature map and a second sub-feature map of the second output feature map by equally dividing the output feature map of the second convolution layer; wherein, the second convolution layer is a group convolution, and the number of channels is the number of channels of the first convolution layer divided by 2 and rounded down. The first sub-feature map of the second output feature map extracts features through the third convolutional layer to obtain a third output feature map; wherein the third convolutional layer is a grouped convolution, and the number of channels is the number of channels of the first convolutional layer divided by 4 and rounded down; The second sub-feature map of the first output feature map, the second sub-feature map of the second output feature map, and the third output feature map are spliced in the channel dimension in the feature splicing layer to obtain a spliced feature map; The spliced feature map passes through the fourth convolutional layer to reduce the number of channels, and the number of channels of the obtained feature map is the same as that of the input feature map of the local multi-scale feature fusion module; The output feature map of the fourth convolutional layer and the input feature map of the local multi-scale feature fusion module are added in the output layer to obtain the output feature map of the local multi-scale feature fusion module.
7. The method of claim 4 wherein, The crack feature fusion module comprises two multi-dimensional feature fusion modules and two multi-dimensional enhanced feature fusion modules connected in sequence; wherein, The multi-dimensional feature fusion module comprises an up-sampling layer, a context feature fusion module, and a multi-scale feature fusion module; The multi-dimensional enhanced feature fusion module comprises a convolutional module, a context feature fusion module, and a multi-scale feature fusion module.
8. The method of claim 7, wherein, In the first multi-dimensional feature fusion module, the crack extraction feature map is fused with the feature map F4 in the context feature fusion module after passing through the up-sampling layer, and the obtained feature is fused with the feature map F4 in the context feature fusion module after passing through the multi-scale feature fusion module to obtain a fused feature map; In the second multi-dimensional feature fusion module, the fused feature map is fused with the feature map F3 in the context feature fusion module after passing through the up-sampling layer, and the obtained feature is fused with the feature map F3 in the context feature fusion module after passing through the multi-scale feature fusion module to obtain a fused enhanced feature map; In the first multi-dimensional enhanced feature fusion module, the fused enhanced feature map is fused with the fused feature map in the context feature fusion module after passing through the convolutional module, and the obtained feature is fused with the fused feature map in the context feature fusion module after passing through the multi-scale feature fusion module to obtain a multi-scale fused feature map; In the second multi-dimensional enhanced feature fusion module, the multi-scale fused feature map is fused with the crack extraction feature map in the context feature fusion module after passing through the convolutional module, and the obtained feature is fused with the crack extraction feature map in the context feature fusion module after passing through the multi-scale feature fusion module to obtain a context-guided fused feature map.
9. The method of claim 8, wherein, The context feature fusion module comprises a channel attention module, a spatial attention module, and a feature splicing module; wherein, The channel attention module is configured to splice the first input feature map and the second input feature map in the channel dimension, process the spliced feature map using an SE attention mechanism, and then split the processed feature map into a first weight feature map and a second weight feature map with the same number of channels as the first input feature map and the second input feature map; The spatial attention module is configured to perform weighted fusion of the first weight feature map and the second weight feature map with the first input feature map and the second input feature map, respectively. The feature splicing module is configured to splice the channel dimensions of the two weighted and fused feature maps obtained by the spatial attention module to obtain an output feature map of the context feature fusion module.
10. The method of claim 1, wherein, Based on the crack segmentation mask of the image, the width of the crack of the concrete composite slab is obtained, including: Based on the crack segmentation mask, connected domain labeling is performed to obtain the coordinates of each connected domain. For each point of each connected domain, a dichotomy algorithm is used to determine the maximum radius at which a circle with the point as the center intersects the crack boundary. After reducing the maximum radius by 1, the radius value is gradually increased with a preset floating-point precision until the inscribed circle is tangent to the boundary, and the maximum width of the crack is obtained.
Citation Information
Patent Citations
Method and system for detecting and segmenting length and width of tunnel lining crack
CN116863134A
Dam crack detection method and device, electronic equipment and storage medium
CN118747838A