A method and system for obtaining mural crack parameters

By combining image acquisition equipment and pre-trained models with calibration plate mapping functions, the problems of human dependence, recognition errors, and insufficient dynamic quantization in obtaining mural crack parameters were solved, achieving efficient and accurate acquisition of mural crack parameters.

CN120953348BActive Publication Date: 2026-04-10SOUTH CENTRAL UNIVERSITY FOR NATIONALITIES
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-16
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing technologies for obtaining parameters of mural cracks rely on professional personnel, have low measurement efficiency, and may damage the murals. Traditional image processing methods have poor adaptability and are prone to false positives and false negatives. Deep learning methods have weak generalization ability and lack quantitative analysis of the dynamic development of cracks.

Method used

Image acquisition equipment was used to acquire images of the cracks. A pre-trained mural crack segmentation MCS model was used for segmentation. A pixel-to-actual length mapping function was generated using a calibration plate. The actual geometric parameters of the cracks were obtained through digital processing.

Benefits of technology

It enables efficient acquisition of mural crack parameters without the need for specialized equipment, improves recognition accuracy and processing efficiency, solves the problem of complex background recognition, and enhances the ability to quantify the dynamic development of mural cracks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120953348B_ABST
    Figure CN120953348B_ABST
Patent Text Reader

Abstract

The application discloses a method for obtaining mural crack parameters, which uses an image acquisition device to obtain a mural crack image, inputs the mural crack image into a mural crack segmentation model pre-trained, obtains a segmentation result in the form of a binary graph corresponding to the mural crack image, and obtains a shooting distance and a shooting mode between the image acquisition device and the mural; a set of calibration plate images is obtained, and all images in the set are digitally processed to obtain the pixel length of a reference line in the image, and the ratio of the actual length of the reference line in the image to the pixel length is obtained as the ratio of the calibration plate image, and the shooting distance used when obtaining the image of each photography mode is linearly regressed with the ratio of the calibration plate image to construct a pixel-actual length mapping relationship function. The application can solve the technical problems that the existing manual measurement method has low measurement efficiency and causes secondary damage to the mural.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of digital protection of murals and deep learning, more specifically, relates to a method and system for obtaining mural crack parameters. BACKGROUND

[0002] As the precious treasure of the long history and rich cultural heritage of the Chinese nation, the protection and restoration of murals has always been the focus of social attention. However, these precious murals are extremely prone to crack, hollowing, and other disease phenomena due to long-term exposure to the natural environment and human activities. Cracks are one of the most common and high-risk disease types. Accurate identification, segmentation, and obtaining of specific parameters of the crack area are crucial for developing effective mural protection and restoration strategies. However, due to the complex and varied background colors of murals and the vast differences in disease morphology, combined with the scarcity of labeled data, traditional image segmentation techniques face unprecedented challenges, and long-term monitoring of mural diseases is also difficult.

[0003] Currently, there are three main methods for obtaining mural crack parameters: the first is manual measurement, which uses tools to record crack width, length, and other parameters on site by professional personnel; the second is a traditional image processing-based method to detect mural diseases, such as extracting disease features through HSV color space conversion and threshold segmentation, and then using edge detection and morphological operations to label the crack area; the third is a deep learning-based semantic segmentation method to detect mural diseases, such as using an improved U-Net network to segment diseases and combining edge detection to extract the outline of mural diseases.

[0004] However, the above three methods have some non-negligible defects:

[0005] First, manual measurement relies on professional manpower, has low measurement efficiency, and is difficult to meet the needs of large-scale mural protection work. In addition, the contact operation may cause secondary damage to the mural;

[0006] Second, the traditional image processing-based method has poor adaptability to complex backgrounds and insufficient parameter extraction stability, which may lead to missed or false detection;

[0007] Third, the deep learning-based semantic segmentation method is effective in some scenarios, but this method often relies on a large amount of labeled data, and is limited by the scarcity of mural data and the diversity of crack morphology. The general deep learning network has weak generalization ability when used to segment mural cracks;

[0008] Fourth, the above three methods focus on mural disease labeling work and lack the ability to quantitatively analyze the dynamic development of mural cracks. SUMMARY

[0009] In view of the above defects or improvement needs of the prior art, the present application provides a method and system for obtaining mural crack parameters. The purpose is to solve the technical problems of the existing manual measurement method which relies on professional manpower, has low measurement efficiency and may cause secondary damage to the mural; the technical problems of the existing method based on traditional image processing which has poor adaptability to complex background, insufficient parameter extraction stability and is prone to missed detection or false detection; the technical problem of the existing semantic segmentation method based on deep learning which has weak generalization ability of the general deep learning network when solving the problem of data scarcity and various forms of mural cracks; and the technical problem that the above three methods all lack the quantitative ability of the dynamic development of mural cracks.

[0010] To achieve the above-mentioned purpose, according to one aspect of the present application, a method for obtaining mural crack parameters is provided, comprising the following steps:

[0011] (1) using an image acquisition device to obtain a crack image on a mural, pre-processing the crack image, inputting the pre-processed crack image into a pre-trained mural crack segmentation MCS model for image segmentation processing to obtain a segmentation result in the form of a binary image corresponding to the crack image, and obtaining a shooting distance D between the image acquisition device and the mural and a shooting mode R used by the image acquisition device when obtaining the crack image;

[0012] (2) generating a calibration plate, using the image acquisition device to shoot the calibration plate in multiple shooting modes and multiple shooting distances to obtain a calibration plate image set composed of multiple calibration plate images in each shooting mode, digitally processing each calibration plate image in the calibration plate image set to obtain a digitally processed calibration plate image and the average pixel length of three reference lines therein, obtaining the ratio of the average actual length of the three reference lines to the average pixel length as the ratio corresponding to the calibration plate image, and performing linear regression analysis according to the ratios corresponding to all calibration plate images to obtain a pixel-actual length mapping function corresponding to each shooting mode;

[0013] (3) digitally processing the segmentation result in the form of a binary image obtained in step (1) to obtain the pixel length, pixel width and pixel area of the digitally processed mural crack, and obtaining the actual geometric parameters of the crack image obtained in step (1) 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 pre-processing process in step (1) is specifically as follows: first, irrelevant background in the crack image is deleted, and the crack image after deletion of the irrelevant background is saved as a square crack image as a pre-processed crack image; then, the pre-processed crack image is input into the pre-trained mural crack segmentation model to obtain a segmentation result in the form of a binary image.

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

[0017] The first layer is an image pre-processing layer, and the input is an image with a dimension of HxWxC, wherein H represents the height of the image, W represents the width of the image, and C is the channel number of the image. The image pre-processing layer first uses a bilinear interpolation method to scale the length and width of the image to 1024 pixels, and then performs normalization processing on the scaled image, and finally outputs a feature map with a dimension of 1024x1024x3;

[0018] The second layer is a convolution layer, and the input is the feature map output by the first layer. The convolution layer performs convolution operation on the feature map, and finally outputs a feature map with a dimension of 64x64x768;

[0019] The third layer is a visual transformer ViT network, which comprises N serially connected ViT blocks, wherein N is a natural number greater than 1, and is preferably 24;

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

[0021] The third layer is a normalization layer, and the input is the feature map output by the second layer. The normalization layer performs normalization processing on the feature map to output a feature map with a dimension of 64x64x768;

[0022] The third layer is a multi-head attention layer, and the input is the feature map output by the third layer. The multi-head attention layer inputs the feature map into a multi-head attention module to output a feature map with a dimension of 64x64x768;

[0023] The third layer is an Adapter adapter layer, and the input is the feature map output by the third layer. The Adapter adapter layer inputs the feature map into an Adapter adapter module to output a feature map with a dimension of 64x64x768;

[0024] The third layer is a residual connection layer, and the input is the feature map output by the second layer and the third layer. The residual connection layer performs residual connection on the two feature maps to output a feature map with a dimension of 64x64x768;

[0025] The 3.5th layer is a normalization layer, which inputs the feature map output by the 3.4th layer, and performs normalization processing on the feature map to output a feature map with a dimension of 64x64x768;

[0026] The 3.6th layer is a multi-layer perception layer, which inputs the feature map output by the 3.5th layer, and inputs the feature map into a multi-layer perception module to output a feature map with a dimension of 64x64x768;

[0027] The 3.7th layer is an Adapter adapter layer, which inputs the feature map output by the 3.4th layer, and inputs the feature map into an Adapter adapter module to output a feature map with a dimension of 64x64x768;

[0028] The 3.8th layer is a scaling layer, which inputs the feature map output by the 3.7th layer, and scales the feature map by a scaling factor of 0.5 to output a feature map with a dimension of 64x64x768;

[0029] The 3.9th layer is a residual connection layer, which inputs the feature maps output by the 3.6th layer and the 3.8th layer, and performs residual connection on the two feature maps to output a feature map with a dimension of 64x64x768;

[0030] The 4th layer is a convolution layer, which inputs the feature map output by the 3.9th layer, and performs convolution operation on the feature map to finally output a feature map with a dimension of 64x64x256;

