Method and system for acquiring cracking parameters of wall painting cracks

By combining image acquisition equipment and the mural crack segmentation MCS model with a pixel-actual length mapping function, the problems of low efficiency, poor adaptability, and weak generalization ability in obtaining mural crack parameters were solved, achieving accurate identification and dynamic quantitative analysis.

CN120953348AActive Publication Date: 2025-11-14SOUTH CENTRAL UNIVERSITY FOR NATIONALITIES
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510977642.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-16
Publication Date
2025-11-14
Estimated Expiration
2045-07-16

AI Technical Summary

Technical Problem

Existing technologies for obtaining mural crack parameters suffer from problems such as low efficiency due to reliance on professional personnel, poor adaptability to complex backgrounds, weak generalization ability, and lack of dynamic quantitative analysis capabilities.

Method used

Image acquisition equipment is used to acquire images of cracks and a pre-trained mural crack segmentation MCS model is used for segmentation. A pixel-to-actual length mapping function is generated by a calibration board to achieve accurate identification and parameter acquisition of mural cracks.

Benefits of technology

It improves the automation efficiency and accuracy of mural crack detection, solves the problem of identification stability under complex backgrounds, and realizes quantitative analysis of crack dynamic development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120953348A_ABST
    Figure CN120953348A_ABST
Patent Text Reader

Abstract

The invention discloses a method for acquiring a cracking parameter of a mural crack, which comprises the following steps of: acquiring a mural crack image by using image acquisition equipment, inputting the mural crack image into a pre-trained mural crack segmentation model, and obtaining a segmentation result in a binary image form corresponding to the mural crack image; acquiring a shooting distance and a shooting mode between the image acquisition equipment and the mural; obtaining a calibration plate image set, carrying out the digital processing of all images in the set, obtaining the pixel length of a reference line in the image, and obtaining the ratio of the actual length of the reference line in the image to the pixel length as the ratio of the calibration plate image, and carrying out linear regression analysis on the ratio of the shooting distance used when the image is acquired in each shooting mode to the calibration plate image, and constructing a pixel-actual length mapping relation function. The technical problems that an existing manual measurement method is low in measurement efficiency and causes secondary damage to the mural can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of digital preservation technology and deep learning technology for murals, and more specifically, relates to a method and system for obtaining crack parameters of murals. Background Technology

[0002] Murals, as a treasure of the Chinese nation's long history and rich cultural heritage, have always been a focus of public attention in terms of their protection and restoration. However, due to long-term exposure to the natural environment and the impact of human activities, these precious murals are highly susceptible to various diseases such as cracks, blistering, and flaking, with cracks being one of the most common and damaging types. Accurate identification, segmentation, and acquisition of specific parameters of cracked areas are crucial for developing effective mural protection and restoration strategies. However, the complex and varied background colors of murals, the diverse forms of disease, and the scarcity of labeled data pose unprecedented challenges to traditional image segmentation techniques and make long-term monitoring of mural diseases difficult.

[0003] Currently, there are three main methods for obtaining mural crack parameters: the first is manual measurement, where professionals use tools to record parameters such as crack width and length on-site; the second is based on traditional image processing methods to detect mural defects, such as extracting defect features through HSV color space conversion and threshold segmentation, and then marking crack areas through edge detection and morphological operations; the third is based on deep learning semantic segmentation methods to detect mural defects, such as using an improved U-Net network to segment defects and combining edge detection to extract the outline of mural defects.

[0004] However, all three methods mentioned above have some significant drawbacks:

[0005] First, manual measurement relies on professional personnel, which is inefficient and difficult to meet the needs of large-scale mural conservation work. Furthermore, the contact-based operation may cause secondary damage to the murals.

[0006] Second, traditional image processing methods are poorly adaptable to complex backgrounds, have insufficient stability in parameter extraction, and are prone to missed detections or false detections.

[0007] Third, although deep learning-based semantic segmentation methods are effective in some scenarios, these methods often rely on a large amount of labeled data. Due to the scarcity of mural data and the diversity of crack morphology, the generalization ability of using general deep learning networks to segment mural cracks is weak.

[0008] Fourth, the above three methods all focus on marking mural defects, lacking the ability to quantitatively analyze the dynamic development of mural cracks. Summary of the Invention

[0009] To address the aforementioned deficiencies or improvement needs of existing technologies, this invention provides a method and system for obtaining crack parameters in murals. Its purpose is to solve the technical problems of existing manual measurement methods, which rely on professional personnel, have low measurement efficiency, and may cause secondary damage to the murals; existing methods based on traditional image processing have poor adaptability to complex backgrounds, insufficient stability in parameter extraction, and are prone to missed or false detections; existing deep learning-based semantic segmentation methods have weak generalization ability when dealing with mural crack problems involving scarce data and diverse morphologies; and all three methods lack the ability to quantify the dynamic development of mural cracks.

[0010] To achieve the above objectives, according to one aspect of the present invention, a method for obtaining crack parameters of murals is provided, comprising the following steps:

[0011] (1) Use an image acquisition device to acquire images of cracks on the mural, preprocess the crack images, input the preprocessed crack images into a pre-trained mural crack segmentation MCS model for image segmentation, so as to obtain the segmentation result in the form of a binary image corresponding to the crack images, and obtain the shooting distance D between the image acquisition device and the mural and the shooting mode R used by the image acquisition device when acquiring the crack images.

[0012] (2) Generate a calibration board. Use an image acquisition device to take pictures of the calibration board in various shooting modes and at various shooting distances to obtain a calibration board image set composed of multiple calibration board images in each shooting mode. Digitize each calibration board image in the calibration board image set to obtain the digitized calibration board image and the average pixel length of the three baselines in it. Obtain the ratio between the average actual length of the three baselines and the average pixel length as the ratio corresponding to the calibration board image. Perform linear regression analysis based on the ratios corresponding to all calibration board images to obtain the pixel-actual length mapping function corresponding to each shooting mode.

[0013] (3) The segmentation result in the form of binary image obtained in step (1) is digitally processed to obtain the pixel length, pixel width and pixel area of ​​the mural crack after digital processing, and the actual geometric parameters of the crack image obtained in step (1) are obtained according to the pixel length, pixel width, pixel area and the pixel-actual length mapping function corresponding to each shooting mode obtained in step (2).

[0014] Preferably, the image acquisition device used in step (1) is a mobile phone or a digital camera;

[0015] The preprocessing process in step (1) is as follows: First, the irrelevant background in the crack image is removed, and the crack image after removing the irrelevant background is saved as a square crack image as the preprocessed crack image; then, the preprocessed crack image is input into the pre-trained mural crack segmentation model to obtain the segmentation result in the form of a binary image.

[0016] Preferably, the mural crack segmentation model comprises 13 layers, and its specific structure is as follows:

[0017] The first layer is the image preprocessing layer. Its input is an image with dimensions H×W×C, where H represents the height of the image, W represents the width of the image, and C represents the number of channels of the image. This image preprocessing layer first uses bilinear interpolation to scale the length and width of the image to 1024 pixels. Then, it normalizes the scaled image and finally outputs a feature map with dimensions of 1024×1024×3.

[0018] The second layer is a convolutional layer. Its input is the feature map output by the first layer. This convolutional layer performs a convolution operation on the feature map and finally outputs a feature map with a dimension of 64×64×768.

[0019] The third layer is the Vision Transformer (ViT) network, which consists of N ViT blocks connected in series, where N is a natural number greater than 1, preferably 24.

[0020] For each ViT block, its specific structure is as follows:

[0021] Layer 3.1 is a normalization layer. Its input is the feature map output by layer 2. This normalization layer normalizes the feature map and outputs a feature map with dimensions of 64×64×768.

[0022] Layer 3.2 is a multi-head attention layer, whose input is the feature map output by layer 3.1. This multi-head attention layer inputs the feature map into the multi-head attention module to output a feature map with a dimension of 64×64×768.

[0023] Layer 3.3 is the Adapter layer, which takes the feature map output from layer 3.2 as its input. This Adapter layer inputs the feature map into the Adapter module to output a feature map with dimensions of 64×64×768.

[0024] Layer 3.4 is a residual connection layer. Its input is the feature maps output from layers 2 and 3.3. This residual connection layer performs a residual connection between the two feature maps to output a feature map with a dimension of 64×64×768.

[0025] Layer 3.5 is a normalization layer. Its input is the feature map output from layer 3.4. This normalization layer normalizes the feature map and outputs a feature map with dimensions of 64×64×768.

[0026] Layer 3.6 is a multilayer perceptron layer. The input is the feature map output from layer 3.5. This multilayer perceptron layer inputs the feature map into the multilayer perceptron module and outputs a feature map with a dimension of 64×64×768.

[0027] Layer 3.7 is the Adapter layer, which takes the feature map output from layer 3.4 as its input. This Adapter layer inputs the feature map into the Adapter module and outputs a feature map with dimensions of 64×64×768.

[0028] Layer 3.8 is a scaling layer. Its input is the feature map output from layer 3.7. This scaling layer multiplies the feature map by a scaling factor of 0.5 to scale it, and outputs a feature map with dimensions of 64×64×768.

[0029] Layer 3.9 is a residual connection layer, which takes the feature maps output from layers 3.6 and 3.8 as input. This residual connection layer performs a residual connection between the two feature maps to output a feature map with a dimension of 64×64×768.

[0030] The fourth layer is a convolutional layer. The input is the feature map output from the third and ninth layers. This convolutional layer performs a convolution operation on the feature map and finally outputs a feature map with dimensions of 64×64×256.

[0031] The fifth layer is a normalization layer. Its input is the feature map output by the fourth layer. This normalization layer normalizes the feature map and finally outputs a feature map with a dimension of 64×64×256.

[0032] The 6th layer is a convolutional layer. Its input is the feature map output by the 5th layer. This convolutional layer performs a convolution operation on the feature map and finally outputs a feature map with a dimension of 64×64×256.

