A method and system for detecting defects in underwater structures

CN122906488APending Publication Date: 2026-10-13DALIAN MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611407670.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-11
Publication Date
2026-10-13

AI Technical Summary

Technical Problem

[0003]现有水下视觉检测面临至少三类困难:一是水体吸收和散射导致颜色偏移、对比度降低和纹理模糊;二是真实缺陷样本采集成本高,裂缝和剥落等样本分布不均;三是水下巡检设备通常受功耗、体积和散热限制,难以部署计算量较大的检测模型

Benefits of technology

[0038]有益效果:本发明采用多尺度视网膜色彩恢复算法结合水下光衰减先验算法,改善水体吸收和散射造成的颜色偏移、对比度降低和纹理模糊,获得局部纹理和边缘细节增强的检测导向增强图像;基于自适应数据增强的第二代风格生成对抗网络生成裂缝区域,并结合真实水下背景图像构建带有缺陷标注的扩增训练样本,增加裂缝纹理和形态的多样性;基于 YOLOv10n 基础网络构建 YOLOv10n-C2f-SG-MLCA 轻量化缺陷检测模型,在维持较高检测精度的同时降低模型参数量和计算量,具备向资源受限水下巡检平台迁移部署的潜力;当检测结果包含裂缝时,基于检测结果近似获取裂缝长度估计值、裂缝最大宽度估计值和裂缝最小宽度估计值,为工程巡检和维护决策提供辅助数据。进一步地,本发明并非简单组合图像增强、数据扩增和目标检测网络,而是针对水下结构缺陷检测过程中存在的输入质量下降、缺陷样本不足以及边缘计算资源受限三个相互关联的问题进行分阶段协同设计。其中,MSRCR-ULAP 串联增强用于改善水下散射、颜色偏移和局部纹理缺失造成的检测输入质量下降;基于第二代风格生成对抗网络生成的裂缝区域扩增用于在保持真实水下背景分布的情况下补充裂缝纹理和形态变化;轻量化检测模型进一步根据缺陷目标在不同网络阶段的特征表达需求,对浅层、高层和融合层分别进行针对性优化。通过上述三级协同处理,使增强后的图像特征、扩充后的训练样本以及轻量化网络结构之间形成匹配关系,提升复杂水下环境下缺陷检测的适应能力。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122906488A_ABST
    Figure CN122906488A_ABST
Patent Text Reader

Abstract

The embodiment discloses a kind of underwater structure defect detection method and system, adopt multiscale retina color recovery algorithm to combine underwater light attenuation priori algorithm, obtain the detection guide enhancement image of good color consistency, local texture and edge detail enhancement;Based on the second generation style of adaptive data enhancement generation confrontation network generates crack area, and combines real underwater background image to construct augmented training sample with defect label;Based on YOLOv10n base network constructs C2f-SG-MLCA light weight defect detection model;Based on enhancement image and the light weight model after training obtains detection result, and further accurately obtains the multi-dimensional quantitative parameter such as crack actual length, skeleton point actual width, maximum width, minimum width and average width, while reducing model parameter quantity and amount of calculation, improve the adaptability and deployability of structure defect detection under complex underwater environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of underwater structure health monitoring, computer vision, deep learning target detection, and edge computing, and particularly to a method and system for detecting defects in underwater structures. Background Technology

[0002] Underwater bridge foundations, offshore wind turbine foundations, subsea pipelines, and hydraulic concrete components are subjected to long-term corrosion, erosion, and complex hydrodynamic environments, making their surfaces prone to defects such as cracks, spalling, corrosion pits, and localized damage. Timely identification of these defects is helpful for structural health monitoring, inspection records, and maintenance decisions.

[0003] Existing underwater visual inspection faces at least three types of difficulties: First, water absorption and scattering cause color shifts, reduced contrast, and blurred textures; second, the cost of collecting real defect samples is high, and samples such as cracks and peeling are unevenly distributed; and third, underwater inspection equipment is usually limited by power consumption, size, and heat dissipation, making it difficult to deploy inspection models with large computational requirements.

[0004] Existing methods mostly focus on improving image enhancement, data augmentation, or lightweighting of target detection networks, but a single strategy cannot simultaneously address the problems of input image degradation, insufficient samples, and resource-constrained deployment. Therefore, a solution for underwater structural defect detection that can coordinate image enhancement, defect region amplification, and lightweight detection is needed. Summary of the Invention

[0005] This invention discloses a method and system for detecting defects in underwater structures, in order to overcome the aforementioned technical problems.

[0006] To achieve the above objectives, the technical solution of the present invention is as follows: A method for detecting defects in underwater structures includes the following steps: S1: Acquire images of the underwater structure to be detected and real underwater background images for the training phase, and perform preprocessing; S2: Based on the image of the underwater structure to be detected, a multi-scale retinal color restoration algorithm is used to obtain an enhancement image for enhancing the local texture and edge details of underwater structural defects; then, based on the enhancement image, an underwater light attenuation prior algorithm is used to obtain an enhanced image after color consistency correction, i.e., a detection-guided enhancement image. S3: Based on the enhanced image after color consistency correction, a second-generation style generative adversarial network with adaptive data augmentation is used to generate crack regions, and based on the crack regions and real underwater background images, augmented training samples with defect annotations are constructed. S4: Based on the YOLOv10n basic network, construct the YOLOv10n-C2f-SG-MLCA lightweight defect detection model, and train the YOLOv10n-C2f-SG-MLCA lightweight defect detection model using real training samples and augmented training samples with defect annotations. S5: Based on the enhanced image after color consistency correction and the trained YOLOv10n-C2f-SG-MLCA lightweight defect detection model, obtain the detection results of underwater structural defects; and based on the detection results, obtain the actual length of the crack, the actual width of the crack at the skeleton point, the estimated maximum width of the crack, the estimated minimum width of the crack, and the average width of the crack.

[0007] Furthermore, the formula used to obtain the enhancement map is as follows:

[0008]

[0009]

[0010]

[0011] In the formula: Image pixel position; and These are all color channel numbers. , All are color channels; Input underwater structure image In the The pixel intensity of each color channel; For the first Multiscale Retinex response for each color channel; For scale quantity; For scale number; For the first Weights for each scale; For the first Gaussian wrapping function of scale; These are the normalization coefficients; For the first Gaussian standard deviation on each scale; This represents the convolution operation; Let be the Euclidean norm, i.e., the second norm; For the first Color recovery coefficient diagram for each color channel; and These are all color restoration parameters; To enhance the image In the The pixel intensity of each color channel; For normalization processing; Input underwater structure image In the The pixel intensity of each color channel.