[0031] The 5th layer is a normalization layer, which inputs the feature map output by the 4th layer, and performs normalization processing on the feature map to finally output a feature map with a dimension of 64x64x256;

[0032] The 6th layer is a convolution layer, which inputs the feature map output by the 5th layer, and performs convolution operation on the feature map to finally output a feature map with a dimension of 64x64x256;

[0033] The 7th layer is a normalization layer, which inputs the feature map output by the 6th layer, and performs normalization processing on the feature map to finally output a feature map with a dimension of 64x64x256;

[0034] The 8th layer is a feature enhancement layer, which inputs the feature map output by the 7th layer, and first increases the channel dimension of the feature map to 1024 through a convolution layer, then inputs the feature map with the increased dimension into another convolution layer, and finally inputs the feature map obtained by convolution into a ReLU activation function, to finally output a feature map with a dimension of 64x64x1024;

[0035] The 9th layer is a channel compression layer, the input of which is the feature map output by the 8th layer. The channel compression layer first extracts the local context features of the feature map through a convolution layer, then reduces the channel dimension of the feature map after feature extraction from 1024 to 512 through a convolution layer, and finally processes the reduced feature map through a global attention module, and finally outputs a feature map with a dimension of 64x64x512;

[0036] The 10th layer is a channel compression layer, the input of which is the feature map output by the 9th layer. The channel compression layer first extracts the local context features of the feature map through a convolution layer, then reduces the channel dimension of the feature map after feature extraction from 512 to 256 through a convolution layer, and finally processes the reduced feature map through a global attention module, and finally outputs a feature map with a dimension of 64x64x256;

[0037] The 11th layer is an up-sampling layer, the input of which is the feature map output by the 10th layer. The up-sampling layer first extracts the local context features of the feature map through two identical convolution layers, then up-samples the feature map after feature extraction through a transposed convolution layer to restore the feature map size to 128x128, while reducing the channel dimension of the feature map from 256 to 128, and finally processing the reduced feature map through a global attention module, and finally outputting a feature map with a dimension of 128x128x128;

[0038] The 12th layer is an up-sampling layer, the input of which is the feature map output by the 11th layer. The up-sampling layer first extracts the local context features of the feature map through two identical convolution layers, then up-samples the feature map after feature extraction through a transposed convolution layer to restore the feature map size to 256x256, while reducing the channel dimension of the feature map from 128 to 64, and finally processing the reduced feature map through a global attention module, and finally outputting a feature map with a dimension of 256x256x64;

[0039] The 13th layer is an output convolution layer, the input of which is the feature map output by the 12th layer. The output convolution layer first performs convolution processing on the local space in the feature map through a spatial refinement convolution, then performs prediction convolution processing on the convolution-processed feature map, and finally outputs a feature map with a dimension of 256x256x2, which is a binary graph form of segmentation result.

[0040] Preferably, the mural crack segmentation model is trained by the following steps:

[0041] (1-1) Obtain a plurality of mural crack image groups, and cut each mural crack image in the original image set into a sub-image with a size of 256x256 pixels, and all sub-images constitute an original image set;

[0042] (1-2) Using the LabelMe image labeling tool, label each mural crack image in the original image set obtained in step (1-1), and convert each labeled mural crack image into a binary image with dimensions of 256x256x2. All mural crack images constitute the crack original image part of the data set, and all corresponding binary images constitute the mask image part of the data set;

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

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

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

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

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

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

[0049] (1-9) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample obtained in step (1-8) is input into the residual connection processing of the 3.4 layer of the mural crack segmentation model to obtain a feature map corresponding to the sample, and the dimension is 64*64*768;

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

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

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

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

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

[0055] (1-15) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample obtained in step (1-14) and having a dimension of 64x64x768 is input into the up-sampling operation of the 4th layer of the mural crack segmentation model to obtain a feature map corresponding to the sample and having a dimension of 64x64x256;

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

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

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

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

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

[0061] (1-21) For each sample in the training set of crack original images obtained in step (1-3), the feature map corresponding to the sample obtained in step (1-20) and having a dimension of 64x64x512 is input into the 10th layer of the mural crack segmentation model to perform channel compression processing, so as to obtain a feature map corresponding to the sample and having a dimension of 64x64x256;

[0062] (1-22) For each sample in the training set of crack original images obtained in step (1-3), the feature map corresponding to the sample obtained in step (1-21) and having a dimension of 64x64x256 is input into the 11th layer of the mural crack segmentation model to perform up-sampling processing, so as to obtain a feature map corresponding to the sample and having a dimension of 128x128x128;

[0063] (1-23) For each sample in the training set of crack original images obtained in step (1-3), the feature map corresponding to the sample obtained in step (1-22) and having a dimension of 128x128x128 is input into the 12th layer of the mural crack segmentation model to perform up-sampling processing, so as to obtain a feature map corresponding to the sample and having a dimension of 256x256x64;

[0064] (1-24) For each sample in the training set of crack original images obtained in step (1-3), the feature map corresponding to the sample obtained in step (1-23) and having a dimension of 256x256x64 is input into the 13th layer of the mural crack segmentation model to perform output convolution processing, so as to obtain a feature map corresponding to the sample and having a dimension of 256x256x2;

[0065] (1-25) A loss function is calculated according to the feature map corresponding to each sample in the training set of crack original images obtained in step (1-24), and the mural crack segmentation model is iteratively trained using the loss function until the mural crack segmentation model converges, so as to obtain a mural crack segmentation model that is preliminarily trained;

[0066] (1-26) The mural crack segmentation model preliminarily trained in step (1-25) is verified using the test set obtained in step (1-3) until the classification accuracy reaches the optimal value, so as to obtain a 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 is a Dice loss function, and its calculation formula is:

[0070]

[0071] wherein M represents the number of pixels of each sample in the part of the training set of the original image of the fissure, p i represents the prediction result of the i-th pixel of each sample in the part of the training set of the original image of the fissure after passing through the model, wherein 1 represents foreground and 0 represents background, g i represents the true label of the i-th pixel of each sample in the part of the training set of the mask image, wherein 1 represents foreground and 0 represents background, ε represents a smoothing term, the value range of which is 1e-10 to 1e-6, i∈[1,M];

[0072] L BCE is a binary cross-entropy loss function BCE, the calculation formula of which is:

[0073]

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

[0075] (2-1) generating a calibration plate with three reference lines, the lengths of the three reference lines are all 100 mm, and the three reference lines are distributed at a mutual orthogonal 45° angle;

[0076] (2-2) positioning the image acquisition device used in step (1) in front of the calibration plate generated in step (2-1) through an adjustable support, and adjusting the image acquisition device so that its main optical axis is perpendicular to the surface of the calibration plate;

[0077] (2-3) making the image acquisition device take pictures of the calibration plate generated in step (2-1) in multiple shooting modes and at multiple shooting distances, and obtaining a calibration plate image set Aj=(aj1,…,ajQ) composed of multiple calibration plate images in each shooting mode, wherein Ajk represents a calibration plate image taken at the k-th distance in the j-th shooting mode, j∈[1,P],k∈[1,Q],P represents the number of types of shooting modes, and Q represents the number of types of shooting distances;

[0078] (2-4) for each calibration plate image set Aj composed of multiple calibration plate images in each shooting mode obtained in step (2-3), performing digital processing on each calibration plate image in the calibration plate image set Aj to obtain a digital processing calibration plate image and the average pixel length of the three reference lines therein, and obtaining the ratio of the average actual length of the three reference lines to the average pixel length as the ratio corresponding to the calibration plate image;

[0079] (2-5) For each set of calibration plate images Aj obtained in step (2-3), linear regression analysis is performed on the shooting distances of all calibration plate images in the set and the ratios corresponding to 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 jth shooting mode, Dj is the actual shooting distance when the mural crack image is obtained in the jth shooting mode, and Cj is the intercept term of the jth shooting mode.

[0080] Preferably, P = 4 in step (2-3), i.e. 4 shooting modes: normal pixel standard mode, normal pixel wide-angle mode, high-definition pixel standard mode, and high-definition pixel wide-angle mode.

[0081] In step (2-3), Q = 6, i.e. 6 shooting distances: 500 mm, 800 mm, 1000 mm, 1200 mm, 1500 mm, and 2000 mm.

[0082] The process of obtaining the ratio of the average actual length and the average pixel length of the three reference lines in step (2-4) is as follows: first, the calibration plate image is cropped to obtain an effective calibration region image; then, the effective calibration region image is binarized to obtain the feature image of the three reference lines after binarization; thereafter, the skeletonization processing is performed on the feature image of the three reference lines after binarization to obtain the skeleton image of the three reference lines with a single-pixel width; then, the contour extraction processing is performed on the skeleton image of the three reference lines with a single-pixel width to obtain the skeleton contour of the three reference lines; subsequently, the number of all pixel points in the skeleton contour of the three reference lines is summed and averaged to obtain the average pixel length of each reference line; finally, the average actual length of each reference line is divided by the average pixel length to obtain the ratio as the ratio corresponding to the calibration plate image.