[0033] The 7th layer is a normalization layer. Its input is the feature map output from the 6th layer. This normalization layer normalizes the feature map and finally outputs a feature map with a dimension of 64×64×256.

[0034] The 8th layer is the feature enhancement layer. Its input is the feature map output from the 7th layer. This feature enhancement layer first increases the channel dimension of the feature map to 1024 through a convolutional layer, then inputs the feature map with increased dimension into another convolutional layer, and finally inputs the feature map obtained by convolution into the ReLU activation function, and finally outputs a feature map with a dimension of 64×64×1024.

[0035] The 9th layer is a channel compression layer. Its input is the feature map output by the 8th layer. This channel compression layer first extracts the local context features of the feature map through a convolutional layer, and then reduces the channel dimension of the feature map after feature extraction from 1024 to 512 through another convolutional layer. Finally, a global attention module processes the dimensionality-reduced feature map, and the final output is a feature map with a dimension of 64×64×512.

[0036] The 10th layer is a channel compression layer. Its input is the feature map output from the 9th layer. This channel compression layer first extracts the local context features of the feature map through a convolutional layer, and then reduces the channel dimension of the feature map after feature extraction from 512 to 256 through another convolutional layer. Finally, a global attention module processes the dimensionality-reduced feature map, and the final output is a feature map with a dimension of 64×64×256.

[0037] The 11th layer is an upsampling layer, whose input is the feature map output from the 10th layer. This upsampling layer first extracts local context features of the feature map through two identical convolutional layers, and then upsamples the feature map after feature extraction through a transposed convolutional layer to restore the feature map size to 128×128. At the same time, it reduces the channel dimension of the feature map from 256 to 128. Finally, a global attention module processes the dimensionality-reduced feature map, and the final output is a feature map with a dimension of 128×128×128.

[0038] The 12th layer is an upsampling layer, whose input is the feature map output from the 11th layer. This upsampling layer first extracts the local context features of the feature map through two identical convolutional layers, and then upsamples the feature map after feature extraction through a transposed convolutional layer to restore the feature map size to 256×256. At the same time, it reduces the channel dimension of the feature map from 128 to 64. Finally, a global attention module processes the dimensionality-reduced feature map, and the final output is a feature map with a dimension of 256×256×64.

[0039] The 13th layer is the output convolutional layer, whose input is the feature map output by the 12th layer. This output convolutional layer first performs spatial refinement convolution on the local space of the feature map, and then performs prediction convolution on the convolutional feature map. Finally, the output is a feature map with a dimension of 256×256×2, which is the segmentation result in the form of a binary map.

[0040] Preferably, the mural crack segmentation model is obtained through the following steps:

[0041] (1-1) Obtain multiple mural crack images and crop each mural crack image in the original image set into a sub-image of size 256×256 pixels. All sub-images constitute the original image set.

[0042] (1-2) Use LabelMe image annotation tool to annotate each mural crack image in the original image set obtained in step (1-1), and convert each annotated mural crack image into a binary image with a dimension of 256×256×2. All mural crack images constitute the crack original image part in the dataset, and the binary images corresponding to all mural crack images constitute the mask image part in the dataset.

[0043] (1-3) Divide the dataset obtained in step (1-2) into a training set and a test set in a 7:3 ratio;

[0044] (1-4) For each sample in the original image part of the crack in the training set obtained in step (1-3), the sample is input into the first layer of the mural crack segmentation model for processing to obtain the feature map with a dimension of 1024×1024×3 corresponding to the sample.

[0045] (1-5) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 1024×1024×3 corresponding to the sample obtained in step (1-4) is input into the second layer of the mural crack segmentation model to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0046] (1-6) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-5) is input into the 3.1 layer of the mural crack segmentation model for normalization processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0047] (1-7) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-6) is input into the 3.2 layer of the mural crack segmentation model for processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0048] (1-8) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-7) is input into the 3.3 layer of the mural crack segmentation model for processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0049] (1-9) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-8) is input into the 3rd and 4th layers of the mural crack segmentation model for residual connection processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0050] (1-10) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-9) is input into the 3.5 layer of the mural crack segmentation model for normalization processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0051] (1-11) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-10) is input into the 3.6 layer of the mural crack segmentation model for processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0052] (1-12) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-11) is input into the 3.7 layer of the mural crack segmentation model for processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0053] (1-13) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-12) is input into the 3.8 layer of the mural crack segmentation model for scaling processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0054] (1-14) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-13) is input into the 3.9 layer of the mural crack segmentation model for residual connection processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0055] (1-15) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-14) is input into the 4th layer of the mural crack segmentation model for upsampling operation to obtain the feature map with a dimension of 64×64×256 corresponding to the sample.

[0056] (1-16) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×256 corresponding to the sample obtained in step (1-15) is input into the 5th layer of the mural crack segmentation model for normalization processing to obtain the feature map with a dimension of 64×64×256 corresponding to the sample.

[0057] (1-17) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×256 corresponding to the sample obtained in step (1-16) is input into the 6th layer of the mural crack segmentation model for convolution processing to obtain the feature map with a dimension of 64×64×256 corresponding to the sample.

[0058] (1-18) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×256 corresponding to the sample obtained in step (1-17) is input into the 7th layer of the mural crack segmentation model for normalization processing to obtain the feature map with a dimension of 64×64×256 corresponding to the sample.

[0059] (1-19) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×256 corresponding to the sample obtained in step (1-18) is input into the 8th layer of the mural crack segmentation model for feature enhancement processing to obtain the feature map with a dimension of 64×64×1024 corresponding to the sample.

[0060] (1-20) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×1024 corresponding to the sample obtained in step (1-19) is input into the 9th layer of the mural crack segmentation model for channel compression processing to obtain the feature map with a dimension of 64×64×512 corresponding to the sample.

[0061] (1-21) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×512 corresponding to the sample obtained in step (1-20) is input into the 10th layer of the mural crack segmentation model for channel compression processing to obtain the feature map with a dimension of 64×64×256 corresponding to the sample.

[0062] (1-22) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×256 corresponding to the sample obtained in step (1-21) is input into the 11th layer of the mural crack segmentation model for upsampling to obtain the feature map with a dimension of 128×128×128 corresponding to the sample.

[0063] (1-23) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 128×128×128 corresponding to the sample obtained in step (1-22) is input into the 12th layer of the mural crack segmentation model for upsampling to obtain the feature map with a dimension of 256×256×64 corresponding to the sample.

[0064] (1-24) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 256×256×64 corresponding to the sample obtained in step (1-23) is input into the 13th layer of the mural crack segmentation model for output convolution processing to obtain the feature map with a dimension of 256×256×2 corresponding to the sample.

[0065] (1-25) Calculate the loss function based on the feature map corresponding to each sample in the original image part of the crack in the training set obtained in step (1-24), and use the loss function to iteratively train the mural crack segmentation model until the mural crack segmentation model converges, thereby obtaining the preliminarily trained mural crack segmentation model.

[0066] (1-26) Use the test set obtained in step (1-3) to verify the mural crack segmentation model initially trained in step (1-25) until the classification accuracy reaches the optimal level, thereby obtaining the trained mural crack segmentation model.

[0067] Preferably, the loss function used in step (1-25) is:

[0068] Loss = L Dice +L BCE

[0069] L Dice The Dice loss function is calculated using the following formula:

[0070]

[0071] Where M represents the number of pixels in each sample of the original image portion of the crack in the training set, p i This represents the prediction result of the i-th pixel of each sample in the original image portion of the crack in the training set after passing through the model, where 1 represents the foreground, 0 represents the background, and g i represents the true label of the i-th pixel of each sample in the masked image part of the training set, where 1 represents the foreground, 0 represents the background, and ε represents the smoothing term, which ranges from 1e-10 to 1e-6, i∈[1,M].

[0072] L BCE The cross-entropy loss function (BCE) for binary classification is calculated as follows:

[0073]

[0074] Preferably, step (2) includes the following steps:

[0075] (2-1) Generate a calibration plate with three reference lines, each with a length of 100 mm and distributed at an orthogonal 45° angle to each other;

[0076] (2-2) Position the image acquisition device used in step (1) in front of the calibration plate generated in step (2-1) using an adjustable bracket, and adjust the image acquisition device so that its main optical axis is perpendicular to the surface of the calibration plate.

[0077] (2-3) The image acquisition device takes pictures of the calibration board generated in step (2-1) in multiple shooting modes and multiple shooting distances, and obtains a calibration board image set Aj = (aj1, ..., ajQ) composed of multiple calibration board images in each shooting mode, where Ajk represents the calibration board image obtained by shooting in the j-th shooting mode at the k-th distance, j∈[1, P], k∈[1, Q], P represents the number of shooting modes, and Q represents the number of shooting distances;

[0078] (2-4) For the calibration board image set Aj composed of multiple calibration board images under each shooting mode obtained in step (2-3), each calibration board image in the calibration board image set Aj is digitized to obtain the digitized calibration board image and the average pixel length of the three baselines therein, and the ratio of the average actual length of the three baselines to the average pixel length is obtained as the ratio corresponding to the calibration board image.

[0079] (2-5) For the calibration plate image set Aj obtained in step (2-3) under each shooting mode, perform linear regression analysis based on the shooting distance of all calibration plate images in the calibration plate image set and the ratio of all calibration plate images obtained in step (2-4) to obtain the pixel-actual length mapping function δj=Bj×Dj+Cj corresponding to the shooting mode, where Bj is the regression coefficient of the j-th shooting mode, Dj is the actual shooting distance when obtaining the mural crack image with the j-th shooting mode, and Cj is the intercept term of the j-th shooting mode.

[0080] Preferably, in step (2-3), P=4, that is, 4 shooting modes: standard mode with normal pixels, wide-angle mode with normal pixels, standard mode with high-definition pixels, and wide-angle mode with high-definition pixels;

