Multi-task lightweight crack detection method and system based on machine vision

Through a multi-task lightweight crack detection method based on machine vision, using smartphones and deep neural networks, the problems of traditional crack detection are solved with low efficiency, high cost and narrow application scope, and efficient and accurate crack detection in complex environments are achieved.

CN120471864APending Publication Date: 2025-08-12FUZHOU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510556921.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-29
Publication Date
2025-08-12

AI Technical Summary

Technical Problem

The existing crack detection technology has problems such as low detection efficiency, high cost, susceptible to light and noise, narrow application range, and it is difficult for traditional methods to be applied in complex environments.

Method used

Using a multi-task lightweight crack detection method based on machine vision, using a smartphone to capture images and combine deep neural networks and digital image processing algorithms to realize binary classification, image segmentation and quantification of cracks, and improve detection accuracy and applicability through lightweight classification models and local efficient attention mechanisms.

Benefits of technology

It realizes stable detection under different lighting conditions and low noise backgrounds, improves detection efficiency and accuracy, supports the application of embedded devices, and reduces hardware cost and operational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120471864A_ABST
    Figure CN120471864A_ABST
Patent Text Reader

Abstract

The invention provides a multi-task lightweight crack detection method and system based on machine vision. The method comprises three tasks of crack classification, segmentation and extraction quantification. Wherein a classification task is executed by a lightweight classification model, parameters and precision of the classification task are superior to those of a comparison model, a segmentation task does not need to train samples in advance, consumption of computing resources is greatly reduced, and extraction quantization operation is mainly based on a digital image processing technology, so that the whole method reaches a lightweight level, and use requirements of embedded equipment are met. Meanwhile, according to the continuous multi-task full-process detection method, on one hand, due to the fact that non-crack images are removed through classification, unnecessary crack segmentation can be avoided; and on the other hand, the crack image after secondary denoising and dodging is obviously more friendly to crack extraction quantization operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention proposes a multi-task lightweight crack detection method and system based on machine vision, which relate to the field of machine vision detection. Background Art

[0002] Over the past few decades, my country has witnessed a massive scale of infrastructure construction. Coupled with external environmental factors and loads, existing infrastructure can experience performance degradation due to various defects after long-term service. For example, the development of various cracks can reduce concrete structural rigidity and accelerate steel corrosion, leading to excessive deformation or even failure of components. Therefore, crack monitoring is a crucial aspect of civil engineering structural inspection and monitoring.

[0003] Traditional crack detection relies primarily on inspection vehicles, inspection stands, and other equipment platforms, conducted through manual visual inspection and the use of inspection instruments such as crack detectors. However, these methods suffer from low detection efficiency and limited coverage, and are easily limited by the subjective experience of engineering inspectors and the reach of equipment. This makes traditional inspection methods difficult to implement in areas where manual inspection is difficult, such as high-level areas of bridge piers and high-level sections of tunnel linings. Therefore, crack detection methods combined with artificial intelligence have been widely researched in recent years and have been applied to structures such as buildings, bridges, and road surfaces, demonstrating their engineering value.

[0004] With the continuous development of artificial intelligence (AI) technology, machine vision methods have been explored and applied in recent years to surface crack detection in engineering structures. These methods combine AI with optical imaging technology to automatically process and evaluate digital images captured by visual components. These methods offer advantages such as intelligence, non-destructiveness, non-contact capabilities, and wide coverage, and hold broad application prospects.

[0005] Specifically, a consumer-grade or industrial camera is used to capture an image of the structure (component). Then, based on an appropriate machine learning algorithm, crack conditions are intelligently identified and various parameters (such as length and width) of the detected cracks are calculated. However, due to the requirements for image accuracy and clarity, current acquisition equipment still primarily uses expensive professional and industrial cameras, which pose challenges such as high detection costs, portability, high operational requirements, and fragility. Furthermore, optical imaging is sensitive to environmental interference and has limited adaptability to varying lighting conditions. Recognition accuracy is significantly affected by fluctuations in lighting and image noise. Furthermore, most existing crack detection technologies are limited to single tasks, with relatively simple detection capabilities, targeting only specific stages of crack detection. Furthermore, with the rapid development of embedded devices in recent years, traditional detection methods that sacrifice computing resources for accuracy are not compatible with these devices, significantly limiting their application value. Summary of the Invention

