Irregular target crack measurement method and system based on U-Net semantic segmentation

By using U-Net semantic segmentation and data augmentation techniques, combined with the EPnP algorithm and SVD decomposition, high-precision and low-cost measurement of irregular target cracks is achieved, solving the problems of low crack detection accuracy and poor applicability in existing technologies, and making it suitable for complex field environments.

CN121883355APending Publication Date: 2026-04-17NANJING HYDRAULIC RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511729935.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-24
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing technologies for crack detection have low accuracy, are only applicable to specific environments, and are complex to operate, making them unsuitable for complex field conditions.

Method used

A random target crack measurement method based on U-Net semantic segmentation is adopted. The target image is captured by a camera, data augmentation processing is performed, and a U-Net image detection model is trained. The 3D coordinates of the crack are obtained by using the EPnP algorithm and SVD singular value decomposition, and plane fitting and crack displacement change measurement are performed.

Benefits of technology

It enables high-precision, low-cost crack measurement in complex field environments, avoids damage to the structural surface caused by equipment deployment, has strong adaptability, and is easy to maintain in the later stage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121883355A_ABST
    Figure CN121883355A_ABST
Patent Text Reader

Abstract

The invention discloses an irregular target crack measurement method and system based on U-Net semantic segmentation. The method comprises the steps that a camera is used for shooting and sampling a target picture, an initial data set is formed, the data set is processed, and an enhanced data set is obtained; training a U-Net image detection model according to the enhanced data set, and processing a field mask picture by using the trained U-Net image detection model to obtain an optimized mask picture; carrying out edge extraction on the optimized mask picture by adopting a canny operator to obtain a feature point set; matching the 3D coordinate points in the feature point set with a world coordinate system by using an EPnP algorithm to obtain auxiliary target coordinates; the coordinates of the auxiliary target are optimized through plane fitting, a final three-dimensional coordinate point set is obtained, the coordinate difference values of the final three-dimensional coordinate point sets in different time periods are compared, and the three-direction displacement change situation of the crack is obtained. According to the invention, anti-interference displacement detection is realized, and engineering monitoring requirements are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of earth-rock dam monitoring technology, specifically to a method and system for measuring irregular target cracks based on U-Net semantic segmentation. Background Technology

[0002] In engineering practice, the environment in which cracks are located is quite complex. Due to the influence of factors such as light, dirt, rain and fog, the quality of crack images obtained is poor. Moreover, different environmental factors have different influences. For machine learning that processes images in a fixed way, both applicability and stability will be affected. Zhang Haoyu et al. (Zhang Haoyu, Ding Yong, Li Denghua. A method for detecting surface cracks in structures based on three-dimensional reconstruction [J]. Industrial Construction, 2024, 54(05):60-67.DOI:10.13204 / j.gyjzG22102611) established a three-dimensional model through deep learning and realized the three-dimensional measurement of cracks; Zhao Quanman et al. (Zhao Quanman, Ma Zhihao, Ge Lumin, et al. Semantic segmentation of road cracks based on Transformer and CNN architecture [J / OL]. Journal of Kunming University of Science and Technology (Natural Science Edition), 1-15 [2025-11-02]. https: / / doi.org / 10.16112 / j.cnki.53-1223 / n.2026.01.482) designed the FastViT road crack semantic segmentation model based on the Transformer architecture to achieve accurate segmentation of road cracks; Wang Fei et al. (Wang Fei, Dong Jinfeng, Yu Jun, et al. Intelligent extraction algorithm for shale CT cracks based on deep learning [J]. Natural Gas Industry, 2025, 45(08):67-76) achieved accurate extraction of shale cracks by improving the U-Net network model and constructed a three-dimensional core model. These methods either rely on specific environments and high-precision detection equipment or can only measure unidirectional displacement changes of cracks, and none of them are well adapted to on-site crack measurement. Summary of the Invention

[0003] The technical problem to be solved by this invention is to provide a method and system for measuring irregular target cracks based on U-Net semantic segmentation, in order to solve the problems of low detection accuracy, applicability to specific environments and complex operation in the prior art. This method and system can simplify on-site deployment, reduce maintenance costs and ensure both accuracy and stability.

