Tunnel apparent disease detection method and system based on deep learning and knowledge distillation

CN121235997BActive Publication Date: 2026-08-18INST OF GEOLOGY CHINA EARTHQUAKE ADMINISTRATION
View PDF 7 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

[0005]上述方法虽在裂缝识别或多模态增强方面有所突破,但仍普遍存在以下问题:大多数方法仅针对裂缝,难以统一检测多类型病害;检测模型普遍采用重型结构,难以直接部署在资源受限的边缘设备;训练策略主要依赖于端到端回归,缺乏跨模型的知识迁移机制,模型轻量化后性能显著下降;图像增强与多尺度建模机制较为单一,对模糊、低对比度病害区域的感知能力不足

Benefits of technology

1.本发明通过引入频谱增强机制,在图像预处理阶段显著强化低对比度、模糊边缘等病害区域的结构特征,为模型提供更清晰的信息输入,增强系统在光照不均、背景复杂等环境下的稳定识别能力。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121235997B_ABST
    Figure CN121235997B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of tunnel crack detection and artificial intelligence edge computing, and provides a tunnel apparent disease detection method based on deep learning and knowledge distillation, which comprises the following steps: step one, introducing spectral domain information enhancement to the original tunnel image, and enhancing the edge texture features of the disease area in the image through methods such as multi-scale wavelet transform and small-scale enhancement; step two, constructing a high-performance teacher model, introducing a flexible up-sampling structure to adapt to the feature recovery requirements of different levels of semantic information, introducing an efficient visual coding module to enhance the feature fusion ability of different scale channels, and designing a scale self-adaptive weighted loss function; by introducing the spectral enhancement mechanism, the structural features of the disease area such as low contrast and fuzzy edge are significantly strengthened in the image preprocessing stage, providing clearer information input for the model and enhancing the stable recognition ability of the system in uneven light and complex background environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of tunnel crack detection technology and artificial intelligence edge computing technology, specifically to a method and system for detecting tunnel surface defects based on deep learning and knowledge distillation. Background Technology

[0002] Tunnels, as crucial infrastructure in transportation and municipal engineering, are prone to structural defects such as crack propagation, water seepage and dampness, and lining spalling during long-term operation. Timely and accurate identification of tunnel defects is a vital prerequisite for ensuring traffic safety and extending structural lifespan. Existing techniques based on manual inspection or image detection suffer from low detection efficiency, high subjectivity, and susceptibility to missed detections in complex lighting and blurred texture scenarios.

[0003] In recent years, with the widespread application of target detection algorithms such as the YOLO series in industrial inspection, deep learning-based automatic detection methods have become mainstream. However, traditional detection networks like YOLO still suffer from insufficient recognition accuracy and high deployment resource costs when facing multi-scale, multi-form, and low-contrast defects in tunnel scenarios, limiting their application in edge devices. Therefore, there is an urgent need for an intelligent detection method and system that balances detection accuracy with edge deployment capabilities and adaptability to multiple types of defects.

[0004] Several related studies have attempted to intelligently identify tunnel defects. For example, application number CN202510571962.0 proposes a tunnel crack identification method based on image morphology modeling and multi-level classification, which improves the identification accuracy of small cracks; application number CN202510365809.2 explores a crack segmentation method based on Deeplab network structure optimization, which improves the clarity of segmentation edges; application number CN202510360896.2 proposes to combine 3D point cloud and image features for data fusion to achieve the detection of minute cracks in tunnels; application number CN202411591685.1 uses a deep learning comparison method between historical tunnel images and existing images to perform semantic recognition of defects; and utility model CN202323116181.8 focuses on a multi-source hardware equipment joint detection system for subway tunnels, emphasizing equipment platform integration.

[0005] While the above methods have made breakthroughs in crack identification or multimodal enhancement, they still generally suffer from the following problems: most methods only target cracks and are difficult to detect multiple types of diseases in a unified manner; the detection models generally adopt heavy structures and are difficult to deploy directly on resource-constrained edge devices; the training strategies mainly rely on end-to-end regression and lack cross-model knowledge transfer mechanisms, resulting in a significant performance drop after the model is lightweighted; the image enhancement and multi-scale modeling mechanisms are relatively simple and lack the ability to perceive blurred and low-contrast disease areas. Summary of the Invention

[0006] To address the shortcomings of existing technologies, this invention provides a method and system for detecting tunnel surface defects based on deep learning and knowledge distillation. This method is applicable to the efficient identification of various structural defects in tunnels, including cracks, seepage, and spalling. The proposed detection method not only significantly improves the detection accuracy of small-target cracks and ambiguous defects but also possesses excellent model compression and transfer capabilities, making it suitable for intelligent inspection tasks in large-scale tunnel structural health monitoring.

[0007] To achieve the above objectives, the present invention provides the following technical solution: a method for detecting tunnel surface defects based on deep learning and knowledge distillation, comprising the following steps: Step 1: Introduce spectral domain information enhancement to the original tunnel image, and enhance the edge texture features of the diseased area in the image through multi-scale wavelet transform and small-scale enhancement methods.

[0008] Step 2: Construct a high-performance teacher model, introduce a flexible upsampling structure to adapt to the feature recovery requirements of semantic information at different levels, introduce an efficient visual encoding module to enhance the fusion capability of channel features at different scales, and design a scale-adaptive weighted loss function to dynamically adjust the weight contribution of different types of disease targets such as large-scale chipping and small-scale cracks during the training process.

[0009] Step 3: Construct a lightweight student model with a simple structure suitable for edge deployment. The overall network significantly reduces the number of parameters and computational cost while maintaining detection accuracy. At the same time, it integrates a dynamic control mechanism for inference depth, which adaptively prunes or skips some intermediate inference paths based on the complexity of the input image and the distribution of the disease structure.

[0010] Step 4: Design structural semantic guidance branches. Integrate structural semantic guidance branches into the student model and use shallow features and spatial attention mechanisms to model the morphological features, orientation patterns and spatial topology of the diseased area.