[0081] In steps (2-3), Q = 6, which means 6 shooting distances: 500mm, 800mm, 1000mm, 1200mm, 1500mm, and 2000mm;

[0082] The process of obtaining the ratio between the average actual length and the average pixel length of the three baselines in step (2-4) as the ratio corresponding to the calibration board image is as follows: First, the calibration board image is cropped to obtain an effective calibration area image; then, the effective calibration area image is binarized to obtain the feature images of the three baselines after binarization; subsequently, the feature images of the three baselines after binarization are skeletonized to obtain the skeleton images of the three baselines with a width of one pixel; next, the skeleton images of the three baselines with a width of one pixel are contour extracted to obtain the skeleton contours of the three baselines; then, the number of all pixels in the skeleton contours of the three baselines is summed and the average value is taken, and the result is used as the average pixel length of each baseline; finally, the average actual length of each baseline is divided by the average pixel length to obtain the ratio corresponding to the calibration board image.

[0083] The image cropping process in steps (2-4) is performed using common image processing software. The binarization, skeletonization, contour extraction, and pixel summation are respectively completed using the threshold, ximgproc.thinning, findContours, and arcLength functions from the cv library in Python.

[0084] Preferably, steps (2-5) involve using the `linregress` function from Python's `scipy` library to fit the average pixel length of the calibration board image captured at each shooting distance under each shooting mode to obtain the pixel-to-actual length mapping function for that shooting mode. Specifically:

[0085] δns=Bns×Dns+Cns

[0086] δnw=Bnw×Dnw+Cnw

[0087] δhs=Bhs×Dhs+Chs

[0088] δhw=Bhw×Dhw+Chw

[0089] Where δns, δnw, δhs, and δhw represent the pixel-to-actual length mapping functions for the standard pixel mode, the wide-angle pixel mode, the high-resolution pixel mode, and the wide-angle pixel mode, respectively; Bns, Bnw, Bhs, and Bhw represent the regression coefficients for the standard pixel mode, the wide-angle pixel mode, the high-resolution pixel mode, and the wide-angle pixel mode, respectively; Dns, Dnw, Dhs, and Dhw represent the actual shooting distances when acquiring images of mural cracks using the standard pixel mode, the wide-angle pixel mode, the high-resolution pixel mode, and the wide-angle pixel mode, respectively; and Cns, Cnw, Chs, and Chw represent the intercept terms for the standard pixel mode, the wide-angle pixel mode, the high-resolution pixel mode, and the wide-angle pixel mode, respectively.

[0090] Preferably, step (3) includes the following steps:

[0091] (3-1) The segmentation result in the form of binary image obtained in step (1) is skeletonized to obtain its crack center line. The crack center line is then subjected to contour extraction to obtain the contour of the crack skeleton. The number of all pixels in the contour of the crack skeleton is then used as the pixel length of the crack in the crack image obtained in step (1).

[0092] Specifically, this step involves first using the ximgproc.thinning function from the cv library in Python to perform skeletonization on the segmentation result in the form of the binary image obtained in step (1) to extract the center line of the crack as the skeletonization result. Then, the findContours function from the cv library is used to perform contour extraction on the center line of the crack to obtain the contour of the crack skeleton. Finally, the arcLength function from the cv library is used to obtain the number of all pixels in the contour of the crack skeleton as the pixel length of the crack in the crack image obtained in step (1).

[0093] (3-2) The Canny operator in Python's cv library is used to perform edge detection processing on the segmentation result in the form of a binary image corresponding to the crack image obtained in step (1) to extract the edge of the crack in the crack image as the edge detection result. Based on the edge detection processing result and the crack center line obtained in step (3-1), the distance between each pixel on the crack center line and the crack edge in the edge detection processing result in the normal direction is obtained, which is the normal width value of the pixel. Finally, all normal width values ​​of all pixels on the crack center line are counted, and the maximum value is taken as the maximum pixel width of the crack in the crack image.

[0094] (3-3) Perform pixel statistics on the segmentation result in the form of a binary image corresponding to the crack image obtained in step (1) to obtain the pixel area of ​​the crack in the crack image;

[0095] Specifically, this step involves using the sum function from Python's numpy library to perform pixel statistics on the segmentation result in the form of a binary image corresponding to the crack image obtained in step (1), so as to obtain the pixel area of ​​the crack in the crack image.

[0096] (3-4) Input the shooting distance D between the image acquisition device and the mural obtained in step (1) and the shooting mode R used by the image acquisition device when acquiring the crack image into the pixel-actual length mapping function corresponding to the shooting mode obtained in step (2-5) to obtain the corresponding mapping ratio. Then multiply the pixel length of the crack obtained in step (3-1), the pixel width of the crack obtained in step (3-2), and the pixel area of ​​the crack obtained in step (3-3) by the mapping ratio in the shooting mode to obtain the actual length, actual width, and actual area of ​​the crack in the mural crack image obtained in step (1) under the shooting mode.

[0097] According to another aspect of the present invention, a system for obtaining crack parameters of murals is provided, comprising:

[0098] The first module is used to acquire images of cracks on the mural using an image acquisition device, preprocess the crack images, input the preprocessed crack images into a pre-trained mural crack segmentation MCS model for image segmentation, so as to obtain the segmentation result in the form of a binary image corresponding to the crack images, and obtain the shooting distance D between the image acquisition device and the mural and the shooting mode R used by the image acquisition device when acquiring the crack images.

[0099] The second module is used to generate a calibration board. It uses an image acquisition device to capture images of the calibration board in various shooting modes and at various shooting distances to obtain a calibration board image set consisting of multiple calibration board images in each shooting mode. Each calibration board image in the calibration board image set is digitized to obtain the digitized calibration board image and the average pixel length of the three baselines in it. The ratio between the average actual length of the three baselines and the average pixel length is obtained as the ratio corresponding to the calibration board image. Linear regression analysis is performed based on the ratios corresponding to all calibration board images to obtain the pixel-actual length mapping function corresponding to each shooting mode.

[0100] The third module is used to digitize the segmentation results in the form of binary images obtained by the first module, so as to obtain the pixel length, pixel width and pixel area of ​​the mural cracks after digitization, and to obtain the actual geometric parameters of the crack image obtained by the first module according to the pixel length, pixel width, pixel area and the pixel-actual length mapping function corresponding to each shooting mode obtained by the second module.

[0101] In summary, compared with the prior art, the above-described technical solutions conceived by this invention can achieve the following beneficial effects:

[0102] 1. Since the present invention adopts steps (1) to (3), it obtains accurate mural crack segmentation results through the mural crack segmentation model constructed by the present invention and the pixel-actual length mapping relationship function, thereby obtaining the cracking parameters of the mural crack. Therefore, it can solve the technical problems of existing manual annotation methods that rely on professional manpower, have low measurement efficiency, and may cause secondary damage to the mural.

[0103] 2. Because the present invention adopts step (1), the mural crack segmentation model constructed by the present invention can also identify mural cracks in complex backgrounds well. Therefore, it can solve the technical problems of poor adaptability to complex backgrounds, insufficient parameter extraction stability, and easy missed detection or false detection of existing methods based on traditional image processing.

[0104] 3. Because the present invention adopts steps (1-8) and (1-12), it introduces the Adapter fine-tuning module into the ViT architecture, which improves the model's ability to segment mural cracks and diseases in specific tasks. Therefore, it can solve the technical problem that existing deep learning-based semantic segmentation methods have weak generalization ability when solving mural crack problems with scarce data and diverse forms.

[0105] 4. Since the present invention adopts steps (2) to (3), it can obtain the actual cracking parameters of the mural crack through the pixel-actual length mapping relationship function obtained by the present invention. Therefore, it can solve the technical problem that the above three mural crack marking methods lack the ability to quantify the dynamic development of mural cracks.

[0106] 5. The image acquisition device used in this invention is simple and can be a mobile phone, digital camera or other device, without the need for professional image acquisition equipment, which improves the convenience of detection and processing efficiency.

[0107] 6. The mural crack segmentation model of the present invention can realize the automatic labeling of mural cracks without manual intervention, which can greatly improve the efficiency of mural crack defect labeling work.

[0108] 7. The mural crack segmentation model constructed by this invention has achieved good results when applied to mural crack segmentation; the pixel-actual length mapping function obtained has also achieved good results when applied to obtain mural crack opening parameters. Attached Figure Description

[0109] Figure 1 This is a flowchart of the method for obtaining mural crack parameters according to the present invention;

[0110] Figure 2 This is a schematic diagram of the structure of the MCS network model used in this invention;

[0111] Figure 3 (a) and (b) are samples from the original image portion of the crack and the masked image portion of the present invention, respectively;

[0112] Figure 4 This is a schematic diagram comparing the model of this invention with other segmentation models. Detailed Implementation

[0113] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.

[0114] See Figure 1 This is a schematic diagram of a method for obtaining crack parameters of murals according to the present invention. This method can be applied to existing smartphones with visual information processing and communication capabilities, improving the convenience of detection and processing efficiency.

[0115] The basic idea of ​​this invention is as follows: First, an image acquisition device is used to acquire images of cracks in a mural. These images are then input into a pre-trained mural crack segmentation model to obtain a segmentation result in binary image form. The shooting distance between the image acquisition device and the mural, as well as the shooting mode used to acquire the crack images, are also obtained. Next, a set of calibration board images is acquired, and all images in the set are digitized to obtain the pixel length of the baseline in the images. The ratio of the actual length of the baseline to the pixel length is used as the ratio of the calibration board images. Linear regression analysis is then performed on the ratio of the shooting distance used to acquire images in each shooting mode to the calibration board images to obtain a pixel-actual length mapping function for each shooting mode. Finally, a pixel-actual length mapping function is selected based on the shooting mode used to capture the mural crack images. The shooting distance is input into the function to obtain the mapping ratio of the images. The actual geometric parameters of the cracks in the images are then calculated using this mapping ratio.

[0116] like Figure 1 As shown, the present invention provides a method for obtaining crack parameters of murals, comprising the following steps:

[0117] (1) Use an image acquisition device to acquire images of cracks on the mural, preprocess the crack images, input the preprocessed crack images into a pre-trained Mural Crack Segmentation (MCS) model for image segmentation, so as to obtain the segmentation result in the form of a binary image corresponding to the crack images, and obtain the shooting distance D between the image acquisition device and the mural and the shooting mode R used by the image acquisition device when acquiring the crack images;

[0118] The image acquisition device used in this step is, for example, a mobile phone or a digital camera.

[0119] The preprocessing process in this step is as follows: First, irrelevant backgrounds in the crack image are removed, and the crack image after removing irrelevant backgrounds is saved as a square crack image as the preprocessed crack image; then, the preprocessed crack image is input into a pre-trained mural crack segmentation model to obtain a segmentation result in the form of a binary image.

[0120] like Figure 2 As shown, the mural crack segmentation model of the present invention comprises 13 layers, and its specific structure is as follows:

[0121] The first layer is the image preprocessing layer. Its input is an image with dimensions H×W×C, where H represents the height of the image, W represents the width of the image, and C represents the number of channels of the image (usually RGB 3 channels). This image preprocessing layer first uses bilinear interpolation to scale the length and width of the image to 1024 pixels. Then, it performs normalization processing on the scaled image (the purpose is to eliminate the distribution differences between different input images). The final output is a feature map with dimensions of 1024×1024×3.

[0122] The second layer is a convolutional layer. Its input is the feature map output by the first layer. This convolutional layer performs a convolution operation on the feature map (the parameters of the convolution operation are: 768 output channels, 16×16 kernel size, and 16 stride). The final output is a feature map with a dimension of 64×64×768.

[0123] The third layer is a Vision Transformer (ViT) network, which includes N ViT blocks connected in series, where N is a natural number greater than 1, preferably 24;

[0124] For each ViT block, its specific structure is as follows:

[0125] Layer 3.1 is a normalization layer. Its input is the feature map output by layer 2. This normalization layer normalizes the feature map and outputs a feature map with dimensions of 64×64×768.

[0126] Layer 3.2 is a multi-head attention layer. Its input is the feature map output by layer 3.1. This multi-head attention layer inputs the feature map into the multi-head attention module to output a feature map with a dimension of 64×64×768.

[0127] Layer 3.3 is the Adapter layer, which takes the feature map output from layer 3.2 as its input. The Adapter layer inputs the feature map into the Adapter module (which first downsamples the feature map from 768 to 192, then inputs the feature map into the ReLU activation function, and finally upsamples the activated feature map to restore its channel count to 768) to output a feature map with dimensions of 64×64×768.

[0128] Layer 3.4 is a residual connection layer. Its input is the feature maps output from layers 2 and 3.3. This residual connection layer performs a residual connection between the two feature maps to output a feature map with a dimension of 64×64×768.

[0129] Layer 3.5 is a normalization layer. Its input is the feature map output from layer 3.4. This normalization layer normalizes the feature map and outputs a feature map with dimensions of 64×64×768.

[0130] Layer 3.6 is a multilayer perceptron layer. The input is the feature map output from layer 3.5. This multilayer perceptron layer inputs the feature map into the multilayer perceptron module (which first upsamples the number of channels of the feature map from 768 to 3072, then inputs the feature map into the GELU activation function, and finally downsamples the activated feature map to restore its number of channels to 768), and outputs a feature map with a dimension of 64×64×768.

[0131] Layer 3.7 is the Adapter layer, which takes the feature map output from layer 3.4 as its input. The Adapter layer inputs the feature map into the Adapter module (which first downsamples the feature map from 768 to 192 channels, then inputs the feature map into the ReLU activation function, and finally upsamples the activated feature map to restore its channel count to 768) and outputs a feature map with a dimension of 64×64×768.

[0132] Layer 3.8 is a scaling layer. Its input is the feature map output from layer 3.7. This scaling layer multiplies the feature map by a scaling factor of 0.5 to scale it to output a feature map with dimensions of 64×64×768.

[0133] Layer 3.9 is a residual connection layer. Its input is the feature maps output from layers 3.6 and 3.8. This residual connection layer performs a residual connection between these two feature maps to output a feature map with a dimension of 64×64×768.

[0134] The fourth layer is a convolutional layer. The input is the feature map output from the third and ninth layers. This convolutional layer performs a convolution operation on the feature map (the parameters of the convolution operation are: 256 output channels, 1×1 kernel size, stride of 1, and padding of 0). The final output is a feature map with dimensions of 64×64×256.

[0135] The fifth layer is a normalization layer. Its input is the feature map output from the fourth layer. This normalization layer normalizes the feature map and finally outputs a feature map with dimensions of 64×64×256.

[0136] The 6th layer is a convolutional layer. Its input is the feature map output by the 5th layer. This convolutional layer performs a convolution operation on the feature map (the parameters of the convolution operation are: 256 output channels, 3×3 kernel size, stride of 1, and padding of 1). The final output is a feature map with a dimension of 64×64×256.

[0137] The 7th layer is a normalization layer. Its input is the feature map output from the 6th layer. This normalization layer normalizes the feature map and finally outputs a feature map with a dimension of 64×64×256.

[0138] The 8th layer is the feature enhancement layer, which takes the feature map output from the 7th layer as input. This feature enhancement layer first increases the channel dimension of the feature map to 1024 through a convolutional layer (the parameters of the convolution operation are: 1024 output channels, 1×1 kernel size, 1 stride, and 0 padding). Then, the feature map with increased dimension is input into another convolutional layer (the purpose is to further enhance the channel interaction, where the parameters of the convolution operation are: 1024 output channels, 1×1 kernel size, 1 stride, and 0 padding). Finally, the feature map obtained from the convolution is input into the ReLU activation function, and the final output is a feature map with a dimension of 64×64×1024.

[0139] Layer 9 is a channel compression layer, whose input is the feature map output from layer 8. This channel compression layer first extracts local contextual features from the feature map through a convolutional layer (the parameters of the convolution operation are: 1024 output channels, 3×3 kernel size, stride 1, padding 1). Then, it passes through another convolutional layer to reduce the channel dimension of the feature map after feature extraction from 1024 to 512 (the parameters of the convolution operation are: 512 output channels, 3×3 kernel size, stride 1, padding 1). Finally, a global attention module processes the dimensionality-reduced feature map (to suppress invalid features and enhance the response of the gap boundary), and the final output is a feature map with a dimension of 64×64×512.

[0140] Layer 10 is a channel compression layer, whose input is the feature map output from layer 9. This channel compression layer first extracts the local context features of the feature map through a convolutional layer (the parameters of the convolution operation are: 512 output channels, 3×3 kernel size, stride 1, padding 1). Then, it passes through another convolutional layer to reduce the channel dimension of the feature map after feature extraction from 512 to 256 (the parameters of the convolution operation are: 256 output channels, 3×3 kernel size, stride 1, padding 1). Finally, a global attention module processes the dimensionality-reduced feature map (to suppress invalid features and enhance the response of the gap boundary), and the final output is a feature map with a dimension of 64×64×256.

[0141] Layer 11 is an upsampling layer, whose input is the feature map output from layer 10. This upsampling layer first extracts local contextual features from the feature map through two identical convolutional layers (the parameters of the convolution operation are: 256 output channels, 3×3 kernel size, stride 1, and padding 1). Then, it upsamples the feature map after feature extraction through a transposed convolutional layer, restoring the feature map size to 128×128, and reducing the channel dimension of the feature map from 256 to 128 (the parameters of the transposed convolution operation are: 128 output channels, 2×2 kernel size, stride 2, and padding 0). Finally, a global attention module processes the dimensionality-reduced feature map (to suppress invalid features and enhance the response of the crack boundary), and the final output is a feature map with a dimension of 128×128×128.

[0142] Layer 12 is an upsampling layer, whose input is the feature map output from layer 11. This upsampling layer first extracts the local context features of the feature map through two identical convolutional layers (the parameters of the convolution operation are: 128 output channels, 3×3 kernel size, stride 1, and padding 1). Then, a transposed convolutional layer upsamples the feature map after feature extraction, restoring the feature map size to 256×256, while reducing the channel dimension of the feature map from 128 to 64 (the parameters of the transposed convolution operation are: 64 output channels, 2×2 kernel size, stride 2, and padding 0). Finally, a global attention module processes the dimensionality-reduced feature map (to suppress invalid features and enhance the response of the crack boundary), and the final output is a feature map with a dimension of 256×256×64.

[0143] The 13th layer is the output convolutional layer, whose input is the feature map output from the 12th layer. This output convolutional layer first performs spatial refinement convolution on the local space of the feature map (the parameters of the convolution operation are: 64 output channels, 3×3 kernel size, stride 1, padding 1). Then, the convolutional feature map is subjected to prediction convolution (the parameters of the convolution operation are: 2 output channels, 1×1 kernel size, stride 1, padding 0). Finally, the output is a feature map with a dimension of 256×256×2, which is the segmentation result in the form of a binary map.

[0144] Specifically, the mural crack segmentation model is trained through the following steps:

[0145] (1-1) Obtain multiple mural crack images and crop each mural crack image in the original image set into a sub-image of size 256×256 pixels. All sub-images constitute the original image set.

[0146] Specifically, the images of the mural cracks in this step were obtained through two methods: online collection and on-site photography at cultural relic protection units.

[0147] (1-2) Use the LabelMe image annotation tool to annotate each mural crack image in the original image set obtained in step (1-1) (that is, to annotate the crack part), and convert each annotated mural crack image into a binary image (its dimension is 256×256×2). All mural crack images constitute the crack original image part in the dataset, and the binary images corresponding to all mural crack images constitute the mask image part in the dataset.

[0148] Figure 3 (a) and (b) show samples from the original image portion of the crack and samples from the masked image portion, respectively.

