Lightweight concrete crack detection method and device based on multi-dimensional attention module

CN117078624BActive Publication Date: 2026-09-08GUANGXI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311041937.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-18
Publication Date
2026-09-08
Estimated Expiration
2043-08-18

AI Technical Summary

Technical Problem

其目的旨在于通过提出的轻量化混凝土裂缝模型解决网络参数量大导致检测实时性不足及裂缝检测不准、漏检的问题,以满足实际工业部署和检测实时性需求的同时提高裂缝检测精度

Benefits of technology

[0046] (1) The present invention uses LCBS and LB modules, which can reduce the number of model parameters and computation, which is beneficial to deploy the model on embedded devices and mobile devices such as drones, and also helps to reduce crack detection delay and improve detection efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117078624B_ABST
    Figure CN117078624B_ABST
Patent Text Reader

Abstract

The application discloses a kind of lightweight concrete crack detection method and device based on multidimensional attention module, comprising the following steps: creating the training set and test set of concrete crack image;Based on deep learning, create the lightweight concrete crack detection model containing lightweight CBS feature extraction module, lightweight Bottleneck feature extraction module, multiscale feature extraction module, multidimensional attention module;According to training parameter, the training set is trained and is evaluated on test set according to model in division good;The crack in concrete image is detected by the lightweight concrete crack detection model obtained by training.The crack detection model obtained by the method has the characteristics of less parameter quantity and less required calculation amount, which is more conducive to deployment in mobile devices, wearable devices and other computing power, space limited devices, can effectively solve the problem of crack detection inaccuracy and missed detection, and improve the performance of concrete crack detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of image detection and recognition methods and computer vision, specifically to a lightweight concrete crack detection method and apparatus based on a multidimensional attention module. Background Technology

[0002] Concrete, as a crucial foundation component, is widely used in the construction of infrastructure such as bridges, tunnels, and roads. However, due to factors such as temperature differences, load, and inadequate maintenance, concrete structures are highly susceptible to cracking during their service life, leading to reduced load-bearing capacity and safety hazards. Therefore, in practical engineering, it is necessary to conduct regular inspections and safety assessments of concrete structures. Currently, however, the detection of concrete damage is mainly accomplished through manual inspections, which is inefficient, costly, and risky, potentially even endangering personal safety under extreme conditions. Image processing-based concrete crack detection can achieve more efficient and safer detection of concrete damage. Related research can be broadly divided into two stages: the traditional crack image detection stage and the deep learning-based crack detection stage.

[0003] Traditional crack image detection mainly relies on machine learning algorithms such as SVM and K-Means, which are highly dependent on manually extracted features. These features have weak representational capabilities and are greatly affected by the environment and complex texture backgrounds, resulting in low detection efficiency. With the development of big data and GPU technology, deep learning methods with powerful feature extraction capabilities have provided a new approach for concrete damage detection, ushering in the deep learning-based crack detection stage. Although many deep learning target detection models for concrete crack detection have been proposed, these studies also have certain limitations: First, they do not adequately consider the real-time performance of detection. When models with large parameters and computational costs are deployed on mobile devices and drones, they are limited by hardware conditions, easily leading to high latency and low detection efficiency. Second, there is the problem of inaccurate crack detection box sizes generated by the models, and the models are only suitable for situations where cracks are relatively obvious and background conditions are relatively simple. When cracks are not obvious, they are prone to missed detections. In addition, crack targets are generally more slender than other targets, but current models have not utilized these characteristics for judgment. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention proposes a lightweight concrete crack detection method and device based on a multi-dimensional attention module. The aim is to solve the problems of insufficient real-time detection, inaccurate crack detection, and missed detection caused by the large number of network parameters through the proposed lightweight concrete crack model, thereby improving crack detection accuracy while meeting the requirements of practical industrial deployment and real-time detection.

[0005] To achieve the above objectives, this invention provides a lightweight concrete crack detection method and apparatus based on a multidimensional attention module, comprising the following steps:

[0006] Step S1: Create a training set and a test set of concrete crack images;

[0007] Images of concrete cracks are acquired using drones or cameras, or obtained from public concrete crack image datasets; crack regions in the acquired images are manually labeled to construct a concrete crack image dataset, which is then divided into a training set X. train = {{X1}, ..., {X} n}} and test set X test = {{X1}, ..., {X} m}}, where n and m are the number of samples in the training set and the test set, respectively (n:m=7:3);

[0008] Step S2: Create a lightweight concrete crack detection model based on deep learning, which includes a lightweight CBS feature extraction module, a lightweight Bottleneck feature extraction module, a multi-scale feature extraction module, and a multi-dimensional attention module;

[0009] The lightweight concrete crack detection model is implemented using the deep learning library PyTorch. It is based on YOLOv5 and consists of three parts: the backbone, the neck, and the prediction layer. These parts are composed of a lightweight CBS feature extraction module (LCBS module), a lightweight Bottleneck feature extraction module (LB module), a multi-scale feature extraction module (MSF module), and a multi-dimensional attention module (MDA module).

[0010] Step S3: Train the model on the divided training set according to the training parameters and evaluate it on the test set;

[0011] The lightweight concrete crack detection model is trained on the training set by continuously reducing the value of the loss function, and then the training effect of the model is evaluated on the test set until the model converges and achieves a good detection effect on the test set, thus obtaining the lightweight concrete crack detection model.

[0012] Step S4: Detect cracks in concrete images using the trained lightweight concrete crack detection model;

[0013] The LCBS module mentioned in step S2 consists of a 3*3 depth separable convolutional layer, batch normalization, and SiLU activation function.

[0014] The LB module described in step S2 has different structures in the trunk and neck. The LB module in the trunk consists of two LCBS modules and one MDA module, as shown below:

[0015]

[0016] In the formula, X and F are the input and output feature maps, respectively; LCBS and MDA represent the feature maps input to the LCBS and MDA modules for calculation, respectively; and Add represents the addition of the feature maps. The LB module in the neck area consists of two LCBS modules, which are represented as follows:

[0017]

[0018] In the formula, X and F are the input and output feature maps, respectively, and LCBS indicates that the feature map is input into LCBS for calculation.

[0019] Furthermore, the MSF module described in step S2 will generate a crack feature map. Crack features are extracted using 1x1 convolutional layers, 3x3 convolutional layers, and 3x3 dilated convolutional layers with a dilation rate of 2, respectively. These layers are then concatenated to obtain the output feature map, which is represented as follows:

[0020]

[0021] In the formula, Conv1*1 and Conv3*3 represent 1*1 convolutional layers and 3*3 convolutional layers, respectively. This indicates a 3x3 dilated convolutional layer with a void ratio of 2. Indicates feature map connection operations, X, F cat These represent the feature maps of the input and output, respectively.

[0022] Furthermore, the MDA module described in step S2 simultaneously and losslessly computes the input feature map. Spatial attention (including height and height attention) and channel attention information are used to achieve this. The specific process is as follows:

[0023] To obtain feature maps Spatial attention information for width and height is used to divide the feature map into two directions, width and height, and then average pooling is performed simultaneously. This results in... Location and height The first The output features of each dimension are represented as follows:

[0024]

[0025]

[0026] The width and height attention feature maps are obtained as follows , The number of channels is These two feature maps are then fed into channels with a number of channels. A 1x1 convolutional layer is used, followed by batch normalization and ReLU activation of the output, and then each output is passed through a channel number of... The intermediate feature map is obtained after a 1x1 convolutional layer. , Finally, these two intermediate feature maps are fed into the Sigmoid activation function to calculate the attention information in the width and height directions. , The outputs are represented as follows:

[0027]

[0028]

[0029] in , This represents the Sigmoid function, BN represents batch normalization, and the four convolution operations are as follows: , , , ;

