Method and device for automatically segmenting and quantifying fatigue crack in structural strength test
By constructing the CrackDAM-Net network, combining local and global feature encoders and a hybrid attention mechanism, the balance problem between accuracy and speed in existing fatigue crack detection is solved, and efficient and accurate detection of crack segmentation and quantification is achieved.
Patent Information
- Application Number
- CN202510825859.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-09-30
AI Technical Summary
Existing fatigue crack detection methods have difficulty achieving an effective balance between accuracy and speed, and lack accurate quantification of crack length. In particular, the segmentation network suffers from severe loss of crack edge information in complex backgrounds, resulting in high computational complexity and difficulty meeting real-time detection requirements.
A fatigue crack segmentation and quantification network CrackDAM-Net is constructed, which adopts a parallel structure of local feature encoder and global information encoder, combines frequency domain enhancement with Mamba linear attention mechanism, integrates spatial, channel and pixel attention mechanisms, and performs crack segmentation and length quantization through multi-scale feature fusion and decoder.
It significantly improves the accuracy of crack segmentation and length measurement, reduces computational complexity, achieves a balance between real-time and precision crack detection, and meets the needs of industrial applications.
Smart Images

Figure CN120726341A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for detecting structural strength fatigue cracks, in particular to a method and device for automatically segmenting and quantifying fatigue cracks in a structural strength test. Background Art
[0002] Fatigue cracks are one of the main causes of structural failure in engineering structures. Fatigue crack detection and assessment are crucial for infrastructure safety and equipment life extension. Currently, fatigue crack detection relies primarily on manual inspection and traditional non-destructive testing techniques (such as magnetic particle and ultrasonic testing). However, manual inspection is inefficient and highly subjective, while traditional non-destructive testing (NDT) suffers from insufficient anti-interference capabilities and high costs under complex working conditions.
[0003] In structural strength testing, existing fatigue crack detection algorithms typically employ deep learning-based designs. In recent years, deep learning methods, such as CNNs and Transformers, have achieved breakthroughs in automatic feature extraction, multi-scale perception, and complex scene adaptation, providing new approaches for crack detection. Compared to traditional methods, deep learning offers advantages in texture feature extraction, illumination robustness, and the identification of subtle defects.
[0004] The general process of a deep learning-based design solution is to first construct a dedicated fatigue crack dataset containing typical fatigue crack characteristics, annotate the crack areas, and then divide the dataset according to a preset ratio. Secondly, a targeted crack detection network architecture is designed based on the morphological characteristics and distribution patterns of cracks on the test piece surface. Finally, automatic crack detection is achieved through end-to-end training. However, in actual applications, due to the dual requirements of structural strength testing for detection accuracy and real-time performance, traditional detection networks have difficulty achieving an effective balance between accuracy and speed. In addition, current mainstream algorithms can only achieve rough positioning of crack areas and lack accurate automatic quantification of crack extension length, making it difficult to meet the actual application needs of fatigue crack detection.
[0005] The Chinese invention patent "Metal Fatigue Crack Detection Method Based on Image Processing and Crack Recognition Model" (CN202311288176.7) proposes a metal fatigue crack detection method based on image processing and crack recognition models. This method first performs grayscale transformation on the collected crack image data, segments the crack grayscale image using a local adaptive threshold segmentation method, and performs a binarization operation to obtain a binary crack image. Morphological processing is then used to eliminate random noise in the binary crack image, and the crack contour is smoothed and expanded. Finally, a pre-trained convolutional neural network (VGG16) is used as a region candidate network to perform transfer learning on the basic Faster R-CNN model, obtaining an improved crack recognition model based on Faster R-CNN and achieving non-contact recognition of metal fatigue cracks. Although this method improves recognition accuracy and the generalization ability of the model, it lacks effective capture of global information, and the crack length measurement does not consider the influence of different crack morphologies. The Chinese invention patent "A method for detecting rolling contact fatigue cracks on the side of a metal specimen" (CN202410455556.3) proposes an improved method for detecting rolling contact fatigue cracks on the side of a metal specimen. This method addresses the shortcomings of the original YOLOX backbone network model in global feature extraction. Swin Transformer is used to replace CSPDarknet as the backbone feature extraction network, and a multi-head attention mechanism is used to extract more effective global features. At the same time, the CBAM attention mechanism is introduced into the enhanced feature extraction network to reduce complex background interference and enhance the model's ability to express crack features. Finally, the confidence loss function is replaced by Focal Loss to reduce the model's learning of the image background area and improve its learning ability for positive samples. Although this method takes global feature extraction into account, it is difficult to achieve the goal of real-time detection due to the large number of model parameters and high computational complexity.
[0006] The journal article "UTE-CrackNet: transformer-guided and edge feature extraction U-shaped road crack image segmentation" (The Visual Computer, Springer, 2024: 1-13) proposed a crack segmentation network UTE-CrackNet based on DeepLabv3+ and U-shaped structure in complex scenarios. The network enhances the perception of crack edges by introducing an edge detection module, uses dense multi-scale convolution and position attention mechanism to optimize feature expression, and uses residual attention and gating units to increase attention to important features, thereby improving the accuracy and robustness of crack segmentation. However, the number of parameters and computational complexity of the model are still high, which limits its practical application. The journal article "DCUFormer: Enhancing pavement crack segmentation in complex environments with dual-cross / upsampling attention" (Expert Systems with Applications, 2025, 264 (264): 1-14) proposed a crack segmentation network called DCUFormer. This network introduces a dual cross-attention module and an upsampling attention module based on the Swin Transformer. This effectively injects high-level information into low-level feature maps, enhancing the understanding of low-level feature maps. It also integrates low-level structural and detail information back into high-level information, thereby reconstructing details that may be lost or blurred due to the increase in neural network depth. However, this model still suffers from problems such as a large number of parameters and slow inference speed, making it difficult to meet the needs of practical applications.
[0007] In summary, crack detection methods based on image segmentation can accurately depict crack morphology, facilitate size and direction analysis, and have greater advantages in structural safety assessment. For complex backgrounds, the segmentation network can better distinguish cracks from noise through multi-scale feature extraction and attention mechanism, thereby improving the accuracy and completeness of detection. However, training deep segmentation models usually requires a large amount of pixel-level annotated data, which is tedious and time-consuming. The model itself has a large number of parameters and its inference speed is slower than that of target detection, which is not conducive to real-time application. In addition, the segmentation model is highly dependent on the training data scenario. If it is only trained with a single material surface crack, the generalization ability in other scenarios may be limited. Finally, the existing fatigue crack detection method is relatively simple in quantifying the crack length, without considering the actual crack morphology, and it is difficult to meet the needs of practical applications.
[0008] The existing technology mainly has the following three shortcomings:
[0009] (1) The cracks have a low pixel ratio and unclear edges, which can easily lead to information loss during feature extraction.
[0010] In fatigue crack detection, surface cracks on equipment typically exhibit slender, fuzzy edges and occupy a very low percentage of pixels in the image. While existing segmentation networks can capture high-level feature information through a multi-level feature extraction mechanism, this mechanism can lead to significant loss of critical information, such as crack edges, when processing tiny cracks, significantly reducing the model's segmentation accuracy. This issue severely restricts the model's practical application in industrial scenarios.
[0011] (2) Balancing performance and efficiency of existing models
[0012] Current mainstream crack image segmentation models suffer from a large number of parameters and high computational complexity. While this design can theoretically achieve high segmentation accuracy, in practice it leads to excessive hardware resource requirements and slow training speeds during training. More importantly, achieving an ideal balance between speed and accuracy during the model inference phase severely impacts the model's portability and practicality in industrial real-time inspection scenarios.
[0013] (3) Limited crack quantification accuracy
[0014] Due to the diverse morphologies of surface cracks across different materials, a unified standard for crack length quantification is currently lacking. Existing methods typically employ simple projection length measurements or path length calculations based on skeleton extraction. However, these methods have significant drawbacks: Firstly, the accuracy of crack segmentation directly impacts the skeleton extraction results; secondly, traditional skeleton extraction algorithms are prone to branching noise when processing irregular cracks, leading to biased skeleton line extraction. These issues are particularly pronounced in complex crack morphologies, severely reducing the reliability of the quantification results. Summary of the Invention
[0015] To address the above-mentioned defects in the prior art, the purpose of the present invention is to provide a method and device for automatic segmentation and quantification of fatigue cracks in structural strength tests. By constructing a fatigue crack segmentation and quantification network - CrackDAM-Net, the computational complexity of the model is reduced; the extracted features are combined with the original crack image features through the FDB module, realizing the effective fusion of fine-grained details and coarse-grained information, significantly improving the extraction effect of global crack information; and the integration of three attention mechanisms improves the accuracy of crack segmentation and the accuracy of crack length measurement.
[0016] The present invention is achieved through the following technical solutions.
[0017] One aspect of the present invention provides a method for automatically segmenting and quantifying fatigue cracks in a structural strength test, comprising:
[0018] Acquire material fatigue crack images and construct material fatigue crack image dataset;
[0019] Based on the material fatigue crack image dataset, a fatigue crack segmentation and quantification network CrackDAM-Net is constructed;
[0020] It includes constructing a local feature encoder and a global information encoder to extract local detail features and global context information of fatigue cracks respectively;
[0021] Construct a multi-scale feature fusion module that includes hybrid spatial attention, channel attention, and pixel attention mechanisms, and input local features and global features into the multi-scale feature fusion module for feature fusion;
[0022] Construct a decoder and upsample the fused features through the decoder to obtain a fatigue crack segmentation map;
[0023] Construct a crack length automatic quantification module to automatically quantify the crack length and obtain the quantified value of the fatigue crack length;
[0024] Training fatigue crack automatic segmentation and quantification network;
[0025] The crack image to be detected is input into the fatigue crack segmentation and quantification network CrackDAM-Net to perform crack segmentation and length quantification to obtain the fatigue crack length.
[0026] As a preference, a material fatigue crack image dataset is constructed, and the dataset is divided into a training set, a validation set, and a test set in proportion. Stratified sampling is used to ensure that various crack features are evenly distributed in each subset.
[0027] Preferably, a local feature encoder is constructed, comprising:
[0028] The local feature encoder uses the ResNet-50 network as the basic architecture, separating the initialization layer, the maximum pooling layer and four convolutional layers from the original structure.
[0029] As a preference, a global information encoder is constructed, which consists of four hierarchical structures:
[0030] The first and second layers are hybrid frequency domain-attention layers, each layer contains a frequency domain module FDB and two MILB linear attention modules;
[0031] The third and fourth layers are designed as full attention layers, each consisting of three MILB linear attention modules;
[0032] The MILB linear attention module combines the Mamba-inspired linear attention mechanism MILA, feedforward neural network FFN, layer normalization, and residual connection.
[0033] Preferably, a multi-scale feature fusion module is constructed, and local features and global features are input into the multi-scale feature fusion module for feature fusion; including:
[0034] The crack image features extracted by the local feature encoder branch and the corresponding global information encoder branch are input into the hybrid attention mechanism MSCP to calculate the attention weight of the features; and feature fusion is achieved using a weighted summation method.
[0035] The multi-scale feature fusion module introduces a skip connection structure and projects the fused features through a 1×1 convolutional layer to generate the final feature representation.
[0036] As a preferred option, the hybrid attention mechanism MSCP has the following processing flow:
[0037] According to the input crack image features, spatial attention features and channel attention features are calculated respectively;
[0038] Additively fuse the spatial attention features and channel attention features to form a preliminary coarse feature representation;
[0039] The coarse features are feature-concatenated with the input features, and the pixel attention mechanism is used to obtain the final hybrid attention weights.
[0040] Preferably, a decoder is constructed to perform upsampling processing on the fused features through the decoder, including:
[0041] The decoder consists of three decoder layers and a segmentation header;
[0042] The segmentation head uses sub-pixel convolution to enlarge the feature map to 4 times its original size, and uses 1×1 convolution to generate a segmentation mask. By performing threshold processing on each pixel in the mask, pixels above the set threshold are determined as crack areas, and the remaining pixels are determined as background areas, obtaining a clear crack binary segmentation map;
[0043] The decoder layer performs upsampling processing, including:
[0044] Use sub-pixel convolution to upsample the input features and retain more detailed information;
[0045] Concatenate the upsampled features with the fused features of the corresponding scale in the channel dimension;
[0046] Depthwise separable convolution (DSC) is used to reduce feature dimensions, and the MILB linear attention module is used to further aggregate features.
[0047] Preferably, a crack length automatic quantification module is constructed to automatically quantify the crack length, including:
[0048] Extracting the initial skeleton from the obtained crack binary segmentation map;
[0049] The discrete skeleton evolution algorithm is used to prune the extracted initial skeleton to obtain the main skeleton of the crack;
[0050] The extracted crack trunk skeleton is corrected using the skeleton correction method of orthogonal projection and non-maximum suppression;
[0051] The distance between the two endpoints of the extracted crack skeleton along the skeleton geodesic line is calculated using the quasi-Euclidean distance as the actual length of the crack.
[0052] Preferably, training a fatigue crack automatic segmentation and quantification network includes:
[0053] The constructed fatigue crack image dataset is used to configure the network model training environment, set the training parameters, and construct a composite loss function to train the constructed fatigue crack segmentation and quantification network - CrackDAM-Net.
[0054] In another aspect, the present invention provides an automatic segmentation and quantification device for fatigue cracks in a structural strength test according to the method, comprising:
[0055] An acquisition module is used to acquire material fatigue crack images and construct a material fatigue crack image dataset;
[0056] Local feature encoder module, used to extract local detail features of fatigue cracks;
[0057] A global information encoder module is used to extract global contextual information of fatigue cracks;
[0058] A multi-scale feature fusion module is used to input local features and global features into the multi-scale feature fusion module for feature fusion;
[0059] The decoder module is used to upsample the fused features through the decoder to obtain the fatigue crack segmentation map;
[0060] The automatic crack length quantification module is used to process the crack segmentation map to obtain the quantified value of the fatigue crack length;
[0061] Training module, used to train the fatigue crack automatic segmentation and quantification network.
[0062] The present invention adopts the above technical solution, which has the following beneficial effects:
[0063] 1. This paper combines the structural characteristics and advantages of CNN and Transformer to propose a fatigue crack segmentation and quantification network (CrackDAM-Net) based on frequency domain enhancement and the Mamba linear attention mechanism. This method employs the Mamba linear attention mechanism in the global information encoder, significantly reducing the model's computational complexity. Furthermore, the FDB module combines the extracted features with the original crack image features, effectively integrating fine-grained details with coarse-grained information, significantly improving the extraction of global crack information.
[0064] 2. Our method combines spatial attention, channel attention, and pixel attention to create a hybrid attention mechanism (MSCP). Compared to single-attention mechanisms, this hybrid mechanism provides richer feature representations across multiple dimensions, more accurately capturing crack details and thus effectively improving crack segmentation accuracy.
[0065] 3. The method described in this paper automatically quantifies fatigue crack length based on the binary crack image obtained after segmentation, combined with skeleton extraction and geometric feature analysis. To address the deviation between the skeleton line and the true crack morphology caused by segmentation errors, the skeleton line is corrected using an orthogonal projection method, significantly improving the accuracy of crack length measurement. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of this application, and do not constitute an improper limitation of the present invention. In the drawings:
[0067] Figure 1 Flowchart of the specific operation steps of the present invention;
[0068] Figure 2 This is the CrackDAM-Net network model structure diagram;
[0069] Figure 3 This is the structure diagram of the global information encoder;
[0070] Figure 4 This is a schematic diagram of the MILB module;
[0071] Figure 5 Schematic diagram of the multi-scale feature fusion module;
[0072] Figure 6 Schematic diagram of the hybrid attention mechanism MSCP;
[0073] Figure 7(a) is a schematic diagram of the decoder layer structure;
[0074] Figure 7(b) is a schematic diagram of the segmentation head;
[0075] Figure 8Flowchart for automatic crack length quantification;
[0076] Figure 9(a) is the binary segmentation image of a crack;
[0077] Figure 9(b) is the initial skeleton of a crack extracted from Figure 9(a);
[0078] Figure 9(c) is the main skeleton of a crack extracted from Figure 9(b);
[0079] Figure 10 Correction flow chart for crack trunk skeleton;
[0080] Figure 11 Schematic diagram of quasi-Euclidean distance;
[0081] Figure 12 The results of crack segmentation and length quantification;
[0082] Figure 13 Schematic diagram of the automatic segmentation and quantification device for fatigue cracks in the structural strength test of the present invention. DETAILED DESCRIPTION
[0083] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. The exemplary embodiments and descriptions of the present invention are used to explain the present invention but are not intended to limit the present invention.
[0084] The present invention provides a method for segmenting and quantifying fatigue cracks in structural strength tests, such as Figure 1 As shown, the following steps are included:
[0085] Step 1: Construct a fatigue crack dataset.
[0086] An industrial camera was used to capture high-definition images of fatigue cracks during structural strength testing under various real-world conditions. Images with similar crack characteristics were screened from public datasets to supplement the images, creating a highly complete fatigue crack image dataset with diverse crack types. The fatigue crack dataset contains 1,860 images, with a 1:1 ratio of self-collected images to images from the public dataset. To enhance the model's generalization capabilities, the dataset was partitioned into a training set, validation set, and test set with a ratio of 7:2:1, consisting of 1,302 images for training, 372 images for validation, and 186 images for testing. A stratified sampling strategy was used during the partitioning process to ensure a balanced distribution of crack characteristics across the subsets, thereby improving the model's recognition performance for different crack types.
[0087] Step 2: Construct the fatigue crack segmentation and quantification network CrackDAM-Net.
[0088] The fatigue crack segmentation and quantification network adopts a parallel dual-branch encoder structure, which has the ability to simultaneously extract local crack details and global context information.
[0089] First, the local feature encoder and the global information encoder are used to extract the local detail features and global context information of the crack respectively; then, the local features and global features are input into the multi-scale feature fusion module for fusion; then, the fused features are sent to the decoder, and the spatial resolution is restored by step-by-step upsampling to generate a high-precision crack segmentation map; finally, the crack length automatic quantization module is used to process the crack segmentation map and output the fatigue crack length quantization value. The overall structure of the CrackDAM-Net network model is as follows: Figure 2 shown.
[0090] The process of building the network model is as follows:
[0091] 21) Constructing a local feature encoder
[0092] The local feature encoder uses the ResNet-50 network as its basic architecture, separates the initialization layer, maximum pooling layer and four convolutional layers from the original structure, and improves its residual structure to enhance the network's ability to extract local features.
[0093] The residual connection formula of the traditional ResNet-50 network can be expressed as: H(X) = F(X) + X, where X is the initial input feature; F(X) is the data after feature extraction; H(X) is the residual output. In order to improve the network's ability to model local details of cracks, this paper introduces a learnable residual scaling factor weight x , transforming the originally fixed jump connection into a dynamically adjustable form, the improved residual structure H(X) formula is:
[0094] H(X)=F(X)+weight x ·X
[0095] Among them, X is the initial input; F(X) is the data after feature extraction; weight x ∈[0.5,1] is a learnable dynamic adjustment weight coefficient.
[0096] The improved ResNet-50 network, as a local feature encoder, has stronger crack detail feature extraction capabilities.
[0097] 22) Constructing a global information encoder
[0098] The global information encoder consists of four hierarchical structures, namely global information encoder layer 1, global information encoder layer 2, global information encoder layer 3 and global information encoder layer 4, which are used to extract the global context information of the crack image layer by layer.
[0099] The global information encoder processing flow is as follows:
[0100] (a) The input crack image is downsampled to obtain a feature map with a size of 1 / 4 the original crack image. The feature map is divided into multiple 4×4 image blocks and input to the global information encoder layer 1 to extract shallow global context features of the crack area.
[0101] (b) The image blocks output by the global information encoder layer 1 are merged to obtain a feature map with a size of 1 / 8 the original crack image. The feature map is further divided into multiple 4×4 image blocks and input into the global information encoder layer 2 to further extract deep global context features.
[0102] (c) The image blocks output by the global information encoder layer 2 are merged to obtain a feature map with a size of 1 / 16 of the original crack image. The feature map is further divided into multiple 4×4 image blocks and input into the global information encoder layer 3 to extract deeper global context features.
[0103] (d) The image blocks output by the global information encoder layer 3 are merged to obtain a feature map with a size of 1 / 32 of the original crack image. The map is further divided into multiple 4×4 image blocks and input into the global information encoder layer 4 to complete the deepest level of global context feature extraction.
[0104] During this process, the feature map size is reduced by 50% with each global information encoder layer, gradually forming a multi-scale feature hierarchy. Ultimately, the CrackDAM-Net segmentation network generates multi-scale feature representations with downsampling ratios of 4x, 8x, 16x, and 32x during the forward propagation process, supporting subsequent fine-grained segmentation and quantization tasks.
[0105] The global information encoder layer is as follows Figure 3 As shown in Figure 1, the first and second layers are designed as hybrid frequency domain-attention layers, each layer contains a frequency domain module FDB and two MILB modules; the third and fourth layers are designed as full attention layers, each layer consists of three MILB modules. The MILB module combines the Mamba-inspired linear attention mechanism (MILA), feedforward neural network (FFN), layer normalization and residual connection. The specific structure is shown in Figure 1. Figure 4 As shown in Figure 2, the designed global information encoder structure can not only effectively extract the global features of the crack image, but also significantly reduce the computational complexity of the network.
[0106] 23) Construct a multi-scale feature fusion module
[0107] The specific structure of the multi-scale feature fusion module is as follows Figure 5First, the crack image features extracted by the local feature encoder branch and the corresponding global information encoder branch are input into the hybrid attention mechanism MSCP to calculate the attention weights of the features; then, the weighted summation method is used to achieve feature fusion.
[0108] Hybrid attention mechanism MSCP Figure 6 As shown, the processing flow is as follows:
[0109] (a) Calculate the spatial attention feature X based on the input crack image feature X s and channel attention feature X c ;
[0110] (b) Add and fuse these two features to form a preliminary rough feature representation X sc , the process can be expressed as: X sc =X s +X c ;
[0111] (c) The rough feature X sc Perform feature connection with the input feature X, and then perform more refined calculations through the pixel attention mechanism to obtain the final hybrid attention weight W.
[0112] The multi-scale feature fusion module also introduces a skip connection structure to alleviate the gradient vanishing problem and simplify the network model training process. The fused features are projected through a 1×1 convolution layer to generate the final feature representation F fusion , the calculation formula is: F fusion =Conv 1×1 (F+F Local +F Global ), where F′=F Local W+F Global (1-W), F Local and F Global Represent the crack image features extracted by the local feature encoder and the global information encoder respectively.
[0113] The multi-scale feature fusion module based on the hybrid attention mechanism of the present invention comprehensively utilizes spatial attention, channel attention and pixel attention mechanisms to fully mine and integrate the complementary information between the local feature encoder and the global information encoder from multiple dimensions, thereby achieving more efficient feature fusion.
[0114] 24) Build a decoder
[0115] The decoder consists of three decoder layers (decoder layer 1, decoder layer 2, decoder layer 3) and a segmentation header.
[0116] The decoder layer is shown in Figure 7(a), and the processing flow is as follows:
[0117] (a) Sub-pixel convolution is used to upsample the input features to effectively retain more detailed information;
[0118] (b) Concatenate the upsampled features with the fused features of the corresponding scale in the channel dimension;
[0119] (c) Depthwise separable convolution (DSC) is used to reduce the feature dimension, and the designed MILB linear attention module is used to further aggregate features.
[0120] The segmentation head, shown in Figure 7(b), uses sub-pixel convolution to scale the feature map to four times its original size and then generates a segmentation mask using 1×1 convolution. Finally, a thresholding operation is performed on each pixel in the mask, identifying pixels above the set threshold as crack areas and the remaining pixels as background areas, thereby obtaining a clear binary crack segmentation map. In this paper, the threshold is set to 127.
[0121] 25) Build a crack length automatic quantification module
[0122] The accurate quantification of the crack length in the crack binary segmentation image obtained in step 4) is achieved by an automatic crack length quantification method combining orthogonal projection with discrete skeleton evolution.
[0123] like Figure 8 As shown, the automatic crack length quantification method includes the following steps:
[0124] (a) Extraction of initial crack skeleton
[0125] The medial axis transformation method is used to extract the initial skeleton from the crack binary segmentation map obtained in step 4). Specifically, the center of the largest inscribed circle tangent to the crack boundary is extracted. i , construct the skeleton point set, that is, S = {s i}, 1≤i≤N, where N is the number of extracted circle centers. This method not only quickly extracts the initial crack skeleton but also accurately restores the initial crack contour morphology, providing effective support for the subsequent identification and quantitative analysis of crack branching structures. Figure 9(a) shows the binary segmentation map of a crack obtained using the CrackDAM-Net segmentation network, and Figure 9(b) shows the initial crack skeleton extracted from Figure 9(a) using the medial axis transform method.
[0126] (b) Crack skeleton extraction
[0127] The initial crack skeleton extracted in step (a) often contains numerous small burrs, which can affect the accuracy of crack length quantification. Therefore, the initial skeleton extracted in step (a) was pruned using the discrete skeleton evolution algorithm described in the literature "BAIX, LATECKI L J. Discrete Skeleton Evolution [C]. Energy Minimization Methods in Computer Vision and Pattern Recognition. Ezhou: Springer, 2007: 362-374," to obtain the main crack skeleton.
[0128] Figure 9(c) shows the crack trunk skeleton obtained by pruning the initial skeleton in Figure 9(b) using the discrete skeleton evolution algorithm.
[0129] (c) Crack trunk skeleton correction
[0130] The crack trunk skeleton extracted in step (b) is corrected using a skeleton correction method combining orthogonal projection and non-maximum suppression.
[0131] like Figure 10 As shown in the figure, the crack trunk skeleton correction process is as follows:
[0132] (c1) Expand the crack boundary outward by 5 pixels; then,
[0133] (c2) Calculate the tangent direction of each point on the backbone skeleton one by one, and calculate the grayscale gradient point by point along the perpendicular direction of the tangent (i.e., the orthogonal direction of the skeleton) until the expanded boundary is reached;
[0134] (c3) A non-maximum suppression algorithm is used in orthogonal directions on either side of the skeleton point to identify two local gradient maxima as the corrected crack boundary points. After all skeleton points are processed, two new sets of boundary points are obtained. These are then fitted using bicubic spline interpolation to obtain two corrected crack boundary curves.
[0135] (c4) Calculate the geometric center of the corrected boundary points on both sides of each skeleton point, and replace the original skeleton point with this center position to form the geometric center line of the two boundary curves and obtain the accurate crack trunk skeleton.
[0136] (d) Crack length calculation
[0137] The quasi-Euclidean distance is used to calculate the distance between the two end points of the crack skeleton extracted in step (c) along the skeleton geodesic line as the actual length of the crack.
[0138] like Figure 11As shown, assume that the backbone skeleton has a total of N points, and the quasi-Euclidean distance d between two consecutive points (x i-1 , y i-1 ) and (x i , y i ) is calculated according to the following formula: i where 1 << i << N. By accumulating the distances d between points one by one along the crack backbone skeleton, the total crack length in pixels can be calculated
[0139]
[0140] i . Then, by multiplying this length by a pre-calibrated scale factor γ, the actual length can be obtained . The scale factor refers to the ratio between the pixel distance in the image and its corresponding actual physical distance (in millimeters).
[0141] Figure 12 [[ID=
[0150] The BCE loss function and the Dice loss function are combined in equal proportions to form a composite loss function, namely L BCE +L Dice This combined strategy takes into account the advantages of both loss functions: the BCE loss function can accurately optimize the classification probability at the pixel level, while the Dice loss function has good robustness in dealing with the imbalance problem between crack and background data. Through combined optimization, the overall performance of the image segmentation task can be improved. The calculation formulas of the BCE loss function and the Dice loss function are as follows:
[0151]
[0152] in, is the predicted probability value of the i-th pixel, y i is the corresponding true label, and N is the total number of pixels.
[0153] 33) Data preprocessing
[0154] First, images from the fatigue crack dataset are loaded and all input images are uniformly scaled to a fixed size to match the network's input requirements. Subsequently, various data augmentation strategies are used to improve the model's generalization capabilities, including random rotation (with an angle range of ±45°), random horizontal and vertical flips (with a flip probability of 0.5), Gaussian noise injection, and contrast adjustment. Finally, the augmented images are normalized to accelerate model training convergence and improve stability.
[0155] 34) Network training
[0156] The preprocessed crack data is fed into the CrackDAM-Net network, where network parameters are iteratively optimized using the backpropagation algorithm. During training, model performance is evaluated on the validation set every 10 epochs to monitor training effectiveness and prevent overfitting. Finally, the network model weight file with the best performance on the validation set is saved and used as the optimal model parameter file for subsequent inference and deployment.
[0157] Step 4: Automatic crack segmentation and length quantification.
[0158] After deploying the CrackDAM-Net network trained in step 3, automatic segmentation and length quantification of crack images can be achieved.
[0159] The specific implementation steps are as follows:
[0160] 41) Model Deployment
[0161] Load the optimal network model weight file obtained from training in step 3 into the inference engine and perform 100 idle inference operations on the GPU computing unit to complete model warm-up, eliminate performance fluctuations caused by cold start, and ensure the stability and accuracy of the inference process.
[0162] 42) Automatic crack segmentation and length quantification
[0163] The crack image to be detected is input into the deployed CrackDAM-Net network. After being processed by the network model, the crack segmentation mask and the quantified result of the crack length are output. Figure 12 As shown in the figure, the crack segmentation mask is used to accurately locate the location area of the crack, and the crack length quantification result is used to obtain the specific length information of the crack, providing data support for crack damage assessment.
[0164] As can be seen from the above embodiments, the present invention utilizes the outstanding advantages of convolutional neural networks (CNNs) in local information extraction, combined with the advantage of Transformers in capturing the global contextual information of images, and adopts a fatigue crack segmentation and quantization network based on frequency domain enhancement and Mamba linear attention mechanism - CrackDAM-Net. On the one hand, a dual-branch parallel structure of a local feature encoder and a global information encoder is adopted, taking into account both the local detail features and global contextual information of fatigue crack images. A global information encoder combining frequency domain enhancement and Mamba linear attention is designed. It can not only effectively extract the global features of crack images, but also significantly reduce computational complexity. On the other hand, a multi-scale feature fusion module that hybridizes spatial attention, channel attention, and pixel attention mechanisms is adopted to fully explore and integrate the complementary information between the local feature encoder and the global information encoder from multiple dimensions, thereby improving feature expression capabilities. On the other hand, by establishing an automatic crack length quantization method combining discrete skeleton evolution and orthogonal projection, accurate measurement of fatigue crack length in structural strength tests is achieved.
[0165] Experimental results demonstrate that the proposed CrackDAM-Net significantly improves segmentation accuracy compared to mainstream crack segmentation networks, achieving a good balance between detection accuracy and inference speed, while significantly improving the accuracy of automatic crack length quantization. CrackDAM-Net achieves a good balance between accuracy and speed, achieving segmentation accuracy, recall, and F1 scores of 83.11%, 77.56%, and 80.24%, respectively, at a segmentation speed of 37 FPS. The fatigue crack length quantization error is within 4%, meeting the practical application requirements of fatigue crack detection.
[0166] like Figure 13As shown, the present invention further provides an automatic segmentation and quantification device 100 for fatigue cracks in a structural strength test of the method, comprising:
[0167] An acquisition module 110 is used to acquire material fatigue crack images and construct a material fatigue crack image dataset;
[0168] A local feature encoder module 120 is used to extract local detail features of fatigue cracks;
[0169] A global information encoder module 130 for extracting global context information of fatigue cracks;
[0170] A multi-scale feature fusion module 140 is used to input local features and global features into the multi-scale feature fusion module for feature fusion;
[0171] The decoder module 150 is used to perform upsampling processing on the fused features through the decoder to obtain a fatigue crack segmentation map;
[0172] The crack length automatic quantification module 160 is used to process the crack segmentation map to obtain the quantified value of the fatigue crack length;
[0173] The training module 170 is used to train the fatigue crack automatic segmentation and quantification network.
[0174] The present invention is not limited to the above-mentioned embodiments. On the basis of the technical solutions disclosed in the present invention, those skilled in the art can make some substitutions and modifications to some of the technical features therein according to the disclosed technical content without creative labor, and these substitutions and modifications are all within the protection scope of the present invention.
Claims
1. A method for automatic segmentation and quantification of fatigue cracks in structural strength testing, characterized in that: include: Acquire material fatigue crack images and construct material fatigue crack image dataset; Based on the material fatigue crack image dataset, a fatigue crack segmentation and quantification network CrackDAM-Net is constructed; It includes constructing a local feature encoder and a global information encoder to extract local detail features and global context information of fatigue cracks respectively; Construct a multi-scale feature fusion module that includes hybrid spatial attention, channel attention, and pixel attention mechanisms, and input local features and global features into the multi-scale feature fusion module for feature fusion; Construct a decoder and upsample the fused features through the decoder to obtain a fatigue crack segmentation map; Construct a crack length automatic quantification module to automatically quantify the crack length and obtain the quantified value of the fatigue crack length; Training fatigue crack automatic segmentation and quantification network; The crack image to be detected is input into the fatigue crack automatic segmentation and quantification network CrackDAM-Net to perform crack segmentation and length quantification to obtain the fatigue crack length.
2. The method for automatic segmentation and quantification of fatigue cracks in structural strength testing according to claim 1, characterized in that: A material fatigue crack image dataset is constructed and divided into training set, validation set and test set in proportion. Stratified sampling is used to ensure that various crack features are evenly distributed in each subset.
3. The method for automatic segmentation and quantification of fatigue cracks in structural strength testing according to claim 1, characterized in that: Construct a local feature encoder, including: The local feature encoder uses the ResNet-50 network as the basic architecture, separating the initialization layer, the maximum pooling layer, and four convolutional layers from the original structure; The residual structure H(X) is expressed as: H(X)=F(X)+weight x ·X Among them, X is the initial input; F(X) is the data after feature extraction; weight x ∈[0.5,1] is a learnable dynamic adjustment weight coefficient.
4. The method for automatic segmentation and quantification of fatigue cracks in structural strength testing according to claim 1, characterized in that: Construct a global information encoder, which consists of four hierarchical structures: The first and second layers are hybrid frequency domain-attention layers, each layer contains a frequency domain module FDB and two MILB linear attention modules; The third and fourth layers are designed as full attention layers, each consisting of three MILB linear attention modules; The MILB linear attention module combines the Mamba-inspired linear attention mechanism MILA, feedforward neural network FFN, layer normalization, and residual connection.
5. The method for automatic segmentation and quantification of fatigue cracks in structural strength testing according to claim 1, characterized in that: Construct a multi-scale feature fusion module and input local features and global features into the multi-scale feature fusion module for feature fusion; including: The crack image features extracted by the local feature encoder branch and the corresponding global information encoder branch are input into the hybrid attention mechanism MSCP to calculate the attention weight of the features; and feature fusion is achieved using a weighted summation method. The multi-scale feature fusion module introduces a skip connection structure and projects the fused features through a 1×1 convolutional layer to generate the final feature representation.
6. The method for automatic segmentation and quantification of fatigue cracks in structural strength testing according to claim 5, characterized in that: The hybrid attention mechanism MSCP has the following processing flow: According to the input crack image features, spatial attention features and channel attention features are calculated respectively; Additively fuse the spatial attention features and channel attention features to form a preliminary coarse feature representation; The coarse features are feature-concatenated with the input features, and the pixel attention mechanism is used to obtain the final hybrid attention weights.
7. The method for automatic segmentation and quantification of fatigue cracks in structural strength testing according to claim 1, characterized in that: Construct a decoder and upsample the fused features through the decoder, including: The decoder consists of three decoder layers and a segmentation header; The segmentation head uses sub-pixel convolution to enlarge the feature map to 4 times its original size, and uses 1×1 convolution to generate a segmentation mask. By performing threshold processing on each pixel in the mask, pixels above the set threshold are determined as crack areas, and the remaining pixels are determined as background areas, obtaining a clear crack binary segmentation map; The decoder layer performs upsampling processing, including: Use sub-pixel convolution to upsample the input features and retain more detailed information; Concatenate the upsampled features with the fused features of the corresponding scale in the channel dimension; Depthwise separable convolution (DSC) is used to reduce feature dimensions, and the MILB linear attention module is used to further aggregate features.
8. The method for automatic segmentation and quantification of fatigue cracks in structural strength testing according to claim 1, characterized in that: Construct a crack length automatic quantification module to automatically quantify the crack length, including: Extracting the initial skeleton from the obtained crack binary segmentation map; The discrete skeleton evolution algorithm is used to prune the extracted initial skeleton to obtain the main skeleton of the crack; The extracted crack trunk skeleton is corrected using the skeleton correction method of orthogonal projection and non-maximum suppression; The distance between the two endpoints of the extracted crack skeleton along the skeleton geodesic line is calculated using the quasi-Euclidean distance as the actual length of the crack.
9. The method for automatic segmentation and quantification of fatigue cracks in structural strength testing according to claim 1, characterized in that: Training of automatic fatigue crack segmentation and quantification network, including: The constructed fatigue crack image dataset is used to configure the network model training environment, set the training parameters, and construct a composite loss function to train the constructed fatigue crack segmentation and quantification network - CrackDAM-Net.
10. An automatic fatigue crack segmentation and quantification device in a structural strength test according to any one of claims 1 to 9, characterized in that: include: An acquisition module is used to acquire material fatigue crack images and construct a material fatigue crack image dataset; Local feature encoder module, used to extract local detail features of fatigue cracks; A global information encoder module is used to extract global contextual information of fatigue cracks; A multi-scale feature fusion module is used to input local features and global features into the multi-scale feature fusion module for feature fusion; The decoder module is used to upsample the fused features through the decoder to obtain the fatigue crack segmentation map; The automatic crack length quantification module is used to process the crack segmentation map to obtain the quantified value of the fatigue crack length; Training module, used to train the fatigue crack automatic segmentation and quantification network.
Citation Information
Cited By
Method for quantitatively characterizing fatigue crack full-life characteristics
CN121347292A
Helicopter rotor crack fault identification method and device based on video semantic segmentation
CN121616921A