[0012] Furthermore, the formula used to obtain the enhanced image after color consistency correction is as follows:

[0013]

[0014]

[0015]

[0016]

[0017]

[0018] In the formula: To enhance the image In the The pixel intensity of each color channel; The first one to be recovered after underwater optical attenuation compensation Channel image; For the first Channel background light component; For the first Channel transmittance; The attenuation difference between the red channel and the blue-green channel is calculated from the MSRCR enhancement map; , , These represent the pixel intensity of the MSRCR-enhanced image in the red, green, and blue channels, respectively. This is a relative depth estimate; This is the relative depth offset parameter; This is the attenuation difference coefficient; For the first Channel optical attenuation coefficient; This is the lower limit threshold for transmittance; This is for calculating the maximum value. It is an exponential function; The final detection-guided enhancement image; This is a color range truncation process; For normalization processing; The image of the red channel to be recovered after underwater light attenuation compensation; The image of the green channel to be recovered after underwater light attenuation compensation; This is the blue color channel image to be recovered after underwater light attenuation compensation.

[0019] Furthermore, the method for constructing the YOLOv10n-C2f-SG-MLCA lightweight defect detection model is as follows: In the YOLOv10n base network, the GhostConv lightweight convolutional module is used in stages P2 and P3, and the corresponding C2f feature extraction module is replaced with the C2f-SG module; in stages P4 and P5, the C2f_SHSA module with a fused single-head self-attention SHSA mechanism is used; in the PANet fusion path of the Neck feature fusion network, the corresponding C2f fusion module is replaced with the C2f-SG module; and a hybrid local channel attention MLCA module is added after the SPPF spatial pyramid pooling fast module and before the PSA partial self-attention module.

[0020] Furthermore, the GhostConv lightweight convolutional module includes a main convolutional submodule, a low-cost feature generation submodule, and a fusion output submodule; the main convolutional submodule performs convolution based on the input feature map to generate an intrinsic feature map. The low-cost feature generation submodule is based on the intrinsic feature map. Ghost feature maps are generated using depthwise convolution or linear transformation. The fusion output submodule will integrate the intrinsic feature maps. and Ghost feature map The output feature map is obtained after channel fusion. .

[0021] Furthermore, the C2f-SG module includes a channel partitioning submodule, a Ghost bottleneck stacking submodule, a channel splicing submodule, and... The convolutional fusion submodule; the channel partitioning submodule is used to obtain the first directly connected feature based on the input second feature map. Second processing features The Ghost bottleneck stacking submodule is used to process according to the second processing feature. The second intrinsic feature map is obtained. and Ghost feature map The channel splicing submodule will connect the first direct-connect feature. Second intrinsic feature map and Ghost feature map After splicing, Convolutional fusion of submodules to module output features .

[0022] Furthermore, the C2f_SHSA module includes a C2f branch processing structure and a single-head self-attention SHSA submodule; the C2f branch processing structure is used to perform branch transformation on the high-level semantic features in the P4 and P5 stages; the SHSA submodule is used to perform global context enhancement on the high-level semantic features within the C2f branch processing structure, and the enhanced features are fused by channel concatenation and convolution to obtain the output of the C2f_SHSA module.

[0023] Furthermore, the input to the Hybrid Local Channel Attention (MLCA) module is the high-level fusion feature output from the SPPF module and fed into the PSA module; the MLCA module includes a global average pooling branch and a local convolution branch, used to obtain the attention weight map and recalibrate the input features element by element. The calculation formula is as follows:

[0024]

[0025]

[0026]

[0027] In the formula: Channel weights; For local spatial response; This is an MLCA attention weight map; Output features for the MLCA module; and For fully connected layers or Convolutional mapping weights; It is a non-linear activation function; For global average pooling; High-level fusion features are output from the SPPF module and sent to the PSA module; For depthwise convolution; and The learnable fusion coefficient; For the Sigmoid function; This is element-wise multiplication.

[0028] Furthermore, the detection results include defect categories. Boundary box position and confidence level ; The formula used to obtain the actual length of the crack is as follows:

[0029]

[0030] In the formula: To measure the actual length of the ruler; To measure the length of the ruler pixels; This is the scaling factor; The length of the crack skeleton is in pixels; This is the actual length of the crack; The formula used to obtain the actual width of the crack at the skeleton point is as follows:

[0031]

[0032]

[0033] In the formula: For the first Tangent vectors at each skeleton point; For the first Normal vectors at each skeleton point; For the first One skeleton point; Index the skeleton points; For the first Tangent vectors at each skeleton point Component in the y-direction For the first Tangent vectors at each skeleton point The component in the x-direction; For the first The actual width of the crack at each skeleton point; This is the scaling factor; and The first The pixel distances from each skeleton point to the edge of the binarized crack along the positive and negative normal directions, respectively; For the first One skeleton point; The formulas used to obtain the estimated maximum crack width, the estimated minimum crack width, and the average crack width are as follows:

[0034]

[0035]

[0036] In the formula: This represents the number of skeleton sampling points; , and These are the estimated maximum width, estimated minimum width, and average width of the crack, respectively. This indicates that traversing all skeleton points makes The value is the largest; This indicates that traversing all skeleton points makes The value is the smallest.

[0037] A detection system for underwater structural defect detection includes: an image acquisition module, an image enhancement module, a training sample amplification module, a lightweight detection module, and a crack size estimation module; The image acquisition module is used to acquire images of the underwater structure to be detected and real underwater background images for the training phase, and to perform preprocessing. The image enhancement module is used to obtain an enhancement image for enhancing local texture and edge details of underwater structural defects by using the multi-scale retinal color restoration algorithm MSRCR based on the image of the underwater structure to be detected; and then to obtain an enhanced image after color consistency correction, i.e., a detection-guided enhancement image, by using the underwater light attenuation prior algorithm ULAP based on the enhancement image. The training sample augmentation module generates crack regions based on the enhanced image after color consistency correction and a second-generation style generative adversarial network with adaptive data augmentation. Based on the crack regions and the real underwater background image, it constructs augmented training samples with defect annotations. The lightweight detection module is used to obtain the detection results of underwater structural defects based on the enhanced image after color consistency correction and the trained YOLOv10n-C2f-SG-MLCA lightweight defect detection model. The crack size estimation module is used to obtain the actual crack length, the actual crack width at the skeleton point, the maximum crack width, the minimum crack width, and the average crack width based on the detection results. The crack size estimation module is used to extract the region of interest of the crack based on the defect detection results, and calculate the crack length, maximum width estimate, minimum width estimate and average width based on the measurement scale, binarization, noise reduction, skeleton extraction and skeleton normal width sampling.