[0030] To obtain channel attention information, the input feature map is processed simultaneously with the calculation of spatial attention information. Perform global average pooling, its first The output feature of dimension is represented as:

[0031]

[0032] The channel attention feature map is obtained as follows The number of channels is Input the feature map into a channel with a number of channels. A 1x1 convolutional layer is then passed through a ReLU function for activation, followed by a pass through a channel number of... The 1x1 convolutional layer produces the intermediate feature map. Finally, the feature map is fed into the Sigmoid function to calculate the channel attention information. Its output is represented as:

[0033]

[0034] in For the Sigmoid function, , This represents the convolution operation; finally, the learned attention information in the width, height, and channel directions is multiplied together and then combined with the input feature map. Multiplication yields the output feature map. That is, for the output feature map , its first The output feature of dimension is represented as:

[0035]

[0036] This module enhances the ability to extract crack features through the methods described above.

[0037] Based on the same inventive concept, this invention also provides a lightweight concrete crack detection device based on a multidimensional attention module. The device consists of three versions of a lightweight concrete crack detection model, and the version of the model can be selected according to the parameter k.

[0038] Lightweight concrete crack detection models include:

[0039] The LCBS and LB modules are used for crack feature extraction and to reduce the inference time of lightweight concrete crack detection models.

[0040] The MSF module is used to enhance the ability of lightweight concrete crack detection models to extract features of cracks of different sizes.

[0041] The MDA module is used to reduce the risk of missed crack detection and enhance crack feature extraction capabilities.

[0042] The above four modules are encapsulated to obtain a lightweight concrete crack detection model, which is then deployed to an embedded platform to obtain a lightweight concrete crack detection device for concrete crack detection.

[0043] Based on the actual concrete crack detection scenario, the device can adjust parameter k to select different model versions. The value of k is 0, 1, or 2 to correspond to three model versions. The number of MSF, LCBS, LB, and MDA modules is different in different model versions.

[0044] When k=0, the number of MSF, LCBS, LB, and MDA modules in the model are 1, 30, 11, and 7, respectively; when k=1, the number of MSF, LCBS, LB, and MDA modules in the model are 1, 74, 33, and 21, respectively; and when k=2, the number of MSF, LCBS, LB, and MDA modules in the model are 1, 104, 44, and 28, respectively.

[0045] The present invention has the following beneficial effects:

[0046] (1) The present invention uses LCBS and LB modules, which can reduce the number of model parameters and computation, which is beneficial to deploy the model on embedded devices and mobile devices such as drones, and also helps to reduce crack detection delay and improve detection efficiency.

[0047] (2) The present invention uses the MSF module, which not only has a low number of parameters and is suitable for deployment on lightweight models, but also enhances the ability to extract features of cracks of different sizes, which is beneficial for the model to identify cracks of different sizes more accurately.

[0048] (3) This invention uses an MDA module, which not only includes spatial attention and channel attention simultaneously, but also calculates these two types of attention synchronously. This solves the problem that current mainstream attention modules only include a single type of attention, or calculate another type of attention based on one type of attention information, resulting in insufficient feature extraction. When calculating attention, this module uses convolutional layers with an equal number of channels, solving the problem that current mainstream attention modules reduce the dimensionality of attention channels, leading to the loss of attention information. This module can enhance the crack feature extraction capability, which is beneficial to reducing the problem of missed or false crack detections in the model.

[0049] (4) The lightweight concrete crack detection device proposed in this invention meets the real-time requirements of engineering deployment and application, while also reducing the configuration requirements of detection hardware and achieving a high accuracy rate in crack detection. Attached Figure Description

[0050] Figure 1 This is a flowchart of the lightweight concrete crack detection method and device based on a multidimensional attention module in this invention.

[0051] Figure 2 This is a structural diagram of a lightweight concrete crack detection model in an embodiment of the present invention;

[0052] Figure 3a , Figure 3b , Figure 3c These are structural diagrams of the three feature extraction modules proposed and used in the embodiments of the present invention: the LCBS module, the trunk LB module, and the neck LB module.

