Deep learning-based crack rapid segmentation and size calculation method and system

By using the lightweight network model and attention mechanism of deep learning in building crack detection, combined with specific calculation methods, the problems of low efficiency and insufficient accuracy of traditional detection methods are solved, and efficient and accurate crack detection and size calculation are achieved, which is suitable for in complex backgrounds and diverse environments.

CN118747759APending Publication Date: 2024-10-08GUIZHOU CONSTR SCI RES & DESIGN INST OF CSCEC +1

Patent Information

Application Number
CN202410967100.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-18
Publication Date
2024-10-08

AI Technical Summary

Technical Problem

Traditional building crack detection methods have low efficiency and limited accuracy, making it difficult to meet the needs of modern building detection. Especially when processing large-area, high-resolution images, they are computationally intensive and time-consuming. Moreover, the model has insufficient robustness and generalization capabilities, making it difficult to adapt to diverse situations. Cracks and complex environmental conditions.

Method used

It adopts the lightweight MobileNetV2 network model based on deep learning, introduces the CBAM attention mechanism, and combines the maximum inscribed circle, skeleton extraction and statistical pixel method to perform crack segmentation and size calculation, improve detection accuracy and efficiency, and enhance detection capabilities under complex backgrounds. .

Benefits of technology

It significantly improves the accuracy and efficiency of crack detection, solves the problem of rapid detection in resource-constrained environments, enhances the versatility and practicality of detection, and is suitable for a variety of building apparent defect detection and real-time monitoring systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118747759A_ABST
    Figure CN118747759A_ABST
Patent Text Reader

Abstract

The invention discloses a rapid crack segmentation and size calculation method and system based on deep learning. The method comprises the steps that a building apparent crack data set is acquired; inputting the building apparent crack data set into the improved DeepLabv3 + network model to obtain a segmentation model, and inputting the crack image into the segmentation model for identification and segmentation to obtain a crack segmentation result image; performing gray processing and binarization on the crack segmentation result image to obtain a crack binary image; obtaining the crack width by using an improved maximum inscribed circle method; acquiring the crack length by using a skeleton extraction method; and calculating the crack binary image by using a statistical pixel method to obtain the crack area. According to the method, the lightweight MobileNetV2 is adopted as a backbone network, and the CBAM attention module is introduced, so that the precision and efficiency of crack detection are remarkably improved, and meanwhile, accurate calculation of the crack width is realized by using a maximum inscribed circle method; the problem of rapid detection in a resource limited environment is solved, and the detection capability in a complex background is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of building crack identification, and in particular to a method and system for fast crack segmentation and size calculation based on deep learning. Background Art

[0002] In the field of construction engineering, ensuring structural safety and stability is the cornerstone. With the accelerated pace of urbanization and the aging of buildings, crack problems have become increasingly prominent, endangering the durability and safety of buildings. Cracks not only damage the appearance, but may also indicate a decrease in structural strength and induce safety accidents. Therefore, rapid and accurate detection and evaluation of crack status has become the key to preventing diseases and ensuring public safety. Traditional detection methods rely on manual visual and physical measurements, which are inefficient and greatly affected by human and environmental factors, and are difficult to meet the needs of modern building detection. Especially when faced with large-area, high-resolution images, its limitations are more significant.

[0003] At present, although crack detection technology based on computer vision and deep learning has shown great potential, it still faces challenges. It is difficult to detect cracks of different scales, complex background interference affects the accuracy, and the processing of high-resolution images is computationally intensive and time-consuming, making it difficult to meet real-time requirements. In addition, the model's robustness and generalization capabilities are insufficient, making it difficult to adapt to a variety of cracks and environmental conditions. Although models such as Deeplabv3+ are powerful, they have large parameters, complex training, high hardware requirements, and are sensitive to hyperparameter selection. Manual measurement is inefficient and has limited accuracy. Therefore, it is urgent to develop a more efficient, accurate, and robust crack detection and size calculation method to promote the advancement of construction engineering technology and ensure public safety. Summary of the invention

[0004] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.

[0005] In view of the above existing problems, the present invention is proposed. Therefore, the present invention provides a method for fast segmentation and size calculation of cracks based on deep learning to solve the problems of insufficient accuracy, efficiency, real-time performance and detection ability under complex backgrounds in traditional crack detection methods.

[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0007] In a first aspect, the present invention provides a method for fast segmentation and size calculation of cracks based on deep learning, comprising:

[0008] Obtain building surface crack dataset;

[0009] Input the building apparent crack data set into the improved DeepLabv3+ network model to obtain a segmentation model, and input the crack image into the segmentation model for recognition and segmentation to obtain a crack segmentation result image;

[0010] Grayscale processing and binarization are performed on the crack segmentation result image to obtain a crack binary image;