[0083] The image cropping processing in step (2-4) is performed using a general image processing software, and the binarization processing, skeletonization processing, contour extraction processing, and pixel point summation are respectively completed using the threshold function, ximgproc.thinning function, findContours function, and arcLength function in the cv library of Python.

[0084] Preferably, step (2-5) is performed by fitting each shooting distance and the average pixel length corresponding to the calibration plate image obtained in the shooting distance for each shooting mode using the linregress function in the scipy library of Python to obtain the pixel-actual length mapping function corresponding to the shooting mode, which is specifically as follows:

[0085] δns = Bns x Dns + Cns

[0086] δnw = Bnw x Dnw + Cnw

[0087] δhs = Bhs x Dhs + Chs

[0088] δhw = Bhw x Dhw + Chw

[0089] wherein δns, δnw, δhs, δhw represent the pixel-actual length mapping function corresponding to the normal pixel standard mode, the pixel-actual length mapping function corresponding to the normal pixel wide-angle mode, the pixel-actual length mapping function corresponding to the high-definition pixel standard mode, and the pixel-actual length mapping function corresponding to the high-definition pixel wide-angle mode respectively, Bns, Bnw, Bhs, Bhw represent the regression coefficient corresponding to the normal pixel standard mode, the regression coefficient corresponding to the normal pixel wide-angle mode, the regression coefficient corresponding to the high-definition pixel standard mode, and the regression coefficient corresponding to the high-definition pixel wide-angle mode respectively, Dns, Dnw, Dhs, Dhw represent the actual shooting distance when the mural crack image is acquired using the normal pixel standard mode, the actual shooting distance when the mural crack image is acquired using the normal pixel wide-angle mode, the actual shooting distance when the mural crack image is acquired using the high-definition pixel standard mode, and the actual shooting distance when the mural crack image is acquired using the high-definition pixel wide-angle mode respectively, Cns, Cnw, Chs, Chw represent the intercept term corresponding to the normal pixel standard mode, the intercept term corresponding to the normal pixel wide-angle mode, the intercept term corresponding to the high-definition pixel standard mode, and the intercept term corresponding to the high-definition pixel wide-angle mode respectively.

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

[0091] (3-1) performing skeletonization processing on the segmentation result in the form of a binary graph obtained in step (1) to obtain a crack center line thereof, performing contour extraction processing on the crack center line to obtain a contour of the crack skeleton, and obtaining the number of all pixel points in the contour of the crack skeleton as the pixel length of the crack in the crack image obtained in step (1);

[0092] Specifically, first, the ximgproc.thinning function in the cv library of Python is used to perform skeletonization processing on the segmentation result in the form of a binary graph obtained in step (1) to extract the crack center line thereof as a skeletonization result, then the findContours function in the cv library is used to perform contour extraction processing on the crack center line to obtain a contour of the crack skeleton, and finally the arcLength function in the cv library is used to obtain the number of all pixel points 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 configured to generate a calibration board, capture the calibration board in multiple shooting modes and multiple shooting distances by using an image acquisition device to obtain a calibration board image set composed of multiple calibration board images in each shooting mode, perform digital processing on each calibration board image in the calibration board image set to obtain a digital processed calibration board image and average pixel lengths of three reference lines in the digital processed calibration board image, obtain a ratio of the average actual lengths of the three reference lines to the average pixel lengths as a ratio corresponding to the calibration board image, and perform linear regression analysis according to the ratios corresponding to all calibration board images to obtain a pixel-actual length mapping function corresponding to each shooting mode.

[0100] The third module is configured to perform digital processing on the segmentation result in the form of a binary graph obtained by the first module to obtain a pixel length, a pixel width and a pixel area of the digital processed mural crack, and obtain actual geometric parameters of the crack image obtained by the first module according to the pixel length, the pixel width, the pixel area and the pixel-actual length mapping function corresponding to each shooting mode obtained by the second module.

[0101] Overall, compared with the prior art, the above technical solutions conceived by the present application can achieve the following beneficial effects:

[0102] 1. The mural crack segmentation model and the pixel-actual length mapping relationship function constructed by the present application can obtain accurate mural crack segmentation results and thus obtain mural crack cracking parameters, so that the technical problems of the existing manual annotation method, such as dependence on professional manpower, low measurement efficiency and possible secondary damage to murals, can be solved.

[0103] 2. The mural crack segmentation model constructed by the present application can well identify mural cracks with complex backgrounds, so that the technical problems of the existing methods based on traditional image processing, such as poor adaptability to complex backgrounds, insufficient parameter extraction stability, and easy omission or misdiagnosis, can be solved.

[0104] 3. The Adapter fine-tuning module is introduced into the ViT architecture to improve the ability of the model in mural crack disease segmentation specific tasks, so that the technical problem of the existing deep learning based semantic segmentation method that the generalization ability is weak when solving the problem of data scarcity and morphologically diverse mural cracks can be solved.