[0004] To solve the above technical problems, the present invention adopts the following technical solution:

[0005] A method for measuring cracks in irregular targets based on U-Net semantic segmentation includes the following steps:

[0006] S1. Use a camera to capture and sample images of the target to form an initial dataset; perform data augmentation on the initial dataset to obtain an augmented dataset.

[0007] S2. Train the U-Net image detection model based on the augmented dataset, and use the trained U-Net image detection model to process the mask image on site to obtain the optimized mask image.

[0008] S3. Apply the Canny operator to the optimized mask image for edge extraction, obtain the maximum bounding shape on the extracted edge contour, and extract the feature point set on the maximum bounding shape.

[0009] S4. Use the EPNP algorithm to match the coordinates of the feature point set with the world coordinate system to obtain the projection matrix; based on the projection matrix constraint, use SVD singular value decomposition to obtain the sub-target coordinates.

[0010] S5. Plane fitting is used to optimize the coordinates of the sub-target to obtain the final three-dimensional coordinate point set. The coordinate difference of the final three-dimensional coordinate point set at different time periods is compared to obtain the change of the crack's three-dimensional displacement.

[0011] Furthermore, in step S1, the target is a geometrically regular target of the paint.

[0012] Furthermore, in step S1, the data augmentation process includes sequentially performing labelme annotation, adding noise, brightness adjustment, and cropping.

[0013] Furthermore, in step S2, the optimized mask image includes the following:

[0014] S201. Divide the augmented dataset into a 4:1 ratio to obtain a training set and a test set. Use the training set to train the weight file of the U-Net image detection model.

[0015] S202. Input the masked image from the scene into the trained U-Net image detection model. Use the semantic segmentation unit to perform semantic segmentation to obtain the segmented masked image. Use the probability transformation unit to process the segmented masked image to obtain a univariate potential energy field. Extract the probability of the pixel's category to obtain confidence information. Detect and initially screen elements based on the confidence information. Based on the univariate potential energy field, perform feature space extraction, similarity kernel function calculation, and potential matrix construction to obtain a two-sided potential energy matrix. Perform Gaussian potential energy calculation on the two-sided potential energy matrix to obtain global smoothness constraints.

[0016] S203. Repeat step S202 five times to obtain the optimized mask image.

[0017] Furthermore, in step S4, four control points are acquired in the world coordinate system, denoted as... , and the i-th 3D coordinate point in the world coordinate system satisfy:

[0018] ;

[0019] in, Let the coordinates be the homogeneous barycenter coordinates. Let j be the j-th control point in the world coordinate system;

[0020] Based on the camera's intrinsic parameter matrix , The projection in the camera coordinate system is ,but:

[0021] ;

[0022] in, For projection parameters, , They are respectively Focal length in direction, They are respectively In the camera coordinate system Projected coordinates of direction for Coordinates in the world coordinate system; Let i be the i-th 2D coordinate point in the camera coordinate system; Let j be the j-th control point in the camera coordinate system. , For the k-th eigenvector The 3×1 sub-vectors, where T is the total number of eigenvectors. This is the first control parameter;

[0023] Eliminating the projection parameters yields:

[0024] ;

[0025] Connecting the four control points in series yields a system of linear equations, the specific formula of which is:

[0026] ;

[0027] in, The projection matrix; The coordinates of the control point in the camera coordinate system. , The second control parameter is N, where N is the total number of coordinate points.

[0028] Based on the 3D-3D camera pose, the rotation matrix and translation vector of the Euclidean transformation are obtained;

[0029] The rotation matrix and translation vector are iteratively optimized using the Levenberg-Marquardt method until the reprojection error is less than 0.1, at which point the iteration stops, and the left projection matrix M1 and the right projection matrix M2 are obtained.

[0030] For the two cameras, left and right, respectively:

[0031] ;