[0011] Step 5: Design a multi-scale joint knowledge distillation mechanism that integrates local region guidance and multi-scale response alignment distillation mechanism, constructs a dual-path distillation structure at the feature level and output level, and focuses on local detail alignment and cross-layer semantic transfer in the crack region during the distillation process.

[0012] Step 6: Edge Deployment and System Integration. Deploy the trained lightweight student model to an embedded edge platform.

[0013] Preferably, the weighted loss function in step two is: , Where N is the total number of predicted targets. , and They represent the first The classification, confidence, and location regression loss of each target; , and The loss weighting factor is dynamically adjusted based on the target size. Indicates the first The receptive field scale of an object on the feature map To avoid smooth terms with a denominator of zero.

[0014] A tunnel surface defect detection system based on deep learning and knowledge distillation includes: The data preprocessing module is used to perform spectral enhancement on the tunnel images; The teacher model building module is used to build a multi-scale disease detection model and adopts a scale-dynamic weighted loss function. The student model building module is used to build lightweight tunnel defect detection models suitable for edge deployment, which significantly reduces computational costs and parameter size while maintaining detection accuracy. The structural semantic guidance module is used to connect in parallel with the lightweight backbone network unit in the student model building module; The knowledge distillation module is used to achieve efficient knowledge transfer between the teacher model building module and the student model building module, enabling the lightweight student model to inherit the high-precision detection capability of the teacher model while maintaining a lightweight structure. The edge deployment module is used to deploy the student model building module to embedded terminals; The dataset building module is used to create a training sample library covering multiple types and scenarios of tunnel defects, providing high-quality training data support for deep learning models.

[0015] Preferably, the data preprocessing module includes a multi-scale wavelet transform unit and an enhancement unit. The multi-scale wavelet transform unit and the enhancement unit are connected in series to output an enhanced image of the disease edge texture features. The multi-scale wavelet transform unit decomposes the image into low-frequency and high-frequency sub-bands through discrete wavelet transform, and then reconstructs the high-frequency sub-bands after enhancement.

[0016] Preferably, the construction of the teacher model with multi-scale modeling capabilities is based on the YOLOv11 network backbone architecture and employs multi-scale structural enhancements, including: Input module: Receives the tunneled image after spectral enhancement processing and performs preliminary convolution and normalization; Backbone network: Composed of C3k2 modules and Bottleneck structure, used for shallow texture extraction, mid-level semantic modeling and high-level global feature capture; Feature fusion module: The dynamic upsampling module DySample and the integrated high-efficiency visual coding module EVCBlock are introduced into the multi-scale fusion path; DySample achieves pixel-level reconstruction through dynamic weight generation, improving the accuracy of boundary features; EVCBlock is composed of a local visual coding module and a lightweight MLP channel modeling module in parallel, and is fused by convolution to enhance cross-scale information transmission and channel interaction. Detection head: The 11Detect module with a three-branch structure outputs bounding box regression and classification predictions.

[0017] Preferably, the student model includes a lightweight backbone network, a detection head, and a dynamic depth control mechanism, specifically: Lightweight backbone network: Based on YOLOv11n, it adopts channel pruning (approximately 50% of the teacher model) and introduces the DySample dynamic upsampling module and a simplified EVCBlock module into the feature fusion path to improve feature reconstruction and spatial semantic expression capabilities; Simplified EVCBlock (EVCBlock-lite): It consists of local visual coding units and lightweight MLP channel modeling units. Channel alignment and fusion are performed by 1×1 convolution, which retains multi-channel modeling and local detail perception capabilities, and reduces attention and fully connected computation. The detection head (11Detect-lite) employs a three-scale detection branch (P3 / P4 / P5), which uses depthwise separable convolution and 1×1 convolution for compression. It adopts a shared parameter structure to reduce computational cost and outputs target bounding boxes and class probability predictions.

[0018] Preferably, the student model includes a dynamic depth control unit and a simplified unit. The dynamic depth control unit includes an intermediate prediction output and a complexity scoring subunit, and the scoring subunit outputs... The image complexity value, when The intermediate exit is triggered at the time. The complexity scoring subunit consists of two 3×3 convolutional layers and one fully connected layer. The input is the feature vector of the intermediate feature map after global average pooling.

[0019] Preferably, in the structural semantic guidance module, the depth-separable convolutional unit is composed of 3×3 depth convolution and 1×1 point convolution, which is used to extract local edge responses; the coordinate attention unit generates spatial attention weights by fusing channel attention with position information to enhance the perception of spatial topology of the disease area, and its output is spliced ​​with the main mid-layer features according to the channel dimension after adjusting the number of channels by 1×1 convolution.

[0020] Preferably, the knowledge distillation module includes a feature-level distillation unit and an output-level distillation unit. The feature-level distillation unit calculates the loss of multi-scale features of teachers and students and the cosine similarity loss. The output-level distillation unit uses divergence-aligned category prediction distribution and calculates the bounding box loss. The feature-level distillation unit selects the P3 / P4 / P5 scale feature maps of the teacher and student models, assigns a weight of 1.5 times to diseased areas and a weight of 0.5 to non-diseased areas through local region masking. The dynamic control mechanism for inference depth dynamically adjusts the inference path length according to the structural complexity of the input image, realizing fine control of computing resources, thereby effectively improving the system's inference efficiency while ensuring detection accuracy.

[0021] Preferably, the dataset construction module includes an image filtering unit, a semi-automatic annotation unit, and a data augmentation unit. The dataset covers cracks, seepage, and spalling defects, and the ratio of the training set to the test set is 8:1.

[0022] This invention provides a method and system for detecting tunnel surface defects based on deep learning and knowledge distillation. It has the following beneficial effects: 1. This invention introduces a spectrum enhancement mechanism to significantly enhance the structural features of diseased areas such as low contrast and blurred edges during the image preprocessing stage, providing clearer information input to the model and enhancing the system's stable recognition capability in environments with uneven lighting and complex backgrounds.

[0023] 2. This invention constructs a teacher model with multi-scale perception capabilities, integrating lightweight feature encoding and scale-adaptive loss function, which significantly improves the recognition accuracy of various scale diseases such as microcracks, small seepage and large slabs.

