Methods, devices, equipment and media for identifying cracks in hydraulic structures
By introducing the ECA attention mechanism in the Swin-Unet model and replacing the Swin-Transformer-Block module as the target convolution module, the hydraulic building crack recognition model is optimized, solving the existing model's shortcomings in detection efficiency and accuracy, and achieving more efficient crack recognition.
Patent Information
- Application Number
- CN202510451368.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-11
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2045-04-11
AI Technical Summary
When processing large amounts of images, the existing Swin-Unet model is difficult to accurately capture crack features in small cracks or complex backgrounds. The calculation amount is large, resulting in insufficient detection efficiency and accuracy, which cannot meet the requirements of hydraulic construction crack detection.
The ECA attention mechanism was introduced and the Swin-Transformer-Block module was replaced with the target convolution module. The adaptive cross-channel interaction of the ECA attention mechanism and the lightweight design of the target convolution module were optimized.
It improves the identification accuracy and efficiency of hydraulic building crack recognition models, can better restore local features in crack images, and improves the detection accuracy and speed.
Smart Images

Figure CN119963825B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image segmentation technology, and in particular to methods, devices, equipment, and media for identifying cracks in hydraulic structures. Background Art
[0002] As hydraulic structures age, cracks become a common sign of aging and damage. Crack expansion can lead to serious structural failures and safety hazards. Therefore, crack detection and repair are key steps in hydraulic structure safety management. Existing Swin-Unet models, based on convolutional neural networks and intelligent recognition networks, are used to detect cracks in large-scale image data. The Swin-Unet model decoder utilizes the Swin-Transformer-Block. However, in practical applications where the Swin-Unet model processes large numbers of images, the Swin-Transformer-Block struggles to accurately capture and recover detailed features of small cracks or those in complex backgrounds. Furthermore, the high computational complexity of the Swin-Transformer-Block results in a slow inference speed for the Swin-Unet model, reducing its detection accuracy and efficiency. Consequently, when processing large numbers of images, existing Swin-Unet models fail to meet the efficiency and accuracy requirements for crack detection. Summary of the Invention
[0003] In order to solve the above problems, the present application proposes a hydraulic structure crack identification method, device, equipment, and medium, which can improve the accuracy and efficiency of the recognition results of the crack images to be detected.
[0004] To achieve the above objectives, in a first aspect, embodiments of the present application provide a method for identifying cracks in hydraulic structures, the method comprising:
[0005] Inputting the crack image to be detected into the target crack recognition model to obtain the recognition result of the crack image to be detected;
[0006] The target crack identification model is determined by the following steps:
[0007] Acquiring a crack image dataset of a hydraulic structure, preprocessing the crack image dataset, and dividing the preprocessed crack image dataset into a training set and a validation set;
[0008] Obtain an initial Swin-Unet model, wherein the decoder of the initial Swin-Unet model includes a Swin-Transformer-Block module;
[0009] Based on the initial Swin-Unet model, the ECA attention mechanism is introduced, and the Swin-Transformer-Block module is replaced with a target convolution module to obtain an improved intermediate model;
[0010] The intermediate model is iteratively trained and verified using the training set and the verification set to obtain the target crack recognition model.
[0011] In a second aspect, a hydraulic structure crack identification device provided according to an embodiment of the present application includes:
[0012] A first data acquisition module is used to acquire a crack image dataset of a hydraulic structure, preprocess the crack image dataset, and divide the preprocessed crack image dataset into a training set and a validation set;
[0013] A second data acquisition module is used to obtain an initial Swin-Unet model, wherein the decoder of the initial Swin-Unet model includes a Swin-Transformer-Block module;
[0014] A first data processing module is used to introduce an ECA attention mechanism based on the initial Swin-Unet model and replace the Swin-Transformer-Block module with a target convolution module to obtain an improved intermediate model;
[0015] A second data processing module, using the training set and the validation set to iteratively train and validate the intermediate model to obtain a target crack recognition model;
[0016] The crack image to be detected is input into the target crack recognition model to obtain a recognition result of the crack image to be detected.
[0017] In a third aspect, an electronic device provided according to an embodiment of the present application includes:
[0018] at least one processor;
[0019] at least one memory for storing at least one program;
[0020] When at least one of the programs is executed by at least one of the processors, the hydraulic structure crack identification method described in any one of the first aspects is implemented.
[0021] In a fourth aspect, a computer-readable storage medium is provided according to an embodiment of the application, storing computer-executable instructions, wherein the computer-executable instructions are used to execute the hydraulic structure crack identification method described in any one of the first aspects.
[0022] In summary, the above embodiment of the present application inputs the crack image to be detected into the target crack recognition model to obtain the recognition result of the crack image to be detected. The target crack recognition model is determined by the following steps: first, based on the initial Swin-Unet model, the ECA attention mechanism is introduced, and the Swin-Transformer-Block module is replaced with the target convolution module to obtain an improved intermediate model. Then, the intermediate model is iteratively trained and verified using the training set and the validation set to obtain the target crack recognition model. Since the target crack recognition model introduces the ECA attention mechanism compared to the initial Swin-Unet model, it combines the advantages of the ECA attention mechanism's adaptive cross-channel interaction and enhanced feature representation capabilities, so that local features in the crack image can be effectively restored to improve the recognition accuracy of the target crack recognition model. In addition, the Swin-Transformer-Block module is replaced with the target convolution module, combining the advantages of the lightweight design of the target convolution module itself. In this way, the present application recognizes the crack image to be detected based on the target crack model, which can improve the efficiency and accuracy of the recognition results. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A flow chart of a method for identifying cracks in hydraulic structures according to an embodiment of the present application;
[0024] Figure 2 A schematic diagram of cracks in a hydraulic structure provided by an embodiment of the present application;
[0025] Figure 3 A schematic diagram of the intermediate model structure of an embodiment provided in this application;
[0026] Figure 4 A flowchart of iterative training and verification of an intermediate model using a training set and a verification set according to an embodiment of the present application;
[0027] Figure 5 The Head network identification result of an embodiment provided for this application belongs to a crack schematic diagram;
[0028] Figure 6 A flowchart of an embodiment of the present application for extracting features from each crack image in a training set using a feature extraction network;
[0029] Figure 7 A schematic diagram of the Neck network structure of an embodiment provided in this application;
[0030] Figure 8This is a flowchart of an embodiment of the present application, in which each crack feature map of a crack image is processed by an ECA attention mechanism using a Neck network and then input into a target convolution module for processing;
[0031] Figure 9 A schematic diagram of a feature extraction network structure according to an embodiment of the present application;
[0032] Figure 10 A schematic diagram of the first Swin-Transformer-Block module structure of an embodiment provided by this application;
[0033] Figure 11 A schematic diagram of the structure of the first ECA attention module according to an embodiment of the present application;
[0034] Figure 12 A flow chart of performing channel weighting on a first convolutional feature map using a first ECA attention module according to an embodiment of the present application;
[0035] Figure 13 This is a schematic diagram of the structure of the first ConvBlock module of an embodiment provided by this application;
[0036] Figure 14 A flowchart of extracting a fourth intermediate feature using the first ConvBlock module according to an embodiment of the present application;
[0037] Figure 15 A schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0039] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0040] As hydraulic structures age, cracks become a common manifestation of aging and damage. The expansion of cracks may lead to serious structural failures and safety hazards. Therefore, the detection and repair of cracks in hydraulic structures is a key step in the safety management of hydraulic structures.
[0041] Traditional crack detection methods rely on manual inspections and visual observation, which are inefficient, prone to missed detections, and subject to subjective judgment bias. This makes them difficult to meet the requirements for efficient and accurate detection, especially in complex environments. The existing Swin-Unet model, based on convolutional neural networks and intelligent recognition networks, is used to detect cracks in large-scale image data. The Swin-Unet model decoder utilizes the Swin-Transformer-Block. However, in practical applications where the Swin-Unet model processes large numbers of images, the Swin-Transformer-Block struggles to accurately capture and restore detailed features of small cracks or those in complex backgrounds, impacting the Swin-Unet model's detection accuracy. The high computational complexity of the Swin-Transformer-Block also slows the Swin-Unet model's inference speed, reducing detection efficiency. Therefore, when the Swin-Unet model processes large numbers of images, the existing Swin-Unet model cannot meet the efficiency and accuracy requirements for crack detection.
[0042] Based on this, an embodiment of the present application provides a method for identifying cracks in hydraulic structures, which can introduce the ECA attention mechanism and replace the Swin-Transformer-Block module with a target convolution module to obtain a target crack recognition model to improve the efficiency and accuracy of the target crack recognition model.
[0043] Figure 1 This is a flow chart of the hydraulic structure crack identification method according to the embodiment of the present application, referring to Figure 1 As shown, the hydraulic structure crack identification method includes steps S10 to S14, which are specifically as follows:
[0044] Step S10, the crack image to be detected is input into the target crack recognition model to obtain the recognition result of the crack image to be detected;
[0045] The target crack identification model is determined through the following steps:
[0046] Step S11, obtaining a crack image dataset of a hydraulic structure, preprocessing the crack image dataset, and dividing the preprocessed crack image dataset into a training set and a validation set;
[0047] Step S12, obtaining an initial Swin-Unet model, wherein the decoder of the initial Swin-Unet model includes a Swin-Transformer-Block module;
[0048] Step S13: Based on the initial Swin-Unet model, the ECA attention mechanism is introduced, and the Swin-Transformer-Block module is replaced with the target convolution module to obtain an improved intermediate model;
[0049] Step S14: Iteratively train and verify the intermediate model using the training set and the validation set to obtain a target crack recognition model.
[0050] Therefore, in an embodiment of the present application, the crack image to be detected is input into the target crack recognition model to obtain the recognition result of the crack image to be detected. The target crack recognition model is determined by the following steps: first, based on the initial Swin-Unet model, the ECA attention mechanism is introduced, and the Swin-Transformer-Block module is replaced with the target convolution module to obtain an improved intermediate model. Then, the intermediate model is iteratively trained and verified using the training set and the validation set to obtain the target crack recognition model. Since the target crack recognition model introduces the ECA attention mechanism compared to the initial Swin-Unet model, it combines the advantages of the adaptive cross-channel interaction and enhanced feature representation capabilities of the ECA attention mechanism, so that the local features in the crack image can be effectively restored to improve the recognition accuracy of the target crack recognition model. In addition, the Swin-Transformer-Block module is replaced with the target convolution module, which combines the advantages of the lightweight design of the target convolution module itself. In this way, the present application recognizes the crack image to be detected based on the target crack model, which can improve the efficiency and accuracy of the recognition results.
[0051] The hydraulic structures in the embodiment of the present application can be buildings such as embankments, reservoirs, and channels. Since most hydraulic structures are located in natural environments, they may be affected by natural environmental factors for a long time, which may cause the hydraulic structures to age and crack. Figure 2 As shown, cracks exist in the hydraulic structure, and the shape of the cracks is usually irregular. In the embodiment of the present application, the cracked part of the hydraulic structure can be photographed to obtain a crack image dataset of the hydraulic structure.
[0052] Since the crack image set of hydraulic structures obtained by taking pictures in a natural environment is affected by factors such as natural light changes, rainfall, and dust, the embodiment of the present application can simulate the crack images of hydraulic structures under the influence of different factors by preprocessing the crack image data set, so as to achieve the purpose of expanding the crack image set of hydraulic structures, thereby improving the accuracy of the crack image set and improving the generalization of the target crack recognition model obtained by iterative training using the crack image set.
[0053] In some embodiments, the initial Swin-Unet model may include an encoder and a decoder, wherein the encoder gradually decomposes the input crack image into multi-scale feature representations while extracting local and global information to obtain multiple crack feature maps. In some embodiments, the encoder may first divide the input image into non-overlapping blocks, each block is regarded as an independent token, and these tokens are projected into a higher-dimensional feature space to obtain an embedding vector, and then learn the feature depth of the embedding vector to obtain a feature map, thereby halving the spatial resolution of the feature map and increasing the feature dimension of the feature map to 2 times. Those skilled in the art do not impose any restrictions on the specific implementation of the encoder and can design the encoder based on specific needs. Exemplarily, the encoder of the initial Swin-Unet model can be implemented by Vision Transformer (ViT), convolutional neural network or CNN-Transformer, etc.
[0054] Because the Swin-Transformer-Block module of the decoder in the initial Swin-Unet model is difficult to accurately capture and restore detailed features for small cracks or cracks in complex backgrounds, in addition, due to the large amount of computation of Swin-Transformer-Block, the reasoning speed of the Swin-Unet model is slow, which reduces the accuracy and efficiency of the target crack recognition model. The embodiment of the present application introduces the ECA attention mechanism, combines the advantages of the adaptive cross-channel interaction and enhanced feature representation capabilities of the ECA attention mechanism, so that local features in the crack image can be effectively restored to improve the recognition accuracy of the target crack recognition model. In addition, due to the lightweight design advantages of the target convolution module itself, the computational complexity of the target convolution module is lower than that of the Swin-Transformer-Block module. By replacing the Swin-Transformer-Block module with the target convolution module on the basis of the ECA attention mechanism, the present application can reduce the situation where the recognition efficiency is reduced due to the large amount of computation of the Swin-Transformer-Block module, thereby improving the recognition efficiency of the target crack recognition model.
[0055] In some embodiments, reference Figure 3 As shown, the intermediate model includes the feature extraction network, Neck network and Head network connected in sequence, refer to Figure 4 As shown, the intermediate model is iteratively trained and verified using the training set and the validation set to obtain the target crack recognition model, including but not limited to the following steps:
[0056] Step S21, using a feature extraction network to perform feature extraction on each crack image in the training set to obtain multiple crack feature maps corresponding to each crack image;
[0057] Step S22: Each crack feature map of the crack image is processed by the Neck network using the ECA attention mechanism, and then input into the target convolution module for upsampling, feature extraction, and feature splicing in sequence to obtain a target crack feature map corresponding to the crack image;
[0058] Step S23, using the Head network to perform image segmentation on the target crack feature map to obtain the recognition result of the crack image to be detected;
[0059] In step S24, the recognition results are iteratively trained and verified based on a verification set to obtain a target crack recognition model.
[0060] Therefore, the embodiment of the present application extracts a multi-scale crack feature map from the crack image through a feature extraction network, and uses the ECA attention mechanism to enhance the feature expression of the multi-scale crack feature map. The output processed by the ECA attention mechanism is then upsampled through the target convolution module to restore features, extract features, and splice multi-scale features. The spliced result is input into the Head network to perform image segmentation on the target crack feature map, and then iterative training and verification are performed based on the segmentation results to obtain a target crack recognition model. The above embodiment of the present application can enhance the expression of features by introducing the ECA attention mechanism, restore the resolution of the multi-scale crack feature map by upsampling, and then further extract and convert features to further enhance the feature expression capability. Finally, the multi-scale crack feature map is spliced to better retain the detailed information of the target crack feature map, which can improve the accuracy of the target crack recognition model.
[0061] It can be understood that the embodiment of the present application introduces the ECA attention mechanism to enable the target crack recognition model to pay more attention to important information, and restores the lost information of the crack feature maps of different scales extracted by the feature extraction network through upsampling. The feature expression ability can be guaranteed through the ECA attention mechanism and upsampling. After feature extraction of the upsampled output, the crack feature maps of different scales are spliced, which can make full use of the multi-scale crack feature map information, thereby improving the accuracy of the target crack feature recognition model.
[0062] In the embodiment of the present application, the Head network is used to perform image segmentation on the target crack feature map. Multiple convolutional layers are set to generate a segmentation mask for each pixel of the target crack feature map. The output of each pixel is a probability value or a category label, indicating whether the pixel belongs to a crack. Taking the crack detection of hydraulic structures with two categories as an example, the output value of each pixel is between 0 and 1. The output value of the pixel is greater than the preset threshold, that is, the output value of the pixel is close to 1. Figure 5 As shown in Figure 2, the Head network recognition result belongs to cracks.
[0063] It is understood that in the embodiment of the present application, iterative training of the recognition results and verification based on the validation set can be achieved by repeating steps S21 to S24 until a preset number of iterative training rounds is reached. Specifically, the parameters of the target crack recognition model are gradually optimized using the training set based on the preset iterative training parameters to improve the model's performance. After each iterative training, the performance of the target crack recognition model is evaluated using the validation set to ensure that the target crack recognition model not only performs well on the training set but also maintains good generalization capabilities on an untrained dataset (i.e., the validation set).
[0064] For example, the crack image processing batch size for iterative training is set to 32, the number of iterative training rounds is set to 200, the optimizer used for iterative training is stochastic gradient descent, the optimizer's initial learning rate is set to 0.01, the optimizer's weight decay coefficient is set to 0.0005, and the image size of the input training set is 640*640. Feature extraction is performed on 32 crack images each time to obtain multiple crack feature maps. Feature extraction and splicing are then performed using the Neck network. The spliced results are then segmented using the Head network to obtain the recognition results. After verification using the validation set, the parameters of the target crack recognition model are updated based on the initial learning rate and weight decay coefficient of the stochastic gradient descent optimizer. This process is repeated until 200 iterative training rounds are reached, at which point the target crack recognition model for the 200th round is output.
[0065] In some embodiments, the feature extraction network includes a Patch Partition module, a first sub-feature extraction module, and a plurality of second sub-feature extraction modules connected in sequence. Figure 6 As shown, step S21 includes:
[0066] Step S31, inputting the crack image into the Patch Partition module for segmentation;
[0067] In step S32, the segmented crack image is input into a first sub-feature extraction module and a plurality of second sub-feature extraction modules connected in sequence for feature extraction, and the feature maps output by the first sub-feature extraction module and each second sub-feature extraction module are determined as crack feature maps.
[0068] Therefore, the embodiment of the present application performs feature extraction by sequentially connecting a first sub-feature extraction module and multiple second sub-feature extraction modules, and determines the feature maps output by the first sub-feature extraction module and each second sub-feature extraction module as a crack feature map, which can fully utilize the multi-scale of the crack feature map and improve the generalization of the target crack recognition model.
[0069] In the embodiments of the present application, hierarchical feature extraction is performed by combining a first sub-feature extraction module and multiple second sub-feature extraction modules. The first sub-feature extraction module can extract low-level features, such as edge or texture features, while the multiple second sub-feature extraction modules can extract higher-level features, such as the overall shape or direction of cracks in hydraulic structures. Because cracks in hydraulic structures can exhibit different characteristics depending on factors such as material and environment, the multi-scale feature extraction in the embodiments of the present application can make the target crack recognition model more robust to variations in hydraulic structure cracks, thereby improving the generalization ability of the target crack recognition model to identify cracks in different scenarios.
[0070] In the embodiment of the present application, the feature maps output by the first sub-feature extraction module and each second sub-feature extraction module are determined as crack feature maps. The splicing of multi-scale features makes the crack feature maps richer and can better describe the complexity of cracks.
[0071] In some embodiments, the Neck network includes a first convolution module, a second convolution module, a third convolution module, a fourth convolution module, a first ECA attention module, a second ECA attention module, a third ECA attention module, a fourth ECA attention module, a first ConvBlock module, a second ConvBlock module, a third ConvBlock module, a fourth ConvBlock module, a first upsampling module, a second upsampling module, a third upsampling module, a fourth upsampling module, a first Concat splicing module, a second Concat splicing module, a third Concat splicing module, and a fourth Concat splicing module. oncat splicing module, the input end of the first convolution module is connected to the output end of the first sub-feature extraction module, the input ends of the second convolution module, the third convolution module and the fourth convolution module are respectively connected to the output ends of each second sub-feature extraction module, the crack feature map includes the first crack feature map, the second crack feature map, the third crack feature map and the fourth crack feature map, the first sub-feature extraction module outputs the first crack feature map, the number of the second sub-feature extraction modules is 3, corresponding to the first module, the second module and the third module, the first module outputs the second crack feature map, the second module outputs the third crack feature map, and the third module outputs the fourth crack feature map. Figure 7 as well as Figure 8 As shown, step S22 includes:
[0072] Step S41: performing channel adjustment on the fourth crack feature map through a fourth convolution module to obtain a fourth convolution feature map, and inputting the fourth convolution feature map into a fourth ECA attention module for channel weighting to obtain a fourth intermediate feature.
[0073] Step S42: performing channel adjustment on the third crack feature map through a third convolution module to obtain a third convolution feature map, and inputting the third convolution feature map into a third ECA attention module for channel weighting to obtain a third intermediate feature.
[0074] Step S43: Pass the second crack feature map through the second convolution module to perform channel adjustment to obtain a second convolution feature map, and input the second convolution feature map into the second ECA attention module for channel weighting to obtain a second intermediate feature;
[0075] Step S44: performing channel adjustment on the first crack feature map through the first convolution module to obtain a first convolution feature map, and inputting the first convolution feature map into the first ECA attention module for channel weighting to obtain a first intermediate feature;
[0076] Step S45: Input the fourth intermediate feature to the first ConvBlock module for feature extraction to obtain a first ConvBlock feature, input the first ConvBlock feature to the first upsampling module for upsampling to obtain a first upsampled feature, and perform feature splicing on the first upsampled feature and the third intermediate feature through the first Concat splicing module to obtain a fifth intermediate feature;
[0077] Step S46: The fifth intermediate feature is sequentially subjected to a second ConvBlock module for feature extraction to obtain a second ConvBlock feature, the second ConvBlock feature is input into a second upsampling module for upsampling to obtain a second upsampled feature, and the second upsampled feature and the second intermediate feature are concatenated using a second Concat concatenation module to obtain a sixth intermediate feature;
[0078] Step S47: The sixth intermediate feature is sequentially subjected to a third ConvBlock module for feature extraction to obtain a third ConvBlock feature. The third ConvBlock feature is input into a third upsampling module for upsampling to obtain a third upsampled feature. The third upsampled feature is concatenated with the first intermediate feature through a third Concat concatenation module to obtain a seventh intermediate feature.
[0079] In step S48, the seventh intermediate feature is sequentially subjected to feature extraction by the fourth ConvBlock module to obtain a fourth ConvBlock feature, and the fourth ConvBlock feature is input into the fourth upsampling module for upsampling to obtain a target crack feature map.
[0080] Therefore, the embodiment of the present application can improve the accuracy and efficiency of the target crack recognition model in identifying cracks in hydraulic structures by performing channel adjustment, channel weighting, feature extraction, upsampling and feature splicing on the crack feature map.
[0081] In some embodiments, since the features in the fourth crack feature map are scattered in different channels, the embodiment of the present application can perform channel integration through the fourth convolution module, so that the features between different channels can be fused, thereby enhancing the expressive power of the features. The fourth convolution matrix of the embodiment of the present application can perform weighted summation on each spatial position of the fourth crack feature map through the weight matrix, thereby realizing a linear combination across channels. Those skilled in the art can set the specific implementation method of the fourth convolution module according to actual needs. Exemplarily, the fourth convolution module can be set to a convolution module such as a fourth 1*1 convolution module, a fourth 4*4 convolution module, or a fourth 7*7 convolution module. It can be understood that the implementation methods of the first convolution module, the second convolution module, and the third convolution module are basically the same as the implementation methods of the specific embodiment of the fourth convolution module, and will not be repeated here.
[0082] In some embodiments, the first ECA attention module can compress each channel space dimension of the first convolution feature map; adaptively calculate the kernel size of the one-dimensional convolution according to the channel dimension, adjust the dimension of the compressed feature map, and perform local cross-channel interaction based on the calculated one-dimensional convolution kernel, and then generate channel weights through the activation function; perform weighted calculation on the channel weights and the channels corresponding to the channel weights in the first convolution feature map to obtain the first intermediate features. The first ECA module of the embodiment of the present application can dynamically adjust the range of local cross-channel interaction according to the channel dimension by adaptively selecting the size of the one-dimensional convolution kernel, so that high-dimensional channels can interact in a longer range, while low-dimensional channels interact in a shorter range, thereby efficiently capturing the dependencies between channels in different dimensions. It can be understood that the implementation methods of the second ECA attention module, the third ECA attention module and the fourth ECA attention module are basically the same as the implementation methods of the specific embodiment of the first ECA attention module, and will not be repeated here.
[0083] In some embodiments, the first Concat splicing module can perform weighted addition of the channel dimensions of the first up-sampled feature and the third intermediate feature to obtain the fifth intermediate feature after splicing. In other embodiments, the first Concat splicing module can assign weights to the first up-sampled feature and the third intermediate feature respectively, and perform weighted addition of the channel dimensions of the first up-sampled feature and the third intermediate feature based on the weights to obtain the fifth intermediate feature after weighted splicing; in addition, the weights assigned to the first up-sampled feature and the third intermediate feature can be obtained by presetting specific data values or by learning. Those skilled in the art can set the specific values of the weights according to actual needs. In the embodiment of the present application, the first Concat splicing module can obtain the fifth intermediate feature by merging the channel information of the first up-sampled feature and the third intermediate feature in the channel dimension, which can combine local details with global semantics, thereby improving the recognition accuracy and generalization ability of the target crack recognition model. It can be understood that the implementation methods of the second Concat splicing module, the third Concat splicing module and the fourth Concat splicing module are basically the same as the implementation methods of the specific embodiment of the first Concat splicing module, and will not be repeated here.
[0084] In some embodiments, the first ConvBlock module may include a plurality of convolutional layers connected in sequence, and each convolutional layer may be connected to an activation function and a normalization layer. The first ConvBlock module performs a convolution operation on the fourth intermediate feature through each convolutional layer in turn, extracts features, activates the extracted features through the activation function, and then inputs them into the normalization layer for normalization processing to obtain the first ConvBlock features. The embodiment of the present application can perform feature extraction through multiple convolutional layers and can enhance the feature expression of the first ConvBlock. It can be understood that the implementation methods of the second ConvBlock module, the third ConvBlock module, and the fourth ConvBlock module are basically the same as the implementation methods of the specific embodiment of the first ConvBlock module, and will not be repeated here.
[0085] In some embodiments, reference Figure 9 As shown, the first sub-feature extraction module includes a LinearEmbeding module and a Swin-Transformer-Block module connected in sequence, and the first module, the second module, and the third module of the second sub-feature extraction module each include a Patch Merging module and a Swin-Transformer-Block module in sequence. Specifically, in this embodiment of the application, the first sub-feature extraction module outputs a first crack feature map, the first module outputs a second crack feature map, the second module outputs a third crack feature map, and the third module outputs a fourth crack feature map, including but not limited to the following steps:
[0086] The segmented crack image to be detected is converted into an embedding vector through the Linear Embedding module;
[0087] Input the embedding vector into the first Swin-Transformer-Block module to extract the first crack feature map, and input the first crack feature map into the second Swin-Transformer-Block module through the first Patch Merging module to extract the second crack feature map;
[0088] The second crack feature map is input into the third Swin-Transformer-Block module through the second Patch Merging module to extract the third crack feature map;
[0089] The third crack feature map is input into the fourth Swin-Transformer-Block module through the third Patch Merging module to extract the fourth crack feature map.
[0090] In the embodiment of the present application, the Swin-Transformer-Block modules in the first sub-feature extraction module and the multiple second sub-feature extraction modules include, in sequence, a first LN module, a W-MSA module, a first residual module, a second LN module, a first MLP module, a second residual module, a third LN module, a fourth LN module, a SW-MSA module, a third residual module, a second MLP module and a fourth residual module.
[0091] In the embodiment of the present application, the Patch Merging module includes a patch division and merging module, a linear transformation module, and a shape adjustment module connected in sequence. The patch division and merging module divides the input feature map into multiple patches, merges the multiple patches, and then uses the linear transformation module to map each merged patch to a larger channel space. Finally, the shape adjustment module adjusts the dimensional order of the output feature map.
[0092] Reference Figure 10 As shown in the figure, the first Swin-Transformer-Block module includes a first LN module, a W-MSA module, a first residual module, a second LN module, a first MLP module, a second residual module, a third LN module, a SW-MSA module, a fourth residual module, a fourth LN module, a second MLP module, and a third residual module. Taking the example of inputting the embedding vector into the first Swin-Transformer-Block module to extract the first crack feature map, this can be achieved through the following steps:
[0093] The embedding vector is normalized by the first LN module and then input into the W-MSA module for self-attention calculation within the local window. The output feature map of the W-MSA module and the segmented crack image are residually connected through the first residual module to obtain the first residual map;
[0094] The first residual image is normalized by the second LN module and then input into the first MLP module for nonlinear transformation and Mish activation function activation. The first residual image and the feature image output by the first MLP module are residually connected through the second residual module to obtain a second residual image.
[0095] The second residual map is normalized by the third LN module and then input into the SW-MSA module for self-attention calculation between local windows. The output feature map of the SW-MSA module and the second residual map are residually connected through the third residual module to obtain the third residual map.
[0096] The third residual map is normalized by the fourth LN module and then input into the second MLP module for nonlinear transformation and Mish activation function activation. The third residual map and the feature map output by the second MLP module are residually connected through the fourth residual module to obtain the first crack feature map.
[0097] The Swin-Transformer-Block module in the embodiment of the present application uses W-MSA to perform self-attention calculations within a local window, and uses the SW-MSA module to perform self-attention calculations between local windows. This allows W-MSA to enhance the expression of local features while using the SW-MSA module to communicate between different local windows while taking into account the modeling capabilities of global information. The implementation method of the second sub-feature extraction module in the embodiment of the present application is basically the same as the embodiment of inputting the embedding vector into the first Swin-Transformer-Block module to extract the first crack feature map, and will not be repeated here.
[0098] It can be understood that the first LN module performs normalization processing on the segmented crack image by normalizing all the features of the downsampled feature map, so that all the features of the segmented crack image have a distribution with a mean of 0 and a standard deviation of 1, so that the gradient will not explode or disappear due to a value range that is too large or too small during the back propagation process, and the input and output distributions of the first LN module remain consistent, thereby stabilizing the training process of the entire target crack recognition model.
[0099] It can be understood that the W-MSA module divides the image into multiple non-overlapping local windows and performs self-attention calculations in each window. Since the W-MSA module performs self-attention calculations within the local window rather than for the entire image, the amount of calculation and memory overhead are reduced; in addition, compared to calculating on the entire image, the W-MSA module can better capture local features and detail information in the image. In other embodiments, the SW-MSA module introduces a local window offset and offsets the local window according to the step size, so that overlapping areas are generated between adjacent windows, and information between different windows can be communicated, thereby enhancing the perception of global information.
[0100] It is understandable that, since data in practical applications typically exhibits complex nonlinear relationships, performing nonlinear transformations on both the first and second MLP modules can map the data input to the first and second MLP modules into a nonlinear feature space, enhancing the stability of the gradient and, consequently, the expressiveness and generalization capabilities of the target crack identification model. The gradient is used to guide the update direction of the target crack identification model parameters. Based on the nonlinear transformation, the Mish activation function is used for activation. Since the Mish activation function is a smooth nonlinear activation function, its output is continuous across the entire domain, further improving the stability of the gradient and, thus, enhancing the expressiveness and generalization capabilities of the target crack identification model.
[0101] Specifically, the calculation expression of the Mish activation function is as follows:
[0102] ;
[0103] ;
[0104] in, is the Mish activation function, is the hyperbolic tangent function, is a natural constant, is a smooth nonlinear function, is the input value of the Mish activation function.
[0105] In some embodiments, the structures of the second ECA attention module, the third ECA attention module, and the fourth ECA attention module are the same as the first ECA attention module; Figure 11 As shown, the first ECA attention module includes a global pooling module, a convolution module, a Sigmoid activation module, and a channel-by-channel weighting module. Figure 12 As shown, the first convolutional feature map is input into the first ECA attention module for channel weighting to obtain the first intermediate feature, including but not limited to the following steps:
[0106] Step S51: input the first convolution feature map into the global pooling module for global average pooling to obtain a first pooled feature;
[0107] Step S52: extract the first pooled features through the first convolution module and input them into the Sigmoid activation module for activation to obtain the attention coefficient corresponding to each channel in the first convolution feature map;
[0108] In step S53, the attention coefficient is multiplied by the channel corresponding to the attention coefficient through a channel-by-channel weighting module to obtain a first intermediate feature.
[0109] Therefore, in an embodiment of the present application, the first pooled feature is subjected to feature extraction by the first convolution module and then input into the Sigmoid activation module for activation to obtain the attention coefficient corresponding to each channel in the first convolution feature map. The attention coefficient is multiplied by the channel corresponding to the attention coefficient through the channel-by-channel weighting module to obtain the first intermediate feature, which enables each channel of the first convolution feature map to be weighted, thereby enhancing the feature expression of the first intermediate feature.
[0110] In some embodiments, global average pooling is to compress the spatial dimension of the first convolution feature map into a single value, retain the global information of each channel and extract the feature representation at the channel level, which can reduce the computational complexity; on the basis of global average pooling, further feature extraction is performed on the features after global average pooling through feature extraction operations to learn the relationship between channels; on the basis of feature extraction, the extracted features are mapped to the (0, 1) interval according to the Sigmoid activation function to generate the attention coefficient of each channel; on the basis of Sigmoid function activation, the attention coefficient is multiplied by the corresponding channel of the first convolution feature map respectively, so as to enhance the feature expression of the first intermediate feature.
[0111] It can be understood that the implementation methods of the second ECA attention module, the third ECA attention module and the fourth ECA attention module are basically the same as the specific embodiment of the first ECA attention module, and will not be repeated here.
[0112] In some embodiments, the structures of the second ConvBlock module, the third ConvBlock module, and the fourth ConvBlock module are the same as the structure of the first ConvBlock module; the first ConvBlock module sequentially includes a fifth convolution module, a first BN module, a first ReLU activation module, a sixth convolution module, a second BN module, a second ReLU activation module, and a residual connection module, Figure 13 as well as Figure 14As shown, the fourth intermediate feature is input into the first ConvBlock module for feature extraction to obtain the first ConvBlock feature, including but not limited to the following steps:
[0113] Step S61: extracting and converting the fourth intermediate features through the fifth convolution module and then inputting the extracted features into the first BN module for batch normalization.
[0114] Step S62: The output value of the first BN module is introduced into the ReLU activation function through the first ReLU activation module for activation;
[0115] Step S63: The output value of the first ReLU activation module is subjected to feature extraction and dimension conversion by the sixth convolution module and then input into the second BN module for batch normalization processing;
[0116] Step S64, the output value of the second BN module is introduced into the ReLU activation function through the second ReLU activation module for activation;
[0117] Step S65: Perform weighted calculation on the fourth intermediate feature and the output value of the second ReLU activation module through the residual connection module to obtain the first ConvBlock feature.
[0118] Therefore, in an embodiment of the present application, the fourth intermediate feature is extracted and dimensionally converted by the fifth convolution module and then input into the first BN module for batch normalization processing. The output value of the first BN module is introduced into the ReLU activation function through the first ReLU activation module for activation. The output value of the first ReLU activation module is extracted and dimensionally converted by the sixth convolution module and then input into the second BN module for batch normalization processing. The output value of the second BN module is introduced into the ReLU activation function through the second ReLU activation module for activation. The fourth intermediate feature and the output value of the second ReLU activation module are weightedly calculated through the residual connection module to obtain the ConvBlock feature, which can enhance the feature expression of the first ConvBlock feature, and the information of the fourth intermediate feature is taken into account through the residual connection module.
[0119] Specifically, the embodiment of the present application further extracts features and converts dimensions of the fourth intermediate features through the fifth convolution module to extract a more advanced feature representation; on the basis of feature extraction, the output value of the fifth convolution module is batch normalized to keep the gradient stable; on the basis of batch normalization, nonlinear activation is introduced through the first ReLU activation module to enhance the expression ability; repeat the above steps, and then perform weighted calculation on the fourth intermediate feature and the output value of the second ReLU activation module through the residual connection module to further maintain the stability of the gradient, so that the first ConvBlock feature takes into account the information of the first intermediate feature.
[0120] It is understandable that those skilled in the art can set the specific implementation of the fifth convolution module and the sixth convolution module according to actual needs. For example, the fifth convolution module and the sixth convolution module can be set to a fifth 3*3 convolution module and a sixth 3*3 convolution module, a fifth 4*4 convolution module and a sixth 4*4 convolution module, or a fifth 7*7 convolution module and a sixth 7*7 convolution module.
[0121] It can be understood that the implementation of the second ConvBlock module, the third ConvBlock module and the fourth ConvBlock module is basically the same as the specific embodiment of the first ConvBlock module, and will not be described in detail here.
[0122] In some embodiments, preprocessing the crack image dataset includes:
[0123] Each crack image in the crack image dataset is processed by adding Gaussian noise, changing saturation and brightness;
[0124] Among them, Gaussian noise satisfies the following expression:
[0125] ;
[0126] in, is the preset standard deviation of Gaussian noise, is a natural constant, is the default mean of Gaussian noise.
[0127] Therefore, the embodiment of the present application can simulate the crack images of hydraulic structures under the influence of different factors by adding Gaussian noise and changing the saturation and brightness of each crack image in turn, so as to improve the accuracy of the crack images.
[0128] It can be understood that the embodiment of the present application can simulate the influence of natural environment light on the crack image of hydraulic structure by changing the saturation and brightness, so that the crack image is closer to reality, thereby improving the accuracy of the crack image.
[0129] The present embodiment utilizes a Gaussian noise calculation formula to control the center position of the Gaussian noise distribution by adjusting the specific value of μ. Furthermore, by adjusting the specific value of σ to control the spread of the Gaussian noise distribution, the embodiment can simulate noise interference caused by crack images affected by natural environmental factors. Those skilled in the art can adjust the specific values of the Gaussian noise formula according to actual needs.
[0130] The present application also provides a hydraulic structure crack identification device, comprising:
[0131] The first data acquisition module is used to obtain a crack image dataset of a hydraulic structure, preprocess the crack image dataset, and divide the preprocessed crack image dataset into a training set and a validation set;
[0132] A second data acquisition module is used to obtain an initial Swin-Unet model, wherein the decoder of the initial Swin-Unet model includes a Swin-Transformer-Block module;
[0133] The first data processing module is used to introduce the ECA attention mechanism based on the initial Swin-Unet model and replace the Swin-Transformer-Block module with the target convolution module to obtain an improved intermediate model;
[0134] The second data processing module uses the training set and the validation set to iteratively train and validate the intermediate model to obtain the target crack recognition model;
[0135] The crack image to be detected is input into the target crack recognition model to obtain the recognition result of the crack image to be detected.
[0136] The specific implementation of the hydraulic structure crack identification device in the embodiment of the present application is basically the same as the specific implementation of the hydraulic structure crack identification method described above, and will not be repeated here.
[0137] The present application also provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described hydraulic structure crack identification method. The electronic device can be any smart terminal, including a tablet computer and an in-vehicle computer.
[0138] See also Figure 15 , Figure 15 The hardware structure of an electronic device according to another embodiment is shown. The electronic device includes:
[0139] The processor 901 can be implemented as a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0140] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 902 and is called by the processor 901 to execute the hydraulic structure crack identification method of the embodiment of this application.
[0141] Input / output interface 903, used to implement information input and output;
[0142] Communication interface 904, used to implement communication interaction between this device and other devices, which can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WiFi, Bluetooth, etc.);
[0143] Bus 905 , which transmits information between various components of the device (e.g., processor 901 , memory 902 , input / output interface 903 , and communication interface 904 );
[0144] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0145] In some embodiments, the embodiments of the present application further provide a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned hydraulic structure crack identification method.
[0146] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0147] The embodiments described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0148] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0149] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0150] Those skilled in the art will appreciate that all or some of the steps in the methods, systems, and functional modules / units in the devices disclosed above may be implemented as software, firmware, hardware, or appropriate combinations thereof.
[0151] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0152] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0153] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the above-mentioned units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0154] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0155] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0156] 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 application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes multiple instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: various media that can store programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
Claims
1. A method for identifying cracks in hydraulic structures, characterized in that: The hydraulic structure crack identification method comprises: Inputting the crack image to be detected into the target crack recognition model to obtain the recognition result of the crack image to be detected; The target crack identification model is determined by the following steps: Acquiring a crack image dataset of a hydraulic structure, preprocessing the crack image dataset, and dividing the preprocessed crack image dataset into a training set and a validation set; Obtain an initial Swin-Unet model, wherein the decoder of the initial Swin-Unet model includes a Swin-Transformer-Block module; Based on the initial Swin-Unet model, the ECA attention mechanism is introduced, and the Swin-Transformer-Block module is replaced with a target convolution module to obtain an improved intermediate model; The intermediate model is iteratively trained and verified using the training set and the validation set to obtain the target crack recognition model. The intermediate model includes a feature extraction network, a Neck network, and a Head network connected in sequence. The feature extraction network is used to perform feature extraction on each crack image in the training set to obtain multiple crack feature maps corresponding to each crack image. Each crack feature map of the crack image is processed by the Neck network using the ECA attention mechanism and then input into the target convolution module for upsampling, feature extraction, and feature splicing in sequence to obtain a target crack feature map corresponding to the crack image. The Head network is used to perform image segmentation on the target crack feature map to obtain a recognition result of the crack image to be detected. The recognition result is iteratively trained and verified based on the validation set to obtain the target crack recognition model.
2. The hydraulic structure crack identification method according to claim 1, characterized in that: The feature extraction network includes a Patch Partition module, a first sub-feature extraction module, and multiple second sub-feature extraction modules connected in sequence. The feature extraction network is used to extract features from each crack image in the training set to obtain multiple crack feature maps corresponding to each crack image, including: Inputting the crack image into the Patch Partition module for segmentation; The segmented crack image is input into the first sub-feature extraction module and multiple second sub-feature extraction modules connected in sequence for feature extraction, and the feature map output by the first sub-feature extraction module and each second sub-feature extraction module is determined as the crack feature map.
3. The hydraulic structure crack identification method according to claim 2, characterized in that: The Neck network includes a first convolution module, a second convolution module, a third convolution module, a fourth convolution module, a first ECA attention module, a second ECA attention module, a third ECA attention module, a fourth ECA attention module, a first ConvBlock module, a second ConvBlock module, a third ConvBlock module, a fourth ConvBlock module, a first upsampling module, a second upsampling module, a third upsampling module, a fourth upsampling module, a first Concat splicing module, a second Concat splicing module, a third Concat splicing module and a fourth Concat splicing module, the input end of the first convolution module is connected to the output end of the first sub-feature extraction module, the second convolution module, the third convolution module and the fourth The input end of the convolution module is respectively connected to the output end of each second sub-feature extraction module. The crack feature map includes a first crack feature map, a second crack feature map, a third crack feature map and a fourth crack feature map. The first sub-feature extraction module outputs the first crack feature map. The number of the second sub-feature extraction modules is 3, corresponding to the first module, the second module and the third module. The first module outputs the second crack feature map, the second module outputs the third crack feature map, and the third module outputs the fourth crack feature map. Each crack feature map of the crack image is processed by the Neck network using the ECA attention mechanism and then input into the target convolution module for upsampling, feature extraction and feature splicing in sequence to obtain the target crack feature map corresponding to the crack image, including: Passing the fourth crack feature map through the fourth convolution module to perform channel adjustment to obtain a fourth convolution feature map, and inputting the fourth convolution feature map into the fourth ECA attention module for channel weighting to obtain a fourth intermediate feature; Passing the third crack feature map through the third convolution module to perform channel adjustment to obtain a third convolution feature map, and inputting the third convolution feature map into the third ECA attention module for channel weighting to obtain a third intermediate feature; Passing the second crack feature map through the second convolution module to perform channel adjustment to obtain a second convolution feature map, and inputting the second convolution feature map into the second ECA attention module for channel weighting to obtain a second intermediate feature; Passing the first crack feature map through the first convolution module to perform channel adjustment to obtain a first convolution feature map, and inputting the first convolution feature map into the first ECA attention module for channel weighting to obtain a first intermediate feature; Inputting the fourth intermediate feature into the first ConvBlock module for feature extraction to obtain a first ConvBlock feature, inputting the first ConvBlock feature into the first upsampling module for upsampling to obtain a first upsampled feature, and performing feature splicing on the first upsampled feature and the third intermediate feature through the first Concat splicing module to obtain a fifth intermediate feature; The fifth intermediate feature is sequentially subjected to the second ConvBlock module for feature extraction to obtain a second ConvBlock feature, the second ConvBlock feature is input into the second upsampling module for upsampling to obtain a second upsampled feature, and the second upsampled feature and the second intermediate feature are concatenated using the second Concat concatenation module to obtain a sixth intermediate feature; The sixth intermediate feature is sequentially subjected to the third ConvBlock module for feature extraction to obtain a third ConvBlock feature, the third ConvBlock feature is input into the third upsampling module for upsampling to obtain a third upsampled feature, and the third upsampled feature and the first intermediate feature are concatenated by the third Concat concatenation module to obtain a seventh intermediate feature; The seventh intermediate feature is sequentially subjected to feature extraction by the fourth ConvBlock module to obtain a fourth ConvBlock feature, and the fourth ConvBlock feature is input into the fourth upsampling module for upsampling to obtain the target crack feature map.
4. The hydraulic structure crack identification method according to claim 3, characterized in that: The structures of the second ECA attention module, the third ECA attention module, and the fourth ECA attention module are the same as the structure of the first ECA attention module. The first ECA attention module sequentially includes a global pooling module, a convolution module, a Sigmoid activation module, and a channel-by-channel weighting module. The first convolution feature map is input into the first ECA attention module for channel weighting to obtain a first intermediate feature, including: Inputting the first convolutional feature map into the global pooling module for global average pooling to obtain a first pooling feature; The first pooled feature is extracted by the convolution module and then input into the Sigmoid activation module for activation to obtain the attention coefficient corresponding to each channel in the first convolution feature map; The attention coefficient is multiplied by the channel corresponding to the attention coefficient through the channel-by-channel weighting module to obtain the first intermediate feature.
5. The hydraulic structure crack identification method according to claim 3, characterized in that: The structures of the second ConvBlock module, the third ConvBlock module, and the fourth ConvBlock module are the same as the structure of the first ConvBlock module. The first ConvBlock module includes a fifth convolution module, a first BN module, a first ReLU activation module, a sixth convolution module, a second BN module, a second ReLU activation module, and a residual connection module. The fourth intermediate feature is input into the first ConvBlock module for feature extraction to obtain a first ConvBlock feature, including: The fourth intermediate feature is extracted and dimensionally converted by the fifth convolution module and then input into the first BN module for batch normalization processing; The output value of the first BN module is introduced into the ReLU activation function through the first ReLU activation module for activation; The output value of the first ReLU activation module is subjected to feature extraction and dimension conversion by the sixth convolution module and then input into the second BN module for batch normalization processing; The output value of the second BN module is introduced into the ReLU activation function through the second ReLU activation module for activation; The fourth intermediate feature and the output value of the second ReLU activation module are weightedly calculated through the residual connection module to obtain the first ConvBlock feature.
6. The hydraulic structure crack identification method according to claim 1, characterized in that: The preprocessing of the crack image dataset includes: Adding Gaussian noise and changing saturation and brightness to each crack image in the crack image dataset in sequence; The Gaussian noise satisfies the following expression: ; in, is the preset standard deviation of Gaussian noise, is a natural constant, is the default mean of Gaussian noise.
7. A hydraulic structure crack identification device, characterized in that: include: A first data acquisition module is used to acquire a crack image dataset of a hydraulic structure, preprocess the crack image dataset, and divide the preprocessed crack image dataset into a training set and a validation set; A second data acquisition module is used to obtain an initial Swin-Unet model, wherein the decoder of the initial Swin-Unet model includes a Swin-Transformer-Block module; A first data processing module is used to introduce an ECA attention mechanism based on the initial Swin-Unet model and replace the Swin-Transformer-Block module with a target convolution module to obtain an improved intermediate model; A second data processing module uses the training set and the validation set to iteratively train and validate the intermediate model to obtain a target crack recognition model, wherein the intermediate model includes a feature extraction network, a Neck network, and a Head network connected in sequence. The feature extraction network is used to extract features from each crack image in the training set to obtain multiple crack feature maps corresponding to each crack image. Each crack feature map of the crack image is processed by the Neck network using the ECA attention mechanism and then input into the target convolution module for sequential upsampling, feature extraction, and feature splicing to obtain a target crack feature map corresponding to the crack image. The Head network is used to perform image segmentation on the target crack feature map to obtain a recognition result of the crack image to be detected. The recognition result is iteratively trained and validated based on the validation set to obtain the target crack recognition model; The crack image to be detected is input into the target crack recognition model to obtain a recognition result of the crack image to be detected.
8. An electronic device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When at least one of the programs is executed by at least one of the processors, the hydraulic structure crack identification method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium storing computer-executable instructions, characterized in that: The computer executable instructions are used to execute the hydraulic structure crack identification method according to any one of claims 1 to 6.