[0053] Figure 4 This is a structural diagram of the MSF module in an embodiment of the present invention;

[0054] Figure 5 This is a structural diagram of the MDA module in an embodiment of the present invention;

[0055] Figure 6This is a comparison of the crack detection performance of the lightweight concrete crack detection model with other mainstream target detection models in this embodiment of the invention. The white boxes in the ground truth represent the annotation boxes of cracks in the image, and the white boxes in the other images represent the detection boxes of cracks in the corresponding models. Detailed Implementation

[0056] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions of the present invention will be further described in detail below with reference to the accompanying drawings. It should be noted that the described examples are only intended to facilitate understanding and do not limit the present invention in any way.

[0057] like Figure 1 As shown, a lightweight concrete crack detection method based on a multidimensional attention module includes the following steps:

[0058] Step 101: Create training and testing sets for concrete crack images;

[0059] In this embodiment, the dataset used for training and evaluating the lightweight concrete crack detection model is the concrete crack dataset from the ZJUSYG crack dataset. This dataset was captured using a Canon EOS M10 camera and includes 1959 concrete crack images and corresponding labeled ground truth images. All images are RGB images with a resolution of 1000×1000. The concrete crack dataset is divided into a training set and a test set in a 7:3 ratio, with 1405 images in the training set and 554 images in the test set.

[0060] Step 102: Create a lightweight concrete crack detection model based on deep learning, which includes a lightweight CBS feature extraction module, a lightweight Bottleneck feature extraction module, a multi-scale feature extraction module, and a multi-dimensional attention module;

[0061] In this embodiment, the lightweight concrete crack detection model is based on YOLOv5 and consists of a lightweight CBS feature extraction module (LCBS module), a lightweight Bottleneck feature extraction module (LB module), a multi-scale feature extraction module (MSF module), and a multi-dimensional attention module (MDA module).

[0062] like Figure 2As shown, the lightweight concrete crack detection model consists of three parts: the backbone, the neck, and the prediction layer. The backbone is composed of LCBS modules, C3 modules, and Spatial Pyramid Pooling – Fast (SPPF) modules. The number of LB modules (n) in the four C3 modules is set to 1, 2, 3, and 1, respectively. The neck consists of LCBS modules and C3 modules, with the number of LB modules (n) in all four C3 modules set to 1. The prediction layer consists of three depth-wiseseparable convolutions (DWConv).

[0063] like Figure 3a As shown, the LCBS module consists of a 3*3 depth separable convolutional layer, batch normalization, and the SiLU activation function; the LB module has different structures in the backbone and neck, such as... Figure 3b As shown, the LB module in the backbone consists of two LCBS modules and one MDA module, represented as follows:

[0064]

[0065] In the formula, X and F are the input and output feature maps, respectively; LCBS and MDA represent the feature maps being input into the LCBS and MDA modules for calculation, respectively; and Add represents the addition of the feature maps. Figure 3c As shown, the LB module in the neck consists of two LCBS modules, represented as follows:

[0066]

[0067] In the formula, X and F are the input and output feature maps, respectively, and LCBS indicates that the feature map is input into LCBS for calculation.

[0068] like Figure 4 As shown, the MSF module will display the crack feature map. Crack features are extracted using 1x1 convolutional layers, 3x3 convolutional layers, and 3x3 dilated convolutional layers with a dilation rate of 2, respectively. These layers are then concatenated to obtain the output feature map, which is represented as follows:

[0069]

[0070] In the formula, Conv1*1 and Conv3*3 represent 1*1 convolutional layers and 3*3 convolutional layers, respectively. This indicates a 3x3 dilated convolutional layer with a void ratio of 2. Indicates feature map connection operations, X, F cat These represent the feature maps of the input and output, respectively.

