Tunnel lining crack detection method, system and electronic equipment based on deep learning

Through a method based on deep learning, combined with the YOLOv8 model and the self-attention mechanism, the location and size of tunnel lining cracks are identified, which solves the problems of low detection efficiency and neglect of feature information in the existing technology, and achieves accurate identification and identification of tunnel lining cracks. Safety assessment.

CN118505690BActive Publication Date: 2024-10-11EAST CHINA JIAOTONG UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410957529.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2024-10-11
Estimated Expiration
2044-07-17

AI Technical Summary

Technical Problem

The detection efficiency of tunnel lining cracks in the existing technology is low, dangerous and subjective, which cannot meet the requirements of fast and efficient detection. Moreover, traditional methods ignore crack characteristic information and cannot accurately identify small cracks, which affects the safety assessment of tunnel lining.

Method used

Using a method based on deep learning, by acquiring and labeling image data of the tunnel lining surface, using the YOLOv8 model combined with the self-attention mechanism to identify crack locations, and using threshold segmentation and transfer learning models to identify crack sizes, calculate the average width and maximum crack width Width, minimum width and overall length.

Benefits of technology

It achieves accurate identification of large and small cracks, improves the accuracy of detection results and the reliability of tunnel lining safety assessment, and meets the high requirements for automatic crack location and extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118505690B_ABST
    Figure CN118505690B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image processing and recognition, and specifically discloses a method, system and electronic device for detecting cracks in a tunnel lining based on deep learning, including obtaining image data of the surface of a tunnel lining, annotating, resizing, normalizing and performing image brightness equalization processing on the image data, and making labels based on the frame selection interference factor to obtain a labeled image data set, obtaining diagonal boundary box data based on the labeled image data set and a crack position recognition model, performing threshold segmentation on image data samples based on the diagonal boundary box data to obtain crack samples, obtaining a binary image based on a crack size recognition model of the crack samples, inputting the binary image into a contour processing algorithm model to obtain statistical data of crack width and length, obtaining crack detection parameters based on the statistical data, realizing the integration of automatic identification and positioning of large and small cracks in the tunnel and automatic calculation of crack size, and improving the efficiency and accuracy of crack detection in the tunnel lining.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing and recognition technology, and in particular to a tunnel lining crack detection method, system and electronic equipment based on deep learning. Background Art

[0002] Subways have been widely used around the world because of their environmental protection, energy saving, emission reduction and other characteristics. They can reduce urban traffic pressure while causing less pollution and damage to the environment. However, due to different construction times, geological conditions and technical standards of tunnel structures, after years of operation, apparent defects such as lining cracks, water seepage and leakage have appeared, posing serious safety hazards to the tunnel structure itself and the safe operation of trains. Among them, lining cracks are one of the most common and serious damages. Therefore, regular detection, statistics and evaluation of tunnel lining cracks will provide guidance for the next step of tunnel lining safety and stability, and provide a basis for evaluating the structural safety of tunnel linings and controlling cracks.

[0003] However, due to the hidden nature of subway tunnels, the continuity of transportation, the complexity of tunnel lining stress and other factors, the current lining crack detection faces time and cost pressures.

[0004] In the related technologies, traditional tunnel lining crack detection mainly relies on manual visual inspection, which is inefficient, dangerous, subjective, and time-consuming. It cannot meet the current requirements for fast and efficient tunnel lining crack detection. In the image recognition method, some influencing factors are not fully considered in the image pre-processing. It only extracts the crack position and ignores the crack feature information. At the same time, the extracted tunnel lining cracks focus more on large cracks, while ignoring the positioning and identification of small cracks in the tunnel lining. It cannot meet the current high requirements for automatic crack positioning and automatic crack extraction, thereby affecting the accuracy of tunnel lining safety assessment. Summary of the invention

[0005] The present application aims to solve the problems in the prior art of manually extracting crack positions of tunnel lining cracks or models that only extract crack positions while ignoring crack feature information. The extracted tunnel lining cracks focus more on large cracks, and some influencing factors are ignored in image pre-processing. It cannot meet the current requirements of automatic crack positioning and crack extraction, and the detection precision and accuracy need to be improved. Based on this, a tunnel lining crack detection method, system and electronic equipment based on deep learning are proposed.

[0006] In a first aspect, an embodiment of the present application provides a method for detecting cracks in a tunnel lining based on deep learning, comprising:

[0007] Acquire image data of the tunnel lining surface, and perform labeling, size adjustment, normalization, and image brightness equalization processing on the image data to obtain image data samples;

[0008] Select interference factors according to the image data samples to create labels to obtain a labeled image data set, wherein the labeled image data set includes a first training set and a first test set;

[0009] Inputting the first training set into a target position recognition model to obtain a crack position recognition model, and inputting the first test set into the crack position recognition model to obtain diagonal bounding box data;

[0010] Performing threshold segmentation on the image data samples based on the diagonal bounding box data to obtain crack samples, wherein the crack samples include a second training set and a second test set;

[0011] Inputting the second training set into the target size recognition model to obtain a crack size recognition model, and inputting the second test set into the crack size recognition model to obtain a binary image;

[0012] The binarized image is input into the contour processing algorithm model to obtain statistical data of crack width and length, and crack detection parameters including average crack width, maximum width, minimum width and total length are obtained based on the statistical data.

[0013] According to some embodiments of the present application, the step of acquiring image data of the tunnel lining surface, and performing labeling, size adjustment, normalization, and image brightness equalization processing on the image data to obtain image data samples includes:

[0014] Annotating the image data including the position and size of the crack, and cropping and resizing the annotated image data;