[0006] In response to the shortcomings of the existing technology, the present invention provides a multi-task lightweight crack detection method and system based on machine vision, which is suitable for various lighting conditions and low shooting noise (noise point) background. It uses daily smartphones to capture the apparent crack characteristics of different structures (components), and then relies on deep neural networks and digital image processing algorithms to complete the multi-task full-process detection method of binary classification, image segmentation and extraction and quantification of cracks. Its lightweight nature supports deployment on edge devices.

[0007] The present invention proposes a multi-task lightweight crack detection method and system based on machine vision, which includes the following contents:

[0008] A multi-task lightweight crack detection method based on machine vision, characterized by comprising the following steps:

[0009] Step A: Build a crack sample library, design a lightweight classification model, and train the classification model;

[0010] Step B: Use a smartphone to sample the target structure on-site and perform pixel calibration and classification on the sampled data;

[0011] Step C: performing image segmentation on the filtered crack image to obtain a binary image of the crack background;

[0012] Step D: Extract the processed crack trajectory and quantify the crack length and width;

[0013] Furthermore, step A includes the following:

[0014] Step A1: Collect apparent crack image samples of different structures. The crack images include cross cracks, multiple parallel cracks, and network cracks under high noise and uneven lighting conditions. After cropping, use data augmentation techniques such as rotation to expand the samples. After manually labeling the sample categories, a crack sample library containing images is obtained.

[0015] Step A2: Design a lightweight classification network based on the improved MobileNetV3 using the PyTorch framework. Specifically, a widened structure is constructed to address the redundant structure of MobileNetV3. At the same time, an ELA local efficient attention mechanism is embedded in specific layers of the widened structure to focus on crack information.

[0016] Step A21: Set up an expanded structure for the lightweight classification network to resolve structural redundancy by reducing the number of network layers in the original MobileNetV3 network and expanding the number of network channels.

[0017] Step A22: Introduce the local efficient attention mechanism ELA, where the local efficient attention mechanism ELA takes the input crack feature map xc Average pooling, one-dimensional convolution, group normalization and Sigmoid function activation are performed in the X and Y directions respectively to obtain the horizontal attention y h and vertical attention y w ; The mathematical expression of the output Y of the local efficient attention mechanism ELA is as follows:

[0018] Y=x c ×y h ×y w ;

[0019] Step A23: Use the local efficient attention mechanism ELA to replace the SE attention module in the inverted residual structure of the original MobileNetV3 network and reduce the number of network parameters.

[0020] Furthermore, step A also includes the following:

[0021] Step A3: Train a lightweight classification network, where the network's training dataset includes the crack sample library containing images from Step A1; perform comparative experiments and ablation experiments based on the crack sample library to evaluate the network performance and the effectiveness of each component.

[0022] Step A3 includes the following sub-steps:

[0023] Step A31: randomly divide the dataset of the crack sample library into a training set, a validation set, and a test set;

[0024] Step A32: The cosine annealing learning rate decay strategy is used for training all networks.

[0025] Furthermore, step B includes the following:

[0026] Step B1: Set the focal length and pixel count of the smartphone according to the actual conditions at the construction site, and capture crack images or crack-free images of the structure to be tested under the on-site lighting conditions. Crack images include single crack images and complex multi-crack images.

[0027] Step B2: Input the images captured by the smartphone one by one or in batches into the trained lightweight classification network for binary classification to determine whether there are cracks. If cracks are found, the subsequent crack segmentation process continues; otherwise, the process ends.

[0028] Step B3: Use the scale factor method to simplify the pixel calibration process, calculate the scale factor, and complete the actual correction of the pixel size.

[0029] Furthermore, step C includes the following:

[0030] Step C11: To address the common lighting instability phenomenon of crack images, the crack image is uniformly processed by gamma transformation and logarithmic transformation in sequence to increase the grayscale difference between the crack and the shadow area;

[0031] Step C12: To address the noise problem in the image, bilateral filtering and Gaussian filtering are used to remove noise. The bilateral filtering retains the crack edge information while the Gaussian filtering blurs the noise.