[0024] 3. The present invention designs a knowledge distillation strategy that combines local region guidance and response alignment, enabling the lightweight student model to achieve recognition accuracy close to that of the teacher model while maintaining low computational cost, which is significantly better than the traditional pruning and compression scheme.

[0025] 4. This invention introduces a dynamic depth control mechanism to flexibly adjust the network inference depth according to the image complexity, outputting detection results without requiring a complete forward propagation, improving average inference efficiency by more than 30%, and is suitable for real-time deployment on edge devices.

[0026] 5. This invention enhances the model's ability to perceive the morphology, orientation, and spatial layout of defects by integrating structural semantic guidance branches, further reducing the false negative rate of complex defects (such as radial cracks and converging seepage), and supporting the simultaneous identification of multiple typical tunnel defects such as cracks, seepage, and spalling under the same detection framework. It has good scenario versatility and engineering promotion potential.

[0027] 6. This invention significantly improves the overall performance of the intelligent tunnel defect detection system in terms of identification accuracy, system efficiency, and practical deployment capability through the synergistic optimization of model structure and training strategy, and has good technological advancement and engineering application value. Attached Figure Description

[0028] Figure 1 This is a flowchart of the present invention; Figure 2 This is a schematic diagram of the tunnel defect detection dataset in this invention; Figure 3 This is a schematic diagram of the improved YOLOv11 structure of the teacher model in this invention. Detailed Implementation

[0029] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0030] Example: Please see the appendix Figure 1 - Appendix Figure 3 This invention provides a method for detecting tunnel surface defects based on deep learning and knowledge distillation, comprising the following steps: Step 1: Image Acquisition and Spectral Enhancement Preprocessing of Tunnel Defects In this invention, firstly, a self-moving tunnel defect detection system is used to acquire high-resolution images of the tunnel inner wall to obtain structural image data that meets the requirements for identifying micro-cracks. Then, the acquired images are filtered, cropped, and finely annotated to construct a tunnel defect detection dataset covering multiple typical defect types. Secondly, to improve the model's ability to identify low-contrast and weak-texture defect areas, the images are preprocessed with spectral enhancement before model training. Multi-scale wavelet transform and small-scale Retinex method are used to enhance structural details and edge textures, significantly improving the subsequent network's perception performance of weak defect features.

[0031] Specifically, 1. Methods for acquiring images of tunnel defects This invention employs a self-moving tunnel surface defect detection system for high-precision acquisition of images of the tunnel's internal wall structure. The system integrates nine 12K high-resolution linear array industrial cameras, a blue laser light source, a mileage encoder, and an acquisition control device. It features modular structure, high imaging accuracy, and convenient assembly, making it suitable for continuous acquisition of defect data from long-distance tunnels. Image acquisition utilizes a high frame rate synchronous triggering mechanism, achieving seamless lateral coverage after image stitching. The stitched image resolution reaches 0.15 mm, exceeding the 0.2 mm crack identification accuracy requirement in the "Railway Tunnel Engineering Construction Quality Acceptance Standard".

[0032] The system consists of the following four parts: Data acquisition module: includes industrial camera, blue laser light source, and embedded control system; Car platform: Equipped with a power propulsion system and shock-absorbing and stabilizing devices, supporting automatic track inspection; Data storage module: Built-in high-speed NAS storage device to ensure complete preservation of original images; Power supply module: Integrated lithium battery pack, which can operate continuously for at least 4 hours without external power supply.

[0033] During image acquisition, all industrial cameras simultaneously complete exposure under trigger control and upload data at high speed via a local area network. The system supports a maximum detection speed of 5 km / h, operates within a temperature range of 0–40℃, and a relative humidity range of 0–95%, demonstrating good environmental adaptability. Image quality has been verified using a standard crack detection card, showing the ability to distinguish micro-cracks and meeting the requirements for high-resolution, high-quality images in subsequent deep learning modeling.

[0034] 2. Construction of Tunnel Defect Dataset After image acquisition, the acquired tunnel surface image data is filtered, cropped, labeled, and formatted to construct a tunnel defect detection dataset. Defect types include, but are not limited to: linear cracks, network cracks, lining spalling, water seepage marks, water stains, and other structurally abnormal areas. Figure 2 This shows a magnified view of some of the defect labels in the tunnel defect dataset.

[0035] The specific steps are as follows: Image filtering: Remove blurry, overexposed, or severely occluded images; Disease labeling: Semi-automatic auxiliary labeling tools are used in combination with manual review to complete fine boundary labeling, and the labeling format is YOLO / TXT standard; Disease classification: Classification is based on crack direction, texture direction and seepage area morphology to construct a representative and diverse subset; Image normalization and size processing: Unify the input image size and perform histogram equalization to enhance data stability; Data partitioning: The dataset is divided into training, validation and test sets according to the proportions for model training and evaluation.

[0036] 3. Spectrum Enhancement Preprocessing To enhance the perception capabilities of deep learning models for low-contrast, weakly edged disease regions, this invention introduces a spectral domain enhancement mechanism to fully exploit the latent spatial frequency features in the image. First, Discrete Wavelet Transform (DWT) is used to decompose the image into low-frequency and high-frequency sub-bands at multiple scales. By enhancing the detail information in the high-frequency sub-bands and combining it with the low-frequency structure, the image is reconstructed to highlight fine-grained structural edges. Second, a dynamic brightness compensation mechanism based on multi-scale Retinex is introduced to suppress the interference of non-uniform illumination on disease detection and restore the local dynamic range and detail levels of the image. The two enhancement results can be combined with the original image to form a multi-channel input or parallel encoding path, enabling the network to obtain richer texture distribution and boundary-guided features in the early perception stage, thereby effectively improving the comprehensive detection performance of various diseases such as cracks, seepage, and spalling.