[0015] The histogram, normalized histogram and cumulative distribution function of each image are calculated in sequence based on the adjusted image data, and

[0016] Based on the calculation results, the original grayscale image is mapped and the brightness of the image is adjusted by combining linear transformation calculation to obtain image data samples.

[0017] According to some embodiments of the present application, the step of sequentially calculating the histogram, normalized histogram, and cumulative distribution function of each image based on the adjusted image data, and mapping the original grayscale image based on the calculation results and adjusting the brightness of the image by linear transformation calculation to obtain an image data sample includes:

[0018] Based on the formula Calculate the histogram of each image,

[0019] Based on the formula Calculate the normalized histogram,

[0020] Based on the formula Calculate the cumulative distribution function,

[0021] Based on the formula Map the original grayscale image, and

[0022] Based on the formula Perform linear changes to adjust the brightness of the image to obtain image data samples;

[0023] In the formula, Indicates that the gray level is the brightness value of the kth pixel in the image, M represents the total number of finite elements in each row of the image, and N represents the total number of finite elements in each column of the image. Indicates that the image is at position The gray value at Indicates whether the grayscale of the current pixel meets the selected grayscale level. Indicates the gray level is The number of pixels in the image, n represents the total number of pixels in the image, Indicates the gray level is The frequency of pixel appearance, Indicates the gray level is The frequency of pixel appearance, Indicates that the gray level is less than or equal to The cumulative probability of a pixel, Indicates the new gray level mapped to the old gray level, represents the total number of gray levels, represents the contrast scaling factor of the image, Indicates the brightness offset of the image, Represents the new image grayscale matrix.

[0024] According to some embodiments of the present application, the step of inputting the first training set into the target position recognition model to obtain a crack position recognition model; and the step of inputting the first test set into the crack position recognition model to obtain diagonal bounding box data includes:

[0025] The attention mechanism is embedded into the backbone network, neck network and head detection of the YOLOv8 algorithm model to obtain the target position recognition model;

[0026] A loss function for measuring the overlap between the predicted crack area and the actual crack area is embedded based on the target position recognition model;

[0027] Input the first training set to train the model to obtain the training accuracy and error convergence curve corresponding to the recognition accuracy and loss function, and obtain the crack position recognition model based on the training accuracy and error convergence curve;

[0028] Based on the obtained crack position recognition model, the first test set is input to obtain diagonal bounding box data, which includes the located crack image position and its coordinate data of the relationship with the full image position.

[0029] According to some embodiments of the present application, the embedding of the target position recognition model to measure the overlap loss function between the predicted crack area and the actual crack area includes:

[0030] The loss function is constructed based on the pixel true label and pixel prediction probability of the collected image.

[0031] Among them, the loss function calculation formula is:

[0032] In the formula, represents the loss function, represents the true label of the i-th pixel, represents the predicted probability of the i-th pixel, is the total number of pixels in the image.

[0033] According to some embodiments of the present application, the step of inputting the second training set into the target size recognition model to obtain a crack size recognition model, and inputting the second test set into the crack size recognition model to obtain a binary image includes:

[0034] Pre-training the deep learning network model based on the second training set to obtain output image features;

[0035] Modifying the size of the corresponding network structure based on the image features and freezing other convolution or pooling layers of the network structure to obtain a target size recognition model;

[0036] The second training set is input into the target size recognition model for transfer learning training, and the joint activation function and the cross entropy loss function are used as the loss function of the model after transfer learning training to obtain a crack size recognition model.

[0037] According to some embodiments of the present application, the second training set is input into the target size recognition model for transfer learning training, and the activation function and the cross entropy loss function are combined as the loss function of the model after transfer learning training to obtain a crack size recognition model, including:

[0038] The calculation formula of the joint activation function and the cross entropy loss function as the loss function of the model after transfer learning training is:

[0039]

[0040] In the formula, represents the loss function, represents the i-th element of the original output of the neural network, represents the jth element of the original output of the neural network, represents the i-th hot encoded vector, Indicates the number of all elements to be output.

[0041] Compared with the prior art, the above technical solutions in the embodiments of the present application have at least the following technical effects or advantages:

[0042] 1) The method provided in the present application is an automated tunnel crack detection method which mainly includes two modules: a lining crack position recognition model on a tunnel grayscale image and a crack size recognition model, wherein the model for tunnel lining crack position recognition is based on a Yolov8 deep neural network model and introduces a self-attention mechanism, so that the image detection algorithm can locate cracks on photos, and enhance the recognition of small micro-crack features through the attention mechanism, and accurately recognize large cracks or small cracks, and obtain diagonal bounding box data through the model; in order to further count the specific size parameters of the automatically identified cracks, the image data samples are threshold segmented based on the diagonal bounding box data to obtain crack sample data, a crack size recognition model is trained based on the crack sample data, and a binary image is obtained by testing; the binary image is input into the contour processing algorithm model to obtain crack detection parameters including the average width, maximum width, minimum width and total length of the cracks, which meets the current high requirements for automatic crack positioning and automatic crack extraction, and improves the reliability and accuracy of the detection results and tunnel lining safety assessment.

[0043] 2) In order to improve the robustness of the pre-trained model under different lighting conditions and remove the interference factors of the image data on the tunnel lining surface, the brightness of the image is unified by equalization and other transformation methods. This is achieved by first performing histogram equalization and then performing linear changes. At the same time, since the grayscale image of the tunnel contains many interfering structures such as bolts and joints in addition to cracks, the interference factors are individually selected to make labels, so as to improve the accuracy of the tunnel lining crack position recognition model in extracting and positioning the lining surface crack recognition and reduce the misjudgment rate of the model recognition process.

