CN-122023227-A - SWINBH-UNET-based intelligent detection method for surface crack defects
Abstract
The invention discloses a surface crack defect intelligent detection method based on SWINBH-UNET, which comprises the steps of 1, constructing a SWINBH-UNET model, comprising an encoder, a decoder and a connecting module, wherein the encoder comprises a SwinTransformer Block module, a first shallow layer feature and a plurality of intermediate layer features are sequentially obtained by sampling crack images layer by layer, the first shallow layer feature extracts edge information through a BAM module and forms a top shallow layer feature with the edge information, 2, training the model constructed in step 1 by using a building surface crack reference dataset, 3, collecting a plurality of to-be-detected building surface crack images, 4, dividing each to-be-detected building surface crack image, and inputting the segmented to-be-detected building surface crack images into the trained SWINBH-UNET model to obtain a crack detection result. The invention can capture the multi-scale characteristics of the crack under complex and various forms, blurred boundaries and background interference, and the crack boundary segmentation is accurate.
Inventors
- LI JIE
- XU YUQING
- SUN SHANGSHANG
- WANG XINDI
- XU FENGYU
- FAN BAOJIE
- ZHOU WENZHANG
Assignees
- 南京邮电大学
Dates
- Publication Date
- 20260512
- Application Date
- 20251020
Claims (10)
- 1. A SWINBH-UNET-based intelligent detection method for surface crack defects is characterized by comprising the following steps: Step 1, constructing SWINBH-UNET model, which comprises an encoder, a decoder and a connection module; The encoder comprises a SwinTransformer Block module, a SwinTransformer Block module sequentially obtains a first shallow layer feature and a plurality of middle layer features by downsampling the crack image layer by layer, wherein the first shallow layer feature extracts edge information through the BAM module and forms a top shallow layer feature with the edge information; The connection module is used for information transfer between the encoder and the decoder; Step 2, training the SWINBH-UNET model constructed in the step 1 by using a building surface crack reference data set; Step 3, acquiring a plurality of images of the surface cracks of the building to be detected; And 4, after each image of the surface crack of the building to be detected is segmented, inputting the segmented image into the SWINBH-UNET model after training in the step 2, and obtaining a crack detection result of the image of the surface crack of the building to be detected.
- 2. The intelligent detection method for surface crack defects based on SWINBH-UNET of claim 1, wherein in step 1, a calculation formula of a Loss function Loss of a SWINBH-UNET model is as follows: ; Wherein: LB= Lwbce+ Ldice wherein Lwbce is the weighted BCE loss; Ldice is the Dice loss; LB is edge perception loss; a. b and c are weighting coefficients of Lwbce, ldice and LB, respectively, and a > c, b > c.
- 3. The intelligent detection method for surface crack defects based on SWINBH-UNET of claim 2, wherein in step 1, the calculation formula of Lwbce is: Wherein N is the total number of pixels of the crack image; yi is the real label value of the ith pixel in the crack image, and takes the value of 0 or 1, when yi=0, the ith pixel is the background or the crack, and when yi=1, the ith pixel is the foreground or the crack; The probability that the ith pixel in the crack image is the foreground takes the value of [0,1]; ω1 is the foreground pixel weight and ω0 is the background pixel weight.
- 4. The intelligent detection method for surface crack defects based on SWINBH-UNET of claim 3, wherein the calculation formula of Ldice is: In the formula, The number of pixels predicted as foreground and true as foreground is approximately calculated; Is the total number of real foreground pixels; is the sum of the probabilities predicted to be foreground pixels.
- 5. The intelligent detection method for surface crack defects based on SWINBH-UNET of claim 1, wherein in step 1, the connection module comprises a jump connection and a bridge layer; the bottom layer characteristics output by the encoder are transmitted to the decoder through the bridging layer and used as bottom layer input characteristics of the decoder; the decoder performs layer-by-layer up-sampling on the bottom layer input characteristics to obtain decoded output characteristics; The top shallow layer characteristics and all middle layer characteristics of the encoder are connected with the corresponding layer characteristics of the decoder in a jumping way to realize information transmission; and the bridge layer and each layer of up-sampling adopt residual blocks to perform feature fusion and detail feature recovery, wherein the residual blocks comprise mixed cavity convolution HDC and SE attention mechanisms.
- 6. The method for intelligently detecting surface crack defects based on SWINBH-UNET, wherein the mixed cavity convolution HDC adopts three 3×3 cavity convolutions with expansion rates of 1,3 and 5 respectively to serially connect, so that adaptability to fine cracks and wide cracks is enhanced.
- 7. The method for intelligently detecting the surface crack defect based on SWINBH-UNET of claim 1, wherein the SwinTransformer Block module can synchronously capture global morphological characteristics and local detail characteristics of the crack through a hierarchical window self-attention mechanism W-MSA/SW-MSA in the process of downsampling the crack image layer by layer, expand a model receptive field through the self-attention mechanism, and dynamically divide a window through a sliding window technology so as to balance calculation efficiency and characteristic capturing capacity, thereby being suitable for a long and thin low-contrast crack target, wherein the global morphological characteristics comprise crack trend and crack distribution, and the local detail characteristics comprise edge textures.
- 8. The method for intelligently detecting surface crack defects based on SWINBH-UNET of claim 1, wherein in step 1, the output characteristics decoded by the decoder are subjected to channel optimization through a channel attention mechanism SE, texture channels and edge characteristic channels related to cracks are highlighted, background noise channels are restrained, and further a crack detection result is obtained.
- 9. The method for intelligently detecting surface crack defects based on SWINBH-UNET in accordance with claim 1, wherein in step 2, the method for training the model SWINBH-UNET by using the disclosed reference data set for building surface crack comprises the following steps: step 2-1, selecting a building surface CRACK reference dataset which is one or a combination of CRACK500, DEEPCRACK, CFD and AigleRN; Step 2-2, reducing all pictures in the building surface crack reference data set selected in the step 2-1 to 256×256 so as to speed up training, and matching with the crack images input in the step 1; 2-3, performing data enhancement operation on each crack image in the building surface crack reference data set reduced in the step 2-2 to obtain a building surface crack enhancement data set, wherein the data enhancement operation comprises 7 steps of random cutting, motion blurring, randomly changing brightness, contrast, saturation and tone of the image, randomly rotating the image, randomly horizontally overturning and vertically overturning, and randomly rotating the image by 90, 180 or 270 degrees; And 2-4, training the SWINBH-UNET model constructed in the step 1 by using the building surface crack enhancement data set.
- 10. The intelligent detection method of the surface crack defect based on SWINBH-UNET, which is characterized in that the image of the surface crack of the building to be detected in the step 3 is a bridge surface crack image or a hydraulic building surface crack image.
Description
SWINBH-UNET-based intelligent detection method for surface crack defects Technical Field The invention relates to the technical field of bridge detection, in particular to an intelligent detection method for surface crack defects based on SWINBH-UNET. Background The bridge structure health monitoring, especially the detection of the surface cracks of the building, has extremely important significance. In the task of building surface crack detection, the key problems of complex environmental interference, various crack forms, difficult accurate capture of boundary details and the like are generally faced. At present, detection is mainly carried out manually, and the detection mode has obvious bottlenecks in efficiency and precision, so that an automatic and intelligent bridge surface defect detection technology becomes a current research hot spot. At present, a deep learning method is also adopted to identify defects such as bridge cracks, for example, a Chinese patent application with the application number of CN2022115789221 and the name of "a bridge damage identification method based on deep learning" is disclosed, and the method comprises the steps of S1, selecting different bridge structure surface damage pictures as training samples, S2, carrying out model training on the selected samples by using an Adam optimization algorithm, S3, adjusting training intensive verification set combination, selecting a model with the best performance, S4, applying the best model to an actual engineering test, combining a multi-scale sliding window, and constructing an automatic bridge structure surface damage identification model by migration training A lexNet convolutional neural network through a migration learning technology, so that three bridge structure surface damage types including cracks, defects and rust can be quickly identified. In addition, the invention is applied for a Chinese patent with the number of CN202411653623.9, the invention is named as a pavement crack detection method and system, which comprises the steps of acquiring a plurality of pavement crack images, constructing a Swin-Unet model, determining the total loss of the Swin-Unet model by utilizing the plurality of pavement crack images, training the Swin-Unet model by utilizing the total loss of the Swin-Unet model, taking the trained Swin-Unet model as a pavement crack detection model, inputting the pavement crack image to be detected into the pavement crack detection model, and obtaining a pavement crack detection result output by the pavement crack detection model, wherein the comprehensive capturing capability of global and local characteristics of cracks and the segmentation effect on crack details can be improved. However, in use, the above deep learning method is not accurate enough for capturing multi-scale features of the crack and not accurate enough for dividing the boundary due to complex and various crack forms, blurred boundaries, background interference and the like. Disclosure of Invention Aiming at the defects of the prior art, the invention provides the intelligent detection method for the surface crack defects based on SWINBH-UNET, which can capture the multi-scale characteristics of the crack under the conditions of complex and various forms, blurred boundaries and background interference and accurate crack boundary segmentation. In order to solve the technical problems, the invention adopts the following technical scheme: A SWINBH-UNET-based intelligent detection method for surface crack defects comprises the following steps: And step 1, constructing SWINBH-UNET models, wherein the models comprise an encoder, a decoder and a connection module. The encoder comprises a SwinTransformer Block module, a SwinTransformer Block module sequentially obtains a first shallow layer feature and a plurality of middle layer features through layer-by-layer downsampling on a crack image, wherein the first shallow layer feature extracts edge information through a BAM module and forms a top shallow layer feature with the edge information. The connection module is used for information transfer between the encoder and the decoder. And 2, training the SWINBH-UNET model constructed in the step 1 by using the building surface crack reference data set. And step 3, acquiring a plurality of images of the surface cracks of the building to be detected. And 4, after each image of the surface crack of the building to be detected is segmented, inputting the segmented image into the SWINBH-UNET model after training in the step 2, and obtaining a crack detection result of the image of the surface crack of the building to be detected. In step 1, the calculation formula of the Loss function Loss of SWINBH-UNET model is: Wherein: LB= Lwbce+ Ldice where Lwbce is the weighted BCE loss. Ldice is the Dice penalty, and LB is the edge-aware penalty. A. b and c are weighting coefficients of Lwbce, ldice and LB, respectively, and a > c, b > c. In step 1, lwbce has th