[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 the present application is that first, an image acquisition device is used to obtain a mural crack image, the mural crack image is input into a mural crack segmentation model trained in advance, a segmentation result in the form of a binary image corresponding to the mural crack image is obtained, and a shooting distance between the image acquisition device and the mural and a shooting mode used when the mural crack image is obtained are obtained. Then, a set of calibration plate images is obtained, and all images in the set are digitally processed to obtain the pixel length of the reference line in the image, and the ratio of the actual length of the reference line in the image to the pixel length is obtained as the ratio of the calibration plate image. The shooting distance used when each photography mode obtains an image is linearly regressed with the ratio of the calibration plate image to obtain a pixel-actual length mapping relationship function for each photography mode. Finally, the pixel-actual length mapping relationship function is selected according to the photography mode used when the mural crack image is shot, and the shooting distance is input into the function to obtain the mapping ratio of the image, and the actual geometric parameters of the cracks in the image are calculated through the mapping ratio.

[0116] As shown in Figure 1 , the present application provides a method for obtaining mural crack cracking parameters, comprising the following steps:

[0117] (1) using an image acquisition device to obtain a crack image on a mural, pre-processing the crack image, inputting the pre-processed crack image into a mural crack segmentation (MCS) model trained in advance for image segmentation processing to obtain a segmentation result in the form of a binary image corresponding to the crack image, and obtaining a shooting distance D between the image acquisition device and the mural and a shooting mode R used by the image acquisition device when obtaining the crack image;

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

[0119] The pre-processing process of this step is specifically as follows: first, irrelevant background in the crack image is deleted, and the crack image after deleting the irrelevant background is saved as a square crack image as the pre-processed crack image; then, the pre-processed crack image is input into a mural crack segmentation model trained in advance to obtain a segmentation result in the form of a binary image.

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

[0121] The first layer is an image preprocessing layer, the input of which is an image with a dimension of HxWxC, wherein H represents the height of the image, W represents the width of the image, and C is the number of channels of the image (generally 3 channels of RGB). The image preprocessing layer first uses a bilinear interpolation method to scale the length and width of the image to 1024 pixels, and then performs normalization processing on the scaled image (the purpose is to eliminate the distribution difference between different input images), and finally outputs a feature map with a dimension of 1024x1024x3.

[0122] The second layer is a convolutional layer, the input of which is the feature map output by the first layer. The convolutional layer performs convolutional operation on the feature map (the parameters of the convolutional operation are: output channel number 768, convolution kernel size 16x16, and step length 16), and finally outputs a feature map with a dimension of 64x64x768.

[0123] The third layer is a Vision Transformer (ViT) network, which includes N serially connected ViT blocks, wherein N is a natural number greater than 1, and is preferably 24.

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

[0125] The third layer is a normalization layer, the input of which is the feature map output by the second layer. The normalization layer performs normalization processing on the feature map to output a feature map with a dimension of 64x64x768.

[0126] The third layer is a multi-head attention layer, the input of which is the feature map output by the third layer. The multi-head attention layer inputs the feature map into a multi-head attention module to output a feature map with a dimension of 64x64x768.

[0127] The third layer is an Adapter adapter layer, the input of which is the feature map output by the third layer. The Adapter adapter layer inputs the feature map into an Adapter adapter module (which first reduces the channel number of the feature map from 768 to 192 through downsampling, then inputs the feature map into a ReLU activation function, and finally performs upsampling operation on the activated feature map to restore its channel number to 768), to output a feature map with a dimension of 64x64x768.

[0128] The third layer is a residual connection layer, the input of which is the feature map output by the second layer and the third layer. The residual connection layer performs residual connection on the two feature maps to output a feature map with a dimension of 64x64x768.

[0129] The third layer is a normalization layer, the input of which is the feature map output by the third layer. The normalization layer performs normalization processing on the feature map to output a feature map with a dimension of 64x64x768.

[0130] The 3.6th layer is a multi-layer perception layer, which inputs the feature map output by the 3.5th layer, inputs the feature map into a multi-layer perception module (which first enlarges the channel number of the feature map from 768 to 3072 through upsampling, then inputs the feature map into a GELU activation function, and finally performs downsampling operation on the activated feature map to restore its channel number to 768), to output a feature map with a dimension of 64x64x768.

[0131] The 3.7th layer is an Adapter adapter layer, which inputs the feature map output by the 3.4th layer, inputs the feature map into an Adapter adapter module (which first reduces the channel dimension of the feature map from 768 to 192 through downsampling, then inputs the feature map into a ReLU activation function, and finally performs upsampling operation on the activated feature map to restore its channel number to 768), to output a feature map with a dimension of 64x64x768.

[0132] The 3.8th layer is a scaling layer, which inputs the feature map output by the 3.7th layer, scales the feature map by a scaling factor of 0.5 to output a feature map with a dimension of 64x64x768.

[0133] The 3.9th layer is a residual connection layer, which inputs the feature maps output by the 3.6th layer and the 3.8th layer, and performs residual connection on the two feature maps to output a feature map with a dimension of 64x64x768.

[0134] The 4th layer is a convolution layer, which inputs the feature map output by the 3.9th layer, performs convolution operation on the feature map (the parameters of the convolution operation are: output channel number 256, convolution kernel size 1x1, step 1, padding value 0), and finally outputs a feature map with a dimension of 64x64x256.

[0135] The 5th layer is a normalization layer, which inputs the feature map output by the 4th layer, performs normalization processing on the feature map, and finally outputs a feature map with a dimension of 64x64x256.

[0136] The 6th layer is a convolution layer, which inputs the feature map output by the 5th layer, performs convolution operation on the feature map (the parameters of the convolution operation are: output channel number 256, convolution kernel size 3x3, step 1, padding value 1), and finally outputs a feature map with a dimension of 64x64x256.

[0137] The 7th layer is a normalization layer, which inputs the feature map output by the 6th layer, performs normalization processing on the feature map, and finally outputs a feature map with a dimension of 64x64x256.

[0138] The 8th layer is a feature enhancement layer, which inputs the feature map output by the 7th layer. The feature enhancement layer first increases the channel dimension of the feature map to 1024 through a convolution layer (the parameters of the convolution operation are: output channel number 1024, convolution kernel size 1x1, step 1, and padding value 0), then inputs the feature map with the lifted dimension into another convolution layer (for further lifting of channel interaction, the parameters of the convolution operation are: output channel number 1024, convolution kernel size 1x1, step 1, and padding value 0), and finally inputs the feature map obtained through convolution into a ReLU activation function, and finally outputs a feature map with a dimension of 64x64x1024.

[0139] The 9th layer is a channel compression layer, which inputs the feature map output by the 8th layer. The channel compression layer first extracts the local context features of the feature map through a convolution layer (the parameters of the convolution operation are: output channel number 1024, convolution kernel size 3x3, step 1, and padding value 1), then reduces the channel dimension of the feature map after feature extraction from 1024 to 512 through another convolution layer (the parameters of the convolution operation are: output channel number 512, convolution kernel size 3x3, step 1, and padding value 1), and finally processes the feature map after dimension reduction through a global attention module (to suppress invalid features and strengthen crack boundary responses), and finally outputs a feature map with a dimension of 64x64x512.

[0140] The 10th layer is a channel compression layer, which inputs the feature map output by the 9th layer. The channel compression layer first extracts the local context features of the feature map through a convolution layer (the parameters of the convolution operation are: output channel number 512, convolution kernel size 3x3, step 1, and padding value 1), then reduces the channel dimension of the feature map after feature extraction from 512 to 256 through another convolution layer (the parameters of the convolution operation are: output channel number 256, convolution kernel size 3x3, step 1, and padding value 1), and finally processes the feature map after dimension reduction through a global attention module (to suppress invalid features and strengthen crack boundary responses), and finally outputs a feature map with a dimension of 64x64x256.

[0141] The 11th layer is an up-sampling layer, the input of which is the feature map output by the 10th layer. The up-sampling layer first extracts local context features of the feature map through two identical convolution layers (the parameters of the convolution operation are: the number of output channels is 256, the convolution kernel size is 3x3, the step is 1, and the padding value is 1), and then performs up-sampling on the feature map after feature extraction through a transposed convolution layer, restores the feature map size to 128x128, and reduces the channel dimension of the feature map from 256 to 128 (the parameters of the transposed convolution operation are: the number of output channels is 128, the convolution kernel size is 2x2, the step is 2, and the padding value is 0), and finally processes the reduced feature map through a global attention module (to suppress invalid features and strengthen crack boundary responses), and finally outputs a feature map with a dimension of 128x128x128.

[0142] The 12th layer is an up-sampling layer, the input of which is the feature map output by the 11th layer. The up-sampling layer first extracts local context features of the feature map through two identical convolution layers (the parameters of the convolution operation are: the number of output channels is 128, the convolution kernel size is 3x3, the step is 1, and the padding value is 1), and then performs up-sampling on the feature map after feature extraction through a transposed convolution layer, restores the feature map size to 256x256, and reduces the channel dimension of the feature map from 128 to 64 (the parameters of the transposed convolution operation are: the number of output channels is 64, the convolution kernel size is 2x2, the step is 2, and the padding value is 0), and finally processes the reduced feature map through a global attention module (to suppress invalid features and strengthen crack boundary responses), and finally outputs a feature map with a dimension of 256x256x64.

[0143] The 13th layer is an output convolution layer, the input of which is the feature map output by the 12th layer. The output convolution layer first performs convolution processing on the local space in the feature map through a spatial refinement convolution (the parameters of the convolution operation are: the number of output channels is 64, the convolution kernel size is 3x3, the step is 1, and the padding value is 1), and then performs prediction convolution processing on the convolution-processed feature map (the parameters of the convolution operation are: the number of output channels is 2, the convolution kernel size is 1x1, the step is 1, and the padding value is 0), and finally outputs a feature map with a dimension of 256x256x2, which is a binary graph form of the segmentation result.

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

[0145] (1-1) Obtain a plurality of mural crack images, and crop each mural crack image in the original image set into a sub-image with a size of 256x256 pixels, and all the sub-images constitute the original image set.

[0146] Specifically, the mural crack images in this step are obtained through two ways of network collection and on-site shooting in cultural relic protection units.

[0147] (1-2) LabelMe image annotation tool is used to label each mural crack image in the original image set obtained in step (1-1) (that is, to label out the crack part), and each mural crack image after labeling is converted into a binary image (with a dimension of 256x256x2). All mural crack images constitute a crack original image part in the data set, and the binary images corresponding to all mural crack images constitute a mask image part in the data set.

[0148] Figure 3 (a) and (b) respectively show a sample in the crack original image part and a sample in the mask image part.

[0149] (1-3) The data set obtained in step (1-2) is divided into a training set and a test set according to a ratio of 7:3.

[0150] (1-4) For each sample in the crack original image part 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 a feature map corresponding to the sample with a dimension of 1024x1024x3.

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

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

[0153] The above step (1-6) has the advantage that layer normalization standardizes the output of each layer, reduces the problem of too large input data difference between different layers, helps to stabilize the training process, and 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 crack original image part in the training set obtained in step (1-3), the feature map corresponding to the sample with a dimension of 64x64x768 obtained in step (1-6) is input into the third layer. 2 of the mural crack segmentation model for processing to obtain a feature map corresponding to the sample with a dimension of 64x64x768.

[0155] The step (1-7) has the advantages that the multi-head self-attention mechanism enables the model to establish long-range dependencies between the input features, thereby capturing global information and complex context relationships in the image. The combination of the two effectively enhances the understanding and processing capabilities of the network for image data.

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

[0157] (1-9) For each sample in the training set of the crack original image part of step (1-3), the feature map corresponding to the sample and having the dimension of 64x64x768 obtained in step (1-8) is input into the 3.4 layer of the mural crack segmentation model for residual connection processing, so as to obtain a feature map corresponding to the sample and having the dimension of 64x64x768.

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

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

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

[0161] The steps (1-8) and (1-12) have the advantages that by introducing the Adapter fine-tuning module into the ViT architecture, the ability of the model in the mural crack disease segmentation specific task is improved. The Adapter fine-tuning module enables the network to be fine-tuned on the basis of preserving the pre-trained model weights by inserting lightweight trainable parameters in the multi-head attention mechanism and the feed-forward network of each layer of the ViT. By combining the powerful feature learning ability of the multi-layer ViT architecture and the fine-tuning advantages of the Adapter module, the image encoding adapter can learn mural crack features and enhance its performance in the mural crack disease segmentation task field, while only updating the parameters of the fine-tuning module, thereby improving the training efficiency.

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

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

[0164] (1-15) For each sample in the mural crack image part of the training set obtained in step (1-3), the feature map corresponding to the sample and having a dimension of 64x64x768 obtained in step (1-14) is input into the 4th layer of the mural crack segmentation model for up-sampling operation, to obtain a feature map corresponding to the sample and having a dimension of 64x64x256.

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

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

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

[0168] (1-19) For each sample in the training set of the crack original image part obtained in step (1-3), the feature map 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 a feature map corresponding to the sample, and the dimension is 64*64*1024.

[0169] The advantage of the above step (1-19) is that the channel expansion significantly improves the semantic information carrying capacity of the features, provides a high-dimensional feature basis for subsequent multi-level upsampling, and enhances the nonlinear expression ability combined with the ReLU activation function.

[0170] (1-20) For each sample in the training set of the crack original image part obtained in step (1-3), the feature map 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 a feature map corresponding to the sample, and the dimension is 64*64*512.

[0171] (1-21) For each sample in the training set of the crack original image part obtained in step (1-3), the feature map 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 a feature map corresponding to the sample, and the dimension is 64*64*256.

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

[0173] (1-23) For each sample in the fissure original image part of the training set obtained in step (1-3), the feature map corresponding to the sample obtained in step (1-22) and having a dimension of 128x128x128 is input into the 12th layer of the mural fissure segmentation model to perform up-sampling processing, so as to obtain a feature map corresponding to the sample and having a dimension of 256x256x64.

[0174] The steps (1-20) to (1-23) have the advantage that the global attention model (GAM) is embedded after the four multi-level up-sampling layers, the GAM is composed of a channel attention submodule and a spatial attention submodule in series, and the channel-spatial double attention mechanism is used to dynamically optimize feature selection; the channel attention branch uses a full connection layer to compress and restore the channel dimension, generates channel weights to suppress irrelevant features; and the spatial attention branch uses a 7x7 large convolution kernel to capture wide context information and strengthen the fissure region response.

[0175] (1-24) For each sample in the fissure original image part of the training set obtained in step (1-3), the feature map corresponding to the sample obtained in step (1-23) and having a dimension of 256x256x64 is input into the 13th layer of the mural fissure segmentation model to perform output convolution processing, so as to obtain a feature map corresponding to the sample and having a dimension of 256x256x2.

[0176] (1-25) A loss function is calculated according to the feature map corresponding to each sample in the fissure original image part of the training set obtained in step (1-24), and the mural fissure segmentation model is iteratively trained using the loss function until the mural fissure segmentation model converges, thereby obtaining a mural fissure segmentation model that is preliminarily trained.

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

[0178] Loss=L Dice +L BCE

[0179] L Dice is a Dice loss function, and its calculation formula is:

[0180]

[0181] where M represents the number of pixels of each sample in the fissure original image part of the training set, p i represents the prediction result of the i-th pixel of each sample in the fissure original image part of the training set after passing through the model (1 represents the foreground and 0 represents the background), and g iyi is the true label of the i-th pixel of each sample in the mask image part of the training set (1 represents foreground and 0 represents background), and ε is a smoothing term introduced to avoid zero denominator, with a value range of 1e-10 to 1e-6, preferably 1e-6, i∈[1, M].

[0182] L BCE is a binary cross-entropy loss function (BCE for short), and its calculation formula is:

[0183]

[0184] The above step (1-25) has the advantages that the Dice loss function can measure the overlap degree of two sample sets, can strongly match the body region, and is effective for sparse foreground data; the cross-BCE loss function can compare the predicted probability distribution and the true label probability distribution to calculate the error, can accurately align the pixel-level label, and is suitable for most cases. Combining the two can optimize both local pixels and overall regions, and is one of the most commonly used combinations.

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

[0186] (2) A calibration plate is generated, and the image acquisition device is used to take the calibration plate in multiple shooting modes and multiple shooting distances to obtain a calibration plate image set composed of multiple calibration plate images in each shooting mode. Each calibration plate image in the calibration plate image set is digitally processed to obtain a digitally processed calibration plate image and the average pixel length of the three reference lines therein, and the ratio of the average actual length of the three reference lines to the average pixel length is obtained as the ratio corresponding to the calibration plate image, and linear regression analysis is performed according to the ratios corresponding to all calibration plate images to obtain a pixel-actual length mapping function corresponding to each shooting mode;

[0187] Specifically, the present step comprises the following steps:

[0188] (2-1) A calibration plate with three reference lines is generated, and the lengths of the three reference lines are all 100 mm, and they are distributed at a 45° angle with each other;

[0189] Specifically, the present step is to use word or ordinary drawing software to draw three fine lines with a length of 100 mm as reference lines, and the directions of the three lines are horizontal, vertical and 45-degree diagonal line respectively.

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

[0191] (2-3) Capture the calibration plate generated in step (2-1) in multiple shooting modes and at multiple shooting distances, and obtain a calibration plate image set Aj = (aj1, …, ajQ) composed of multiple calibration plate images in each shooting mode, where Ajk represents a calibration plate image obtained in the jth shooting mode and at the kth 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, i.e., 4 shooting modes: normal pixel standard mode, normal pixel wide-angle mode, high-definition pixel standard mode, and high-definition pixel wide-angle mode, and Q = 6, i.e., 6 shooting distances: 500 mm, 800 mm, 1000 mm, 1200 mm, 1500 mm, and 2000 mm.

[0193] (2-4) For each calibration plate image set Aj composed of multiple calibration plate images in each shooting mode obtained in step (2-3), perform digital processing on each calibration plate image in the calibration plate image set Aj to obtain a digitally processed calibration plate image and the average pixel length of the three reference lines therein, and obtain the ratio of the average actual length of the three reference lines to the average pixel length as the ratio (in mm / pixel) corresponding to the calibration plate image.

[0194] The process of obtaining the ratio of the average actual length of the three reference lines to the average pixel length as the ratio corresponding to the calibration plate image in this step is as follows: first, crop the calibration plate image to obtain an effective calibration region image; then, perform binaryzation processing on the effective calibration region image to obtain a feature image of the three reference lines after binaryzation; thereafter, perform skeletonization processing on the feature image of the three reference lines after binaryzation to obtain a skeleton image of the three reference lines with a single-pixel width; then, perform contour extraction processing on the skeleton image of the three reference lines with a single-pixel width to obtain a skeleton contour of the three reference lines; subsequently, sum the number of all pixel points in the skeleton contour of the three reference lines and take the average (i.e., divide the number of all pixel points in the skeleton contour of the three reference lines by 3) to obtain the average pixel length of each reference line; finally, divide the average actual length of each reference line by the average pixel length to obtain the ratio as the ratio corresponding to the calibration plate image;

[0195] More specifically, the image cropping processing is using common image processing software (such as Photoshop, etc.), the binarization processing, the skeletonization processing, the contour extraction processing, and the pixel point summation are respectively completed by using the threshold function, the ximgproc.thinning function, the findContours function, and the arcLength function in the cv library in Python.

[0196] (2-5) For each set of calibration plate images Aj under each shooting mode obtained in step (2-3), linear regression analysis is performed according to the shooting distances of all calibration plate images in the set of calibration plate images and the ratios corresponding to all calibration plate images obtained in step (2-4) to obtain a pixel-actual length mapping function δj = Bj × Dj + Cj corresponding to the shooting mode (where Bj is the regression coefficient of the jth shooting mode, Dj is the actual shooting distance when the mural crack image is obtained in the jth shooting mode, and Cj is the intercept term of the jth shooting mode);

[0197] Specifically, this step is to fit each shooting distance and the average pixel length corresponding to the calibration plate image obtained at the shooting distance under each shooting mode by using the linregress function in the scipy library of Python to obtain the pixel-actual length mapping function corresponding to the shooting mode, and the specific process is as follows:

[0198] δns = Bns × Dns + Cns

[0199] δnw = Bnw × Dnw + Cnw

[0200] δhs = Bhs × Dhs + Chs

[0201] δhw = Bhw × Dhw + Chw

[0202] wherein δns, δnw, δhs, δhw represent pixel-actual length mapping functions corresponding to normal pixel standard mode, pixel-actual length mapping functions corresponding to normal pixel wide-angle mode, pixel-actual length mapping functions corresponding to high-definition pixel standard mode, and pixel-actual length mapping functions corresponding to high-definition pixel wide-angle mode respectively, Bns, Bnw, Bhs, Bhw represent regression coefficients corresponding to normal pixel standard mode, regression coefficients corresponding to normal pixel wide-angle mode, regression coefficients corresponding to high-definition pixel standard mode, and regression coefficients corresponding to high-definition pixel wide-angle mode respectively, Dns, Dnw, Dhs, Dhw represent actual shooting distances when mural crack image is acquired using normal pixel standard mode, actual shooting distances when mural crack image is acquired using normal pixel wide-angle mode, actual shooting distances when mural crack image is acquired using high-definition pixel standard mode, and actual shooting distances when mural crack image is acquired using high-definition pixel wide-angle mode respectively, Cns, Cnw, Chs, Chw represent intercept terms corresponding to normal pixel standard mode, intercept terms corresponding to normal pixel wide-angle mode, intercept terms corresponding to high-definition pixel standard mode, and intercept terms corresponding to high-definition pixel wide-angle mode respectively.

[0203] The advantage of the present step (2) is that after obtaining the pixel-actual length mapping relationship function of the image acquisition device, the subsequent acquisition of mural crack cracking parameters does not need to repeatedly perform the function obtaining step, and the corresponding mapping ratio can be obtained directly according to the shooting image using the photographic mode selection function obtained in step (1) and inputting the shooting distance into the function.

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

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

[0206] (3-1) Skeletonizing the segmentation result in the form of binary image obtained in step (1) to obtain the crack center line, performing contour extraction processing on the crack center line to obtain the contour of the crack skeleton, and obtaining the number of all pixel points in the contour of the crack skeleton as the pixel length of the crack in the crack image obtained in step (1);

[0207] Specifically, first, the ximgproc.thinning function in the cv library of Python is used to perform skeletonization processing on the segmentation result in the form of a binary graph obtained in step (1) to extract the crack center line as the skeletonization result, then the findContours function in the cv library is used to perform contour extraction processing on the crack center line to obtain the contour of the crack skeleton, and finally the arcLength function in the cv library is used to obtain the number of all pixel points 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 segmentation result in the form of a binary graph corresponding to the crack image obtained in step (1) is subjected to edge detection processing by using the Canny operator in the cv library of Python to extract the edge of the crack in the crack image as the edge detection result, according to the edge detection processing result and the crack center line obtained in step (3-1), the distance between each pixel point on the crack center line and the crack edge in the edge detection processing result in the normal direction is obtained, that is, the normal width value of the pixel point, finally, all normal width values of all pixel points on the crack center line are counted, and the maximum value among them is taken as the maximum pixel width of the crack in the crack image.

[0209] (3-3) The segmentation result in the form of a binary graph corresponding to the crack image obtained in step (1) is subjected to pixel statistics to obtain the pixel area of the crack in the crack image.

[0210] Specifically, the sum function in the numpy library of Python is used to perform pixel statistics on the segmentation result in the form of a binary graph corresponding to the crack image obtained in step (1) to obtain the pixel area of the crack in the crack image.

[0211] (3-4) The shooting distance D between the image acquisition device obtained in step (1) and the mural and the shooting mode R used by the image acquisition device to acquire the crack image are input into the pixel-actual length mapping function corresponding to the shooting mode obtained in step (2-5) to obtain the corresponding mapping ratio, and 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) are multiplied by the mapping ratio under the shooting mode to obtain the actual length, the actual width and the actual area of the crack in the mural crack image obtained in step (1) under the shooting mode.

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

