An underwater crack automatic detection method based on geometric curvature prior enhancement of a visual large model
Patent Information
- Application Number
- CN202611082341.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-21
- Publication Date
- 2026-08-18
AI Technical Summary
本发明旨在克服水下复杂环境干扰,实现对水下大坝裂缝的高保真分割与高精度物理量化,从而显著提升大坝水下缺陷检测的准确度与工程实用性
[0007] The advantages of this invention are as follows: The method and system of this invention construct a dedicated dataset for underwater cracks, establish a data-driven feature model integrating lightweight DeepLabv3+ and geometric prior information based on the principal curvature of the Hessian matrix, and combine a cueless GCUR-SAM network model with LoRA fine-tuning technology. This achieves high-fidelity identification and fully automatic segmentation of cracks in low-contrast underwater scenes. Distortion is eliminated by combining an underwater multi-media remapping model, topological branches are pruned using median transformation and discrete skeleton evolution algorithms, and the true physical width of the cracks is accurately calculated using an improved FWHM algorithm. A PyQt5 interactive interface is integrated to achieve real-time visualization and data archiving of the entire process of correction, segmentation, and quantization. The constructed automated underwater crack detection and quantization system overcomes the limitations of traditional large-scale visual models that rely on manual interaction, effectively solves the problem of geometric parameter measurement errors caused by underwater refraction, and significantly improves the accuracy and efficiency of underwater concrete structure defect monitoring.
Smart Images