[0011] The crack binary image is calculated using an improved maximum inscribed circle method to obtain the crack width, the crack binary image is calculated using a skeleton extraction method to obtain the crack length, and the crack binary image is calculated using a statistical pixel method to obtain the crack area;

[0012] Based on the camera imaging principle, the crack width, crack length and crack area are calculated to obtain the actual crack width, actual crack length and actual crack area.

[0013] As a preferred solution of the method for rapid segmentation and size calculation of cracks based on deep learning described in the present invention, the improved DeepLabv3+ network model includes:

[0014] Replace the backbone network of the DeepLabv3+ network model with MobileNetV2;

[0015] The attention mechanism is introduced into the DeepLabv3+ network model, and the channel and spatial information of the building surface crack dataset is obtained by using the attention mechanism.

[0016] The crack data set is preprocessed and then input into the improved DeepLabv3+ network model for training to obtain a segmentation model.

[0017] As a preferred solution of the method for rapid segmentation and size calculation of cracks based on deep learning described in the present invention, wherein: the crack image is input into the segmentation model for identification and segmentation to obtain the crack segmentation result image including:

[0018] Inputting the crack map into the segmentation model, and encoding and decoding the crack map using the segmentation model;

[0019] The crack map is processed by the encoding module to generate a feature map, the first part of the feature map is input to the ASPP module, and the second part of the feature map is input to the decoding module;

[0020] The first part of the feature map is obtained by the ASPP module to obtain five groups of feature maps, the five groups of feature maps are concatenated, convolved and focused to obtain the first feature map, and the first feature map is input into the decoding module;

[0021] Using the decoding module to perform channel dimension reduction on the second part of the feature map to obtain a second feature map;

[0022] The first feature map and the second feature map are spliced ​​and up-sampled by interpolation using the decoding module to obtain the crack segmentation result image.

[0023] As a preferred solution of the method for rapid segmentation and size calculation of cracks based on deep learning described in the present invention, wherein: the crack binary image is calculated using an improved maximum inscribed circle method to obtain the maximum pixel width of the crack, including:

[0024] Processing the crack binary image to obtain a crack contour;

[0025] Randomly selecting one percent of the pixel points within the crack outline for sorting;

[0026] Determine the minimum circumscribed rectangle of the crack outline, and calculate half of the shortest side of the minimum circumscribed rectangle as the upper limit of the radius of the inscribed circle;

[0027] All pixels within the crack contour are traversed, and based on the search accuracy, the loop plus map method is used to search and calculate the maximum inscribed circle of each pixel to obtain the coordinates of the maximum inscribed circle of each pixel.

[0028] As a preferred solution of the method for rapid segmentation and size calculation of cracks based on deep learning described in the present invention, the search accuracy includes:

[0029] Set the search accuracy. When the difference between the maximum radius and the minimum radius is less than the search accuracy, it is considered that the maximum inscribed circle of each pixel is found. The search accuracy is expressed as:

[0030]

[0031] Among them, x 2 -x 1 is the length of the rectangle, y 2 -y 1 is the height of the rectangle.

[0032] As a preferred solution of the method for rapid segmentation and size calculation of cracks based on deep learning described in the present invention, wherein: the crack binary image is calculated using a skeleton extraction method to obtain the crack length, including:

[0033] Performing morphological thinning processing on the crack binary image, gradually removing boundary pixels of the crack area while keeping the connectivity and topological structure of the crack unchanged, until only a skeleton structure with a single pixel width remains;

[0034] Scan the refined crack binary image, and mark and extract the crack contours through pixel connectivity analysis;

[0035] Finally, the length of the line segment is obtained by counting the number of skeleton pixels.

[0036] As a preferred solution of the method for rapid segmentation and size calculation of cracks based on deep learning described in the present invention, wherein: the crack binary image is calculated using a statistical pixel method to obtain the crack area, including:

[0037] In the crack binary image, the white area is the crack area, the black area is the background area, and the number of pixels in the white area is counted to obtain the crack area.

[0038] In a second aspect, the present invention provides a system for fast segmentation and size calculation of cracks based on deep learning, comprising:

[0039] A data acquisition module, used to acquire a building surface crack data set;

[0040] A network model training module, used for inputting the building surface crack data set into the improved DeepLabv3+ network model to obtain a segmentation model;

[0041] A crack recognition and segmentation module is used to input the crack image into the segmentation model for recognition and segmentation to obtain a crack segmentation result image;

[0042] An image processing module is used to perform grayscale processing and binarization on the crack segmentation result image to obtain a crack binary image;

[0043] A crack size acquisition module is used to calculate the crack binary image using an improved maximum inscribed circle method to obtain the crack width, calculate the crack binary image using a skeleton extraction method to obtain the crack length, and calculate the crack binary image using a statistical pixel method to obtain the crack area;