[0032] Step C13: Based on the characteristics of "low grayscale" and "strong edges" of the cracks in the image, a specific "threshold segmentation + edge detection" fusion algorithm is used; threshold segmentation and edge detection operations are performed on the crack image, and then the intersection of the cracks processed by the two methods is taken to obtain a preliminary crack binary image.

[0033] Furthermore, step C also includes the following:

[0034] Step C2: Design a filter based on the triple differences of crack length, area, average grayscale and noise in the crack binary image;

[0035] Step C2 further includes the following:

[0036] Step C21: Set the thresholds Y1, Y2, and Y3 of length, area, and average grayscale respectively to further remove noise based on these three indicators;

[0037] Step C22: Compare the preliminary cracks obtained in step C13 with Y1, Y2, and Y3 in terms of the three indicators, and screen out cracks that meet the requirements of length greater than Y1, area greater than Y2, and average grayscale less than Y3. After secondary denoising, the crack binary image is obtained.

[0038] Furthermore, step D includes the following:

[0039] Step D11: performing a skeleton thinning operation on the crack binary image to obtain crack skeleton lines of the crack binary image;

[0040] Step D12: The crack skeleton line is regarded as a collection of multiple pixel coordinate points, and the DFS depth-first search method is used to find and extract the longest crack trajectory in the entire skeleton line.

[0041] Furthermore, step D also includes the following:

[0042] Step D2: After extracting the crack trajectory, the length and width of the crack are geometrically quantified;

[0043] Wherein step D2 also includes the following contents:

[0044] Step D21: for each pixel point of the extracted crack trajectory, calculate the sum of the Euclidean distances of each pixel point using the coordinate concept;

[0045] Step D22: Apply a distance transform to the crack binary image. The distance transform includes calculating the distance from each pixel in the crack to the nearest background pixel. When the distance from a pixel to the background reaches a maximum, the pixel is used as the center and the distance as the radius to locate the maximum inscribed circle. The maximum inscribed circle diameter is the maximum width. The distance d from each foreground pixel to the nearest background pixel in the binary image is calculated using the Euclidean distance. For example, the distance between two points (x1, y1) and (x2, y2) on a plane can be defined as:

[0046]

[0047] Step D23: Determine the area of the crack region by the pixel ratio of the crack region, and determine the direction of the crack path by the angle between the minimum circumscribed rectangle and the horizontal line.

[0048] According to a second aspect of the present invention, a multi-task lightweight crack detection system based on machine vision includes an electronic device, wherein the electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and is characterized in that when the processor executes the computer program, it implements a multi-task lightweight crack detection method based on machine vision as described in any one of the above contents of the present invention.

[0049] According to a third aspect of the present invention, a multi-task lightweight crack detection system based on machine vision includes a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and is characterized in that when the computer program is executed by a processor, it implements a multi-task lightweight crack detection method based on machine vision as described in any one of the above contents of the present invention.

[0050] The present invention has the following advantages:

[0051] The present invention proposes a multi-task lightweight crack detection method based on machine vision, which has the following advantages:

[0052] (1) The crack photography device is a common smartphone, which has low hardware cost, good portability and simple operation;

[0053] (2) The crack photography and detection process does not require the setting up of a special detection platform, does not require closed traffic, and has a high degree of automation, thus avoiding the problems of strong subjectivity and low efficiency of manual detection;

[0054] (3) It can stably detect under different lighting conditions and low noise backgrounds, which effectively solves the problems of traditional machine vision detection being sensitive to external lighting and having low accuracy under the influence of noise;

[0055] (4) The detection method includes multiple tasks such as classification, segmentation, extraction and quantification. The detection process is coherent and has a wider range of applications. The proposed method can achieve a lightweight level and can be combined with embedded devices to detect cracks. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 This is a flow chart of the multi-task lightweight crack detection method based on machine vision of the present invention.

[0057] Figure 2 Schematic diagram of the structure of the local efficient attention mechanism ELA of the present invention.

[0058] Figure 3 The lightweight classification network of the present invention utilizes the inverted residual structure improved by ELA.