Figure CN122597416A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing technology, and relates to an automated underwater crack detection method based on a geometric curvature a priori enhanced visual large model. Background Technology
[0002] Large hydraulic structures and underwater infrastructure are prone to surface cracks during long-term service due to the combined effects of water pressure loads, water erosion, and temperature stress. Cracks, as an early physical indicator of structural health degradation, can severely impair the strength and durability of the structure, requiring timely detection and intervention. Traditional underwater detection methods, such as manual inspection, drainage checks, and monitoring with embedded sensors, suffer from high operational risks, low detection efficiency, or insufficient reliability. Existing automatic detection technologies mainly face the following problems: 1) The complex underwater environment (such as light attenuation and suspended object scattering) results in extremely low image contrast, making feature extraction by conventional algorithms difficult and easily leading to crack breakage and false detections; 2) Most detection and quantification methods ignore the geometric distortion caused by underwater medium refraction, remaining at the pixel-level statistics and lacking rigorous physical mapping; 3) Detection systems are difficult to apply to actual engineering projects to achieve fully automated, high-precision data acquisition and real-time analysis.
[0003] Although deep learning and large-scale visual models (such as the Segmentation All Model, SAM) have been applied to crack detection in recent years, existing methods still have significant shortcomings: 1) Standard large-scale models heavily rely on manually provided visual cues such as points and boxes, making fully automated detection impossible, and lacking understanding of specific underwater domains, resulting in poor segmentation robustness; 2) The accuracy of quantization algorithms needs improvement, as mask burrs easily generate redundant branches, leading to low crack quantization accuracy; 3) There is a lack of an integrated solution covering the entire process of imaging correction, intelligent segmentation, and physical quantization. Therefore, developing an intelligent system based on an improved SAM model that can achieve high-fidelity detection, accurate physical quantization, and engineering applications of underwater cracks has significant practical engineering value. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention proposes an automated underwater crack detection method and system based on geometric curvature prior enhancement. This invention aims to overcome interference from the complex underwater environment, achieving high-fidelity segmentation and high-precision physical quantification of underwater dam cracks, thereby significantly improving the accuracy and engineering practicality of underwater dam defect detection.
[0005] The technical solution of the present invention: An automated underwater crack detection method based on a geometric curvature prior algebraic enhanced visual large model includes the following steps: S1. Obtain the underwater crack dataset; Underwater crack data was collected on-site at the underwater dam using an underwater robot. The collected underwater crack data was then transmitted back to the terminal for preprocessing. Clear underwater crack images were extracted frame by frame, and crack labels were manually added to obtain an underwater crack dataset. The underwater crack image dataset was then divided into training, validation, and test sets according to the proportions. S2. Based on the underwater multi-media imaging model, calculate and extract camera intrinsic parameters, camera extrinsic parameters and distortion correction parameters, and construct a remapping matrix to eliminate underwater refraction and perspective distortion. The underwater multi-medium imaging model is used to characterize the process by which spatial points on the surface of a real crack are projected onto the camera imaging plane after being refracted by three media: water, glass, and air. The underwater multi-medium imaging model includes coordinate transformation relationships, three-medium refraction constraint relationships, and optical path decomposition equations. The coordinate transformation relationship is as follows: In the world coordinate system, assuming the spatial point on the actual crack surface is... Transform it to the camera coordinate system using camera extrinsic parameters: in, Represents the spatial coordinates of a point on the actual crack surface in the world coordinate system. This represents the coordinates of the corresponding point in the camera coordinate system. ; It is the camera's rotation matrix. It is the camera's translation vector; The three-medium refraction constraint relationship is: light rays from a point in space... Light propagates to the camera's optical center, passing sequentially through water, glass, and air. According to Snell's law, light rays satisfy strict constraints when propagating in different media: in, , , These are the refractive indices of water, glass, and air, respectively. , , These are the angles between the direction of light propagation in water, glass, and air and the normal direction of the medium interface, respectively. The optical path decomposition equation is used to geometrically decompose the refracted light path from a spatial point on the real crack surface to the camera's optical center in both the depth direction and the direction parallel to the imaging plane. Specifically, it is expressed as: in, Spatial points in the camera coordinate system Depth coordinates Let be the distance from the inner surface of the glass to the optical center of the camera. For the thickness of the glass, For spatial points Vertical water depth to the outer surface of the glass. It is the equivalent radial projection distance; When light enters the camera lens, let the pixel coordinates in the underwater crack image be... Based on the distortion correction parameters, the pixel coordinates Perform distortion correction to obtain the distortion-corrected pixel coordinates. Then, using camera intrinsics, the coordinates of the distortion-free pixels are determined. Convert to normalized camera coordinates And based on normalized camera coordinates Determine the angle of light exiting the air By simultaneously applying the three-medium refraction constraint relationship and the optical path decomposition equation, the pixel coordinates determined by the underwater multi-medium imaging model are obtained. A nonlinear mapping function to actual three-dimensional underwater coordinates; To obtain the camera's intrinsic parameters, extrinsic parameters, distortion correction parameters, and physical parameters of the underwater multi-media imaging model, a two-stage calibration strategy of air calibration and underwater refraction parameter optimization is adopted. In the air calibration stage, multiple calibration images containing a planar calibration plate are acquired at different poses, and the Zhang Zhengyou calibration method is used to calibrate the calibration images to obtain the camera's intrinsic parameters, distortion correction parameters, and the camera's extrinsic parameters corresponding to each calibration image. In the underwater refraction parameter optimization stage, a slime mold algorithm is introduced to globally optimize the underwater refraction parameters in the underwater multi-media imaging model, using the root mean square reprojection error as the optimization function. in, It is the total number of valid corner points extracted from the calibrated image under multiple views. It is the first j The first calibration image i The actual two-dimensional pixel coordinates of each corner point It is the reprojection of two-dimensional pixel coordinates. and They are the first i The rotation matrix and translation vector corresponding to the calibration image; The absolute reference depth of the target is determined based on a nonlinear mapping function. Using the absolute reference depth as a reference, forward optical path tracing is performed on the coordinates of each pixel in the underwater crack image to establish a global mapping relationship between the original distorted pixel coordinates and the corrected pixel coordinates. The global mapping relationship is stored as a remapping matrix. The underwater crack image is resampled using the remapping matrix to obtain a corrected image that eliminates underwater refraction and perspective distortion and conforms to the geometric relationship of pinhole perspective. S3. Construct the GCUR-SAM network model. Use the underwater crack dataset obtained in step S1 to train and test the GCUR-SAM network model to obtain a detection model for underwater crack segmentation. The construction of the GCUR-SAM network model specifically includes: First, a segmentation model is constructed, and its interaction paradigm and decoding mechanism are reconstructed to form an end-to-end automatic segmentation structure suitable for underwater crack images. During the training and forward inference phases, sparse cue inputs are eliminated, and a fixed empty cue feature vector is used as the output of the cue encoder. The image encoder extracts features from the input underwater crack image to obtain high-dimensional global image features. The high-dimensional global image features and the empty cue feature vector are input together into the mask decoder to achieve end-to-end feature mapping from the underwater crack image to the crack segmentation mask. The mask decoder is configured to a single mask output mode to eliminate the ambiguity of global, local, and sub-local results caused by multiple mask outputs, and retains a single straight-through output branch, enabling the mask decoder to output a unique underwater crack segmentation result through deterministic decoding. Secondly, a low-rank adaptation method is used to efficiently fine-tune the segmentation model, freezing the pre-trained backbone network parameters, and introducing two low-rank trainable matrices into the target layer of the image encoder to approximate the weight update amount: in, It is the input vector. This is the original weight matrix. It is the parameter update matrix. It is a dimension reduction matrix. It is an upgraded matrix. It is a fine-tuning setting of the rank. It is a low-rank update scaling factor. It is the dimension of the input vector. It is the dimension of the output vector; The fine-tuned segmentation model further combines the data-driven features of the lightweight DeepLabv3+ network with geometric prior information based on the principal curvature of the Hessian matrix to construct the GCUR-SAM network model. The lightweight DeepLabv3+ network serves as a refinement network, used to refine the crack segmentation results by incorporating the global spatial prior from the "All Segmentation" model output. The underwater crack image is concatenated with the coarse predicted probability map from the "All Segmentation" model output along the channel dimension to construct a four-channel fusion feature, which is then used as the input to the lightweight DeepLabv3+ network. The backbone of the lightweight DeepLabv3+ network employs ResNet-18. The hollow spatial pyramid pooling module includes 1×1 convolutional branches and different dilation rates. A 3×3 dilated convolution branch and a pooling branch are used to capture feature information at different scales of underwater crack images. The low-level feature maps of the backbone network are reduced in channel dimension by 1×1 convolution, and then concatenated with the features output by the dilated spatial pyramid pooling module and upsampled. After that, the predicted incremental result of the underwater crack image is output by 3×3 convolution and upsampling. Finally, the coarse Logits output by the mask decoder of the segmentation model are residually connected with the predicted incremental result of the underwater crack image, and the predicted probability map is output by passing the Sigmoid activation function. The geometric prior based on the principal curvatures of the Hessian matrix is as follows: Convert the input underwater crack image to a grayscale image. And using a two-dimensional Gaussian kernel Smoothing a grayscale image yields a smoothed image. Calculate the second-order partial derivatives of the smoothed image at each pixel and construct the Hessian matrix. : in, It is a smoothed grayscale image. , , These represent the second-order partial derivatives of the underwater crack image in the horizontal, vertical, and horizontal-vertical mixed directions, respectively. Find the eigenvalues of the Hessian matrix at each pixel. and The larger of the two absolute values is extracted as the maximum principal curvature response map representing the crack intensity at that pixel. The maximum principal curvature response map was then normalized. Linear mapping to the [0, 1] interval yields the geometric prior weight graph: in, It is a geometric prior weight graph. and These are the global maximum and global minimum values in the maximum principal curvature response plot, respectively. The predicted probability map obtained by the output of the lightweight DeepLabv3+ network and its residual connection is fused with the geometric prior weight map at the pixel level to obtain a geometrically constrained enhanced prediction probability result: in, It is the predicted probability result after geometric prior enhancement. It is a predicted probability map obtained from the output of a lightweight DeepLabv3+ network and through residual connections. It is the intensity factor that controls the geometric prior; Finally, the predicted probability results after geometric prior enhancement are thresholded to obtain the underwater crack segmentation results.
[0006] The GCUR-SAM network model is trained, validated, and tested using the training, validation, and test sets obtained in step S1. During the training phase, the training epochs, batch sizes, optimizer, learning rate, momentum parameter, and weight decay are set. A hybrid loss mechanism combining cross-entropy loss and Dice loss is used during training. in, Represents cross-entropy loss, This represents the Dice loss; during the validation phase, the GCUR-SAM training parameters are adjusted based on the segmentation results of the validation set, and the optimal model is saved; during the testing phase, the test set is input into the trained GCUR-SAM network model, and the underwater crack segmentation results are output to obtain the detection model for underwater crack segmentation. S4. Perform topology trimming on the underwater crack segmentation results output by the detection model obtained in step S3, and calculate the true physical width of the underwater cracks by combining the improved FWHM algorithm. The underwater crack segmentation results output in step S3 are thresholded to obtain an underwater crack binary segmentation mask. Based on the underwater crack binary segmentation mask, an unpruned skeleton and distance transformation matrix are obtained through median transformation. (Skeleton point set) Each pixel in the matrix represents the center of a maximum inscribed circle; the distance transformation matrix records the radius of the maximum inscribed circle at the corresponding skeleton point. The crack morphology is reconstructed using the union of all the largest inscribed circles on the skeleton. in, Represented by skeleton points Center of the circle A function of radius; The undressed skeleton is topologically pruned using a discrete skeleton evolution algorithm, transforming it into a graph model composed of nodes and edges. Edges with a degree of 1 are retrieved to obtain the final branches of the skeleton. The number of unique pixels contributed by the terminal branches of each skeleton to the reconstructed shape is calculated, and this number of unique pixels is used as the weight of the terminal branches of the corresponding skeleton. When the weight of the terminal branch of a skeleton is less than the set area threshold, the terminal branch of the skeleton is determined to be a pseudo-branch that contributes very little to the overall shape and is removed to obtain the pruned crack skeleton. An improved full width at half maximum (FWHM) algorithm is constructed to extract the pixel-level width of underwater cracks. The algorithm slides along the pruned crack skeleton with a fixed step size, selecting local neighboring skeleton points before and after the current crack skeleton center point, and calculating the coordinate differences of these local neighboring skeleton points in the horizontal and vertical directions. and and according to and Construct the tangent vector; the unit normal vector perpendicular to the tangent vector. Defined as: Using the current crack skeleton center point as a reference, construct a structure with a length of [length missing] along the positive and negative directions of the unit normal vector. The measurement line is oversampled at 0.5 pixel intervals to obtain the set of sampling points on the measurement line: in, These are the coordinates of the sampling points on the measurement line. These are the coordinates of the center point of the current crack skeleton. It is the sampling position parameter along the unit normal vector direction. ; The corrected image obtained in step S2 is converted into a corrected grayscale image matrix. A bilinear interpolation algorithm is used, employing the grayscale values of the four adjacent pixels surrounding each sampling point, and the grayscale value of each sampling point is estimated based on spatial distance weighting. All sampling points are traversed, and the corrected grayscale image matrix is converted into a one-dimensional grayscale profile curve distributed along the measurement line. A bidirectional scan is performed from the grayscale valley position at the center of the crack in the one-dimensional grayscale profile curve as the starting point, extending outwards to both sides. When the grayscale crack exceeds the judgment threshold, the corresponding left and right boundary index positions are recorded, and then the pixel width of the underwater crack is calculated. in, It is a threshold for judgment. It is the minimum gray value of a one-dimensional grayscale profile curve. It's local contrast. It is the threshold proportionality coefficient. ; It is the pixel width of the underwater crack. and These are the left and right boundary point indices; Finally, image correction and underwater crack physical size measurement are performed based on the remapping matrix constructed in step S2: in, The absolute reference depth of the target location. For the camera's equivalent focal length, It is the actual physical width of the underwater crack. It is the ratio factor between physical and pixel dimensions; S5 uses PyQt5 to build an interactive interface, integrating image correction, fine crack segmentation, and crack quantization algorithms to achieve automated underwater full-process detection and visualization output.
[0007] The advantages of this invention are as follows: The method and system of this invention construct a dedicated dataset for underwater cracks, establish a data-driven feature model integrating lightweight DeepLabv3+ and geometric prior information based on the principal curvature of the Hessian matrix, and combine a cueless GCUR-SAM network model with LoRA fine-tuning technology. This achieves high-fidelity identification and fully automatic segmentation of cracks in low-contrast underwater scenes. Distortion is eliminated by combining an underwater multi-media remapping model, topological branches are pruned using median transformation and discrete skeleton evolution algorithms, and the true physical width of the cracks is accurately calculated using an improved FWHM algorithm. A PyQt5 interactive interface is integrated to achieve real-time visualization and data archiving of the entire process of correction, segmentation, and quantization. The constructed automated underwater crack detection and quantization system overcomes the limitations of traditional large-scale visual models that rely on manual interaction, effectively solves the problem of geometric parameter measurement errors caused by underwater refraction, and significantly improves the accuracy and efficiency of underwater concrete structure defect monitoring. Attached Figure Description
[0008] Figure 1 This is a schematic diagram of the underwater optical path propagation path proposed in this invention; Figure 2 This is a network structure diagram of the unannotated SAM proposed in this invention; Figure 3 This is a diagram of the lightweight DeepLabv3+ network structure proposed in this invention. Detailed Implementation
[0009] The specific embodiments of the present invention will be further described below with reference to the accompanying drawings and technical solutions.
[0010] S1. Obtain the underwater crack dataset; Underwater crack data was collected on-site at the underwater dam using an underwater robot. The collected underwater crack data was then transmitted back to the terminal for preprocessing. Clear underwater crack images were extracted frame by frame, and crack labels were manually added to obtain an underwater crack dataset. The underwater crack image dataset was then divided into training, validation, and test sets according to the proportions. S2. Based on the underwater multi-media imaging model, calculate and extract camera intrinsic parameters, camera extrinsic parameters and distortion correction parameters, and construct a remapping matrix to eliminate underwater refraction and perspective distortion. Figure 1 This is a schematic diagram of the underwater optical path propagation. The underwater multi-medium imaging model is used to characterize the process by which spatial points on the surface of a real crack are projected onto the camera's imaging plane after refraction through three media: water, glass, and air. The underwater multi-medium imaging model includes coordinate transformation relationships, three-medium refraction constraint relationships, and optical path decomposition equations. The coordinate transformation relationship is as follows: In the world coordinate system, assuming the spatial point on the actual crack surface is... Transform it to the camera coordinate system using camera extrinsic parameters: in, Represents the spatial coordinates of a point on the actual crack surface in the world coordinate system. This represents the coordinates of the corresponding point in the camera coordinate system. ; It is the camera's rotation matrix. It is the camera's translation vector; The three-medium refraction constraint relationship is: light rays from a point in space... Light propagates to the camera's optical center, passing sequentially through water, glass, and air. According to Snell's law, light rays satisfy strict constraints when propagating in different media: in, , , These are the refractive indices of water, glass, and air, respectively. , , These are the angles between the direction of light propagation in water, glass, and air and the normal direction of the medium interface, respectively. The optical path decomposition equation is used to geometrically decompose the refracted light path from a spatial point on the real crack surface to the camera's optical center in both the depth direction and the direction parallel to the imaging plane. Specifically, it is expressed as: in, Spatial points in the camera coordinate system Depth coordinates Let be the distance from the inner surface of the glass to the optical center of the camera. For the thickness of the glass, For spatial points Vertical water depth to the outer surface of the glass. It is the equivalent radial projection distance; When light enters the camera lens, let the pixel coordinates in the underwater crack image be... Based on the distortion correction parameters, the pixel coordinates Perform distortion correction to obtain the distortion-corrected pixel coordinates. Then, using camera intrinsics, the coordinates of the distortion-free pixels are determined. Convert to normalized camera coordinates And based on normalized camera coordinates Determine the angle of light exiting the air By simultaneously applying the three-medium refraction constraint relationship and the optical path decomposition equation, the pixel coordinates determined by the underwater multi-medium imaging model are obtained. A nonlinear mapping function to actual three-dimensional underwater coordinates; To obtain the camera's intrinsic parameters, extrinsic parameters, distortion correction parameters, and physical parameters of the underwater multi-media imaging model, a two-stage calibration strategy of air calibration and underwater refraction parameter optimization is adopted. In the air calibration stage, multiple calibration images containing a planar calibration plate are acquired at different poses, and the Zhang Zhengyou calibration method is used to calibrate the calibration images to obtain the camera's intrinsic parameters, distortion correction parameters, and the camera's extrinsic parameters corresponding to each calibration image. In the underwater refraction parameter optimization stage, a slime mold algorithm is introduced to globally optimize the underwater refraction parameters in the underwater multi-media imaging model, using the root mean square reprojection error as the optimization function. in, It is the total number of valid corner points extracted from the calibrated image under multiple views. It is the first j The first calibration image i The actual two-dimensional pixel coordinates of each corner point These are the reprojected two-dimensional pixel coordinates; and They are the first i The rotation matrix and translation vector corresponding to the calibration image; The absolute reference depth of the target is determined based on a nonlinear mapping function. Using the absolute reference depth as a reference, forward optical path tracing is performed on the coordinates of each pixel in the underwater crack image to establish a global mapping relationship between the original distorted pixel coordinates and the corrected pixel coordinates. The global mapping relationship is stored as a remapping matrix. The underwater crack image is resampled using the remapping matrix to obtain a corrected image that eliminates underwater refraction and perspective distortion and conforms to the geometric relationship of pinhole perspective. S3. Construct the GCUR-SAM network model. Use the underwater crack dataset obtained in step S1 to train and test the GCUR-SAM network model to obtain a detection model for underwater crack segmentation. First, we construct the Segmentation All Model (SAM) and reconstruct its interaction paradigm and decoding mechanism to form an end-to-end automatic segmentation structure suitable for underwater crack images. Figure 2 The diagram shows the network structure of the uncued SAM. During the training and forward inference phases, sparse cue inputs are removed, and a fixed empty cue feature vector is used as the output of the cue encoder. The image encoder extracts features from the input underwater crack image to obtain high-dimensional global image features. These high-dimensional global image features and the empty cue feature vector are input to the mask decoder to achieve end-to-end feature mapping from the underwater crack image to the crack segmentation mask. The mask decoder is configured to a single mask output mode to eliminate ambiguity in the overall, local, and sub-local results caused by multiple mask outputs, and retains a single direct-through output branch, enabling the mask decoder to output a unique underwater crack segmentation result through deterministic decoding. Secondly, a low-rank adaptation method is used to fine-tune the segmentation model, freezing the pre-trained backbone network parameters, and introducing two low-rank trainable matrices into the target layer of the image encoder to approximate the weight update amount: in, It is the input vector. This is the original weight matrix. It is the parameter update matrix. It is a dimension reduction matrix. It is an upgraded matrix. It is a fine-tuning setting of the rank. It is a low-rank update scaling factor. It is the dimension of the input vector. It is the dimension of the output vector; The fine-tuned segmentation model further combines the data-driven features of the lightweight DeepLabv3+ network with geometric prior information based on the principal curvature of the Hessian matrix to construct the GCUR-SAM network model. Figure 3This is the architecture diagram of the lightweight DeepLabv3+ network. The lightweight DeepLabv3+ network acts as a refinement network, used to refine the crack segmentation results by incorporating the global spatial prior output of the "All Segmentation" model. It concatenates the underwater crack image with the coarse predicted probability map output by the "All Segmentation" model along the channel dimension to construct a four-channel fusion feature, which is then used as the input to the lightweight DeepLabv3+ network. The backbone of the lightweight DeepLabv3+ network uses ResNet-18. The hollow spatial pyramid pooling module includes a 1×1 convolutional branch and 3×1 convolutional branches with different dilation rates. The ×3 dilated convolutional branch and pooling branch are used to capture feature information at different scales of underwater crack images. The low-level feature maps of the backbone network are reduced in channel dimension by 1×1 convolution, and then concatenated with the features output by the dilated spatial pyramid pooling module and upsampled. After being processed by 3×3 convolution and upsampling, the predicted incremental result of the underwater crack image is output. Finally, the coarse Logits output by the mask decoder of the segmentation model are residually connected with the predicted incremental result of the underwater crack image, and the predicted probability map is output through the Sigmoid activation function. The geometric prior based on the principal curvatures of the Hessian matrix is as follows: Convert the input underwater crack image to a grayscale image. And using a two-dimensional Gaussian kernel Smoothing a grayscale image yields a smoothed image. Calculate the second-order partial derivatives of the smoothed image at each pixel and construct the Hessian matrix. : in, It is a smoothed grayscale image. , , These represent the second-order partial derivatives of the underwater crack image in the horizontal, vertical, and horizontal-vertical mixed directions, respectively. Find the eigenvalues of the Hessian matrix at each pixel. and The larger of the two absolute values is extracted as the maximum principal curvature response map representing the crack intensity at that pixel. The maximum principal curvature response map was then normalized. Linear mapping to the [0, 1] interval yields the geometric prior weight graph: in, It is a geometric prior weight graph. and These are the global maximum and global minimum values in the maximum principal curvature response plot, respectively. The predicted probability map obtained by the output of the lightweight DeepLabv3+ network and its residual connection is fused with the geometric prior weight map at the pixel level to obtain a geometrically constrained enhanced prediction probability result: in, It is the predicted probability result after geometric prior enhancement. This is the predicted probability map output by the lightweight DeepLabv3+ network. It is the intensity factor that controls the geometric prior; Finally, the predicted probability results after geometric prior enhancement are thresholded to obtain the underwater crack segmentation results.
[0011] The GCUR-SAM network model was trained, validated, and tested using the training, validation, and test sets obtained in step S1. The training epochs were set to 100, the batch size to 8, the optimizer to AdamW, the learning rate to 5e-4, the momentum parameter to 0.9, and the weight decay to 0.01. A hybrid loss mechanism combining cross-entropy loss and Dice loss was used during training. in, Represents cross-entropy loss, This represents Dice's loss.
[0012] To verify the superiority and objectivity of the GCUR-SAM network model proposed in this invention, it was compared with mainstream semantic segmentation algorithms such as ConvNeXt and SegFormer. Table 1 shows that LPFNet achieved the highest segmentation accuracy, with an F1 score of 80.48. Furthermore, its precision and recall were improved to 79.23 and 81.77 respectively, representing the best results among all compared models. This indicates that the GCUR-SAM network model of this invention can overcome visual interference in the underwater environment and more effectively extract key features of underwater cracks, thereby achieving reliable defect segmentation.
[0013] Table 1. Test results of the model performance of the present invention S4. Perform topology trimming on the underwater crack segmentation results output by the detection model obtained in step S3, and calculate the true physical width of the underwater cracks by combining the improved FWHM algorithm. The underwater crack segmentation results output in step S3 are thresholded to obtain an underwater crack binary segmentation mask. Based on the underwater crack binary segmentation mask, an unpruned skeleton and distance transformation matrix are obtained through median transformation. (Skeleton point set) Each pixel in the matrix represents the center of a maximum inscribed circle; the distance transformation matrix records the radius of the maximum inscribed circle at the corresponding skeleton point. The crack morphology is reconstructed using the union of all the largest inscribed circles on the skeleton. in, Represented by skeleton points Center of the circle A function of radius; The underwater crack segmentation results output in step S3 are thresholded to obtain an underwater crack binary segmentation mask. Based on the underwater crack binary segmentation mask, an unpruned skeleton and distance transformation matrix are obtained through median transformation. (Skeleton point set) Each pixel in the matrix represents the center of a maximum inscribed circle; the distance transformation matrix records the radius of the maximum inscribed circle at the corresponding skeleton point. The crack morphology is reconstructed using the union of all the largest inscribed circles on the skeleton. in, Represented by skeleton points Center of the circle A function of radius; An improved full width at half maximum (FWHM) algorithm is constructed to extract the pixel-level width of underwater cracks. The algorithm slides along the pruned crack skeleton with a fixed step size, selecting local neighboring skeleton points before and after the current crack skeleton center point, and calculating the coordinate differences of these local neighboring skeleton points in the horizontal and vertical directions. and and according to and Construct the tangent vector; the unit normal vector perpendicular to the tangent vector. Defined as: Using the current crack skeleton center point as a reference, construct a structure with a length of [length missing] along the positive and negative directions of the unit normal vector. The measurement line is oversampled at 0.5 pixel intervals to obtain the set of sampling points on the measurement line: in, These are the coordinates of the sampling points on the measurement line. These are the coordinates of the center point of the current crack skeleton. It is the sampling position parameter along the unit normal vector direction. ; The corrected image obtained in step S2 is converted into a corrected grayscale image matrix. A bilinear interpolation algorithm is used, employing the grayscale values of the four adjacent pixels surrounding each sampling point, and the grayscale value of each sampling point is estimated based on spatial distance weighting. All sampling points are traversed, and the corrected grayscale image matrix is converted into a one-dimensional grayscale profile curve distributed along the measurement line. A bidirectional scan is performed from the grayscale valley position at the center of the crack in the one-dimensional grayscale profile curve as the starting point, extending outwards to both sides. When the grayscale crack exceeds the judgment threshold, the corresponding left and right boundary index positions are recorded, and then the pixel width of the underwater crack is calculated. in, It is a threshold for judgment. It is the minimum gray value of a one-dimensional grayscale profile curve. It's local contrast. It is the threshold proportionality coefficient. ; It is the pixel width of the underwater crack. and These are the left and right boundary point indices; Finally, image correction and underwater crack physical size measurement are performed based on the remapping matrix constructed in step S2: in, The absolute reference depth of the target location. For the camera's equivalent focal length, It is the actual physical width of the underwater crack. It is the ratio factor between physical and pixel dimensions; To further verify the robustness of the width measurement algorithm of this invention, experiments were conducted comparing and analyzing the center-axis transformation method, the Laplace method, and the FWHM method. Table 2 shows that the measurement accuracy of the center-axis transformation method and the Laplace method is limited, resulting in relatively high errors. The method proposed in this invention reduces the error by 0.70 mm, 0.73 mm, and 2.57 mm compared to the center-axis transformation method, the Laplace method, and the FWHM method, respectively. The method studied in this research exhibits good robustness in complex underwater environments and can achieve millimeter-level precision measurement of underwater concrete structures.
[0014] Table 2. Quantization results of the algorithm proposed in this invention. S5 uses PyQt5 to build an interactive interface, integrating image correction, fine crack segmentation, and crack quantization algorithms to achieve automated underwater full-process detection and visualization output.
[0015] S5.1 Build a visual interactive interface: The main interface of the integrated display system is developed using the PyQt5 framework. The main interface is divided into four core modules: operation area, pixel scale, display area and information panel, so as to realize command control and status monitoring of the entire detection process.
[0016] S5.2, Core Workflow Execution Module: Image Input and Distortion Correction: The system sequentially performs input image and image correction through the operation area. After importing the underwater crack image, the system automatically loads the camera remapping matrix and outputs the distorted corrected image. Fine-grained crack mask extraction: Crack segmentation is performed based on the corrected image, and the system calls the GCUR-SAM network model to extract crack features and obtain a high-fidelity mask; Automatic measurement of physical parameters: The system performs width measurement by combining the acquired physical and pixel scaling factors with the extracted underwater crack pixel width to automatically perform geometric calculations and obtain the actual physical width of the underwater crack. S5.3, Multi-dimensional Visualization Rendering and Real-time Information Feedback Module: The system enables dynamic rendering of the display area, and as the system progresses, it sequentially presents the visualization results of each stage, such as underwater crack images, corrected images, and predicted probability maps, in real time. It enables synchronous response of the information panel, real-time updates of the system's current operating status, and intuitive display of specific quantitative data, including the actual physical width.
[0017] S5.4 Data Storage and Export Archive Module: Structured and Quantitative Data Export: A data export interface has been added to the information panel, which supports one-click extraction of the calculated actual physical width of underwater cracks and system operation logs, and exporting them as a standard format data table file; Full-process image atlas packaging: Supports the synchronous storage of underwater crack images, correction images, and predicted probability maps generated at each stage within the display area, and packages and compresses them with quantized data.
Claims
1. An automated underwater crack detection method based on a geometric curvature prior a priori enhanced visual large model, characterized in that, Includes the following steps: S1. Obtain the underwater crack dataset; Underwater crack data was collected on-site at the underwater dam using an underwater robot. The collected underwater crack data was then transmitted back to the terminal for preprocessing. Clear underwater crack images were extracted frame by frame, and crack labels were manually added to obtain an underwater crack dataset. The underwater crack image dataset was then divided into training, validation, and test sets according to the proportions. S2. Based on the underwater multi-media imaging model, calculate and extract camera intrinsic parameters, camera extrinsic parameters and distortion correction parameters, and construct a remapping matrix to eliminate underwater refraction and perspective distortion. S3. Construct the GCUR-SAM network model. Use the underwater crack dataset obtained in step S1 to train and test the GCUR-SAM network model to obtain a detection model for underwater crack segmentation. S4. Perform topology trimming on the underwater crack segmentation results output by the detection model obtained in step S3, and calculate the true physical width of the underwater cracks by combining the improved FWHM algorithm. S5 uses PyQt5 to build an interactive interface, integrating image correction, fine crack segmentation, and crack quantization algorithms to achieve automated underwater full-process detection and visualization output.
2. The automated underwater crack detection method based on geometric curvature prior a priori enhanced visual large model according to claim 1, characterized in that, The specific implementation process of step S2 is as follows: The underwater multi-medium imaging model is used to characterize the process by which spatial points on the surface of a real crack are projected onto the camera imaging plane after being refracted by three media: water, glass, and air. The underwater multi-medium imaging model includes coordinate transformation relationships, three-medium refraction constraint relationships, and optical path decomposition equations. The coordinate transformation relationship is as follows: In the world coordinate system, assuming the spatial point on the actual crack surface is... Transform it to the camera coordinate system using camera extrinsic parameters: in, Represents the spatial coordinates of a point on the actual crack surface in the world coordinate system. This represents the coordinates of the corresponding point in the camera coordinate system. ; It is the camera's rotation matrix. It is the camera's translation vector; The three-medium refraction constraint relationship is: light rays from a point in space... Light propagates to the camera's optical center, passing sequentially through water, glass, and air. According to Snell's law, light rays satisfy strict constraints when propagating in different media: in, , , These are the refractive indices of water, glass, and air, respectively. , , These are the angles between the direction of light propagation in water, glass, and air and the normal direction of the medium interface, respectively. The optical path decomposition equation is used to geometrically decompose the refracted light path from a spatial point on the real crack surface to the camera's optical center in both the depth direction and the direction parallel to the imaging plane. Specifically, it is expressed as: in, Spatial points in the camera coordinate system Depth coordinates Let be the distance from the inner surface of the glass to the optical center of the camera. For the thickness of the glass, For spatial points Vertical water depth to the outer surface of the glass. It is the equivalent radial projection distance; When light enters the camera lens, let the pixel coordinates in the underwater crack image be... Based on the distortion correction parameters, the pixel coordinates Perform distortion correction to obtain the distortion-corrected pixel coordinates. Then, using camera intrinsics, the coordinates of the distortion-free pixels are determined. Convert to normalized camera coordinates And based on normalized camera coordinates Determine the angle of light exiting the air By simultaneously applying the three-medium refraction constraint relationship and the optical path decomposition equation, the pixel coordinates determined by the underwater multi-medium imaging model are obtained. A nonlinear mapping function to actual three-dimensional underwater coordinates; To obtain the camera's intrinsic parameters, extrinsic parameters, distortion correction parameters, and physical parameters of the underwater multi-media imaging model, a two-stage calibration strategy of air calibration and underwater refraction parameter optimization is adopted. In the air calibration stage, multiple calibration images containing a planar calibration plate are acquired at different poses, and the Zhang Zhengyou calibration method is used to calibrate the calibration images to obtain the camera's intrinsic parameters, distortion correction parameters, and the camera's extrinsic parameters corresponding to each calibration image. In the underwater refraction parameter optimization stage, a slime mold algorithm is introduced to globally optimize the underwater refraction parameters in the underwater multi-media imaging model, using the root mean square reprojection error as the optimization function. in, It is the total number of valid corner points extracted from the calibrated image under multiple views. It is the first j The first calibration image i The actual two-dimensional pixel coordinates of each corner point These are the reprojected two-dimensional pixel coordinates; and They are the first i The rotation matrix and translation vector corresponding to the calibration image; The absolute reference depth of the target is determined based on a nonlinear mapping function. Using the absolute reference depth as a reference, forward optical path tracing is performed on the coordinates of each pixel in the underwater crack image to establish a global mapping relationship between the original distorted pixel coordinates and the corrected pixel coordinates. The global mapping relationship is stored as a remapping matrix. The underwater crack image is resampled using the remapping matrix to obtain a corrected image that eliminates underwater refraction and perspective distortion and conforms to the geometric relationship of pinhole perspective.
3. The automated underwater crack detection method based on geometric curvature prior a priori enhanced visual large model according to claim 2, characterized in that, The specific implementation process of step S3 is as follows: The construction of the GCUR-SAM network model specifically includes: First, a segmentation model is constructed, and its interaction paradigm and decoding mechanism are reconstructed to form an end-to-end automatic segmentation structure suitable for underwater crack images. During the training and forward inference phases, sparse cue inputs are eliminated, and a fixed empty cue feature vector is used as the output of the cue encoder. The image encoder extracts features from the input underwater crack image to obtain high-dimensional global image features. The high-dimensional global image features and the empty cue feature vector are input together into the mask decoder to achieve end-to-end feature mapping from the underwater crack image to the crack segmentation mask. The mask decoder is configured to a single mask output mode to eliminate the ambiguity of global, local, and sub-local results caused by multiple mask outputs, and retains a single straight-through output branch, enabling the mask decoder to output a unique underwater crack segmentation result through deterministic decoding. Secondly, a low-rank adaptation method is used to fine-tune the segmentation model, freezing the pre-trained backbone network parameters, and introducing two low-rank trainable matrices into the target layer of the image encoder to approximate the weight update amount: in, It is the input vector. This is the original weight matrix. It is the parameter update matrix. It is a dimension reduction matrix. It is an upgraded matrix. It is a fine-tuning setting of the rank. It is a low-rank update scaling factor. It is the dimension of the input vector. It is the dimension of the output vector; The fine-tuned segmentation model further combines the data-driven features of the lightweight DeepLabv3+ network with geometric prior information based on the principal curvature of the Hessian matrix to construct the GCUR-SAM network model. The lightweight DeepLabv3+ network serves as a refinement network, used to refine the crack segmentation results by incorporating the global spatial prior from the "All Segmentation" model output. The underwater crack image is concatenated with the coarse predicted probability map from the "All Segmentation" model output along the channel dimension to construct a four-channel fusion feature, which is then used as the input to the lightweight DeepLabv3+ network. The backbone of the lightweight DeepLabv3+ network employs ResNet-18. The hollow spatial pyramid pooling module includes 1×1 convolutional branches and different dilation rates. A 3×3 dilated convolution branch and a pooling branch are used to capture feature information at different scales of underwater crack images. The low-level feature maps of the backbone network are reduced in channel dimension by 1×1 convolution, and then concatenated with the features output by the dilated spatial pyramid pooling module and upsampled. After that, the predicted incremental result of the underwater crack image is output by 3×3 convolution and upsampling. Finally, the coarse Logits output by the mask decoder of the segmentation model are residually connected with the predicted incremental result of the underwater crack image, and the predicted probability map is output by passing the Sigmoid activation function. The geometric prior based on the principal curvatures of the Hessian matrix is as follows: Convert the input underwater crack image to a grayscale image. And using a two-dimensional Gaussian kernel Smoothing a grayscale image yields a smoothed image. Calculate the second-order partial derivatives of the smoothed image at each pixel and construct the Hessian matrix. : in, It is a smoothed grayscale image. , , These represent the second-order partial derivatives of the underwater crack image in the horizontal, vertical, and horizontal-vertical mixed directions, respectively. Find the eigenvalues of the Hessian matrix at each pixel. and The larger of the two absolute values is extracted as the maximum principal curvature response map representing the crack intensity at that pixel. The maximum principal curvature response map was then normalized. Linear mapping to the [0, 1] interval yields the geometric prior weight graph: in, It is a geometric prior weight graph. and These are the global maximum and global minimum values in the maximum principal curvature response plot, respectively. The predicted probability map obtained by the output of the lightweight DeepLabv3+ network and its residual connection is fused with the geometric prior weight map at the pixel level to obtain a geometrically constrained enhanced prediction probability result: in, It is the predicted probability result after geometric prior enhancement. This is the predicted probability map output by the lightweight DeepLabv3+ network. It is the intensity factor that controls the geometric prior; Finally, the predicted probability results after geometric prior enhancement are thresholded to obtain the underwater crack segmentation results. The GCUR-SAM network model is trained, validated, and tested using the training, validation, and test sets obtained in step S1. During the training phase, the training epochs, batch sizes, optimizer, learning rate, momentum parameter, and weight decay are set. A hybrid loss mechanism combining cross-entropy loss and Dice loss is used during training. in, Represents cross-entropy loss, This represents the Dice loss; during the validation phase, the GCUR-SAM training parameters are adjusted based on the segmentation results of the validation set, and the optimal model is saved; during the testing phase, the test set is input into the trained GCUR-SAM network model, and the underwater crack segmentation results are output to obtain the detection model for underwater crack segmentation.
4. The automated underwater crack detection method based on geometric curvature prior a priori enhanced visual large model according to claim 3, characterized in that, The specific implementation process of step S4 is as follows: The underwater crack segmentation results output in step S3 are thresholded to obtain an underwater crack binary segmentation mask. Based on the underwater crack binary segmentation mask, an unpruned skeleton and distance transformation matrix are obtained through median transformation. (Skeleton point set) Each pixel in the matrix represents the center of a maximum inscribed circle; the distance transformation matrix records the radius of the maximum inscribed circle at the corresponding skeleton point. The crack morphology is reconstructed using the union of all the largest inscribed circles on the skeleton. in, Represented by skeleton points Center of the circle A function of radius; The undressed skeleton is topologically pruned using a discrete skeleton evolution algorithm, transforming it into a graph model composed of nodes and edges. Edges with a degree of 1 are retrieved to obtain the final branches of the skeleton. The number of unique pixels contributed by the terminal branches of each skeleton to the reconstructed shape is calculated, and this number of unique pixels is used as the weight of the terminal branches of the corresponding skeleton. When the weight of the terminal branch of a skeleton is less than the set area threshold, the terminal branch of the skeleton is determined to be a pseudo-branch that contributes very little to the overall shape and is removed to obtain the pruned crack skeleton. An improved full width at half maximum (FWHM) algorithm is constructed to extract the pixel-level width of underwater cracks. The algorithm slides along the pruned crack skeleton with a fixed step size, selecting local neighboring skeleton points before and after the current crack skeleton center point, and calculating the coordinate differences of these local neighboring skeleton points in the horizontal and vertical directions. and and according to and Construct the tangent vector; the unit normal vector perpendicular to the tangent vector. Defined as: Using the current crack skeleton center point as a reference, construct a structure with a length of [length missing] along the positive and negative directions of the unit normal vector. The measurement line is oversampled at 0.5 pixel intervals to obtain the set of sampling points on the measurement line: in, These are the coordinates of the sampling points on the measurement line. These are the coordinates of the center point of the current crack skeleton. It is the sampling position parameter along the unit normal vector direction. ; The corrected image obtained in step S2 is converted into a corrected grayscale image matrix. A bilinear interpolation algorithm is used, employing the grayscale values of the four adjacent pixels surrounding each sampling point, and the grayscale value of each sampling point is estimated based on spatial distance weighting. All sampling points are traversed, and the corrected grayscale image matrix is converted into a one-dimensional grayscale profile curve distributed along the measurement line. A bidirectional scan is performed from the grayscale valley position at the center of the crack in the one-dimensional grayscale profile curve as the starting point, extending outwards to both sides. When the grayscale crack exceeds the judgment threshold, the corresponding left and right boundary index positions are recorded, and then the pixel width of the underwater crack is calculated. in, It is a threshold for judgment. It is the minimum gray value of a one-dimensional grayscale profile curve. It's local contrast. It is the threshold proportionality coefficient. ; It is the pixel width of the underwater crack. and These are the left and right boundary point indices; Finally, image correction and underwater crack physical size measurement are performed based on the remapping matrix constructed in step S2: in, The absolute reference depth of the target location. For the camera's equivalent focal length, It is the actual physical width of the underwater crack. It is the ratio factor between physical and pixel dimensions.