[0038] Beneficial Effects: This invention employs a multi-scale retinal color restoration algorithm combined with an underwater light attenuation prior algorithm to improve color shift, contrast reduction, and texture blurring caused by water absorption and scattering, obtaining detection-guided enhanced images with enhanced local texture and edge details. A second-generation style generative adversarial network based on adaptive data augmentation generates crack regions, and augmented training samples with defect annotations are constructed using real underwater background images, increasing the diversity of crack textures and morphologies. A lightweight defect detection model, YOLOv10n-C2f-SG-MLCA, is built based on the YOLOv10n basic network, reducing the number of model parameters and computational load while maintaining high detection accuracy, possessing the potential for migration and deployment to resource-constrained underwater inspection platforms. When the detection results include cracks, approximate estimates of crack length, maximum crack width, and minimum crack width are obtained based on the detection results, providing auxiliary data for engineering inspection and maintenance decisions. Furthermore, this invention is not a simple combination of image enhancement, data augmentation, and target detection networks, but rather a phased collaborative design addressing three interrelated problems in underwater structural defect detection: decreased input quality, insufficient defect samples, and limited edge computing resources. Specifically, the MSRCR-ULAP cascaded enhancement is used to improve the quality degradation of detection input caused by underwater scattering, color shift, and local texture loss; crack region augmentation based on a second-generation style generative adversarial network is used to supplement crack texture and morphological changes while maintaining the realistic underwater background distribution; the lightweight detection model further optimizes the shallow, high-level, and fusion layers according to the feature representation requirements of the defect target at different network stages. Through the above three-level collaborative processing, a matching relationship is formed between the enhanced image features, the expanded training samples, and the lightweight network structure, improving the adaptability of defect detection in complex underwater environments. Attached Figure Description

[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 This is a flowchart of the underwater structure defect detection process of the present invention.

[0041] Figure 2 This is a schematic diagram of the overall process of the underwater structure defect detection method in an embodiment of the present invention.

[0042] Figure 3 This is a schematic diagram illustrating the application scenario of the underwater structural defect detection system in an embodiment of the present invention.

[0043] Figure 4 This is a schematic diagram illustrating the process of constructing a multi-source underwater structural defect dataset in an embodiment of the present invention.

[0044] Figure 5 This is a schematic diagram of the MSRCR-ULAP image enhancement process in an embodiment of the present invention.

[0045] Figure 6 This is a schematic diagram of the crack region generation, fusion, and annotation process in an embodiment of the present invention.

[0046] Figure 7 This is a schematic diagram of the lightweight detection model structure in an embodiment of the present invention.

[0047] Figure 8 This is a schematic diagram of the GhostConv convolutional structure in an embodiment of the present invention.

[0048] Figure 9 This is a schematic diagram of the C2f_SHSA module structure in an embodiment of the present invention.

[0049] Figure 10 This is a schematic diagram of the MLCA module structure in an embodiment of the present invention.

[0050] Figure 11 This is a schematic diagram of the crack geometry estimation process in an embodiment of the present invention.

[0051] Figure 12 This is a schematic diagram comparing image enhancement quality evaluation indicators in an embodiment of the present invention. Detailed Implementation

[0052] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0053] This embodiment describes a method for detecting defects in underwater structures, including the following steps: Figure 1 As shown: S1: Acquire images of the underwater structure to be detected and real underwater background images for the training phase, and perform preprocessing: The acquired images are uniformly adjusted to 640×640 resolution and converted to YOLO format using bounding box annotation. Real samples are divided into training set, validation set and test set. Specifically, the underwater structure images to be detected can be from on-site inspection images of underwater bridge pile foundations, offshore wind power foundations, subsea pipelines, or hydraulic concrete components, or from supplementary images collected from underwater samples in the laboratory or from historical inspection images; the real underwater background images are from real training samples and are used for subsequent crack area fusion and amplification.

[0054] In one implementation, the acquired images are uniformly adjusted to a resolution of 640×640 and converted to YOLO format using bounding box annotation. Real samples are divided into training set, validation set and test set. The amplified samples generated and fused by StyleGAN2-ADA are only included in the training set and not in the validation set and test set.

[0055] The underwater structural defects include cracks, spalling, corrosion pits, and localized damage. The dataset in this embodiment uses cracks and spalling as training and testing categories, and can be expanded to include corrosion pits and localized damage detection after adding corresponding labeled samples.

[0056] S2: MSRCR-ULAP Image Enhancement: Based on the image of the underwater structure to be detected, the multi-scale retinal color restoration algorithm MSRCR is used to obtain an enhanced image for enhancing the local texture and edge details of underwater structural defects; then, based on the enhanced image, the underwater light attenuation prior algorithm ULAP is used to obtain an enhanced image after color consistency correction, i.e., a detection-guided enhanced image.

[0057] Preferably, the formula used to obtain the enhancement map is as follows: Specifically, MSRCR enhancement includes: calculating color channels based on Gaussian wrap functions at multiple scales. Multiscale retinal response And through the color recovery function Correct the color channel response.

[0058] (1) (2) (3) (4) In the formula: Image pixel position; and These are all color channel numbers. , All are color channels; Input underwater structure image In the The pixel intensity of each color channel; For the first Multiscale Retinex response for each color channel; For scale quantity; For scale number; For the first Weights for each scale; For the first Gaussian wrapping function of scale; These are the normalization coefficients; For the first Gaussian standard deviation on each scale; This represents the convolution operation; It is the Euclidean norm, i.e., the second norm; For the first Color recovery coefficient diagram for each color channel; and These are all color restoration parameters; To enhance the image In the The pixel intensity of each color channel; For normalization processing; Input underwater structure image In the The pixel intensity of each color channel.

[0059] The formula used to obtain the enhanced image after color consistency correction is as follows: Specifically, the ULAP color consistency correction uses the MSRCR enhancement map. As input, an underwater optical attenuation prior algorithm is used to estimate underwater optical attenuation information, compensate for channel attenuation, and perform normalization processing to estimate the background light component of the channel. and channel transmittance Then, the RGB channels are compensated and normalized to obtain the detection-guided enhancement image.