[0044] 3) By performing threshold segmentation on the image data samples based on the diagonal bounding box data, the crack sample data for input into the crack size recognition model is obtained. The crack size recognition model is built based on the transfer learning network model. The transfer learning model shows good accuracy and stability. With the progress of the inspection work, the data set will become more and more substantial, and the accuracy of the model will also improve accordingly. The model realizes the binarization processing and output of the crack image, and obtains the crack detection parameter data including the average width, maximum width, minimum width and total length of the crack through the contour processing algorithm model.

[0045] In a second aspect, an embodiment of the present application provides a tunnel lining crack detection system based on deep learning, comprising:

[0046] An image acquisition module is configured to obtain image data of the tunnel lining surface, and to perform labeling, size adjustment, normalization and image brightness equalization on the image data to obtain image data samples;

[0047] an interference factor removal module, configured to select interference factors including bolts and welds according to the image data samples to create labels to obtain a labeled image data set, and divide the labeled image data set into a first training set and a first test set in proportion;

[0048] A first model building module is configured to build a target position recognition model, input the first training set to train the model to obtain a crack position recognition model, and input the first test set to the crack position recognition model to obtain diagonal bounding box data;

[0049] A threshold segmentation module is configured to perform threshold segmentation on the image based on the diagonal bounding box data to obtain crack samples, and to obtain a second training set and a second test set based on the crack recognition sample division;

[0050] A second model building module is configured to build a crack size recognition model based on transfer learning, input the second training set to train the model, and input the second test set to the trained model to obtain a binary image;

[0051] The crack feature calculation module is configured to obtain statistical data of crack width and length by processing the binary image based on the established contour processing algorithm model, and obtain crack detection parameters including the average width, maximum width, minimum width and total length of the crack based on the statistical data.

[0052] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0053] at least one processor; and

[0054] a memory communicatively connected to the at least one processor; wherein,

[0055] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the steps of the tunnel lining crack detection method based on deep learning as described in any embodiment of the first aspect above.

[0056] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implement the steps of the deep learning-based tunnel lining crack detection method as described in any one of the embodiments of the first aspect above.

[0057] It can be understood that the beneficial effects of the technical solutions provided in the second, third and fourth aspects can be found in the relevant description of the first aspect, and will not be repeated here.

[0058] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0060] Figure 1 is a flow chart of a tunnel lining crack detection method based on deep learning according to an embodiment of the present application;

[0061] Figure 2 is a schematic diagram of labeling a captured image according to an embodiment of the present application;

[0062] Figure 3 is a schematic diagram of an image after the interference factor is selected according to an embodiment of the present application;

[0063] Figure 4 is a schematic diagram of a binarization process of a tunnel crack image according to an embodiment of the present application;

[0064] Figure 5 is a block diagram of a tunnel lining crack detection system based on deep learning according to an embodiment of the present application;

[0065] Figure 6 It is a functional block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0066] The embodiments of the present application are described in detail below. The embodiments described with reference to the accompanying drawings are exemplary. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0067] It should be noted that, unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific implementations and are not intended to limit this application. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0068] See also Figures 1 to 4 , this embodiment provides a tunnel lining crack detection method based on deep learning, including:

[0069] Step S100: acquiring image data of the tunnel lining surface, and performing labeling, size adjustment, normalization and image brightness equalization processing on the image data to obtain image data samples;

[0070] In this step, the image data may be photos of the interior of the tunnel collected during historical routine inspections of the tunnel. To ensure that these photos cover different lighting conditions and environments, areas with complex geological conditions, areas crossing the city center, and multiple rivers and lakes may be included, and the number of these photos may be relatively balanced.

[0071] It can be understood that in addition to the photo itself, it is also necessary to record the shooting position relationship of the CCD camera carried by the simple train platform to shoot the tunnel lining surface, generate shooting position data, the current camera elevation angle a, the distance L from the tunnel entrance, the distance d between the camera and the tunnel lining surface, and the image data I, and obtain the shooting position data A according to the formula, which is specifically expressed as: A={[{'elevation_i_j':{a}},{'Length_i_j':{d}},{'Distance_i':{L}},{'Image_i_j':{I}}],}, where elevation_i_j represents the elevation value of the i-th tunnel section at the j-th elevation segment, Length_i_j represents the distance between the camera and the tunnel lining at the j-th elevation segment of the i-th tunnel section, Distance_i represents the distance between the i-th tunnel section and the tunnel entrance, and Image_i_j represents the image information at the j-th elevation segment of the i-th tunnel section.

[0072] It should be noted that the tunnel section calculation formula is calculated based on the maximum shooting range of the camera. The specific formula is: , where All_Length represents the total length of the tunnel, CCD_Length represents the length of the camera shooting range, and the elevation segment is also calculated based on the maximum shooting range. The specific formula is: , where All_Angle represents the maximum elevation angle of the camera, and CCD_Angle represents the elevation angle of the camera in one shot. When a crack is detected in a certain image in the subsequent steps, during the process of locating the crack, the specific tunnel location where the crack appears is traced back through the shooting position data.

[0073] It should also be noted that since the image content also includes other accessories such as pipes and wires, cracks are smaller than the accessories and more difficult to detect. The image data is captured as a high-definition grayscale image, which will be more effective in the subsequent model processing image recognition crack process.

[0074] In order to facilitate the training and comparison of the model, the collected tunnel photos were annotated with the location and size of the cracks through manual positioning and recognition. The annotation content included information such as the location, length, and width of the cracks. The photos were then accurately annotated using the annotation tool LabelMe.