[0213] In order to comprehensively evaluate the performance of the present application, multi-dimensional evaluation indexes are adopted. Five evaluation indexes, namely, pixel accuracy (Accuracy, Acc for short), precision, recall, Dice coefficient and mean intersection over union (mIoU for short) are introduced.

[0214] Table 1 experimental environment configuration

[0215]

[0216] Table 2 experimental parameter setting table

[0217]

[0218]

[0219] Test example 1

[0220] In order to verify the performance advantage of the method of the present application in the mural crack segmentation task, nine kinds of segmentation algorithms with field representative, such as UNet, DeepLabv3+ and SegFormer, are compared in systematic segmentation performance on the mural crack data set MuralCrack and the public road crack data set Crack500 built by the present application. The experimental results are shown in Table 3. In the experimental design, a unified hardware platform, hyperparameter configuration and data preprocessing process are adopted.

[0221] Table 3 comparison of experimental results of MCS model and other models on MuralCrack and Crack500 data sets (%)

[0222]

[0223] According to the experimental results in Table 3, the MCS model of the present application achieves 94.98% and 96.41% accuracy, 91.76% and 92.73% Dice coefficient, and 86.97% and 89.75% mIoU on the MuralCrack mural crack dataset and the Crack500 road crack dataset, respectively, all of which are optimal. On the MuralCrack mural crack dataset, the mural crack segmentation model is more suitable for fine structure cracks than the full-resolution feature preserving HRNet, which improves the Dice by 15.18% and the mIoU by 14.33%, respectively, and improves the Segformer using a hierarchical Transformer architecture as the encoder and a lightweight full-MLP multi-level feature fusion decoder by 12.31% Dice and 13.29% mIoU, respectively. On the road crack dataset Crack500, the MCS model improves the Dice by 12.58% and the mIoU by 11.92% compared with the HRNet, and improves the Dice by 13.49% and the mIoU by 12.93% compared with the SegFormer.