[0032] in, The influence factor of the left camera. The x-coordinate of the 2D coordinate point projected by the left camera. The y-coordinate of the 2D coordinate point projected by the left camera. The influence factor of the right camera. The x-coordinate of the 2D projection point of the right camera. The x-coordinate of the 2D coordinate point projected by the right camera;

[0033] Expanding the projection matrix and eliminating influence factors, we obtain the first equation:

[0034] ;

[0035] in, This is the first row of the left projection matrix. This is the second row of the left projection matrix. This is the third row of the left projection matrix. This is the first row of the right projection matrix. This is the second row of the right projection matrix. This is the third row of the right projection matrix;

[0036] Converting the first equation into a matrix, we get:

[0037] ;

[0038] in, As an intermediate variable, ;

[0039] Using SVD singular value decomposition, let The coordinates of the secondary target are obtained.

[0040] in, It is a left singular matrix. It is a right singular matrix. for The transpose of .

[0041] Furthermore, in step S5, the least squares algorithm is used to prefit the sub-target coordinates to form a preliminary fitting plane, and the coordinate points in the sub-target coordinates are judged. The specific formula is as follows:

[0042] ;

[0043] ;

[0044] in, For robust standard deviation, The total number of samples, To take the median, The residual at the i-th coordinate point is... The weight of the i-th coordinate point;

[0045] when When the value is 1, it indicates that the coordinate points in the sub-target coordinates belong to the preliminary fitting plane, and a three-dimensional coordinate point set is obtained. The distance-weighted overall least squares method is used to fit the three-dimensional coordinate point set to obtain the final three-dimensional coordinate point set.

[0046] The formula for calculating the triaxial displacement change of the crack is:

[0047] ;

[0048] in, , and These represent the X, Y, and Z coordinate values ​​of the triaxial displacement change of the crack, respectively. , and These are the three-dimensional coordinates of the crack during the second measurement. , and These are the three coordinates of the crack during the first measurement.

[0049] Furthermore, this invention also proposes a U-Net semantic segmentation-based system for measuring cracks in irregular targets, comprising:

[0050] The data augmentation module is used to capture and sample images of the target using a camera to form an initial dataset; the initial dataset is then augmented to obtain an augmented dataset.

[0051] The data optimization module is used to train a U-Net image detection model based on the augmented dataset, and then use the trained U-Net image detection model to process the masked images in the field to obtain optimized masked images.

[0052] The coordinate acquisition module is used to perform edge extraction on the optimized mask image using the Canny operator, obtain the maximum bounding shape on the extracted edge contour, and extract the feature point set on the maximum bounding shape; the EPnP algorithm is used to match the coordinates of the feature point set with the world coordinate system to obtain the projection matrix; based on the projection matrix constraint, the sub-target coordinates are obtained using SVD singular value decomposition.

[0053] The crack measurement module is used to optimize the sub-target coordinates using plane fitting to obtain the final three-dimensional coordinate point set. By comparing the coordinate differences of the final three-dimensional coordinate point sets at different time periods, the three-dimensional displacement changes of the crack can be obtained.

[0054] Furthermore, the present invention also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the U-Net semantic segmentation-based random target crack measurement method.

[0055] Furthermore, the present invention also proposes a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the aforementioned method for measuring cracks in irregular targets based on U-Net semantic segmentation.

[0056] Compared with the prior art, the present invention, employing the above technical solution, has the following technical effects:

[0057] 1. This invention adopts a non-contact measurement method, which eliminates the need to install detection instruments or equipment at the cracks, thus avoiding the risk of damage to the structural surface caused by the installation of instruments or equipment.

[0058] 2. This invention uses regular patterns drawn with paint as targets for identification. It is simple to set up on site, less affected by external environmental factors, has low maintenance costs, is easy to remove after monitoring, and has strong on-site applicability.

[0059] 3. This invention only requires image acquisition, making it applicable to complex field environments and facilitating the selection of target types based on the field environment. Attached Figure Description

[0060] Figure 1 This is a flowchart illustrating the overall implementation of the present invention.

[0061] Figure 2 This is a physical diagram of the detection device in an embodiment of the present invention.