[0075] See also Figure 2 It should be noted that the LabelMe annotation tool is an open source tool widely used in the market. The specific function implementation principle will not be elaborated here. The LabelMe annotation tool annotates different image features through bounding boxes of different colors, and annotates different image features annotated by the bounding boxes. At the same time, considering the size requirements of the subsequent model and in order to further denoise the image, in order to improve the robustness of the pre-trained model under different lighting conditions, the image data is processed including resizing, normalization and image brightness equalization to obtain image data samples.

[0076] In some embodiments, the image data is annotated including the location and size of the cracks, and the annotated image data is cropped and resized, i.e., the large scanned photo taken by the CCD is cropped, and the histogram, normalized histogram and cumulative distribution function of each image are calculated in turn based on the adjusted image data, and based on the calculation results, the original grayscale image is mapped and the brightness of the image is adjusted in combination with linear transformation calculation to obtain an image data sample.

[0077] Specifically, we choose to use histogram equalization first and then linear change to achieve uniform brightness of the image. Based on the formula Calculate the histogram of each image,

[0078] Based on the formula Calculate the normalized histogram,

[0079] Based on the formula Calculate the cumulative distribution function,

[0080] Based on the formula Map the original grayscale image, and

[0081] Based on the formula Perform linear changes to adjust the brightness of the image to obtain image data samples;

[0082] In the formula, Indicates that the gray level is the brightness value of the kth pixel in the image, M represents the total number of finite elements in each row of the image, and N represents the total number of finite elements in each column of the image. Indicates that the image is at position The gray value at Indicates whether the grayscale of the current pixel meets the selected grayscale level. Indicates the gray level is The number of pixels in the image, n represents the total number of pixels in the image, Indicates the gray level is The frequency of pixel appearance, Indicates the gray level is The frequency of pixel appearance, Indicates that the gray level is less than or equal to The cumulative probability of a pixel, Indicates the new gray level mapped to the old gray level, represents the total number of gray levels, represents the contrast scaling factor of the image, Indicates the brightness offset of the image, Represents the new image grayscale matrix.

[0083] Step S200: Select interference factors according to the image data sample to create labels to obtain a labeled image data set, wherein the labeled image data set includes a first training set and a first test set;

[0084] In this step, if Figure 3 As shown in the figure, after the image data is normalized for brightness and undergoes other preprocessing, the image data samples are obtained. Since the grayscale image of the tunnel contains many interfering structures in addition to cracks, such as bolts, joints, and gaps, these factors will cause the subsequent model to misjudge. Therefore, it is necessary to separately select the interfering factors and make labels to improve the accuracy of subsequent model recognition.

[0085] Optionally, after selecting interference factors for image data samples and making labels to obtain a labeled image data set, the labeled tunnel scanning images are divided into a training set and a test set according to a 4:1 data ratio. The training set is used to train the created target position recognition model, and the test set is used to predict the trained model. It should be noted that the image data ratio of the training set and the test set can also be other values, such as 5:1 or 6:1, which can be selected according to actual needs.

[0086] Step S300: inputting the first training set into the target position recognition model to obtain a crack position recognition model, and inputting the first test set into the crack position recognition model to obtain diagonal bounding box data;

[0087] In this step, the target position recognition model is used to process the input tunnel lining image to identify the location of the crack. In order to improve the recognition precision and accuracy, the target position recognition model is built based on the improved YOLOv8 algorithm model. It should be noted that the target position recognition model can also be based on other versions of the YOLO series, which is not limited here. After the target position recognition model is built, training and debugging are performed to obtain a crack position recognition model with more accurate prediction. Finally, the test set is input into the crack position recognition model to obtain the diagonal bounding box data. It should be noted that the diagonal bounding box data is the bounding box data of the crack in each image, and the diagonal bounding box data includes the located crack image position and its coordinate data of the relationship with the position of the whole image.

[0088] Among them, the diagonal bounding box data includes data set C, which can be expressed by the formula: {[{'elevation_i_j':{a}},{'Length_i_j':{d}},{'Distance_i':{L}},{'Image_i_j':{f_B(A_i('Image_i_j'))}},{'Image_i_j_crack_j':{(x,y,w,h)}}],}. The difference between data set C and data A is that image I is processed. Specifically, it is processed according to f_B (A_i ('Image_i_j')), where f_B (*) represents the processing result of the crack position recognition model, specifically the located crack image and its position relationship with the whole image (x, y, w, h), where x, y represent the center coordinates of the crack image, w, h represent the length and width of the located crack range, and are retained in {'Image_i_j_crack_j':{(x, y, w, h)}}, A_i ('Image_i_j') represents the image data corresponding to 'Image_i_j' under the i-th tunnel segment in data A, and Image_i_j_crack_j represents the j-th crack under the Image_i_j picture.

[0089] The creation of the target location recognition model is further described below, including the following steps:

[0090] Step S301: embedding the attention mechanism into the backbone network, neck network and head detection of the YOLOv8 algorithm model to obtain a target position recognition model;

[0091] In this step, it is necessary to explain that the attention mechanism is a technology widely used in deep learning, especially in the fields of natural language processing (NLP) and computer vision (CV). Its core idea is to optimize the calculation process by adjusting weight distribution, introducing new calculation methods and analyzing the calculation context vector to improve the detection efficiency of some features, thereby improving the performance of the model. In computer vision, the attention mechanism is mainly divided into channel attention and spatial attention. Channel attention generates channel weights through global average pooling and global maximum pooling; spatial attention generates spatial weights by average pooling and maximum pooling of feature maps. The Convolutional BlockAttention Module (CBAM) module combines channel attention and spatial attention to significantly improve model performance. The operation process of the module is shown in formulas (1), (2), (3), (4) and (5). For the grayscale image of the tunnel used, the spatial attention mechanism will work more effectively. Non-Local Attention generates global context information by calculating the similarity between any two positions in the input feature map, as shown in formula (6), which can capture global dependencies.