[0149] (1-3) Divide the dataset obtained in step (1-2) into a training set and a test set in a ratio of 7:3.

[0150] (1-4) For each sample in the original image part of the crack in the training set obtained in step (1-3), the sample is input into the first layer of the mural crack segmentation model for processing to obtain the feature map with a dimension of 1024×1024×3 corresponding to the sample.

[0151] (1-5) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 1024×1024×3 corresponding to the sample obtained in step (1-4) is input into the second layer of the mural crack segmentation model to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0152] (1-6) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-5) is input into the 3.1 layer of the mural crack segmentation model for normalization processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0153] The advantages of the above steps (1-6) are that layer normalization standardizes the output of each layer, reducing the problem of excessive differences in input data between different layers, which helps to stabilize the training process. At the same time, by limiting the parameter distribution of each layer in the network, it helps to avoid the model's excessive dependence on noise and unnecessary features, thereby improving the generalization ability.

[0154] (1-7) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-6) is input into the 3.2 layer of the mural crack segmentation model for processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0155] The advantage of steps (1-7) above is that the multi-head self-attention mechanism enables the model to establish long-range dependencies between input features, thereby capturing global information and complex contextual relationships in the image. The combination of these two aspects effectively enhances the network's ability to understand and process image data.

[0156] (1-8) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-7) is input into the 3.3 layer of the mural crack segmentation model for processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0157] (1-9) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-8) is input into the 3rd and 4th layers of the mural crack segmentation model for residual connection processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0158] (1-10) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-9) is input into the 3.5 layer of the mural crack segmentation model for normalization processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0159] (1-11) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-10) is input into the 3.6 layer of the mural crack segmentation model for processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0160] (1-12) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-11) is input into the 3.7 layer of the mural crack segmentation model for processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0161] The advantage of steps (1-8) and (1-12) above lies in improving the model's ability to segment mural cracks and defects by introducing the Adapter fine-tuning module into the ViT architecture. The Adapter fine-tuning module inserts lightweight trainable parameters into the multi-head attention mechanism and feedforward network of each ViT layer, allowing the network to be fine-tuned while retaining the weights of the pre-trained model. By combining the powerful feature learning capabilities of the multi-layer ViT architecture with the fine-tuning advantages of the Adapter module, the image encoding adapter can learn mural crack features, enhancing its performance in the mural crack and defect segmentation task, while updating parameters only for the fine-tuning module, thereby improving training efficiency.

[0162] (1-13) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-12) is input into the 3.8 layer of the mural crack segmentation model for scaling processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0163] (1-14) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-13) is input into the 3.9 layer of the mural crack segmentation model for residual connection processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample.

[0164] (1-15) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-14) is input into the 4th layer of the mural crack segmentation model for upsampling operation to obtain the feature map with a dimension of 64×64×256 corresponding to the sample.

[0165] (1-16) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×256 corresponding to the sample obtained in step (1-15) is input into the 5th layer of the mural crack segmentation model for normalization processing to obtain the feature map with a dimension of 64×64×256 corresponding to the sample.

[0166] (1-17) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×256 corresponding to the sample obtained in step (1-16) is input into the 6th layer of the mural crack segmentation model for convolution processing to obtain the feature map with a dimension of 64×64×256 corresponding to the sample.

[0167] (1-18) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×256 corresponding to the sample obtained in step (1-17) is input into the 7th layer of the mural crack segmentation model for normalization processing to obtain the feature map with a dimension of 64×64×256 corresponding to the sample.

[0168] (1-19) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×256 corresponding to the sample obtained in step (1-18) is input into the 8th layer of the mural crack segmentation model for feature enhancement processing to obtain the feature map with a dimension of 64×64×1024 corresponding to the sample.

[0169] The advantages of the above steps (1-19) are that channel expansion significantly improves the semantic information carrying capacity of features, provides a high-dimensional feature foundation for subsequent multi-level upsampling, and enhances nonlinear expression capabilities when combined with the ReLU activation function.

[0170] (1-20) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×1024 corresponding to the sample obtained in step (1-19) is input into the 9th layer of the mural crack segmentation model for channel compression processing to obtain the feature map with a dimension of 64×64×512 corresponding to the sample.

[0171] (1-21) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×512 corresponding to the sample obtained in step (1-20) is input into the 10th layer of the mural crack segmentation model for channel compression processing to obtain the feature map with a dimension of 64×64×256 corresponding to the sample.

[0172] (1-22) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×256 corresponding to the sample obtained in step (1-21) is input into the 11th layer of the mural crack segmentation model for upsampling to obtain the feature map with a dimension of 128×128×128 corresponding to the sample.

[0173] (1-23) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 128×128×128 corresponding to the sample obtained in step (1-22) is input into the 12th layer of the mural crack segmentation model for upsampling to obtain the feature map with a dimension of 256×256×64 corresponding to the sample.

[0174] The advantage of steps (1-20) to (1-23) above is that a global attention model (GAM) is embedded after upsampling in the four multi-level upsampling layers. The GAM is composed of a channel attention submodule and a spatial attention submodule connected in series. It dynamically optimizes feature selection through a channel-space dual attention mechanism. The channel attention branch uses a fully connected layer to compress and restore the channel dimension and generate channel weights to suppress irrelevant features. The spatial attention branch uses a 7×7 large convolutional kernel to capture wide contextual information and enhance the response in the gap region.

[0175] (1-24) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 256×256×64 corresponding to the sample obtained in step (1-23) is input into the 13th layer of the mural crack segmentation model for output convolution processing to obtain the feature map with a dimension of 256×256×2 corresponding to the sample.

[0176] (1-25) Calculate the loss function based on the feature map corresponding to each sample in the original image part of the crack in the training set obtained in step (1-24), and use the loss function to iteratively train the mural crack segmentation model until the mural crack segmentation model converges, thereby obtaining the preliminarily trained mural crack segmentation model.

[0177] Specifically, the loss function used in this step is:

[0178] Loss = L Dice +L BCE

[0179] L Dice The Dice loss function is calculated using the following formula:

[0180]

[0181] Where M represents the number of pixels in each sample of the original image portion of the crack in the training set, p i g represents the prediction result of the i-th pixel of each sample in the original image portion of the crack in the training set after passing through the model (1 represents foreground, 0 represents background). iε represents the true label of the i-th pixel of each sample in the masked image portion of the training set (1 represents the foreground and 0 represents the background). ε is a smoothing term introduced to avoid the denominator being zero. Its value ranges from 1e-10 to 1e-6, preferably 1e-6, i∈[1,M].

[0182] L BCE The binary cross-entropy loss function (BCE) is calculated as follows:

[0183]

[0184] The advantages of steps (1-25) above are that the Dice loss function can measure the degree of overlap between two sample sets, emphasizing overall region matching and being effective for sparse foreground data; the BCE loss function can compare the predicted probability distribution with the true label probability distribution to calculate the error, accurately aligning pixel-level labels and being suitable for most cases. Combining the two can simultaneously optimize local pixels and the overall region, making it one of the most commonly used combinations.

[0185] (1-26) Use the test set obtained in step (1-3) to verify the mural crack segmentation model initially trained in step (1-25) until the classification accuracy reaches the optimal level, thereby obtaining the trained mural crack segmentation model.

[0186] (2) Generate a calibration board. Use an image acquisition device to take pictures of the calibration board in various shooting modes and at various shooting distances to obtain a calibration board image set composed of multiple calibration board images in each shooting mode. Digitize each calibration board image in the calibration board image set to obtain the digitized calibration board image and the average pixel length of the three baselines in it. Obtain the ratio between the average actual length of the three baselines and the average pixel length as the ratio corresponding to the calibration board image. Perform linear regression analysis based on the ratios corresponding to all calibration board images to obtain the pixel-actual length mapping function corresponding to each shooting mode.

[0187] Specifically, this step includes the following steps:

[0188] (2-1) Generate a calibration plate with three reference lines, each with a length of 100 mm and distributed at an orthogonal 45° angle to each other;

[0189] Specifically, this step involves using Word or a regular drawing software to draw three thin lines, each 100mm long, as baselines. The directions of these three lines are horizontal, vertical, and diagonally at 45 degrees.

[0190] (2-2) Position the image acquisition device used in step (1) in front of the calibration plate generated in step (2-1) using an adjustable bracket, and adjust the image acquisition device so that its main optical axis is perpendicular to the surface of the calibration plate.

[0191] (2-3) The image acquisition device takes pictures of the calibration board generated in step (2-1) in multiple shooting modes and multiple shooting distances, and obtains a calibration board image set Aj = (aj1, ..., ajQ) composed of multiple calibration board images in each shooting mode, where Ajk represents the calibration board image obtained by shooting in the j-th shooting mode at the k-th distance, j∈[1, P], k∈[1, Q], P represents the number of shooting modes, and Q represents the number of shooting distances;

[0192] In this embodiment, P=4, which means 4 shooting modes: standard mode with normal pixels, wide-angle mode with normal pixels, standard mode with high-definition pixels, and wide-angle mode with high-definition pixels; Q=6, which means 6 shooting distances: 500mm, 800mm, 1000mm, 1200mm, 1500mm, and 2000mm.

[0193] (2-4) For the calibration board image set Aj composed of multiple calibration board images under each shooting mode obtained in step (2-3), each calibration board image in the calibration board image set Aj is digitized to obtain the digitized calibration board image and the average pixel length of the three baselines therein, and the ratio of the average actual length of the three baselines to the average pixel length is obtained as the ratio corresponding to the calibration board image (unit: mm / pixel).

