Concrete crack batch identification method based on visual image
By using the Attention U-Net network and differential convolution module in concrete crack detection, combined with the gated attention mechanism, the problem of insufficient detection accuracy in the existing technology is solved, and high-precision identification and rapid identification of surface cracks in concrete structures are achieved. detection.
Patent Information
- Application Number
- CN202410809526.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-09-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing technology for concrete crack detection, edge detection operators and deep learning-based methods are difficult to correctly reflect the overall gradient distribution of the image, resulting in insufficient detection accuracy under complex conditions and unable to meet practical application needs.
Using the PDU-Net network based on Attention U-Net, combined with the differential convolution module PDCBlock and the gated attention mechanism, through differential convolution operation and Gaussian filtering and other technologies, rich crack gradient information and semantic information are extracted to identify concrete cracks. Batch identification.
It improves the identification accuracy of surface cracks in concrete structures, has fast detection speed, high accuracy and good applicability, and can effectively process complex images to meet practical application needs.
Smart Images

Figure CN118691576A
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of crack detection, and in particular to a method for batch identifying concrete cracks based on visual images. Background Art
[0002] Concrete-like rock is a common building material used in infrastructure construction, and is widely used in infrastructure construction such as roads, bridges and dams. Due to the influence of the environment and loads, these basic material structures will age over time, causing damage to the health of the structure. Among the various indicators of building structural health, cracks are one of the key parameters that directly indicate the structural condition. Statistical analysis shows that 46% of structural weaknesses are simply due to the failure to detect structural cracks. Therefore, continuous and effective crack detection is very important to ensure structural safety.
[0003] Crack detection is a classic engineering problem. The main methods include actual measurement, sensor positioning, and image observation. Manual measurement is simple and easy, but time-consuming and labor-intensive, and it is difficult to be competent in large-scale structural detection; the sensor positioning method has high accuracy, but each crack needs to install equipment and cannot meet the low-cost requirements. Using video / images to detect the observed crack information is simple and efficient. This detection method is increasingly becoming the first choice for large-scale structural safety monitoring. The problem of crack detection in images is similar to the problem of edge detection in images. There are three commonly used crack image detection methods: edge detection operator-based method, deep learning-based edge detection method, and image semantic segmentation method. However, considering that there are certain differences between global gradients and local gradients, the threshold selection method is difficult to correctly reflect the overall gradient distribution of the image. Therefore, the edge detection operator often shows limited detection capabilities when processing complex real images.
[0004] Based on deep learning edge detection methods, the existing technology uses U-Net to achieve pixel-level segmentation of crack images. Neighborhood aggregation is no longer required for post-processing, and crack recognition efficiency is high. However, in the U-Net encoding process, traditional convolution usually directly aggregates local strong semantic information, and the ability to extract image gradient information is limited, making it difficult to learn crack edge information with complex backgrounds. A new set of pattern subclasses containing meanings such as edges and corners is also defined. In the local area with the minimum variance, the local pattern represented by the central pixel difference is directly merged into the corresponding subclass to achieve low-cost crack edge recognition. By rasterizing and binarizing the image, the horizontal and vertical projections of the pixel standard deviation are extracted as feature quantities to classify the cracks. These methods encode in local patterns, but lack semantic information of cracks. The above methods can achieve good edge detection effects under ideal conditions, but in actual applications, the accuracy of their detection models is limited and often cannot meet the actual application requirements. Summary of the invention
[0005] The purpose of the present invention is to provide a method for batch identification of concrete cracks based on visual images to solve the problems mentioned in the above background technology.
[0006] To achieve the above object, the present invention provides a method for batch identification of concrete cracks based on visual images, comprising the following steps:
[0007] S1, collect concrete crack images, convert the crack images into grayscale images and perform preprocessing;
[0008] S2, performing preliminary crack region segmentation on the preprocessed grayscale image, and converting the segmented image into a binary crack image;
[0009] S3, using Gaussian filtering to remove noise in the binary crack image to obtain a denoised binary crack image;
[0010] S4. Build the PDU-Net network based on Attention U-Net, including the decoder and encoder. The decoder uses the differential convolution-based module PDCBlock.
[0011] S5. Input the training set and the validation set into the PDU-Net network for training and validation, and save the model with the best effect;
[0012] S6. Use the model in S5 to test the crack images in the test set and obtain the test results.
[0013] Preferably, the grayscale image in S1 is subjected to bilateral filtering to remove background noise, and then the filtered image is enhanced using Gamma transformation to obtain a preprocessed grayscale image.
[0014] Preferably, in S3, an improved Zhang parallel thinning algorithm is used to obtain a crack skeleton line with a single pixel width; the number of crack skeleton line pixels in the crack area is calculated to obtain the length information of the crack, and the orthogonal skeleton line method is used to obtain the maximum width and average width of the crack.
[0015] Preferably, the maximum width and average width of the crack are calculated as follows:
[0016] a. Calculate the normal vector of each point on the crack skeleton line using the local pixel point straight line fitting method;
[0017] b. Taking each point on the crack skeleton line as a starting point, sampling is performed on the grayscale image along the respective normal vectors and their reverse directions, and the grayscale values of all sampling points are fitted using a Gaussian function to obtain a fitting curve;
[0018] c. Calculate the mean and standard deviation of the fitting curve, and use the difference between the mean and the standard deviation as the preliminary determination of the left edge point of the crack, and use the sum of the mean and the standard deviation as the preliminary determination of the right edge point of the crack;
[0019] d. Use the grayscale threshold method to determine the final left and right edge points of the crack.
[0020] Preferably, the specific steps of using the gray threshold method to accurately determine the final left and right edge points of the crack are as follows:
[0021] d1. Get the minimum value among the grayscale values of all sampling points, and add up the grayscale values of all sampling points to get the average value;
[0022] d2, take the left edge point as the starting point; initialize a=1;
[0023] d3, taking any a-th sampling point in the neighborhood of the starting point as the current sampling point;
[0024] d4. Compare the gray value of the current sampling point with the mean and minimum values respectively. If the gray value of the current sampling point is greater than the mean and the difference between the gray value of the current sampling point and the minimum value is greater than the set threshold, it means that the current sampling point is the background, and the a-1th sampling point is the final left edge point of the crack (x l ,y l ), and execute step e. Otherwise, it means that the current sampling point belongs to the crack area, and after assigning a+1 to a, return to step d3 and finally obtain the final right edge point of the crack (x r ,y r ).
[0025] Preferably, the maximum inter-class variance method (Otsu method) is used in S3 to determine the optimal threshold for image segmentation to distinguish the crack area and the background area in the image:
[0026] For the image processed by S3, t is the segmentation threshold of the crack area and the background, the number of points in the crack area accounts for h0 of the image, and the average grayscale is m0; the number of points in the background accounts for h1 of the image, and the average grayscale is m1; the total average grayscale of the image is:
[0027] m=h0*m0+h1*m1
[0028] Traverse t from the minimum gray value to the maximum gray value, when t makes the value g = h0*(m0-m) 2 +h1*(m1-m) 2 When t is maximum, it is the optimal threshold for segmentation.
[0029] Preferably, the encoder includes 5 stages, and each stage executes a PDCBlock and then performs maximum pooling, so that the output size becomes 1 / 2 of the original size, and the number of channels of the convolution layer becomes twice of the original size; each PDCBlock is composed of 3 different convolutional layers, and different convolutional layers of the same PDCBlock have filters of the same size. After 4 poolings, the output scale becomes 1 / 16 of the initial image, and the number of channels of the convolution layer becomes 16 times of the initial image.
[0030] Preferably, the decoder includes 5 stages, from the 1st to the 4th stage, each stage performs an upsampling to double the original output image size, and then combines it with the features extracted by the previous layer of PDCBlock. Figure 1 The result is then input to AG, and the calculated result is concatenated with the decoded feature map. The number of channels becomes twice as much as the original one, and the image size remains unchanged. Then two convolutions are performed, and the number of channels is restored. This is performed four times in sequence. In the fifth stage, one convolution is performed to output a feature image with the same size as the original image and a channel number of 1.
[0031] Preferably, PDCBlock is composed of three residual blocks, each of which uses a depthwise separable convolution structure to perform convolution on each channel. Each residual block is composed of a 3×3 depthwise convolution layer, a ReLU layer, and a 1×1 point convolution layer.
[0032] Preferably, the PDC pixel differential convolution operation formula is: i The differential convolution operation of pixels in the neighborhood is:
[0033]
[0034] Among them, x i is the i-th pixel of the input feature map, x i+j For x i Pixels in the neighborhood R (R∈3×3), w i is the weight corresponding to the 3×3 convolution kernel, x i+j -x i is pixel x i The difference information.
[0035] Therefore, the present invention adopts the above-mentioned batch recognition method of concrete cracks based on visual images, which can identify cracks on the surface of concrete structures in color images, judge the cracks and process the fragment connections, effectively improve the recognition accuracy of cracks on the surface of concrete structures, and has the advantages of fast detection speed, high accuracy and good applicability.
[0036] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a schematic diagram of the overall process of an embodiment of the present invention;
[0038] Figure 2 A schematic diagram of the PDU-Net structure of an embodiment of the present invention;
[0039] Figure 3 PDCBlock internal structure diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0040] Example
[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0042] Reference Figure 1 The present invention discloses a method for batch identification of concrete cracks based on visual images, comprising the following steps:
[0043] S1. Collect concrete crack images, convert the crack images into grayscale images and perform preprocessing; perform bilateral filtering on the grayscale images to remove background noise, and then use Gamma transformation to enhance the filtered images to obtain preprocessed grayscale images.
[0044] S2, performing preliminary crack region segmentation on the preprocessed grayscale image, and converting the segmented image into a binary crack image;
[0045] S3, using Gaussian filtering to remove noise in the binary crack image to obtain a denoised binary crack image;
[0046] In S3, the improved Zhang parallel thinning algorithm is used to obtain the crack skeleton line with a single pixel width; the number of crack skeleton line pixels in the crack area is calculated to obtain the length information of the crack, and the orthogonal skeleton line method is used to obtain the maximum width and average width of the crack.
[0047] The calculation process of the maximum width and average width of the crack is as follows:
[0048] a. Calculate the normal vector of each point on the crack skeleton line using the local pixel point straight line fitting method;
[0049] b. Taking each point on the crack skeleton line as a starting point, sampling is performed on the grayscale image along the respective normal vectors and their reverse directions, and the grayscale values of all sampling points are fitted using a Gaussian function to obtain a fitting curve;
[0050] c. Calculate the mean and standard deviation of the fitting curve, and use the difference between the mean and the standard deviation as the preliminary determination of the left edge point of the crack, and use the sum of the mean and the standard deviation as the preliminary determination of the right edge point of the crack;
[0051] d. Use the grayscale threshold method to determine the final left and right edge points of the crack. The specific steps are as follows:
[0052] d1. Get the minimum value among the grayscale values of all sampling points, and add up the grayscale values of all sampling points to get the average value;
[0053] d2, take the left edge point as the starting point; initialize a=1;
[0054] d3, taking any a-th sampling point in the neighborhood of the starting point as the current sampling point;
[0055] d4. Compare the gray value of the current sampling point with the mean and minimum values respectively. If the gray value of the current sampling point is greater than the mean and the difference between the gray value of the current sampling point and the minimum value is greater than the set threshold, it means that the current sampling point is the background, and the a-1th sampling point is the final left edge point of the crack (x l ,y l ), and execute step e. Otherwise, it means that the current sampling point belongs to the crack area, and after assigning a+1 to a, return to step d3 and finally obtain the final right edge point of the crack (x r ,y r ).
[0056] The maximum inter-class variance method (Otsu method) is used to determine the optimal threshold for image segmentation to distinguish the crack area and the background area in the image:
[0057] For the image processed by S3, t is the segmentation threshold of the crack area and the background, the number of points in the crack area accounts for h0 of the image, and the average grayscale is m0; the number of points in the background accounts for h1 of the image, and the average grayscale is m1; the total average grayscale of the image is:
[0058] m=h0*m0+h1*m1
[0059] Traverse t from the minimum gray value to the maximum gray value, when t makes the value g = h0*(m0-m) 2 +h1*(m1-m) 2 When t is maximum, it is the optimal threshold for segmentation.
[0060] S4. Build the PDU-Net network based on Attention U-Net (structure as Figure 2 ), including a decoder and an encoder. The decoder uses a module based on differential convolution, PDCBlock, which adds differential convolution in two directions, namely, differential convolution in the center direction and in the angular direction. This module integrates the pixel differential calculation in two neighborhoods into the convolution operation, which not only effectively extracts rich crack gradient information but also retains the semantic information extracted by the convolutional neural network;
[0061] During decoding, before feature concatenation, a gated attention mechanism (AG) is used to activate the feature areas extracted by PDCBlock.
[0062] The encoder consists of 5 stages. After executing a PDCBlock in each stage, maximum pooling is performed, and the output size becomes 1 / 2 of the original size, and the number of channels in the convolution layer becomes twice as much as the original size. Each PDCBlock consists of 3 different convolutional layers. Different convolutional layers of the same PDCBlock have filters of the same size. After 4 pooling, the output scale becomes 1 / 16 of the initial image, and the number of channels in the convolution layer becomes 16 times of the initial image.
[0063] The decoder consists of 5 stages. From stage 1 to stage 4, each stage performs an upsampling to double the original output image size, and then combines it with the features extracted by the previous layer of PDCBlock. Figure 1 The result is then input to AG, and the calculated result is concatenated with the decoded feature map. The number of channels becomes twice as much as the original one, and the image size remains unchanged. Then two convolutions are performed, and the number of channels is restored. This is performed four times in sequence. In the fifth stage, one convolution is performed to output a feature image with the same size as the original image and a channel number of 1.
[0064] Each stage includes multiple main operations. Conv2d-pd1 and Conv2d-pd2 represent two different differential convolutions, Conv2d-cv represents ordinary convolution, Att represents gated attention mechanism, Cat represents feature concatenation, Conv2d represents normalization and ReLU activation operations after convolution, and Conv represents Sigmod activation operation after convolution.
[0065] like Figure 3 ,PDCBlock consists of 3 residual blocks. A depth-wise separable convolution structure is used inside each residual block to perform convolution on each channel. Each residual block consists of a 3×3 depth convolution layer, a ReLU layer, and a 1×1 point convolution layer.
[0066] PDC pixel differential convolution operation formula, for the i-th pixel x i The differential convolution operation of pixels in the neighborhood is:
[0067]
[0068] Among them, x i is the i-th pixel of the input feature map, x i+j For x i Pixels in the neighborhood R (R∈3×3), w i is the weight corresponding to the 3×3 convolution kernel, x i+j -x i is pixel x i The difference information.
[0069] S5. Input the training set and the validation set into the PDU-Net network for training and validation, and save the model with the best effect;
[0070] S6. Use the model in S5 to test the crack images in the test set and obtain the test results.
[0071] Therefore, the present invention adopts the above-mentioned batch recognition method of concrete cracks based on visual images, which can identify cracks on the surface of concrete structures in color images, judge the cracks and process the fragment connections, effectively improve the recognition accuracy of cracks on the surface of concrete structures, and has the advantages of fast detection speed, high accuracy and good applicability.
[0072] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.
Claims
1. A method for batch identification of concrete cracks based on visual images, characterized in that: The following steps are involved: S1, collect concrete crack images, convert the crack images into grayscale images and perform preprocessing; S2, performing preliminary crack region segmentation on the preprocessed grayscale image, and converting the segmented image into a binary crack image; S3, using Gaussian filtering to remove noise in the binary crack image to obtain a denoised binary crack image; using a threshold segmentation method to perform secondary segmentation on the binary crack image, distinguishing the crack area and the background area in the binary crack image after the secondary segmentation, and dividing the crack area into a training set, a test set, and a validation set; S4. Build the PDU-Net network based on Attention U-Net, including the decoder and encoder. The decoder uses the differential convolution-based module PDCBlock. S5. Input the training set and the validation set into the PDU-Net network for training and validation, and save the model with the best effect; S6. Use the model in S5 to test the crack images in the test set and obtain the test results.
2. The method for batch identification of concrete cracks based on visual images according to claim 1 is characterized in that: The grayscale image in S1 is subjected to bilateral filtering to remove background noise, and then the filtered image is enhanced using Gamma transformation to obtain a preprocessed grayscale image.
3. The method for batch identification of concrete cracks based on visual images according to claim 1 is characterized in that: In S3, the improved Zhang parallel thinning algorithm is used to obtain the crack skeleton line with a single pixel width; the number of crack skeleton line pixels in the crack area is calculated to obtain the length information of the crack, and the orthogonal skeleton line method is used to obtain the maximum width and average width of the crack.
4. The method for batch identification of concrete cracks based on visual images according to claim 3 is characterized in that: The calculation process of the maximum width and average width of the crack is as follows: a. Calculate the normal vector of each point on the crack skeleton line using the local pixel point straight line fitting method; b. Taking each point on the crack skeleton line as a starting point, sampling is performed on the grayscale image along the respective normal vectors and their reverse directions, and the grayscale values of all sampling points are fitted using a Gaussian function to obtain a fitting curve; c. Calculate the mean and standard deviation of the fitting curve, and use the difference between the mean and the standard deviation as the preliminary determination of the left edge point of the crack, and use the sum of the mean and the standard deviation as the preliminary determination of the right edge point of the crack; d. Use the grayscale threshold method to determine the final left and right edge points of the crack.
5. The method for batch identification of concrete cracks based on visual images according to claim 4 is characterized in that: The specific steps for accurately determining the final left and right edge points of the crack using the grayscale threshold method are as follows: d1. Get the minimum value among the grayscale values of all sampling points, and add up the grayscale values of all sampling points to get the average value; d2, take the left edge point as the starting point; initialize a=1; d3, taking any a-th sampling point in the neighborhood of the starting point as the current sampling point; d4. Compare the gray value of the current sampling point with the mean and minimum values respectively. If the gray value of the current sampling point is greater than the mean and the difference between the gray value of the current sampling point and the minimum value is greater than the set threshold, it means that the current sampling point is the background, and the a-1th sampling point is the final left edge point of the crack (x l ,y l ), and execute step e. Otherwise, it means that the current sampling point belongs to the crack area, and after assigning a+1 to a, return to step d3 and finally obtain the final right edge point of the crack (x r ,y r ).
6. The method for batch identification of concrete cracks based on visual images according to claim 1 is characterized in that: In S3, the maximum inter-class variance method is used to determine the optimal threshold for image segmentation and distinguish the crack area from the background area in the image: For the image processed by S3, t is the segmentation threshold of the crack area and the background, the number of points in the crack area accounts for h0 of the image, and the average grayscale is m0; the number of points in the background accounts for h1 of the image, and the average grayscale is m1; the total average grayscale of the image is: m=h0*m0+h1*m1 Traverse t from the minimum gray value to the maximum gray value, when t makes the value g = h0*(m0-m) 2 +h1*(m1-m) 2 When t is the maximum, it is the optimal threshold for segmentation.
7. The method for batch identification of concrete cracks based on visual images according to claim 1 is characterized in that: The encoder consists of 5 stages. After executing a PDCBlock in each stage, maximum pooling is performed, and the output size becomes 1 / 2 of the original size, and the number of channels in the convolution layer becomes twice as much as the original size. Each PDCBlock consists of 3 different convolutional layers. Different convolutional layers of the same PDCBlock have filters of the same size. After 4 pooling, the output scale becomes 1 / 16 of the initial image, and the number of channels in the convolution layer becomes 16 times of the initial image.
8. The method for batch identification of concrete cracks based on visual images according to claim 1 is characterized by: The decoder consists of 5 stages. From the 1st to the 4th stage, after upsampling once in each stage, the output image size becomes twice the original one, and then it is input into AG together with the feature map extracted by the previous layer of PDCBlock. The calculated result is concatenated with the decoded feature map, the number of channels becomes twice the original one, the image size remains unchanged, and then 2 convolutions are performed to restore the number of channels. This is performed 4 times in sequence. In the 5th stage, 1 convolution is performed to output a feature image with the same size as the original image and a channel number of 1.
9. The method for batch identification of concrete cracks based on visual images according to claim 1 is characterized in that: PDCBlock consists of three residual blocks. A depth-wise separable convolution structure is used inside each residual block to perform convolution on each channel. Each residual block consists of a 3×3 depth convolution layer, a ReLU layer, and a 1×1 point convolution layer.
10. The method for batch identification of concrete cracks based on visual images according to claim 1, characterized in that: PDC pixel differential convolution operation formula, for the i-th pixel x i The differential convolution operation of pixels in the neighborhood is: Among them, x i is the i-th pixel of the input feature map, x i+j For x i Pixels within the neighborhood R (R∈3×3), w i is the weight corresponding to the 3×3 convolution kernel, x i+j -x i is pixel x i The difference information.
Citation Information
Patent Citations
Concrete crack identification method based on image processing technology
CN112785579A
High-precision spillway bottom plate concrete structure surface crack feature detection method
CN117095315A
Surface crack detection method based on image processing
CN117974627A
Cited By
Engineering structure crack detection and measurement method based on machine vision
CN119494835A
Intelligent hydraulic concrete crack detection method and system
CN120071150A
Concrete dam defect detection method
CN120707551A
A method for detecting defects in concrete dams
CN120707551B