[0060] (5) (6) (7) (8) (9) (10) In the formula: To enhance the image In the The pixel intensity of each color channel represents the input channel image for ULAP color consistency correction; The first one to be recovered after underwater optical attenuation compensation Channel image; For the first Channel background light component; For the first Channel transmittance; The attenuation difference between the red channel and the blue-green channel is calculated from the MSRCR enhancement map; , , These represent the pixel intensity of the MSRCR-enhanced image in the red, green, and blue channels, respectively. This is a relative depth estimate; This is the relative depth offset parameter; This is the attenuation difference coefficient; For the first Channel optical attenuation coefficient; This is the lower limit threshold for transmittance; This is for calculating the maximum value. It is an exponential function; The final detection-guided enhancement image; This is a color range truncation process; For normalization processing; The image of the red channel to be recovered after underwater light attenuation compensation; The image of the green channel to be recovered after underwater light attenuation compensation; This is the blue color channel image to be recovered after underwater light attenuation compensation.

[0061] This embodiment employs the ULAP algorithm to estimate underwater light attenuation information, compensate for channel attenuation, and normalize the enhanced image. The concatenation order is determined based on the formation process of underwater defect discernibility. Since underwater images initially suffer from local contrast reduction, edge blurring, and weakened defect texture, this embodiment first uses MSRCR to enhance local structural information, achieving high discernibility of crack edges and defect textures. Subsequently, ULAP is used for color consistency correction and underwater light attenuation compensation to reduce potential color deviations during enhancement. Performing color correction before texture enhancement might further amplify areas of color inconsistency during the enhancement process; therefore, this embodiment uses a concatenation method of MSRCR→ULAP.

[0062] S3: Crack region generation, fusion and annotation: Based on the enhanced image after color consistency correction, a second-generation style generative adversarial network with adaptive data augmentation is used to generate crack regions, and based on the crack regions and real underwater background images, augmented training samples with defect annotations are constructed. Specifically, during the training phase, a second-generation style generative adversarial network (StyleGAN2-ADA) based on adaptive data augmentation is used to generate crack regions. Based on the crack regions and the real underwater background image, the crack regions are fused with the real underwater background image to construct augmented training samples with defect annotations. The augmented training samples are only used during the training phase and are not included in the validation set or test set.

[0063] Specifically, the construction of the amplified training samples includes: generating crack regions using StyleGAN2-ADA; selecting underwater background images from real training samples; performing scale transformation, flipping, and color statistical matching on the crack regions; obtaining crack region masks through Otsu thresholding and morphological processing; embedding the processed crack regions into the underwater background images, and generating corresponding defect bounding box annotations.

[0064] When embedding the processed crack region into the underwater background image, Poisson image fusion is preferentially used to reduce boundary artifacts between the crack region and the underwater background image. When embedding the processed crack region into the real underwater background image, Poisson image fusion is preferentially used to reduce boundary artifacts between the crack region and the background image. When Poisson fusion fails, or when the fusion result shows obvious boundary artifacts, target area distortion, or mask position instability, Alpha-weighted fusion is used as a supplementary method. Unlike directly generating a complete underwater inspection image, this embodiment only generates the crack defect region and fuses it into the real underwater background image. Since the underwater structure background, lighting conditions, and imaging noise have strong scene correlation, directly generating a complete image can easily produce a background distribution inconsistent with the real inspection environment. By using a region-level generation method, the texture, lighting, and water disturbance features in the real background can be preserved, while only expanding the morphological and texture changes of the crack region, thereby reducing the domain difference between the generated sample and the real sample.

[0065] S4: Lightweight Detection Model Construction, Model Training and Inference: Based on the YOLOv10n basic network, a lightweight defect detection model YOLOv10n-C2f-SG-MLCA is constructed, and the YOLOv10n-C2f-SG-MLCA lightweight defect detection model is trained using real training samples and augmented training samples with defect annotations. Specifically, the YOLOv10n basic network includes a backbone network, a neck feature fusion network, and a decoupled detection head. The backbone network comprises multiple Conv convolutional units, a C2f feature extraction module, an SPPF spatial pyramid pooling fast module, and a PSA partial self-attention module, used to form P3, P4, and P5 multi-scale features. P4 is the fourth level of the backbone network, a high-level semantic feature stage downsampled 16 times relative to the input image, and P5 is the fifth level of the backbone network, a high-level semantic feature stage downsampled 32 times relative to the input image. The neck feature fusion network uses PANet for top-down and bottom-up multi-scale feature fusion; the decoupled detection head outputs the defect category, bounding box location, and confidence score.

[0066] Preferably, the method for constructing the YOLOv10n-C2f-SG-MLCA lightweight defect detection model is as follows: In the YOLOv10n base network, the GhostConv lightweight convolutional module is used in stages P2 and P3, and the corresponding C2f feature extraction module is replaced with the C2f-SG module; in stages P4 and P5, the C2f_SHSA module with a fused single-head self-attention SHSA mechanism is used; in the PANet fusion path of the Neck feature fusion network, the corresponding C2f fusion module is replaced with the C2f-SG module; and a hybrid local channel attention MLCA module is added after the SPPF spatial pyramid pooling fast module and before the PSA partial self-attention module.

[0067] Preferably, such as Figure 8 As shown, the GhostConv lightweight convolutional module includes a main convolutional submodule, a low-cost feature generation submodule, and a fusion output submodule; the main convolutional submodule performs convolution on the input feature map to generate an intrinsic feature map. The low-cost feature generation submodule is based on the intrinsic feature map. Ghost feature maps are generated using depthwise convolution or linear transformation. The fusion output submodule will integrate the intrinsic feature maps. and Ghost feature map The output feature map is obtained after channel fusion. .

[0068] Preferably, the C2f-SG module includes a channel partitioning submodule, a Ghost bottleneck stacking submodule, a channel splicing submodule, and... The convolutional fusion submodule; the channel partitioning submodule is used to obtain the first directly connected feature based on the input second feature map. Second processing features The Ghost bottleneck stacking submodule is used to process according to the second processing feature. The second intrinsic feature map is obtained. and Ghost feature map The channel splicing submodule will connect the first direct-connect feature. Second intrinsic feature map and Ghost feature map After splicing, Convolutional fusion of submodules to module output features .

[0069] like Figure 9 As shown, the C2f_SHSA module includes a C2f branch processing structure and a single-head self-attention SHSA submodule. The C2f branch processing structure is used to perform branch transformation on the high-level semantic features in the P4 and P5 stages. The SHSA submodule is used to perform global context enhancement on the high-level semantic features within the C2f branch processing structure, and the enhanced features are fused by channel concatenation and convolution to obtain the output of the C2f_SHSA module.