[0059] Figure 4 The curve of the accuracy change of the lightweight classification network of the present invention on the training set and the validation set with the number of training rounds.

[0060] Figure 5 This is an explanatory diagram of the crack segmentation stage of the present invention.

[0061] Figure 6 This is a flowchart of the filter execution process of the present invention.

[0062] Figure 7 Schematic diagram of the DFS depth-first search method of the present invention.

[0063] Figure 8 This is a binary schematic diagram of the crack of the present invention.

[0064] Figure 9 This is a diagram showing the effect of the crack skeleton refinement operation of the present invention.

[0065] Figure 10 This is the crack trajectory extraction diagram of the present invention.

[0066] Figure 11 Schematic diagram of the maximum width of the crack of the present invention. DETAILED DESCRIPTION

[0067] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings.

[0068] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present application belongs.

[0069] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application; as used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form, and it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or their combinations.

[0070] The present invention proposes a multi-task lightweight crack detection method and system based on machine vision. Figure 1 This is a flow chart of a multi-task lightweight crack detection method based on machine vision provided by an embodiment of the present invention, wherein a multi-task lightweight crack detection method based on machine vision includes the following steps:

[0071] Step A: Build a crack sample library, design a lightweight classification model, and train the classification model;

[0072] Step B: Use a smartphone to sample the target structure on-site and perform pixel calibration and classification on the sampled data;

[0073] Step C: performing image segmentation on the filtered crack image to obtain a binary image of the crack background;

[0074] Step D: Extract the crack trajectory after C22 treatment and quantify the crack length and width;

[0075] Furthermore, step A includes the following:

[0076] Step A1: Collect samples of apparent crack images of different structures. The crack images include cross cracks, multiple parallel cracks, and network cracks under random environmental conditions such as high noise and uneven lighting. After cropping, use data augmentation techniques such as rotation to expand the samples. After manually labeling the sample categories, a crack sample library containing 5040 images is obtained.

[0077] Step A2: Design a lightweight classification network based on the improved MobileNetV3 using the PyTorch framework. Specifically, a widened structure is constructed to address the redundant structure of MobileNetV3. The ELA local efficient attention mechanism is embedded in specific layers of the widened structure to focus on crack information. This includes the following sub-steps:

[0078] Step A21: Set the network structure to the one shown in Table 1. Reduce the number of layers in the original MobileNetV3 network to address structural redundancy and increase the number of channels to learn richer crack information while maintaining network lightweightness. The inverted residual structure will be explained in A23.

[0079]

[0080]

[0081] Table 1 Overall structure of lightweight classification network

[0082] Step A22: Introduce the local efficient attention mechanism ELA, Figure 2 The diagram shows the structure of the local efficient attention mechanism in the embodiment of the present invention. c Average pooling, one-dimensional convolution, group normalization and Sigmoid function activation are performed in the X and Y directions respectively to obtain the horizontal attention y h and vertical attention y w The output Y of ELA is obtained by applying the following formula:

[0083] Y=x c ×y h ×y w ;

[0084] Step A23: Use ELA to replace the SE attention module in the original MobileNetV3 network inverted residual structure to further reduce the number of network parameters and enhance the feature extraction capability. The improved inverted residual structure is shown in Figure 3 .

[0085] Furthermore, step A also includes the following:

[0086] Step A3: Train the lightweight classification network using the crack sample library mentioned in A1. Perform comparative and ablation experiments to evaluate the network performance and the effectiveness of each component. This includes the following sub-steps:

[0087] Step A3 includes the following sub-steps:

[0088] Step A31: Randomly divide the data set in A1 into training set, validation set and test set in a ratio of 8:1:1.

[0089] Step A32: Set the total number of training rounds to 50, the initial learning rate to 0.001, and all networks are trained using a cosine annealing learning rate decay strategy. Model evaluation metrics include Accuracy, Precision, Recall, F1, and Params. Figure 4The accuracy curve of the lightweight classification network on the training set and validation set changes with the number of training rounds.

[0090] Step A33: This embodiment of the present invention selects SqueezeNet, ShuffleNet, and MobileNetV3 as comparison models to evaluate the classification performance of the proposed network. All network experimental settings remain consistent. The final performance comparison on the test set is shown in Table 2. The lightweight classification network of this embodiment of the present invention achieves the highest performance with the minimum number of parameters, with significant advantages across all metrics.