[0037] Step 2: Construct a teacher model with multi-scale modeling capabilities The teacher model constructed in this invention is based on the YOLOv11 network backbone architecture. While maintaining the stability of the original backbone structure, it has carried out a number of structural enhancements to meet the needs of expressing multi-scale and multi-morphological features of tunnel defects. Figure 3 An improved YOLOv11 teacher model is presented, which is based on the YOLOvx model and consists of the following parts: Input module: Receives tunneled images that have undergone spectral enhancement processing, with a uniform size of 512×512, and feeds them into the initial convolution and normalization layers.

[0038] The backbone network consists of multiple stacked C3k2 modules and a Bottleneck structure, possessing excellent residual connection mechanisms and semantic extraction capabilities. Shallow layers focus on edges and textures, mid-layers focus on structural semantics, and high-layers capture global disease area features.

[0039] Feature Fusion Module (Neck): The Dysample module (Improvement 1) is introduced to replace the original YOLO interpolation-based upsampling operation. Dysample performs pixel-level perceptual reconstruction through a dynamic weight generation mechanism, improving boundary response accuracy while maintaining multi-scale fusion efficiency. EVCBlock modules are inserted into different scale branches (Improvement 2) to construct multi-scale enhancement paths. EVCBlock strengthens cross-scale information transfer and channel interaction by connecting LVCBlock (local perception) and LightMLPBlock (global modeling) in parallel and fusing them through 1×1 convolution.

[0040] The detection head retains a three-branch structure, with each branch containing an 11Detect module composed of deep and shallow convolutions (DWConv, Conv2d, etc.), which outputs bounding box regression (BBox Loss) and classification (Cls Loss) predictions.

[0041] The structural improvements proposed in this invention are as follows: Backbone Structure and Multi-Scale Feature Extraction Path: After receiving the spectrally enhanced image at the input end, the image is first pre-encoded through a set of standard convolutional layers and C3k2 modules. Then, a multi-scale feature extraction path is formed along the backbone network branches. The network retains the Bottleneck module, C3k2 residual structure, and multi-level convolutional combinations from the original YOLOv11 structure, forming a three-branch feature extraction mechanism that includes low-level texture perception (shallow layer), mid-level semantic modeling (intermediate layer), and high-level global understanding (deep layer).

[0042] Improvement 1: Introduce a flexible upsampling module (DySample) Traditional YOLOv11 upsampling structures primarily employ Nearest-Neighbor or Bilinear Interpolation for feature map size recovery. However, this approach fails to consider the semantic structure and spatial geometric information of the image, resulting in insufficient context awareness and blurred edge reconstruction. To improve the clarity of boundary structures such as tunnel cracks and lumps, this invention introduces a dynamically learnable upsampling operator, the Dysample module, which replaces the original upsampling layer in multiple upsampling paths, achieving more accurate semantic feature recovery. This module possesses the following characteristics: Structure: Dysample constructs a spatial weight mapping based on three sets of inputs: query, key, and value, and performs pixel-level resampling weight allocation through a self-attention mechanism; Dynamic perception mechanism: The module dynamically generates sampling weight kernels based on the context of the input feature map, which has stronger edge response capabilities and can finely preserve weak structural information such as crack edges and chip boundaries; Embedding method: In this invention, Dysample is embedded into two upsampling paths during the feature fusion stage of the YOLO backbone network, see... Figure 3 The section marked "Improvement Point 1" enhances the fidelity of feature scale restoration.

[0043] Improvement 2: Integration of a high-efficiency visual coding module (EVCBlock) To improve the robustness and discriminative power of the YOLOv11 network in complex textured backgrounds and low-contrast tunneled images, this invention introduces a high-efficiency visual center coding module, EVCBlock, in front of the detection head, such as... Figure 3As shown in "Improvement Point 2" in the text, EVCBlock consists of the following substructures: Stem guiding layer: The basic feature extraction unit, consisting of convolution, normalization, ReLU and max pooling, is used for initial compression and stabilization of the input tensor; Local Visual Encoding Module (LVCBlock): It uses spatial attention mechanism to construct "key-value" relationship, and fuses local texture saliency and edge guidance through residual connections; it is combined with 1×1 convolution to improve channel compression and spatial focusing capabilities; Lightweight MLP Channel Modeling Module (LightMLPBlock): This module enhances the interaction of features between different channels by combining depthwise separable convolution with channel unrolling / compression operations; it also introduces a residual channel regularization strategy to enhance expressive power while keeping the model lightweight.

[0044] EVCBlock integrates spatial guidance and channel modeling dual-perspective information expression mechanisms, making it particularly suitable for capturing the distribution trends and edge continuity of cracks and seepage zones in tunnel defect scenarios with complex structural details and dense multi-scale textures, effectively improving the semantic discriminative power of the detection network in the Head stage.

[0045] 4. Design a scale-adaptive weighted loss function (SDLoss) To improve the overall performance of the model in multi-scale disease detection tasks, a scale-dynamic loss function (SDLoss) is used during the training phase to adjust the weights of disease targets of different sizes. SDLoss dynamically adjusts the loss function based on the size of the disease and the difficulty of detection. Weight allocation for bounding box regression and classification branches in numerical data.

[0046] The total loss function used in traditional YOLO series models is expressed as follows:

[0047] In the formula, For category loss, Indicates the target confidence loss. This represents the position regression loss.

[0048] Building upon this, SDLoss introduces a scale factor-aware mechanism. By introducing a weight adjustment term for each loss term, it adaptively adjusts the importance of targets at different scales in the loss function, as defined below:

[0049] In the formula, N represents the total number of predicted targets. , and They represent the first The classification, confidence, and location regression loss of each target; , and The loss weighting factor is dynamically adjusted based on the target size and is determined by the relative ratio between the target size and the image scale. The weighting factor is defined as follows:

[0050] In the formula, Indicates the first The receptive field scale of an object on the feature map To avoid smooth terms with a denominator of zero, usually .