[0070] In this embodiment, the following improvements are made to the YOLOv10n structure: GhostConv replaces the corresponding convolutional modules in the P2 and P3 stages of the backbone network, and a C2f-SG module with a Ghost feature generation mechanism replaces the original C2f feature extraction module; a C2f_SHSA module with a single-head self-attention SHSA mechanism replaces the original C2f module in the P4 and P5 stages of the backbone network; an MLCA hybrid local channel attention module is added after the SPPF spatial pyramid pooling fast module and before the PSA partial self-attention module; in the top-down and bottom-up fusion paths of the PANet neck network, the corresponding C2f fusion module is replaced with a C2f-SG module.

[0071] The above network structure is designed differently according to the feature representation requirements of underwater defects in different network layers: the shallow stage focuses on the extraction of edge, texture and local structural information, and reduces redundant computation in the feature generation process through GhostConv and C2f-SG modules; the deep stage focuses on the semantic and contextual relationship expression of defect categories, and enhances long-distance feature association by integrating the SHSA mechanism inside the C2f structure; the feature fusion stage enhances the response of local abnormal regions through the MLCA module.

[0072] Since underwater crack detection targets are typically small in size, have weak edges, and poor texture continuity, this embodiment introduces GhostConv and C2f-SG modules in the shallow P2 and P3 stages to maintain the representation of defect edge features while reducing computational load. In the P4 and P5 stages, the C2f_SHSA module is used to enhance the association of high-level semantic features through a single-head self-attention mechanism. This module does not add an independent attention structure outside the C2f module, but rather integrates the SHSA mechanism within the C2f structure to improve the feature representation capability of the lightweight network for complex underwater defect targets.

[0073] Preferably, such as Figure 10 As shown, the input to the Hybrid Local Channel Attention (MLCA) module is the high-level fusion feature output from the SPPF module before being fed into the PSA module. The MLCA module includes a global average pooling branch and a local convolution branch, used to obtain the attention weight map and perform element-wise recalibration of the input features. The calculation formula is as follows: (11) (12) (13) (14) In the formula: Channel weights; For local spatial response; This is an MLCA attention weight map; Output features for the MLCA module; and For fully connected layers or Convolutional mapping weights; It is a non-linear activation function; For global average pooling; High-level fusion features are output from the SPPF module and sent to the PSA module; For depthwise convolution; and The learnable fusion coefficient; For the Sigmoid function; This is element-wise multiplication.

[0074] Specifically, in this embodiment, the input of the MLCA module is the high-level fusion feature output by the SPPF module and sent to the PSA module. Attention weights are generated jointly through global average pooling branch and local convolution branch, and the input features are recalibrated element by element, thereby enhancing the response of local abnormal regions such as cracks and peeling.

[0075] S5: Crack size estimation: Based on the enhanced image after color consistency correction and the trained YOLOv10n-C2f-SG-MLCA lightweight defect detection model, obtain the detection results of underwater structural defects; based on the detection results, obtain the actual crack length, the actual crack width at the skeleton point, the estimated maximum crack width, the estimated minimum crack width, and the average crack width.

[0076] Specifically, the lightweight defect detection model is trained using real training samples and the augmented training samples; the detection-guided enhanced image is input into the trained lightweight defect detection model, and the detection results of underwater structural defects are output, including defect category, bounding box location, and confidence level. Further, based on the detection results, crack geometry estimation is performed to obtain the actual crack length, the actual crack width at the skeleton point, the maximum crack width, the minimum crack width, and the average crack width.

[0077] The detection results include defect categories. Boundary box position and confidence level Extract the region of interest (ROI) of the crack based on the defect detection results. The region of interest in the crack is grayscaled, binarized, denoised, and its skeleton extracted.

[0078] (15) (16) (17) (18) (19) (20) (twenty four) (25) In the formula: To measure the actual length of the ruler; To measure the length of the ruler pixels; This is the scaling factor; The length of the crack skeleton is in pixels; This is the actual length of the crack; For the first One skeleton point; For the first Tangent vectors at each skeleton point; For the first Normal vectors at each skeleton point; and The first The pixel distances from each skeleton point to the edge of the binarized crack along the positive and negative normal directions, respectively; For the first The actual width of the crack at each skeleton point; This represents the number of skeleton sampling points; , and These are the estimated maximum width, estimated minimum width, and average width of the crack, respectively. For the first One skeleton point; This indicates that traversing all skeleton points makes The value is the largest; This indicates that traversing all skeleton points makes The value is minimized. The width estimation formula is a calculation method designed in this embodiment based on the detection results and the skeleton normal sampling process. It is used for engineering auxiliary analysis and does not replace high-precision underwater measurement equipment.

[0079] This embodiment also discloses an underwater structural defect detection system, including: an image acquisition module, an image enhancement module, a training sample amplification module, a lightweight detection module, and a crack size estimation module; The image acquisition module is used to acquire images of the underwater structure to be detected and real underwater background images for the training phase, and to perform preprocessing. The image enhancement module is used to obtain an enhanced image for enhancing local texture and edge details of underwater structural defects by using the multi-scale retinal color restoration algorithm MSRCR based on the image of the underwater structure to be detected; and then to obtain an enhanced image after color consistency correction, i.e., a detection-guided enhanced image, by using the underwater light attenuation prior algorithm ULAP based on the enhanced image. The training sample augmentation module generates crack regions based on the enhanced image after color consistency correction and a second-generation style generative adversarial network with adaptive data augmentation. Based on the crack regions and the real underwater background image, it constructs augmented training samples with defect annotations. Specifically, the training sample augmentation module generates crack regions based on the second-generation StyleGAN2-ADA adaptive data augmentation network and fuses them with real underwater background images to obtain augmented training samples with defect annotations. The lightweight detection module is used to obtain the detection results of underwater structural defects based on the enhanced image after color consistency correction and the trained YOLOv10n-C2f-SG-MLCA lightweight defect detection model. The lightweight detection module in this embodiment runs the YOLOv10n-C2f-SG-MLCA lightweight defect detection model and outputs the category, bounding box location, and confidence level of underwater structural defects. Specifically, the C2f-SG module is used in stages P2 and P3, and the C2f_SHSA module is used in stages P4 and P5. The corresponding C2f module in the PANet fusion path is replaced with the C2f-SG module, and the MLCA module is set after the SPPF module and before the PSA module.