[0044] The actual crack size acquisition module is used to calculate the crack width, crack length and crack area based on the camera imaging principle to obtain the actual crack width, actual crack length and actual crack area.

[0045] In a third aspect, the present invention provides a computing device, comprising:

[0046] Memory and processor;

[0047] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the method for rapid segmentation and size calculation of cracks based on deep learning are implemented.

[0048] In a fourth aspect, the present invention provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the method for rapid segmentation and size calculation of cracks based on deep learning.

[0049] Compared with the prior art, the present invention has the following beneficial effects: the present invention significantly improves the accuracy and efficiency of crack detection by adopting a lightweight MobileNetV2 as the backbone network and introducing a CBAM attention module, while using the maximum inscribed circle method to achieve accurate calculation of the crack width; the present invention not only solves the problem of rapid detection in resource-constrained environments, but also enhances the detection capability in complex backgrounds, has wide versatility and practicality, and can be applied to a variety of building surface defect detection and real-time monitoring systems. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:

[0051] Figure 1 A schematic diagram of a general flow chart of a method for rapid segmentation and size calculation of cracks based on deep learning according to an embodiment of the present invention;

[0052] Figure 2 This is a schematic diagram of the overall process of a method for rapid segmentation and size calculation of cracks based on deep learning according to an embodiment of the present invention;

[0053] Figure 3 A schematic diagram of a CBAM attention mechanism for a method for fast segmentation and size calculation of cracks based on deep learning according to an embodiment of the present invention;

[0054] Figure 4 A schematic diagram of an improved DeepLabv3+ network architecture of a method for fast segmentation and size calculation of cracks based on deep learning according to an embodiment of the present invention;

[0055] Figure 5 A schematic diagram of the actual situation of cracks in a method for rapid crack segmentation and size calculation based on deep learning according to an embodiment of the present invention;

[0056] Figure 6 This is a schematic diagram of a method for rapid segmentation and size calculation of cracks based on deep learning according to an embodiment of the present invention after being processed by an improved DeepLabv3+ model;

[0057] Figure 7 A schematic diagram showing comparison of detection results of a traditional DeepLabv3+ model of a method for rapid segmentation and size calculation of cracks based on deep learning according to an embodiment of the present invention and an improved DeepLabv3+ model of the present invention;

[0058] Figure 8 A schematic diagram of the maximum inscribed circle method before and after optimization of a method for rapid segmentation and size calculation of cracks based on deep learning according to an embodiment of the present invention;

[0059] Fig. 9 A schematic diagram of a skeleton line of a method for rapid segmentation and size calculation of cracks based on deep learning according to an embodiment of the present invention;

[0060] Fig.10 A schematic diagram of crack size of a method for rapid crack segmentation and size calculation based on deep learning according to an embodiment of the present invention. DETAILED DESCRIPTION

[0061] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.

[0062] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0063] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.

[0064] The present invention is described in detail with reference to schematic diagrams. When describing the embodiments of the present invention, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.

[0065] At the same time, in the description of the present invention, it should be noted that the orientations or positional relationships indicated by the terms "upper, lower, inner and outer" are based on the orientations or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the system or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first, second or third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.

[0066] In the present invention, unless otherwise clearly specified and limited, the terms "install, connect, connect" should be understood in a broad sense, for example: it can be a fixed connection, a detachable connection or an integral connection; it can also be a mechanical connection, an electrical connection or a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0067] Example 1

[0068] Reference Figure 1-4 , as an embodiment of the present invention, provides a method for fast segmentation and size calculation of cracks based on deep learning, comprising:

[0069] S100: Obtain a building surface crack dataset;

[0070] Specifically, an open source crack image dataset was obtained, and the images were preprocessed by image scaling and cropping, and the images were uniformly adjusted to a size of 227×227. The images were then labeled using the labelme tool and converted into json format files suitable for image segmentation tasks, which stored the location and shape information of the cracks, and finally the required crack dataset was obtained. The crack dataset was divided into a training set and a validation set in a ratio of 9:1 in preparation for subsequent steps.

[0071] S101: Input the building surface crack dataset into the improved DeepLabv3+ network model to obtain a segmentation model, and input the crack image into the segmentation model for recognition and segmentation to obtain a crack segmentation result image;

[0072] Preferably, the backbone network of the DeepLabv3+ network model is replaced with MobileNetV2;

[0073] Specifically, the present invention replaces the backbone network of DeepLabv3+ from the original Xception to MobileNetV2, reducing the computational complexity of the model and making the model lighter while maintaining accuracy: MobileNetV2 is a lightweight convolutional neural network designed for mobile devices and embedded applications, and its core innovation lies in the inverted residual structure and linear bottleneck; the traditional residual structure captures features by increasing the convolution operation of the dimension, while the inverted residual structure first expands through 1x1 convolution, then performs 3x3 deep convolution, and finally reduces the dimension through another 1x1 convolution; due to the gradual expansion and compression mechanism of the inverted residual structure, the computationally intensive convolution operation directly in the high-dimensional space is avoided; the traditional network layer using the ReLU nonlinear activation function will compress the feature space, MobileNetV2 removes the last layer of ReLU in the inverted residual structure and uses linear activation to avoid information loss;