[0092] (1);

[0093] (2);

[0094] (3);

[0095] (4);

[0096] (5);

[0097] in, is the input feature map, is the sigmoid function, is a global average pooling function that averages the values ​​of all spatial positions of each channel, is the global maximum pooling function that takes the maximum value of all spatial positions of each channel, is a multilayer perceptron with two fully connected layers, is the channel attention map, is the weighted input feature map, is the convolution operation, represents a convolution kernel of size 7×7, is the output feature map.

[0098] (6);

[0099] in: is the output feature at position i, are the input features of position i and position j respectively, is the similarity function measuring the similarity between position i and position j, is the feature transformation at position j, is the normalization factor. Common Functions include: Dot product: , Gaussian function: , embedding function: wait.

[0100] The attention mechanism is embedded into the Backbone, Neck and Head of YOLOv8 to enhance the feature extraction, fusion and detection capabilities. The attention mechanism can be introduced in the Backbone, Neck and Head respectively. First, define the NonLocalBlock class. The weight is assigned to each position by calculating the similarity of the global features. The class contains g, theta, phi, and convolution layer: used to generate different feature maps. Global similarity calculation: calculate the similarity between positions through the inner product of the feature map. Recalibrate the feature map: recalibrate the original feature map according to the calculated weight. Insert NonLocalBlock between layer3 and layer4 of the CSPDarknetWithAttention class in the Backbone module. In this way, after the first few layers of convolution, the feature map will pass through the self-attention mechanism module to enhance the feature representation of important areas. The network logic framework diagram is shown in the figure. The Neck layer of YOLOv8 uses the PANet (Path Aggregation Network) module. First, define the CBAM class, which contains the ChannelAttention class and the SpatialAttention class. Redefine PANetWithAttention, insert the CBAM module between layer2 and layer3 of the forward function, introduce the self-attention mechanism into the PANet module, replace the PANet module of the original network layer, and integrate it into the Neck structure of Yolov8.

[0101] Step S302: embedding a loss function for measuring the overlap between the predicted crack area and the actual crack area based on the target position recognition model;

[0102] In this step, in order to measure the difference or error between the prediction result of the target position recognition model and the actual label, a loss function is created to measure the overlap between the predicted crack area and the actual crack area. The loss function is constructed based on the pixel real label and pixel prediction probability of the collected image.

[0103] The loss function calculation formula is:

[0104] In the formula, represents the loss function, represents the true label of the i-th pixel, represents the predicted probability of the i-th pixel, is the total number of pixels in the image.

[0105] Step S303: inputting the first training set to train the model to obtain the training accuracy and error convergence curve corresponding to the recognition accuracy and loss function, and obtaining the crack position recognition model based on the training accuracy and error convergence curve;

[0106] In this step, it should be noted that the first training set is input into the target position recognition model for training. After each iterative training, the accuracy of the model training is calculated using the test set. When the accuracy of the model is stable, the training process is exited and the model is retained to obtain the training accuracy and error convergence curve corresponding to the recognition accuracy and loss function. The most suitable target position recognition model is selected as the crack position recognition model through the training accuracy and error convergence curve of the target position recognition model. The most suitable one may be the crack positioning recognition model with the highest accuracy.

[0107] Step S304: Based on the obtained crack position recognition model, the first test set is input to obtain diagonal bounding box data, wherein the diagonal bounding box data includes the located crack image position and its coordinate data of the relationship with the full image position.

[0108] In this step, after multiple trainings, the final crack position recognition model is obtained, and then the first test set is input into the crack position recognition model to obtain the diagonal bounding box data including the located crack image position and its coordinate data of the relationship with the full image position.

[0109] Step S400: performing threshold segmentation on the image data sample based on the diagonal bounding box data to obtain crack samples, wherein the crack samples include a second training set and a second test set;

[0110] In this step, it should be noted that in order to automatically measure the size of the cracks obtained by image recognition and positioning by the crack position recognition model, the crack position recognition model can be built based on the DeepCrack model, and it is necessary to perform threshold segmentation on the image in the image data sample according to the corner bounding box data to obtain the crack sample. Of course, it is also possible to perform threshold segmentation on the image in the labeled image data set to obtain the crack sample.

[0111] See also Figure 4 , taking DeepCrack as an example, to realize the crack size recognition of the image, it is necessary to make a data set for the training rules of the model. The output is a binary crack image, so to make a data set, the image must be threshold segmented first. The lighting conditions of the tunnel scanning image are difficult to distinguish directly. Through the output diagonal bounding box data, the ROI (Region of Interest) of the crack area is manually or automatically selected, and the non-ROI area is removed to obtain the crack sample. The crack sample is cropped and extracted from the crack selected from the image, and then a suitable binarization threshold is selected for binarization. After obtaining the crack sample, it can be divided into the second training set and the second test set according to the proportion. The division ratio can be 4:1, 5:1 or other ratio coefficients, which can be selected according to actual needs.

[0112] Step S500: inputting the second training set into the target size recognition model to obtain a crack size recognition model, and inputting the second test set into the crack size recognition model to obtain a binary image;