[0194] The process of obtaining the ratio of the average actual length to the average pixel length of the three baselines as the ratio corresponding to the calibration board image in this step is as follows: First, the calibration board image is cropped to obtain an effective calibration region image; then, the effective calibration region image is binarized to obtain the feature images of the three baselines after binarization; next, the feature images of the three baselines after binarization are skeletonized to obtain the skeleton images of the three baselines with a width of one pixel; then, the skeleton images of the three baselines with a width of one pixel are contour extracted to obtain the skeleton contours of the three baselines; subsequently, the number of all pixels in the skeleton contours of the three baselines is summed and averaged (i.e., the number of all pixels in the skeleton contours of the three baselines is divided by 3), and the result is used as the average pixel length of each baseline; finally, the average actual length of each baseline is divided by the average pixel length to obtain the ratio corresponding to the calibration board image.

[0195] More specifically, image cropping is performed using common image processing software (such as Photoshop). Binarization, skeletonization, contour extraction, and pixel summation are accomplished using the `threshold`, `ximgproc.thinning`, `findContours`, and `arcLength` functions from the `cv` library in Python, respectively.

[0196] (2-5) For the calibration plate image set Aj obtained in step (2-3) under each shooting mode, perform linear regression analysis based on the shooting distance of all calibration plate images in the calibration plate image set and the ratio of all calibration plate images obtained in step (2-4) to obtain the pixel-actual length mapping function δj=Bj×Dj+Cj corresponding to the shooting mode (where Bj is the regression coefficient of the j-th shooting mode, Dj is the actual shooting distance when obtaining the mural crack image with the j-th shooting mode, and Cj is the intercept term of the j-th shooting mode).

[0197] Specifically, this step uses the `linregress` function from Python's `scipy` library to fit the average pixel length of the calibration board image captured at each shooting distance under each shooting mode to obtain the pixel-to-actual length mapping function for that shooting mode. Specifically:

[0198] δns=Bns×Dns+Cns

[0199] δnw=Bnw×Dnw+Cnw

[0200] δhs=Bhs×Dhs+Chs

[0201] δhw=Bhw×Dhw+Chw

[0202] Where δns, δnw, δhs, and δhw represent the pixel-to-actual length mapping functions for the standard pixel mode, the wide-angle pixel mode, the high-resolution pixel mode, and the wide-angle pixel mode, respectively; Bns, Bnw, Bhs, and Bhw represent the regression coefficients for the standard pixel mode, the wide-angle pixel mode, the high-resolution pixel mode, and the wide-angle pixel mode, respectively; Dns, Dnw, Dhs, and Dhw represent the actual shooting distances when acquiring images of mural cracks using the standard pixel mode, the wide-angle pixel mode, the high-resolution pixel mode, and the wide-angle pixel mode, respectively; and Cns, Cnw, Chs, and Chw represent the intercept terms for the standard pixel mode, the wide-angle pixel mode, the high-resolution pixel mode, and the wide-angle pixel mode, respectively.

[0203] The advantage of this step (2) is that after obtaining the pixel-actual length mapping function of the image acquisition device, the subsequent acquisition of the cracking parameters of the mural does not require repeating the acquisition function step. The corresponding mapping ratio can be obtained by directly using the photography mode selection function when taking the image obtained in step (1) and inputting the shooting distance into the function.

[0204] (3) The segmentation result in the form of binary image obtained in step (1) is digitally processed to obtain the pixel length, pixel width and pixel area of ​​the mural crack after digital processing, and the actual geometric parameters of the crack image obtained in step (1) are obtained according to the pixel length, pixel width, pixel area and pixel-actual length mapping function obtained in step (2).

[0205] Specifically, this step includes the following steps:

[0206] (3-1) The segmentation result in the form of binary image obtained in step (1) is skeletonized to obtain its crack center line. The crack center line is then subjected to contour extraction to obtain the contour of the crack skeleton. The number of all pixels in the contour of the crack skeleton is then used as the pixel length of the crack in the crack image obtained in step (1).

[0207] Specifically, this step involves first using the ximgproc.thinning function from the cv library in Python to perform skeletonization on the segmentation result in the form of the binary image obtained in step (1) to extract the center line of the crack as the skeletonization result. Then, the findContours function from the cv library is used to perform contour extraction on the center line of the crack to obtain the contour of the crack skeleton. Finally, the arcLength function from the cv library is used to obtain the number of all pixels in the contour of the crack skeleton as the pixel length of the crack in the crack image obtained in step (1).

[0208] (3-2) The Canny operator in Python's cv library is used to perform edge detection processing on the segmentation result in the form of a binary image corresponding to the crack image obtained in step (1) to extract the edge of the crack in the crack image as the edge detection result. Based on the edge detection processing result and the crack center line obtained in step (3-1), the distance between each pixel on the crack center line and the crack edge in the edge detection processing result in the normal direction is obtained, which is the normal width value of the pixel. Finally, all normal width values ​​of all pixels on the crack center line are counted, and the maximum value is taken as the maximum pixel width of the crack in the crack image.

[0209] (3-3) Perform pixel statistics on the segmentation result in the form of a binary image corresponding to the crack image obtained in step (1) to obtain the pixel area of ​​the crack in the crack image;

[0210] Specifically, this step involves using the sum function from Python's numpy library to perform pixel statistics on the segmentation result in the form of a binary image corresponding to the crack image obtained in step (1), in order to obtain the pixel area of ​​the crack in the crack image.

[0211] (3-4) Input the shooting distance D between the image acquisition device and the mural obtained in step (1) and the shooting mode R used by the image acquisition device when acquiring the crack image into the pixel-actual length mapping function corresponding to the shooting mode obtained in step (2-5) to obtain the corresponding mapping ratio. Multiply the pixel length of the crack obtained in step (3-1), the pixel width of the crack obtained in step (3-2), and the pixel area of ​​the crack obtained in step (3-3) by the mapping ratio in the shooting mode to obtain the actual length, actual width, and actual area of ​​the crack in the mural crack image obtained in step (1) under the shooting mode. Test results

[0212] The training model of this invention is written in Python and runs on a GPU server based on the Ubuntu system. The parameters of the experimental environment are shown in Table 1, and the experimental parameter settings are shown in Table 2.