[0062] Figure 3 This is the optimized mask image result diagram in an embodiment of the present invention.

[0063] Figure 4 This is a result image of the feature point set in an embodiment of the present invention.

[0064] Figure 5 This is a diagram showing the result of unidirectional movement of the X-axis in an embodiment of the present invention.

[0065] Figure 6 This is a diagram showing the result of unidirectional movement of the Y-axis in an embodiment of the present invention.

[0066] Figure 7 This is a diagram showing the result of unidirectional movement along the Z-axis in an embodiment of the present invention.

[0067] Figure 8 This is a diagram showing the result of simultaneous movement of the XYZ axes in an embodiment of the present invention. Detailed Implementation

[0068] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention.

[0069] To achieve the above objectives, this invention proposes a method for measuring cracks in irregular targets based on U-Net semantic segmentation, such as... Figure 1 As shown, the specific steps are as follows:

[0070] S1. Use a camera to capture and sample images of the target to form an initial dataset containing 120 images; perform data augmentation on the initial dataset to obtain an augmented dataset.

[0071] Among them, the target is a geometrically regular target for paint, and the shape of the target can be selected independently according to the site conditions.

[0072] Data augmentation processes include labeling via labelme, adding noise, adjusting brightness, and cropping, performed sequentially.

[0073] S2. Train the U-Net image detection model based on the augmented dataset, and use the trained U-Net image detection model to process the mask image in the scene to obtain an optimized mask image. Specifically:

[0074] S201. Divide the augmented dataset into a 4:1 ratio to obtain a training set and a test set. Use the training set to train the weight file of the U-Net image detection model.

[0075] S202. Input the masked image from the scene into the trained U-Net image detection model. Use the semantic segmentation unit to perform semantic segmentation to obtain the segmented masked image. Use the probability transformation unit to process the segmented masked image to obtain a univariate potential field. Each pixel position in this univariate potential field contains the predicted category energy distribution, reflecting the optimal label selection without considering neighborhood relationships. Extract the probability of the pixel's category to obtain confidence information. Based on the confidence information, detect the preliminary screening elements of uncertain regions. Based on the univariate potential field, perform feature space extraction, similarity kernel function calculation, and potential matrix construction to obtain a two-sided potential matrix. Perform Gaussian potential energy calculation on the two-sided potential matrix to obtain global smoothing constraints.

[0076] S203. Repeat step S202 five times to obtain the optimized mask image.

[0077] S3. Apply the Canny operator to the optimized mask image for edge extraction, obtain the maximum bounding shape on the extracted edge contour, and extract the feature point set on the maximum bounding shape.

[0078] S4. Using the EPNP algorithm, the coordinates of the feature point set are matched with the world coordinate system to obtain the projection matrix; based on the projection matrix constraints, the sub-target coordinates are obtained using SVD singular value decomposition. Specifically:

[0079] Obtain four control points in the world coordinate system, denoted as follows: , and the i-th 3D coordinate point in the world coordinate system satisfy:

[0080] ;

[0081] in, Let the coordinates be the homogeneous barycenter coordinates. Let j be the j-th control point in the world coordinate system;

[0082] Based on the camera's intrinsic parameter matrix , The projection in the camera coordinate system is ,but:

[0083] ;

[0084] in, For projection parameters, , They are respectively Focal length in direction, They are respectively In the camera coordinate system Projected coordinates of direction for Coordinates in the world coordinate system; Let i be the i-th 2D coordinate point in the camera coordinate system; Let j be the j-th control point in the camera coordinate system. , For the k-th eigenvector The 3×1 sub-vectors, where T is the total number of eigenvectors. This is the first control parameter;

[0085] Eliminating the projection parameters yields:

[0086] ;

[0087] Connecting the four control points in series yields a system of linear equations, the specific formula of which is:

[0088] ;

[0089] in, The projection matrix; The coordinates of the control point in the camera coordinate system. , The second control parameter is N, where N is the total number of coordinate points.

[0090] Based on the 3D-3D camera pose, the rotation matrix and translation vector of the Euclidean transformation are obtained;

