Tunnel crack recognition method based on dynamic dense stacking feature pyramid
Through the tunnel crack recognition method of dynamic dense stack feature pyramid, the self-attention network and residual branch network in multi-layer blocks are used to solve the problems of low recognition accuracy and poor real-time performance in tunnel crack recognition, achieving more efficient recognition effect and adaptation Complex environment.
Patent Information
- Application Number
- CN202411233630.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-09-04
AI Technical Summary
The existing tunnel crack identification technology has the problems of low recognition accuracy, poor real-time performance and insufficient generalization ability, especially in micro cracks and complex environments, which are difficult to accurately identify.
Using the tunnel crack recognition method based on dynamic dense stack feature pyramids, the self-attention network and residual branch network in multi-layer blocks are constructed, and the feature values are extracted in combination with the dynamic dense stack feature pyramids to enhance the complexity and expression ability of feature representation and improve recognition Accuracy and real-time.
It effectively improves the accuracy and real-time identification of tunnel cracks, can better capture the subtle features of tiny cracks in the image, adapt to complex tunnel structures and environments, and provide more effective tunnel health monitoring and maintenance tools.
Smart Images

Figure CN118736353B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of tunnel crack recognition methods, and in particular to a tunnel crack recognition method based on a dynamic dense stack feature pyramid. Background Art
[0002] Tunnel crack identification is an important task in tunnel health monitoring and maintenance, and it currently faces some difficulties and challenges. At present, tunnel crack identification mainly relies on manual evaluation, which has obvious shortcomings. First, the cracks are subtle and difficult to detect: some tiny cracks are not obvious on the bridge surface and are difficult to detect with the naked eye, especially when the crack width is less than 0.2mm, it is difficult to accurately identify them with traditional visual detection methods; secondly, environmental factors interfere: lighting conditions, stains on the tunnel surface, water marks and other factors may affect the accuracy of crack identification. As science and technology keep pace with the times, the traditional way of identifying tunnel cracks has gradually become modernized. In crack identification, artificial intelligence and other methods are used for identification, but there are many problems such as low efficiency and low identification accuracy.
[0003] At present, there is also a photographic measurement method for identifying tunnel cracks. This is one of the most commonly used methods. Through the use of cameras, video recorders, radiation, infrared photography and other technical means, the tunnel surface is photographed and recorded in detail. The captured images can be further used for crack identification and measurement through image processing software. However, some image processing software itself runs too slowly, has too low recognition accuracy, and cannot normalize large-scale data, resulting in misjudgment, which seriously affects tunnel safety.
[0004] In recent years, although there have been some applications of artificial intelligence in identifying tunnel cracks at home and abroad, these algorithms still have the following problems:
[0005] First, the complexity of crack features. Tunnel cracks may have various shapes and features, such as width, length, direction, etc., and may be affected by multiple factors such as tunnel structure, material, and age. This makes the extraction and identification of crack features quite complex, requiring the algorithm to have strong feature learning and processing capabilities.
[0006] Secondly, since the structures and environments of different tunnels may vary greatly, the algorithm needs to have good generalization capabilities and be able to adapt to various complex situations.
[0007] However, some current algorithms may only be trained and optimized for specific types of tunnels or cracks, resulting in poor performance in practical applications. In practical applications, algorithms are usually required to be able to quickly process a large number of images in a short period of time while ensuring recognition accuracy. However, there is often a certain contradiction between the two. Improving the real-time performance of the algorithm may sacrifice a certain degree of accuracy, and vice versa. Therefore, how to find the best balance between the two is an important issue. Summary of the invention
[0008] In order to solve the real-time problem of the algorithm in accurately identifying tunnel cracks and the problem of poor generalization of conventional algorithms, the present invention provides a tunnel crack identification method based on a dynamic dense stack feature pyramid.
[0009] In order to solve the above technical problems, the technical solution proposed by the present invention is:
[0010] A tunnel crack recognition method based on dynamic dense stack feature pyramid includes the following steps:
[0011] Step S1, performing data preprocessing: preprocessing the acquired crack images to obtain a training set, a test set, and a validation set;
[0012] Step S2, constructing a multi-layer intra-block self-attention network backbone network and a residual branch network;
[0013] Step S3, calculate self-attention, and use the residual idea to fuse the output of the self-attention network block in the multi-layer block;
[0014] Step S4, extracting feature values by dynamically densely stacking feature pyramids;
[0015] The step S4 specifically includes the following contents:
[0016] S4-1, the backbone network constructed in step S2 is a multi-path backbone network with feature maps, in which each path is interwoven with other paths through lateral connections to form a parallel dynamic dense stack feature pyramid grid;
[0017] S4-2, the feature hierarchy in the backbone network is reduced in dimensionality, that is, the number of channels is reduced by 1×1 convolution, and multiple dynamic dense stack pyramid paths are generated, each of which contains multiple feature layers;
[0018] S4-3, sampling features are fused to output the final feature map.
[0019] As a further improvement of the above technical solution:
[0020] Preferably, the step S1 specifically includes the following steps:
[0021] S1-1, perform preliminary screening: select original photos containing tunnel crack targets that meet the requirements according to the needs to form a data set;
[0022] S1-2, labeling: labeling the data set to obtain a labeled data set;
[0023] S1-3, classify the data set: divide the labeled data set into an initial training set, an initial validation set, and an initial test set;
[0024] S1-4, perform data augmentation on the initial training set, the initial validation set and the initial test set to obtain the training set, the validation set and the test set respectively to form residual features; the data augmentation includes rotation of 90°, rotation of 180°, rotation of 270°, horizontal flipping, vertical flipping, color jittering and Gaussian noise.
[0025] Preferably, in step S2, the backbone network includes a self-attention module based on an offset slider, the residual branch network includes an LN layer and a residual, and the self-attention network block in each multi-layer block is composed of a self-attention module based on an offset slider, an LN layer and a residual connection.
[0026] Preferably, in step S2, the specific steps are:
[0027] S2-1, constructing the first level: converting the residual feature dimensions after the division and data amplification in step S1 into S, and sending them to the self-attention module of the self-attention network block in the multi-layer block;
[0028] S2-2, construct the 2nd to 4th levels: For each level, after a residual merge, the input is merged according to the 2x2 adjacent residuals. The number of residual blocks is H / 8xW / 8, the feature dimension is reduced to 4S, and then sent to the multi-level W-MSA.
[0029] Preferably, in step S3, the residual is classified, and self-attention is calculated in each window in each feature layer; in the next feature layer, the window partition is moved to generate a new window. The self-attention calculation in the new window crosses the boundary of the previous window in the layer to provide a connection between them, and the calculation formula is as follows:
[0030] ;
[0031] Among them, R stands for Refer, which is the query vector; H stands for Hinge, which is the key vector; V stands for Value, which is the value vector; is the scaling factor;
[0032] The output of the residual block is added to the output of the self-attention network in the multi-layer block, and the feature map output is obtained again through the activation function; a deep network is constructed by stacking multiple residual blocks, and the output of each residual block is used as the input of the next residual block, stacked layer by layer.
[0033] Compared with the prior art, the tunnel crack identification method based on dynamic dense stacking feature pyramid provided by the present invention has the following advantages:
[0034] The tunnel crack identification method based on dynamic dense stack feature pyramid of the present invention utilizes multi-layer intra-block self-attention network and dynamic dense stack feature pyramid, aiming to overcome the problems encountered in tunnel crack identification, especially the difficulty of detecting tiny cracks, interference from environmental factors, and complex crack background features. The present invention improves the accuracy and real-time performance of tunnel crack identification through data acquisition, preprocessing and construction of deep learning network, thereby providing a more effective tool for tunnel health monitoring and maintenance.
[0035] The tunnel crack recognition method based on the dynamic dense stacked feature pyramid of the present invention, the self-attention mechanism of the multi-layer block self-attention network backbone network can extract features of the image on different layers, and enhance the complexity and expression ability of the feature representation by connecting and stacking multiple layers, so as to better capture the subtle features of tiny cracks in the image and solve the problem of complex background features of the cracks. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 This is a flow chart of the method for identifying the algorithm of the present invention.
[0037] Figure 2 This is a diagram of the dynamic dense stack feature pyramid grid structure of the present invention.
[0038] Figure 3 This is the overall architecture diagram of the multi-layer intra-block self-attention network of the present invention.
[0039] Figure 4 It is an experimental effect diagram in an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The specific embodiments of the present invention are described in detail below. It should be understood that the specific embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0041] like Figures 1 to 3 As shown, the tunnel crack identification method based on dynamic dense stacking feature pyramid of the present invention comprises the following sequential steps:
[0042] Step S1, perform data preprocessing: preprocess the acquired crack images to obtain a training set, a test set, and a validation set.
[0043] S1-1, preliminary screening: 1200 original photos containing tunnel crack targets that meet the requirements are screened according to actual needs to form a data set;
[0044] S1-2, labeling: Use labelimg labeling tool to label the data set, label the tunnel crack as 1, and other areas as background without labeling, to obtain the labeled data set;
[0045] S1-3, classify the data set: use 900 images in the labeled data set as the initial training set, 150 images as the initial validation set, and 150 images as the initial test set;
[0046] S1-4, perform data augmentation on the initial training set, the initial validation set and the initial test set to obtain a training set, a validation set and a test set respectively: the data augmentation includes rotation of 90°, rotation of 180°, rotation of 270°, horizontal flipping, vertical flipping, color jittering and Gaussian noise. After data augmentation, the training set contains 4500 images, the validation set contains 750 images, and the test set contains 750 images.
[0047] Generally in machine learning, the ratio of training set, development set, and test set is 60 / 20 / 20, which usually achieves better results.
[0048] Training set: training algorithm.
[0049] Development set: Tune parameters, select features, and make other decisions about the learning algorithm.
[0050] Test set: The best model selected from the development set is evaluated on the test set without changing the learning algorithm or parameters accordingly.
[0051] Step S2: construct a multi-layer intra-block self-attention network backbone network.
[0052] The backbone network includes a key module, the offset slider-based self-attention module (MSA module), which is used to replace the standard multi-head self-attention module in the conversion module. The residual branch network includes an LN layer and a residual. Each multi-layer intra-block self-attention network block consists of an offset slider-based self-attention module, an LN layer (LayerNorm layer), and a residual connection. The residual branch network implements residual learning by introducing residuals. The residual allows the input to be passed to the output through two convolutional layers, which helps reduce the risk of overfitting. And the residual branch and the backbone branch are added before the output, so that the multi-layer intra-block self-attention network has efficient modeling capabilities and computational efficiency when dealing with visual problems, so that it can better capture the subtle features of tiny cracks in the image.
[0053] The specific steps of constructing a multi-layer intra-block self-attention network backbone are as follows:
[0054] S2-1, construct the first level: convert the residual feature dimensions after the input and division into S, and send them to the self-attention module of the self-attention network block in the multi-layer block;
[0055] ;
[0056] Among them, MSA represents a self-attention module, and in the formula it is processed by MSA.
[0057] Further speaking:
[0058] ;
[0059] S2-2, constructing the 2nd to 4th levels: for each level, after a residual merging, the input is merged according to the adjacent residuals of 2x2, the number of residual blocks is H / 8xW / 8, and the feature dimension is reduced to 4S, and then sent to the multi-level W-MSA;
[0060] ;
[0061] Further speaking:
[0062] ;
[0063] Among them, g is the height of the feature map; k is the width of the feature map; N is the number of channels of the feature map, that is, the size of the embedding; S is the size of the window; Indicates the current level; Input for the current level; is the output of the current level; LN (LayerNormalization) represents the layer normalization processing performed at the current level; Ω represents the self-attention network block in the corresponding multi-layer block; W-MSA represents the cascaded window self-attention module, which is represented in the formula as processed by W-MSA.
[0064] In the window-based self-attention mechanism W-MSA, a fixed-size window is set to constrain the calculation range of the attention mechanism, only the similarity between the positions within the window is calculated, and the attention scores are normalized to obtain the weights.
[0065] In each level of input, a 2 x 2 window is selected, and the maximum value is selected to form a new residual map, which reduces the spatial dimension of the feature map and extracts the most significant features. At the same time, it reduces the amount of calculation and the number of parameters, which helps the training and generalization ability of the network. Then, 1×1 convolution is used for feature extraction. After the activation function, the second convolution layer uses 1×1 convolution again to extract features from the activated feature map, and finally obtains the output of the residual block.
[0066] In this embodiment, if Figure 3 As shown, the output of each layer is a high-dimensional feature map. Each step uses the high-dimensional feature map output by the previous step. The final model outputs a 100*5 matrix, where: 1dim contains whether the crack is contained, 4dim xmin, ymin, xmax, ymax are used to determine the crack location, and the above 5 dims together form a labeling box, such as Figure 3 , using H / 4*W / 4 as the basic unit, represents the size of a box, simple calculation Figure 3 The total number of 5dim boxes output is: 48+48+1+1+1+1=100, where 100 means a total of 100 boxes are output. The output of the feature pyramid is finally output through full connection. Among them, dim represents the dimension, 1dim represents the part of the upper left corner that is not included in the box, and 4dim represents Figure 3 The contents selected by the 4 boxes.
[0067] Step S3, calculate the self-attention and use the residual idea to fuse the output of the self-attention network block in the multi-layer block.
[0068] The residuals are assigned and a regular window partitioning scheme is used, that is, in each feature layer, self-attention is calculated in each window. In the next feature layer, the window partition is moved to generate a new window. The self-attention calculation in the new window crosses the boundaries of the previous windows in the layer to provide a connection between them. The calculation formula is as follows:
[0069] ;
[0070] Among them, R stands for Refer, which is the query vector; H stands for Hinge, which is the key vector; V stands for Value, which is the value vector; It is a scaling factor that prevents the result from being too large or too small, causing the value to be either 0 or 1 after softmax.
[0071] Drawing on the idea of residual network, the outputs of the self-attention network blocks in the four multi-layer blocks are added bit by bit to prevent feature disappearance and gradient explosion caused by the deepening of the network depth.
[0072] The output of the residual block is added to the output of the self-attention network in the multi-layer block, and then the feature map output is obtained again through the activation function. A deep network is constructed by stacking multiple residual blocks, which effectively learn complex feature representations. The output of each residual block is used as the input of the next residual block, and the layers are stacked layer by layer to increase the depth of the network.
[0073] Step S4, extracting feature values through dynamic dense stacking feature pyramid. The specific steps are as follows:
[0074] S4-1, first builds a multi-path backbone network with feature maps, where each path is intertwined with other paths through lateral connections. This design forms a parallel dynamic dense stack feature pyramid grid, providing multiple deep pyramid representations to enhance the accuracy of object detection and instance segmentation tasks.
[0075] S4-2, the feature hierarchy in the backbone network is reduced in dimensionality, that is, the number of channels is uniformly reduced through 1×1 convolution to generate multiple dynamic dense stack pyramid paths, each of which contains multiple feature layers.
[0076] S4-3, sampling feature fusion outputs the final feature map. We accumulate the features in the dynamic dense stack pyramid path with the high-level representation of the processed deep pyramid. The combination of the two enables the construction of a deeper feature pyramid, thus achieving a trade-off between efficiency and accuracy.
[0077] A dynamic dense stack feature pyramid model is constructed, including: the horizontal cross-layer module uses 1×1 horizontal convolution to project the feature map at the same level and fuses it with the corresponding features in the adjacent path; the upward cross-layer module introduces a direct connection to construct a bottom-up path across levels to shorten the path from the low-level features of the shallow path to the high-level features of the deep path; the downward cross-layer module realizes top-down information flow through downward connections.
[0078] Experimental verification
[0079] Before outputting the image, the output of the model is tested. The experimental evaluation indicators are set as follows:
[0080] The present invention conducts experiments on a validation set that has not participated in training, and uses mAP as the evaluation indicator.
[0081] AP is defined as the average area under the precision curve of each category in all categories. The calculation process is as follows: First, the precision and regression values are calculated for the prediction results of each category; then, the precision values are sorted according to the regression value, and the average precision value of each position is calculated; finally, the average precision value of each category is averaged to get AP.
[0082] mAP is defined as the average of the average AP of all categories. The calculation process is to average the AP value of each category and then average it again to get mAP. mAP: AP value calculation is only for one category, calculate the AP of all categories, and then take the average. mAP measures the detection ability of the trained model on all categories.
[0083] Assuming there are K categories, K>1, the calculation formula of mAP is:
[0084] ;
[0085] Among them, C represents the total number of categories, AP i Represents the AP value of the i-th class.
[0086] The input of this experiment is an image with cracks, such as Figure 4 As shown (the input image has no frame lines), the output is a map with the crack locations marked and the exact values of the detection results.
[0087] The preset threshold is 0.5, and the above categories include:
[0088] True Positive (TP): A correct positioning result, the IOU between the predicted box and the actual box (groundtruth) (i.e., the value obtained by dividing the overlap of the two boxes by the union of the two boxes) can be greater than the specified threshold;
[0089] False Positive (FP): An incorrect result, the IOU between the predicted box and the actual box is less than the threshold;
[0090] False Negative (FN): If there is a feature at a certain location (i.e. the crack mentioned in the patent), there should be a frame line, but if it is not predicted, then the actual frame is an FN for the model.
[0091] True Negative (TN): The actual box finds a predicted box with an IOU greater than the threshold, then the actual box is considered to be successfully detected.
[0092] In this embodiment, only one type is a positive sample, and the rest are all negative samples. The specific experimental results are shown in Table 1.
[0093] Table 1 Experimental results:
[0094]
[0095] Under the same data set division (training set, validation set, test set), it can be seen that the method of the present invention obtains the best mAP, which proves the effectiveness of the method.
[0096] The above implementation cases are only preferred embodiments of the present invention and are not intended to limit the present invention in any form. Although the present invention has been disclosed as above with preferred embodiments, they are not intended to limit the present invention. Therefore, any simple modification, equivalent changes and modifications made to the above embodiments according to the technical essence of the present invention without departing from the content of the technical solution of the present invention shall fall within the scope of protection of the technical solution of the present invention.
Claims
1. A tunnel crack recognition method based on dynamic dense stack feature pyramid, characterized in that: The following steps are involved: Step S1, performing data preprocessing: preprocessing the acquired crack images to obtain a training set, a test set, and a validation set; Step S2, constructing a multi-layer intra-block self-attention network backbone network and a residual branch network; Step S3, calculate self-attention, and use the residual idea to fuse the output of the self-attention network block in the multi-layer block; Step S4, extracting feature values by dynamically densely stacking feature pyramids; In step S2, the backbone network includes a self-attention module based on an offset slider, the residual branch network includes an LN layer and a residual, and the self-attention network block in each multi-layer block is composed of a self-attention module based on an offset slider, an LN layer and a residual connection; In step S2, the specific steps are: S2-1, constructing the first level: converting the residual feature dimensions after the division and data amplification in step S1 into S, and sending them to the self-attention module of the self-attention network block in the multi-layer block; S2-2, constructing the 2nd to 4th levels: for each level, after a residual merging, the input is merged according to the adjacent residuals of 2x2, the number of residual blocks is H / 8xW / 8, the feature dimension is reduced to 4S, and then sent to the multi-level W-MSA; In step S3, the residual is classified, and self-attention is calculated in each window in each feature layer; in the next feature layer, the window partition is moved to generate a new window; the self-attention calculation in the new window spans the boundaries of the previous windows in the layer to provide a connection between them, and the calculation formula is as follows: ; Among them, R stands for Refer, which is the query vector; H stands for Hinge, which is the key vector; V stands for Value, which is the value vector; is the scaling factor; The output of the residual block is added to the output of the self-attention network in the multi-layer block, and the feature map output is obtained again through the activation function; a deep network is constructed by stacking multiple residual blocks, and the output of each residual block is used as the input of the next residual block, stacked layer by layer; The step S4 specifically includes the following contents: S4-1, the backbone network constructed in step S2 is a multi-path backbone network with feature maps, in which each path is interwoven with other paths through lateral connections to form a parallel dynamic dense stack feature pyramid grid; S4-2, the feature hierarchy in the backbone network is reduced in dimensionality, that is, the number of channels is reduced by 1×1 convolution, and multiple dynamic dense stack pyramid paths are generated, each of which contains multiple feature layers; S4-3, sampling features are fused to output the final feature map.
2. The tunnel crack identification method based on dynamic dense stacking feature pyramid according to claim 1 is characterized in that: The step S1 specifically includes the following steps: S1-1, perform preliminary screening: select original photos containing tunnel crack targets that meet the requirements according to the needs to form a data set; S1-2, labeling: labeling the data set to obtain a labeled data set; S1-3, classify the data set: divide the labeled data set into an initial training set, an initial validation set, and an initial test set; S1-4, perform data augmentation on the initial training set, the initial validation set and the initial test set to obtain the training set, the validation set and the test set respectively to form residual features; the data augmentation includes rotation of 90°, rotation of 180°, rotation of 270°, horizontal flipping, vertical flipping, color jittering and Gaussian noise.