[0074] Preferably, an attention mechanism is introduced into the DeepLabv3+ network model, and the channel and spatial information of the building surface crack dataset is obtained by using the attention mechanism;

[0075] In the embodiment of the present application, the CBAM attention mechanism is introduced, such as Figure 3 As shown in the figure, the CBAM attention mechanism combines the channel attention and spatial attention mechanisms. It captures important channel and spatial information in the image through different attention mechanisms, enhances the model's attention to key features, and thus enhances the model's representation ability, enabling the model to pay more attention to key areas and key information in the image.

[0076] Specifically, the channel attention part improves the performance of the DeepLabv3+ network model by emphasizing important feature channels. First, the input feature map is globally averaged and globally max-pooled to obtain two vectors F avg and F max , these two vectors represent the average and maximum value of each channel, respectively, and are used to capture the global information of different types of cracks, so as to better determine which channels are more important for the current task. The channel attention calculation is expressed as:

[0077]

[0078] F max =max(F(i, j, c))

[0079] Among them, H, W, and C are the width, height, and number of channels of the input feature map respectively;

[0080] Then, these two vectors are processed by a shared multi-layer perceptron and the results are fused. Finally, the result is obtained by the Sigmoid activation function, which is expressed as:

[0081] M c =σ[MLP(F avg )+MLP(F max )

[0082] Among them, M c is the result obtained by the Sigmoid activation function, F avg and F max Perform global average pooling and global maximum pooling on the feature map to obtain two vectors d

[0083] It should be noted that through the channel attention mechanism, the DeepLabv3+ network model can dynamically adjust the weight of each channel to highlight the feature channels that are critical to crack segmentation. When the average and maximum values ​​of some channels in the feature map are high, these channels are considered to contain important crack information, and the model will give them higher weights.

[0084] Specifically, the spatial attention part enhances the feature representation by emphasizing important spatial positions. The DeepLabv3+ network model performs average pooling and maximum pooling on the output results of the channel attention calculation in the channel dimension to obtain two features F″ avg and F″ max :

[0085]

[0086] F″ max =max(M c )

[0087] in, and M is the two features obtained by averaging and max pooling the output of the channel attention calculation by the DeepLabv3+ network model in the channel dimension. c is the result obtained by the Sigmoid activation function, and C is the number of channels;

[0088] The two features are passed through a 7×7 convolution, and finally the final result is obtained through the Sigmoid activation function, which is expressed as:

[0089] M s =σ(Conv7×7(F″ avg :F″ max ))

[0090] Among them, M s In order to obtain the two features through a 7×7 convolution, the final result is obtained through the Sigmoid activation function. and The two features are obtained by performing average pooling and maximum pooling on the channel dimension of the output results of the channel attention calculation of the DeepLabv3+ network model;

[0091] It should be noted that the spatial attention mechanism ensures that the DeepLabv3+ network model can highlight the spatial location of the cracks and enhance attention to the crack area, which means that the DeepLabv3+ network model can more accurately segment the edges and details of the cracks, and maintain high-precision segmentation even under complex backgrounds and noise interference;

[0092] Preferably, the crack data set is preprocessed and then input into the improved DeepLabv3+ network model for training to obtain a segmentation model. The improved DeepLabv3+ network model architecture is as follows: Figure 4 As shown;

[0093] Preferably, the crack map is input into a segmentation model, and the crack map is encoded and decoded using the segmentation model;

[0094] Preferably, the crack map is processed by the encoding module to generate a feature map, the first part of the feature map is input to the ASPP module, and the second part of the feature map is input to the decoding module;

[0095] Specifically, the encoding part includes two parts: the backbone network and the atrous spatial convolutional pooling pyramid, i.e., the ASPP module. The input image is processed by the backbone network to generate a feature map, which is divided into two parts: one part is the feature map output by the last layer of convolution, and the other part is the feature map of the intermediate low-level features. The first part of the backbone network output is sent to the ASPP module, and the second part is sent to the decoding module.

[0096] Preferably, the first part of the feature map is obtained by the ASPP module to obtain five groups of feature maps, the five groups of feature maps are concatenated, convolved and focused to obtain the first feature map, and the first feature map is input into the decoding module;

[0097] In the embodiment of the present application, the ASPP module receives the first part of the output of the backbone network as input, uses four hole convolution blocks with different expansion rates and a global average pooling block to obtain a total of five sets of feature maps, which are concatenated and sent to the decoding module after passing through a 1*1 convolution block and a CBAM attention module;

[0098] Preferably, a decoding module is used to perform channel dimension reduction on the second part of the feature map to obtain a second feature map;

[0099] In the embodiment of the present application, the decoding module is used to perform channel dimension reduction on the second part of the feature map using 1*1 convolution, from 256 to 48, and the decoding module is used to interpolate and upsample the first part of the feature map processed by the ASPP module, so that the first part of the feature map has the same size as the second part of the feature map;

[0100] Preferably, the first feature map and the second feature map are spliced ​​and interpolated and up-sampled using a decoding module to obtain a crack segmentation result image;

[0101] It should be noted that the present invention adopts the improved Deeplabv3+ model as the core algorithm for crack detection. In terms of the Deeplabv3+ model backbone network, the original Xception network is replaced by a lighter MobileNetV2 to reduce the number of model parameters and speed up the calculation speed. In addition, in order to enhance the model's ability to extract crack features, the CBAM attention module is further introduced into the network. By integrating the spatial and channel attention mechanisms, the accuracy and robustness of crack detection are effectively improved.

[0102] S102: grayscale processing and binarization are performed on the crack segmentation result image to obtain a crack binary image;

[0103] In the embodiment of the present application, the crack segmentation result image is firstly gray-processed to convert it into a single-channel image to highlight the structure and texture information of the crack; then the image is binarized to set the target area, i.e. the crack, to white and the background to black so that the two can be clearly distinguished;

[0104] S103: Calculate the crack binary image using the improved maximum inscribed circle method to obtain the crack width, calculate the crack binary image using the skeleton extraction method to obtain the crack length, and calculate the crack binary image using the statistical pixel method to obtain the crack area;

[0105] Preferably, the crack contour is obtained by processing the crack binary image;

[0106] Preferably, one percent of the pixels within the crack outline are randomly selected for sorting;

[0107] Preferably, the minimum circumscribed rectangle of the crack contour is determined, and half of the shortest side of the minimum circumscribed rectangle is calculated as the upper limit of the radius of the inscribed circle;

[0108] Preferably, all pixel points within the crack contour are traversed, and based on the search accuracy, a loop plus map method is used to search and calculate the maximum inscribed circle of each pixel point, and the coordinates of the maximum inscribed circle of each pixel point are obtained;

[0109] In the embodiment of the present application, the current pixel coordinates are taken as the center of the circle, 0 is taken as the minimum radius, and half of the shortest side of the minimum circumscribed rectangle is taken as the maximum radius;

[0110] Preferably, the search accuracy is set. When the difference between the maximum radius and the minimum radius is less than the search accuracy, it is considered that the maximum inscribed circle of each pixel is found. The search accuracy is expressed as:

[0111]

[0112] Among them, x 2 -x 1 is the length of the rectangle, y 2 -y 1 is the height of the rectangle;

[0113] Specifically, calculate the middle value of the current maximum inscribed circle radius, the minimum radius and the maximum radius, generate circle scatter points with the current radius and the given center as parameters, check whether these scatter points are within the contour, if any scatter points are outside the contour, update the maximum radius to the current radius; if all scatter points are within the contour, update the minimum radius to the current radius, and continue to update the radius until the maximum radius minus the minimum radius is less than the specified precision, and return the radius at this time;

[0114] It should be noted that the improved maximum inscribed circle method includes: speeding up the inscribed circle radius search process: using a method of randomly selecting one percent of the pixels within the crack outline for sorting, quickly increasing the lower limit of the inscribed circle radius, reducing unnecessary calculation steps, and speeding up the overall processing speed; optimizing the calculation method for finding the radius: the original method used a double for loop to traverse each pixel of the image and make a judgment, and then find the radius of the maximum inscribed circle, resulting in excessive calculation. In order to optimize this process, the loop plus map method is used to replace the double for loop, thereby reducing the amount of calculation and improving the calculation efficiency.

[0115] Preferably, a morphological thinning process is performed on the crack binary image to gradually remove the boundary pixels of the crack area while keeping the connectivity and topological structure of the crack unchanged, until only a skeleton structure with a single pixel width remains;

[0116] Preferably, the refined crack binary image is scanned, and the contour lines of the cracks are marked and extracted through pixel connectivity analysis;

[0117] Preferably, finally, the length of the line segment is obtained by counting the number of skeleton pixels;

[0118] In an embodiment of the present application, the length of the crack contour is obtained by a skeleton extraction method; the binary image is thinned, and the crack area is gradually reduced to a thin line, retaining its topological structure. The line is the skeleton of the crack and represents the central axis of the crack; then the number of all skeleton pixels in the skeleton image is counted, and the total length of the crack is obtained based on the number of these points.

[0119] Preferably, in the crack binary image, the white area is the crack area, the black area is the background area, and the number of pixels in the white area is counted to obtain the crack area;

[0120] In an embodiment of the present application, based on the crack binary image, the crack area appears white (pixel value is 255) and the background area appears black (pixel value is 0); the area of ​​the crack is calculated by counting the number of white pixels in the crack area, that is, traversing all pixels of the binary image and counting the number of pixels with a pixel value of 255.

[0121] S104: Based on the camera imaging principle, the crack width, crack length, and crack area are calculated to obtain the actual crack width, actual crack length, and actual crack area;

[0122] In the embodiment of the present application, according to the camera imaging principle, there are:

[0123]

[0124] Among them, Z c is the shooting distance, (u,v) is the pixel coordinate of the maximum inscribed circle, is the camera internal parameter, is the camera external parameter, (X w , Y w , Z w ) is the world coordinate;

[0125] In the embodiment of the present application, the camera intrinsic parameters are obtained by calibration, the camera extrinsic parameters are obtained by SLAM technology, and the shooting distance is obtained by real-time measurement of laser ranging;

[0126] Specifically, the camera external parameters are obtained through SLAM technology. The camera collects a series of images during movement, and the key points and descriptors in each frame are extracted using a feature extraction algorithm. Feature matching is performed between adjacent images, and the relative motion of the camera is solved through the Perspective-n-Point problem. The specific pose estimation can be optimized by the RANSAC algorithm to eliminate incorrect matches. The pose and map points of all image frames are globally optimized using a nonlinear optimization method to improve the accuracy of pose estimation. Pose optimization is usually achieved by minimizing the reprojection error, which is expressed as:

[0127]

[0128] Among them, P ij is the position of the jth feature point in the i-th frame image, is the projection function, K is the camera intrinsic parameter matrix, R i is the pose of the i-th frame, P j is the 3D position of the jth feature point;

[0129] Therefore, the camera external parameters, that is, the rotation matrix R and translation vector T in the world coordinate system, can be calculated to estimate the camera pose.

[0130] The shooting distance is obtained through laser ranging technology. The laser rangefinder sends out a laser pulse. The laser pulse encounters the surface of the target object and is reflected back to the receiver. The rangefinder records the time interval between the laser pulse emission and the reception of the reflected signal. The distance is calculated through the speed of light and the time interval, which is expressed as:

[0131]

[0132] Among them, Z c is the shooting distance, c is the speed of light, Δt is the time interval;

[0133] Taking the actual width of the crack as an example, the world coordinates are obtained by reverse calculation based on the inverse matrix of the camera's intrinsic parameter matrix and extrinsic parameter matrix, the coordinates of the maximum inscribed circle of each pixel point, and the shooting distance;

[0134] The Euclidean distance between the two end points of the maximum inscribed circle diameter is calculated by world coordinates to obtain the actual width of the crack. The calculation process is expressed as:

[0135]

[0136] Among them, (X w1 , Y w1 , Z w1 ) and (X w2 , Y w2 , Z w2 ) are the world coordinates of the two end points of the calculated maximum inscribed circle diameter, and D is the actual width of the crack;

[0137] It should be noted that the present invention realizes the accurate conversion from the maximum pixel width of the crack image to the actual crack width, and the same is true for the crack length and crack area, by accurately calibrating the camera intrinsic parameters, using the SLAM technology to obtain the camera extrinsic parameters and real-time laser ranging. It improves the measurement accuracy, enhances the adaptability and flexibility under different shooting conditions, supports automated measurement and real-time monitoring, and at the same time improves the versatility of technical applications, providing comprehensive and accurate technical support for building structure health monitoring.

[0138] The above is a schematic scheme of a method for rapid segmentation and size calculation of cracks based on deep learning in this embodiment. It should be noted that the technical scheme of the system for rapid segmentation and size calculation of cracks based on deep learning and the technical scheme of the method for rapid segmentation and size calculation of cracks based on deep learning belong to the same concept. For details not described in detail in the technical scheme of the system for rapid segmentation and size calculation of cracks based on deep learning in this embodiment, please refer to the description of the technical scheme of the method for rapid segmentation and size calculation of cracks based on deep learning.

[0139] The fast segmentation and size calculation system of cracks based on deep learning in this embodiment includes:

[0140] A data acquisition module, used to acquire a building surface crack data set;

[0141] The network model training module is used to input the building surface crack dataset into the improved DeepLabv3+ network model to obtain the segmentation model;

[0142] The crack recognition and segmentation module is used to input the crack image into the segmentation model for recognition and segmentation to obtain a crack segmentation result image;

[0143] An image processing module is used to perform grayscale processing and binarization on the crack segmentation result image to obtain a crack binary image;

[0144] The crack size acquisition module is used to calculate the crack binary image using the improved maximum inscribed circle method to obtain the crack width, calculate the crack binary image using the skeleton extraction method to obtain the crack length, and calculate the crack binary image using the statistical pixel method to obtain the crack area;

[0145] The actual crack size acquisition module is used to calculate the crack width, crack length and crack area based on the camera imaging principle to obtain the actual crack width, actual crack length and actual crack area.

[0146] This embodiment further provides a computing device, which is applicable to the fast segmentation and size calculation of cracks based on deep learning, including:

[0147] Memory and processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement the method for fast segmentation and size calculation of cracks based on deep learning as proposed in the above embodiment.

[0148] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the method for fast segmentation and size calculation of cracks based on deep learning as proposed in the above embodiment is implemented.

[0149] The storage medium proposed in this embodiment and the method for realizing fast segmentation and size calculation of cracks based on deep learning proposed in the above embodiment belong to the same inventive concept. The technical details not fully described in this embodiment can be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.

[0150] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ReadOnly, Memory, ROM), random access memory (RandomAccess Memory, RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform the methods of various embodiments of the present invention.

[0151] Example 2

[0152] Reference Figure 5-10 , which is an embodiment of the present invention, provides a method for fast segmentation and size calculation of cracks based on deep learning. In order to verify its beneficial effects, the experimental results of the present invention are provided.

[0153] In this embodiment, the improved DeepLabv3+ model is combined with the CBAM attention mechanism to detect and segment concrete cracks, and calculate their sizes.

[0154] First, the cracks on the surface of the concrete structure are photographed using a high-resolution camera to obtain the original image of the cracks, such as Figure 5 As shown, the original image shows the actual condition of the concrete surface, including the shape and location of the cracks and detailed information of the background;

[0155] The original crack image is processed by the improved DeepLabv3+ model. The improved DeepLabv3+ model first uses the backbone network to extract high-level and low-level features of the image, where the high-level features are input into the Atrous Spatial Pyramid Pooling (ASPP) module, and the low-level features are input into the decoder module. Combined with the CBAM attention mechanism, the model emphasizes important channels and spatial positions during the feature extraction process, and finally generates a segmentation result image. In this segmentation result image, the crack area is accurately segmented and displayed as an image that is clearly distinguished from the background area, as shown in Figure 2. Figure 6As shown in Figure 1, the image processed by the improved DeepLabv3+ model. In this image, the crack area is clearly segmented and forms a clear contrast with the background;

[0156] The improved DeepLabv3+ model has achieved all-round accuracy improvement compared to the original model, such as Figure 7 As shown by Figure 7 It can be seen that mIoU (Mean Intersection over Union, the average intersection over union ratio, the larger the value, the higher the accuracy) increased from 85.24% to 85.60%, mPA (Mean Pixel Accuracy, the average pixel accuracy, the larger the value, the higher the accuracy) increased from 90.90% to 91.74%, and Recall (recall rate, the larger the value, the higher the accuracy) increased from 90.90% to 91.74%.

[0157] The segmentation result image is gray-scaled and converted into a single-channel image to highlight the structure and texture information of the crack; the gray-scale image is binarized, the crack area is set to white and the background area is set to black to clearly distinguish the crack from the background; the binary image is contour-detected to find the contour area of ​​the crack;

[0158] The maximum width of the crack is calculated using the improved maximum inscribed circle method. The detection effects of the traditional maximum inscribed circle method and the improved maximum inscribed circle method of the present invention are as follows: Figure 8 As shown by Figure 8 It can be seen that through the improvement measures of the present invention, the processing time of a single picture is shortened from 0.85 seconds to 0.001 seconds, and the frame rate when detecting the video is increased from about 0.3 frames / second to 11 frames / second, with significant effects.

[0159] Extract the crack skeleton to calculate the crack length. The test results are as follows: Fig. 9 As shown;

[0160] Finally, the area of ​​the crack is calculated by counting the number of pixels of the crack outline.

[0161] According to the above steps, the crack size is obtained, such as Fig.10 As shown in the figure, the specific size information of the cracks calculated based on the segmentation results, including the maximum width, length and area, shows the quantitative measurement results of the cracks.

[0162] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A method for rapid segmentation and size calculation of cracks based on deep learning, characterized in that: include: Obtain building surface crack dataset; Input the building apparent crack data set into the improved DeepLabv3+ network model to obtain a segmentation model, and input the crack image into the segmentation model for recognition and segmentation to obtain a crack segmentation result image; Grayscale processing and binarization are performed on the crack segmentation result image to obtain a crack binary image; The crack binary image is calculated using an improved maximum inscribed circle method to obtain the crack width, the crack binary image is calculated using a skeleton extraction method to obtain the crack length, and the crack binary image is calculated using a statistical pixel method to obtain the crack area; Based on the camera imaging principle, the crack width, crack length and crack area are calculated to obtain the actual crack width, actual crack length and actual crack area.

2. The method for rapid segmentation and size calculation of cracks based on deep learning according to claim 1, It is characterized in that Improvements to the DeepLabv3+ network model include: Replace the backbone network of the DeepLabv3+ network model with MobileNetV2; The attention mechanism is introduced into the DeepLabv3+ network model, and the channel and spatial information of the building surface crack dataset is obtained by using the attention mechanism. The crack data set is preprocessed and then input into the improved DeepLabv3+ network model for training to obtain a segmentation model.

3. The method for rapid segmentation and size calculation of cracks based on deep learning according to claim 1 or 2, characterized in that: The crack image is input into the segmentation model for identification and segmentation to obtain the crack segmentation result image including: Inputting the crack map into the segmentation model, and encoding and decoding the crack map using the segmentation model; The crack map is processed by the encoding module to generate a feature map, the first part of the feature map is input to the ASPP module, and the second part of the feature map is input to the decoding module; The first part of the feature map is obtained by the ASPP module to obtain five groups of feature maps, the five groups of feature maps are concatenated, convolved and focused to obtain the first feature map, and the first feature map is input into the decoding module; Using the decoding module to perform channel dimension reduction on the second part of the feature map to obtain a second feature map; The first feature map and the second feature map are spliced ​​and up-sampled by interpolation using the decoding module to obtain the crack segmentation result image.

4. The method for rapid segmentation and size calculation of cracks based on deep learning according to claim 3, characterized in that: The improved maximum inscribed circle method is used to calculate the crack binary image to obtain the maximum pixel width of the crack, including: Processing the crack binary image to obtain a crack contour; Randomly selecting one percent of the pixel points within the crack outline for sorting; Determine the minimum circumscribed rectangle of the crack outline, and calculate half of the shortest side of the minimum circumscribed rectangle as the upper limit of the radius of the inscribed circle; All pixels within the crack contour are traversed, and based on the search accuracy, the loop plus map method is used to search and calculate the maximum inscribed circle of each pixel to obtain the coordinates of the maximum inscribed circle of each pixel.

5. The method for rapid segmentation and size calculation of cracks based on deep learning according to claim 4, characterized in that: Search accuracy includes: Set the search accuracy. When the difference between the maximum radius and the minimum radius is less than the search accuracy, it is considered that the maximum inscribed circle of each pixel is found. The search accuracy is expressed as: Among them, x2-x1 is the length of the rectangle, and y2-y1 is the height of the rectangle.

6. The method for rapid segmentation and size calculation of cracks based on deep learning according to claim 5, characterized in that: The crack binary image is calculated using a skeleton extraction method to obtain the crack length, including: Performing morphological thinning processing on the crack binary image, gradually removing boundary pixels of the crack area while keeping the connectivity and topological structure of the crack unchanged, until only a skeleton structure with a single pixel width remains; Scan the refined crack binary image, and mark and extract the crack contours through pixel connectivity analysis; Finally, the length of the line segment is obtained by counting the number of skeleton pixels.

7. The method for rapid segmentation and size calculation of cracks based on deep learning according to claim 6, characterized in that: The crack binary image is calculated using the statistical pixel method to obtain the crack area, including: In the crack binary image, the white area is the crack area, the black area is the background area, and the number of pixels in the white area is counted to obtain the crack area.

8. A system for rapid segmentation and size calculation of cracks based on deep learning, characterized in that: include, A data acquisition module, used to acquire a building surface crack data set; A network model training module, used for inputting the building surface crack data set into the improved DeepLabv3+ network model to obtain a segmentation model; A crack recognition and segmentation module is used to input the crack image into the segmentation model for recognition and segmentation to obtain a crack segmentation result image; An image processing module is used to perform grayscale processing and binarization on the crack segmentation result image to obtain a crack binary image; A crack size acquisition module is used to calculate the crack binary image using an improved maximum inscribed circle method to obtain the crack width, calculate the crack binary image using a skeleton extraction method to obtain the crack length, and calculate the crack binary image using a statistical pixel method to obtain the crack area; The actual crack size acquisition module is used to calculate the crack width, crack length and crack area based on the camera imaging principle to obtain the actual crack width, actual crack length and actual crack area.

9. An electronic device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the method for rapid segmentation and size calculation of cracks based on deep learning as described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the method for rapid segmentation and size calculation of cracks based on deep learning as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Building surface crack detection method based on deep learning network

    CN112330593A

  • Improved urban streetscape image segmentation method based on deep learning

    CN115035299A

  • Crack detection method

    CN115240070A

  • Method and system for detecting and segmenting length and width of tunnel lining crack

    CN116863134A

  • Streetscape semantic segmentation method based on DeepLabV3 +

    CN116977631A

Cited By

  • Coal rock fracture image recognition method and system based on deep learning and post-processing

    CN119229217A