[0213] To comprehensively evaluate the performance of this invention, a multi-dimensional evaluation metric was adopted. Five evaluation metrics were introduced: pixel accuracy (Accuracy, Accuracy, Recall, Dice coefficient, and Mean Intersection over Union (mIoU).

[0214] Table 1 Experimental Environment Configuration

[0215]

[0216] Table 2 Experimental Parameter Settings

[0217]

[0218]

[0219] Test Example 1

[0220] To verify the performance advantages of the method of this invention in the task of mural crack segmentation, a systematic comparison of its segmentation performance with nine representative segmentation algorithms in the field, including UNet, DeepLabv3+, and SegFormer, was conducted on the self-built mural crack dataset MuralCrack and the public road crack dataset Crack500. The experimental results are shown in Table 3. In the experimental design, a unified hardware platform, hyperparameter configuration, and data preprocessing workflow were adopted.

[0221] Table 3 compares the experimental results (%) of the MCS model with other models on the MuralCrack and Crack500 datasets.

[0222]

[0223] According to the experimental results in Table 3, the MCS model of this invention achieved 94.98% and 96.41% accuracy, 91.76% and 92.73% Dice coefficient, and 86.97% and 89.75% mIoU on the MuralCrack and Crack500 road crack datasets, respectively, all of which are optimal. On the MuralCrack mural crack dataset, the mural crack segmentation model improved Dice by 15.18% and mIoU by 14.33% compared to HRNet, which maintains high-resolution features throughout and is suitable for fine-structure cracks. It also improved Dice by 12.31% and mIoU by 13.29% compared to SegFormer, which uses a hierarchical Transformer architecture as the encoder and a lightweight full MLP for multi-level feature fusion as the decoder. On the Crack500 road crack dataset, the MCS model improved Dice by 12.58% and mIoU by 11.92% compared to HRNet, and improved Dice by 13.49% and mIoU by 12.93% compared to SegFormer.

[0224] The crack prediction results of some images on the MuralCrack test dataset and the Crack500 test dataset using different methods are presented to further verify the reliable performance of the method of the present invention in the task of mural crack segmentation.

[0225] like Figure 4 As shown, compared with other segmentation models, the MCS model can effectively identify cracks and background color patterns, and it can also identify finer cracks well.

[0226] In summary, the method of this invention significantly improves several key indicators, including pixel accuracy, precision, recall, Dice coefficient, and mean intersection-over-union ratio, in mural crack segmentation tasks, providing a superior solution for the practical application of mural crack segmentation.

[0227] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for obtaining crack parameters in murals, characterized in that, Includes the following steps: (1) Use an image acquisition device to acquire images of cracks on the mural, preprocess the crack images, input the preprocessed crack images into a pre-trained mural crack segmentation MCS model for image segmentation, so as to obtain the segmentation result in the form of a binary image corresponding to the crack images, and obtain the shooting distance D between the image acquisition device and the mural and the shooting mode R used by the image acquisition device when acquiring the crack images. (2) Generate a calibration board. Use an image acquisition device to take pictures of the calibration board in various shooting modes and at various shooting distances to obtain a calibration board image set composed of multiple calibration board images in each shooting mode. Digitize each calibration board image in the calibration board image set to obtain the digitized calibration board image and the average pixel length of the three baselines in it. Obtain the ratio between the average actual length of the three baselines and the average pixel length as the ratio corresponding to the calibration board image. Perform linear regression analysis based on the ratios corresponding to all calibration board images to obtain the pixel-actual length mapping function corresponding to each shooting mode. (3) The segmentation result in the form of binary image obtained in step (1) is digitally processed to obtain the pixel length, pixel width and pixel area of ​​the mural crack after digital processing, and the actual geometric parameters of the crack image obtained in step (1) are obtained according to the pixel length, pixel width, pixel area and the pixel-actual length mapping function corresponding to each shooting mode obtained in step (2).

2. The method for obtaining mural crack parameters according to claim 1, characterized in that, The image acquisition device used in step (1) is a mobile phone or a digital camera; The preprocessing process in step (1) is as follows: First, the irrelevant background in the crack image is removed, and the crack image after removing the irrelevant background is saved as a square crack image as the preprocessed crack image; then, the preprocessed crack image is input into the pre-trained mural crack segmentation model to obtain the segmentation result in the form of a binary image.

3. The method for obtaining mural crack parameters according to claim 1 or 2, characterized in that, The mural crack segmentation model consists of 13 layers, and its specific structure is as follows: The first layer is the image preprocessing layer. Its input is an image with dimensions H×W×C, where H represents the height of the image, W represents the width of the image, and C represents the number of channels of the image. This image preprocessing layer first uses bilinear interpolation to scale the length and width of the image to 1024 pixels. Then, it normalizes the scaled image and finally outputs a feature map with dimensions of 1024×1024×3. The second layer is a convolutional layer. Its input is the feature map output by the first layer. This convolutional layer performs a convolution operation on the feature map and finally outputs a feature map with a dimension of 64×64×768. The third layer is the Vision Transformer (ViT) network, which consists of N ViT blocks connected in series, where N is a natural number greater than 1, preferably 24. For each ViT block, its specific structure is as follows: Layer 3.1 is a normalization layer. Its input is the feature map output by layer 2. This normalization layer normalizes the feature map and outputs a feature map with dimensions of 64×64×768. Layer 3.2 is a multi-head attention layer, whose input is the feature map output by layer 3.

1. This multi-head attention layer inputs the feature map into the multi-head attention module to output a feature map with a dimension of 64×64×768. Layer 3.3 is the Adapter layer, which takes the feature map output from layer 3.2 as its input. This Adapter layer inputs the feature map into the Adapter module to output a feature map with dimensions of 64×64×768. Layer 3.4 is a residual connection layer. Its input is the feature maps output from layers 2 and 3.

3. This residual connection layer performs a residual connection between the two feature maps to output a feature map with a dimension of 64×64×768. Layer 3.5 is a normalization layer. Its input is the feature map output from layer 3.

4. This normalization layer normalizes the feature map and outputs a feature map with dimensions of 64×64×768. Layer 3.6 is a multilayer perceptron layer. The input is the feature map output from layer 3.

5. This multilayer perceptron layer inputs the feature map into the multilayer perceptron module and outputs a feature map with a dimension of 64×64×768. Layer 3.7 is the Adapter layer, which takes the feature map output from layer 3.4 as its input. This Adapter layer inputs the feature map into the Adapter module and outputs a feature map with dimensions of 64×64×768. Layer 3.8 is a scaling layer. Its input is the feature map output from layer 3.

7. This scaling layer multiplies the feature map by a scaling factor of 0.5 to scale it, and outputs a feature map with dimensions of 64×64×768. Layer 3.9 is a residual connection layer, which takes the feature maps output from layers 3.6 and 3.8 as input. This residual connection layer performs a residual connection between the two feature maps to output a feature map with a dimension of 64×64×768. The fourth layer is a convolutional layer. The input is the feature map output from the third and ninth layers. This convolutional layer performs a convolution operation on the feature map and finally outputs a feature map with dimensions of 64×64×256. The fifth layer is a normalization layer. Its input is the feature map output by the fourth layer. This normalization layer normalizes the feature map and finally outputs a feature map with a dimension of 64×64×256. The 6th layer is a convolutional layer. Its input is the feature map output by the 5th layer. This convolutional layer performs a convolution operation on the feature map and finally outputs a feature map with a dimension of 64×64×256. The 7th layer is a normalization layer. Its input is the feature map output from the 6th layer. This normalization layer normalizes the feature map and finally outputs a feature map with a dimension of 64×64×256. The 8th layer is the feature enhancement layer. Its input is the feature map output from the 7th layer. This feature enhancement layer first increases the channel dimension of the feature map to 1024 through a convolutional layer, then inputs the feature map with increased dimension into another convolutional layer, and finally inputs the feature map obtained by convolution into the ReLU activation function, and finally outputs a feature map with a dimension of 64×64×1024. The 9th layer is a channel compression layer. Its input is the feature map output by the 8th layer. This channel compression layer first extracts the local context features of the feature map through a convolutional layer, and then reduces the channel dimension of the feature map after feature extraction from 1024 to 512 through another convolutional layer. Finally, a global attention module processes the dimensionality-reduced feature map, and the final output is a feature map with a dimension of 64×64×512. The 10th layer is a channel compression layer. Its input is the feature map output from the 9th layer. This channel compression layer first extracts the local context features of the feature map through a convolutional layer, and then reduces the channel dimension of the feature map after feature extraction from 512 to 256 through another convolutional layer. Finally, a global attention module processes the dimensionality-reduced feature map, and the final output is a feature map with a dimension of 64×64×256. The 11th layer is an upsampling layer, whose input is the feature map output from the 10th layer. This upsampling layer first extracts local context features of the feature map through two identical convolutional layers, and then upsamples the feature map after feature extraction through a transposed convolutional layer to restore the feature map size to 128×128. At the same time, it reduces the channel dimension of the feature map from 256 to 128. Finally, a global attention module processes the dimensionality-reduced feature map, and the final output is a feature map with a dimension of 128×128×128. The 12th layer is an upsampling layer, whose input is the feature map output from the 11th layer. This upsampling layer first extracts the local context features of the feature map through two identical convolutional layers, and then upsamples the feature map after feature extraction through a transposed convolutional layer to restore the feature map size to 256×256. At the same time, it reduces the channel dimension of the feature map from 128 to 64. Finally, a global attention module processes the dimensionality-reduced feature map, and the final output is a feature map with a dimension of 256×256×64. The 13th layer is the output convolutional layer, whose input is the feature map output by the 12th layer. This output convolutional layer first performs spatial refinement convolution on the local space of the feature map, and then performs prediction convolution on the convolutional feature map. Finally, the output is a feature map with a dimension of 256×256×2, which is the segmentation result in the form of a binary map.

4. The method for obtaining mural crack parameters according to any one of claims 1 to 3, characterized in that, The mural crack segmentation model was obtained through the following steps: (1-1) Obtain multiple mural crack images and crop each mural crack image in the original image set into a sub-image of size 256×256 pixels. All sub-images constitute the original image set. (1-2) Use LabelMe image annotation tool to annotate each mural crack image in the original image set obtained in step (1-1), and convert each annotated mural crack image into a binary image with a dimension of 256×256×2. All mural crack images constitute the crack original image part in the dataset, and the binary images corresponding to all mural crack images constitute the mask image part in the dataset. (1-3) Divide the dataset obtained in step (1-2) into a training set and a test set in a 7:3 ratio; (1-4) For each sample in the original image part of the crack in the training set obtained in step (1-3), the sample is input into the first layer of the mural crack segmentation model for processing to obtain the feature map with a dimension of 1024×1024×3 corresponding to the sample. (1-5) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 1024×1024×3 corresponding to the sample obtained in step (1-4) is input into the second layer of the mural crack segmentation model to obtain the feature map with a dimension of 64×64×768 corresponding to the sample. (1-6) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-5) is input into the 3.1 layer of the mural crack segmentation model for normalization processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample. (1-7) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-6) is input into the 3.2 layer of the mural crack segmentation model for processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample. (1-8) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-7) is input into the 3.3 layer of the mural crack segmentation model for processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample. (1-9) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-8) is input into the 3rd and 4th layers of the mural crack segmentation model for residual connection processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample. (1-10) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-9) is input into the 3.5 layer of the mural crack segmentation model for normalization processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample. (1-11) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-10) is input into the 3.6 layer of the mural crack segmentation model for processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample. (1-12) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-11) is input into the 3.7 layer of the mural crack segmentation model for processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample. (1-13) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-12) is input into the 3.8 layer of the mural crack segmentation model for scaling processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample. (1-14) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-13) is input into the 3.9 layer of the mural crack segmentation model for residual connection processing to obtain the feature map with a dimension of 64×64×768 corresponding to the sample. (1-15) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×768 corresponding to the sample obtained in step (1-14) is input into the 4th layer of the mural crack segmentation model for upsampling operation to obtain the feature map with a dimension of 64×64×256 corresponding to the sample. (1-16) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×256 corresponding to the sample obtained in step (1-15) is input into the 5th layer of the mural crack segmentation model for normalization processing to obtain the feature map with a dimension of 64×64×256 corresponding to the sample. (1-17) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×256 corresponding to the sample obtained in step (1-16) is input into the 6th layer of the mural crack segmentation model for convolution processing to obtain the feature map with a dimension of 64×64×256 corresponding to the sample. (1-18) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×256 corresponding to the sample obtained in step (1-17) is input into the 7th layer of the mural crack segmentation model for normalization processing to obtain the feature map with a dimension of 64×64×256 corresponding to the sample. (1-19) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×256 corresponding to the sample obtained in step (1-18) is input into the 8th layer of the mural crack segmentation model for feature enhancement processing to obtain the feature map with a dimension of 64×64×1024 corresponding to the sample. (1-20) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×1024 corresponding to the sample obtained in step (1-19) is input into the 9th layer of the mural crack segmentation model for channel compression processing to obtain the feature map with a dimension of 64×64×512 corresponding to the sample. (1-21) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×512 corresponding to the sample obtained in step (1-20) is input into the 10th layer of the mural crack segmentation model for channel compression processing to obtain the feature map with a dimension of 64×64×256 corresponding to the sample. (1-22) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 64×64×256 corresponding to the sample obtained in step (1-21) is input into the 11th layer of the mural crack segmentation model for upsampling to obtain the feature map with a dimension of 128×128×128 corresponding to the sample. (1-23) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 128×128×128 corresponding to the sample obtained in step (1-22) is input into the 12th layer of the mural crack segmentation model for upsampling to obtain the feature map with a dimension of 256×256×64 corresponding to the sample. (1-24) For each sample in the original image part of the crack in the training set obtained in step (1-3), the feature map with a dimension of 256×256×64 corresponding to the sample obtained in step (1-23) is input into the 13th layer of the mural crack segmentation model for output convolution processing to obtain the feature map with a dimension of 256×256×2 corresponding to the sample. (1-25) Calculate the loss function based on the feature map corresponding to each sample in the original image part of the crack in the training set obtained in step (1-24), and use the loss function to iteratively train the mural crack segmentation model until the mural crack segmentation model converges, thereby obtaining the preliminarily trained mural crack segmentation model. (1-26) Use the test set obtained in step (1-3) to verify the mural crack segmentation model initially trained in step (1-25) until the classification accuracy reaches the optimal level, thereby obtaining the trained mural crack segmentation model.