[0071] like Figure 5 As shown, the MDA module computes the input feature map simultaneously and without loss. Spatial attention (including height and height attention) and channel attention information are used to achieve this. The specific process is as follows:

[0072] To obtain feature maps Spatial attention information for width and height is used to divide the feature map into two directions, width and height, and then average pooling is performed simultaneously. This results in... Location and height The first The output features of each dimension are represented as follows:

[0073]

[0074]

[0075] The width and height attention feature maps are obtained as follows , The number of channels is These two feature maps are then fed into channels with a number of channels. A 1x1 convolutional layer is used, followed by batch normalization and ReLU activation of the output, and then each output is passed through a channel number of... The intermediate feature map is obtained after a 1x1 convolutional layer. , Finally, these two intermediate feature maps are fed into the Sigmoid activation function to calculate the attention information in the width and height directions. , The outputs are represented as follows:

[0076]

[0077]

[0078] in , This represents the Sigmoid function, BN represents batch normalization, and the four convolution operations are as follows: , , , ;

[0079] To obtain channel attention information, the input feature map is processed simultaneously with the calculation of spatial attention information. Perform global average pooling, its first The output feature of dimension is represented as:

[0080]

[0081] The channel attention feature map is obtained as follows The number of channels is Input the feature map into a channel with a number of channels. A 1x1 convolutional layer is then passed through a ReLU function for activation, followed by a pass through a channel number of... The 1x1 convolutional layer produces the intermediate feature map. Finally, the feature map is fed into the Sigmoid function to calculate the channel attention information. Its output is represented as:

[0082]

[0083] in For the Sigmoid function, , This represents the convolution operation; finally, the learned attention information in the width, height, and channel directions is multiplied together and then combined with the input feature map. Multiplication yields the output feature map. That is, for the output feature map , its first The output feature of dimension is represented as:

[0084]

[0085] This module enhances the ability to extract crack features through the methods described above.

[0086] Step 103: Train the model on the divided training set according to the training parameters and evaluate it on the test set;

[0087] In this embodiment, model training and evaluation were performed using the PyTorch deep learning framework, with the operating system being Ubuntu 18.04.3 LTS, the CPU being an Intel(R) Xeon(R) Gold 6240, the memory being 32GB, and the GPU being a Tesla V100S. Model training parameters were set as follows: image size normalized to 640×640, using the Stochastic Gradient Descent (SGD) optimizer, an initial learning rate of 0.003, a learning rate momentum factor of 0.9, a batch size of 16, a weight decay rate of 0.0005, and a total of 300 training epochs. Based on the actual dataset size, and to prevent excessive oscillations at the beginning of model training that could hinder later training, a warm-up approach was adopted, with a warm-up momentum factor of 0.8 and 10 warm-up epochs.

[0088] To objectively evaluate the model's performance, the mean average precision (mAP) for each category, along with metrics such as the number of model parameters, model size, and computational cost, were used for evaluation. When the Intersection over Union (IoU) threshold was 0.5, the mean average precision was denoted as mAP@0.5. When the IoU threshold was set to 10 values ​​at equal intervals from 0.5 to 0.95, the average of these 10 mean precision values ​​was denoted as mAP@0.5:0.95.

[0089] The lightweight concrete crack detection model obtained after training was compared with mainstream object detection models such as YOLOv5s, SSD, YOLOv7-tiny, RetinaNet, EfficientDet, DDOD, and Faster R-CNN on the same concrete crack dataset. The comparison results are shown in Table 1, with the best results in bold.

[0090] Table 1 Performance comparison between different models

[0091] Model mAP@0.5 (%) mAP@0.5:0.95 (%) Number of parameters (M) Model size (MB) Computational cost (GFLOPs) Faster R-CNN 65.9 30.3 41.32 315 267.6 SSD 69.8 35.8 13.09 100 30.1 RetinaNet 67.8 37.9 32.20 245 254.4 EfficientDet 71.7 34.7 6.6 76.3 10.87 YOLOv5s 83.9 53.7 7.02 13.7 15.9 YOLOv7-tiny 80.7 51.1 6.01 11.7 13.2 DDOD 77.4 47.2 31.18 245.2 71.18 Corresponding model of the present invention 88.1 65.7 4.55 9.21 7.8