[0051] To train the YOLOv11 teacher model constructed in this invention, the experiment was conducted on a Windows system platform using a high-performance workstation equipped with an NVIDIA RTX 4090 graphics card, and trained using the PyTorch deep learning framework. The input image size was set to 512×512, and the AdamW optimizer was used with an initial learning rate of 0.001, which decayed to 0.01. The weight decay coefficient was set to 0.0005, and the batch size was 16. The model training was performed for 100 epochs, with early stopping enabled to prevent overfitting. Image enhancement methods such as hue perturbation, saturation perturbation, and brightness perturbation were applied during training, and an IoU threshold of 0.7 was set to optimize positive and negative sample matching. Data loading was handled concurrently using 8 threads, and model parameters were saved every 10 epochs to ensure stable and efficient training.

[0052] The trained teacher model will serve as a supervised source for knowledge distillation, guiding the training of student models. For details on the relevant distillation strategies, please refer to step S5.

[0053] Step 3: Constructing a lightweight student model and an edge inference optimization mechanism To achieve efficient deployment of the tunnel defect detection model of this invention on embedded devices, a lightweight student model was designed. Its structure is simplified by modules and optimized by paths, which effectively reduces the network computing load and parameter scale while maintaining the ability to express multi-scale features.

[0054] The student model mainly consists of a lightweight backbone network, a detection head, and a dynamic depth control mechanism, as detailed below: Lightweight backbone network design (YOLOv11n + DySample) The student model's backbone network is based on YOLOv11n, retaining the three-scale feature extraction backbone structure and making the following improvements: Channel pruning: The number of channels in the backbone convolutional layer is approximately 50% of that in the teacher model, reducing redundant computation; The upsampling module is replaced with DySample: the traditional fixed interpolation is replaced with a dynamic upsampling module to improve the quality of feature reconstruction after upsampling; Retain the simplified EVCBlock: To maintain the model's spatial-semantic fusion capability, a "simplified EVCBlock module" is introduced in the output stage of each backbone feature.

[0055] Simplified EVCBlock module design (EVCBlock-lite) The original EVCBlock consists of three parts: a Local Visual Encoding Module (LVCBlock), a Lightweight MLP Channel Modeling Module (LightMLPBlock), and a channel concatenation and fusion structure. To control complexity, EVCBlock-lite uses the following simplified structure in the student model: Stem guiding layer: Retains the standard 3×3 convolution + BN + ReLU + MaxPooling structure for basic feature extraction.

[0056] Local Visual Encoding Module (LVCBlock-lite): Removes large-scale attention modules and retains only 1×1 convolution compression + depthwise separable convolution combination; retains key channel selection and fusion mechanisms (such as C3 variant structure).

[0057] Lightweight MLP Channel Modeling Module (LightMLPBlock-lite): Simplified to two sets of depthwise separable convolutions + ReLU + local normalization structures; replacing the multi-layer MLP fully connected structure to improve computational efficiency.

[0058] Feature splicing and fusion layer: 1×1 convolutions are reserved for feature channel alignment and fusion; all paths are short connection structures to ensure no information is lost.

[0059] This module retains the multi-channel modeling capabilities and local detail awareness of the original EVCBlock, while removing large-scale attention computations and redundant nonlinear paths, making it suitable for reuse in lightweight models.

[0060] Detection head optimization (11Detect-Lite) The three-scale detection branches (P3 / P4 / P5) are retained, but only 3 layers are retained in each branch: the standard stacked convolution is replaced by depthwise separable convolution + 1×1 channel compressed convolution; a shared head parameter structure is adopted to further compress the number of detection head parameters; the target bounding box and category probability output module are retained (supporting multiple disease targets).

[0061] Inference Depth Dynamic Control (DDC) To further reduce inference latency and power consumption when deploying the model on edge devices, this invention introduces a Dynamic Depth Control (DDC) mechanism in the lightweight student model. This mechanism dynamically adjusts the inference path length based on the structural complexity of the input image, enabling fine-grained control of computing resources and thus effectively improving system inference efficiency while ensuring detection accuracy.

[0062] Specifically, intermediate prediction exits (Early ExitHeads) are preset in multiple stages of the student model backbone network, enabling the network to have multi-level output capabilities. Each exit structure is a simplified version of the 11Detect module, consisting of depthwise separable convolutions and a lightweight prediction head, capable of performing preliminary object detection at shallow layers. Simultaneously, a lightweight scoring network is inserted in the intermediate layers of the backbone network to determine the texture complexity of the input image. This scoring module consists of two standard convolutional layers and one fully connected layer. The input is an intermediate feature map, which, after global average pooling, outputs a continuous score value S∈[0,1], used to evaluate the structural richness and disease distribution density of the image.

[0063] During inference, the model first performs the first two stages of feature extraction on the input image and sends the output of this stage to the scoring module to obtain a complexity score. When S is lower than a set threshold (e.g., 0.35), the model determines that the image is a simple structure or a disease-free area, and can directly complete the detection through the intermediate prediction exit, skipping the subsequent deep inference module with a large computational load. If the score is higher than the threshold, it indicates that there are complex disease structures in the image (such as intersecting cracks, seepage zones, and debris accumulation). The model will continue to execute the complete path to the final detection layer to obtain richer semantic information from the deep features to complete high-precision detection.

[0064] This mechanism enables the model to flexibly allocate computing resources based on the content of the input image. In tunnel scenes, numerous "blemish-free background" areas do not require deep processing, thus significantly reducing the overall average inference latency. Experiments show that this mechanism can improve the average processing speed by approximately 30% without sacrificing overall detection performance. It is particularly suitable for embedded terminals or mobile detection devices with high requirements for energy consumption and response speed, demonstrating good deployment practicality and engineering promotion value.

[0065] Step 4: Design of Structural Semantic Guided Branch (SBG) A semantic-structure based guidance (SBG) branch is integrated into the backbone network. This branch provides semantic prior guidance to the main detection branch by modeling the geometric shape, orientation pattern and spatial topology of the tunnel defect area, which effectively improves the model's discrimination ability in complex scenarios such as texture blurring and structural superposition.