[0080] The crack size estimation module is used to extract the region of interest of the crack based on the detection results when the detection results contain cracks, and to calculate the estimated crack length, the estimated maximum crack width, and the estimated minimum crack width based on the measurement scale, binarization, denoising, and skeleton extraction.

[0081] The crack size estimation module is used to extract the region of interest of the crack based on the defect detection results, and calculate the crack length, maximum width, minimum width and average width based on the measurement scale, binarization, denoising, skeleton extraction and skeleton normal width sampling.

[0082] Specifically, electronic devices based on the underwater structural defect detection method of the present invention, including processors, memory, programs stored in the memory and executable by the processor, and readable storage media, are all within the protection scope of the present invention.

[0083] The embodiments of the present invention are as follows: Example 1: Overall Process and System Scenario like Figure 2 As shown, this embodiment includes three stages: detection-guided image enhancement, crack region generation and amplification, and lightweight detection model training and inference. Instead of focusing on the input domain, data domain, and feature domain, it employs a collaborative design: the front-end MSRCR-ULAP first improves the visibility of defects in degraded images; the middle StyleGAN2-ADA performs region-level amplification to supplement the training sample distribution; and the back-end lightweight detection model optimizes its structure based on the differences in feature representation between shallow, high-level, and fusion layers, thereby ensuring a balance between input quality, sample coverage, and model deployment capabilities.

[0084] like Figure 3 As shown, the system may include a vision sensing unit, an edge computing unit, a memory, a sealed enclosure, a power management and communication interface, and a host computer or inspection terminal. The edge computing unit may be an ARM processor, an embedded GPU, or other low-power computing platforms. This system scenario is for illustrating potential deployment forms and does not correspond to the actual embedded test platform of this embodiment. Specific hardware platforms and system-level performance can be further verified according to engineering requirements.

[0085] Example 2: Dataset Construction like Figure 4 As shown, training data can be obtained through on-site engineering data collection, supplementary laboratory data collection, and amplification of crack regions. All collected images are uniformly resized and bounding box labeled, then converted to YOLO format. Amplified samples are only included in the training set, not the validation or test sets, as shown in Table 1. Table 1 Training Data Table

[0086] Example 3: MSRCR-ULAP Image Enhancement like Figure 5 As shown, MSRCR enhancement first calculates Retinex responses at multiple scales and performs color restoration to enhance local texture and edges; ULAP then performs underwater light attenuation information estimation, channel attenuation compensation, and normalization. Since underwater images initially suffer from local contrast reduction, edge blurring, and weakened defect textures, this embodiment first uses MSRCR to enhance local structural information, making crack edges and defect textures highly recognizable; subsequently, ULAP is used for color consistency correction and underwater light attenuation compensation to reduce potential color deviations during enhancement. If color correction is performed before texture enhancement, the enhancement process may further amplify areas of color inconsistency; therefore, this embodiment uses a cascaded approach of MSRCR→ULAP.

[0087] Example 4: Crack Region Generation and Amplification like Figure 6 As shown, unlike directly generating a complete underwater inspection image, this embodiment only generates the crack defect region using StyleGAN2-ADA and does not use the generated result directly as a complete inspection image. Instead, it fuses it with the real underwater background. Since the underwater structure background, lighting conditions, and imaging noise have strong scene correlations, directly generating a complete image can easily produce a background distribution inconsistent with the actual inspection environment. By using a region-level generation method, the texture, lighting, and water disturbance features in the real background can be preserved, while expanding the morphological and texture variations of the crack region, thereby reducing the domain difference between the generated sample and the real sample. Before fusion, scale transformation, color statistical matching, and mask extraction are performed. During fusion, Poisson fusion is preferred, and Alpha-weighted fusion is used when obvious boundary artifacts, target region distortion, or mask offset occur. After fusion, defect annotations are automatically generated based on the crack pasting position, as shown in Table 2.

[0088] Table 2 Training parameters for StyleGAN2-ADA

[0089] Example 5: Lightweight Detection Model like Figure 7 As shown, the lightweight detection model is built based on YOLOv10n. According to the YOLOv10n structure, GhostConv and C2f-SG are used in stage P2, GhostConv and C2f-SG in stage P3, SCDown and C2f_SHSA in stage P4, and SCDown and C2f_SHSA in stage P5. An MLCA module is set after the SPPF module and before the PSA module. In the top-down and bottom-up fusion paths of the neck network PANet, the corresponding C2f modules are replaced with C2f-SG modules. The detection head maintains multi-scale output, as shown in Table 3. The above configuration does not perform homogenized compression of each network layer, but rather performs differentiated optimization based on the feature responsibilities of different layers: the shallow stages of P2 / P3 mainly extract crack edges, textures, and local structures, using GhostConv and C2f-SG to reduce computational redundancy and preserve detailed representations; the deep stages of P4 / P5 mainly express target semantics, crack continuity, and contextual relationships, using C2f_SHSA with SHSA fusion mechanism to supplement long-distance feature associations; MLCA is set after SPPF and before PSA to enhance the response of local anomalous regions before the high-level fused features enter the self-attention processing.

[0090] Table 3 Lightweight Detection Model Module Configuration

[0091] Example 6: Training and Inference Examples During training, both real and augmented training samples can be used. During inference, the image processed by MSRCR-ULAP is input into the trained lightweight detection model to obtain the defect category, location, and confidence level. In one implementation example, the model has approximately 1.78M parameters and a computational cost of approximately 4.5 GFLOPs, as shown in Table 4. This data is used to illustrate the low model complexity and does not constitute a limitation of the claims.

[0092] Table 4 CPU Inference Performance Test Results

[0093] Furthermore, the following experimental results illustrate the effectiveness of the present invention under the corresponding experimental conditions, and do not constitute a limitation on the scope of protection of the claims.

[0094] (1) Examples of ablation experiments using image enhancement strategies are shown in Table 5.

[0095] Table 5 Ablation Experiments Using Image Enhancement Strategies

[0096] The results above show that the MSRCR→ULAP tandem enhancement achieves higher mAP50 and mAP50-95, indicating that enhancing crack texture and edge structure first, and then correcting underwater color consistency, is beneficial to improving the identifiability of defect areas in degraded underwater images.

[0097] (2) Examples of ablation experiments using the crack region amplification strategy are shown in Table 6.

[0098] Table 6 Ablation experiments using the crack region amplification strategy

[0099] The results above show that StyleGAN can supplement crack texture and morphological changes after generating crack regions and integrating them into the real underwater background. When used in conjunction with geometric augmentation, mAP50 and Recall are relatively stable, indicating that regional crack augmentation is suitable as a training supplement to real samples, rather than directly replacing the real validation and test sets.