[0091] The rotation matrix and translation vector are iteratively optimized using the Levenberg-Marquardt method until the reprojection error is less than 0.1, at which point the iteration stops, and the left projection matrix M1 and the right projection matrix M2 are obtained.

[0092] For the two cameras, left and right, respectively:

[0093] ;

[0094] in, The influence factor of the left camera. The x-coordinate of the 2D coordinate point projected by the left camera. The y-coordinate of the 2D coordinate point projected by the left camera. The influence factor of the right camera. The x-coordinate of the 2D projection point of the right camera. The x-coordinate of the 2D coordinate point projected by the right camera;

[0095] Expanding the projection matrix and eliminating influence factors, we obtain the first equation:

[0096] ;

[0097] in, This is the first row of the left projection matrix. This is the second row of the left projection matrix. This is the third row of the left projection matrix. This is the first row of the right projection matrix. This is the second row of the right projection matrix. This is the third row of the right projection matrix;

[0098] Converting the first equation into a matrix, we get:

[0099] ;

[0100] in, As an intermediate variable, ;

[0101] Using SVD singular value decomposition, let The coordinates of the secondary target are obtained.

[0102] in, It is a left singular matrix. It is a right singular matrix. for The transpose of .

[0103] S5. Plane fitting is used to optimize the sub-target coordinates to obtain the final three-dimensional coordinate point set. The coordinate differences of the final three-dimensional coordinate point sets at different time periods are compared to obtain the changes in the three-dimensional displacement of the crack. Specifically:

[0104] The least median square algorithm is used to prefit the sub-target coordinates to form a preliminary fitting plane, and the coordinate points in the sub-target coordinates are judged. The specific formula is as follows:

[0105] ;

[0106] ;

[0107] in, For robust standard deviation, The total number of samples, To take the median, The residual at the i-th coordinate point is... The weight of the i-th coordinate point;

[0108] when When the value is 1, it indicates that the coordinate points in the sub-target coordinates belong to the preliminary fitting plane, and a three-dimensional coordinate point set is obtained. The distance-weighted overall least squares method is used to fit the three-dimensional coordinate point set to obtain the final three-dimensional coordinate point set.

[0109] The formula for calculating the triaxial displacement change of the crack is:

[0110] ;

[0111] in, , and These represent the X, Y, and Z coordinate values ​​of the triaxial displacement change of the crack, respectively. , and These are the three-dimensional coordinates of the crack during the second measurement. , and These are the three coordinates of the crack during the first measurement.

[0112] Example:

[0113] The camera model is Nikon D3100, with 14.2 million pixels, 4608×3702 effective pixels, a sensor size of 23.1×15.4mm, an EXPEED 2 image processor, and a focal length of 18-55mm.

[0114] To verify the accuracy and stability of the method proposed in this invention, this embodiment designs a three-dimensional displacement accuracy and stability testing device based on a fixed slide table. This device includes a horizontal slide rail, a longitudinal slide rail, a vertical slide rail, and a dial indicator. Left and right test targets are fixed to the moving end and the fixed end, respectively. An electronic dial indicator is arranged in the horizontal sliding direction. Details of the test equipment are as follows... Figure 2 As shown.

[0115] During the experiment, a camera was used to take multi-angle photos of the test equipment, with the target positioned as centrally as possible. The relative displacement of the two sides of the crack was simulated by moving the target on the moving end, with the reading of an electronic dial gauge used as a reference value. The displacement was controlled at 1 mm per movement, and a total of ten movements were performed. Images were captured after each movement, and the difference between the obtained three-dimensional coordinates and the initial three-dimensional coordinates represents the change in the crack.

[0116] A U-Net image detection model is trained based on an augmented dataset. The trained U-Net model is then used to process the masked images in the scene, resulting in optimized masked images. The results are as follows: Figure 3 As shown, the jagged edges and defects in the optimized mask image have been effectively repaired, improving the quality of the mask image.