[0066] Specifically, the SBG branch takes the shallow (stride=4 or stride=8) feature map from the student model as input. This layer has richer edge and texture information, making it suitable for extracting geometric structural features of diseased areas such as cracks and seepage. To improve feature extraction efficiency and generalization ability, this branch adopts a lightweight structure consisting of convolutional layers and an attention module. Its core includes a set of 3×3 depthwise separable convolutional layers for extracting local edge responses, followed by a channel attention mechanism (such as SE or SimAM modules) to enhance the response amplitude of key regions. To further model the spatial distribution trend of diseased areas, the SBG branch also includes a coordinate attention module guided by location information, which combines absolute position encoding and directional bias convolution to perceive the target's directional features.

[0067] The structural semantic features extracted by the SBG branch are then fused with the high-level semantic features in the backbone network. The fusion method employs a cross-layer connection approach, where the SBG output is dimensionality-reduced through a 1×1 convolution and then concatenated with the mid-layer feature map of the backbone network channel-by-channel. This concatenation is then input into the feature enhancement module of the detection head as auxiliary information to improve the response sensitivity of the backbone detection branch to structural defects. During the training phase, to ensure that the SBG branch focuses on extracting structural features, this invention introduces a structure-guided loss function. A contour mask of the defect area (such as a crack mask or the boundary of a seepage area) is selected as a supervision signal to constrain the consistency between the SBG output and the structural contour in spatial distribution, thereby guiding the network to develop spatial structure perception capabilities.

[0068] By introducing structural semantic guidance branches, this invention achieves effective modeling of complex spatial relationships of defects in a lightweight model, significantly improving the robustness of detection for irregular defect structures such as radial cracks, intersecting cracks, and multi-connected seepage zones. Without significantly increasing model parameters, the SBG branch can improve the model's mAP in complex structural scenarios by approximately 3.4%, demonstrating better target perception and structural discrimination capabilities in difficult-to-detect areas such as intersecting and overlapping cracks and blurred linings.

[0069] Step 5: Design of a Multi-Scale Joint Knowledge Distillation Mechanism To achieve high-precision tunnel defect detection under edge deployment conditions, this invention designs a knowledge distillation mechanism that integrates local region guidance and multi-scale response alignment. This mechanism aims to enable a lightweight student model to fully inherit the structural awareness and target discrimination capabilities of the teacher model. It consists of feature-level distillation and logit-level distillation, combined with spatial attention information from defect areas, to achieve more structure-oriented learning transfer.

[0070] Specifically, in the feature-level distillation path, feature maps at three scales (stride=8, 16, 32) in both the teacher and student models are selected as distillation objects. To unify channel dimensions and spatial dimensions, the student feature map is first adjusted for the number of channels using a 1×1 convolution and then spatially aligned using bilinear interpolation. Subsequently, a joint feature alignment loss function is constructed using mean squared error (MSE) and cosine similarity to measure the semantic expression differences between the student and teacher models at each scale, thereby guiding the student network to learn the multi-scale response patterns of the teacher model in diseased regions.

[0071] Meanwhile, to enhance the model's structural discrimination ability for fine-grained defects such as cracks and seepage, this invention introduces a Local Attention Guidance (LAG) mechanism during the distillation process. Specifically, based on the high-confidence bounding boxes output by the teacher model, a mask image of the defect area is generated and applied to the aforementioned feature distillation process. This assigns a higher weight to the loss function within the defect area, guiding the student model to focus on key structural regions such as crack edges and morphological changes in defects, thereby improving the model's spatial perception ability for complex targets.

[0072] In output-level distillation, the student model's detector head output is aligned with the teacher model's. First, Kullback-Leibler divergence (KL divergence) is applied to the class prediction distributions of both models for soft label alignment. Simultaneously, IoU error is used as positional consistency supervision for the bounding box regression. Output distillation is performed concurrently with feature distillation during the training phase, and loss-weighted fusion is achieved through hyperparameters to ensure bidirectional inheritance of the model across both object classification and localization dimensions.

[0073] The entire distillation training process was implemented using the PyTorch framework. The training data was the same as the teacher model, and the student model only participated in parameter updates, while the weights of the teacher model remained frozen. A simultaneous distillation strategy was employed to jointly optimize the detection loss and distillation loss. The overall training time was approximately 60–80 epochs. Ultimately, while maintaining a lightweight structure, the student model achieved an approximately 4.2% improvement in mAP (mearing perceptual accuracy) in complex tunnel scenes compared to the non-distilled version, significantly enhancing the model's recognition ability in disease scenes with weak textures and low contrast.

[0074] Step Six: Edge Deployment and System Integration To realize the practical application of the tunnel defect detection system in engineering, this invention deploys a lightweight student model optimized by multi-scale knowledge distillation on an embedded edge terminal with real-time processing capabilities, thereby constructing an integrated hardware and software intelligent tunnel detection system that enables rapid identification, location, and classification of various defects such as cracks, seepage, and spalling.

[0075] Before deployment, student models are first exported to ONNX or TorchScript format using PyTorch to adapt to mainstream edge inference frameworks (such as TensorRT, OpenVINO, ncnn, etc.). Regarding deployment platforms, this system supports integration with low-power AI computing modules such as NVIDIA Jetson AGX Xavier, Orin Nano, and Horizon Sunrise, and is compatible with various types of industrial-grade computing nodes and vehicle-mounted industrial control terminals.

