Underwater pile foundation crack accurate identification method based on CBRT-DETR
By combining the CBRT-DETR model with CNN and Transformer architecture, the accuracy and real-time performance issues of underwater pile foundation crack detection in complex environments were solved, achieving efficient and automated crack identification and improving identification accuracy and robustness.
Patent Information
- Application Number
- CN202510767468.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-10
- Publication Date
- 2025-11-07
AI Technical Summary
Existing underwater pile foundation crack detection methods suffer from low accuracy and poor real-time performance in complex environments. Traditional methods are difficult to adapt to underwater image distortion, color distortion, and texture blurring, making crack identification difficult.
A deep learning model based on CBRT-DETR, combined with convolutional neural network (CNN) and Transformer architecture, is used for end-to-end training. The CBAM attention mechanism and multi-scale feature fusion are employed to accurately identify underwater pile foundation cracks.
It significantly improves the accuracy and robustness of underwater pile foundation crack identification, achieves automated and efficient detection, reduces human error, adapts to complex underwater environments, and improves computational efficiency and identification speed.
Smart Images

Figure CN120912934A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of crack detection, and particularly relates to an underwater pile foundation crack accurate identification method based on CBRT-DETR. BACKGROUND
[0002] The underwater pile foundation is an important component of underwater structures such as bridges and offshore platforms, and is long-term in the underwater environment, which is easily affected by water flow, corrosion and other external factors. Especially on the surface of the underwater pile foundation, the appearance of cracks can reduce the safety of the structure and even cause serious engineering accidents. Therefore, the accurate detection and identification of underwater pile foundation cracks are of great significance to ensure the safety of underwater structures. However, the image acquisition process is often disturbed by factors such as water quality, lighting, and viewing angle, resulting in low-quality images and difficulty in accurately identifying crack areas. Traditional underwater crack detection methods mostly rely on manual judgment or simple image processing algorithms, and cannot achieve efficient and accurate crack identification.
[0003] The prior art image preprocessing technology based on MSRCR, in order to solve the quality problem of underwater pile foundation crack image, adopts the least square method image enhancement (MSRCR) algorithm to preprocess the image. The MSRCR algorithm can effectively eliminate the scattering and color distortion in the underwater image through the adaptive adjustment of the image, so as to enhance the contrast and clarity of the image and improve the recognition degree of the crack area in the image. The algorithm first optimizes the brightness and contrast of the image by adjusting the color of the image, and then combines bilateral filtering and MSRCR algorithm to enhance the details of the image, and finally realizes the clarification processing of the underwater image, which lays a good foundation for the subsequent crack identification.
[0004] The existing underwater pile foundation crack identification method has many problems, especially in the case of image distortion, color distortion and crack area blur, accurate identification of cracks is difficult. Underwater images usually have strong scattering effect, and color distortion and texture blur seriously affect the recognition effect of cracks. Due to the complexity of water quality, traditional recognition methods based on edge detection or template matching cannot fully cope with the variability and complexity of underwater environment. Therefore, more advanced technical means are needed to improve the accuracy and efficiency of underwater pile foundation crack identification. SUMMARY
[0005] The present application solves the technical problems of low accuracy, poor real-time performance and difficulty in adapting to complex environments in the prior art underwater pile foundation crack detection method; the present application uses a CBRT-DETR model based on deep learning to realize accurate identification of underwater pile foundation cracks. The CBRT-DETR model combines traditional convolutional neural network CNN and Transformer architecture, and through end-to-end training, can accurately locate and classify the crack area in the image. Compared with the traditional Transformer, CBRT-DETR uses a low-complexity Transformer variant, introduces scale-intra feature interaction, CBAM attention mechanism, multi-scale feature fusion and efficient query point selection in the encoder, adopts an end-to-end training method, and avoids the post-processing steps (such as non-maximum suppression) commonly used in traditional target detection methods. Significantly improve the efficiency and accuracy of target detection. While ensuring real-time performance, it can handle complex target detection tasks and has great potential in industrial applications.
[0006] In order to achieve the above-mentioned application purposes, the technical scheme adopted by the present application is as follows: a CBRT-DETR-based underwater pile foundation crack accurate identification method, comprising the following steps:
[0007] S10, collect underwater pile foundation image data stage, workers collect some underwater pile foundation crack pictures in advance, and label each picture, which can be labeled with common underwater column foundation crack shape as classification standard, convenient for subsequent model training and testing;
[0008] S20, image preprocessing stage, according to the collected underwater pile foundation image data, adjust the original images of different sizes to the same size, then normalize the adjusted image data, standardize the pixel value, in order to speed up the training and convergence speed of the model and reduce the influence of large value range input on the model weight. Then the normalized image is data enhanced to increase data diversity and prevent overfitting, then the enhanced data is converted from NumPy array to tensor form supported by deep learning framework (PyTorch). Finally, the data is batch processed to prevent hardware damage caused by excessive calculation. After image preprocessing, the final output shape is (b,c,h,w) tensor, where b is the batch size, c is the channel number, h and w are the height (i.e. row number) and width (i.e. column number) of the image data respectively;
[0009] S30, the ResNet model is used for feature extraction stage of image, CBRT-DETR uses ResNet as backbone network, first, the image data is reduced dimension through initial convolution and pooling layer, then the features of image data are extracted through residual fast, and multi-scale features are output. Finally, the spatial resolution is gradually reduced through the down-sampling mechanism to reduce the calculation cost. Different stages of ResNet will finally output multiple feature maps;
[0010] S40, the efficient hybrid encoder is used for the encoding stage, first, the scale-in feature interaction is used to process the feature map of each scale independently, and the context information in the scale, i.e. the relationship between each position in the feature map, is extracted. Among them, CBAM attention mechanism is adopted, including two sequential sub-modules of channel attention module and spatial attention module. Secondly, through cross-scale feature fusion, different scale features, such as x s3 ,x s4 ,x s5 , are fused into a unified feature map, which is convenient for subsequent target detection task. This step integrates the information of small objects, medium objects and large objects of different scales through fusion, and integrates the global multi-scale semantics. Finally, the fused multi-scale features are output;
[0011] S50, the uncertainty minimum query selection stage is applied, the position confidence p(x) of the prediction box and the class confidence c(x) of the prediction box are used to define and calculate the query point uncertainty u(x), wherein the lower the uncertainty, the higher the quality of the query point. The query point selection process selects n query points with uncertainty from the feature map as the input of the decoder, these points are considered to be high quality, which can more accurately represent the target, improve the quality of the query point, improve the performance of the subsequent decoder, and improve the calculation efficiency;
[0012] S60, the decoder decoding stage is one of the core blocks of the whole model, the decoder is based on the architecture of Transformer, which is stacked by multiple decoding layers, each decoding layer includes self-attention mechanism, cross-attention mechanism and feedforward network. Through self-attention operation on each layer of query point, using cross-attention to extract information from feature map, updating the representation of query point through feedforward network, multi-layer stacking, gradually optimizing query point. The final output of the decoder is (b, n, d), wherein each query point represents a high-dimensional feature of the target, which contains the semantic information and position information of the target, as the input of the subsequent classification head and positioning head;
[0013] S70, a crack recognition stage, inputs the query point features optimized by the decoder as an inquiry, generates the final target detection result through two modules of a classification head and a positioning head, wherein the classification head converts the query point features optimized by the decoder into a category distribution to predict the target category corresponding to each query point; and the positioning head converts the query point features optimized by the decoder into a bounding box parameter to predict the position and size of the target. Finally, the category label, confidence score and bounding box position can be recognized.
[0014] Further, the underwater camera is ensured to stably shoot the target pile foundation area, images under different conditions are collected and labeled, the data are classified according to the crack types, and finally the data are divided into a training set, a verification set and a test set in proportion for model training and evaluation.
[0015] Further, image size adjustment, normalization, data enhancement and batch processing are included. First, the image size is uniformly adjusted, and the image is normalized through proportional scaling and random cropping; then, the pixel value is normalized to ensure that the input value is within a uniform range; then, data enhancement techniques (flipping, rotation, cropping, scaling) are applied to increase the diversity of data; finally, the image is converted to a PyTorch tensor format and loaded and trained in batches using DataLoader to improve the training efficiency and stability of the model.
[0016] Further, the initial convolution and pooling layer extracts basic features through dimension reduction, the residual block uses jump connection to solve the gradient disappearance and extract deep features; the multi-scale feature output captures image information of different scales at different stages; the down-sampling operation reduces the spatial resolution by increasing the stride to retain important feature information and reduce the calculation cost.
[0017] Further, the CBAM attention mechanism is used for intra-scale feature interaction. First, the channel and spatial attention are used to process the feature map respectively, focusing on local context information to reduce the calculation amount. Then, cross-scale feature fusion is performed, the feature maps of different scales are spliced or weighted averaged to generate a fused global semantic feature map, and important information between scales is retained.
[0018] Further, high-quality target regions are selected by calculating the uncertainty of the query points. For each query point, the L2 norm of the position confidence p(x) and the category confidence c(x) is calculated to obtain the uncertainty u(x). Then, the n query points with the smallest uncertainty are selected as input to reduce the calculation amount and improve the efficiency, helping the decoder to more accurately process the target.
[0019] Further, the input query point and the feature map are updated by a self-attention mechanism, and then interact with the feature map information through a cross-attention mechanism, and then a feedforward network is used for nonlinear transformation. The multi-layer decoder stack gradually optimizes the query point representation, and finally outputs the optimized query point containing the target semantic and position information as the input of subsequent classification and positioning.
[0020] Further, first, the classification head outputs the probability distribution of the category through a fully connected layer, and the positioning head outputs four parameters of the bounding box. Then, the predicted category is determined by the maximum class probability, and the bounding box position and confidence are output. Finally, a confidence threshold is set for post-processing, and the query points with low confidence are discarded.
[0021] Compared with the prior art, the present application has the following beneficial effects:
[0022] (1) The underwater pile crack precise identification method based on CBRT-DETR provided by the present application can improve the accuracy and robustness of underwater pile crack identification. The present application adopts a deep learning method based on the CBRT-DETR model, which combines self-attention mechanism and multi-scale feature fusion, can effectively extract crack feature information from underwater images, and solves the problems of underwater image blur and color distortion in traditional methods, thereby significantly improving the crack identification accuracy. Compared with traditional image processing methods, the CBRT-DETR model can more accurately identify the crack area in complex underwater environments.
[0023] (2) The underwater pile crack precise identification method based on CBRT-DETR provided by the present application, the model of the present application is based on an end-to-end CBRT-DETR deep learning framework, which can automatically detect, locate and classify underwater pile cracks without human intervention or complex manual feature engineering. This not only greatly improves the detection efficiency, but also reduces human error, ensuring the stability and consistency of the detection results. Compared with existing traditional methods, the automatic processing flow of the present application can realize more efficient and reliable crack identification.
[0024] (3) The application provides a CBRT-DETR-based underwater pile foundation crack accurate identification method, which adopts a CBRT-DETR model and an efficient self-attention mechanism, optimizes the calculation efficiency while ensuring the identification accuracy, and can complete the detection and classification of underwater pile foundation cracks in a shorter time compared with traditional crack identification methods. In particular, in a complex underwater environment, the model can efficiently process large-scale image data, reduce the consumption of computing resources, improve the overall processing speed, and adapt to the demand for real-time detection. Compared with the traditional Transformer, the CBRT-DETR uses a low-complexity Transformer variant, introduces scale-in feature interaction, CBAM attention mechanism, multi-scale feature fusion and efficient query point selection in the encoder, and adopts an end-to-end training method to avoid the post-processing steps commonly used in traditional target detection methods. BRIEF DESCRIPTION OF DRAWINGS
[0025] The accompanying drawings are included to provide a further understanding of the application, and constitute a part of the specification, illustrate the application, and are used to explain the application together with the embodiments of the application, and do not constitute a limitation on the application.
[0026] Figure 1 A flowchart of the CBRT-DETR-based underwater pile foundation crack accurate identification method provided by the application.
[0027] Figures 2-7 A CBRT-DETR working system structure diagram. DETAILED DESCRIPTION
[0028] The technical solutions of the application will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the application, rather than all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of the application.
[0029] Embodiment 1
[0030] A CBRT-DETR-based underwater pile foundation crack accurate identification method comprises the following steps:
[0031] S10, a stage of collecting underwater pile foundation image data, workers collect some pictures of underwater pile foundation cracks in advance, and label each picture, which can be labeled with the shape of common underwater column foundation cracks as the classification standard, so as to facilitate subsequent model training and testing;
[0032] S20, image preprocessing stage, according to the collected underwater pile image data, the original images of different sizes are adjusted to the same size, then the adjusted image data is normalized, the pixel value is standardized, so as to speed up the training and convergence speed of the model and reduce the influence of large numerical range input on the model weight. Then the normalized image is data enhanced to increase data diversity and prevent overfitting, then the enhanced data is converted from NumPy array to tensor form supported by deep learning framework (PyTorch). Finally, the data is batch processed to prevent hardware damage caused by excessive calculation. After image preprocessing, the final output is a tensor with shape (b,c,h,w), where b is the batch size, c is the number of channels, h and w are the height (i.e. the number of rows) and width (i.e. the number of columns) of the image data, respectively;
[0033] S30, feature extraction stage using ResNet model, CBRT-DETR uses ResNet as the backbone network, first reduces the dimension of image data through initial convolution and pooling layer, then extracts the features of image data through residual fast, outputs multi-scale features. Finally, through the down-sampling mechanism, the spatial resolution is gradually reduced to reduce the calculation cost. Different stages of ResNet will finally output multiple feature maps;
[0034] S40, encoding stage using efficient hybrid encoder, first, scale-in feature interaction is used to process each scale feature map independently, to extract its scale-in context information, i.e. the relationship between each position in the feature map. CBAM attention mechanism is used, which contains two sequential sub-modules, channel attention module and spatial attention module. Secondly, through cross-scale feature fusion, different scale features, such as x s3 ,x s4 ,x s5 , are fused into a unified feature map to facilitate subsequent target detection tasks. This step integrates the information of small, medium and large objects in different scales through fusion, which can integrate global multi-scale semantics. Finally, the fused multi-scale features are output;
[0035] S50, uncertainty minimum query selection stage, by predicting the position confidence p(x) of the bounding box and the class confidence c(x) of the bounding box, the query point uncertainty u(x) is defined and calculated, where the lower the uncertainty, the higher the quality of the query point. The query point selection process selects n query points with uncertainty from the feature map as the input of the decoder, which are considered to be high-quality and can more accurately represent the target, improve the quality of the query point, improve the performance of the subsequent decoder, and improve the computing efficiency;
[0036] S60, the decoder decoding stage, is one of the core blocks of the entire model. The decoder is based on the Transformer architecture, which is stacked by multiple decoding layers. Each decoding layer includes a self-attention mechanism, a cross-attention mechanism, and a feed-forward network. Through self-attention operation on each layer's query point, extracting information from the feature map using cross-attention, and updating the query point's representation through the feed-forward network, the query point is gradually optimized through multi-layer stacking. The final output of the decoder is a query point with a shape of (b, n, d), where each query point represents a high-dimensional feature of a target. These features contain semantic information and location information of the target, serving as input for the subsequent classification head and positioning head;
[0037] S70, the crack recognition stage, takes the query point features optimized by the decoder as input and generates the final target detection results through the classification head and the positioning head. The classification head converts the query point features optimized by the decoder into a class distribution, predicting the target class corresponding to each query point. The positioning head converts the query point features optimized by the decoder into a bounding box parameter, predicting the location and size of the target. Finally, the class label, confidence score, and bounding box position can be identified.
[0038] Further, the step S10 comprises:
[0039] S101, before collection, ensure that the underwater camera or robot can stably align the target pile foundation area. The shooting angle and aperture of the camera can be adjusted through remote control equipment to ensure the stability of the image during shooting. Underwater pile foundation images are taken from different angles, distances, and lighting conditions to ensure that various forms of cracks (such as straight cracks, curved cracks, deep and shallow cracks, etc.) are covered. After each shooting is completed, ensure the integrity of the image data. The collected image files should be named by time or location and saved to a special image database;
[0040] S102, according to common underwater pile foundation crack types and forms (such as straight cracks, curved cracks, deep cracks, etc.), develop classification standards. Different labels are divided according to the shape, size, and depth of the cracks. By manually observing each collected image, determine its crack type, and label each image according to the classification standard. The position of the crack area can be labeled using a labeling tool to generate a corresponding label file. The label file contains the crack position (such as bounding box coordinates) and crack category (such as type 1: straight crack, type 2: curved crack, etc.) of the image;
[0041] S103, in the entire data set, divide the data into training set, validation set, and test set according to a certain proportion (such as 70% training set, 15% validation set, and 15% test set) to ensure that the model can be trained, validated, and evaluated on different data.
[0042] Further, step S20 shown includes:
[0043] S201. Image resizing: Standardize the size of each image for subsequent model processing. Assume the shape of each image is , where b... i c is the batch size. i h is the number of channels. i and w i These represent the number of rows and columns of the image, respectively. Assume the adjusted image is (b... i ',c i ',h i ',w i First, scale the scale proportionally, assuming the scaling factor is r, where...
[0044] r = min(h) i ' / h i ,w i ' / w i (1)
[0045] The adjusted height and width are then h. i '=h i r, w i '=w i After image scaling, it needs to be precisely adjusted using a random cropping formula. The cropped image is image[top:bottom,left:right], where top∈[0,h]. i -h i '],left∈[0,w i -w i '],bottom=top+h i ',right=left+w i ';
[0046] S202, Normalization operation, scales the pixel values of an image to a uniform range (usually 0 to 1 or -1 to 1) to accelerate model training and improve stability. Assume x original It is the original pixel value, x normalized Normalized pixel values, usually x original ∈[0,255],x normalized =x original / 255, each pixel value is converted according to the above formula. Where x i =(b i ,c i ,h i ,w i Normalization and standardization can accelerate model training and convergence, while reducing the impact of inputs with large numerical ranges on model weights;
[0047] S203, data augmentation, let x be the original image, through x flipped = flip(x) randomly flip the image; through x rotated = rotated(x, θ) randomly rotate the image, θ is a randomly selected rotation angle. Through x cropped = crop(x, region) randomly crop the image, through x scaled = scale(x, s) randomly scale, where s is the scaling factor. Aims to increase the diversity of data by applying a variety of random transformations to the training data, thereby improving the robustness of the model and preventing overfitting;
[0048] S204, the image data output above is converted from NumPy array or PIL image to PyTorch tensor format using transforms.ToTensor(). Batch processing first, all image data and corresponding labels are packaged into TensorDataset. Using DataLoader to create batch loader, specify batch size (such as 32 or 64) and whether to shuffle data (shuffle = True). Each time data and labels are extracted from DataLoader. Only one batch of data is used each time. This method can effectively reduce the amount of calculation, avoid memory overflow caused by loading the entire data set at once, and speed up the training process.
[0049] Further, the step S30 shown comprises:
[0050] S301, initial convolution and pooling layer, assuming that the input image data is x cp = (b i , c i , h i , w i ), the output image is x cp' = (b i ', c i ', h i ', w i '). After initial convolution and pooling operation, x output = Pool(Conv(x input )), through the initial convolution layer and the pooling layer, the dimensionality reduction of the image is carried out, and the spatial resolution of the input image is reduced to a smaller size, while the feature information of the image is maintained;
[0051] S302, residual block feature extraction, assuming that the tensor input to a certain residual block is x re = (b i , c i , h iw i ), output x re' = (b i ', c i ', h i ', w i '), then the operation of each residual block adds the input and output through a skip connection:
[0052] x re' = Conv2D(ReLU(Conv2D(x re ))) + x re (2)
[0053] where Conv2D is a convolution operation and ReLU is an activation function. Deep features of the image are extracted through the residual block, and the skip connection in the residual block helps to solve the gradient vanishing problem in the deep network and improve the training effect of the model;
[0054] S303, multi-scale feature output, assuming that the different stages of ResNet output feature maps x1, x2, x3, x4, respectively, where x1 = (b, c1, h1, w1), x2 = (b, c2, h2, w2), x3 = (b, c3, h3, w3), x4 = (b, c4, h4, w4), the feature maps output by each stage have different spatial resolutions (h i ,w i ), but the same batch size b and different channel numbers c i . Then x multi_scale = {x1, x2, x3, x4}, where x multi_scale is a set of feature maps of multiple scales. Multiple scale feature maps are output through different stages of ResNet, which helps to capture crack information of different scales in subsequent target detection tasks;
[0055] S304, downsampling mechanism, the downsampling operation reduces the spatial resolution of the image by increasing the stride, assuming that the size of the input feature map is x in = (b i ,c i ,h i ,w i ), and the output is xdown = (b i ,c i ',h i ',w i '), then h i ' and w i ' are smaller than h i and w i . The formula
[0056] xdown = MaxPool(x in ) (3)
[0057] Implementation. By the down-sampling mechanism, the spatial resolution is gradually reduced to reduce the computational cost while keeping important feature information. Finally, three multi-scale feature maps of different stages are output: x s3 , x s4 , x s5 .
[0058] Further, the step S40 shown comprises:
[0059] S401, intra-scale feature interaction, in each scale, CBAM attention mechanism is used to model the feature map. First, the channel attention is calculated:
[0060] x ci = Sotfmax(MLP(AvgPool(x i ))+MLP(MaxPool(x i ))) (4)
[0062] where x i is the feature map of the initial input, MaxPool and AvgPool are the maximum and average pooling layer calculations respectively, MLP is the fully connected layer, and x ci is the feature map after channel attention processing. Then the spatial attention is calculated:
[0063] x si '= Sotfmax(Conv 7 (AvgPool(x ci )) ; MaxPool(x ci )) (5)
[0065] where x si is the feature map after spatial and channel attention calculation, and then the local region within the feature map is focused, i.e. intra-scale feature interaction is performed on x s3 , x s4 , x s5 , instead of the global information of the entire image, thereby effectively reducing the computational amount. Assuming that the input multi-scale feature maps are x s3 , x s4 , x s5 , the shapes of these feature maps are (b, c, h, w) respectively, where b is the batch size, c is the number of channels, and h and w are the row and column numbers of the image respectively. After the CBAM attention mechanism, the output feature maps of each scale are x s3 ', xs4 '、x s5 This mechanism processes feature maps at each scale to capture local contextual information. Its shape remains unchanged, but it retains local contextual information.
[0066] S402, Cross-scale Feature Fusion: This method combines feature maps from multiple scales, preserving important information across scales to generate a multi-scale global semantic feature map. The input is x, obtained from feature interactions within the same scale. s3 '、x s4 '、x s5 The fusion operation involves concatenating or weighting feature maps of different scales along the channel dimension (c-dimensional) to obtain the final fused feature map.
[0067] x fusion =Fuse(x s3 ',x s4 ',x s5 ') (6)
[0068] Here, Fuse represents the fusion operation, which can typically be achieved through methods such as concatenation or weighted summation. The output fused feature map is x. fusion Its shape is (b, c) fusion ,h,w), where c fusion It is the number of channels after splicing, which is c3+c4+c5, that is, the sum of the number of channels of feature maps at different scales.
[0069] Further, step S50 shown includes:
[0070] S501. Define query point uncertainty. For each query point x, the uncertainty u(x) is given by the formula: u(x) = ||p(x) - c(x)||, which means calculating the L2 norm of p(x) and c(x). Here, p(x) is the location confidence of the query point, representing the model's confidence in that location. For each query point, the network predicts a relative location confidence value, typically output by the Sigmoid function, with a value in the range [0,1], indicating the confidence that the location is the target. c(x) is the category confidence of the query point, representing the model's confidence in that category. The category confidence is also output by the Softmax function to ensure that the output is a probability distribution (i.e., the sum of the probabilities of all categories is 1).
[0071] S502. Query Point Selection: Select the n query points with the lowest uncertainty. These query points have low uncertainty and represent higher-quality target areas. After calculating the uncertainty u(x) for all query points, select the n query points with the lowest uncertainty as input.
[0072] x selected= SelectTopN(u(x), n) (7)
[0073] where SelectTopN is to select n query points with the smallest uncertainty. By selecting query points with higher quality, irrelevant areas in the image are avoided from being calculated, thus reducing the amount of calculation and improving overall efficiency. The selected query points are input into the decoder, helping the decoder to more accurately process the target.
[0074] Further, the illustrated step S60 includes:
[0075] S601, input preparation, prepare the query points and feature maps as inputs to the decoder. The shape of the query point q is (b, n, d), and the shape of the input f feature map is (b, c, h, w);
[0076] S602, self-attention mechanism, use the self-attention mechanism to process the query points q. The self-attention mechanism calculates the relationship between the query points and updates the representation of each query point: q new = SelfAttention(q). The core of self-attention is to calculate the relationship between each query point and other query points and generate a new query point representation;
[0077] S603, cross-attention mechanism, the cross-attention mechanism calculates the relationship between the query points and each position in the feature map, and updates the representation of the query points through attention weights. Through the cross-attention mechanism, the query points q new and the feature map f are used to interact information:
[0078] q updated = CrossAttention(q new ,f) (8)
[0079] S604, feedforward network, usually composed of two fully connected layers and an activation function. The updated query point representation q updated is nonlinearly transformed using the feedforward network to further improve the feature representation capability of the query points:
[0080] q final = FeedForward(q updated ) (9)
[0081] The representation of each query point is further processed by the feedforward network to update the features of the query points;
[0082] S605, multi-layer stack, the decoder is stacked by multiple decoding layers, each layer performs self-attention, cross-attention and feedforward network operations. The output of each layer is used as the input of the next layer, and the representation of the query point is gradually optimized. The multi-layer decoding layer is stacked to finally generate the optimized query point representation. The query point representation after multi-layer stacking is q final ;
[0083] S606, output query point, the output query point of the decoder has a shape of (b, n, d), where b is the batch size, n is the number of query points, and d is the high-dimensional feature dimension of the query point. The final query point representation is output, which contains the semantic information and position information of the target, and is used as the input of the subsequent classification head and positioning head.
[0084] Further, the illustrated step S70 includes:
[0085] S701, input preparation, the optimized query point features of the decoder are used as input, which already contains the high-dimensional representation of the target, and integrates the semantic information and position information of the target. The query point q final has a shape of (b, n, d);
[0086] S702, classification head, the classification head converts the input query point feature q final into a probability distribution of categories through a fully connected layer. For each query point, the classification head outputs a k-dimensional vector, where k is the number of categories. Each dimension corresponds to the probability of a category
[0087] z = Softmax (w c · q final + b c ) (10)
[0088] where w c and b c are the weights and biases of the classification head, and z is the category distribution, which has a shape of (b, n, k), where k is the number of categories. Then for each query point, the category with the maximum probability y' = argmax(z i ) is selected as the predicted target category;
[0089] S703, positioning head, the input query point feature q final is converted into the parameters of the bounding box through a fully connected layer (usually outputting 4 values, representing the four parameters of the bounding box), usually represented as [x center , y center , w, h], where: x center , y center are the coordinates of the center of the bounding box, and w, h are the width and height of the bounding box. The positioning head performs linear transformation on the input query point feature, and outputs the four parameters of the bounding box: e = wb q final b b wherein: w b and b b are the weights and bias of the localization head, e is the bounding box parameter, shape is (b, n, 4), i.e. the bounding box coordinates of each query point;
[0090] S704, output the detection result, for each query point, output its corresponding class label, class confidence and bounding box coordinates. The class label is the class with the maximum class confidence. The confidence score is the maximum value in the class confidence, and the corresponding class is the predicted class of the query point. The bounding box position is obtained by the localization head 4 parameters, which represent the position and size of the target. The final detection result includes: predicted class: y' = argmax(z i ), bounding box position: e = [x center , y center , w, h], confidence score: p' = max(z i ).
[0091] S705, threshold filtering in post-processing, set a confidence threshold T, for each query point, if its confidence score is lower than the threshold, it is considered that the query point does not contain the target, and the query point is discarded. For each query point i, if p i > T, the query point is retained, otherwise discarded.
[0092] The above content character definitions are as follows Table 1:
[0093] Table 1: symbol meaning table
[0094]
[0095]
[0096]
[0097] Obviously, the above embodiments are only examples for the purpose of clarity, and are not limiting of the embodiments. Based on the above description, other different forms of changes or variations can be made by those of ordinary skill in the art. Here, it is not necessary and impossible to exhaust all embodiments. The obvious changes or variations derived therefrom are still within the protection scope of the present application.
Claims
1. A CBRT-DETR-based underwater pile foundation crack accurate identification method, characterized in that, The method comprises the following steps: S10, an underwater pile image data collection stage, workers collect some underwater pile crack pictures in advance, and label each picture, which can be labeled with common underwater column base crack shape as a classification standard, to facilitate subsequent model training and testing; S20, an image preprocessing stage, according to the collected underwater pile image data, the original images of different sizes are adjusted to the same size, then the adjusted image data is normalized, the pixel value is standardized, then the normalized image is data enhanced, then the enhanced data is converted from a NumPy array to a tensor form supported by a deep learning framework; finally, the data is batch processed to prevent hardware damage caused by excessive calculation; after image preprocessing, the final output is a tensor with a shape of (b, c, h, w), where b is the batch size, c is the number of channels, h and w are the height and width of the image data, respectively; S30, a feature extraction stage using a ResNet model, CBRT-DETR uses ResNet as the backbone network, which first reduces the dimension of the image data through an initial convolution and a pooling layer, then extracts the features of the image data through a residual fast, and outputs multi-scale features; Finally, the spatial resolution is gradually reduced through a downsampling mechanism to reduce the calculation cost; ResNet will finally output multiple feature maps at different stages; S40, the encoding stage is carried out by using a high-efficiency mixed encoder, first, the feature maps of each scale are independently processed by using scale-in feature interaction, and the context information of the scale, i.e. the relationship between positions in the feature map, is extracted; wherein a CBAM attention mechanism is used, containing two sequential sub-modules of a channel attention module and a spatial attention module; secondly, through cross-scale feature fusion, the features x s3 , s4 , s5 of different scales are fused into a unified feature map, facilitating subsequent target detection tasks; this step integrates the information of small objects, medium objects and large objects of different scales through fusion, and integrates the global multi-scale semantics; finally, the fused multi-scale features are output. S50, an uncertainty minimum query selection stage, by predicting the position confidence p(x) of the bounding box and the class confidence c(x) of the bounding box, the query point uncertainty u(x) is defined and calculated, where the lower the uncertainty, the higher the quality of the query point; The query point selection process selects n query points with uncertainty from the feature map as the input of the decoder, which are considered to be high-quality and can more accurately represent the target, improve the quality of the query point, improve the performance of the subsequent decoder, and improve the calculation efficiency; S60, a decoder decoding stage, the decoder is based on the architecture of Transformer, which is stacked by multiple decoding layers, each decoding layer includes self-attention mechanism, cross-attention mechanism and feedforward network; through self-attention operation on each layer of query points, cross-attention is used to extract information from the feature map, and the representation of the query point is updated through the feedforward network, which is stacked by multiple layers to optimize the query point step by step; The final output of the decoder is a query point with a shape of (b, n, d), where each query point represents a high-dimensional feature of a target, which contains semantic information and position information of the target, serving as the input of the subsequent classification head and positioning head; S70, a crack recognition stage, the input is the query point feature optimized by the decoder, and the final target detection result is generated through the two modules of the classification head and the positioning head, wherein the classification head converts the query point feature optimized by the decoder into a class distribution to predict the target class corresponding to each query point; The positioning head converts the query point feature optimized by the decoder into a bounding box parameter to predict the position and size of the target; finally, the class label, confidence score and bounding box position are recognized.
2. The CBRT-DETR-based underwater pile foundation crack accurate identification method according to claim 1, characterized in that: In step S10, images are collected by underwater cameras to ensure stable shooting of the target pile foundation area, collect images under different conditions and label them, classify them according to crack types, and finally divide the data into training set, validation set and test set in proportion for model training and evaluation.
3. The CBRT-DETR-based underwater pile foundation crack accurate identification method according to claim 1, characterized in that: Image processing includes image size adjustment, normalization, data enhancement and batch processing; first, uniformly adjust the image size, normalize the image through equal scaling and random cropping; then, normalize the pixel values to ensure that the input values are within a uniform range; next, apply data enhancement techniques to increase data diversity; finally, convert the images to PyTorch tensor format and use DataLoader for batch loading and training.
4. The CBRT-DETR-based underwater pile foundation crack accurate identification method according to claim 1, characterized in that: In step S30, the initial convolution and pooling layer extracts basic features by reducing dimension, and the residual block uses jump connection to solve gradient vanishing and extract deep features; Multi-scale feature output captures image information at different scales at different stages; down-sampling operation reduces spatial resolution by increasing stride to retain important feature information and reduce computational cost.
5. The CBRT-DETR-based underwater pile foundation crack accurate identification method according to claim 1, characterized in that: In step S40, CBAM attention mechanism is used for intra-scale feature interaction; first, process the feature map through channel and spatial attention respectively to focus on local context information and reduce computational complexity; then, perform cross-scale feature fusion by concatenating or weighted averaging feature maps of different scales to generate a fused global semantic feature map that retains important information between scales.
6. The CBRT-DETR-based underwater pile foundation crack accurate identification method according to claim 1, characterized in that: In step S50, high-quality target regions are selected by calculating the uncertainty of query points; for each query point, calculate the L2 norm of position confidence p(x) and class confidence c(x) to get uncertainty u(x); then select the n query points with the smallest uncertainty as input to reduce computational complexity and improve efficiency, helping the decoder to more accurately process the target.
7. The CBRT-DETR-based underwater pile foundation crack accurate identification method according to claim 1, characterized in that: In step S60, input the query points and feature maps, update the query point representation through self-attention mechanism, then interact with the feature map information through cross-attention mechanism, and finally use a feedforward network for nonlinear transformation; The multi-layer decoder stack gradually optimizes the query point representation, and finally outputs the optimized query points containing target semantics and position information as input for subsequent classification and positioning.
8. The CBRT-DETR-based underwater pile foundation crack accurate identification method according to claim 1, characterized in that: The classification head outputs the probability distribution of the category through the full connection layer; the positioning head outputs four parameters of the boundary box; then, the predicted category is determined by the maximum category probability, and the boundary box position and confidence are output; finally, the confidence threshold is set for post-processing, and the query points with low confidence are discarded.