Crack identification and analysis method and system for building shear walls
Through multi-angle shooting and image standardization processing, combined with multi-model degradation and data enhancement strategies, the shear wall crack features are extracted using convolutional denoising autoencoder and dynamic graph convolutional neural network, and classified through twin metric learning networks, solving the problems of low shear wall crack recognition efficiency and unstable image quality in the existing technology, and achieving efficient crack recognition and classification.
Patent Information
- Application Number
- CN202510088184.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2045-01-21
AI Technical Summary
The existing shear wall crack identification method has problems such as high labor intensity, low efficiency and strong subjectivity, and the image quality is unstable in complex environments, which affects the performance of the recognition algorithm.
Multi-angle shooting and image standardization processing are adopted, combined with multi-model degradation and data enhancement strategies, noise separation is performed through convolutional denoising autoencoder, local and global features are extracted using dynamic graph convolutional neural network, and fracture classification is performed through twin metric learning networks.
It significantly improves the ability of the recognition algorithm to adapt to different imaging conditions, enhances the ability to extract fracture features, realizes effective capture of deep semantic information between fracture areas and efficient integration of different scale features, and improves classification accuracy.
Smart Images

Figure CN119515879B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of crack identification, and in particular to a method and system for identifying and analyzing cracks in a building shear wall. Background Art
[0002] Shear walls are prone to cracks under long-term loads and environmental factors. These cracks not only affect the aesthetics of the building, but are also likely to cause structural performance degradation and endanger building safety. At present, traditional shear wall crack identification methods mainly rely on manual inspections, which have problems such as high labor intensity, low efficiency, and strong subjectivity, and are difficult to meet the needs of large-scale building structure safety monitoring.
[0003] With the development of deep learning technology, the automatic crack recognition method based on computer vision has gradually become a research hotspot. However, the existing crack recognition algorithms still face many challenges when processing images in complex environments: due to the influence of factors such as on-site lighting conditions, shooting angles and environmental interference, the quality of the acquired crack images is uneven, which seriously affects the performance of the recognition algorithm; secondly, when extracting crack features, the deep semantic information between crack regions is often ignored, resulting in insufficient feature expression capabilities. In addition, when aggregating local regional features, the existing algorithms often ignore the useful information in other regional features and lack full utilization of the global morphological features of the cracks; at the same time, the sample data of dangerous cracks in actual engineering is relatively scarce. How to ensure the recognition accuracy and generalization ability of the algorithm under limited sample conditions is also a key problem that needs to be solved urgently. Summary of the invention
[0004] The present invention provides a method and system for identifying and analyzing cracks in building shear walls, which effectively captures deep semantic information between crack regions in building shear walls and efficiently integrates crack features of different scales.
[0005] In a first aspect, the present invention provides a method for identifying and analyzing cracks in a building shear wall, the method comprising: photographing the surface of the building shear wall at multiple angles and performing image standardization processing to obtain a standardized image data matrix; performing multi-model degradation processing and multi-angle image combination on the standardized image data matrix to obtain target enhanced image data; inputting the target enhanced image data into a convolutional denoising autoencoder for noise separation to obtain a denoised feature image matrix; inputting the denoised feature image matrix into a dynamic graph convolutional neural network for local feature and global feature extraction to obtain a local crack feature matrix and a global crack feature matrix, and performing feature fusion on the local crack feature matrix and the global crack feature matrix to obtain a fused feature matrix; inputting the fused feature matrix into a twin metric learning network for feature measurement and crack classification, and outputting a target crack classification result.
[0006] In combination with the first aspect, in a first implementation of the first aspect of the present invention, the surface of the building shear wall is photographed at multiple angles and image normalized to obtain a standardized image data matrix, including: photographing the surface of the building shear wall to obtain a multi-angle original image set including three viewing angles of 90 degrees forward, 45 degrees to the left, and 45 degrees to the right; performing regional segmentation on the multi-angle original image set to obtain a target monitoring area image, and performing proportional cropping and pixel resampling on the target monitoring area image to obtain a uniform size image; performing illumination compensation on the uniform size image to obtain an illumination image. The invention discloses a method for obtaining a normalized image by illuminating the image, and performing pixel value sorting and median extraction on the local area of the normalized image to obtain a filtered image; the filtered image is divided into a plurality of image blocks, and a histogram equalization operation is performed on each image block to obtain a contrast enhanced image; the contrast enhanced image is binarized and annotated, and the pixel value of the crack area is marked as 1, and the pixel value of the non-crack area is marked as 0 to obtain a binary label image; at the same time, the contrast enhanced image and the binary label image are integrated to obtain a plurality of standard angle images, and a standardized image data matrix is constructed according to the plurality of standard angle images.
[0007] In combination with the first aspect, in a second implementation of the first aspect of the present invention, the standardized image data matrix is subjected to multi-model degradation processing and multi-angle image combination to obtain target enhanced image data, including: performing degradation processing on multiple standardized angle images in the standardized image data matrix according to a motion blur degradation model, setting the blur kernel length to be uniformly sampled within a range of 5-15 pixels, and randomly sampling the blur angle within a range of 0-180 degrees, performing a convolution operation on each standardized angle image to obtain a motion blur degradation matrix; adding Gaussian noise based on the motion blur degradation matrix, setting the noise mean to 0, and performing random sampling on the standard deviation within a range of 0.01-0.05, performing Gaussian distribution noise superposition on the image pixel values of each standardized angle image to obtain a Gaussian noise degradation matrix; performing illumination change processing on the Gaussian noise degradation matrix, and performing brightness gain and contrast on each standardized angle image. The brightness gain coefficient is randomly sampled in the range of 0.8-1.2, and the contrast gain coefficient is randomly sampled in the range of 0.9-1.1 to obtain an illumination change degradation matrix; the illumination change degradation matrix is input into a geometric deformation processing module, and perspective transformation and scale transformation are performed on each standardized angle image, the perspective transformation angle is randomly sampled in the range of -10 degrees to 10 degrees, and the scale transformation ratio is randomly sampled in the range of 0.9-1.1 to obtain a geometric deformation degradation matrix; a degradation model combination pool is constructed based on the geometric deformation degradation matrix, and four degradation models, namely, motion blur, Gaussian noise, illumination change, and geometric deformation, are randomly selected and combined, and multiple degradation superposition processing is performed on each standardized angle image to obtain a multiple degraded image set; multi-angle image fusion is performed on the multiple degraded image set, and degraded images collected from different viewing angles in the same shear wall area and their corresponding labels are combined and spliced to obtain target enhanced image data.
[0008] In combination with the first aspect, in a third implementation of the first aspect of the present invention, the target enhanced image data is input into a convolutional denoising autoencoder for noise separation to obtain a denoised feature image matrix, including: inputting the target enhanced image data into a first residual block of a feature extraction subnetwork in a convolutional denoising autoencoder, wherein the first residual block comprises two 3×3 convolutional layers connected in series, the number of output channels of the first convolutional layer is 64, the number of output channels of the second convolutional layer is 64, and the residual connection uses 1×1 convolution for channel matching to obtain a first layer feature map; inputting the first layer feature map into a second residual block of the feature extraction subnetwork for The second residual block comprises two 3×3 convolutional layers connected in series, the number of output channels of the first convolutional layer is 128, the number of output channels of the second convolutional layer is 128, each convolutional layer is followed by a batch normalization layer and a LeakyReLU activation function is passed to obtain a second-layer feature map; the second-layer feature map is input into the third residual block of the feature extraction subnetwork, wherein the third residual block comprises two 3×3 convolutional layers connected in series, the number of output channels of the first convolutional layer is 256, the number of output channels of the second convolutional layer is 256, the input feature map is element-wise added to the residual block output through a short-circuit connection to obtain a third-layer feature map; The third layer feature map performs channel attention calculation to obtain a channel weight vector, and performs a broadcast multiplication operation on the channel weight vector and the third layer feature map in the channel dimension to obtain a channel weighted feature map, and then inputs the channel weighted feature map into the spatial attention module, generates a spatial weight map through a 7×7 convolution layer, the output channel number of the 7×7 convolution layer is 1, and is normalized by a Sigmoid function; performs a broadcast multiplication operation on the spatial weight map and the channel weighted feature map in the spatial dimension to obtain an attention enhancement feature map, and then performs upsampling through a deconvolution layer, and the deconvolution kernel size is 4×4, The step size is 2, the number of output channels is 512, and batch normalization and ReLU activation function are used to obtain an upsampled feature map; the upsampled feature map is concatenated with the jump connection feature of the corresponding encoding stage in the channel dimension, and then the feature is reconstructed through two serially connected deconvolution layers to obtain a reconstructed feature map, wherein the number of output channels of the first deconvolution layer is 256, the number of output channels of the second deconvolution layer is 128, the convolution kernel size of each deconvolution layer is 4×4, and the step size is 2; the reconstructed feature map is deconvolved, the deconvolution kernel size is 4×4, and the step size is 2, to obtain a denoised feature image matrix.
[0009] In combination with the first aspect, in a fourth implementation method of the first aspect of the present invention, the denoised feature image matrix is input into a dynamic graph convolutional neural network to extract local features and global features to obtain a local crack feature matrix and a global crack feature matrix, and the local crack feature matrix and the global crack feature matrix are feature fused to obtain a fused feature matrix, including: dividing the denoised feature image matrix into P×P overlapping blocks, where P is 16, and the overlap rate of adjacent blocks is 50%, and each overlapping block is feature aggregated by maximum pooling and average pooling to obtain a local feature set; constructing a K nearest neighbor graph for the local feature set, setting the K value to 16, calculating the similarity matrix between each node and other nodes based on cosine similarity, taking the K nodes with the highest similarity as the neighborhood points of the central node, and obtaining a dynamic adjacency matrix; inputting the dynamic adjacency matrix into an edge feature calculation module, calculating the neighborhood points of the central node and its K nearest neighbors The edge features between neighboring nodes are obtained to obtain an edge feature matrix; graph attention calculation is performed on the edge feature matrix, and an attention weight matrix is obtained by multiplying the attention vector with the feature transformation matrix; the attention weight matrix and the edge feature matrix are weighted aggregated, and the K neighborhood features of each node are weighted summed, and feature transformation is performed through a three-layer graph convolution network, the convolution kernel size is 1×1, and the number of output channels is [128, 256, 512] respectively, to obtain a local crack feature matrix; a global graph convolution operation is performed on the local aggregated features to construct a complete graph structure, each node is connected to all other nodes, and global information interaction is performed through two layers of graph convolution layers, the convolution kernel size is 1×1, and the number of output channels is [512, 1024], to obtain a global crack feature matrix; feature fusion is performed on the local crack feature matrix and the global crack feature matrix to obtain a fused feature matrix.
[0010] In combination with the first aspect, in a fifth implementation of the first aspect of the present invention, the feature fusion of the local crack feature matrix and the global crack feature matrix to obtain a fused feature matrix includes: extracting features from the local crack feature matrix and the global crack feature matrix respectively through the first layer of the pyramid, wherein the first layer of the pyramid includes a 1×1 convolution layer, the number of input channels is 1024, the number of output channels is 256, and the step size is 1, and processing through the ReLU activation function to obtain an initial local feature map and an initial global feature map; inputting the initial local feature map and the initial global feature map into an upsampling module respectively, performing 2 times upsampling through a nearest neighbor interpolation method, and then passing through a 3×3 convolution layer, the padding method is SAME, the number of input channels is 256, the number of output channels is 256, and the step size is 1, followed by a batch normalization layer and a ReLU activation function to obtain an upsampled local feature map and an upsampled global feature map; performing feature fusion on the upsampled local feature map and the upsampled global feature map to obtain a fused feature map, The fused feature map is input into the channel attention module, and the feature is first compressed into a 1×1×256 vector through global average pooling, and then passed through two fully connected layers, the output dimension of the first fully connected layer is 16, and the output dimension of the second fully connected layer is 256, and the ReLU activation function is passed in the middle, and finally the channel weight vector is generated by the Sigmoid function and the feature is recalibrated to obtain the channel enhanced feature; the channel enhanced feature is non-locally calculated to obtain the spatial enhanced feature, and the spatial enhanced feature is input into the feature pyramid aggregation module, the feature pyramid aggregation module includes four parallel branches, each branch is a 3×3 convolution layer, the number of input channels is 128, the number of output channels is 128, and the output of each branch is processed by batch normalization and ReLU activation function to obtain a multi-scale feature group; the four branch features in the multi-scale feature group are spliced in the channel dimension to obtain a multi-level feature set, and the multi-level feature set is upsampled to the same resolution through the nearest neighbor interpolation method to obtain a fused feature matrix.
[0011] In combination with the first aspect, in a sixth implementation of the first aspect of the present invention, the fused feature matrix is input into the twin metric learning network for feature measurement and crack classification, and the target crack classification result is output, including: inputting the fused feature matrix into the first convolution branch of the dual branches of the twin metric learning network, the first convolution branch contains 6 convolution blocks, the first convolution block contains a 3×3 convolution layer, the number of input channels is 512, the number of output channels is 64, the step size is 1, and the padding method is SAME, to obtain the first layer of convolution features; for the The first layer of convolution features are sequentially input into the second convolution block to the sixth convolution block, the number of output channels of the second convolution block to the sixth convolution block are 128, 256, 512, 512, 512 respectively, the convolution kernel size of each convolution block is 3×3, the step size is 1, and the filling method is SAME, and the first branch target features are obtained; the fused feature matrix is input into the second convolution branch in the dual branch of the twin metric learning network, the second convolution branch has the same structure as the first convolution branch, and uses the weights shared with the first convolution branch. The first branch target feature and the second branch target feature are respectively subjected to global context attention calculation to obtain the first enhanced feature and the second enhanced feature; the first enhanced feature and the second enhanced feature are input into the two-stream metric module, the first stream calculates the Euclidean distance, and the second stream calculates the cosine similarity, the two distance values are connected in series and fused through the fully connected layer to obtain a fused distance vector; the fused distance vector is subjected to triplet constraint optimization, for each anchor sample a, a positive sample p in the same category and a negative sample n in a different category are selected, the triplet loss is calculated, and an optimized distance matrix is obtained; the optimized distance matrix is subjected to density clustering analysis, firstly the local density of each sample point is calculated, then the minimum distance from each point to a point with higher density is calculated, the cluster center is determined through a decision diagram, and an initial category division result is obtained; the initial category division result is finely classified, the Mahalanobis distance between each category center and the sample point is calculated, the classification threshold is set to 2 times the standard deviation of the intra-class distance mean, the category attribution is confirmed and adjusted, and the target crack classification result is output.
[0012] In a second aspect, the present invention provides a crack identification and analysis system for a building shear wall, and the crack identification and analysis system for a building shear wall comprises: a shooting module, used to perform multi-angle shooting and image standardization processing on the surface of the building shear wall to obtain a standardized image data matrix; a combination module, used to perform multi-model degradation processing and multi-angle image combination on the standardized image data matrix to obtain target enhanced image data; a separation module, used to input the target enhanced image data into a convolutional denoising autoencoder for noise separation to obtain a denoised feature image matrix; an extraction module, used to input the denoised feature image matrix into a dynamic graph convolutional neural network for local feature and global feature extraction to obtain a local crack feature matrix and a global crack feature matrix, and perform feature fusion on the local crack feature matrix and the global crack feature matrix to obtain a fused feature matrix; a classification module, used to input the fused feature matrix into a twin metric learning network for feature measurement and crack classification, and output the target crack classification result.
[0013] In combination with the second aspect, in a first implementation of the second aspect of the present invention, the shooting module is specifically used to: shoot images of the surface of the building shear wall to obtain a multi-angle original image set with viewing angles including three angles of 90 degrees in the front direction, 45 degrees on the left side and 45 degrees on the right side; perform regional segmentation on the multi-angle original image set to obtain a target monitoring area image, and perform proportional cropping and pixel resampling processing on the target monitoring area image to obtain a uniform size image; perform illumination compensation on the uniform size image to obtain an illumination normalized image, and perform local area pixel value sorting and median extraction on the illumination normalized image to obtain a filtered image; divide the filtered image into multiple image blocks, and perform a histogram equalization operation on each image block to obtain a contrast enhanced image; perform binary labeling on the contrast enhanced image, mark the pixel value of the crack area as 1, and mark the pixel value of the non-crack area as 0, to obtain a binary label image, and at the same time, integrate the contrast enhanced image and the binary label image to obtain multiple standard angle images, and construct a standardized image data matrix based on the multiple standard angle images.
[0014] In combination with the second aspect, in a second implementation of the second aspect of the present invention, the combination module is specifically used to: perform degradation processing on multiple standardized angle images in the standardized image data matrix according to a motion blur degradation model, set the blur kernel length to be uniformly sampled in the range of 5-15 pixels, and randomly sample the blur angle in the range of 0-180 degrees, and perform convolution operation on each standardized angle image to obtain a motion blur degradation matrix; add Gaussian noise based on the motion blur degradation matrix, set the noise mean to 0, and perform random sampling in the range of 0.01-0.05 for the standard deviation, and perform Gaussian distribution noise superposition on the image pixel values of each standardized angle image to obtain a Gaussian noise degradation matrix; perform illumination change processing on the Gaussian noise degradation matrix, by performing brightness gain and contrast gain transformation on each standardized angle image, the brightness gain coefficient is between 0.8- The illumination change degradation matrix is obtained by randomly sampling within the range of 1.2 and the contrast gain coefficient is randomly sampled within the range of 0.9-1.1; the illumination change degradation matrix is input into the geometric deformation processing module, and perspective transformation and scale transformation are performed on each standardized angle image. The perspective transformation angle is randomly sampled within the range of -10 degrees to 10 degrees, and the scale transformation ratio is randomly sampled within the range of 0.9-1.1 to obtain the geometric deformation degradation matrix; a degradation model combination pool is constructed based on the geometric deformation degradation matrix, and four degradation models, namely, motion blur, Gaussian noise, illumination change, and geometric deformation, are randomly selected and combined, and multiple degradation superposition processing is performed on each standardized angle image to obtain a multiple degraded image set; multi-angle image fusion is performed on the multiple degraded image set, and the degraded images and their corresponding labels collected from the same shear wall area at different viewing angles are combined and spliced to obtain target enhanced image data.In combination with the second aspect, in a third implementation of the second aspect of the present invention, the separation module is specifically used to: input the target enhanced image data into the first residual block of the feature extraction subnetwork in the convolutional denoising autoencoder, wherein the first residual block comprises two 3×3 convolutional layers connected in series, the number of output channels of the first convolutional layer is 64, the number of output channels of the second convolutional layer is 64, and the residual connection uses 1×1 convolution for channel matching to obtain a first layer feature map; input the first layer feature map into the second residual block of the feature extraction subnetwork for processing, wherein the second residual block comprises two 3×3 convolutional layers connected in series, The number of output channels of the first convolutional layer is 128, and the number of output channels of the second convolutional layer is 128. Each convolutional layer is followed by a batch normalization layer and a LeakyReLU activation function is passed to obtain a second-layer feature map; the second-layer feature map is input into the third residual block of the feature extraction subnetwork, wherein the third residual block contains two 3×3 convolutional layers connected in series, the number of output channels of the first convolutional layer is 256, and the number of output channels of the second convolutional layer is 256. The input feature map and the residual block output are element-wise added through a short-circuit connection to obtain a third-layer feature map; channel attention calculation is performed on the third-layer feature map , obtain a channel weight vector, and perform a broadcast multiplication operation on the channel dimension of the channel weight vector and the third layer feature map to obtain a channel weighted feature map, and then input the channel weighted feature map into the spatial attention module, generate a spatial weight map through a 7×7 convolution layer, the output channel number of the 7×7 convolution layer is 1, and normalize it through a Sigmoid function; perform a broadcast multiplication operation on the spatial dimension of the spatial weight map and the channel weighted feature map to obtain an attention enhancement feature map, and then upsample it through a deconvolution layer, the deconvolution kernel size is 4×4, the step size is 2, and the output channel is The number of channels is 512, and batch normalization and ReLU activation function are used to obtain an upsampled feature map; the upsampled feature map is spliced with the jump connection feature of the corresponding encoding stage in the channel dimension, and then the feature is reconstructed through two serial deconvolution layers to obtain a reconstructed feature map, wherein the number of output channels of the first deconvolution layer is 256, the number of output channels of the second deconvolution layer is 128, the convolution kernel size of each deconvolution layer is 4×4, and the step size is 2; the reconstructed feature map is deconvolved, the deconvolution kernel size is 4×4, and the step size is 2, and a denoised feature image matrix is obtained.
[0015] In combination with the second aspect, in a fourth implementation method of the second aspect of the present invention, the extraction module is specifically used to: divide the denoised feature image matrix into P×P overlapping blocks, where P is 16, and the overlap rate of adjacent blocks is 50%, and each overlapping block performs feature aggregation through maximum pooling and average pooling to obtain a local feature set; construct a K nearest neighbor graph for the local feature set, set the K value to 16, calculate the similarity matrix between each node and other nodes based on cosine similarity, take the K nodes with the highest similarity as the neighborhood points of the central node, and obtain a dynamic adjacency matrix; input the dynamic adjacency matrix into the edge feature calculation module, calculate the edge features between the central node and its K nearest neighbor nodes, and obtain an edge feature matrix; perform graph attention calculation on the edge feature matrix, and use attention to The product operation of the amount and the feature transformation matrix is obtained to obtain the attention weight matrix; the attention weight matrix and the edge feature matrix are weighted aggregated, the K neighborhood features of each node are weighted summed, and feature transformation is performed through a three-layer graph convolution network. The convolution kernel size is 1×1, and the number of output channels is [128, 256, 512] respectively to obtain a local crack feature matrix; a global graph convolution operation is performed on the local aggregated features to construct a complete graph structure, each node is connected to all other nodes, and global information exchange is performed through two layers of graph convolution layers. The convolution kernel size is 1×1, and the number of output channels is [512, 1024] to obtain a global crack feature matrix; feature fusion is performed on the local crack feature matrix and the global crack feature matrix to obtain a fused feature matrix.
[0016] In combination with the second aspect, in a fifth implementation of the second aspect of the present invention, the extraction module is further used to: perform feature extraction on the local crack feature matrix and the global crack feature matrix respectively through the first layer of the pyramid, wherein the first layer of the pyramid includes a 1×1 convolution layer, the number of input channels is 1024, the number of output channels is 256, the step size is 1, and the initial local feature map and the initial global feature map are obtained by processing through the ReLU activation function; the initial local feature map and the initial global feature map are respectively input into the upsampling module, upsampled by 2 times through the nearest neighbor interpolation method, and then passed through a 3×3 convolution layer, the padding method is SAME, the number of input channels is 256, the number of output channels is 256, the step size is 1, and then a batch normalization layer and a ReLU activation function are used to obtain an upsampled local feature map and an upsampled global feature map; feature fusion is performed on the upsampled local feature map and the upsampled global feature map to obtain a fused feature map, and the fused feature map is input into the channel attention module Block, firstly compress the features into a 1×1×256 vector through global average pooling, then pass through two fully connected layers, the output dimension of the first fully connected layer is 16, and the output dimension of the second fully connected layer is 256, and the ReLU activation function is passed in the middle, and finally the channel weight vector is generated by the Sigmoid function and the feature is recalibrated to obtain the channel enhanced feature; non-local attention calculation is performed on the channel enhanced feature to obtain the spatial enhanced feature, and the spatial enhanced feature is input into the feature pyramid aggregation module, the feature pyramid aggregation module includes four parallel branches, each branch is a 3×3 convolution layer, the number of input channels is 128, the number of output channels is 128, the output of each branch is processed by batch normalization and ReLU activation function to obtain a multi-scale feature group; the four branch features in the multi-scale feature group are spliced in the channel dimension to obtain a multi-level feature set, and the multi-level feature set is upsampled to the same resolution through the nearest neighbor interpolation method to obtain a fusion feature matrix.
[0017] In combination with the second aspect, in a sixth implementation method of the second aspect of the present invention, the classification module is specifically used to: input the fused feature matrix into the first convolution branch of the dual branches of the twin metric learning network, the first convolution branch contains 6 convolution blocks, the first convolution block contains a 3×3 convolution layer, the number of input channels is 512, the number of output channels is 64, the step size is 1, and the filling method is SAME, to obtain the first layer of convolution features; the first layer of convolution features are sequentially input into the second convolution block to the sixth convolution block, the number of output channels of the second convolution block to the sixth convolution block are 128, 256, 512, 512, 512 respectively, the convolution kernel size of each convolution block is 3×3, the step size is 1, and the filling method is SAME, to obtain the first branch target features; the fused feature matrix is input into the second convolution branch of the dual branches of the twin metric learning network, the second convolution branch has exactly the same structure as the first convolution branch, and uses the weight parameters shared with the first convolution branch to obtain the second branch target features; for the The first branch target feature and the second branch target feature are respectively subjected to global context attention calculation to obtain the first enhanced feature and the second enhanced feature; the first enhanced feature and the second enhanced feature are input into the dual-stream metric module, the first stream calculates the Euclidean distance, and the second stream calculates the cosine similarity, the two distance values are connected in series and fused through the fully connected layer to obtain a fused distance vector; the fused distance vector is subjected to triplet constraint optimization, for each anchor sample a, a positive sample p in the same category and a negative sample n in a different category are selected, the triplet loss is calculated, and an optimized distance matrix is obtained; the optimized distance matrix is subjected to density clustering analysis, firstly the local density of each sample point is calculated, then the minimum distance from each point to a point with higher density is calculated, the cluster center is determined through a decision diagram, and an initial category division result is obtained; the initial category division result is finely classified, the Mahalanobis distance between each category center and the sample point is calculated, the classification threshold is set to 2 times the standard deviation of the intra-class distance mean, the category attribution is confirmed and adjusted, and the target crack classification result is output.
[0018] In the technical solution provided by the present invention, the problem of unstable quality of crack image acquisition in complex environments is effectively solved by multi-angle shooting and standardization processing, combined with multi-model degradation and data enhancement strategies, and the adaptability of the recognition algorithm to different imaging conditions is significantly improved. An improved convolutional denoising autoencoder is used for noise separation, and the model's ability to extract crack features is enhanced through the organic combination of residual structure and attention mechanism, effectively reducing the interference of environmental noise. The dynamic graph convolutional neural network is innovatively applied to crack feature extraction, and the deep semantic information between crack regions is effectively captured through the joint learning of local features and global features. A multi-scale feature fusion mechanism based on pyramid structure is designed, and the efficient integration of crack features of different scales is achieved through the dual enhancement of channel attention and spatial attention. A crack classification strategy based on twin metric learning is proposed, which can still achieve high classification accuracy under small sample conditions through triple loss constraints and density clustering optimization. The present invention has obvious advantages over existing algorithms and shows strong generalization ability for cracks of different types and degrees.
[0019] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0020] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A schematic diagram of an embodiment of a method for identifying and analyzing cracks in a building shear wall according to an embodiment of the present invention;
[0022] Figure 2 It is a schematic diagram of an embodiment of a crack identification and analysis system for a building shear wall in an embodiment of the present invention. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0024] The terms "including" and "having" and any variations thereof mentioned in the embodiments of the present invention are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device end including a series of steps or units is not limited to the listed steps or units, but may optionally include other steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or device ends.
[0025] To facilitate understanding of this embodiment, a method for identifying and analyzing cracks in a building shear wall disclosed in an embodiment of the present invention is first described in detail. Figure 1 As shown, the method comprises the following steps:
[0026] 101. Shoot the surface of the building shear wall from multiple angles and perform image standardization processing to obtain a standardized image data matrix;
[0027] It is understandable that the execution subject of the present invention may be a crack identification and analysis system for building shear walls, or a terminal or a server, which is not limited here. The embodiment of the present invention is described by taking a server as the execution subject as an example.
[0028] Specifically, the surface of the building shear wall is imaged, and a multi-angle original image set taken from three different angles of 90 degrees forward, 45 degrees on the left, and 45 degrees on the right is obtained to capture the characteristic details of the cracks in the wall at different viewing angles. The multi-angle original image set is segmented to determine the target monitoring area image, and the target monitoring area image is cropped and pixel resampled to obtain an image of uniform size. The uniform size image is subjected to illumination compensation to obtain an illumination normalized image to reduce the impact of changes in illumination intensity on image quality and crack detection. The illumination normalized image is sorted and median extracted by performing local area pixel value sorting and median extraction to obtain a filtered image. Median filtering is a noise reduction method that can effectively remove random noise in the image, especially salt and pepper noise, while retaining the edge information of the image to the greatest extent, which helps to maintain the edge characteristics of the crack. The filtered image is divided into multiple image blocks, and a histogram equalization operation is performed on each image block to obtain a contrast enhanced image. By using histogram equalization, the image contrast is improved, and a more obvious contrast is formed between the crack area and other areas of the wall, making the crack boundary easier to identify and segment. The contrast-enhanced image is binarized and annotated, and the pixel values in the crack area are marked as 1, and the pixel values in the non-crack area are marked as 0, to obtain a binary label image. By discretizing the pixel values in the image, the location and morphology of the crack are clearly identified. At the same time, the contrast-enhanced image is integrated with the binary label image to generate multiple standard angle images, which contain processed crack feature information and corresponding crack annotation information, so that these images can be used for model training and verification to improve the recognition effect. A standardized image data matrix is constructed through multiple standard angle images.
[0029] 102. Perform multi-model degradation processing and multi-angle image combination on the standardized image data matrix to obtain target enhanced image data;
[0030] Specifically, multiple standardized angle images in the standardized image data matrix are degraded according to the motion blur degradation model. Motion blur is a form of image degradation. The blur kernel length is set to be uniformly sampled in the range of 5 to 15 pixels, and the blur angle is randomly sampled between 0 and 180 degrees. The motion blur degradation matrix is generated by performing convolution operation on each standardized angle image. By simulating blur effects of different degrees and directions, the robustness of the model in practical application scenarios is enhanced, so that it can better adapt to different degrees of image blur interference. Gaussian noise is added based on the motion blur degradation matrix, the noise mean is set to 0, and the standard deviation is randomly sampled in the range of 0.01 to 0.05. Then, the pixel values of each standardized angle image are superimposed with Gaussian distribution noise to obtain a Gaussian noise degradation matrix. Gaussian noise is a common random noise in image processing. By adding this noise, the image quality degradation caused by sensors and other external interferences in the actual shooting environment is effectively simulated, so that the model has stronger robustness to various noise interferences. The Gaussian noise degradation matrix is processed for illumination changes. By performing brightness gain and contrast gain transformation on each standardized angle image, the brightness gain coefficient is randomly sampled in the range of 0.8 to 1.2, and the contrast gain coefficient is randomly sampled in the range of 0.9 to 1.1, respectively, to obtain the illumination change degradation matrix. Changes in illumination conditions are inevitable in actual shooting. By performing random gain transformation on the brightness and contrast of the image, the imaging effect of shear wall cracks under different illumination conditions is simulated, so that the model can maintain stable performance when processing data under different illumination conditions. The illumination change degradation matrix is input into the geometric deformation processing module, and perspective transformation and scale transformation are performed on each standardized angle image. The perspective transformation angle is randomly sampled in the range of -10 degrees to 10 degrees, and the scale transformation ratio is randomly sampled in the range of 0.9 to 1.1, to obtain the geometric deformation degradation matrix. The perspective transformation is used to simulate the deformation caused by the camera shooting the shear wall at different shooting positions and angles, while the scale transformation is used to simulate the effect of shooting at different distances. Through these geometric deformation processing, the diversity of the data set is enriched, making the model more adaptable to changes in shooting angle and distance. On this basis, a degradation model combination pool is constructed based on the geometric deformation degradation matrix, and four degradation models, namely motion blur, Gaussian noise, illumination change, and geometric deformation, are randomly selected and combined. Multiple degradation superposition processing is performed on each standardized angle image to obtain a multiple degradation image set. By randomly combining different types of degradation, complex image degradation effects are simulated, so that the generated multiple degradation image set can fully reflect various image degradation situations encountered in practical applications. Multiple degradation superposition processing can greatly enhance the generalization ability of the model, so that it can still effectively identify cracks in the face of complex and changing environments.Multi-angle image fusion is performed on multiple degraded image sets, and the degraded images collected from different perspectives of the same shear wall area and their corresponding labels are combined and spliced to obtain the target enhanced image data. By fusing multiple degraded images from different angles, the diversity and integrity of the data are enhanced, so that the model can learn the performance characteristics of shear wall cracks from different perspectives.
[0031] 103. Input the target enhanced image data into the convolutional denoising autoencoder for noise separation to obtain a denoised feature image matrix;
[0032] Specifically, the target enhanced image data is input into the first residual block in the feature extraction subnetwork of the convolutional denoising autoencoder. The first residual block contains two 3×3 convolutional layers connected in series. The number of output channels of the first convolutional layer and the second convolutional layer are both 64. The residual connection is realized by 1×1 convolution, which is used for channel matching to ensure the consistency of the number of channels between input and output. Through this residual structure, low-level features are effectively captured and image details are retained to obtain the first-layer feature map. The first-layer feature map is input into the second residual block of the feature extraction subnetwork for processing. The second residual block also contains two 3×3 convolutional layers connected in series. The number of output channels of the first and second convolutional layers of the second residual block are both 128. A batch normalization layer is connected after each convolutional layer to accelerate the training process and improve the stability of the model. The output of the convolutional layer is activated by the LeakyReLU activation function. Compared with the ordinary ReLU, the LeakyReLU activation function can alleviate the problem of neuron "death" and enhance the nonlinear expression ability of the model. The second-layer feature map is obtained through the processing of the second residual block. The second-layer feature map is input into the third residual block of the feature extraction subnetwork for processing. The third residual block also contains two 3×3 convolutional layers in series, and the number of output channels of the first and second convolutional layers is 256. The third residual block uses a short-circuit connection method to perform an element-wise addition operation on the input feature map and the output of the residual block, which alleviates the gradient vanishing problem and makes the network easier to train. Through this residual connection, the original feature information can be effectively retained while further extracting deep features to obtain the third-layer feature map. Channel attention calculation is performed on the third-layer feature map to enhance feature expression. The third-layer feature map is calculated through the channel attention module to obtain a channel weight vector, which reflects the importance of different channels in feature expression. Then the channel weight vector is broadcast multiplied with the third-layer feature map in the channel dimension to obtain a weighted channel feature map. The channel attention mechanism can effectively improve the network's sensitivity to important features and ignore irrelevant redundant information. The channel weighted feature map is input into the spatial attention module for spatial attention calculation. The spatial attention module generates a spatial weight map through a 7×7 convolutional layer. The number of output channels of the convolutional layer is 1, and the value of the weight map is normalized by the Sigmoid function to ensure that the value of the weight map is between 0 and 1. The generated spatial weight map highlights the important areas in the image for crack identification, while suppressing other irrelevant areas. The generated spatial weight map is broadcast multiplied with the channel weighted feature map in the spatial dimension to obtain the attention-enhanced feature map. The attention-enhanced feature map is upsampled by the deconvolution layer. The deconvolution kernel size is 4×4, the step size is 2, and the number of output channels is set to 512. It is processed by batch normalization and ReLU activation function to obtain the upsampled feature map.The deconvolution operation restores the image size to a size closer to the input image, and improves the nonlinear ability through the activation function, providing a high-resolution feature map for subsequent feature reconstruction. The upsampled feature map is spliced with the corresponding jump connection feature in the encoding stage in the channel dimension. The jump connection mechanism is a common method in networks such as U-Net, which is used to retain the detailed information in the encoding stage and pass it to the decoding stage to improve the effect of feature reconstruction. On the spliced features, feature reconstruction is performed through two serial deconvolution layers. The output channel number of the first deconvolution layer is 256, and the output channel number of the second deconvolution layer is 128. The convolution kernel size of each deconvolution layer is 4×4, and the step size is 2. Through the deconvolution process, the spatial resolution of the image is gradually restored, and more detailed feature information is reconstructed. The reconstructed feature map is deconvolved, and the deconvolution kernel size is 4×4 and the step size is 2. After the above upsampling and deconvolution operations, the denoised feature image matrix is finally obtained.
[0033] 104. Input the denoised feature image matrix into a dynamic graph convolutional neural network to extract local features and global features, obtain a local crack feature matrix and a global crack feature matrix, and perform feature fusion on the local crack feature matrix and the global crack feature matrix to obtain a fused feature matrix;
[0034] Specifically, the denoised feature image matrix is divided into P×P overlapping blocks, where the value of P is 16 and the overlap rate between adjacent blocks is 50%. The overlapping partitioning method can effectively share information between adjacent image regions, reduce the loss of boundary information caused by block partitioning, and retain the continuity of crack features. On each overlapping block obtained, two aggregation methods, maximum pooling and average pooling, are used to integrate the features to construct a local feature set, which can represent the significant information in the local area of the image. The local feature set is constructed with a K-nearest neighbor graph, and the K value is set to 16 to ensure that each node can be connected to multiple neighbor nodes to form a graph structure with efficient feature interaction capabilities. In the process of constructing the K-nearest neighbor graph, the similarity matrix between each node and other nodes is calculated based on cosine similarity, and the K nodes with the highest similarity are taken as the neighborhood points of the central node to obtain a dynamic adjacency matrix. The dynamic adjacency matrix can dynamically determine the selection of neighbor nodes according to the similarity between nodes, and can more flexibly reflect the feature similarity relationship between different nodes. Especially in complex crack morphology, the dynamic graph structure can significantly improve the effect of feature extraction. The dynamic adjacency matrix is input into the edge feature calculation module, and the edge feature matrix is generated by calculating the edge features between each central node and its K nearest neighbor nodes. The edge features reflect the relationship features between nodes. The graph attention mechanism is used to calculate the attention of the edge feature matrix, and the attention weight matrix is obtained by multiplying the attention vector and the feature transformation matrix. The attention weight matrix can assign different weights to the features of each node, so as to more accurately focus on the important nodes that contribute to crack detection and ignore redundant or noisy information. The attention weight matrix and the edge feature matrix are weighted aggregated, and the K neighborhood features of each node are weighted summed to form a comprehensive local feature expression. In order to extract feature information, the weighted aggregated features are transformed through a three-layer graph convolutional network. The convolution kernel size of the three-layer graph convolutional network is 1×1, and the number of output channels is [128, 256, 512] respectively. Through the multi-layer graph convolutional network, the abstract level of the features is gradually improved, and the relationship between nodes is effectively integrated to obtain the local crack feature matrix. The local aggregated features are subjected to global graph convolution operations to construct a complete graph structure, so that each node is connected to all other nodes in the graph. Through this step, the global information interaction of crack features in the entire image space can be realized. In the global graph convolution operation, two layers of graph convolution layers are used, the convolution kernel size is still 1×1, and the number of output channels is [512,1024]. The process of global information interaction makes the crack features not only limited to the feature aggregation of the local area, but also can realize the feature sharing within the entire shear wall image through the fully connected graph structure, so that the model can grasp the global features of the cracks as a whole. The extraction of global features can reflect the overall trend and distribution state of the cracks extending on the shear wall surface.The local crack feature matrix and the global crack feature matrix are fused to form the final fused feature matrix.
[0035] The local crack feature matrix and the global crack feature matrix are extracted by the first layer of the pyramid, and the operation is performed by a 1×1 convolution layer, where the number of input channels is 1024, the number of output channels is 256, and the step size is set to 1. Through this step, the high-dimensional features are compressed into lower-dimensional features to reduce the computational complexity while retaining the main information of the features. These features are processed by the ReLU activation function to form the initial local feature map and the initial global feature map. The application of the activation function makes the features nonlinear and enhances the expression ability of the model. The initial local feature map and the initial global feature map are input into the upsampling module respectively, and the feature map is upsampled by 2 times by the nearest neighbor interpolation method. The nearest neighbor interpolation is an upsampling method that can quickly increase the resolution of the feature map to twice, thereby increasing the level of detail of the image while keeping the computational overhead low. On the upsampled feature map, a 3×3 convolution layer is processed, and the padding method in the convolution operation is set to SAME to ensure that the feature map maintains the same size during the convolution process. The number of input and output channels of the convolution layer is 256, and the step size is 1. The outputs of these convolution operations are processed by batch normalization layers and ReLU activation functions. The batch normalization layer can stabilize the training process and reduce the gradient vanishing phenomenon, while the ReLU activation function gives the network stronger nonlinear feature representation capabilities. These processes form upsampled local feature maps and upsampled global feature maps. The upsampled local feature maps and global feature maps are fused so that local and global features can complement each other and obtain a richer fused feature map. The fused feature map is then input into the channel attention module to improve the effectiveness of the features. In the channel attention module, the fused feature map is compressed into a 1×1×256 vector through global average pooling. Through this pooling method, global channel information is obtained, thereby effectively focusing on the contribution of each channel in the overall feature expression. Two fully connected layers are used to process the channel information. The output dimension of the first fully connected layer is 16, and the output dimension of the second fully connected layer is 256. The nonlinear transformation between the two fully connected layers is performed through the ReLU activation function to improve the feature expression capability. The channel weight vector is generated by the Sigmoid function. The weight vector is used to recalibrate the features of each channel to form channel enhancement features. The channel enhancement operation can make the network focus more on the feature channels that are most important for crack detection and improve the overall recognition performance. Non-local attention calculation is performed on the channel enhancement features to obtain spatial enhancement features. The non-local attention mechanism effectively captures the long-distance dependency between features by calculating the relationship between different positions in the feature map. Through non-local attention calculation, attention is paid to the spatial distribution characteristics of cracks in the entire image, and this relationship is encoded into the feature representation to obtain more accurate spatial enhancement features. The spatial enhancement features are input into the feature pyramid aggregation module.The feature pyramid aggregation module contains four parallel branches, each of which is a 3×3 convolutional layer with 128 input channels and 128 output channels. The feature pyramid structure enables different branches to extract features from different scales and retain information of different scales in the feature space. The output of each branch is processed by the batch normalization layer and the ReLU activation function to form a multi-scale feature group. The four branch features in the multi-scale feature group are concatenated in the channel dimension to obtain a multi-level feature set. The multi-level feature set is upsampled to the same resolution by the nearest neighbor interpolation method to obtain a fused feature matrix.
[0036] 105. Input the fused feature matrix into the twin metric learning network for feature measurement and crack classification, and output the target crack classification result.
[0037] Specifically, the fused feature matrix is input into the first convolution branch in the dual branch of the twin metric learning network, which contains six convolution blocks. The first convolution block contains a 3×3 convolution layer with 512 input channels, 64 output channels, a step size of 1, and a padding method of SAME. Through the convolution operation, the spatial features and patterns in the fused feature matrix are preliminarily extracted to obtain the first layer of convolution features. The first layer of convolution features are sequentially input into the second to sixth convolution blocks, and the output channel numbers of these convolution blocks are set to 128, 256, 512, 512, and 512, respectively. Each convolution block uses a 3×3 convolution kernel, a step size of 1, and a padding method of SAME. Through this series of convolution operations, the expressive power of the features is gradually improved, so that the features can capture more crack information and high-level pattern expressions in each layer, and the target features of the first branch are obtained, representing the local and global feature information of the cracks. At the same time, the fused feature matrix is input into the second convolution branch of the twin metric learning network, which has the same structure as the first convolution branch and uses the weight parameters shared with the first convolution branch. This means that the second convolution branch has the same feature extraction capability as the first convolution branch, ensuring that the two branches can extract features consistently for different inputs. The target feature of the second branch is obtained by processing the second convolution branch. The target features of the first and second branches are respectively calculated by global context attention to obtain the first enhanced feature and the second enhanced feature. The global context attention mechanism can effectively improve the perception of crack features by comprehensively considering the information of all positions in the feature map, so that the network can better focus on the significant feature areas of the crack. Through the weighted calculation of context attention, the first enhanced feature and the second enhanced feature can improve their ability to describe the crack morphology on the basis of the original feature. The first enhanced feature and the second enhanced feature are input into the two-stream metric module for feature measurement. In the two-stream metric module, the first stream calculates the Euclidean distance between the two features, while the second stream calculates the cosine similarity between them. These two distance metrics measure the similarity between features from different perspectives: Euclidean distance reflects the absolute distance of feature vectors in space, while cosine similarity focuses on the directional similarity between feature vectors. The two distance values are concatenated and then fused through a fully connected layer to obtain a fused distance vector. The fused distance vector is optimized with triple constraints. For each anchor sample a, a positive sample p in the same category and a negative sample n in a different category are selected, and the triple loss is calculated to obtain the optimized distance matrix. The introduction of triple loss is to ensure that the distance between the anchor sample and the positive sample of the same category is as small as possible, and the distance between the anchor sample and the negative sample of different categories is as large as possible. In this way, the distinguishing ability of the features in crack classification is significantly improved. Density clustering analysis is performed on the optimized distance matrix.Calculate the local density of each sample point. The density value is used to measure the density of each sample in the feature space. Calculate the minimum distance from each point to a higher density point to help identify the sample point at the center of the cluster. With this information, use a decision diagram to determine the cluster center and obtain the initial classification results. Perform fine classification on the initial classification results to improve the accuracy of classification. The Mahalanobis distance between the center of each category and the sample point is calculated to measure the degree of difference between the sample point and the category center, and the classification threshold is set to twice the standard deviation of the mean distance within the class, so as to confirm and adjust the category attribution. The fine classification method based on the Mahalanobis distance can effectively consider the correlation of sample points and the distribution characteristics of the category, significantly improve the accuracy and robustness of crack classification, and finally output the target crack classification results.
[0038] In the embodiment of the present invention, by multi-angle shooting and standardization processing, combined with multi-model degradation and data enhancement strategies, the problem of unstable quality of crack image acquisition in complex environments is effectively solved, and the adaptability of the recognition algorithm to different imaging conditions is significantly improved. An improved convolutional denoising autoencoder is used for noise separation, and the model's ability to extract crack features is enhanced through the organic combination of residual structure and attention mechanism, effectively reducing the interference of environmental noise. The dynamic graph convolutional neural network is innovatively applied to crack feature extraction, and the deep semantic information between crack regions is effectively captured through the joint learning of local features and global features. A multi-scale feature fusion mechanism based on pyramid structure is designed, and the efficient integration of crack features of different scales is achieved through the dual enhancement of channel attention and spatial attention. A crack classification strategy based on twin metric learning is proposed, and a high classification accuracy can still be achieved under small sample conditions through triple loss constraints and density clustering optimization. The present invention has obvious advantages over existing algorithms, and exhibits strong generalization capabilities for cracks of different types and degrees.
[0039] In a specific embodiment, the process of executing step 101 may specifically include the following steps:
[0040] The surface of the building shear wall is imaged to obtain a multi-angle original image set including three viewing angles of 90 degrees forward, 45 degrees on the left, and 45 degrees on the right;
[0041] Performing regional segmentation on the multi-angle original image set to obtain the target monitoring area image, and performing equal-proportion cropping and pixel resampling processing on the target monitoring area image to obtain a uniform-size image;
[0042] Perform illumination compensation on the uniform-size image to obtain an illumination normalized image, and perform pixel value sorting and median extraction on the illumination normalized image in the local area to obtain a filtered processed image;
[0043] The filtered image is divided into a plurality of image blocks, and a histogram equalization operation is performed on each image block to obtain a contrast enhanced image;
[0044] The contrast-enhanced image is binarized and annotated, and the pixel value in the crack area is marked as 1, and the pixel value in the non-crack area is marked as 0 to obtain a binary labeled image. At the same time, the contrast-enhanced image and the binary labeled image are integrated to obtain multiple standard angle images, and a standardized image data matrix is constructed based on the multiple standard angle images.
[0045] Specifically, the surface of the building shear wall is imaged to obtain image information collected from different perspectives. By using a camera device with multi-viewing capabilities, the surface of the shear wall is imaged, and the viewing angles include 90 degrees forward, 45 degrees to the left, and 45 degrees to the right. Assume that the original images obtained under the three viewing angles are and , these images form a multi-angle original image set, denoted as . For the original image set from multiple angles Perform regional segmentation to extract the target monitoring area of the shear wall. Remove irrelevant information in the image, such as the background, light source or other structures around the wall, so that the model training and analysis are focused on the crack area of the shear wall. Use image segmentation algorithms, such as threshold-based methods or semantic segmentation using convolutional neural networks (such as U-Net) to obtain the target monitoring area image at each perspective. Assume that the image of each target monitoring area is , the target area images constitute a new set . Image of target monitoring area Perform proportional cropping and pixel resampling to obtain an image of uniform size. Proportional cropping can maintain the geometric characteristics of the original crack without distortion. Assume that the target size is ,in and Represents the height and width of the image respectively. In order to achieve proportional cropping and pixel resampling, the size transformation is performed by the following formula:
[0046] ;
[0047] in, represents the image resampling function, is the input target monitoring area image, and is the output uniform size image. After the above operation, the target monitoring area under each viewing angle is converted to the same size to ensure the consistency of the image input data. Perform illumination compensation on the uniform size image to eliminate the influence of illumination differences under different shooting conditions on the image quality and obtain an illumination normalized image. Assume represents the original image, Represents the average brightness of the image, and the target average brightness is , the illumination compensation is expressed as:
[0048] ;
[0049] in, is the image after illumination compensation. Through this formula, the overall brightness of the image reaches a standardized level. The pixel values of the local area of the illumination normalized image are sorted and the median is extracted to obtain the filtered image. The image is divided into several small windows, and then the pixel values in each window are sorted, and the middle value is selected as the output value to effectively remove noise. Assume that the window size is , then the median filter is defined as:
[0050] ;
[0051] in, represents the image after filtering, This filtering method can suppress random noise and enhance the image quality while retaining the edge information of the image. The filtered image is divided into multiple image blocks, and a histogram equalization operation is performed on each image block to obtain a contrast-enhanced image. Assume that the filtered image is , divide it into several image blocks, each image block is recorded as ,in Represents the position index of the image block in the horizontal and vertical directions. For each image block, the contrast is enhanced by histogram equalization operation. Histogram equalization is implemented by the following formula:
[0052] ;
[0053] in, is the image after equalization processing. is the gray level of the image, and are the width and height of the image block, The gray value is The histogram equalization makes the brightness distribution of the image more uniform and enhances the contrast between the crack area and the background area in the image. The image after contrast enhancement is binarized and the pixel value of the crack area is marked as 1, while the pixel value of the non-crack area is marked as 0 to obtain a binary label image. Suppose the image after contrast enhancement is , by setting the threshold Binarization:
[0054] ;
[0055] in, Represents the binarized label image. The contrast-enhanced image and the binarized label image are integrated to obtain images of multiple standard angles, and a standardized image data matrix is constructed for subsequent model training and crack classification.
[0056] In a specific embodiment, the process of executing step 102 may specifically include the following steps:
[0057] According to the motion blur degradation model, multiple standardized angle images in the standardized image data matrix are degraded, the blur kernel length is set to be uniformly sampled in the range of 5-15 pixels, the blur angle is randomly sampled in the range of 0-180 degrees, and a convolution operation is performed on each standardized angle image to obtain a motion blur degradation matrix;
[0058] Gaussian noise is added based on the motion blur degradation matrix, the noise mean is set to 0, the standard deviation is randomly sampled in the range of 0.01-0.05, and Gaussian distribution noise is superimposed on the image pixel value of each standardized angle image to obtain a Gaussian noise degradation matrix;
[0059] The Gaussian noise degradation matrix is processed for illumination changes. By transforming the brightness gain and contrast gain of each standardized angle image, the brightness gain coefficient is randomly sampled in the range of 0.8-1.2, and the contrast gain coefficient is randomly sampled in the range of 0.9-1.1, and the illumination change degradation matrix is obtained.
[0060] The illumination change degradation matrix is input into the geometric deformation processing module, and perspective transformation and scale transformation are performed on each standardized angle image. The perspective transformation angle is randomly sampled in the range of -10 degrees to 10 degrees, and the scale transformation ratio is randomly sampled in the range of 0.9-1.1 to obtain the geometric deformation degradation matrix;
[0061] Based on the geometric deformation degradation matrix, a degradation model combination pool is constructed. Four degradation models, namely motion blur, Gaussian noise, illumination change, and geometric deformation, are randomly selected and combined. Multiple degradation superposition processing is performed on each standardized angle image to obtain a multiple degraded image set.
[0062] Multi-angle image fusion is performed on multiple degraded image sets, and the degraded images collected from different viewing angles in the same shear wall area and their corresponding labels are combined and spliced to obtain target enhanced image data.
[0063] Specifically, multiple standardized angle images in the standardized image data matrix are degraded according to the motion blur degradation model. For each standardized angle image, the length of the blur kernel is set The blur kernel length is uniformly sampled in the range of 5 to 15 pixels. Reflects the degree of blur when simulating motion, for example, a longer blur kernel indicates the blurring effect caused by fast movement, while a shorter blur kernel indicates slight motion. Random sampling in the range of 0 to 180 degrees to simulate motion effects in different directions. The random selection of is to make the degraded image have more diverse blur directions, reflecting the camera jitter phenomenon in different directions in reality. The convolution operation process is expressed by the following formula:
[0064] ;
[0065] in, represents the normalized input image, represents the blur kernel, with a size of , and rotate to the angle , the symbol * represents the convolution operation. Through this operation, the motion blur degradation matrix is obtained For example, if the blur kernel length is 10 pixels and the blur angle is 45 degrees, is a linear kernel with a length of 10 and a direction of 45 degrees to the horizontal direction. Gaussian noise is added to the image based on the motion blur degradation matrix. Gaussian noise is a common form of degradation used to simulate random noise interference of image sensors. Assume that the mean of Gaussian noise is 0 and the standard deviation is Random sampling is performed in the range of 0.01 to 0.05 to reflect different degrees of noise interference. The process of adding Gaussian noise is expressed as:
[0066] ;
[0067] in, The mean is 0 and the standard deviation is Gaussian noise, is the degradation matrix after adding Gaussian noise. For example, if the standard deviation The random sampling is 0.03, which means that the added noise has a strong disturbance effect, so it can better simulate the noise interference of images in complex environments. The Gaussian noise degradation matrix is processed with illumination changes to simulate the imaging effect under different illumination conditions. The illumination change processing includes two parts: brightness gain and contrast gain. Suppose the brightness gain coefficient The contrast gain factor is randomly sampled in the range of 0.8 to 1.2. Random sampling in the range of 0.9 to 1.1, the image after the illumination change is represented as:
[0068] ;
[0069] in, represents the degraded image after the illumination change, and Control the gain of brightness and contrast respectively. For example, if and , the brightness of the image will increase by 10% and the contrast will also increase slightly. This operation enables the model to adapt to different lighting environments, thereby improving the robustness of the model in practical applications. The illumination change degradation matrix is input into the geometric deformation processing module to perform perspective transformation and scale transformation on each standardized angle image. Perspective transformation is used to simulate the deformation caused by changes in the image shooting angle, while scale transformation is used to simulate the effect of shooting at different distances. Suppose the perspective transformation angle Random sampling in the range of -10 degrees to 10 degrees, scale transformation ratio Random sampling in the range of 0.9 to 1.1, the perspective transformation is done by the transformation matrix accomplish:
[0070] ;
[0071] The scale transformation is done by scaling the matrix accomplish:
[0072] ;
[0073] For example, if the perspective transformation angle is 5 degrees and the scale transformation ratio is 0.95, the perspective transformation will simulate the effect of the camera slightly tilted, while the scale transformation means that the field of view of the image is slightly reduced. It can make the image contain feature information of different geometric angles and enhance the adaptability of the model to complex deformation. Based on the geometric deformation degradation matrix, a degradation model combination pool is constructed. The degradation model combination pool contains four degradation models: motion blur, Gaussian noise, illumination change, and geometric deformation. Random selection and combination are performed to perform multiple degradation superposition processing on each standardized angle image. Assuming that the randomly selected degradation combination is motion blur, Gaussian noise, and illumination change, the multiple degraded images obtained are It is expressed by the following formula:
[0074] ;
[0075] in, Represent the processing functions of motion blur, Gaussian noise and illumination change respectively. Through multiple degradation superposition, the image contains more complex degradation effects, enhancing the diversity of data and the generalization ability of the model. After obtaining the multiple degraded image sets, multi-angle image fusion processing is performed. The degraded images collected from different viewing angles of the same shear wall area and their corresponding labels are combined and spliced to form the final target enhanced image data. Assume that the degraded images obtained at three viewing angles of 90 degrees forward, 45 degrees on the left and 45 degrees on the right are , then the target enhanced image data It is expressed as:
[0076] ;
[0077] Through the splicing operation, multi-perspective information is fused, so that the model can simultaneously learn the crack characteristics from different perspectives and improve the comprehensive recognition ability of cracks.
[0078] In a specific embodiment, the process of executing step 103 may specifically include the following steps:
[0079] The target enhanced image data is input into the first residual block of the feature extraction subnetwork in the convolutional denoising autoencoder, where the first residual block contains two 3×3 convolutional layers connected in series, the number of output channels of the first convolutional layer is 64, the number of output channels of the second convolutional layer is 64, and the residual connection uses 1×1 convolution for channel matching to obtain the first layer feature map;
[0080] The first layer feature map is input into the second residual block of the feature extraction subnetwork for processing, where the second residual block contains two 3×3 convolutional layers connected in series. The number of output channels of the first convolutional layer is 128, and the number of output channels of the second convolutional layer is 128. Each convolutional layer is followed by a batch normalization layer and a LeakyReLU activation function to obtain the second layer feature map.
[0081] The second layer feature map is input into the third residual block of the feature extraction subnetwork, where the third residual block contains two 3×3 convolutional layers connected in series, the number of output channels of the first convolutional layer is 256, and the number of output channels of the second convolutional layer is 256. The input feature map and the residual block output are element-wise added through a short-circuit connection to obtain the third layer feature map;
[0082] Perform channel attention calculation on the third-layer feature map to obtain the channel weight vector, and perform broadcast multiplication of the channel dimension on the channel weight vector and the third-layer feature map to obtain the channel weighted feature map. Then, the channel weighted feature map is input into the spatial attention module, and a spatial weight map is generated through a 7×7 convolution layer. The output channel number of the 7×7 convolution layer is 1, and it is normalized by the Sigmoid function.
[0083] The spatial weight map is broadcast multiplied with the channel weighted feature map in the spatial dimension to obtain the attention enhanced feature map, which is then upsampled through a deconvolution layer with a deconvolution kernel size of 4×4, a step size of 2, and an output channel number of 512. It is then processed through batch normalization and ReLU activation function to obtain an upsampled feature map.
[0084] The upsampled feature map is concatenated with the skip connection feature of the corresponding encoding stage in the channel dimension, and then the feature is reconstructed through two serially connected deconvolution layers to obtain the reconstructed feature map. The output channel number of the first deconvolution layer is 256, the output channel number of the second deconvolution layer is 128, the convolution kernel size of each deconvolution layer is 4×4, and the stride is 2;
[0085] The reconstructed feature map is deconvolved with a kernel size of 4×4 and a step size of 2 to obtain a denoised feature image matrix.
[0086] Specifically, the target enhanced image data is input into the first residual block in the feature extraction subnetwork of the convolutional denoising autoencoder. The first residual block contains two serial Convolutional layer, assuming the input image data is The number of output channels of the first convolutional layer is 64, and the first convolution operation is expressed as:
[0087] ;
[0088] in, Represents the weight of the convolution kernel, and its size is , is the number of input channels, the symbol * indicates the convolution operation, is the bias term. Then Enter the second In the convolution layer, the number of output channels of this layer is also 64, and the second layer convolution feature is obtained :
[0089] ;
[0090] In order to realize the residual connection, the input features With output features Add, using a The convolution is used to perform channel matching. This process is expressed as:
[0091] ;
[0092] in, The size is . Then the matched input features are compared with Add together to get the first layer feature map :
[0093] ;
[0094] The first layer feature map The second residual block also contains two series of The number of output channels of the convolution layer, the first convolution layer, and the second convolution layer is 128. Through convolution operation and batch normalization, the intermediate features are obtained:
[0095] ;
[0096] Among them, BN stands for batch normalization, which is used to stabilize the training process and accelerate convergence. Activation is performed through the LeakyReLU activation function:
[0097] ;
[0098] Similarly, the activated feature Enter the second In the convolutional layer, the output features are recorded as , and then processed by batch normalization and LeakyRelU activation:
[0099] ;
[0100] ;
[0101] Thus, the second layer feature map is obtained . The second layer feature map The third residual block is input to the feature extraction sub-network for processing. The third residual block also contains two series The number of output channels of the convolution layer, the first convolution layer and the second convolution layer is 256. The intermediate features are obtained through convolution operation:
[0102] ;
[0103] After batch normalization and activation:
[0104] ;
[0105] After the second The convolutional layer obtains the output features :
[0106] ;
[0107] After the second The convolutional layer obtains the output features :
[0108] ;
[0109] In this layer, a short-circuit connection method is used to connect the input features And the residual block output Perform element-level addition to obtain the third-layer feature map :
[0110] ;
[0111] Perform channel attention calculation on the third layer feature map. Perform global average pooling and transform the feature map Compressed to a vector of channel dimensions :
[0112] ;
[0113] in, and are the height and width of the feature map, respectively. Indicates the channel index. Input two fully connected layers. The output dimension of the first fully connected layer is 16, and the output dimension of the second fully connected layer is 256. The ReLU activation function is used in the middle, and the channel weight vector is generated by the Sigmoid function.
[0114] ;
[0115] Combine the channel weight vector with the third layer feature map Perform a broadcast multiplication operation in the channel dimension to obtain the channel weighted feature map:
[0116] ;
[0117] The channel weighted feature map is input into the spatial attention module through a The convolution layer generates a spatial weight map. The number of output channels of the convolution layer is 1. The spatial weight map is obtained after normalization by the Sigmoid function. :
[0118] ;
[0119] Then the spatial weight map is broadcast multiplied with the channel weighted feature map in the spatial dimension to obtain the attention enhanced feature map:
[0120] ;
[0121] The attention-enhanced feature map is upsampled by the deconvolution layer, and the deconvolution kernel size is , the step size is 2, the number of output channels is 512, and then processed by batch normalization and ReLU activation function to obtain the upsampled feature map:
[0122] ;
[0123] The upsampled feature map is concatenated with the skip connection feature in the encoding stage in the channel dimension to obtain a fused feature map. The fused feature map is reconstructed through two serially connected deconvolution layers. The output channel number of the first deconvolution layer is 256, and the convolution kernel size is , with a step size of 2, the output is:
[0124] ;
[0125] After the second deconvolution layer, the number of output channels is 128 and the convolution kernel size is , the step size is 2, and the reconstructed feature map is obtained:
[0126] ;
[0127] The reconstructed feature map is deconvolved, and the deconvolution kernel size is , with a step size of 2, the denoised feature image matrix is obtained:
[0128] .
[0129] In a specific embodiment, the process of executing step 104 may specifically include the following steps:
[0130] The denoised feature image matrix is divided into P×P overlapping blocks, where P is 16 and the overlap rate of adjacent blocks is 50%. Each overlapping block is subjected to feature aggregation through maximum pooling and average pooling to obtain a local feature set.
[0131] Construct a K-nearest neighbor graph for the local feature set, set the K value to 16, calculate the similarity matrix between each node and other nodes based on cosine similarity, take the K nodes with the highest similarity as the neighborhood points of the central node, and obtain the dynamic adjacency matrix;
[0132] The dynamic adjacency matrix is input into the edge feature calculation module, and the edge features between the central node and its K neighboring nodes are calculated to obtain the edge feature matrix;
[0133] Perform graph attention calculation on the edge feature matrix, and obtain the attention weight matrix by multiplying the attention vector and the feature transformation matrix;
[0134] The attention weight matrix and the edge feature matrix are weighted aggregated, and the K neighborhood features of each node are weighted summed. The features are transformed through a three-layer graph convolutional network with a convolution kernel size of 1×1 and the number of output channels of [128, 256, 512] to obtain the local crack feature matrix.
[0135] Perform global graph convolution operations on local aggregated features to build a complete graph structure. Each node is connected to all other nodes. Global information interaction is performed through two layers of graph convolution layers. The convolution kernel size is 1×1 and the number of output channels is [512, 1024] to obtain the global crack feature matrix.
[0136] The local crack feature matrix and the global crack feature matrix are fused to obtain a fused feature matrix.
[0137] Specifically, the denoised feature image matrix is divided into overlapping blocks, where , and the overlap rate of adjacent blocks is 50%, ensuring that the boundary information of each image block will not be lost, thereby capturing the continuity characteristics of the crack area. Suppose the denoised feature image matrix is , divide it into multiple overlapping image blocks, denoted as ,in Represent the horizontal and vertical indices of the image block respectively. Each image block is subjected to feature aggregation through the maximum pooling and average pooling operations to capture features of different scales. The maximum pooling operation takes the maximum value in the image block to retain the most significant features, and the average pooling operation calculates the mean of the pixel values in the image block to smooth the features. Let the feature after maximum pooling be The feature after average pooling is , then the final local feature It is expressed as:
[0138] ;
[0139] in, Represents the concatenation operation of features, and the local feature set obtained Contains the features of all image blocks and can effectively represent the local information of the crack. conduct Neighborhood graph construction, settings , that is, each node is connected to the other 16 nodes to form a local graph structure. Neighbor graph, calculate the similarity matrix between each node and other nodes based on cosine similarity. Let the two eigenvectors be and , then the cosine similarity between them It is expressed as:
[0140] ;
[0141] Among them, · represents the dot product operation of the vector, Represents the modulus of the feature vector. By calculating the cosine similarity matrix , take the node with the highest similarity nodes as the neighborhood points of the node, and obtain the dynamic adjacency matrix The dynamic adjacency matrix dynamically selects neighbors based on the similarity of node features, thus more flexibly adapting to the complex morphology of cracks. Input to the edge feature calculation module to calculate the relationship between each central node and its The edge features between neighboring nodes. Let the feature of the central node be , the characteristics of its neighborhood nodes are , then the edge features Expressed as the difference between the two:
[0142] ;
[0143] The representation of edge features can effectively reflect the feature differences between nodes, thereby capturing the local change information of the cracks. The edge feature matrix obtained is Contains the difference features between each node and its neighborhood. Perform graph attention calculation on the edge feature matrix, and obtain the attention weight matrix by multiplying the attention vector and the feature transformation matrix. Suppose the edge feature matrix is , the attention vector is , then the attention weight It is expressed as:
[0144] ;
[0145] Among them, the softmax function is used to normalize the attention score into a probability value. represents the transpose of the attention vector. In this way, the attention weight matrix can weight each edge feature to highlight the features that are more useful for crack identification. The attention weight matrix is weighted and aggregated with the edge feature matrix to obtain the weight of each node. The neighborhood features are weighted summed to obtain the aggregated node features:
[0146] ;
[0147] in, Representation Node The aggregated node features are transformed through a three-layer graph convolutional network, and the convolution kernel size is , the number of output channels is [128, 256, 512] respectively. Suppose the weight matrix of the graph convolution layer is ,in Indicates Layer convolution, the output feature of each layer is expressed as:
[0148] ;
[0149] in, Represents the activation function, usually the ReLU activation function is selected. is the bias term. After three layers of graph convolution feature transformation, the local crack feature matrix is finally obtained. , which contains a high-level representation of local information. Then, a global graph convolution operation is performed on the local aggregated features to build a complete graph structure so that each node is connected to all other nodes to achieve global information interaction. The global graph convolution is implemented through two layers of graph convolution layers, and the convolution kernel size is also , the number of output channels is [512,1024]. Suppose the weight matrix of the global convolutional layer is , then the feature representation after global information interaction is:
[0150] ;
[0151] The role of global convolution is to combine the node information in the global scope so that each node can perceive the crack characteristics of the entire graph. After two layers of global convolution, the global crack feature matrix is obtained. , which contains a high-level representation of global information. The local crack feature matrix and the global crack feature matrix are fused by splicing the channel dimension to obtain the fused feature matrix.
[0152] In a specific embodiment, the execution step performs feature fusion on the local crack feature matrix and the global crack feature matrix to obtain the fused feature matrix, which may specifically include the following steps:
[0153] The local crack feature matrix and the global crack feature matrix are respectively extracted through the first layer of the pyramid, where the first layer of the pyramid contains a 1×1 convolution layer with 1024 input channels, 256 output channels, and a step size of 1. The initial local feature map and the initial global feature map are obtained through the ReLU activation function.
[0154] The initial local feature map and the initial global feature map are respectively input into the upsampling module, and are upsampled by 2 times by the nearest neighbor interpolation method, and then pass through a 3×3 convolution layer with SAME padding, 256 input channels, 256 output channels, and a step size of 1, followed by a batch normalization layer and a ReLU activation function to obtain an upsampled local feature map and an upsampled global feature map;
[0155] The upsampled local feature map and the upsampled global feature map are fused to obtain a fused feature map, which is then input into the channel attention module. The feature is first compressed into a 1×1×256 vector through global average pooling, and then passed through two fully connected layers. The output dimension of the first fully connected layer is 16, and the output dimension of the second fully connected layer is 256. The ReLU activation function is used in the middle, and finally the channel weight vector is generated through the Sigmoid function and the feature is recalibrated to obtain the channel enhanced feature.
[0156] Perform non-local attention calculation on the channel enhancement features to obtain spatial enhancement features, and input the spatial enhancement features into the feature pyramid aggregation module. The feature pyramid aggregation module contains four parallel branches, each of which is a 3×3 convolutional layer with 128 input channels and 128 output channels. The output of each branch is processed by batch normalization and ReLU activation function to obtain a multi-scale feature group.
[0157] The four branch features in the multi-scale feature group are spliced in the channel dimension to obtain a multi-level feature set, and the multi-level feature set is upsampled to the same resolution through the nearest neighbor interpolation method to obtain a fused feature matrix.
[0158] Specifically, the first layer of the pyramid structure is used to extract features from the local crack feature matrix and the global crack feature matrix. The first layer of the pyramid contains a The convolution layer has 1024 input channels, 256 output channels, and a stride of 1. The operation is expressed as:
[0159] ;
[0160] ;
[0161] in, and Respectively represent the input local crack feature matrix and global crack feature matrix, and for The weight matrix of the convolution, and is a bias term, and the nonlinear expression ability of the feature is enhanced through the ReLU activation function to obtain the initial local feature map and the initial global feature map The initial local feature map and the initial global feature map are input into the upsampling module respectively, and upsampled by 2 times by the nearest neighbor interpolation method. The nearest neighbor interpolation is an upsampling method that can quickly enlarge the size of the feature map by two times and maintain the original feature information. Assume that the feature maps after upsampling are and Then these two upsampled feature maps are passed through a The convolution operation is performed on the convolution layer. The number of input channels of the convolution kernel is 256, the number of output channels is 256, the step size is 1, and the padding method is SAME to keep the spatial size of the feature map consistent:
[0162] ;
[0163] ;
[0164] Among them, BN stands for batch normalization, which standardizes the features to accelerate convergence and stabilize the training process. Finally, the upsampled local feature map is obtained by ReLU activation function. And upsample the global feature map The upsampled local feature map and the upsampled global feature map are fused to obtain a fused feature map. The fusion operation is achieved by splicing the channel dimension to obtain a fused feature map:
[0165] ;
[0166] The fused feature map is input into the channel attention module, and the feature map is compressed into The calculation of global average pooling is expressed as:
[0167] ;
[0168] in, and Represent the height and width of the feature map respectively, is the channel index. The vector after global average pooling The input is sent to two fully connected layers. The output dimension of the first fully connected layer is 16, and the output dimension of the second fully connected layer is 256. After the first fully connected layer, the ReLU activation function is used, and after the second fully connected layer, the channel weight vector is generated by the Sigmoid function:
[0169] ;
[0170] in, and is the weight matrix of the fully connected layer, and is the bias term, Represents the Sigmoid function, which is used to normalize the weight value to the range of [0,1]. The fusion feature map is recalibrated by the generated channel weight vector to obtain the channel enhancement feature:
[0171] ;
[0172] Non-local attention is calculated on the channel enhancement feature to improve the expressiveness of the feature. The non-local attention mechanism captures long-distance dependencies by calculating the relationship between any two positions in the feature map to generate spatial enhancement features. Suppose the channel enhancement feature is , the calculation of non-local attention is expressed as:
[0173] ;
[0174] in, represents the function used to calculate similarity, such as the dot product operation, represents the function that transforms the features, is a factor used for normalization to ensure that the sum of all weights is 1, and finally the spatial enhanced features are obtained The spatial enhancement features are input into the feature pyramid aggregation module. The feature pyramid aggregation module consists of four parallel The convolution layer branch has 128 input channels and 128 output channels. Each branch performs a convolution operation on the input features and processes them with batch normalization and ReLU activation function to obtain a multi-scale feature group:
[0175] ;
[0176] Through these four parallel convolution branches, features are extracted at different scales to capture the multi-scale information of the crack. The four branch features in the multi-scale feature group are spliced in the channel dimension to obtain a multi-level feature set. :
[0177] ;
[0178] The multi-level feature set is upsampled by the nearest neighbor interpolation method to make the resolution of all features consistent and obtain the fused feature matrix Nearest neighbor interpolation doubles the resolution of multi-level features so that they can match the spatial size of the original input image.
[0179] In a specific embodiment, the process of executing step 105 may specifically include the following steps:
[0180] Input the fused feature matrix into the first convolution branch of the dual branches of the twin metric learning network. The first convolution branch contains 6 convolution blocks. The first convolution block contains a 3×3 convolution layer, with 512 input channels, 64 output channels, 1 stride, and SAME padding to obtain the first layer of convolution features.
[0181] The first layer of convolution features are input into the second convolution block to the sixth convolution block in sequence. The number of output channels of the second convolution block to the sixth convolution block are 128, 256, 512, 512, 512 respectively. The convolution kernel size of each convolution block is 3×3, the step size is 1, and the padding method is SAME, and the target feature of the first branch is obtained;
[0182] The fused feature matrix is input into the second convolution branch in the dual branches of the twin metric learning network. The second convolution branch has the same structure as the first convolution branch and uses the weight parameters shared with the first convolution branch to obtain the target features of the second branch.
[0183] Perform global context attention calculation on the first branch target feature and the second branch target feature respectively to obtain a first enhanced feature and a second enhanced feature;
[0184] The first enhanced feature and the second enhanced feature are input into the two-stream metric module, the first stream calculates the Euclidean distance, the second stream calculates the cosine similarity, the two distance values are connected in series and fused through the fully connected layer to obtain a fused distance vector;
[0185] Perform triplet constraint optimization on the fused distance vector. For each anchor sample a, select positive samples p in the same category and negative samples n in different categories, calculate the triplet loss, and obtain the optimized distance matrix.
[0186] Perform density clustering analysis on the optimized distance matrix. First, calculate the local density of each sample point, then calculate the minimum distance from each point to a point with higher density, determine the cluster center through the decision diagram, and obtain the initial category division result.
[0187] The initial classification results are finely classified, the Mahalanobis distance between the center of each category and the sample point is calculated, the classification threshold is set to twice the standard deviation of the mean distance within the class, the category attribution is confirmed and adjusted, and the target crack classification results are output.
[0188] Specifically, the fusion feature matrix Input to the first convolution branch in the dual branch of the twin metric learning network. The twin network is a neural network structure that is effective for feature similarity measurement. Its core is to extract features through a dual-branch convolution module with shared weights and calculate the distance between features. The first convolution branch contains six convolution blocks, of which the first convolution block consists of a The convolution layer consists of 512 input channels, 64 output channels, 1 stride, and SAME padding. This convolution operation is expressed as:
[0189] ;
[0190] in, represents the first layer of convolutional features, is the convolution kernel weight of the first convolution block, and its size is 64, is a bias term, * represents a convolution operation, and BN represents batch normalization, which is used to accelerate network training. The activation function is used to enhance the nonlinearity of the network. The first layer of convolution features is input into the second to sixth convolution blocks in sequence. The number of output channels of the second to sixth convolution blocks are 128, 256, 512, 512, 512, respectively. The convolution kernel size of each convolution block is , the step length is 1, and the filling method is SAME. The feature extraction process of a convolutional block is expressed as:
[0191] ;
[0192] Through the layer-by-layer extraction of these six convolutional blocks, the changes of crack features at different spatial scales can be effectively captured, and the target features of the first branch can be obtained. At the same time, the fusion feature matrix Input to the second convolution branch of the twin network. The structure of the second convolution branch is exactly the same as the first convolution branch, and shares the same weight parameters to ensure that the two branches maintain consistency in feature extraction for different inputs. Through the same convolution operation, the second convolution branch outputs the target features of the second branch. The design of shared weights ensures the consistency of feature extraction, so that the twin network can perform reliable similarity measurement. and the second branch target feature Perform global context attention calculation to obtain the first enhanced feature And the second enhancement feature The global context attention mechanism aggregates the context information of the entire feature map, allowing the network to better focus on important feature areas. The calculation of global context attention is expressed as:
[0193] ;
[0194] in, Indicates location Feature pair position The importance weight of is calculated by the soft attention mechanism. In this way, the enhanced features obtained can better highlight the significant information of the crack area. And the second enhancement feature Input to the two-stream metric module. In the two-stream metric module, the first stream is used to calculate the Euclidean distance between the two enhanced features, and the second stream is used to calculate the cosine similarity between them. Euclidean distance The calculation is expressed as:
[0195] ;
[0196] in, and The first and second enhancement features are represented by The value of each channel. Cosine similarity The calculation is expressed as:
[0197] ;
[0198] Among them, · represents the dot product operation of the vector, Represents the modulus of the vector. The two distance values, Euclidean distance and cosine similarity, are connected in series and fused through a fully connected layer to obtain a fused distance vector:
[0199] ;
[0200] in, and Represent the weight and bias of the fully connected layer respectively. The fused distance vector can contain feature information based on distance and similarity at the same time, so as to measure the relationship between two features more comprehensively. The fused distance vector is optimized with triple constraints to improve the discrimination between different categories in the feature space. For each anchor sample , select positive samples in the same category and negative samples in different categories , the distance matrix is optimized by calculating the triplet loss. The triplet loss is defined as:
[0201] ;
[0202] in, Represents anchor samples With positive samples The distance between Represents anchor samples With negative samples The distance between is a predefined margin parameter used to ensure that the distance between positive samples is smaller than that between negative samples. Through triple constraint optimization, the distance between samples of the same category is minimized, while the distance between samples of different categories is maximized, thereby enhancing the distinguishing ability of features and obtaining an optimized distance matrix. Density clustering analysis is performed on the optimized distance matrix to calculate the local density of each sample point. Assume that the sample point The local density is , obtained by calculating the number of neighbors within a certain radius around the sample point:
[0203] ;
[0204] in, Represents sample points and The distance between is a predefined distance threshold, is the indicator function, when 0, 1, otherwise 0. Calculate the minimum distance from each point to a point with higher density :
[0205] ;
[0206] The cluster center is determined by the decision diagram, and the point with higher local density and farther distance is selected as the cluster center to obtain the initial classification result. The initial classification result is finely classified, and the Mahalanobis distance between each category center and the sample point is calculated to better measure the belonging relationship of the sample point relative to the category center. Let the category center be , the sample points are , the covariance matrix is , then the Mahalanobis distance is expressed as:
[0207] ;
[0208] In order to ensure the accuracy of classification, the classification threshold is set to twice the standard deviation of the mean distance within the class, and the sample points exceeding the threshold are redistributed to confirm and adjust the category attribution, and finally the target crack classification result is output.
[0209] The above describes the crack identification and analysis method of the building shear wall in the embodiment of the present invention. The following describes the crack identification and analysis system of the building shear wall in the embodiment of the present invention. Figure 2 In one embodiment of the present invention, a crack identification and analysis system for a building shear wall includes:
[0210] The shooting module 201 is used to shoot the surface of the building shear wall from multiple angles and perform image standardization processing to obtain a standardized image data matrix;
[0211] A combination module 202 is used to perform multi-model degradation processing and multi-angle image combination on the standardized image data matrix to obtain target enhanced image data;
[0212] The separation module 203 is used to input the target enhanced image data into the convolution denoising autoencoder for noise separation to obtain a denoised feature image matrix;
[0213] The extraction module 204 is used to input the denoised feature image matrix into the dynamic graph convolutional neural network to extract local features and global features, obtain a local crack feature matrix and a global crack feature matrix, and perform feature fusion on the local crack feature matrix and the global crack feature matrix to obtain a fused feature matrix;
[0214] The classification module 205 is used to input the fused feature matrix into the twin metric learning network for feature measurement and crack classification, and output the target crack classification result.
[0215] Through the synergy of the above components, through multi-angle shooting and standardization processing, combined with multi-model degradation and data enhancement strategies, the problem of unstable quality of crack image acquisition in complex environments is effectively solved, and the adaptability of the recognition algorithm to different imaging conditions is significantly improved. The improved convolutional denoising autoencoder is used for noise separation. Through the organic combination of residual structure and attention mechanism, the model's ability to extract crack features is enhanced, and the interference of environmental noise is effectively reduced. The dynamic graph convolutional neural network is innovatively applied to crack feature extraction. Through the joint learning of local features and global features, the deep semantic information between crack regions is effectively captured. A multi-scale feature fusion mechanism based on pyramid structure is designed, and the efficient integration of crack features of different scales is achieved through the dual enhancement of channel attention and spatial attention. A crack classification strategy based on twin metric learning is proposed. Through triple loss constraints and density clustering optimization, a high classification accuracy can still be achieved under small sample conditions. The present invention has obvious advantages over existing algorithms and shows strong generalization ability for cracks of different types and degrees.
[0216] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, systems and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0217] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0218] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for identifying and analyzing cracks in a building shear wall, characterized in that: The method comprises: The surface of the building shear wall is photographed at multiple angles and image standardized to obtain a standardized image data matrix; Performing multi-model degradation processing and multi-angle image combination on the standardized image data matrix to obtain target enhanced image data; Inputting the target enhanced image data into a convolutional denoising autoencoder for noise separation to obtain a denoised feature image matrix; Inputting the denoised feature image matrix into a dynamic graph convolutional neural network to extract local features and global features to obtain a local crack feature matrix and a global crack feature matrix, and performing feature fusion on the local crack feature matrix and the global crack feature matrix to obtain a fused feature matrix; The fused feature matrix is input into the twin metric learning network for feature measurement and crack classification, and the target crack classification result is output.
2. The method for identifying and analyzing cracks in a building shear wall according to claim 1, characterized in that: The surface of the building shear wall is photographed at multiple angles and image standardized to obtain a standardized image data matrix, including: The surface of the building shear wall is imaged to obtain a multi-angle original image set including three viewing angles of 90 degrees forward, 45 degrees on the left, and 45 degrees on the right; Performing region segmentation on the multi-angle original image set to obtain a target monitoring region image, and performing proportional cropping and pixel resampling processing on the target monitoring region image to obtain a uniform size image; Performing illumination compensation on the uniform-size image to obtain an illumination normalized image, and performing local area pixel value sorting and median extraction on the illumination normalized image to obtain a filtered processed image; Dividing the filtered image into a plurality of image blocks, and performing a histogram equalization operation on each image block to obtain a contrast enhanced image; The contrast enhanced image is binarized and annotated, and the pixel value of the crack area is marked as 1, and the pixel value of the non-crack area is marked as 0 to obtain a binary labeled image. At the same time, the contrast enhanced image and the binary labeled image are integrated to obtain a plurality of standard angle images, and a standardized image data matrix is constructed according to the plurality of standard angle images.
3. The method for identifying and analyzing cracks in a building shear wall according to claim 2, characterized in that: The step of performing multi-model degradation processing and multi-angle image combination on the standardized image data matrix to obtain target enhanced image data includes: Degrading the multiple standardized angle images in the standardized image data matrix according to the motion blur degradation model, setting the blur kernel length to be uniformly sampled in the range of 5-15 pixels, and setting the blur angle to be randomly sampled in the range of 0-180 degrees, and performing convolution operation on each standardized angle image to obtain a motion blur degradation matrix; Gaussian noise is added based on the motion blur degradation matrix, the noise mean is set to 0, the standard deviation is randomly sampled in the range of 0.01-0.05, and Gaussian distribution noise is superimposed on the image pixel values of each standardized angle image to obtain a Gaussian noise degradation matrix; The Gaussian noise degradation matrix is subjected to illumination change processing, by performing brightness gain and contrast gain transformation on each standardized angle image, the brightness gain coefficient is randomly sampled in the range of 0.8-1.2, and the contrast gain coefficient is randomly sampled in the range of 0.9-1.1, to obtain an illumination change degradation matrix; The illumination change degradation matrix is input into the geometric deformation processing module, and perspective transformation and scale transformation are performed on each standardized angle image. The perspective transformation angle is randomly sampled in the range of -10 degrees to 10 degrees, and the scale transformation ratio is randomly sampled in the range of 0.9-1.1 to obtain the geometric deformation degradation matrix; Based on the geometric deformation degradation matrix, a degradation model combination pool is constructed, four degradation models including motion blur, Gaussian noise, illumination change, and geometric deformation are randomly selected and combined, and multiple degradation superposition processing is performed on each standardized angle image to obtain a multiple degraded image set; Multi-angle image fusion is performed on the multiple degraded image sets, and the degraded images collected from different viewing angles in the same shear wall area and their corresponding labels are combined and spliced to obtain target enhanced image data.
4. The method for identifying and analyzing cracks in a building shear wall according to claim 3, characterized in that: The step of inputting the target enhanced image data into a convolutional denoising autoencoder for noise separation to obtain a denoised feature image matrix comprises: Input the target enhanced image data into the first residual block of the feature extraction subnetwork in the convolutional denoising autoencoder, wherein the first residual block comprises two 3×3 convolutional layers connected in series, the number of output channels of the first convolutional layer is 64, the number of output channels of the second convolutional layer is 64, and the residual connection uses 1×1 convolution for channel matching to obtain a first layer feature map; Inputting the first layer feature map into the second residual block of the feature extraction subnetwork for processing, wherein the second residual block comprises two 3×3 convolutional layers connected in series, the number of output channels of the first convolutional layer is 128, the number of output channels of the second convolutional layer is 128, each convolutional layer is followed by a batch normalization layer and a LeakyReLU activation function is passed to obtain the second layer feature map; Input the second layer feature map into the third residual block of the feature extraction subnetwork, wherein the third residual block includes two 3×3 convolutional layers connected in series, the number of output channels of the first convolutional layer is 256, the number of output channels of the second convolutional layer is 256, and the input feature map and the residual block output are element-wise added through a short-circuit connection to obtain the third layer feature map; Perform channel attention calculation on the third-layer feature map to obtain a channel weight vector, and perform broadcast multiplication operation on the channel weight vector and the third-layer feature map in the channel dimension to obtain a channel weighted feature map, and then input the channel weighted feature map into the spatial attention module, and generate a spatial weight map through a 7×7 convolution layer, the output channel number of the 7×7 convolution layer is 1, and normalized by a Sigmoid function; Performing a broadcast multiplication operation on the spatial weight map and the channel weighted feature map in the spatial dimension to obtain an attention enhancement feature map, and then upsampling through a deconvolution layer, where the deconvolution kernel size is 4×4, the step size is 2, the number of output channels is 512, and batch normalization and ReLU activation function are performed to obtain an upsampled feature map; The up-sampled feature map is concatenated with the skip connection feature of the corresponding encoding stage in the channel dimension, and then the feature is reconstructed through two serially connected deconvolution layers to obtain a reconstructed feature map, wherein the number of output channels of the first deconvolution layer is 256, the number of output channels of the second deconvolution layer is 128, the convolution kernel size of each deconvolution layer is 4×4, and the step size is 2; A deconvolution operation is performed on the reconstructed feature map, with a deconvolution kernel size of 4×4 and a step size of 2 to obtain a denoised feature image matrix.
5. The method for crack identification and analysis of building shear walls according to claim 4, characterized in that: The denoised feature image matrix is input into a dynamic graph convolutional neural network to extract local features and global features to obtain a local crack feature matrix and a global crack feature matrix, and feature fusion is performed on the local crack feature matrix and the global crack feature matrix to obtain a fused feature matrix, including: Divide the denoised feature image matrix into P×P overlapping blocks, where P is 16 and the overlapping rate of adjacent blocks is 50%, perform feature aggregation on each overlapping block through maximum pooling and average pooling to obtain a local feature set; A K nearest neighbor graph is constructed for the local feature set, the K value is set to 16, the similarity matrix between each node and other nodes is calculated based on the cosine similarity, the K nodes with the highest similarity are taken as the neighborhood points of the central node, and a dynamic adjacency matrix is obtained; The dynamic adjacency matrix is input into an edge feature calculation module to calculate edge features between a central node and its K neighboring nodes to obtain an edge feature matrix; Performing graph attention calculation on the edge feature matrix, and obtaining an attention weight matrix by multiplying the attention vector by the feature transformation matrix; The attention weight matrix and the edge feature matrix are weighted aggregated, the K neighborhood features of each node are weighted summed, and the features are transformed through a three-layer graph convolutional network, the convolution kernel size is 1×1, and the number of output channels is [128, 256, 512], respectively, to obtain a local crack feature matrix; Perform global graph convolution operations on local aggregated features to build a complete graph structure. Each node is connected to all other nodes. Global information interaction is performed through two layers of graph convolution layers. The convolution kernel size is 1×1 and the number of output channels is [512, 1024] to obtain the global crack feature matrix. The local crack feature matrix and the global crack feature matrix are subjected to feature fusion to obtain a fused feature matrix.
6. The method for identifying and analyzing cracks in a building shear wall according to claim 5, characterized in that: The step of fusing the local crack feature matrix and the global crack feature matrix to obtain a fused feature matrix includes: Feature extraction is performed on the local crack feature matrix and the global crack feature matrix respectively through the first layer of the pyramid, wherein the first layer of the pyramid includes a 1×1 convolution layer, the number of input channels is 1024, the number of output channels is 256, the step size is 1, and the initial local feature map and the initial global feature map are obtained through ReLU activation function processing; The initial local feature map and the initial global feature map are respectively input into the upsampling module, and are upsampled by 2 times by the nearest neighbor interpolation method, and then passed through a 3×3 convolution layer with SAME padding, 256 input channels, 256 output channels, and a step size of 1, followed by a batch normalization layer and a ReLU activation function to obtain an upsampled local feature map and an upsampled global feature map; The upsampled local feature map and the upsampled global feature map are subjected to feature fusion to obtain a fused feature map, and the fused feature map is input into a channel attention module. The feature is first compressed into a 1×1×256 vector by global average pooling, and then passed through two fully connected layers, the first fully connected layer has an output dimension of 16, and the second fully connected layer has an output dimension of 256. A ReLU activation function is used in the middle, and finally a channel weight vector is generated by a Sigmoid function and the feature is recalibrated to obtain a channel enhanced feature; Performing non-local attention calculation on the channel enhancement feature to obtain a spatial enhancement feature, and inputting the spatial enhancement feature into a feature pyramid aggregation module, wherein the feature pyramid aggregation module comprises four parallel branches, each of which is a 3×3 convolutional layer, the number of input channels is 128, the number of output channels is 128, and the output of each branch is processed by batch normalization and ReLU activation function to obtain a multi-scale feature group; The four branch features in the multi-scale feature group are spliced in the channel dimension to obtain a multi-level feature set, and the multi-level feature set is upsampled to the same resolution through the nearest neighbor interpolation method to obtain a fused feature matrix.
7. The method for identifying and analyzing cracks in a building shear wall according to claim 6, characterized in that: The step of inputting the fused feature matrix into the twin metric learning network for feature measurement and crack classification, and outputting the target crack classification result, includes: Input the fused feature matrix into the first convolution branch of the dual branches of the twin metric learning network, wherein the first convolution branch contains 6 convolution blocks, the first convolution block contains a 3×3 convolution layer, the number of input channels is 512, the number of output channels is 64, the step size is 1, and the padding mode is SAME, to obtain the first layer of convolution features; The first layer of convolutional features are sequentially input into the second convolutional block to the sixth convolutional block, the number of output channels of the second convolutional block to the sixth convolutional block are 128, 256, 512, 512, 512 respectively, the convolution kernel size of each convolutional block is 3×3, the step size is 1, and the padding method is SAME, and the first branch target feature is obtained; Input the fused feature matrix into the second convolution branch in the dual branches of the twin metric learning network, wherein the second convolution branch has the same structure as the first convolution branch, and adopts the weight parameters shared with the first convolution branch to obtain the second branch target features; Performing global context attention calculation on the first branch target feature and the second branch target feature respectively to obtain a first enhanced feature and a second enhanced feature; Input the first enhanced feature and the second enhanced feature into a two-stream metric module, the first stream calculates the Euclidean distance, the second stream calculates the cosine similarity, the two distance values are connected in series and fused through a fully connected layer to obtain a fused distance vector; Perform triplet constraint optimization on the fused distance vector, for each anchor sample a, select positive samples p in the same category and negative samples n in different categories, calculate triplet loss, and obtain an optimized distance matrix; Performing density clustering analysis on the optimized distance matrix, first calculating the local density of each sample point, then calculating the minimum distance from each point to a point with higher density, determining the cluster center through a decision diagram, and obtaining an initial category division result; The initial classification results are finely classified, the Mahalanobis distance between the center of each category and the sample point is calculated, the classification threshold is set to 2 times the standard deviation of the mean distance within the class, the category attribution is confirmed and adjusted, and the target crack classification result is output.
8. A crack identification and analysis system for building shear walls, characterized in that: A method for crack identification and analysis of a building shear wall according to any one of claims 1 to 7, the system comprising: A shooting module is used to shoot the surface of the building shear wall at multiple angles and perform image standardization processing to obtain a standardized image data matrix; A combination module, used for performing multi-model degradation processing and multi-angle image combination on the standardized image data matrix to obtain target enhanced image data; A separation module, used for inputting the target enhanced image data into a convolutional denoising autoencoder for noise separation to obtain a denoised feature image matrix; An extraction module is used to input the denoised feature image matrix into a dynamic graph convolutional neural network to extract local features and global features, obtain a local crack feature matrix and a global crack feature matrix, and perform feature fusion on the local crack feature matrix and the global crack feature matrix to obtain a fused feature matrix; The classification module is used to input the fused feature matrix into the twin metric learning network for feature measurement and crack classification, and output the target crack classification result.
Citation Information
Patent Citations
Concrete pavement crack identification method based on deep learning and storage medium
CN116912257A
Method for extracting building change area in double-time-phase remote sensing image based on twinborn mixed attention mechanism and multi-scale feature fusion
CN118212532A