[0117] Edge extraction is performed on the optimized mask image using the Canny operator. The maximum bounding shape is obtained from the extracted edge contours, and feature point sets are extracted from the maximum bounding shape. The results are as follows: Figure 4 As shown, the feature point set is a regular geometric plane.

[0118] The test results are as follows Figure 5 , Figure 6 , Figure 7 and Figure 8 As shown. Figure 5 (a) is a graph showing the changes in triaxial displacement when the X-axis moves unidirectionally. Figure 5 (b) is a graph showing the triaxial error values ​​when the X-axis moves unidirectionally. Figure 5 (c) is a graph showing the stability of the X-axis when it moves in one direction. Figure 5 It can be seen that when moving the X-axis in one direction, the error between the measured displacement and the actual displacement is controlled within ±0.45mm. The measured value of the moving axis and the measured displacement maintain the same linear growth trend, and the change amplitude of the non-moving axis is consistent with that of the moving axis, which meets the accuracy requirements. At the same time, the error range of the X-axis is within ±0.45mm, and the error fluctuation does not increase with the increase of the reference displacement, indicating that the method proposed in this invention has stability and reliability when moving the X-axis in one direction. Figure 6 (a) is a graph showing the results of the triaxial displacement changes when the Y-axis moves unidirectionally. Figure 6 (b) is a graph showing the triaxial error values ​​when the Y-axis moves unidirectionally. Figure 6 (c) is a graph showing the stability of the Y-axis when it moves unidirectionally. Figure 6 It can be seen that when moving the Y-axis in one direction, the error between the measured displacement and the actual displacement is controlled within ±0.5mm. The measured value of the moving axis and the measured displacement maintain the same linear growth trend, and the change amplitude of the non-moving axis is consistent with that of the moving axis, which meets the accuracy requirements. At the same time, the error range of the Y-axis is within ±0.5mm, and the error fluctuation does not increase with the increase of the reference displacement, indicating that the method proposed in this invention has stability and reliability when moving the Y-axis in one direction. Figure 7 (a) is a graph showing the results of the triaxial displacement changes when the Z-axis moves unidirectionally. Figure 7 (b) is a graph showing the triaxial error values ​​when the Z-axis moves unidirectionally. Figure 7 (c) is a graph showing the stability of the Z-axis during unidirectional Z-axis movement. Figure 7 It can be seen that when moving the Z-axis in one direction, the error between the measured displacement and the actual displacement is controlled within ±0.5mm. The measured value of the moving axis and the measured displacement maintain the same linear growth trend, and the change amplitude of the non-moving axis is consistent with that of the moving axis, which meets the accuracy requirements. At the same time, the Z-axis error range is within ±0.5mm, and the error fluctuation does not increase with the increase of the reference displacement, indicating that the method proposed in this invention has stability and reliability when moving the Z-axis in one direction.

[0119] Since cracks can undergo more than one-way displacement in real-world situations, triaxial movement tests are also necessary. Figure 8 The results are from experiments conducted while simultaneously moving the X, Y, and Z axes. Figure 8 (a) is a graph showing the displacement changes of the three axes when they move simultaneously along the X, Y, and Z axes. Figure 8 (b) is a graph showing the result of the three-axis error values ​​when the XYZ axes move simultaneously. Figure 8 It can be seen that when the slide table is moved in three directions at the same time, the error between the measured displacement and the actual displacement is controlled within ±0.5mm. The measured value of the moving axis and the measured displacement maintain the same linear growth trend, which meets the accuracy requirements. Moreover, the error fluctuation does not increase with the increase of the reference displacement, indicating that the method proposed in this invention has stability and reliability when performing triaxial displacement at the same time.

[0120] The algorithm resolution of the proposed method was analyzed, and detailed data are shown in Table 1. Table 1 shows that the triaxial measurement fluctuation range of the proposed method is within 0.6 mm, proving that the resolution of the proposed method is within a controllable range.

[0121] Table 1 Algorithm Resolution Analysis

[0122]