5. The method for obtaining mural crack parameters according to claim 4, characterized in that, The loss function used in step (1-25) is: Loss=L D ice+L BCE L D ice is the Dice loss function, and its calculation formula is as follows: Where M represents the number of pixels in each sample in the original crack image part of the training set, pi represents the prediction result of the i-th pixel of each sample in the original crack image part of the training set after passing through the model, where 1 represents the foreground and 0 represents the background, gi represents the true label of the i-th pixel of each sample in the mask image part of the training set, where 1 represents the foreground and 0 represents the background, ε represents the smoothing term, whose value range is from 1e-10 to 1e-6, i∈[1,M]; L BCE The cross-entropy loss function (BCE) for binary classification is calculated as follows:

6. The method for obtaining mural crack parameters according to claim 1, characterized in that, Step (2) includes the following steps: (2-1) Generate a calibration plate with three reference lines, each with a length of 100 mm and distributed at an orthogonal 45° angle to each other; (2-2) Position the image acquisition device used in step (1) in front of the calibration plate generated in step (2-1) using an adjustable bracket, and adjust the image acquisition device so that its main optical axis is perpendicular to the surface of the calibration plate. (2-3) The image acquisition device takes pictures of the calibration board generated in step (2-1) in multiple shooting modes and multiple shooting distances, and obtains a calibration board image set Aj = (aj1, ..., ajQ) composed of multiple calibration board images in each shooting mode, where Ajk represents the calibration board image obtained by shooting in the j-th shooting mode at the k-th distance, j∈[1, P], k∈[1, Q], P represents the number of shooting modes, and Q represents the number of shooting distances; (2-4) For the calibration board image set Aj composed of multiple calibration board images under each shooting mode obtained in step (2-3), each calibration board image in the calibration board image set Aj is digitized to obtain the digitized calibration board image and the average pixel length of the three baselines therein, and the ratio of the average actual length of the three baselines to the average pixel length is obtained as the ratio corresponding to the calibration board image. (2-5) For the calibration plate image set Aj obtained in step (2-3) under each shooting mode, perform linear regression analysis based on the shooting distance of all calibration plate images in the calibration plate image set and the ratio of all calibration plate images obtained in step (2-4) to obtain the pixel-actual length mapping function δj=Bj×Dj+Cj corresponding to the shooting mode, where Bj is the regression coefficient of the j-th shooting mode, Dj is the actual shooting distance when obtaining the mural crack image with the j-th shooting mode, and Cj is the intercept term of the j-th shooting mode.

7. The method for obtaining mural crack parameters according to claim 6, characterized in that, In steps (2-3), P=4, which means 4 shooting modes: standard mode with normal pixels, wide-angle mode with normal pixels, standard mode with high resolution pixels, and wide-angle mode with high resolution pixels. In steps (2-3), Q = 6, which means 6 shooting distances: 500mm, 800mm, 1000mm, 1200mm, 1500mm, and 2000mm; The process of obtaining the ratio between the average actual length and the average pixel length of the three baselines in step (2-4) as the ratio corresponding to the calibration board image is as follows: First, the calibration board image is cropped to obtain an effective calibration area image; then, the effective calibration area image is binarized to obtain the feature images of the three baselines after binarization; subsequently, the feature images of the three baselines after binarization are skeletonized to obtain the skeleton images of the three baselines with a width of one pixel; next, the skeleton images of the three baselines with a width of one pixel are contour extracted to obtain the skeleton contours of the three baselines. Subsequently, the number of all pixels in the skeleton contours of the three baselines is summed and averaged to obtain the average pixel length of each baseline. Finally, the average actual length of each baseline is divided by the average pixel length to obtain the ratio of the two, which is used as the ratio corresponding to the calibration board image. The image cropping process in steps (2-4) is performed using common image processing software. The binarization, skeletonization, contour extraction, and pixel summation are respectively completed using the threshold, ximgproc.thinning, findContours, and arcLength functions from the cv library in Python.

8. The method for obtaining mural crack parameters according to claim 7, characterized in that, Steps (2-5) involve using the `linregress` function from Python's `scipy` library to fit the average pixel length of the calibration board image captured at each shooting distance under each shooting mode, in order to obtain the pixel-to-actual length mapping function for that shooting mode. Specifically: δns=Bns×Dns+Cns δnw=Bnw×Dnw+Cnw δhs=Bhs×Dhs+Chs δhw=Bhw×Dhw+Chw Where δns, δnw, δhs, and δhw represent the pixel-to-actual length mapping functions for the standard pixel mode, the wide-angle pixel mode, the high-resolution pixel mode, and the wide-angle pixel mode, respectively; Bns, Bnw, Bhs, and Bhw represent the regression coefficients for the standard pixel mode, the wide-angle pixel mode, the high-resolution pixel mode, and the wide-angle pixel mode, respectively; Dns, Dnw, Dhs, and Dhw represent the actual shooting distances when acquiring images of mural cracks using the standard pixel mode, the wide-angle pixel mode, the high-resolution pixel mode, and the wide-angle pixel mode, respectively; and Cns, Cnw, Chs, and Chw represent the intercept terms for the standard pixel mode, the wide-angle pixel mode, the high-resolution pixel mode, and the wide-angle pixel mode, respectively.

9. The method for obtaining mural crack parameters according to claim 8, characterized in that, Step (3) includes the following steps: (3-1) The segmentation result in the form of binary image obtained in step (1) is skeletonized to obtain its crack center line. The crack center line is then subjected to contour extraction to obtain the contour of the crack skeleton. The number of all pixels in the contour of the crack skeleton is then used as the pixel length of the crack in the crack image obtained in step (1). Specifically, this step involves first using the ximgproc.thinning function from the cv library in Python to perform skeletonization on the segmentation result in the form of the binary image obtained in step (1) to extract the center line of the crack as the skeletonization result. Then, the findContours function from the cv library is used to perform contour extraction on the center line of the crack to obtain the contour of the crack skeleton. Finally, the arcLength function from the cv library is used to obtain the number of all pixels in the contour of the crack skeleton as the pixel length of the crack in the crack image obtained in step (1). (3-2) The Canny operator in Python's cv library is used to perform edge detection processing on the segmentation result in the form of a binary image corresponding to the crack image obtained in step (1) to extract the edge of the crack in the crack image as the edge detection result. Based on the edge detection processing result and the crack center line obtained in step (3-1), the distance between each pixel on the crack center line and the crack edge in the edge detection processing result in the normal direction is obtained, which is the normal width value of the pixel. Finally, all normal width values ​​of all pixels on the crack center line are counted, and the maximum value is taken as the maximum pixel width of the crack in the crack image. (3-3) Perform pixel statistics on the segmentation result in the form of a binary image corresponding to the crack image obtained in step (1) to obtain the pixel area of ​​the crack in the crack image; Specifically, this step involves using the sum function from Python's numpy library to perform pixel statistics on the segmentation result in the form of a binary image corresponding to the crack image obtained in step (1), so as to obtain the pixel area of ​​the crack in the crack image. (3-4) Input the shooting distance D between the image acquisition device and the mural obtained in step (1) and the shooting mode R used by the image acquisition device when acquiring the crack image into the pixel-actual length mapping function corresponding to the shooting mode obtained in step (2-5) to obtain the corresponding mapping ratio. Then multiply the pixel length of the crack obtained in step (3-1), the pixel width of the crack obtained in step (3-2), and the pixel area of ​​the crack obtained in step (3-3) by the mapping ratio in the shooting mode to obtain the actual length, actual width, and actual area of ​​the crack in the mural crack image obtained in step (1) under the shooting mode.

10. A system for obtaining crack parameters of murals, characterized in that, include: The first module is used to acquire images of cracks on the mural using an image acquisition device, preprocess the crack images, input the preprocessed crack images into a pre-trained mural crack segmentation MCS model for image segmentation, so as to obtain the segmentation result in the form of a binary image corresponding to the crack images, and obtain the shooting distance D between the image acquisition device and the mural and the shooting mode R used by the image acquisition device when acquiring the crack images. The second module is used to generate a calibration board. It uses an image acquisition device to capture images of the calibration board in various shooting modes and at various shooting distances to obtain a calibration board image set consisting of multiple calibration board images in each shooting mode. Each calibration board image in the calibration board image set is digitized to obtain the digitized calibration board image and the average pixel length of the three baselines in it. The ratio between the average actual length of the three baselines and the average pixel length is obtained as the ratio corresponding to the calibration board image. Linear regression analysis is performed based on the ratios corresponding to all calibration board images to obtain the pixel-actual length mapping function corresponding to each shooting mode. The third module is used to digitize the segmentation results in the form of binary images obtained by the first module, so as to obtain the pixel length, pixel width and pixel area of ​​the mural cracks after digitization, and to obtain the actual geometric parameters of the crack image obtained by the first module according to the pixel length, pixel width, pixel area and the pixel-actual length mapping function corresponding to each shooting mode obtained by the second module.

Citation Information

Patent Citations

  • Method for accurately calculating actual width of single pixel in crack image

    CN112200824A

  • Asphalt pavement crack image segmentation method based on deep convolutional neural network

    CN112634292A

  • CT coal rock fracture image segmentation method based on MCSN network model

    CN117934500A

  • Crack image segmentation method based on ECA-AC-ResUnet network

    CN120047452A

  • Medical image segmentation method based on u-net

    US20220309674A1