[0224] The crack prediction results of some images on the MuralCrack test dataset and the Crack500 test set by different methods further verify the reliable performance of the method of the present application in the mural crack segmentation task.

[0225] As shown in Figure 4 Compared with other segmentation models, the MCS model can effectively identify cracks and background color patterns, and can also better identify finer cracks.

[0226] In summary, the method of the present application has a large improvement in the key indicators of pixel accuracy, precision, recall, Dice coefficient and average intersection over union in the mural crack segmentation task, and provides a more optimal solution for the practical application of the mural crack segmentation task

[0227] Those skilled in the art will readily understand that the above description is only of the preferred embodiments of the present application and is not intended to limit the present application, and any modifications, equivalent replacements and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method of obtaining a mural crack fracture parameter, characterized by, The method comprises the following steps: (1) acquiring a crack image on a mural using an image acquisition device, pre-processing the crack image, inputting the pre-processed crack image into a mural crack segmentation MCS model pre-trained to perform image segmentation processing, to obtain a segmentation result in the form of a binary graph corresponding to the crack image, and acquiring a shooting distance D between the image acquisition device and the mural and a shooting mode R used by the image acquisition device to acquire the crack image; the mural crack segmentation model comprises 13 layers, and the specific structure is as follows: The first layer is an image preprocessing layer, and the input is an image with a dimension of HxWxC, wherein H represents the height of the image, W represents the width of the image, and C is the channel number of the image. The image preprocessing layer first uses a bilinear interpolation method to scale the length and width of the image to 1024 pixels, and then performs normalization processing on the scaled image, and finally outputs a feature map with a dimension of 1024x1024x3; The second layer is a convolution layer, and the input is the feature map output by the first layer. The convolution layer performs convolution operation on the feature map, and finally outputs a feature map with a dimension of 64x64x768; The third layer is a visual transformer ViT network, which comprises N ViT blocks connected in series, wherein N is a natural number greater than 1; For each ViT block, the specific structure is as follows: The third layer is a normalization layer, and the input is the feature map output by the second layer. The normalization layer performs normalization processing on the feature map to output a feature map with a dimension of 64x64x768; The third layer is a multi-head attention layer, and the input is the feature map output by the third layer. The multi-head attention layer inputs the feature map into a multi-head attention module to output a feature map with a dimension of 64x64x768; The third layer is an Adapter adapter layer, and the input is the feature map output by the third layer. The Adapter adapter layer inputs the feature map into an Adapter adapter module to output a feature map with a dimension of 64x64x768; The third layer is a residual connection layer, and the input is the feature map output by the second layer and the third layer. The residual connection layer performs residual connection on the two feature maps to output a feature map with a dimension of 64x64x768; The third layer is a normalization layer, and the input is the feature map output by the third layer. The normalization layer performs normalization processing on the feature map to output a feature map with a dimension of 64x64x768; The third layer is a multi-layer perception layer, and the input is the feature map output by the third layer. The multi-layer perception layer inputs the feature map into a multi-layer perception module to output a feature map with a dimension of 64x64x768; The third layer is an Adapter adapter layer, and the input is the feature map output by the third layer. The Adapter adapter layer inputs the feature map into an Adapter adapter module to output a feature map with a dimension of 64x64x768; The 3.8th layer is a scaling layer, which inputs the feature map output by the 3.7th layer, scales the feature map by multiplying a scaling factor 0.5, and outputs a feature map with a dimension of 64x64x768; The 3.9th layer is a residual connection layer, which inputs the feature maps output by the 3.6th layer and the 3.8th layer, and performs residual connection on the two feature maps to output a feature map with a dimension of 64x64x768; The 4th layer is a convolution layer, which inputs the feature map output by the 3.9th layer, performs convolution operation on the feature map, and finally outputs a feature map with a dimension of 64x64x256; The 5th layer is a normalization layer, which inputs the feature map output by the 4th layer, performs normalization processing on the feature map, and finally outputs a feature map with a dimension of 64x64x256; The 6th layer is a convolution layer, which inputs the feature map output by the 5th layer, performs convolution operation on the feature map, and finally outputs a feature map with a dimension of 64x64x256; The 7th layer is a normalization layer, which inputs the feature map output by the 6th layer, performs normalization processing on the feature map, and finally outputs a feature map with a dimension of 64x64x256; The 8th layer is a feature enhancement layer, which inputs the feature map output by the 7th layer, first increases the channel dimension of the feature map to 1024 through a convolution layer, then inputs the feature map with the increased dimension into another convolution layer, and finally inputs the feature map obtained by convolution into a ReLU activation function, and finally outputs a feature map with a dimension of 64x64x1024; The 9th layer is a channel compression layer, which inputs the feature map output by the 8th layer, first extracts the local context features of the feature map through a convolution layer, then reduces the channel dimension of the feature map after feature extraction from 1024 to 512 through a convolution layer, and finally processes the feature map after dimension reduction through a global attention module, and finally outputs a feature map with a dimension of 64x64x512; The 10th layer is a channel compression layer, which inputs the feature map output by the 9th layer, first extracts the local context features of the feature map through a convolution layer, then reduces the channel dimension of the feature map after feature extraction from 512 to 256 through a convolution layer, and finally processes the feature map after dimension reduction through a global attention module, and finally outputs a feature map with a dimension of 64x64x256; The 11th layer is an up-sampling layer, which inputs the feature map output by the 10th layer, first extracts the local context features of the feature map through two identical convolution layers, then performs up-sampling on the feature map after feature extraction through a transposed convolution layer, restores the feature map size to 128x128, and at the same time reduces the channel dimension of the feature map from 256 to 128, and finally processes the feature map after dimension reduction through a global attention module, and finally outputs a feature map with a dimension of 128x128x128; The 12th layer is an up-sampling layer, the input of which is the feature map output by the 11th layer, the up-sampling layer first extracts local context features of the feature map through two identical convolutional layers, then up-samples the feature map after feature extraction through a transposed convolutional layer to restore the feature map size to 256x256, while reducing the channel dimension of the feature map from 128 to 64, and finally processing the reduced feature map through a global attention module, and finally outputting a feature map with a dimension of 256x256x64; The 13th layer is an output convolutional layer, the input of which is the feature map output by the 12th layer, the output convolutional layer first performs convolutional processing on the local space in the feature map through a spatial refinement convolution, then performs prediction convolutional processing on the convolutional processed feature map, and finally outputs a feature map with a dimension of 256x256x2, which is a binary graph form of segmentation result; (2) A calibration plate is generated, and the calibration plate is photographed in multiple shooting modes and multiple shooting distances using an image acquisition device to obtain a calibration plate image set composed of multiple calibration plate images in each shooting mode. Each calibration plate image in the calibration plate image set is digitally processed to obtain a digitally processed calibration plate image and the average pixel length of the three reference lines therein, and the ratio of the average actual length to the average pixel length of the three reference lines is obtained as the ratio corresponding to the calibration plate image. Linear regression analysis is performed according to the ratios corresponding to all calibration plate images to obtain a pixel-actual length mapping function corresponding to each shooting mode; (3) The binary graph form of the segmentation result obtained in step (1) is digitally processed to obtain the pixel length, pixel width and pixel area of the digitally processed mural crack, 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, wherein the image acquisition device used in step (1) is a mobile phone or a digital camera; The pre-processing process in step (1) is specifically as follows: first, delete the irrelevant background in the crack image, and save the crack image after deleting the irrelevant background as a square crack image as a pre-processed crack image; then, input the pre-processed crack image into a pre-trained mural crack segmentation model to obtain a binary graph form of segmentation result. The mural crack segmentation model is trained through the following steps:

3. The method of acquiring mural crack parameters according to claim 2, wherein, (1-1) Obtain a plurality of mural crack image sets, and crop each mural crack image in the original image set into a sub-image with a size of 256x256 pixels, and all sub-images constitute an original image set; ​ (1-2) using the LabelMe image labeling tool to label each mural crack image in the original image set obtained in step (1-1), and converting each mural crack image after labeling into a binary image, which has a dimension of 256x256x2, all mural crack images constitute a crack original image part in the data set, and all binary images corresponding to the mural crack images constitute a mask image part in the data set; (1-3) dividing the data set obtained in step (1-2) into a training set and a test set according to a ratio of 7:3; (1-4) for each sample in the crack original image part in the training set obtained in step (1-3), inputting the sample into the first layer of the mural crack segmentation model for processing to obtain a feature map corresponding to the sample, which has a dimension of 1024x1024x3; (1-5) for each sample in the crack original image part in the training set obtained in step (1-3), inputting the feature map corresponding to the sample obtained in step (1-4) and having a dimension of 1024x1024x3 into the second layer of the mural crack segmentation model to obtain a feature map corresponding to the sample, which has a dimension of 64x64x768; (1-6) for each sample in the crack original image part in the training set obtained in step (1-3), inputting the feature map corresponding to the sample obtained in step (1-5) and having a dimension of 64x64x768 into the third layer of the mural crack segmentation model for normalization processing to obtain a feature map corresponding to the sample, which has a dimension of 64x64x768; (1-7) for each sample in the crack original image part in the training set obtained in step (1-3), inputting the feature map corresponding to the sample obtained in step (1-6) and having a dimension of 64x64x768 into the third layer of the mural crack segmentation model for processing to obtain a feature map corresponding to the sample, which has a dimension of 64x64x768; (1-8) for each sample in the crack original image part in the training set obtained in step (1-3), inputting the feature map corresponding to the sample obtained in step (1-7) and having a dimension of 64x64x768 into the third layer of the mural crack segmentation model for processing to obtain a feature map corresponding to the sample, which has a dimension of 64x64x768; (1-9) for each sample in the crack original image part in the training set obtained in step (1-3), inputting the feature map corresponding to the sample obtained in step (1-8) and having a dimension of 64x64x768 into the third layer of the mural crack segmentation model for residual connection processing to obtain a feature map corresponding to the sample, which has a dimension of 64x64x768; (1-10) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample and having a dimension of 64x64x768 obtained in step (1-9) is input into the 3.5th layer of the mural crack segmentation model for normalization processing, so as to obtain a feature map corresponding to the sample and having a dimension of 64x64x768; (1-11) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample and having a dimension of 64x64x768 obtained in step (1-10) is input into the 3.6th layer of the mural crack segmentation model for processing, so as to obtain a feature map corresponding to the sample and having a dimension of 64x64x768; (1-12) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample and having a dimension of 64x64x768 obtained in step (1-11) is input into the 3.7th layer of the mural crack segmentation model for processing, so as to obtain a feature map corresponding to the sample and having a dimension of 64x64x768; (1-13) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample and having a dimension of 64x64x768 obtained in step (1-12) is input into the 3.8th layer of the mural crack segmentation model for scaling processing, so as to obtain a feature map corresponding to the sample and having a dimension of 64x64x768; (1-14) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample and having a dimension of 64x64x768 obtained in step (1-13) is input into the 3.9th layer of the mural crack segmentation model for residual connection processing, so as to obtain a feature map corresponding to the sample and having a dimension of 64x64x768; (1-15) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample and having a dimension of 64x64x768 obtained in step (1-14) is input into the 4th layer of the mural crack segmentation model for up-sampling operation, so as to obtain a feature map corresponding to the sample and having a dimension of 64x64x256; (1-16) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample and having a dimension of 64x64x256 obtained in step (1-15) is input into the 5th layer of the mural crack segmentation model for normalization processing, so as to obtain a feature map corresponding to the sample and having a dimension of 64x64x256; (1-17) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample and having a dimension of 64x64x256 obtained in step (1-16) is input into the 6th layer of the mural crack segmentation model for convolution processing, so as to obtain a feature map corresponding to the sample and having a dimension of 64x64x256; (1-18) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample and having a dimension of 64x64x256 obtained in step (1-17) is input into the 7th layer of the mural crack segmentation model for normalization processing, so as to obtain a feature map corresponding to the sample and having a dimension of 64x64x256; (1-19) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample and having a dimension of 64x64x256 obtained in step (1-18) is input into the 8th layer of the mural crack segmentation model for feature enhancement processing, so as to obtain a feature map corresponding to the sample and having a dimension of 64x64x1024; (1-20) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample and having a dimension of 64x64x1024 obtained in step (1-19) is input into the 9th layer of the mural crack segmentation model for channel compression processing, so as to obtain a feature map corresponding to the sample and having a dimension of 64x64x512; (1-21) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample and having a dimension of 64x64x512 obtained in step (1-20) is input into the 10th layer of the mural crack segmentation model for channel compression processing, so as to obtain a feature map corresponding to the sample and having a dimension of 64x64x256; (1-22) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample and having a dimension of 64x64x256 obtained in step (1-21) is input into the 11th layer of the mural crack segmentation model for up-sampling processing, so as to obtain a feature map corresponding to the sample and having a dimension of 128x128x128; (1-23) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample and having a dimension of 128x128x128 obtained in step (1-22) is input into the 12th layer of the mural crack segmentation model for up-sampling processing, so as to obtain a feature map corresponding to the sample and having a dimension of 256x256x64; (1-24) For each sample in the training set of crack original image part obtained in step (1-3), the feature map corresponding to the sample and having a dimension of 256x256x64 obtained in step (1-23) is input into the 13th layer of the mural crack segmentation model for output convolution processing, so as to obtain a feature map corresponding to the sample and having a dimension of 256x256x2; (1-25) A loss function is calculated according to the feature map corresponding to each sample in the training set of crack original image part obtained in step (1-24), and the mural crack segmentation model is iteratively trained by using the loss function until the mural crack segmentation model converges, so as to obtain a mural crack segmentation model preliminarily trained; (1-26) verifying the mural crack segmentation model preliminarily trained in step (1-25) using the test set obtained in step (1-3) until the classification accuracy obtained reaches the optimal value, so as to obtain the trained mural crack segmentation model.