[0100] (3) Examples of ablation experiments for lightweight detection model modules are shown in Table 7.

[0101] Table 7 Ablation Experiment of Lightweight Detection Model Module

[0102] The results show that the Ghost structure reduces the number of parameters from 2.26M to 1.78M and the computational cost from 6.5GFLOPs to 4.5GFLOPs, but lightweighting alone causes a slight decrease in recall. SHSA and MLCA can compensate for global context and local salient defect responses. The combination of these three structures achieves a 78.2% mAP50 while maintaining low parameter and computational costs, resulting in a detection energy efficiency ratio of 17.38, demonstrating a balance between detection performance and model complexity. Note: Edes is the detection energy efficiency index, calculated as mAP50 / GFLOPs, where mAP50 is a percentage value used to compare detection performance per unit of computational cost. As can be seen from the above results, the Ghost structure can reduce the number of parameters from 2.26M to 1.78M and the computational cost from 6.5GFLOPs to 4.5GFLOPs. When the three are combined, a mAP50 of 78.2% is achieved while maintaining a low number of parameters and computational cost, which reflects the balance between detection performance and model complexity.

[0103] (4) Examples of complex underwater conditions and CPU inference tests, as shown in Tables 8 and 9.

[0104] Table 8. Tests under complex underwater conditions

[0105] Table 9 CPU Inference Test

[0106] CPU forward inference results show that, with 8 threads, the model achieves 16.10 FPS at a 640×640 input size and 35.81 FPS at a 320×320 input size. These results illustrate the model's potential for migration and deployment to low-power CPUs or edge computing platforms. However, actual engineering deployment speed will be affected by differences in image reading, preprocessing, post-processing, communication, and hardware platforms.

[0107] Example 7: Crack Geometry Estimation like Figure 11 As shown, the crack ROI can be extracted based on the detection results, and grayscale conversion, binarization, denoising and skeleton extraction are performed in sequence; then, the estimated crack length, estimated crack maximum width and estimated crack minimum width are calculated by combining the measurement scale.

[0108] Example 8: Quality Evaluation and Synergistic Effect Description like Figure 12 As shown, UCIQE and UIQM can be used to evaluate the enhanced image quality. These evaluation results are only used to illustrate the impact of the image enhancement methods in the embodiments on image quality and do not constitute a necessary limitation of the claims.

[0109] In summary, the technical effectiveness of this invention does not stem from the performance improvement of a single module, but rather from the synergistic relationship between the three stages: the front-end MSRCR→ULAP enhancement improves the visibility of defect features in degraded underwater images; the intermediate crack region amplification increases the coverage of training samples while preserving the true underwater background distribution; and the back-end lightweight detection structure is specifically optimized based on the characteristics of shallow, high-level, and fusion layers. Through the collaborative processing of the input domain, data domain, and feature domain, structural defect detection in complex underwater environments is achieved while maintaining a low number of model parameters and computational cost. The detection method in this embodiment, after acquiring the underwater structure image, sequentially performs multi-scale retinal color restoration (MSRCR) enhancement and underwater light attenuation prior (ULAP) color consistency correction to obtain a detection-guided enhanced image suitable for defect identification. During the training phase, a second-generation style generative adversarial network (StyleGAN2-ADA) based on adaptive data augmentation generates only crack defect regions and fuses the crack regions with the real underwater background image to construct augmented training samples with defect annotations. During the detection phase, a lightweight defect detection model YOLOv10n-C2f-SG-MLCA is constructed based on YOLOv10n. In the shallow P2 / P3 stages, GhostConv and C2f-SG are used to reduce redundancy and preserve local details. In the deep P4 / P5 stages, C2f_SHSA is used to supplement long-range semantic representations. After SPPF and before PSA, MLCA is used to enhance local defect responses. C2f-SG is used in the PANet fusion path to control the complexity of the fusion stage. This results in a synergistic effect between front-end enhancement, intermediate region-level amplification, and back-end layered detection structures, improving the detection adaptability and deployability under conditions of underwater image degradation, insufficient defect samples, and limited edge platform resources.

[0110] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for detecting defects in underwater structures, characterized in that, Includes the following steps: S1: Acquire images of the underwater structure to be detected and real underwater background images for the training phase, and perform preprocessing; S2: Based on the image of the underwater structure to be detected, a multi-scale retinal color restoration algorithm is used to obtain an enhancement image for enhancing the local texture and edge details of underwater structural defects; then, based on the enhancement image, an underwater light attenuation prior algorithm is used to obtain an enhanced image after color consistency correction, i.e., a detection-guided enhancement image. S3: Based on the enhanced image after color consistency correction, a second-generation style generative adversarial network with adaptive data augmentation is used to generate crack regions, and based on the crack regions and real underwater background images, augmented training samples with defect annotations are constructed. S4: Based on the YOLOv10n basic network, construct the YOLOv10n-C2f-SG-MLCA lightweight defect detection model, and train the YOLOv10n-C2f-SG-MLCA lightweight defect detection model using real training samples and augmented training samples with defect annotations. S5: Based on the enhanced image after color consistency correction and the trained YOLOv10n-C2f-SG-MLCA lightweight defect detection model, obtain the detection results of underwater structural defects; and based on the detection results, obtain the actual length of the crack, the actual width of the crack at the skeleton point, the estimated maximum width of the crack, the estimated minimum width of the crack, and the average width of the crack.

2. The underwater structural defect detection method according to claim 1, characterized in that, The formula used to obtain the enhancement map is as follows: In the formula: Image pixel position; and These are all color channel numbers. , These are the red channel, green channel, and blue channel, respectively. Input underwater structure image In the The pixel intensity of each color channel; For the first Multiscale Retinex response for each color channel; For scale quantity; For scale number; For the first Weights for each scale; For the first Gaussian wrapping function of scale; These are the normalization coefficients; For the first Gaussian standard deviation on each scale; This represents the convolution operation; Let be the Euclidean norm, i.e., the second norm; For the first Color recovery coefficient diagram for each color channel; and These are all color restoration parameters; To enhance the image In the The pixel intensity of each color channel; For normalization processing; Input underwater structure image In the The pixel intensity of each color channel.