[0076] The deployment process mainly includes the following stages: First, the front-end acquisition module (such as a tunnel inspection robot, track inspection vehicle, or vehicle-mounted imaging system) acquires tunnel lining image data in real time. The image resolution is no less than 0.2 mm, meeting the crack recognition accuracy standard. Then, the image undergoes wavelet transform and Retinex enhancement by a spectrum enhancement preprocessing module (integrated into the system's preprocessing chain) to strengthen edge texture signals and enhance the model's ability to perceive diseased areas. The enhanced image is then input into the deployed student model for forward inference. The model automatically invokes a dynamic depth control mechanism (DDC) to determine image complexity and dynamically select the inference path. If the image structure is simple, results are quickly output in the shallow to mid-level layers; if the disease is complex, it enters a deep network for refined detection, significantly improving inference efficiency.

[0077] The inference results include the category of the target defect (cracks, seepage, spalling, etc.), confidence level, location coordinates, and target shape characteristics. The results can be displayed simultaneously on the device's graphical interface or transmitted back to the backend server via 5G / wired network, enabling remote centralized monitoring and defect distribution analysis. The system also supports functions such as abnormal frame saving, local result caching, and breakpoint resume, ensuring reliability and stability in complex construction and inspection environments.

[0078] Actual deployment tests show that on the Jetson Xavier platform, this system can achieve an image processing speed of 25 FPS, supports continuous defect detection at speeds not exceeding 5 km / h, consumes less than 15 W of power, and occupies less than 2.5 GB of GPU memory, meeting the comprehensive performance requirements of mobile edge computing devices for high recognition accuracy, low power consumption, and strong generalization ability. The deployment method of this invention has good engineering adaptability and can be widely applied to tunnel operation health monitoring and early warning of structural defects in railways, highways, municipal engineering, and other fields.

[0079] As another aspect of the present invention, the present invention provides a tunnel appearance defect detection system based on deep learning and knowledge distillation, comprising: The data preprocessing module for spectral enhancement of tunnel images includes a multi-scale wavelet transform unit and an enhancement unit. The multi-scale wavelet transform unit and the enhancement unit are connected in series to output an enhanced image of the texture features of the crack edge. The multi-scale wavelet transform unit decomposes the image into low-frequency and high-frequency sub-bands through discrete wavelet transform, and reconstructs the high-frequency sub-bands after enhancement, thereby improving the signal-to-noise ratio of crack edge details by ≥15dB. The teacher model building module for constructing multi-scale disease detection models employs a scale-weighted loss function. It comprises a backbone network unit, a feature encoding unit, and a dynamic upsampling unit. The feature encoding unit is embedded in the feature fusion layer of the backbone network unit, and the dynamic upsampling unit replaces the traditional upsampling layer. The feature encoding unit includes a guiding layer, a local perception subunit, and a global modeling subunit, which are fused through residual connections to enhance cross-scale channel interaction capabilities. The dynamic upsampling unit generates pixel-level sampling weights based on a "query-key-value" attention mechanism, improving edge reconstruction accuracy by ≥20% compared to traditional bilinear interpolation. A student model building module is used to construct a lightweight tunnel defect detection model suitable for edge deployment. This module significantly reduces computational cost and parameter size while maintaining detection accuracy. It includes a lightweight backbone network unit, a dynamic depth control unit, and a simplified unit. The dynamic depth control unit contains an intermediate prediction exit and a complexity scoring subunit, with the scoring subunit outputting... The image complexity value, when The intermediate exit is triggered at the time. The complexity scoring subunit consists of two 3×3 convolutional layers and one fully connected layer. The input is the feature vector after global average pooling of the intermediate feature map. The scoring time is ≤1ms. The structural semantic guidance module is used in parallel with the lightweight backbone network unit in the student model building module. The coordinate attention unit of the structural semantic guidance module integrates absolute position encoding and has an accuracy of ≥92% in extracting the orientation features of radial cracks and cross seepage zones. It includes depthwise separable convolutional units and coordinate attention units. Its output is concatenated with the feature channels of the middle layer of the backbone after 1×1 convolution dimensionality reduction. The number of convolutional channels of the lightweight backbone unit is 50% of that of the teacher model building module. Depthwise separable convolution is used instead of standard convolution, and the number of parameters is ≤8M. This knowledge distillation module is designed to enable efficient knowledge transfer between the teacher model building module and the student model building module, allowing the lightweight student model to inherit the high-precision detection capabilities of the teacher model while maintaining a lightweight structure. It includes a feature-level distillation unit and an output-level distillation unit. The feature-level distillation unit calculates the loss of multi-scale features and cosine similarity loss for the teacher and student models. The output-level distillation unit uses divergence-aligned category prediction distribution and calculates the bounding box loss. The feature-level distillation unit selects the P3 / P4 / P5 scale feature maps of the teacher and student models, assigns a weight of 1.5 times to diseased areas and a weight of 0.5 to non-diseased areas through local region masking. The edge deployment module is used to deploy the student model building module to embedded terminals; This dataset building module is used to create a training sample library of tunnel defects covering multiple types and scenarios, providing high-quality training data support for deep learning models. It includes an image filtering unit, a semi-automatic annotation unit, and a data augmentation unit. The dataset covers defects such as cracks, seepage, and spalling, with a training set to test set ratio of 8:1.

[0080] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for detecting tunnel surface defects based on deep learning and knowledge distillation, characterized in that, Includes the following steps: Step 1: Enhance the original tunnel image by introducing spectral domain information, and enhance the edge texture features of the diseased area in the image through multi-scale wavelet transform and small-scale enhancement methods; Step 2: Construct a high-performance teacher model, introduce a flexible upsampling structure to adapt to the feature recovery requirements of semantic information at different levels, introduce an efficient visual coding module to enhance the feature fusion capability of different scale channels, and design a scale-adaptive weighted loss function to dynamically adjust the weight contribution of different types of disease targets such as large-scale chipping and small-scale cracks during the training process. Step 3: Construct a lightweight student model with a simple structure suitable for edge deployment. The overall network significantly reduces the number of parameters and computational cost while maintaining detection accuracy. At the same time, it integrates a dynamic control mechanism for inference depth, which adaptively prunes or skips some intermediate inference paths based on the complexity of the input image and the distribution of the disease structure. Step 4: Design structural semantic guidance branches and integrate them into the student model. Use shallow features and spatial attention mechanisms to model the morphological features, orientation patterns, and spatial topology of the diseased area. Step 5: Design a multi-scale joint knowledge distillation mechanism, which integrates the distillation mechanism of local region guidance and multi-scale response alignment, and constructs a dual-path distillation structure of feature level and output level. During the distillation process, attention is paid to the local detail alignment and cross-layer semantic transfer of the crack region. Step 6: Edge Deployment and System Integration. Deploy the trained lightweight student model to an embedded edge platform.

2. The tunnel surface defect detection method based on deep learning and knowledge distillation according to claim 1, characterized in that, The weighted loss function in step two is: , Where N is the total number of predicted targets. , and They represent the first The classification, confidence, and location regression loss of each target; , and The loss weighting factor is dynamically adjusted based on the target size. Indicates the first The receptive field scale of an object on the feature map To avoid smooth terms with a denominator of zero.

3. A tunnel surface defect detection system based on deep learning and knowledge distillation, using the tunnel surface defect detection method based on deep learning and knowledge distillation as described in claim 2, characterized in that, include: The data preprocessing module is used to perform spectral enhancement on the tunnel images; The teacher model building module is used to build a multi-scale disease detection model and adopts a scale-dynamic weighted loss function. The student model building module is used to build lightweight tunnel defect detection models suitable for edge deployment, which significantly reduces computational costs and parameter size while maintaining detection accuracy. The structural semantic guidance module is used to connect in parallel with the lightweight backbone network unit in the student model building module; The knowledge distillation module is used to achieve efficient knowledge transfer between the teacher model building module and the student model building module, enabling the lightweight student model to inherit the high-precision detection capability of the teacher model while maintaining a lightweight structure. The edge deployment module is used to deploy the student model building module to embedded terminals; The dataset building module is used to create a training sample library covering multiple types and scenarios of tunnel defects, providing high-quality training data support for deep learning models.

4. The tunnel surface defect detection system based on deep learning and knowledge distillation according to claim 3, characterized in that, The data preprocessing module includes a multi-scale wavelet transform unit and an enhancement unit. The multi-scale wavelet transform unit and the enhancement unit are connected in series to output an enhanced image of the disease edge texture features. The multi-scale wavelet transform unit decomposes the image into low-frequency and high-frequency sub-bands through discrete wavelet transform, and then reconstructs the high-frequency sub-bands after enhancement.

5. The tunnel surface defect detection system based on deep learning and knowledge distillation according to claim 3, characterized in that, A teacher model with multi-scale modeling capabilities was constructed. This model is based on the YOLOv11 network backbone architecture and employs multi-scale structural enhancements, including: Input module: Receives the tunneled image after spectral enhancement processing and performs preliminary convolution and normalization; Backbone network: Composed of C3k2 modules and Bottleneck structure, used for shallow texture extraction, mid-level semantic modeling and high-level global feature capture; Feature fusion module: The dynamic upsampling module DySample and the integrated high-efficiency visual coding module EVCBlock are introduced into the multi-scale fusion path; DySample achieves pixel-level reconstruction through dynamic weight generation, improving the accuracy of boundary features; EVCBlock is composed of a local visual coding module and a lightweight MLP channel modeling module in parallel, and is fused by convolution to enhance cross-scale information transmission and channel interaction. Detection head: The 11Detect module with a three-branch structure outputs bounding box regression and classification predictions.

6. The tunnel surface defect detection system based on deep learning and knowledge distillation according to claim 3, characterized in that, The student model includes a lightweight backbone network, a detection head, and a dynamic depth control mechanism, specifically: Lightweight backbone network: Based on YOLOv11n, channel pruning is adopted, and the DySample dynamic upsampling module and a simplified EVCBlock module are introduced into the feature fusion path to improve feature reconstruction and spatial semantic expression capabilities. Simplified EVCBlock: It consists of local visual coding units and lightweight MLP channel modeling units. Channel alignment and fusion are performed by 1×1 convolution, which retains multi-channel modeling and local detail perception capabilities, and reduces attention and fully connected computation. The detection head employs a three-scale detection branch, which uses depthwise separable convolution and 1×1 convolution for compression. A shared parameter structure is used to reduce computational load, while outputting target bounding boxes and class probability predictions.

7. The tunnel surface defect detection system based on deep learning and knowledge distillation according to claim 3, characterized in that, The student model includes a dynamic depth control unit and a simplified unit. The dynamic depth control unit contains an intermediate prediction exit and a complexity scoring subunit, and the scoring subunit outputs... The image complexity value, when The intermediate exit is triggered at the time. The complexity scoring subunit consists of two 3×3 convolutional layers and one fully connected layer. The input is the feature vector of the intermediate feature map after global average pooling.

8. The tunnel surface defect detection system based on deep learning and knowledge distillation according to claim 3, characterized in that, In the structural semantic guidance module, the depth-separable convolutional unit consists of a 3×3 depth convolution and a 1×1 point convolution, which is used to extract local edge responses; the coordinate attention unit generates spatial attention weights by fusing channel attention with position information to enhance the perception of spatial topology in the diseased area. Its output is then concatenated with the main mid-layer features according to the channel dimension after adjusting the number of channels by a 1×1 convolution.

9. The tunnel surface defect detection system based on deep learning and knowledge distillation according to claim 3, characterized in that, The knowledge distillation module includes a feature-level distillation unit and an output-level distillation unit. The feature-level distillation unit calculates the loss of multi-scale features of teachers and students and the cosine similarity loss. The output-level distillation unit uses divergence-aligned category prediction distribution and calculates the bounding box loss. The feature-level distillation unit selects the P3 / P4 / P5 scale feature maps of the teacher and student models, assigns a weight of 1.5 times to diseased areas and a weight of 0.5 to non-diseased areas through local region masking. The dynamic control mechanism for inference depth dynamically adjusts the inference path length according to the structural complexity of the input image, realizing fine-grained control of computing resources, thereby effectively improving the system's inference efficiency while ensuring detection accuracy.

10. The tunnel appearance defect detection system based on deep learning and knowledge distillation according to claim 3, characterized in that, The dataset construction module includes an image filtering unit, a semi-automatic annotation unit, and a data augmentation unit. The dataset covers cracks, seepage, and spalling defects, with a training set to test set ratio of 8:1.

Citation Information

Patent Citations

  • A tunnel disease identification and detection method and system based on deep learning

    CN119339063B

  • Tunnel lining fine crack detection method and system based on data fusion

    CN119887757A

  • Method and system for realizing tunnel crack detection based on Deeplab

    CN119887764A

  • Tunnel crack image identification method and tunnel wall uniform image detection system

    CN120088260A

  • Subway tunnel safety hazard detection vehicle and subway tunnel detection system

    CN221049682U