4. The method for obtaining mural crack cracking parameters according to claim 3, characterized in that, The loss function used in step (1-25) is: Loss = L Dice + L BCE; L Dice Dice loss function, the formula is: ; where M represents the number of pixels of each sample in the part of the original image of the crack in the training set, p i represents the prediction result of the i-th pixel of each sample in the part of the original image of the crack in the training set after passing through the model, where 1 represents the foreground and 0 represents the background, g i represents the true label of the i-th pixel of each sample in the part of the mask image in the training set, where 1 represents the foreground and 0 represents the background, ε represents a smoothing term, the value range of which is 1e-10 to 1e-6, i∈[1, M]; L BCE is a binary cross-entropy loss function BCE, which is calculated as: 。 5. The method of acquiring mural crack parameters according to claim 1, wherein, Step (2) comprises the following steps: (2-1) generating a calibration plate with three reference lines, the lengths of the three reference lines are all 100 mm, and the three reference lines are orthogonally distributed at an angle of 45°; (2-2) positioning the image acquisition device used in step (1) in front of the calibration plate generated in step (2-1) through an adjustable support, and adjusting the image acquisition device so that its main optical axis is perpendicular to the surface of the calibration plate; (2-3) making the image acquisition device take pictures of the calibration plate generated in step (2-1) in multiple shooting modes and multiple shooting distances, and obtaining a calibration plate image set Aj = (aj1, …, ajQ) composed of multiple calibration plate images in each shooting mode, wherein Ajk represents a calibration plate image obtained in the jth shooting mode and at the kth 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 each calibration plate image set Aj composed of multiple calibration plate images in each shooting mode obtained in step (2-3), digitally processing each calibration plate image in the calibration plate image set Aj to obtain the digitally processed calibration plate image and the average pixel length of the three reference lines therein, and obtaining the ratio of the average actual length to the average pixel length of the three reference lines as the ratio corresponding to the calibration plate image; (2-5) for each calibration plate image set Aj in each shooting mode obtained in step (2-3), performing linear regression analysis according to the shooting distances of all calibration plate images in the calibration plate image set and the ratios corresponding to 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, wherein Bj is the regression coefficient of the jth shooting mode, Dj is the actual shooting distance when obtaining a mural crack image in the jth shooting mode, and Cj is the intercept term of the jth shooting mode.

6. The method for obtaining mural crack cracking parameters according to claim 5, characterized in that, In step (2-3), P = 4, i.e. four shooting modes: normal pixel standard mode, normal pixel wide-angle mode, high-definition pixel standard mode, and high-definition pixel wide-angle mode; In step (2-3), Q = 6, i.e. six shooting distances: 500 mm, 800 mm, 1000 mm, 1200 mm, 1500 mm, and 2000 mm; The ratio of the average actual length of the three reference lines and the average pixel length in step (2-4) is taken as the ratio corresponding to the calibration board image. Specifically, 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 image of the three reference lines after binarization; thereafter, the feature image of the three reference lines after binarization is skeletonized to obtain the skeleton image of the three reference lines with a single pixel width; then, the skeleton image of the three reference lines with a single pixel width is subjected to contour extraction processing to obtain the skeleton contour of the three reference lines; Then, the number of all pixel points in the skeleton contour of the three reference lines is summed and averaged to obtain the average pixel length of each reference line; finally, the average actual length of each reference line is divided by the average pixel length to obtain the ratio of the two as the ratio corresponding to the calibration board image; The image cropping processing in step (2-4) uses ordinary image processing software, and the binarization processing, skeletonization processing, contour extraction processing, and pixel point summation use the threshold function, the ximgproc.thinning function, the findContours function, and the arcLength function in the cv library in Python, respectively.

7. The method of acquiring mural crack parameters according to claim 6, wherein, Step (2-5) is to fit the average pixel length corresponding to the calibration board image obtained at each shooting distance under each shooting mode by using the linregress function in the scipy library of Python to obtain the pixel-actual length mapping function corresponding to the shooting mode, specifically: δns = Bns×Dns + Cns δnw = Bnw×Dnw + Cnw δhs = Bhs×Dhs + Chs δhw = Bhw×Dhw + Chw Wherein, δns, δnw, δhs, δhw respectively represent the pixel-actual length mapping function corresponding to the normal pixel standard mode, the pixel-actual length mapping function corresponding to the normal pixel wide-angle mode, the pixel-actual length mapping function corresponding to the high-definition pixel standard mode, and the pixel-actual length mapping function corresponding to the high-definition pixel wide-angle mode, Bns, Bnw, Bhs, Bhw respectively represent the regression coefficient corresponding to the normal pixel standard mode, the regression coefficient corresponding to the normal pixel wide-angle mode, the regression coefficient corresponding to the high-definition pixel standard mode, and the regression coefficient corresponding to the high-definition pixel wide-angle mode, Dns, Dnw, Dhs, Dhw respectively represent the actual shooting distance when the mural crack image is acquired using the normal pixel standard mode, the actual shooting distance when the mural crack image is acquired using the normal pixel wide-angle mode, the actual shooting distance when the mural crack image is acquired using the high-definition pixel standard mode, and the actual shooting distance when the mural crack image is acquired using the high-definition pixel wide-angle mode, Cns, Cnw, Chs, Chw respectively represent the intercept term corresponding to the normal pixel standard mode, the intercept term corresponding to the normal pixel wide-angle mode, the intercept term corresponding to the high-definition pixel standard mode, and the intercept term corresponding to the high-definition pixel wide-angle mode.

8. The method of acquiring mural crack parameters according to claim 7, wherein, Step (3) comprises the following steps: (3-1) skeletonizing the binary graph form segmentation result obtained in step (1) to obtain the crack center line, performing contour extraction processing on the crack center line to obtain the contour of the crack skeleton, and obtaining the number of all pixel points in the contour of the crack skeleton as the pixel length of the crack in the crack image obtained in step (1); In this step, first, the ximgproc.thinning function in the cv library of Python is used to perform skeletonization processing on the binary graph form segmentation result obtained in step (1) to extract the crack center line as the skeletonization result, then the findContours function in the cv library is used to perform contour extraction processing on the crack center line to obtain the contour of the crack skeleton, and finally the arcLength function in the cv library is used to obtain the number of all pixel points in the contour of the crack skeleton as the pixel length of the crack in the crack image obtained in step (1); (3-2) using the Canny operator in the cv library of Python to perform edge detection processing on the binary graph form segmentation result 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, according to the edge detection processing result and the crack center line obtained in step (3-1), obtaining the distance between each pixel point on the crack center line and the crack edge in the edge detection processing result in the normal direction, which is the normal width value of the pixel point, finally, all normal width values of all pixel points on the crack center line are counted, and the maximum value is taken as the pixel maximum width of the crack in the crack image; (3-3) performing pixel statistics on the binary graph form segmentation result corresponding to the crack image obtained in step (1) to obtain the pixel area of the crack in the crack image; Specifically, the sum function in the numpy library of Python is used to count the pixels of the segmentation result in the form of a binary image obtained in step (1), so as to obtain the pixel area of the crack in the crack image; (3-4) The shooting distance D between the image acquisition device obtained in step (1) and the mural and the shooting mode R used by the image acquisition device to acquire the crack image are input into the pixel-actual length mapping function corresponding to the shooting mode obtained in step (2-5), so as to obtain the corresponding mapping ratio, and 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) are multiplied by the mapping ratio in the shooting mode, so as to obtain the actual length, the actual width and the actual area of the crack in the mural crack image obtained in step (1) in the shooting mode.

9. A system for obtaining mural crack parameters, implemented by the method for obtaining mural crack parameters according to claim 1, characterized in that, The system comprises: A first module is configured to acquire a crack image on a mural using an image acquisition device, pre-process the crack image, input the pre-processed crack image into a mural crack segmentation MCS model trained in advance for image segmentation processing, obtain a segmentation result in the form of a binary image corresponding to the crack image, and acquire a shooting distance D between the image acquisition device and the mural and a shooting mode R used by the image acquisition device to acquire the crack image. A second module is configured to generate a calibration board, capture the calibration board in multiple shooting modes and at multiple shooting distances using the image acquisition device, acquire a calibration board image set composed of multiple calibration board images in each shooting mode, perform digital processing on each calibration board image in the calibration board image set, acquire an average pixel length of three reference lines in the digital processed calibration board image, acquire a ratio of an average actual length of the three reference lines to the average pixel length as a ratio corresponding to the calibration board image, and perform linear regression analysis according to the ratios corresponding to all calibration board images, so as to obtain a pixel-actual length mapping function corresponding to each shooting mode. A third module is configured to perform digital processing on the segmentation result in the form of a binary image obtained by the first module, so as to obtain a pixel length, a pixel width and a pixel area of the mural crack after digital processing, and acquire actual geometric parameters of the crack image obtained by the first module according to the pixel length, the pixel width, the pixel area and the pixel-actual length mapping function corresponding to each shooting mode obtained by the second module.

Citation Information

Patent Citations

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

    CN117934500A

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

    CN120047452A