[0091] Model Name Accuracy Precision Recall F1 Params(M) SqueezeNet 0.972 0.972 0.972 0.972 0.724 ShuffleNet 0.988 0.988 0.988 0.988 1.256 MobileNetV3 0.988 0.992 0.984 0.988 1.520 Lightweight Classification Network 0.994 0.996 0.992 0.994 0.408

[0092] Table 2 Comparison of test sets of different models

[0093] Step A34: To further verify the effectiveness of each component of the proposed network, ablation evaluations were performed on the widening structure and ELA. The specific ablation test results are shown in Table 3, where Net_before represents the network structure before widening, and Net_noELA represents a variant of the lightweight classification network without ELA. Table 3 shows that the widening structure and ELA improve the proposed network across all four metrics.

[0094] Model Name Widening structure ELA Accuracy Precision Recall F1 Net_before 0.980 0.991 0.968 0.979 Net_noELA √ 0.986 0.992 0.980 0.986 Lightweight Classification Network √ √ 0.994 0.996 0.992 0.994

[0095] Table 3 Ablation experiments of lightweight classification networks

[0096] Furthermore, step B includes the following:

[0097] Step B1: Set the focal length and pixel count of the smartphone according to the actual conditions at the construction site, and capture crack images or crack-free images of the structure to be tested under the on-site lighting conditions. Crack images include single crack images and complex multi-crack images.

[0098] Step B2: Input the images captured by the smartphone one by one or in batches into the trained lightweight classification network for binary classification to determine whether there are cracks. If cracks are found, the subsequent crack segmentation process continues; otherwise, the process ends.

[0099] Step B3: Use the scale factor method to simplify the pixel calibration process, calculate the scale factor, and complete the actual correction of the pixel size.

[0100] Furthermore, step C includes the following:

[0101] Step C11: To address the common lighting instability phenomenon of crack images, the crack image is uniformly processed by gamma transformation and logarithmic transformation in sequence to increase the grayscale difference between the crack and the shadow area;

[0102] Step C12: To address the noise problem in the image, bilateral filtering and Gaussian filtering are used to remove noise. The bilateral filtering retains the crack edge information while the Gaussian filtering blurs the noise.

[0103] Step C13: Based on the characteristics of “low grayscale” and “strong edge” of cracks in the image, a specific “threshold segmentation + edge detection” fusion algorithm is used. Figure 5 The crack image is subjected to threshold segmentation and edge detection operations, and then the intersection of the cracks processed by these two methods is taken to finally obtain a preliminary crack binary image.

[0104] Furthermore, step C also includes the following:

[0105] Step C2: Design a filter based on the triple differences of crack length, area, average grayscale and noise in the crack binary image;

[0106] Step C2 further includes the following:

[0107] Step C21: Set the thresholds Y1, Y2, and Y3 of length, area, and average grayscale respectively to further remove noise based on these three indicators;

[0108] Step C22: Compare the preliminary crack areas obtained in C13 with Y1, Y2, and Y3 in terms of the three indicators, and select the ones that meet the requirements. Figure 6 The crack areas with different sizes are screened after secondary denoising to obtain a crack binary image with clearer morphology.

[0109] Furthermore, step D includes the following:

[0110] Step D11: Based on Python OpenCV Figure 8 The cracks are subjected to skeleton refinement operation to obtain Figure 9 The crack skeleton line is shown.

[0111] Step D12: Considering that the crack skeleton line has some branches that will interfere with the length calculation, the skeleton line is regarded as a collection of multiple pixel coordinate points, and the DFS depth-first search method is used to find and extract the longest continuous trajectory in the entire skeleton line. The principle is as follows Figure 7 As shown in the figure, the arrows connect the front and back points and assume that they are adjacent. Starting from point 1, three continuous paths will be traversed, 1 to 3, 1 to 5, and 1 to 8. The longest path algorithm logic is added to extract the longest continuous trajectory, i.e., the trajectory from 1 to 8. The final extracted crack trajectory is shown in Figure 10 shown.