[0092] As can be seen from the table, the mAP@0.5 and mAP@0.5:0.95 of the model corresponding to this invention are 4.2% and 12% higher than the highest YOLOv5s model, respectively; the number of parameters and computational cost are 1.46M and 5.4 GFLOPs lower than the lowest YOLOv7-tiny model, respectively. Therefore, the proposed model has higher mAP@0.5 and mAP@0.5:0.95 than all other comparative models, and its number of parameters and computational cost are lower than these object detection models, and its model size is the smallest.

[0093] like Figure 6 As shown, to more intuitively demonstrate the comparison between the model of this invention and other object detection models, a representative concrete image is extracted from the dataset and detected using different object detection models. The boxes in the ground truth represent the bounding boxes for cracks in the image, while the boxes in the other images represent the detection boxes for cracks by the corresponding models. Figure 6 As can be seen from the ground truth: Faster R-CNN failed to detect the long crack on the right side of the image; SSD failed to detect the two small, inconspicuous cracks on the left side; RetinaNet, EfficientDet, and YOLOv7-tiny failed to detect the inconspicuous (leftmost) crack; although YOLOv5s can detect all the cracks, the detection boxes on the far left and far right of the image are much larger than the labeled boxes, resulting in limited detection accuracy; only the model corresponding to this invention and the DDOD model have detection boxes that match the labeled boxes relatively well.

[0094] Step 104: Detect cracks in concrete images using the trained lightweight concrete crack detection model.

[0095] The above describes in detail a concrete crack detection method based on a multidimensional attention module. Based on this method, a lightweight concrete crack detection device based on a multidimensional attention module is proposed. The structure and deployment process of the device are described in detail below.

[0096] The lightweight concrete crack detection device based on a multidimensional attention module provided in this embodiment of the invention consists of three versions of a lightweight concrete crack detection model, and the version of the model can be selected according to the parameter k.

[0097] Lightweight concrete crack detection models include:

[0098] The LCBS and LB modules are used for crack feature extraction and to reduce the inference time of lightweight concrete crack detection models.

[0099] The MSF module is used to enhance the ability of lightweight concrete crack detection models to extract features of cracks of different sizes.

[0100] The MDA module is used to reduce the risk of missed crack detection and enhance crack feature extraction capabilities.

[0101] Based on the actual detection scenario of concrete cracks, the device can adjust parameter k to select different model versions. The value of k is 0, 1, or 2 to correspond to three model versions.

[0102] When k=0, the number n of LB modules in the four C3 modules of the main trunk is set to 1, 2, 3 and 1 respectively, and the number n of LB modules in the four C3 modules of the neck is set to 1. That is, the number of MSF, LCBS, LB and MDA modules in the model are 1, 30, 11 and 7 respectively.

[0103] When k=1, the number n of LB modules in the four C3 modules of the main trunk is set to 3, 6, 9 and 3 respectively, and the number n of LB modules in the four C3 modules of the neck is set to 3. That is, the number of MSF, LCBS, LB and MDA modules in the model are 1, 74, 33 and 21 respectively.

[0104] When k=2, the number n of LB modules in the four C3 modules of the trunk is set to 4, 8, 12 and 4 respectively, and the number n of LB modules in the four C3 modules of the neck is set to 4. That is, the number of MSF, LCBS, LB and MDA modules in the model are 1, 104, 44 and 28 respectively.

[0105] In this embodiment, the embedded platform selected is the Raspberry Pi 4B, which integrates a quad-core ARM Cortex-A72 64-bit @ 1.5 GHz CPU and VideoCore VI @ 500MHz, supports WiFi connectivity and Gigabit Ethernet port, and can connect to the network during debugging. The operating system used is Linux.

