A tunnel lining detection system and method based on YOLOv8 optimization
Patent Information
- Application Number
- CN202610871688.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-16
- Publication Date
- 2026-10-27
AI Technical Summary
[0005]当隧道内部环境复杂对光学拍摄所得数据造成较大影响,检测设备需进行光学参数调整,导致整个检测周期相对较长,而且现有的光学拍摄检测装置需要工作人员手动控制拍摄的启闭,自动化程度相对较低
1.检测精度显著提升:通过引入MC全局多尺度特征机制模块和加权特征融合策略,有效解决了隧道复杂背景下微小损伤与大面积损伤的平衡检测问题。动态非单调聚焦损失和软标签交叉熵损失的应用,大幅减少了假阳性和假阴性检测结果。实验表明,模型的mAP较原始YOLOv8提升约5~10%。
Smart Images

Figure CN122990413A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of tunnel lining detection technology, and more specifically, to a tunnel lining detection algorithm based on YOLO algorithm optimization, particularly an optimization of a target detection algorithm based on deep learning. Specifically, it is a refinement scheme for the loss function of YOLOv8 algorithm in tunnel surface lining damage detection. By adding an MC module and optimizing the loss function, the detection accuracy and robustness of defects such as cracks and potholes are improved. Background Technology
[0002] Whether it's the tunnel's civil engineering, electromechanical facilities, or the tunnel surface lining, after a period of use, various damages, deformations, and other defects will gradually appear. These are collectively referred to as tunnel defects. Common early lining defects include: lining water leakage, lining cracks, lining spalling and cracking, insufficient protective layer for lining reinforcement with exposed reinforcement, lining deformation and displacement, and defects at tunnel portals.
[0003] Traditional manual inspection methods for detecting tunnel defects require the use of equipment such as crack observation instruments and lifting vehicles under fully or semi-closed traffic conditions. These methods are slow, have low accuracy, and are highly subjective. More importantly, they cannot achieve data management of changes across the entire tunnel area, making it difficult to meet the growing demand for tunnel maintenance.
[0004] Compared to traditional manual tunnel inspection methods, there are various automated tunnel lining inspection methods. Among them, optical imaging analysis is one of the most commonly used methods. Optical imaging analysis offers high detection accuracy and a short service life. However, existing optical imaging tunnel lining inspection devices have the following drawbacks:
[0005] When the complex environment inside the tunnel has a significant impact on the data obtained from optical imaging, the detection equipment needs to adjust its optical parameters, resulting in a relatively long detection cycle. Moreover, the existing optical imaging detection devices require manual control of the start and stop of imaging by staff, resulting in a relatively low degree of automation.
[0006] Meanwhile, the data processing algorithms for tunnel defects mainly rely on threshold segmentation image processing algorithms. When dealing with complex road surface textures, they struggle to distinguish subtle differences between damaged and normal lining, and surface stains on the lining can interfere with the detection results. Furthermore, detection techniques based on ordinary convolutional neural networks are insufficient in feature extraction of tunnel lining damage targets when facing complex scenarios with varying light intensities and shadow occlusion, making it difficult to adapt to the diverse changes in damage morphology. Most lining damage requires manual processing of numerous lining images to generate a final tunnel lining inspection report, resulting in a lengthy overall data acquisition and processing process that hinders the rapid assessment of tunnel maintenance workload. Summary of the Invention
[0007] The purpose of this invention is to overcome the shortcomings of the prior art and provide a tunnel lining detection system and method based on YOLOv8 optimization. By improving the YOLOv8 network structure, optimizing the loss function, and designing a vehicle-mounted automated acquisition device, high-precision, high-robustness, and real-time automated detection of tunnel lining defects can be achieved.
[0008] To achieve the above objectives, the present invention adopts the following technical solution: A tunnel lining inspection system based on YOLOv8 optimization includes a vehicle-mounted acquisition device, an improved YOLOv8 detection model, and a loss function optimization module.
[0009] The vehicle-mounted data acquisition device includes a mobile vehicle, a fixed base, a rotating base, a rotating support, an optical acquisition module, an optical scanning analysis module, an acquisition and analysis controller, and an uninterruptible power supply. The fixed base is fixed to the mobile vehicle, the rotating base is mounted on the fixed base, and the rotating support is mounted on the rotating base. Both the optical acquisition module and the optical scanning analysis module are mounted on the rotating support. The device also includes an acquisition and analysis control component and an uninterruptible power supply mounted on the mobile vehicle. These components are used to perform optical imaging of the tunnel surface and provide feedback to the acquisition and analysis controller. The optical acquisition module, the optical scanning analysis module, and the acquisition and analysis controller are electrically connected. When the acquisition and analysis controller is working, it controls the optical scanning analysis module and the optical acquisition module to work synchronously.
[0010] The acquisition and analysis controller is mounted on a mobile vehicle and is used to perform the acquisition and control of images of the tunnel lining surface. After receiving the control signal, the optical acquisition module and the optical scanning analysis module start the tunnel data acquisition work according to the control requirements. The data acquired by the optical acquisition module and the optical scanning analysis module are transmitted to the acquisition and analysis controller through electrical connection and stored for analysis, so as to facilitate further data analysis in the later stage.
[0011] The improved YOLOv8 detection model is deployed in the acquisition and analysis controller and includes a backbone network, an MC global multi-scale feature mechanism module, a neck network, and a detection head.
[0012] The MC module's specific structure: As an enhancement module of YOLOv8, the MC module (Global Multi-Scale Feature Mechanism Module) primarily enhances the model's ability to perceive minute damages (such as cracks) and macroscopic defects (such as potholes) by extracting multi-scale features from the complex background of tunnel lining images. The MC module achieves global contextual information capture through multi-level convolution and feature fusion mechanisms.
[0013] Number of Feature Fusion Layers: The MC module contains S feature fusion layers (S represents the number of multi-scale layers, as can be seen from the S parameter in the loss function formula); in actual implementations, S is usually set to 4 layers, corresponding to the 4 different resolution feature maps output by the YOLOv8 backbone network (e.g., from 80×80 to 10×10). Each fusion layer uses a weighted summation mechanism, and the weights are dynamically calculated through an attention mechanism: first, global average pooling is applied to the feature map at each scale to generate channel attention weights, which are then multiplied with the original features before fusion. This design ensures that the model can adaptively emphasize important scale features.
[0014] The specific embedding location of the YOLOv8 network: The MC module is embedded between the backbone and neck network of YOLOv8. Specifically, after the YOLOv8 backbone network outputs multi-scale feature maps, these features are first input into the MC module for enhancement. The output of the MC module is directly connected to the feature pyramid layer of the neck network for upsampling and downsampling fusion. This embedding location does not affect the real-time performance of YOLOv8, and at the same time, the multi-scale context extraction of the MC module improves the model's robustness to minor damage and complex backgrounds.
[0015] YOLOv8 Network Improvement Details: This solution makes multi-level improvements to the YOLOv8 network, including backbone network enhancement, neck network feature fusion optimization, and detection head adjustment, to improve the detection capability of tunnel lining damage.
[0016] Specific improvements to the backbone network: The backbone network (such as CSPDarknet) was optimized in both shallow and deep layers. Specifically, dilated convolutions were introduced in the shallow layers (layers 1-3) to increase the receptive field and capture the subtle textures of the cracks; residual connections and MC modules were added in the deep layers (layers 4-5) to enhance feature extraction from large-area damage. After the improvements, the backbone network can better handle scale variations.
[0017] Weight allocation rules for neck network feature fusion: The neck network employs a combination of a weighted feature pyramid network (FPN) and a path aggregation network (PAN). Weight allocation is achieved through an attention mechanism: channel attention weights are calculated for feature maps at different scales, and then weighted fusion is performed. The rules are dynamically adjusted based on feature importance; for example, higher weights are assigned to high-resolution feature maps to detect minute cracks, while contextual information is emphasized for low-resolution feature maps. This allocation rule improves the detection accuracy of multi-scale damage.
[0018] The loss function optimization module is used to calculate the training loss of the improved YOLOv8 detection model. Based on the original YOLOv8 loss function, this scheme introduces weighted feature pyramid loss (WFPL), dynamic non-monotonic focusing loss, soft label cross-entropy loss (softCE), and CIoU bounding box loss, and balances the contribution of different loss terms through hyperparameters.
[0019] Bounding box optimization loss: Combining CIoU loss (Complete Intersectionover Union) and spatial context information from the MC module improves the accuracy of bounding box regression.
[0020] The optimized loss function formula is as follows:
[0021] Where λ1~λ4 are the balancing hyperparameters (the parameters have been optimized for tunnels in different regions during large model training, and a parameter scheme has been formed), S represents the number of multi-scale layers in the MC module, and Ci is the dynamic confidence weight. This represents the probability distribution of soft labels.
[0022] The range of values for the balancing hyperparameters: λ1 to λ4 in the loss function formula are the balancing hyperparameters, used to adjust the contribution of each loss term. Based on the training and optimization results in the patent document, the typical range of values for these parameters in the tunnel lining inspection task is as follows: λ1 (WFPL weight): Value range 0.6 to 1.0, default value 0.8. This parameter controls the intensity of multi-scale feature loss. In tunnel scenes with complex backgrounds (such as those with dirt interference), it is recommended to take a higher value (such as 0.9) to enhance the role of the feature pyramid.
[0023] λ2 (Dynamic Non-Monotonic Focus Loss Weight): Value range 0.2 to 0.4, default value 0.3. It adjusts the anchor frame quality attention; in shadowed scenes, it can be appropriately increased to 0.35 to reduce false negatives.
[0024] λ3 (Soft Label Cross-Entropy Weight): Value range 0.4 to 0.6, default value 0.5. Used to handle ambiguous defects (such as cracks covered by water leakage). In tunnels with high humidity, it is recommended to take 0.55 to improve boundary discrimination.
[0025] λ4 (CIoU loss weight): Fixed at 1.0, used as the base weight for bounding box regression.
[0026] These parameters have been optimized through a grid search using a large-scale tunnel dataset (covering different geological and climatic conditions) to form a standard parameter scheme. Users can fine-tune them according to the specific tunnel environment; for example, in tunnels with uniform lighting, λ1 and λ2 can be slightly reduced.
[0027] The dynamic confidence weight calculation logic is as follows: The dynamic confidence weight Ci is calculated based on the intersection-over-union (IoU) ratio between the anchor box and the ground truth box, using the formula: Ci = IoUi / max(IoU), where IoUi represents the IoU value of the i-th anchor box, and max(IoU) is the maximum IoU in the current batch. This mechanism enables the model to adaptively focus on high-quality anchor boxes, reducing interference from low-quality samples; Ci is incorporated as a soft weight into the dynamic non-monotonic focusing loss, improving training stability.
[0028] Ci is incorporated as a soft weight into the dynamic non-monotonic focusing loss. (i) where Pi is the probability predicted by the model. A higher Ci value indicates better anchor box quality and a greater contribution to the loss. This mechanism enables the model to adaptively focus on high-quality samples during training, reducing interference from low-quality anchor boxes (e.g., IoU < 0.3).
[0029] Parameter adaptation schemes for different tunnel scenarios: Addressing the diversity of tunnel environments (e.g., urban tunnels, mountain tunnels), the technical solution mentions that parameter schemes have been optimized for different regions. For example, in scenarios with high rates of water leakage, λ3 is increased to enhance the handling of blurred boundaries by soft labels; in areas with severe shadow occlusion, λ2 is adjusted to balance the weights of positive and negative samples. The adaptation scheme is achieved through transfer learning, eliminating the need to retrain the entire model (the model is trained according to different regions and roads, and customized for different tunnels based on the training).
[0030] For water leakage coverage scenarios: Increase λ3 to 0.55-0.6 and adjust the soft label distribution to make the model more sensitive to slippery boundaries; at the same time, add a suppression layer for water reflection features in the MC module.
[0031] For shadow occlusion scenarios: Increase λ2 to 0.35–0.4 and dynamically adjust the calculation threshold of Ci (e.g., reduce the IoU threshold from 0.5 to 0.4) to enhance attention to low-light samples.
[0032] Multi-tunnel type adaptation: Achieved through transfer learning, the model is first pre-trained using general parameters, and then fine-tuned iteratively based on specific tunnel data (e.g., urban tunnels vs. mountain tunnels). This resulted in an mAP improvement of approximately 5-10% during model training and testing.
[0033] Hardware Co-control Parameters: Co-control of the hardware system is fundamental to ensuring data acquisition quality. The patent document describes the electrical connections and synchronous operating logic of the optical acquisition module, optical scanning analysis module, and acquisition analysis controller.
[0034] Synchronization trigger delay between the optical acquisition module and the scanning analysis module: The synchronization triggering of the two modules is managed by the acquisition and analysis controller, with the delay controlled in the millisecond range (typically <10ms). Specifically, when the optical acquisition module starts capturing images, the controller immediately triggers the optical scanning analysis module to start scanning via a hardware interrupt signal. This low-latency design avoids data asynchrony issues and ensures the accuracy of optical reflectance chromatography analysis.
[0035] Uninterruptible Power Supply (UPS) Battery Life and Compatibility Standards: The UPS provides stable power to the entire system. Battery life depends on the requirements of the tunnel inspection task. The UPS is equipped with an onboard silicon generator module, charging via vehicle power supply during vehicle operation, and also supports AC charging. The standard configuration is a lithium-ion battery pack, providing a battery life of 4–8 hours, supporting continuous data acquisition for approximately 20–40 kilometers of tunnels. Compatibility standards are based on tunnel length and environmental conditions: For long tunnels, a modular battery expansion solution is adopted; for extremely cold or hot environments, the power system has temperature adaptive functionality, ensuring stable operation within a range of ~10°C to 50°C.
[0036] A tunnel lining inspection method based on YOLOv8 optimization includes the following steps: S100: Moving to the corresponding tunnel via a vehicle platform, and using the optical acquisition module and optical scanning analysis module to perform optical imaging of the internal surface of the tunnel to be inspected; S200: Acquisition and analysis controller to complete the acquisition and summarization of complete single-cavity tunnel lining data; S300: The optical imaging data acquired by the optical acquisition module and optical scanning analysis module is transmitted to the acquisition and analysis controller. The acquired data is analyzed by the optical acquisition module and optical scanning analysis module using optical reflectance chromatography based on the optimized YOLOv8 algorithm in the loss function refinement scheme edge calculation software for tunnel surface lining damage detection, thereby obtaining a statistical report of single-cavity tunnel lining damage detection data; S400: Based on the improved YOLOv8 tunnel lining damage algorithm, the tunnel lining detection algorithm software in the acquisition and analysis controller performs multiple calculations and statistical summaries to process and analyze multiple single-cavity detection data, and outputs the final tunnel lining inspection report.
[0037] The tunnel lining damage algorithm based on YOLOv8 leverages YOLOv8's real-time detection performance and good adaptability to quickly process high-resolution image data acquired by onboard equipment and accurately identify various damage types such as longitudinal cracks, wide longitudinal cracks, transverse cracks, wide transverse cracks, crazing, depression crazing, and pits.
[0038] By deeply optimizing the YOLOv8 network structure, the backbone network is improved to enhance the ability to capture damage features of different scales and morphologies, enabling accurate localization of both small longitudinal cracks and large-area depressions and cracks. The feature fusion strategy of the neck network is adjusted to optimize the interaction of multi-scale feature information, effectively solving the detection accuracy problems of distant micro-cracks and close-range large-area damage. Simultaneously, the recognition algorithm is specifically improved to enhance sensitivity to damage edges and texture changes, ensuring accurate identification even when damage is covered by condensation (or seepage) or obscured by shadows. Addressing the challenges of large lighting variations and complex backgrounds inside tunnels, the optimized YOLOv8 algorithm integrates a multi-scale feature pyramid and an attention mechanism to focus on the target damage area and suppress interference factors such as road surface reflections and stains.
[0039] Compared with the prior art, the present invention has the following significant advantages: 1. Significantly Improved Detection Accuracy: By introducing the MC global multi-scale feature mechanism module and a weighted feature fusion strategy, the model effectively solves the problem of balancing the detection of small and large-area damage in complex tunnel backgrounds. The application of dynamic non-monotonic focusing loss and soft-label cross-entropy loss significantly reduces false positive and false negative detection results. Experiments show that the model's mAP is improved by approximately 5-10% compared to the original YOLOv8.
[0040] 2. More accurate bounding box localization: The spatial context information of the MC module is innovatively integrated into the CIoU bounding box loss, enabling the model to use the surrounding environmental features to assist in localization, which greatly improves the detection accuracy of diseases with blurred boundaries and irregular shapes.
[0041] 3. Strong environmental adaptability: To address common tunnel problems such as water leakage, shadow occlusion, and uneven lighting, a scene-adaptive parameter adjustment scheme has been designed. By fine-tuning the hyperparameters, it can quickly adapt to different tunnel environments without retraining the entire model.
[0042] 4. High degree of automation: The vehicle-mounted data acquisition device realizes fully automatic data acquisition. The optical acquisition and scanning modules are synchronously triggered at the millisecond level. The acquisition and analysis controller has built-in edge computing capabilities, which can collect and analyze data simultaneously. A preliminary report is generated immediately after the detection is completed, and the detection efficiency is more than 50 times higher than that of manual methods.
[0043] 5. Good real-time performance: Based on the YOLOv8n lightweight model, it has been improved to achieve an inference speed of over 30 FPS while ensuring detection accuracy, meeting the real-time detection requirements of vehicles.
[0044] 6. Convenient data management: The system can automatically record information such as the location, type, and extent of defects, and generate standardized inspection reports, which facilitates long-term tracking and dynamic management by tunnel maintenance departments. Attached Figure Description
[0045] Figure 1 This is a structural diagram of the improved YOLOv8 model described in this invention; Figure 2 This is a diagram showing the overall structure of the original YOLOv8 model. Figure 3 A comparison chart of the Precision-Recall curves before and after the improvement; Figure 4 This is an example diagram of the tunnel lining damage detection results described in this invention; Figure 5 This is a schematic diagram of the overall structure of the tunnel lining image acquisition device described in this invention. Detailed Implementation
[0046] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.
[0047] like Figures 1-5 As shown, the tunnel lining image acquisition device of the present invention includes a mobile carrier 1, a fixed base 2, a rotating base 3, a rotating support 4, an optical acquisition module 5, an optical scanning analysis module 6, an acquisition and analysis control component 8, and an uninterruptible power supply 9. The fixed base 2 is bolted to the top of the mobile carrier 1. The rotating base 3 is rotatably mounted on the fixed base 2 via bearings, allowing for 360° horizontal rotation. The rotating support 4 is mounted on the rotating base 3 via a pivot, allowing for ±90° vertical pitch adjustment. The optical acquisition module 5 uses a high-resolution industrial camera, and the optical scanning analysis module 6 uses a laser scanner. Both are fixedly mounted on the rotating support 4, allowing for omnidirectional angle adjustment along with the rotating base and rotating support, ensuring coverage of the entire tunnel lining surface.
[0048] The data acquisition and analysis controller 8 and the uninterruptible power supply 9 are located in the trunk of the mobile vehicle 1. The data acquisition and analysis controller 8 utilizes a high-performance edge computing platform, equipped with an NVIDIA Jetson Xavier NX module, possessing powerful parallel computing capabilities to meet real-time deep learning inference requirements. The controller 8 is electrically connected to the optical acquisition module 5 and the optical scanning analysis module 6 via Gigabit Ethernet for sending control commands and receiving acquired data. The uninterruptible power supply 9 uses a 12V / 200Ah lithium-ion battery pack, equipped with an onboard silicon generator charging module and a mains charging interface, providing a standard battery life of 6 hours, supporting continuous data acquisition over approximately 30 kilometers of tunnel. The power system has a built-in temperature control module, allowing stable operation within a temperature range of ~10°C to 50°C.
[0049] like Figures 1-2As shown, the improved YOLOv8 model described in this invention, based on the original YOLOv8n model, embeds a MC global multi-scale feature mechanism module between the backbone network and the neck network. The first to third convolutional layers of the backbone network are replaced with dilated convolutions with a dilation rate of 2, increasing the receptive field without increasing the number of parameters, thus better capturing the continuous texture features of cracks. Residual connections are added to the fourth and fifth layers of the backbone network, enhancing the network's depth and feature extraction capabilities while avoiding the gradient vanishing problem.
[0050] The MC global multi-scale feature mechanism module receives four feature maps with different resolutions output by the backbone network: 80×80×256, 40×40×512, 20×20×1024, and 10×10×1024. The specific workflow of this module is as follows: Global average pooling is performed on each input feature map to obtain four channel attention weight vectors with lengths of 256, 512, 1024, and 1024, respectively. Apply Sigmoid activation to each weight vector and map its value to the range of 0 to 1; Each feature map is multiplied element by element with its corresponding weight vector to obtain the weighted feature map; The four weighted feature maps are upsampled or downsampled to the same size (40×40), and then element-wise summed to obtain the fused multi-scale feature map. The fused feature map is then input into the neck network for further processing.
[0051] The neck network employs a weighted FPN+PAN structure. During feature fusion, channel attention weights are calculated for feature maps at each scale, and then weighted fusion is performed. For example, when fusing 80×80 and 40×40 feature maps, the 80×80 feature map is assigned a weight of 0.7, and the 40×40 feature map is assigned a weight of 0.3, to highlight the importance of high-resolution features for detecting small cracks.
[0052] A soft-labeling mechanism is introduced to dynamically allocate positive and negative samples, avoiding training instability caused by fixed thresholds. Adaptive label allocation is improved, and the loss function of the YOLO algorithm is optimized. This allows it to work collaboratively with the newly added MC module, enhancing the accuracy and stability of tunnel lining damage detection. Core optimizations include: Multi-scale feature loss is integrated: Based on the multi-scale features extracted by the MC module, a weighted feature pyramid loss (WFPL) is designed to enhance the balanced detection of micro-cracks and large-area damage.
[0053] Dynamic non-monotonic focusing loss: Incorporates anchor frame quality confidence into the loss calculation, and reduces the interference of low-quality anchor frames by dynamically adjusting the loss weights of positive and negative samples.
[0054] Soft label cross-entropy loss: Replaces the traditional hard label classification loss by using soft labels based on probability distribution to improve the model's ability to distinguish ambiguous defects (such as cracks covered by water leakage).
[0055] Bounding box optimization loss: Combining CIoU loss (Complete Intersection over Union) and spatial context information from the MC module improves the accuracy of bounding box regression.
[0056] The optimized formula is as follows: 1. Total Loss Function This invention decomposes the tunnel lining damage detection task into four sub-tasks: feature matching, anchor frame quality assessment, category classification, and bounding box regression, each corresponding to a different loss function. To balance the impact of each sub-task on model training, four balancing hyperparameters λ1 to λ4 are introduced to perform a weighted summation of each loss term, resulting in the total loss function: ; The values of λ1 to λ4 have been determined through grid search optimization on a large-scale tunnel dataset to ensure that the model achieves the best balance between detection accuracy and inference speed.
[0057] 2. Weighted Feature Pyramid Loss (WFPL) To address the issue of traditional feature pyramid networks treating features of different scales equally, this invention introduces a weighted feature pyramid loss to provide differentiated supervision of the multi-scale feature maps output by the MC module. The formula is as follows: ; Implementation details: S represents the number of multi-scale layers in the MC module; in this invention, S=4. F s pred The predicted feature map of the s-th layer output by the MC module; F s gt The s-th layer is the ground truth feature map, obtained by feature extraction from the labeled ground truth bounding boxes; It is the L2 norm, used to measure the difference between the predicted feature map and the true feature map; w s The weights of the features at the s-th layer are dynamically calculated through a channel attention mechanism. Small-scale feature maps (such as 80×80) have higher weights to enhance the detection of small cracks.
[0058] 3. Dynamic non-monotonic focusing loss To address the issue of traditional focusing loss treating all anchor frames equally, this invention introduces a dynamic confidence weight Ci, enabling the model to adaptively focus on high-quality anchor frames. The formula is as follows: ; Implementation details: IoUi is the intersection-union ratio of the i-th anchor box and the ground truth box; max(IoU) is the maximum intersection-union ratio of all anchor frames in the current batch; Ci is the dynamic confidence weight, which ranges from 0 to 1. The higher the IoU of the anchor box, the larger the Ci value and the greater its contribution to the loss. Pi is the probability that the i-th anchor box predicted by the model contains the target.
[0059] This mechanism can effectively suppress the interference of low-quality anchor boxes (IoU<0.3) on model training, thereby improving training stability and detection accuracy.
[0060] 4. Soft-label cross-entropy loss (softCE) To address the issue that traditional hard-label cross-entropy loss struggles to handle ambiguous boundary artifacts, this invention introduces soft-label cross-entropy loss, replacing traditional 0 / 1 hard labels with probability-distribution-based soft labels. The formula is as follows: ; Implementation details: y j soft Let be the soft label probability distribution for the j-th category. For diseases with ambiguous boundaries, the label value is between 0.4 and 0.6. This represents the probability of the j-th class predicted by the model.
[0061] During the data labeling phase, for defects with ambiguous boundaries (such as cracks covered by water leakage), a Gaussian distribution is used to generate soft labels, with label values gradually decreasing from the center to the edge. This mechanism can improve the model's ability to distinguish ambiguous boundaries and reduce false positive and false negative detection results.
[0062] 5. CIoU bounding box loss To improve the accuracy of bounding box regression, this invention employs CIoU loss, comprehensively considering the overlapping area, center distance, and aspect ratio of the bounding boxes. The formula is as follows: ; Implementation details: IoU is the intersection-union ratio between the predicted bounding box and the ground truth bounding box; ρ is the Euclidean distance between the center of the predicted bounding box and the center of the ground truth bounding box; c is the diagonal length of the smallest bounding rectangle containing the predicted bounding box and the ground truth bounding box; 'a' is a weighting coefficient used to balance the effects of center distance and aspect ratio; v is a parameter that measures the consistency of aspect ratio.
[0063] Meanwhile, by combining the spatial context information output by the MC module, the accuracy of bounding box regression is further optimized, enabling the model to utilize surrounding environmental features to assist in localization.
[0064] Model evaluation metrics The tunnel lining damage algorithm based on YOLOv8 selected evaluation metrics during the research and development process, including the F1 score of combined precision and recall, mean average precision (mAP), computational cost (GFLOPs), and weight size (ModelSize). The specific formulas are as follows: ; In the formula: TP represents true positives, FP represents false positives, FN represents false negatives, AP represents average precision, P represents precision, and R represents recall.
[0065] The specific implementation steps of the tunnel lining detection method described in this invention are as follows: Equipment preparation: Check the battery level of the vehicle-mounted data acquisition device, the working status of the camera and scanner, and adjust the angles of the optical acquisition module and the optical scanning analysis module to ensure coverage of the tunnel roof, side walls and road surface.
[0066] Data Acquisition: The mobile vehicle is driven to the entrance of the tunnel to be inspected, and the data acquisition and analysis controller initiates the data acquisition program. The mobile vehicle travels through the tunnel at a constant speed of 30 km / h, while the optical acquisition module captures images at a rate of 20 frames per second, and the optical scanning and analysis module simultaneously performs laser scanning. The acquisition and analysis controller ensures that both are triggered synchronously through a hardware interrupt signal, with the synchronization delay controlled within 5ms.
[0067] Data preprocessing: After acquisition, the acquisition and analysis controller automatically performs noise reduction, distortion correction and image stitching on the original images to generate a complete panoramic image of the tunnel lining.
[0068] Disease detection: Panoramic images are input into an improved YOLOv8 detection model for inference. The model's inference speed is approximately 30 FPS or higher, meeting the requirements for real-time vehicle-mounted detection. The detection results include the bounding box coordinates, category, and confidence level of the disease.
[0069] Report Generation: Based on the detection results, the data acquisition and analysis controller automatically calculates the quantity, location, length, and area of various defects, generating a statistical report on the damage detection data of the lining of a single tunnel. The report is output in PDF format and includes a defect distribution map and detailed statistical tables.
[0070] Manual review and final report: Professional inspectors manually review the preliminary test results, correcting any false positives or missed negatives. Then, the test data from multiple individual tunnels are summarized and analyzed to generate the final tunnel lining inspection report, including damage assessment and maintenance recommendations.
[0071] During the model training phase, we constructed a large-scale dataset containing 100,000 tunnel lining images, covering different regions and types of tunnels, and annotated over 200,000 defect samples. Training employed the Adam optimizer with an initial learning rate of 0.001, a batch size of 16, and 100 training iterations.
[0072] For different tunnel scenarios, we provide the following parameter adaptation solutions: For scenarios with high incidence of water leakage: λ3 is adjusted to 0.55, and the standard deviation of the Gaussian distribution of the soft label is set to 0.2 to make the model more sensitive to slippery boundaries; at the same time, a suppression layer for water reflection features is added to the MC module.
[0073] For scenes with severe shadow occlusion: Adjust λ2 to 0.38 and reduce the IoU threshold to 0.4 to increase attention to low-light samples.
[0074] For tunnels with uniform lighting and clean backgrounds: reduce λ1 to 0.7 and λ2 to 0.25 to improve inference speed.
[0075] Using transfer learning, the model was first pre-trained using a general tunnel dataset, and then fine-tuned using 500 labeled images of the target tunnel. The fine-tuning iterations were repeated 10 times, which improved the detection accuracy of the model in this tunnel by 5-8%.
[0076] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
[0077] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A tunnel lining inspection system optimized based on YOLOv8, characterized in that, include: The vehicle-mounted data acquisition device includes a mobile vehicle, a fixed base, a rotating base, a rotating support, an optical acquisition module, an optical scanning analysis module, an acquisition and analysis controller, and an uninterruptible power supply. The fixed base is fixed to the top of the mobile vehicle, the rotating base is rotatably mounted on the fixed base, the rotating support is mounted on the rotating base, and both the optical acquisition module and the optical scanning analysis module are mounted on the rotating support. An improved YOLOv8 detection model is deployed in the acquisition and analysis controller. The improved YOLOv8 detection model includes: The backbone network introduces dilated convolutions in the shallow layers to increase the receptive field, and adds residual connections and MC modules in the deep layers; The MC global multi-scale feature mechanism module is embedded between the backbone network and the neck network. It includes an S-layer feature fusion layer, which calculates the dynamic weights of feature maps at each scale through a channel attention mechanism and performs weighted fusion. The neck network adopts a structure that combines a weighted feature pyramid network and a path aggregation network, and dynamically allocates fusion weights of feature maps at different scales based on a channel attention mechanism; The detection head is used to output the bounding box and category information of tunnel lining damage; The loss function optimization module is used to calculate the training loss of the improved YOLOv8 detection model. The loss function includes weighted feature pyramid loss, dynamic non-monotonic focusing loss, soft label cross-entropy loss, and CIoU bounding box loss. Each loss term is weighted and combined using balanced hyperparameters λ1 to λ4. The total loss function formula is: L total =λ1L WFPL +λ2L dynamic +λ3L softCE +λ4L CIoU .
2. The tunnel lining detection system according to claim 1, characterized in that, The S-layer feature fusion layer of the MC global multi-scale feature mechanism module is set to 4 layers, corresponding to the 4 feature maps of different resolutions output by the YOLOv8 backbone network; each layer fusion adopts a weighted summation mechanism, and the weights are dynamically calculated through the attention mechanism: first, global average pooling is applied to the feature map of each scale to generate channel attention weights, and then the weights are multiplied with the original features before fusion.
3. The tunnel lining detection system according to claim 1, characterized in that, The specific formulas for each loss function are as follows: Weighted feature pyramid loss: , Where w s F represents the weights of the features at layer s. s pred For the predicted feature map of the s-th layer, F s gt Let S be the true feature map of the s-th layer, where S is the number of multi-scale layers of the MC module; Dynamic non-monotonic focusing loss: , Where Ci is the dynamic confidence weight, and Pi is the probability predicted by the model; The formula for calculating the dynamic confidence weight Ci is: , Where IoUi represents the intersection-union ratio between the i-th anchor box and the ground truth box, and max(IoU) is the maximum IoU in the current batch; Soft-label cross-entropy loss: , Where y j soft For soft label probability distribution, The class probabilities predicted by the model; CIoU bounding box loss: , Where ρ is the Euclidean distance between the center of the predicted box and the center of the ground truth box, c is the diagonal length of the smallest bounding rectangle containing the two boxes, a is the weighting coefficient, and v is a parameter that measures the consistency of aspect ratio.
4. The tunnel lining detection system according to claim 1, characterized in that, The values of the balancing hyperparameters are as follows: λ1 is 0.6 to 1.0, with a default value of 0.8; λ2 is 0.2 to 0.4, with a default value of 0.3; λ3 is 0.4 to 0.6, with a default value of 0.5; and λ4 is fixed at 1.
0.
5. The tunnel lining detection system according to claim 1, characterized in that, The acquisition and analysis controller controls the optical acquisition module and the optical scanning analysis module to work synchronously via a hardware interrupt signal, with a synchronous triggering delay of less than 10ms; the uninterruptible power supply uses a lithium-ion battery pack and supports charging of the vehicle-mounted silicon generator module and mains power charging.
6. A method for operating the YOLOv8-optimized tunnel lining detection system according to any one of claims 1 to 5, characterized in that, Includes the following steps: S1: The vehicle moves to the corresponding tunnel via a platform and uses the optical acquisition module and optical scanning analysis module to perform optical imaging on the internal surface of the tunnel to be inspected. S2: The acquisition and analysis controller collects and summarizes the complete single-tunnel lining data. S3: The optical imaging data acquired by the optical acquisition module and optical scanning analysis module is sent to the acquisition and analysis controller. Using optical reflectance chromatography and edge calculation software based on the optimized YOLOv8 algorithm in tunnel surface lining damage detection, the acquired data is analyzed to obtain a statistical report of single-tunnel lining damage detection data. S4: Based on the improved YOLOv8 tunnel lining damage algorithm, the tunnel lining detection algorithm software in the data acquisition and analysis controller performs multiple calculations and statistical summaries to process and analyze multiple single-tunnel detection data, and outputs the final tunnel lining detection report.
7. The tunnel lining inspection method according to claim 6, characterized in that, Before step S3, there is also a model training step: T1: Construct a tunnel lining damage dataset containing different geological, climatic and lighting conditions, and label the bounding boxes and categories of various types of damage; T2: Train the improved YOLOv8 detection model using the constructed dataset, and calculate the training loss using the loss function described in claim 1 during the training process; T3: Based on the characteristics of different tunnel scenarios, fine-tune the values of the balance hyperparameters λ1 to λ4: In scenarios with high incidence of water leakage, increase λ3 to 0.55 to 0.6; in scenarios with severe shadow occlusion, increase λ2 to 0.35 to 0.4, and dynamically adjust the calculation threshold of Ci, reducing the IoU threshold from 0.5 to 0.
4.
8. The tunnel lining inspection method according to claim 7, characterized in that, The model training steps adopt a transfer learning approach: first, pre-training is performed using general parameters, then a small number of iterations are performed for fine-tuning based on specific tunnel data, and the model is trained in different regions and roads in general. Based on the training, the model is customized for different tunnels.
9. The tunnel lining detection method according to claim 6, characterized in that, The tunnel lining damage categories include longitudinal cracks, wide longitudinal cracks, transverse cracks, wide transverse cracks, alligator cracks, depressions and pits.
10. The tunnel lining detection system according to claim 1, characterized in that, The bounding box optimization loss combines CIoU loss and spatial context information from the MC module to improve bounding box regression accuracy.