[0113] In this step, the deep learning network model is pre-trained based on the second training set to obtain output image features, the size of the corresponding network structure is modified based on the image features, and other convolution or pooling layers of the network structure are frozen to obtain a target size recognition model, the second training set is input into the target size recognition model for transfer learning training, and the joint activation function and cross entropy loss function are used as the loss function of the model after transfer learning training to obtain a crack size recognition model.

[0114] It should be noted that the deep learning network model uses the DeepCrack model. DeepCrack is an open source deep learning model designed for crack detection. The main process is to achieve end-to-end crack segmentation through hierarchical feature learning. DeepCrack mainly includes the following modules: convolution layer, output layer, fusion layer, sampling and prediction layer and optimization module. Since the DeepCrack model is an existing tool model, its specific function implementation will not be repeated here.

[0115] Specifically, to pre-train DeepCrack, first load the pre-trained model of DeepCrack, and modify the size of the last three layers of the network structure to 512*512*2, 512*512, 512 according to the output image size requirements and features of this image recognition, and freeze other convolution or pooling layers of the network structure to avoid destroying the results of model pre-training. Load the data set into the adjusted convolutional neural network model to start transfer learning training. During the training process, use small batches of data for iterative updates, and perform statistics on each output data to obtain the prediction accuracy value. Based on the prediction accuracy value, determine the final crack size recognition model.

[0116] It can be understood that in order to measure the difference or error between the prediction result of the target size recognition model and the actual crack size, a loss function for measuring the predicted crack size and the actual crack size is created, and the Softmax combined with the CrossEntropyLoss function is used as the loss function of the network model.

[0117] The Softmax formula is ;

[0118] The CrossEntropyLoss function formula is ;

[0119] The specific joint activation function and cross entropy loss function are used as the loss function calculation formula of the model after transfer learning training:

[0120]

[0121] In the formula, represents the loss function, represents the i-th element of the original output of the neural network, represents the jth element of the original output of the neural network, Represents the vector of the i-th hot encoding. For the binary image, if the output predicted pixel value is correct compared with the actual value, ,otherwise , is the probability that the model predicts that the sample belongs to category i, that is, , Indicates the number of all elements output, in the output 512*512 image .

[0122] Continue reading Figure 4 Before obtaining the crack size recognition model, it is necessary to select different binarization thresholds for the model to binarize it, obtain the most appropriate binarization threshold setting value, input the second test set into the crack size recognition model for processing, and the crack size recognition model processes the crack sample image to obtain a binary crack image.

[0123] Step S600: Input the binarized image into the contour processing algorithm model to obtain statistical data of crack width and length, and obtain crack detection parameters including average crack width, maximum width, minimum width and total length based on the statistical data.

[0124] In this step, the segmentation map output by the model is first binarized through the binary crack image output by step S500 to extract the crack area. The crack width and length dimension data are obtained through the contour processing algorithm of computer vision. Taking the findContours function of the cv module of Python as an example, the width distribution of each connected area is calculated, and the average crack width of the connected area is calculated; the length of the connected area of ​​the crack is calculated to estimate the crack, and finally the calculated crack width and length are statistically analyzed to obtain the average width, maximum width, minimum width, and total length of the crack.

[0125] Specific basis Processing, where The processing result of model D is specifically image segmentation of the located crack image to obtain a binary image, in which crack pixels are 1 and non-crack pixels are 0. The segmented crack image uses a contour processing algorithm model to calculate actual physical information to obtain the average width, maximum width, minimum width, and total length of the crack. The specific calculation method is to obtain and store the actual length corresponding to a pixel point.

[0126] In the above method steps, a lining crack position recognition model and a crack size recognition model on a tunnel grayscale image are provided, wherein the tunnel lining crack position recognition model is based on the Yolov8 deep neural network model and introduces a self-attention mechanism, so that the image detection algorithm can locate the cracks on the photo, and enhance the recognition of small micro-crack features through the attention mechanism, and can accurately recognize large cracks or small cracks, and obtain diagonal bounding box data through the model; in order to further count the specific size parameters of the automatically identified cracks, the image data samples are threshold segmented based on the diagonal bounding box data to obtain crack sample data, and a crack size recognition model is built based on the crack sample data, and a binary image is obtained by testing; the binary image is input into the contour processing algorithm model to obtain crack detection parameters including the average width, maximum width, minimum width and total length of the cracks, which meets the current high requirements for automatic crack positioning and automatic crack extraction, and improves the reliability and accuracy of the detection results and the tunnel lining safety assessment.

[0127] In addition, in order to improve the robustness of the pre-trained model under different lighting conditions and remove the interference factors of the image data on the surface of the tunnel lining, the brightness of the image is unified by means of transformation such as equalization. This is achieved by first performing histogram equalization and then performing linear changes. At the same time, since the grayscale image of the tunnel contains many interfering structures such as bolts and joints in addition to cracks, the interference factors are individually selected to make labels, so as to improve the accuracy of the tunnel lining crack position recognition model in extracting and positioning lining surface crack recognition and reduce the misjudgment rate of the model recognition process.

[0128] In addition, by performing threshold segmentation on the image data samples based on the diagonal bounding box data, crack sample data for input into the crack size recognition model is obtained. The crack size recognition model is built based on the transfer learning network model. The transfer learning model shows good accuracy and stability. With the progress of the inspection work, the data set will become more and more substantial, and the accuracy of the model will also improve accordingly. The model realizes the binarization processing and output of the crack image, and obtains the crack detection parameter data including the average width, maximum width, minimum width and total length of the crack through the contour processing algorithm model.

[0129] See also Figure 5 , Figure 5 It is shown that this embodiment provides a tunnel lining crack detection system 200 based on deep learning, and the tunnel lining crack detection system 200 based on deep learning includes:

[0130] The image acquisition module 210 is configured to obtain image data of the tunnel lining surface, and to label, resize, normalize and equalize the image brightness of the image data to obtain image data samples;

[0131] The interference factor removal module 220 is configured to select interference factors including bolts and welds according to the image data samples to create labels to obtain a labeled image data set, and divide the labeled image data set into a first training set and a first test set in proportion;

[0132] The first model building module 230 is configured to build a target position recognition model, input the first training set to train the model to obtain a crack position recognition model, and input the first test set to the crack position recognition model to obtain diagonal bounding box data;

[0133] A threshold segmentation module 240 is configured to perform threshold segmentation on the image based on the diagonal bounding box data to obtain crack samples, and to obtain a second training set and a second test set based on the crack recognition sample division;

[0134] The second model building module 250 is configured to build a crack size recognition model based on transfer learning, input the second training set to train the model, and input the second test set to the trained model to obtain a binary image;

[0135] The crack feature calculation module 260 is configured to calculate the statistical data of crack width and length by processing the binary image based on the established contour processing algorithm model, and obtain crack detection parameters including the average width, maximum width, minimum width and total length of the crack based on the statistical data.

[0136] In some embodiments, an electronic device is also provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the steps of the deep learning-based tunnel lining crack detection method as described in any of the above embodiments.

[0137] See also Figure 6 , Figure 6 A block diagram of an exemplary electronic device suitable for implementing the embodiments of the present application is shown. Figure 6 The electronic device 12 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0138] like Figure 6 As shown, the electronic device 12 is in the form of a general-purpose computing device, and the components of the electronic device 12 may include but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 connecting different system components (including the system memory 28 and the processing unit 16).

[0139] The bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to the Industrial Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnection (PCI) bus.

[0140] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.

[0141] The memory 28 may include computer system readable media in the form of volatile memory, such as random access memory 30 (RAM) and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6 Not shown, usually called a "hard drive").

[0142] although Figure 6 Not shown, a disk drive for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing a removable non-volatile optical disk (e.g., a compact disc read-only memory (CD-ROM), a digital video disc read-only memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the various embodiments of the present application.

[0143] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described herein.

[0144] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 12, and / or communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 22. Furthermore, the electronic device 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 20.

[0145] like Figure 6 As shown, the network adapter 20 communicates with other modules of the electronic device 12 via the bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0146] The processing unit 16 executes various functional applications and data processing by running the programs stored in the system memory 28, such as implementing the steps of the tunnel lining crack detection method based on deep learning mentioned in the above-mentioned embodiment.

[0147] In some embodiments, based on the same inventive concept, a computer-readable storage medium is also provided, on which computer program instructions are stored. When the program instructions are executed by a processor, the steps of a tunnel lining crack detection method based on deep learning provided in the above embodiment are implemented.

[0148] The terms "first", "second", "third", etc. in the specification and claims of the present application and the drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a series of steps or units are included, or optionally, steps or units not listed are included, or optionally, other steps or units inherent to these processes, methods, products or devices are included.

[0149] Only the part relevant to the present application is shown in the accompanying drawings, but not all of the content. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processing or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. When its operation is completed, the process can be terminated, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0150] The terms "component", "module", "system", "unit", etc. used in this specification are used to represent computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a unit can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program, and / or distributed between two or more computers. In addition, these units can be executed from various computer-readable media having various data structures stored thereon. Units can communicate through local and / or remote processes, for example, based on signals having one or more data packets (e.g., data from a second unit interacting with another unit in a local system, a distributed system, and / or a network. For example, the Internet interacts with other systems via signals).

[0151] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example.

[0152] Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Mentioning "embodiment" in this article means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present embodiment application. The appearance of this phrase in various positions in the specification is not necessarily the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It can be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0153] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.

[0154] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the disclosure disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

Claims

1. A tunnel lining crack detection method based on deep learning, It is characterized in that include: Acquire image data of the tunnel lining surface, and perform labeling, size adjustment, normalization, and image brightness equalization processing on the image data to obtain image data samples; Select interference factors according to the image data samples to create labels to obtain a labeled image data set, wherein the labeled image data set includes a first training set and a first test set; Inputting the first training set into the target position recognition model to obtain a crack position recognition model; Input the first test set to the crack position recognition model to obtain diagonal bounding box data, which includes: embedding the attention mechanism into the backbone network, neck network and head detection of the YOLOv8 algorithm model to obtain a target position recognition model; embedding a loss function for measuring the overlap between the predicted crack area and the actual crack area based on the target position recognition model; inputting the first training set to train the model to obtain the training accuracy and error convergence curve corresponding to the recognition accuracy and loss function, and obtaining the crack position recognition model based on the training accuracy and error convergence curve; inputting the first test set based on the obtained crack position recognition model to obtain diagonal bounding box data, and the diagonal bounding box data includes the located crack image position and its coordinate data of the relationship with the full image position; Performing threshold segmentation on the image data samples based on the diagonal bounding box data to obtain crack samples, wherein the crack samples include a second training set and a second test set; Input the second training set to the target size recognition model to obtain a crack size recognition model, input the second test set to the crack size recognition model to obtain a binary image, which includes: pre-training the deep learning network model based on the second training set to obtain output image features; modifying the size of the corresponding network structure based on the image features, and freezing other convolution or pooling layers of the network structure to obtain the target size recognition model; inputting the second training set to the target size recognition model for transfer learning training, and combining the activation function and the cross entropy loss function as the loss function of the model after transfer learning training to obtain the crack size recognition model; The binarized image is input into the contour processing algorithm model to obtain statistical data of crack width and length, and crack detection parameters including average crack width, maximum width, minimum width and total length are obtained based on the statistical data.