[0106] Optionally, the deployment process includes the following steps D01 to D05:

[0107] Step D01: Install the official CSI interface camera, which uses an OV5647 module, a fixed-focus lens, supports 5 megapixels, and a 160-degree wide-angle view.

[0108] Step D02: Download the official Raspberry Pi system image file. Here, we choose to download Raspberry Pi OS with desktop.

[0109] Step D03: Format the SD card. Use SD Card Formatter software. After opening, it will automatically find the memory card. Click Format to format the SD card.

[0110] Step D04: Download Raspberry Pi Imager from the Raspberry Pi website and select the system image file downloaded in step D01 to start burning to the SD card;

[0111] Step D05: Configure the deployment environment, install relevant dependencies (Python environment, OpenCV, PyTorch and PyTorch related dependency packages), transfer the lightweight concrete crack detection model to the SD card, and run the model to obtain a lightweight concrete crack detection device based on a multidimensional attention module.

[0112] Furthermore, in step D05, the Python environment needs to be upgraded from the default version 2.7 to version 3.9; PyTorch needs to have the CPU version installed; the lightweight concrete crack detection model should be transferred to the SD card using WinSCP software; the lightweight concrete crack detection model should include three versions, corresponding to three different lightweight concrete crack detection models when the parameter k=0, 1, and 2 respectively.

[0113] The foregoing description of specific exemplary embodiments of the present invention is for illustrative and explanatory purposes. These descriptions are not intended to limit the invention to the precise forms disclosed, and corresponding changes in form and detail may be made based on the steps described above, further enabling those skilled in the art to implement various embodiments or make various changes and selections using the invention. The scope of the invention is intended to be defined by the claims and their equivalents.

Claims

1. A lightweight concrete crack detection method based on a multidimensional attention module, characterized in that, Includes the following steps: Step S1: Create a training set and a test set of concrete crack images; Use drones or cameras to capture images of concrete cracks, or obtain images of concrete cracks from public datasets of concrete crack images. The cracked areas in the acquired images were manually annotated to construct a concrete crack image dataset, which was then divided into a training set and a test set in a 7:3 ratio. Step S2: Create a lightweight concrete crack detection model based on deep learning, which includes a lightweight CBS feature extraction module, a lightweight Bottleneck feature extraction module, a multi-scale feature extraction module, and a multi-dimensional attention module; The lightweight concrete crack detection model is implemented using the deep learning library PyTorch. It is based on YOLOv5 and consists of three parts: the backbone, the neck, and the prediction layer. These parts are composed of a lightweight CBS feature extraction module, a lightweight Bottleneck feature extraction module, a multi-scale feature extraction module, and a multi-dimensional attention module. Step S3: Train the model on the divided training set according to the training parameters and evaluate it on the test set; The lightweight concrete crack detection model is trained on the training set by continuously reducing the value of the loss function, and then the training effect of the model is evaluated on the test set until the model converges and achieves a good detection effect on the test set, thus obtaining the lightweight concrete crack detection model. Step S4: Detect cracks in concrete images using the trained lightweight concrete crack detection model; The CBS feature extraction module in step S2 consists of a 3*3 depth separable convolutional layer, batch normalization, and SiLU activation function. The lightweight Bottleneck feature extraction module described in step S2 has different structures in the main trunk and neck. The lightweight Bottleneck feature extraction module in the main trunk consists of two CBS feature extraction modules and a multi-dimensional attention module, as shown below: In the formula, X and F are the input and output feature maps, respectively; LCBS and MDA represent the input of the feature maps to the CBS feature extraction module and the multidimensional attention module for calculation, respectively; and Add represents the addition of the feature maps. The lightweight Bottleneck feature extraction module in the neck area consists of two CBS feature extraction modules, which are represented as follows: In the formula, X and F are the input and output feature maps, respectively, and LCBS indicates that the feature map is input into the CBS feature extraction module for calculation; The multi-scale feature extraction module in step S2 extracts the crack feature map. Crack features are extracted using 1x1 convolutional layers, 3x3 convolutional layers, and 3x3 dilated convolutional layers with a dilation rate of 2, respectively. These layers are then concatenated to obtain the output feature map, which is represented as follows: In the formula, Conv1*1 and Conv3*3 represent 1*1 convolutional layers and 3*3 convolutional layers, respectively. This indicates a 3x3 dilated convolutional layer with a void ratio of 2. Indicates feature map connection operations, X, F cat These represent the input and output feature maps, respectively. The multidimensional attention module described in step S2 computes the input feature map simultaneously and without loss. This is achieved using spatial attention and channel attention information, and the specific process is as follows: To obtain feature maps Spatial attention information for width and height is used to divide the feature map into two directions, width and height, and then average pooling is performed simultaneously. This results in... Location and height The first The output features of each dimension are represented as follows: The width and height attention feature maps are obtained as follows , The number of channels is These two feature maps are then fed into channels with a number of channels. A 1x1 convolutional layer is used, followed by batch normalization and ReLU activation of the output, and then each output is passed through a channel number of... The intermediate feature map is obtained after a 1x1 convolutional layer. , Finally, these two intermediate feature maps are fed into the Sigmoid activation function to calculate the attention information in the width and height directions. , The outputs are represented as follows: in , The sigmoid function is represented by , BN represents batch normalization, and the four convolution operations are as follows: , , , ; To obtain channel attention information, the input feature map is processed simultaneously with the calculation of spatial attention information. Perform global average pooling, its first The output feature of dimension is represented as: The channel attention feature map is obtained as follows The number of channels is Input the feature map into a channel with a number of channels. A 1x1 convolutional layer is then passed through a ReLU function for activation, followed by a pass through a channel number of... The 1x1 convolutional layer produces the intermediate feature map. Finally, the feature map is fed into the Sigmoid function to calculate the channel attention information. Its output is represented as: in For the Sigmoid function, , This represents the convolution operation; finally, the learned attention information in the width, height, and channel directions is multiplied together and then combined with the input feature map. Multiplication yields the output feature map. That is, for the output feature map , its first The output feature of dimension is represented as: This module enhances the ability to extract crack features through the methods described above.