3. The underwater structural defect detection method according to claim 1, characterized in that, The formula used to obtain the enhanced image after color consistency correction is as follows: In the formula: To enhance the image In the The pixel intensity of each color channel; The first one to be recovered after underwater optical attenuation compensation Channel image; For the first Channel background light component; For the first Channel transmittance; The attenuation difference between the red channel and the blue-green channel is calculated from the MSRCR enhancement map; , , These represent the pixel intensity of the MSRCR-enhanced image in the red, green, and blue channels, respectively. This is a relative depth estimate; This is the relative depth offset parameter; This is the attenuation difference coefficient; For the first Channel optical attenuation coefficient; This is the lower limit threshold for transmittance; This is for calculating the maximum value. It is an exponential function; The final detection-guided enhancement image; This is a color range truncation process; For normalization processing; The image of the red channel to be recovered after underwater light attenuation compensation; The image of the green channel to be recovered after underwater light attenuation compensation; This is the blue color channel image to be recovered after underwater light attenuation compensation.

4. The underwater structural defect detection method according to claim 1, characterized in that, The method for constructing the YOLOv10n-C2f-SG-MLCA lightweight defect detection model is as follows: In the YOLOv10n base network, the GhostConv lightweight convolutional module is used in stages P2 and P3, and the corresponding C2f feature extraction module is replaced with the C2f-SG module; in stages P4 and P5, the C2f_SHSA module with a fused single-head self-attention SHSA mechanism is used; in the PANet fusion path of the Neck feature fusion network, the corresponding C2f fusion module is replaced with the C2f-SG module; and a hybrid local channel attention MLCA module is added after the SPPF spatial pyramid pooling fast module and before the PSA partial self-attention module.

5. The underwater structural defect detection method according to claim 4, characterized in that, The GhostConv lightweight convolutional module includes a main convolutional submodule, a low-cost feature generation submodule, and a fusion output submodule; the main convolutional submodule performs convolution on the input feature map to generate an intrinsic feature map. The low-cost feature generation submodule is based on the intrinsic feature map. Ghost feature maps are generated using depthwise convolution or linear transformation. The fusion output submodule will integrate the intrinsic feature maps. Ghost feature map The output feature map is obtained after channel fusion. .

6. The underwater structural defect detection method according to claim 4, characterized in that, The C2f-SG module includes a channel partitioning submodule, a Ghost bottleneck stacking submodule, a channel splicing submodule, and... The convolutional fusion submodule; the channel partitioning submodule is used to obtain the first directly connected feature based on the input second feature map. Second processing features ; The Ghost bottleneck stacking submodule is used to determine the second processing feature. The second intrinsic feature map is obtained. Ghost feature map ; The channel splicing submodule will connect the first direct-connect feature Second intrinsic feature map Ghost feature map After splicing, Convolutional fusion of submodules to module output features .

7. The underwater structural defect detection method according to claim 4, characterized in that, The C2f_SHSA module includes a C2f branch processing structure and a single-head self-attention SHSA submodule; the C2f branch processing structure is used to perform branch transformation on the high-level semantic features of the P4 and P5 stages; The SHSA submodule is used to perform global context enhancement on high-level semantic features within the C2f branch processing structure, and then merges the enhanced features through channel concatenation and convolution to obtain the output of the C2f_SHSA module.

8. The underwater structural defect detection method according to claim 4, characterized in that, The input to the Hybrid Local Channel Attention (MLCA) module is the high-level fusion feature output from the SPPF module and fed into the PSA module; the MLCA module includes a global average pooling branch and a local convolution branch, which are used to obtain the attention weight map and recalibrate the input features element by element. The calculation formula is as follows: In the formula: Channel weight; For local spatial response; This is an MLCA attention weight map; Output features for the MLCA module; and For fully connected layers or Convolutional mapping weights; It is a non-linear activation function; For global average pooling; High-level fusion features are output from the SPPF module and sent to the PSA module; For depthwise convolution; and The learnable fusion coefficient; For the Sigmoid function; This is element-wise multiplication.

9. The underwater structural defect detection method according to claim 1, characterized in that, The detection results include defect categories. Boundary box position and confidence level ; The formula used to obtain the actual length of the crack is as follows: In the formula: To measure the actual length of the ruler; To measure the length of the ruler pixels; This is the scaling factor; The length of the crack skeleton is in pixels; This is the actual length of the crack; The formula used to obtain the actual width of the crack at the skeleton point is as follows: In the formula: For the first Tangent vectors at each skeleton point; For the first Normal vectors at each skeleton point; For the first One skeleton point; Index the skeleton points; For the first Tangent vectors at each skeleton point Component in the y-direction For the first Tangent vectors at each skeleton point The component in the x-direction; For the first The actual width of the crack at each skeleton point; This is the scaling factor; and The first The pixel distances from each skeleton point to the edge of the binarized crack along the positive and negative normal directions, respectively; For the first One skeleton point; The formulas used to obtain the estimated maximum crack width, the estimated minimum crack width, and the average crack width are as follows: In the formula: This represents the number of skeleton sampling points; , and These are the estimated maximum width, estimated minimum width, and average width of the crack, respectively. This indicates that traversing all skeleton points makes The value is the largest; This indicates that traversing all skeleton points makes The value is the smallest.

10. The detection system of the underwater structural defect detection method according to any one of claims 1-9, characterized in that, include: Image acquisition module, image enhancement module, training sample amplification module, lightweight detection module, crack size estimation module; The image acquisition module is used to acquire images of the underwater structure to be detected and real underwater background images for the training phase, and to perform preprocessing. The image enhancement module is used to obtain an enhancement image for enhancing local texture and edge details of underwater structural defects by using the multi-scale retinal color restoration algorithm MSRCR based on the image of the underwater structure to be detected; and then to obtain an enhanced image after color consistency correction, i.e., a detection-guided enhancement image, by using the underwater light attenuation prior algorithm ULAP based on the enhancement image. The training sample augmentation module generates crack regions based on the enhanced image after color consistency correction and a second-generation style generative adversarial network with adaptive data augmentation. Based on the crack regions and the real underwater background image, it constructs augmented training samples with defect annotations. The lightweight detection module is used to obtain the detection results of underwater structural defects based on the enhanced image after color consistency correction and the trained YOLOv10n-C2f-SG-MLCA lightweight defect detection model. The crack size estimation module is used to obtain the actual crack length, the actual crack width at the skeleton point, the maximum crack width, the minimum crack width, and the average crack width based on the detection results. The crack size estimation module is used to extract the region of interest of the crack based on the defect detection results, and calculate the crack length, maximum width estimate, minimum width estimate and average width based on the measurement scale, binarization, noise reduction, skeleton extraction and skeleton normal width sampling.