[0123] The algorithm accuracy of the method proposed in this invention was analyzed, and detailed data are shown in Table 2. Table 2 shows that the triaxial absolute errors of the method proposed in this invention are all within ±0.5mm, meeting the requirements for crack measurement (±0.5mm) in the "Technical Specification for Safety Monitoring of Earth-Rock Dams".

[0124] Table 2 Algorithm Accuracy Analysis

[0125]

[0126] A repeatability analysis was performed on the method proposed in this invention, and the detailed data are shown in Table 3. Table 3 shows that the maximum deviation of the proposed method is 0.47 mm along the Y-axis, demonstrating the repeatability and reliability of the proposed method.

[0127] Table 3 Algorithm Repeatability Analysis

[0128]

[0129] This invention also proposes a U-Net semantic segmentation-based system for measuring cracks in irregular targets, including a data augmentation module, a data optimization module, a coordinate acquisition module, a crack measurement module, and a computer program that can run on a processor. It should be noted that each module in the above system corresponds to a specific step of the method provided in this invention, possessing the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the method provided in this invention.

[0130] This invention also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. It should be noted that when the processor executes the computer program, it corresponds to the specific steps of the method provided in this invention, possessing the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the method provided in this invention.

[0131] This invention also proposes a computer-readable storage medium storing a computer program. It should be noted that when the computer program is executed by a processor, it corresponds to the specific steps of the method provided in this invention, possessing the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the method provided in this invention.

[0132] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for measuring cracks in irregular targets based on U-Net semantic segmentation, characterized in that, include: S1. Use a camera to capture images of the target to form the initial dataset; The initial dataset is augmented to obtain the augmented dataset. S2. Train the U-Net image detection model based on the augmented dataset, and use the trained U-Net image detection model to process the mask image on site to obtain the optimized mask image. S3. Apply the Canny operator to the optimized mask image for edge extraction, obtain the maximum bounding shape on the extracted edge contour, and extract the feature point set on the maximum bounding shape. S4. Use the EPnP algorithm to match the coordinates of the feature points in the feature point set with the world coordinate system to obtain the projection matrix; based on the projection matrix constraints, use SVD singular value decomposition to obtain the sub-target coordinates. S5. Plane fitting is used to optimize the coordinates of the sub-target to obtain the final three-dimensional coordinate point set. The coordinate difference of the final three-dimensional coordinate point set at different time periods is compared to obtain the change of the three-dimensional displacement of the crack.

2. The method for measuring cracks in irregular targets based on U-Net semantic segmentation according to claim 1, characterized in that, In step S1, the target is a geometrically regular target for paint.

3. The method for measuring cracks in irregular targets based on U-Net semantic segmentation according to claim 1, characterized in that, In step S1, the data augmentation process includes sequentially performing labelme annotation, adding noise, adjusting brightness, and cropping.

4. The method for measuring cracks in irregular targets based on U-Net semantic segmentation according to claim 1, characterized in that, In step S2, the optimized mask image includes the following: S201. Divide the augmented dataset into a 4:1 ratio to obtain a training set and a test set. Use the training set to train the weight file of the U-Net image detection model. S202. Input the mask image from the scene into the trained U-Net image detection model, and use the semantic segmentation unit to perform semantic segmentation to obtain the segmented mask image. The segmented mask image is processed using a probability transformation unit to obtain a univariate potential energy field. The probability of the pixel belonging to a category is extracted to obtain confidence information. Based on the confidence information, preliminary element screening is performed. Based on the univariate potential energy field, feature space extraction, similarity kernel function calculation, and potential energy matrix construction are performed to obtain a two-sided potential energy matrix. Gaussian potential energy is calculated on the two-sided potential energy matrix to obtain global smoothness constraints. S203. Repeat step S202 five times to obtain the optimized mask image.