2. A lightweight concrete crack detection device based on a multidimensional attention module, characterized in that, The device consists of three versions of lightweight concrete crack detection models, and the version of the model can be selected according to parameter k. Lightweight concrete crack detection models include: The CBS feature extraction module and the lightweight Bottleneck feature extraction module are used for crack feature extraction and to reduce the inference time of the lightweight concrete crack detection model. A multi-scale feature extraction module is used to enhance the lightweight concrete crack detection model's ability to extract features of cracks of different sizes. A multi-dimensional attention module is used to reduce the risk of missed crack detection and enhance crack feature extraction capabilities; The above four modules are encapsulated to obtain a lightweight concrete crack detection model, which is then deployed to an embedded platform to obtain a lightweight concrete crack detection device for concrete crack detection. Based on the actual concrete crack detection scenario, the device can adjust parameter k to select different model versions. The value of k is 0, 1, or 2 to correspond to three model versions. The number of multi-scale feature extraction modules, CBS feature extraction modules, lightweight Bottleneck feature extraction modules, and multi-dimensional attention modules varies in different model versions. When k=0, the number of multi-scale feature extraction modules, CBS feature extraction modules, lightweight Bottleneck feature extraction modules, and multi-dimensional attention modules in the model are 1, 30, 11, and 7, respectively; when k=1, the number of multi-scale feature extraction modules, CBS feature extraction modules, lightweight Bottleneck feature extraction modules, and multi-dimensional attention modules in the model are 1, 74, 33, and 21, respectively; when k=2, the number of multi-scale feature extraction modules, CBS feature extraction modules, lightweight Bottleneck feature extraction modules, and multi-dimensional attention modules in the model are 1, 104, 44, and 28, respectively.