2. According to the method for detecting cracks in tunnel lining based on deep learning in claim 1, It is characterized in that The step of obtaining image data of the tunnel lining surface, and labeling, resizing, normalizing, and image brightness equalization the image data to obtain image data samples includes: Annotating the image data including the position and size of the crack, and cropping and resizing the annotated image data; The histogram, normalized histogram and cumulative distribution function of each image are calculated in sequence based on the adjusted image data, and Based on the calculation results, the original grayscale image is mapped and the brightness of the image is adjusted by combining linear transformation calculation to obtain image data samples.

3. According to the method for detecting cracks in tunnel lining based on deep learning in claim 2, It is characterized in that The method of sequentially calculating the histogram, normalized histogram and cumulative distribution function of each image based on the adjusted image data, and mapping the original grayscale image based on the calculation results and adjusting the brightness of the image by linear transformation calculation to obtain image data samples includes: Based on the formula Calculate the histogram of each image, Based on the formula Calculate the normalized histogram, Based on the formula Calculate the cumulative distribution function, Based on the formula Map the original grayscale image, and Based on the formula Perform linear changes to adjust the brightness of the image to obtain image data samples; In the formula, Indicates that the gray level is the brightness value of the kth pixel in the image, M represents the total number of finite elements in each row of the image, and N represents the total number of finite elements in each column of the image. Indicates that the image is at position The gray value at Indicates whether the grayscale of the current pixel meets the selected grayscale level. Indicates the gray level is The number of pixels in the image, n represents the total number of pixels in the image, Indicates the gray level is The frequency of pixel appearance, Indicates the gray level is The frequency of pixel appearance, Indicates that the gray level is less than or equal to The cumulative probability of a pixel, Indicates the new gray level mapped to the old gray level, represents the total number of gray levels, represents the contrast scaling factor of the image, Indicates the brightness offset of the image, Represents the new image grayscale matrix.

4. According to the method for detecting cracks in tunnel lining based on deep learning in claim 1, It is characterized in that The target position recognition model is embedded in a loss function for measuring the overlap between the predicted crack area and the actual crack area, including: The loss function is constructed based on the pixel true label and pixel prediction probability of the collected image. Among them, the loss function calculation formula is: In the formula, represents the loss function, represents the true label of the i-th pixel, represents the predicted probability of the i-th pixel, is the total number of pixels in the image.

5. According to the method for detecting cracks in tunnel lining based on deep learning in claim 1, It is characterized in that The second training set is input into the target size recognition model for transfer learning training, and the joint activation function and the cross entropy loss function are used as the loss function of the model after transfer learning training to obtain a crack size recognition model, including: The calculation formula of the joint activation function and the cross entropy loss function as the loss function of the model after transfer learning training is: In the formula, represents the loss function, represents the i-th element of the original output of the neural network, represents the jth element of the original output of the neural network, represents the i-th hot encoded vector, Indicates the number of all elements to be output.

6. A tunnel lining crack detection system based on deep learning, It is characterized in that include: An image acquisition module is configured to obtain image data of the tunnel lining surface, and to perform labeling, size adjustment, normalization and image brightness equalization on the image data to obtain image data samples; an interference factor removal module, configured to select interference factors including bolts and welds according to the image data samples to create labels to obtain a labeled image data set, and divide the labeled image data set into a first training set and a first test set in proportion; The first model building module is configured to build a target position recognition model, input the first training set to train the model to obtain a crack position recognition model, and input the first test set to the crack position recognition model to obtain diagonal bounding box data, which includes: embedding the attention mechanism into the backbone network, neck network and head detection of the YOLOv8 algorithm model to obtain the target position recognition model; embedding a loss function for measuring the overlap between the predicted crack area and the actual crack area based on the target position recognition model; inputting the first training set to train the model to obtain the training accuracy and error convergence curve corresponding to the recognition accuracy and the loss function, and obtaining the crack position recognition model based on the training accuracy and error convergence curve; inputting the first test set based on the obtained crack position recognition model to obtain diagonal bounding box data, and the diagonal bounding box data includes the located crack image position and its coordinate data of the relationship between the position of the whole image; A threshold segmentation module is configured to perform threshold segmentation on the image based on the diagonal bounding box data to obtain crack samples, and to obtain a second training set and a second test set based on the crack recognition sample division; The second model building module is configured to build a crack size recognition model based on transfer learning, input the second training set to train the model, and input the second test set to the trained model to obtain a binary image, which includes: pre-training the deep learning network model based on the second training set to obtain output image features; modifying the size of the corresponding network structure based on the image features, and freezing other convolution or pooling layers of the network structure to obtain a target size recognition model; inputting the second training set to the target size recognition model for transfer learning training, and combining the activation function and the cross entropy loss function as the loss function of the model after transfer learning training to obtain a crack size recognition model; The crack feature calculation module is configured to obtain statistical data of crack width and length by processing the binary image based on the established contour processing algorithm model, and obtain crack detection parameters including the average width, maximum width, minimum width and total length of the crack based on the statistical data.

7. An electronic device, It is characterized in that include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the steps of the deep learning-based tunnel lining crack detection method described in any one of claims 1 to 5.

8. A computer-readable storage medium having computer program instructions stored thereon, It is characterized in that When the computer program instructions are executed by a processor, the steps of the tunnel lining crack detection method based on deep learning described in any one of claims 1 to 5 are implemented.