[0112] Furthermore, step D also includes the following:

[0113] Step D2: After extracting the crack trajectory, the length and width of the crack are geometrically quantified;

[0114] Wherein step D2 also includes the following contents:

[0115] Step D21: In terms of crack length, for each adjacent pixel point on the extraction trajectory, the sum of the Euclidean distances is calculated using the coordinate concept.

[0116] Step D22: Crack width, Figure 8 The crack binary image uses distance transformation. Specifically, the distance from each pixel in the crack to the nearest background pixel is calculated. When the distance from a certain pixel to the background reaches the maximum value, this pixel is used as the center of the circle and this distance is used as the radius to locate the maximum inscribed circle. At this time, the diameter of the maximum inscribed circle is the maximum width. Figure 11 The distance d from each foreground pixel to the nearest background pixel in a binary image is calculated using the Euclidean distance. Taking two points (x1, y1) and (x2, y2) on a plane as an example, the distance can be defined as:

[0117]

[0118] Step D23: Crack area by Figure 8 The pixel ratio of the crack area is determined, and the crack path direction is determined by the angle between the minimum circumscribed rectangle and the horizontal line.

[0119] In summary, a multi-task lightweight crack detection system based on machine vision includes an electronic device, wherein the electronic device includes a memory, a processor, and a computer program stored in the memory and runnable on the processor, and is characterized in that when the processor executes the computer program, it implements a multi-task lightweight crack detection method based on machine vision as described in any one of the above contents mentioned in the present invention.

[0120] Among them, a multi-task lightweight crack detection system based on machine vision includes a computer-readable storage medium, and the computer-readable storage medium stores a computer program, characterized in that when the computer program is executed by a processor, it implements a multi-task lightweight crack detection method based on machine vision as described in any one of the above contents mentioned in the present invention.

[0121] The above are preferred embodiments of the present invention. Any changes made according to the technical solution of the present invention, as long as the resulting functions and effects do not exceed the scope of the technical solution of the present invention, shall fall within the scope of protection of the present invention.

Claims

1. A multi-task lightweight crack detection method based on machine vision, characterized in that: The following steps are involved: Step A: Build a crack sample library containing crack images, design a lightweight classification model and train the classification model; Step B: Use a smartphone to sample the target structure on-site and perform pixel calibration and classification on the sampled data; Step C: performing image segmentation on the filtered crack image to obtain a crack binary image; Step D: Extract the processed crack trajectory and quantify the crack length and width.

2. The multi-task lightweight crack detection method based on machine vision according to claim 1, characterized in that: Step A includes the following: Step A1: Samples of apparent crack images of different structures are collected, where the crack images include cross cracks, multiple parallel cracks, and network cracks under high noise and uneven lighting conditions. After cropping, the samples are expanded using data augmentation techniques such as rotation. After manually labeling the sample categories, a crack sample library containing crack images is obtained. Step A2: Design a lightweight classification network based on the improved MobileNetV3 using the PyTorch framework. Specifically, a widened structure is constructed to address the redundant structure of MobileNetV3. At the same time, an ELA local efficient attention mechanism is embedded in specific layers of the widened structure to focus on crack information. Step A21: Set up an expanded structure for the lightweight classification network to resolve structural redundancy by reducing the number of network layers in the original MobileNetV3 network and expanding the number of network channels. Step A22: Introduce the local efficient attention mechanism ELA, where the local efficient attention mechanism ELA takes the input crack feature map x c Average pooling, one-dimensional convolution, group normalization and Sigmoid function activation are performed in the X and Y directions respectively to obtain the horizontal attention y h and vertical attention y w ; The mathematical expression of the output Y of the local efficient attention mechanism ELA is as follows: Y=x c ×y h ×y w ; Step A23: Use the local efficient attention mechanism ELA to replace the SE attention module in the inverted residual structure of the original MobileNetV3 network and reduce the number of network parameters.

3. The multi-task lightweight crack detection method based on machine vision according to claim 2, characterized in that: Step A also includes the following: Step A3: Train a lightweight classification network, where the training dataset includes the crack sample library containing crack images from Step A1; perform comparative experiments and ablation experiments based on the crack sample library to evaluate the network performance and the effectiveness of each component. Step A3 includes the following sub-steps: Step A31: randomly divide the dataset of the crack sample library into a training set, a validation set, and a test set; Step A32: The cosine annealing learning rate decay strategy is used for training all networks.

