Tunnel lining crack detection method and system based on improved YOLO model
By introducing the expanded residual network DWR, deformable convolution and channel-space dual attention mechanism, and Inner-CIoU loss function into the YOLO model, the problems of missed detection and false detection in tunnel lining crack detection are solved, and efficient and accurate multi-scale crack detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA RAILWAY FIRST SURVEY & DESIGN INST GRP
- Filing Date
- 2026-02-03
- Publication Date
- 2026-06-23
AI Technical Summary
Existing tunnel lining crack detection methods based on the YOLO model are prone to missed detections and false detections in complex tunnel environments, and it is difficult to improve the detection accuracy and robustness of multi-scale and fuzzy cracks while maintaining high-speed detection.
An improved YOLO model is constructed by introducing an expanded residual network DWR into the backbone network, a deformable convolution and channel-space dual attention mechanism into the head network, optimizing the bounding box regression loss function, and using the Inner-CIoU loss function to calculate the bounding box regression loss.
It significantly improves detection accuracy, enhances multi-scale detection capabilities, reduces false negative and false positive rates, and maintains the model's lightweight and real-time performance, adapting to interference factors in the complex environment inside the tunnel.
Smart Images

Figure CN122265150A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent detection technology for tunnel engineering, specifically to a method and system for detecting tunnel lining cracks based on an improved YOLO model. Background Technology
[0002] Tunnel lining cracks are one of the major defects threatening the safety and durability of tunnel structures. Traditional detection methods mainly rely on manual inspection, which is inefficient, subjective, and prone to missed detections at high locations. With technological advancements, automatic detection methods based on digital image processing have been proposed. However, these methods typically rely on manually designed features (such as grayscale and gradients), resulting in poor robustness and high false positive and false negative rates when faced with complex backgrounds, uneven lighting, and noise interference from equipment cables within the tunnel.
[0003] In recent years, deep learning-based object detection algorithms, especially the YOLO series models, have shown great potential in crack detection tasks due to their high detection speed. However, directly applying the general YOLO model to tunnel lining crack detection still faces the following serious challenges:
[0004] (1) Scale sensitivity problem: The lining cracks are large in length but extremely small in width, which are typical "small targets". The conventional convolution operation of the YOLO target detection model is prone to losing the semantic information of these small cracks during feature extraction, resulting in missed detection.
[0005] (2) Problem of morphological complexity: Cracks have various shapes, including linear, net-like, and bifurcated shapes, and their features are not obvious and their edges are blurred. Standard models are difficult to accurately depict such irregular and low-contrast features, and they are easily confused with construction joints, water stains and other interference.
[0006] (3) Environmental interference problem: The lighting inside the tunnel is dim and uneven, and there is a lot of background noise similar to the crack features, which puts extremely high demands on the model's feature discrimination ability.
[0007] While existing technologies have improved the YOLO target detection model for crack detection, most improvements are relatively simple, or significantly increase model complexity and computational cost while improving accuracy, making it difficult to achieve efficient real-time detection in practical engineering. Therefore, there is an urgent need for a new method that can significantly improve the accuracy and robustness of multi-scale, fuzzy crack detection while maintaining high-speed detection. Summary of the Invention
[0008] This invention provides a method and system for detecting tunnel lining cracks based on an improved YOLO model, in order to solve the problems of missed and false detection of lining cracks in complex tunnel environments.
[0009] According to a first aspect, one embodiment provides a method for detecting tunnel lining cracks based on an improved YOLO model, the method comprising:
[0010] A dataset of images of tunnel lining cracks was constructed and divided into training, validation and test sets.
[0011] A tunnel lining crack detection model based on an improved YOLO model is constructed. The improved YOLO model includes introducing an expanded residual network (DWR) into the feature extraction module of the backbone network to enhance the feature extraction capability of tunnel lining cracks; introducing deformable convolution and channel-space dual attention mechanism into the detection head network to achieve adaptive focusing on the crack target region and suppress background noise; and optimizing the bounding box regression loss function by using the Inner-CIoU loss function to calculate the bounding box regression loss.
[0012] The training set, validation set, and test set were used to train, validate, and test the tunnel lining crack detection model based on the improved YOLO model.
[0013] The images of tunnel lining cracks to be detected are input into a tunnel lining crack detection model trained based on an improved YOLO model to obtain crack identification results.
[0014] Furthermore, a dataset of tunnel lining crack images was constructed and divided into training, validation, and test sets, specifically including:
[0015] Original images of tunnel lining cracks were collected, covering different lining types, various lighting conditions, and complex background scenes, to obtain a dataset of original images of tunnel lining cracks.
[0016] The cracks in the original image are manually annotated to generate corresponding bounding box label files;
[0017] Data enhancement processing is performed on the original image, including at least one of random rotation, random cropping, brightness adjustment, and contrast adjustment;
[0018] The processed image set is divided into training set, validation set and test set according to a preset ratio.
[0019] Furthermore, an extended residual network (DWR) is introduced into the feature extraction module of the backbone network to enhance the feature extraction capability for tunnel lining cracks. Specifically, this includes:
[0020] The feature extraction module of the backbone network is replaced with a feature extraction module embedded with DWR, and the feature extraction module embedded with DWR specifically includes:
[0021] First, a 1×1 convolutional layer is used to adjust the channels of the input feature map to C1;
[0022] Next, the split method is used to divide the channel-adjusted feature map into two parts. Then, these two feature maps are processed by n concatenated Bottleneck_DWRSeg modules. Each Bottleneck_DWRSeg module contains a standard 1×1 convolutional layer and a 1×1 convolutional layer with DWR module. Multi-scale feature extraction and residual connections enhance the diversity and richness of features.
[0023] The processed feature map is concatenated with the original feature map, and then the feature is fused through the last 1×1 convolutional layer to finally output the feature map.
[0024] Furthermore, the DWR module includes multiple parallel convolutional kernels with different dilation rates, which are used to extract features from different receptive fields. The output feature maps of the multiple convolutional kernels are concatenated along the channel dimension and then added to the input features through residual connections to obtain the output of the DWR module.
[0025] Furthermore, a deformable convolution and channel-space dual attention mechanism are introduced into the detection head network to achieve adaptive focusing on the crack target region and suppress background noise. Specifically, this includes:
[0026] Replace all the standard 3×3 convolutional layers used for classification and regression branches in the Head of the detection head network with RFAConv layers;
[0027] The RFAConv layer is used to first obtain global context information through average pooling, and then generate a receptive field attention weight map through 1×1 convolution and Softmax function. The corresponding weight map is used to weight the input feature map, so that the model can adaptively focus on the crack target region while suppressing background noise.
[0028] Each RFAConv layer is followed by a batch normalization layer and a ReLU activation function to enhance the model's nonlinear expressive power.
[0029] Furthermore, the calculation expression for the RFAConv layer is as follows:
[0030]
[0031] In the formula, S represents the softmax activation function; AP represents the average pooling downsampling layer, used to receive high-dimensional features from the upper layer; g 1×1 It is a 1×1 convolution; k represents the scale factor of the convolution window; F UThis represents the final weighted feature output; at each scale, average pooling is used to extract the global feature vector of the corresponding layer, and the corresponding receptive field attention weight A is generated through the softmax function. rf This is used to emphasize key regions; meanwhile, the characteristic response at the corresponding scale is denoted as R. rf This represents the important feature information retained within a specific receptive field; finally, multi-scale feature output is obtained through weighted fusion.
[0032] Furthermore, the bounding box regression loss function is optimized by using the Inner-CIoU loss function to calculate the bounding box regression loss, specifically including:
[0033] A scaling factor is introduced, and an auxiliary box is generated from both the original predicted box and the ground truth box based on the scaling factor.
[0034] The Inner-CIoU loss function is used to calculate the bounding box regression loss. By introducing auxiliary boxes to form double bounding box constraints, the localization accuracy of crack targets is improved. Specifically, this includes:
[0035] A scaling factor is introduced, and an auxiliary box is generated from both the original predicted box and the ground truth box based on the scaling factor.
[0036] The formula for calculating the Inner-CIoU loss function is as follows:
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043] Among them, S ratio B is the scaling factor; l B is the predicted left boundary of the bounding box. r B is the right boundary of the predicted bounding box. t For the upper boundary of the predicted bounding box, B b The lower boundary of the predicted bounding box; x c y is the horizontal coordinate of the center of the prediction box; c Here, is the vertical coordinate of the center of the prediction box; w is the width of the prediction box; h is the height of the prediction box; B r gt B represents the left boundary of the true bounding box. l gtB represents the right boundary of the true bounding box. b gt B is the lower boundary of the true bounding box. b gt The lower boundary of the true bounding box; I nter U is the area of the intersection of the two auxiliary boxes. nion L is the area of the union of the two auxiliary boxes; IOU inner For the IoU loss of the auxiliary bounding box, L CIOU For standard CIoU loss; L IOU For the original IoU loss; L inner-CIOU The loss function is Inner-CIoU.
[0044] Furthermore, the training set, validation set, and test set are used to train, validate, and test the tunnel lining crack detection model based on the improved YOLO model, specifically including:
[0045] The optimizer used for model training is AdamW, and the learning rate is decayed using a cosine annealing strategy. Accuracy, recall, and mean precision are used as performance evaluation metrics during the training process.
[0046] According to a second aspect, one embodiment provides a tunnel lining crack detection system based on an improved YOLO model, the system comprising:
[0047] The dataset building module is used to construct a dataset of tunnel lining crack images and divide it into training, validation and test sets;
[0048] The model building module is used to construct a tunnel lining crack detection model based on an improved YOLO model. The improved YOLO model includes introducing an expanded residual network (DWR) into the feature extraction module of the backbone network to enhance the feature extraction capability of tunnel lining cracks; introducing deformable convolution and channel-space dual attention mechanisms into the detection head network to achieve adaptive focusing on the crack target region and suppress background noise; and optimizing the bounding box regression loss function by using the Inner-CIoU loss function to calculate the bounding box regression loss.
[0049] The model training module is used to train, validate, and test the tunnel lining crack detection model based on the improved YOLO model using the training set, validation set, and test set.
[0050] The crack detection module is used to input images of tunnel lining cracks to be detected into a trained tunnel lining crack detection model based on an improved YOLO model to obtain crack identification results.
[0051] According to a third aspect, one embodiment provides an electronic device, the device comprising: a processor and a memory;
[0052] The memory is used to store one or more program instructions;
[0053] The processor is configured to run one or more program instructions to perform the steps of a tunnel lining crack detection method based on an improved YOLO model as described in any of the preceding claims.
[0054] According to a fourth aspect, one embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of a tunnel lining crack detection method based on an improved YOLO model as described in any of the preceding claims.
[0055] This invention provides a method and system for detecting tunnel lining cracks based on an improved YOLO model, which has the following advantages:
[0056] (1) Significantly improved detection accuracy: Through the synergistic effect of the three improvements C2f-DWR, RFA-Head and Inner-CIOU, the present invention improves the accuracy (P) by 5.7%, mAP50 by 4.6% and mAP50-95 by 4.0% on the tunnel lining crack dataset compared with the original YOLO model, effectively reducing missed detections and false detections.
[0057] (2) Enhanced multi-scale detection capability: The multi-dilation rate convolution of the C2f-DWR module and the dynamic receptive field attention mechanism of RFA-Head enable the model to effectively capture both large-scale cracks and minute cracks that are easily missed, making it more adaptable to targets of different scales.
[0058] (3) The model is lightweight and efficient: The improved scheme is carefully designed. While significantly improving performance, the number of model parameters only increases from 3.10M to 4.14M, and the computational load (GFLOPs) increases from 8.1G to 9.1G. The increase is controllable and still meets the real-time requirements of long-distance, large-scale, and rapid detection of tunnels.
[0059] (4) Excellent robustness: The present invention has a stronger resistance to common interference factors in tunnels such as low light, high noise, and complex background. The model is stable in actual complex environments and has high engineering practical value. Attached Figure Description
[0060] Figure 1 A flowchart illustrating a method for detecting tunnel lining cracks based on an improved YOLO model, as provided in one embodiment of the present invention;
[0061] Figure 2A schematic diagram of the overall network architecture of the DRI-YOLO model in a tunnel lining crack detection method based on an improved YOLO model provided in an embodiment of the present invention;
[0062] Figure 3 A detailed structural diagram of the C2f-DWR module in a tunnel lining crack detection method based on an improved YOLO model provided in an embodiment of the present invention;
[0063] Figure 4 A schematic diagram illustrating the working principle of the RFAConv layer in a tunnel lining crack detection method based on an improved YOLO model, provided in an embodiment of the present invention;
[0064] Figure 5 This is a schematic diagram of the RFA-Head module in a tunnel lining crack detection method based on an improved YOLO model, provided in one embodiment of the present invention.
[0065] Figure 6 This is a geometrical schematic diagram of the Inner-CIoU loss function in a tunnel lining crack detection method based on an improved YOLO model, provided as an embodiment of the present invention.
[0066] Figure 7 A comparison of PR curves in a tunnel lining crack detection method based on an improved YOLO model provided in one embodiment of the present invention;
[0067] Figure 8 This invention provides a comparison of model performance in a tunnel lining crack detection method based on an improved YOLO model, as an embodiment of the present invention. Detailed Implementation
[0068] The present invention will now be described in further detail with reference to specific embodiments and accompanying drawings. Similar elements in different embodiments are referred to by associated similar element reference numerals. In the following embodiments, many details are described to facilitate a better understanding of the invention. However, those skilled in the art will readily recognize that some features may be omitted in different situations, or may be replaced by other elements, materials, or methods. In some cases, certain operations related to the present invention are not shown or described in the specification. This is to avoid obscuring the core parts of the invention with excessive description. For those skilled in the art, detailed description of these related operations is not necessary; they can fully understand the related operations based on the description in the specification and general technical knowledge in the art.
[0069] Furthermore, the features, operations, or characteristics described in the specification can be combined in any suitable manner to form various embodiments. At the same time, the steps or actions in the method description can be rearranged or adjusted in a manner obvious to those skilled in the art. Therefore, the various orders in the specification and drawings are only for the clear description of a particular embodiment and do not imply a necessary order, unless otherwise stated that a particular order must be followed.
[0070] The first embodiment of this invention provides a tunnel lining crack detection method based on an improved YOLO model. Its core lies in three collaborative improvements to the baseline YOLO model (including but not limited to YOLOv8 to YOLOv12 and their derivative architectures): a feature extraction module, a detection head module, and a loss function. First, a C2f-DWR module is designed based on Dilated Wavelet Residual (DWR) to enable the backbone network to accurately perceive the detailed edge features of complex cracks. Then, considering the large scale variation of cracks in the lining structure, a lining crack detection head, RFAHead, is designed based on Receptive Field Attention (RFA) to further enhance the ability to capture cracks of different scales. Finally, an Inner-CIOU loss function is introduced to improve the bounding box regression loss and enhance the model's detection performance for unevenly distributed cracks of different scales. The following section combines... Figure 1 Please provide a detailed explanation.
[0071] like Figure 1 As shown, in step S100, a dataset of tunnel lining crack images is constructed and divided into a training set, a validation set, and a test set.
[0072] The above steps specifically include:
[0073] S110 collected actual image data of multiple railway and highway tunnels in China, constructing a dataset containing 2,000 original images. This dataset covers scenes with different lining types, various lighting conditions (strong light, weak light, backlight), and complex backgrounds (with cables, stains, construction joints, etc.).
[0074] S120: Manually annotate the cracks in all images to generate corresponding bounding box label files.
[0075] S130, to enhance the model's generalization ability, performs data augmentation operations on the original images, including random rotation (±15°), random cropping, brightness / contrast adjustment, etc., and finally expands it into a dataset of 4000 512×512 images, which are divided into training set, validation set and test set in a 6:2:2 ratio.
[0076] like Figure 1As shown, in step S200, the model building module is used to build a tunnel lining crack detection model based on the improved YOLO model. The improved YOLO model includes introducing an expanded residual network DWR into the feature extraction module of the backbone network to enhance the feature extraction capability of tunnel lining cracks; introducing deformable convolution and channel-space dual attention mechanism into the detection head network to achieve adaptive focusing on the crack target area and suppress background noise; and optimizing the bounding box regression loss function, using the Inner-CIoU loss function to calculate the bounding box regression loss.
[0077] The above steps specifically include:
[0078] S210, In this embodiment, the lightweight YOLOv8n is selected as the basic model framework. This model mainly consists of four parts: an input layer, a backbone network, a neck network, and a head. The backbone network is responsible for initial feature extraction, the neck network (PANet structure) is responsible for multi-scale feature fusion, and the head is responsible for final classification and localization prediction.
[0079] This embodiment makes three collaborative improvements to the baseline YOLOv8n model, including the feature extraction module, the detection head module, and the loss function, resulting in the DRI-YOLO model. The overall architecture is as follows: Figure 2 As shown.
[0080] S220, Improved Backbone Feature Extraction Capability
[0081] An improvement is made to the feature extraction module C2f in the backbone network, designing a C2f-DWR module (i.e., a feature extraction module embedding DWR). The specific implementation is as follows:
[0082] a) Replace the Bottleneck unit in the C2f module with the Bottleneck_DWRSeg unit.
[0083] b) In the Bottleneck_DWRSeg unit, a DWR (dilated residual) structure is introduced. This structure uses three 3×3 convolutional kernels with dilation rates of 1, 3, and 5 in parallel to extract features from different receptive fields.
[0084] c) Concatenate the output feature maps of three convolutional layers with different dilation rates along the channel dimension to fuse multi-scale spatial information.
[0085] d) The concatenated features are added to the input features through a shortcut connection to alleviate the gradient vanishing problem and preserve the original information.
[0086] e) In this embodiment, only the deep C2f modules in the backbone network are replaced with C2f-DWR modules to improve performance while avoiding excessive computational burden.
[0087] See the detailed structural diagram of the C2f-DWR module. Figure 3 The processing procedure is as follows: First, the channels of the input feature map are adjusted to C1 using a 1×1 convolutional layer. Then, the split method is used to divide the channel-adjusted feature map into two parts. Subsequently, these two parts of the feature map are processed by n cascaded Bottleneck_DWRSeg modules. Each Bottleneck_DWRSeg module contains a standard 1×1 convolutional layer and a 1×1 convolutional layer with a DWR module. Multi-scale feature extraction and residual connections enhance the diversity and richness of features. The processed feature map is then concatenated with the original feature map, and feature fusion is performed through a final 1×1 convolutional layer to finally output the feature map.
[0088] The DWR module includes multiple parallel convolutional kernels with different dilation rates, which are used to extract features from different receptive fields. The output feature maps of the multiple convolutional kernels are concatenated along the channel dimension and then added to the input features through residual connections to obtain the output of the DWR module.
[0089] In this embodiment, the DWR module uses 3×3 convolutional kernels with dilation rates of 1, 3, and 5, respectively, to extract features across different receptive fields. By concatenating the output feature maps of convolutional layers with different dilation rates, the DWR network can effectively fuse multi-scale information, enhancing the diversity and richness of features.
[0090] S230, improved multi-scale sensing capability of the detection head:
[0091] The detection head was redesigned, and an RFA-Head was constructed. RFAConv integrates deformable convolution and channel-space dual attention mechanisms, and adopts a dynamic dilation rate adjustment strategy and feature saliency weighting method to enable the model to adaptively focus on key symptom regions while effectively reducing the computational cost of the head. The specific implementation method is as follows:
[0092] a) Replace all the standard 3×3 convolutional layers used for classification and regression branches in the original detection head with RFAConv (Receptive Field Attention Convolution) layers.
[0093] b) The core of the RFAConv layer is to combine deformable convolution with a channel-space dual attention mechanism.
[0094] c) Its calculation process first obtains global context information through average pooling (AvgPool), and then generates a receptive field attention weight map (Arf) through 1×1 convolution and the Softmax function.
[0095] d) This weight map is used to weight the input feature map, enabling the model to adaptively focus on key symptom areas such as cracks while suppressing background noise.
[0096] e) Each RFAConv layer is followed by a batch normalization (BatchNorm) and ReLU activation function.
[0097] The formula for calculating RFAConv is as follows:
[0098]
[0099] In the formula, S represents the softmax activation function; AP represents the average pooling downsampling layer, used to receive high-dimensional features from the upper layer; g 1×1 It is a 1×1 convolution; k represents the scale factor of the convolution window; F U This represents the final weighted feature output; at each scale, average pooling is used to extract the global feature vector of the corresponding layer, and the corresponding receptive field attention weight A is generated through the softmax function. rf This is used to emphasize key regions; meanwhile, the characteristic response at the corresponding scale is denoted as R. rf This represents the important feature information retained within a specific receptive field; finally, multi-scale feature output is obtained through weighted fusion.
[0100] A schematic diagram illustrating the working principle of the RFAConv layer is shown below. Figure 4 The structure of the RFA-Head model is as follows: Figure 5 .
[0101] S240, Optimize the bounding box regression loss function:
[0102] The loss function of the YOLOv8 algorithm mainly consists of three parts: classification loss, confidence loss, and bounding box localization loss. The classification and confidence parts use a binary cross-entropy loss function, while bounding box regression uses the CIOU loss function to improve localization accuracy. Although the CIOU loss incorporates considerations of center point distance and aspect ratio on top of the traditional IOU, it still has some error when the predicted box and the ground truth box do not completely overlap, and its convergence speed is relatively slow. This embodiment replaces the CIoU loss function used for bounding box regression in the original YOLOv8 model with the Inner-CIoU loss function. The specific implementation method is as follows:
[0103] a) Inner-CIoU introduces a scaling factor (Sratio), which is set to 0.75 in this embodiment.
[0104] b) Using this scaling factor, a smaller “auxiliary box” is generated from the original predicted box and the ground truth box.
[0105] c) The loss calculation not only considers the CIoU between the original boxes, but also calculates the CIoU between the auxiliary boxes, and then sums the two values with weights.
[0106] d) This mechanism makes the model pay more attention to the consistency of the region inside the bounding box during training. For crack targets with large aspect ratios, it can provide more effective gradients, thereby accelerating convergence and improving localization accuracy.
[0107] The formula for the Inner-CIoU function is as follows:
[0108]
[0109]
[0110]
[0111]
[0112]
[0113]
[0114] Among them, S ratio B is the scaling factor; l B is the predicted left boundary of the bounding box. r B is the right boundary of the predicted bounding box. t For the upper boundary of the predicted bounding box, B b The lower boundary of the predicted bounding box; x c y is the horizontal coordinate of the center of the prediction box; cHere, is the vertical coordinate of the center of the prediction box; w is the width of the prediction box; h is the height of the prediction box; B r gt B represents the left boundary of the true bounding box. l gt B represents the right boundary of the true bounding box. b gt B is the lower boundary of the true bounding box. b gt The lower boundary of the true bounding box; I nter U is the area of the intersection of the two auxiliary boxes. nion L is the area of the union of the two auxiliary boxes; IOU inner For the IoU loss of the auxiliary bounding box, L CIOU For standard CIoU loss; L IOU For the original IoU loss; L inner-CIOU The loss function is Inner-CIoU.
[0115] Inner-CIoU introduces a scaling factor S. ratio The value of the bounding box is used to adjust the proportion of the auxiliary box in the loss calculation, and its range is set to [0.5, 1.5]. For samples with high IOU, using a smaller bounding box helps to speed up model convergence; while for samples with low IOU, using a larger bounding box for loss calculation is more beneficial to improving the regression performance in low IOU cases. By focusing on the relationship between the auxiliary box and its own scale, Inner-CIoU can better adapt to various shapes of targets in practical applications. In this embodiment, S ratio The geometric diagram of the Inner-CIoU loss function, set to 0.75, is shown below. Figure 6 .
[0116] like Figure 1 As shown, in step S300, the training set, validation set, and test set are used to train, validate, and test the tunnel lining crack detection model based on the improved YOLO model.
[0117] In this embodiment, the PyTorch 1.12.1 framework was used under the Ubuntu 20.04 operating system, and the GPU was an NVIDIA RTX 3080 Ti. The training epochs were set to 150, the batch size to 64, the AdamW optimizer was selected, the initial learning rate was 0.01, and a cosine annealing strategy was used to decay the learning rate to 0.0001. Precision (P), recall (R), and average precision (AP), which reflects the overall detection performance of each model, were selected as evaluation metrics for the model's detection performance. The specific calculation formulas are as follows:
[0118]
[0119]
[0120]
[0121] In this model, True Positive (TP) refers to the number of correctly predicted positive samples, False Positive (FP) represents the number of negative samples misclassified as positive samples, False Negative (FN) corresponds to the number of positive samples incorrectly classified as negative samples, and True Negative (TN) reflects the number of correctly identified negative samples. The area under the precision-recall curve (AP), constructed based on these metrics, effectively characterizes single-class detection performance, and its size is positively correlated with model quality. To comprehensively evaluate the overall model performance, the mean Average Precision (mAP) across all classes is calculated to reflect the algorithm's average detection level on the dataset. Specifically, mAP50 refers to the mAP value when the Intersection over Union (IoU) threshold is 0.5, while mAP50-95 is calculated by averaging multiple mAP values within the range of 0.5 to 0.95 (in increments of 0.05) to evaluate the robustness of the model under different positioning accuracy requirements.
[0122] like Figure 1 As shown, in step S400, the image of the tunnel lining crack to be detected is input into the trained tunnel lining crack detection model based on the improved YOLO model to obtain the crack identification result.
[0123] In this embodiment, the trained DRI-YOLO model is deployed into the detection system. When a new tunnel lining image is input, the model automatically outputs all detected crack targets in the image, including their category confidence, bounding box coordinates (x, y, w, h), and other information.
[0124] Application example:
[0125] 1. Load the pre-trained DRI-YOLO model weights.
[0126] 2. Input a 640x640 grayscale or RGB image of the tunnel lining.
[0127] 3. Model inference, outputting a list of detection results, each result containing bounding box coordinates (x_center, y_center, width, height), confidence score, and class label (class_id, here 'crack').
[0128] 4. Set the confidence threshold to 0.5 and filter out results with scores below this threshold.
[0129] 5. Apply non-maximum suppression (NMS) to the remaining results, with the IoU threshold set to 0.45, to remove overlapping boxes.
[0130] 6. Draw the finally detected bounding boxes on the original image and display or save them.
[0131] To verify the effectiveness and superiority of the improved algorithm proposed in this invention for detecting cracks in tunnel lining structures, a comparative experiment was conducted between the proposed DRI-YOLO algorithm and the current mainstream YOLO series target detection algorithms. Using YOLOv8 as the benchmark model, and while maintaining other experimental parameters, the performance of several mainstream detection models and the proposed DRI-YOLO was compared. The experimental results are shown in Table 1, fully demonstrating the advantages of the proposed method in terms of detection accuracy.
[0132] Table 1 Comparative Experiments
[0133]
[0134] Experimental results show that, on the tunnel lining structure crack detection dataset, compared to traditional target detection models, DWI-YOLO, without a significant increase in parameters, significantly outperforms other models in P, mAP50, and mAP50-95, and even surpasses the newly released YOLO V11 model. Compared to YOLO V11, its P, mAP50, and mAP50-95 are improved by approximately 1.7%, 3.9%, and 1.3%, respectively. The PR curves of YOLOv8n and DWI-YOLO are shown below. Figure 7 As shown, it can be seen that, at the same confidence level, the area under the PR curve of DRI-YOLO is higher than that of YOLOv8n.
[0135] To more intuitively demonstrate the effectiveness and performance advantages of the DRI-YOLO method proposed in this invention, Figure 8 The comparison results between its detection performance and YOLOv8n are presented. Considering the complex and ever-changing detection environments often encountered in practical engineering, this invention specifically selected representative complex scene samples and conducted separate qualitative analysis experiments. From Figure 8The visualization results show that YOLOv8n is prone to problems such as missed detection, false detection, or positioning deviation when faced with images with small cracks or strong background interference; while the improved DWI-YOLO shows stronger adaptability on such difficult samples, and can more accurately identify and locate crack areas, fully demonstrating its stability and practicality in real-world applications.
[0136] Corresponding to the aforementioned method for detecting tunnel lining cracks based on an improved YOLO model, this invention also discloses a tunnel lining crack detection system based on an improved YOLO model, which specifically includes:
[0137] The dataset building module is used to construct a dataset of tunnel lining crack images and divide it into training, validation and test sets;
[0138] The model building module is used to construct a tunnel lining crack detection model based on an improved YOLO model. The improved YOLO model includes introducing an expanded residual network (DWR) into the feature extraction module of the backbone network to enhance the feature extraction capability of tunnel lining cracks; introducing deformable convolution and channel-space dual attention mechanisms into the detection head network to achieve adaptive focusing on the crack target region and suppress background noise; and optimizing the bounding box regression loss function by using the Inner-CIoU loss function to calculate the bounding box regression loss.
[0139] The model training module is used to train, validate, and test the tunnel lining crack detection model based on the improved YOLO model using the training set, validation set, and test set.
[0140] The crack detection module is used to input images of tunnel lining cracks to be detected into a trained tunnel lining crack detection model based on an improved YOLO model to obtain crack identification results.
[0141] It should be noted that for a detailed description of the tunnel lining crack detection system based on the improved YOLO model provided in the embodiments of the present invention, please refer to the relevant description of the tunnel lining crack detection method based on the improved YOLO model provided in the embodiments of the present invention, which will not be repeated here.
[0142] In addition, embodiments of the present invention also provide an electronic device, the device comprising: a processor and a memory; the memory being used to store one or more program instructions; the processor being used to run one or more program instructions to perform the steps of a tunnel lining crack detection method based on an improved YOLO model as described in any of the preceding embodiments.
[0143] It should be noted that for a detailed description of the electronic device provided in the embodiments of the present invention, please refer to the relevant description of the tunnel lining crack detection method based on the improved YOLO model provided in the embodiments of the present invention, which will not be repeated here.
[0144] In addition, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of a tunnel lining crack detection method based on an improved YOLO model as described in any of the preceding claims.
[0145] It should be noted that for a detailed description of the computer-readable storage medium provided in the embodiments of the present invention, please refer to the relevant description of the tunnel lining crack detection method based on the improved YOLO model provided in the embodiments of the present invention, which will not be repeated here.
[0146] Those skilled in the art will understand that all or part of the functions of the various methods in the above embodiments can be implemented by hardware or by computer programs. When all or part of the functions in the above embodiments are implemented by computer programs, the program can be stored in a computer-readable storage medium, which may include: read-only memory, random access memory, disk, optical disk, hard disk, etc., and the program is executed by a computer to achieve the above functions. For example, the program can be stored in the memory of a device, and when the program in the memory is executed by the processor, all or part of the above functions can be achieved. In addition, when all or part of the functions in the above embodiments are implemented by computer programs, the program can also be stored in a server, another computer, disk, optical disk, flash drive, or external hard drive, etc., and can be downloaded or copied to the memory of a local device, or the system of the local device can be updated. When the program in the memory is executed by the processor, all or part of the functions in the above embodiments can be achieved.
[0147] The above examples illustrate the present invention only to aid in understanding it and are not intended to limit the scope of the invention. Those skilled in the art can make various simple deductions, modifications, or substitutions based on the principles of this invention.
Claims
1. A method for detecting cracks in tunnel lining based on an improved YOLO model, characterized in that, The method includes: A dataset of images of tunnel lining cracks was constructed and divided into training, validation and test sets. A tunnel lining crack detection model based on an improved YOLO model is constructed. The improved YOLO model includes introducing an expanded residual network (DWR) into the feature extraction module of the backbone network to enhance the feature extraction capability of tunnel lining cracks; introducing deformable convolution and channel-space dual attention mechanism into the detection head network to achieve adaptive focusing on the crack target region and suppress background noise; and optimizing the bounding box regression loss function by using the Inner-CIoU loss function to calculate the bounding box regression loss. The training set, validation set, and test set were used to train, validate, and test the tunnel lining crack detection model based on the improved YOLO model. The images of tunnel lining cracks to be detected are input into a tunnel lining crack detection model trained based on an improved YOLO model to obtain crack identification results.
2. The method for detecting tunnel lining cracks based on an improved YOLO model as described in claim 1, characterized in that, A dataset of tunnel lining crack images was constructed and divided into training, validation, and test sets, specifically including: Original images of tunnel lining cracks were collected, covering different lining types, various lighting conditions, and complex background scenes, to obtain a dataset of original images of tunnel lining cracks. The cracks in the original image are manually annotated to generate corresponding bounding box label files; Data enhancement processing is performed on the original image, including at least one of random rotation, random cropping, brightness adjustment, and contrast adjustment; The processed image set is divided into training set, validation set and test set according to a preset ratio.
3. The method for detecting tunnel lining cracks based on an improved YOLO model as described in claim 1, characterized in that, An extended residual network (DWR) is introduced into the feature extraction module of the backbone network to enhance the feature extraction capability for tunnel lining cracks. Specifically, this includes: The feature extraction module of the backbone network is replaced with a feature extraction module embedded with DWR, and the feature extraction module embedded with DWR specifically includes: First, a 1×1 convolutional layer is used to adjust the channels of the input feature map to C1; Next, the split method is used to divide the channel-adjusted feature map into two parts. Then, these two feature maps are processed by n concatenated Bottleneck_DWRSeg modules. Each Bottleneck_DWRSeg module contains a standard 1×1 convolutional layer and a 1×1 convolutional layer with DWR module. Multi-scale feature extraction and residual connections enhance the diversity and richness of features. The processed feature map is concatenated with the original feature map, and then the feature is fused through the last 1×1 convolutional layer to finally output the feature map.
4. The method for detecting tunnel lining cracks based on an improved YOLO model as described in claim 3, characterized in that, The DWR module includes multiple parallel convolutional kernels with different dilation rates, which are used to extract features from different receptive fields. The output feature maps of the multiple convolutional kernels are concatenated along the channel dimension and then added to the input features through residual connections to obtain the output of the DWR module.
5. The method for detecting tunnel lining cracks based on an improved YOLO model as described in claim 1, characterized in that, A deformable convolution and channel-space dual attention mechanism are introduced into the detection head network to achieve adaptive focusing on the crack target region and suppress background noise. Specifically, this includes: Replace all the standard 3×3 convolutional layers used for classification and regression branches in the Head of the detection head network with RFAConv layers; The RFAConv layer is used to first obtain global context information through average pooling, and then generate a receptive field attention weight map through 1×1 convolution and Softmax function. The corresponding weight map is used to weight the input feature map, so that the model can adaptively focus on the crack target region while suppressing background noise. Each RFAConv layer is followed by a batch normalization layer and a ReLU activation function to enhance the model's nonlinear expressive power.
6. The method for detecting tunnel lining cracks based on an improved YOLO model as described in claim 5, characterized in that, The calculation expression for the RFAConv layer is as follows: In the formula, S represents the softmax activation function; AP represents the average pooling downsampling layer, used to receive high-dimensional features from the upper layer; g 1×1 It is a 1×1 convolution; k represents the scale factor of the convolution window; F U This represents the final weighted feature output; at each scale, average pooling is used to extract the global feature vector of the corresponding layer, and the corresponding receptive field attention weight A is generated through the softmax function. rf This is used to emphasize key regions; meanwhile, the characteristic response at the corresponding scale is denoted as R. rf This represents the important feature information retained within a specific receptive field; finally, multi-scale feature output is obtained through weighted fusion.
7. The method for detecting tunnel lining cracks based on an improved YOLO model as described in claim 1, characterized in that, Furthermore, the bounding box regression loss function is optimized, and the Inner-CIoU loss function is used to calculate the bounding box regression loss, specifically including: A scaling factor is introduced, and an auxiliary box is generated from both the original predicted box and the ground truth box based on the scaling factor. The formula for calculating the Inner-CIoU loss function is as follows: Among them, S ratio B is the scaling factor; l B is the predicted left boundary of the bounding box. r B is the right boundary of the predicted bounding box. t For the upper boundary of the predicted bounding box, B b The lower boundary of the predicted bounding box; x c y is the horizontal coordinate of the center of the prediction box; c Here, is the vertical coordinate of the center of the prediction box; w is the width of the prediction box; h is the height of the prediction box; B r gt B represents the left boundary of the true bounding box. l gt B represents the right boundary of the true bounding box. b gt B is the lower boundary of the true bounding box. b gt The lower boundary of the true bounding box; I nter U is the area of the intersection of the two auxiliary boxes. nion L is the area of the union of the two auxiliary boxes; IOU inner For the IoU loss of the auxiliary bounding box, L CIOU For standard CIoU loss; L IOU For the original IoU loss; L inner-CIOU The loss function is Inner-CIoU.
8. The method for detecting tunnel lining cracks based on an improved YOLO model as described in claim 1, characterized in that, The training set, validation set, and test set are used to train, validate, and test the tunnel lining crack detection model based on the improved YOLO model, specifically including: The optimizer used for model training is AdamW, and the learning rate is decayed using a cosine annealing strategy. Accuracy, recall, and mean precision are used as performance evaluation metrics during the training process.
9. A tunnel lining crack detection system based on an improved YOLO model, characterized in that, The system includes: The dataset building module is used to construct a dataset of tunnel lining crack images and divide it into training, validation and test sets; The model building module is used to construct a tunnel lining crack detection model based on an improved YOLO model. The improved YOLO model includes introducing an expanded residual network (DWR) into the feature extraction module of the backbone network to enhance the feature extraction capability of tunnel lining cracks; introducing deformable convolution and channel-space dual attention mechanisms into the detection head network to achieve adaptive focusing on the crack target region and suppress background noise; and optimizing the bounding box regression loss function by using the Inner-CIoU loss function to calculate the bounding box regression loss. The model training module is used to train, validate, and test the tunnel lining crack detection model based on the improved YOLO model using the training set, validation set, and test set. The crack detection module is used to input images of tunnel lining cracks to be detected into a trained tunnel lining crack detection model based on an improved YOLO model to obtain crack identification results.
10. An electronic device, characterized in that, The device includes: a processor and a memory; The memory is used to store one or more program instructions; The processor is configured to run one or more program instructions to perform the steps of a tunnel lining crack detection method based on an improved YOLO model as described in any one of claims 1 to 8.