5. The method for measuring cracks in irregular targets based on U-Net semantic segmentation according to claim 1, characterized in that, In step S4, four control points are acquired in the world coordinate system, denoted as... , and the i-th 3D coordinate point in the world coordinate system satisfy: ; in, Let the coordinates be the homogeneous barycenter coordinates. Let j be the j-th control point in the world coordinate system; Based on the camera's intrinsic parameter matrix , The projection in the camera coordinate system is ,but: ; in, For projection parameters, , They are respectively Focal length in direction, They are respectively In the camera coordinate system Projected coordinates of direction They are respectively Coordinates in the world coordinate system; Let i be the i-th 2D coordinate point in the camera coordinate system; Eliminating the projection parameters yields: ; Connecting the four control points in series yields a system of linear equations, the specific formula of which is: ; in, The projection matrix; The coordinates of the control point in the camera coordinate system. , The second control parameter is N, where N is the total number of coordinate points. Based on the 3D-3D camera pose, the rotation matrix and translation vector of the Euclidean transformation are obtained; The rotation matrix and translation vector are iteratively optimized using the Levenberg-Marquardt method until the reprojection error is less than 0.1, at which point the iteration stops, and the left projection matrix M1 and the right projection matrix M2 are obtained. For the two cameras, left and right, respectively: ; in, The influence factor of the left camera. The x-coordinate of the 2D coordinate point projected by the left camera. The y-coordinate of the 2D coordinate point projected by the left camera. The influence factor of the right camera. The x-coordinate of the 2D projection point of the right camera. The x-coordinate of the 2D coordinate point projected by the right camera; Expanding the projection matrix and eliminating influence factors, we obtain the first equation: ; in, This is the first row of the left projection matrix. This is the second row of the left projection matrix. This is the third row of the left projection matrix. This is the first row of the right projection matrix. This is the second row of the right projection matrix. This is the third row of the right projection matrix; Converting the first equation into a matrix, we get: ; in, As an intermediate variable, ; Using SVD singular value decomposition, let The coordinates of the secondary target are obtained. in, It is a left singular matrix. It is a right singular matrix. for The transpose of .

6. The method for measuring cracks in irregular targets based on U-Net semantic segmentation according to claim 1, characterized in that, In step S5, the least median square algorithm is used to prefit the sub-target coordinates to form a preliminary fitting plane, and the coordinate points in the sub-target coordinates are judged. The specific formula is as follows: ; ; in, For robust standard deviation, The total number of coordinate points. The total number of samples, To take the median, The residual at the i-th coordinate point is... The weight of the i-th coordinate point; when When the value is 1, it indicates that the coordinate points in the sub-target coordinates belong to the preliminary fitting plane, and a three-dimensional coordinate point set is obtained. The distance-weighted overall least squares method is used to fit the three-dimensional coordinate point set to obtain the final three-dimensional coordinate point set. The formula for calculating the triaxial displacement change of the crack is: ; in, , and These represent the X, Y, and Z coordinate values ​​of the triaxial displacement change of the crack, respectively. , and These are the three-dimensional coordinates of the crack during the second measurement. , and These are the three coordinates of the crack during the first measurement.

7. A system applied to the U-Net semantic segmentation-based random target crack measurement method according to any one of claims 1-6, characterized in that, include: The data augmentation module is used to sample target images using a camera to form the initial dataset; The initial dataset is augmented to obtain the augmented dataset. The data optimization module is used to train the U-Net image detection model based on the augmented dataset, and then use the trained U-Net image detection model to process the masked images in the field to obtain optimized masked images. The coordinate acquisition module is used to perform edge extraction on the optimized mask image using the Canny operator, obtain the maximum bounding shape on the extracted edge contour, and extract the feature point set on the maximum bounding shape; the EPnP algorithm is used to match the coordinates of the feature point set with the world coordinate system to obtain the projection matrix; based on the projection matrix constraint, the sub-target coordinates are obtained using SVD singular value decomposition. The crack measurement module is used to optimize the coordinates of the sub-target using plane fitting to obtain the final three-dimensional coordinate point set. By comparing the coordinate differences of the final three-dimensional coordinate point sets at different time periods, the three-dimensional displacement changes of the crack can be obtained.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the irregular target crack measurement method based on U-Net semantic segmentation as described in any one of claims 1 to 6.

9. A computer-readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to perform the irregular target crack measurement method based on U-Net semantic segmentation as described in any one of claims 1 to 6.