4. The multi-task lightweight crack detection method based on machine vision according to claim 1, characterized in that: Step B includes the following: Step B1: Set the focal length and pixel count of the smartphone according to the actual conditions at the construction site, and capture crack images or crack-free images of the structure to be tested under the on-site lighting conditions. Crack images include single crack images and complex multi-crack images. Step B2: Input the crack images taken by the smartphone one by one or in batches into the trained lightweight classification network for binary classification to determine whether there are cracks; If cracks are identified, the subsequent crack segmentation process continues, otherwise it ends; Step B3: Use the scale factor method to simplify the pixel calibration process, calculate the scale factor, and complete the actual correction of the pixel size.

5. The multi-task lightweight crack detection method based on machine vision according to claim 1, characterized in that: Step C includes the following: Step C11: To address the common lighting instability phenomenon of crack images, the crack image is uniformly processed by gamma transformation and logarithmic transformation in sequence to increase the grayscale difference between the crack and the shadow area; Step C12: To address the noise problem in the image, bilateral filtering and Gaussian filtering are used to remove noise. The bilateral filtering retains the crack edge information while the Gaussian filtering blurs the noise. Step C13: Based on the characteristics of "low grayscale" and "strong edges" of cracks in the image, a specific "threshold segmentation + edge detection" fusion algorithm is used to perform threshold segmentation and edge detection on the crack image. The intersection of the cracks processed by the two algorithms is then taken to finally obtain a preliminary binary crack image.

6. The multi-task lightweight crack detection method based on machine vision according to claim 5, characterized in that: Step C also includes the following: Step C2: Design a filter based on the triple differences of crack length, area, average grayscale, and noise in the crack binary image. Step C2 also includes the following: Step C21: Set the thresholds Y1, Y2, and Y3 of length, area, and average grayscale respectively to further remove noise based on these three indicators; Step C22: Compare the preliminary cracks obtained in step C13 with Y1, Y2, and Y3 in terms of the three indicators, and screen out cracks that meet the requirements of length greater than Y1, area greater than Y2, and average grayscale less than Y3. After secondary denoising, the crack binary image is obtained.

7. The multi-task lightweight crack detection method based on machine vision according to claim 1, characterized in that: Step D includes the following: Step D11: performing a skeleton thinning operation on the crack binary image to obtain crack skeleton lines of the crack binary image; Step D12: The crack skeleton line is regarded as a collection of multiple pixel coordinate points, and the DFS depth-first search method is used to find and extract the longest crack trajectory in the entire skeleton line.

8. The multi-task lightweight crack detection method based on machine vision according to claim 7, characterized in that: Step D also includes the following: Step D2: After extracting the crack trajectory, the length and width of the crack are geometrically quantified. Step D2 also includes the following: Step D21: for each pixel point of the extracted crack trajectory, calculate the sum of the Euclidean distances of each pixel point using the coordinate concept; Step D22: Apply a distance transform to the crack binary image. The distance transform includes calculating the distance from each pixel in the crack to the nearest background pixel. When the distance from a pixel to the background reaches a maximum, the pixel is used as the center and the distance as the radius to locate the maximum inscribed circle. The maximum inscribed circle diameter is the maximum width. The distance d from each foreground pixel to the nearest background pixel in the binary image is calculated using the Euclidean distance. For example, the distance between two points (x1, y1) and (x2, y2) on a plane can be defined as: Step D23: Determine the area of the crack region by the pixel ratio of the crack region, and determine the direction of the crack path by the angle between the minimum circumscribed rectangle and the horizontal line.

9. A multi-task lightweight crack detection system based on machine vision, comprising an electronic device, wherein the electronic device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the multi-task lightweight crack detection method based on machine vision as described in any one of claims 1 to 8 is implemented.

10. A multi-task lightweight crack detection system based on machine vision, comprising a computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the multi-task lightweight crack detection method based on machine vision as claimed in any one of claims 1 to 8 is implemented.