Training method and detection method of tunnel lining crack detection model

By combining channel pruning and global attention mechanisms with the YOLOv5s model, the problems of high computational cost and low accuracy in tunnel lining crack detection are solved, achieving lightweight model and efficient detection.

CN120912503APending Publication Date: 2025-11-07SHENYANG UNIVERSITY OF TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510809266.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-17
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

Traditional methods for detecting cracks in tunnel lining rely on manual inspection, which is inaccurate and inefficient. Furthermore, deep learning models in edge terminals are computationally intensive, and their storage capacity and power consumption are limited. Existing lightweight methods also affect the accuracy and training efficiency of the models.

Method used

A lightweight approach is adopted to combine channel pruning and global attention mechanisms to process the YOLOv5s model. This includes performing channel pruning on the YOLOv5s model and adding a global attention mechanism, optimizing the model through an L1 regularized loss function, and integrating the C3 structure of the Global Context Block and Backbone to form the C3GC module.

Benefits of technology

While maintaining high accuracy, it significantly reduces model size and improves training efficiency, making it suitable for edge terminals such as Raspberry Pi devices, thus improving the accuracy and efficiency of tunnel lining crack detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120912503A_ABST
    Figure CN120912503A_ABST
Patent Text Reader

Abstract

The invention provides a training and detection method for a tunnel lining crack detection model, and the method comprises the steps: building a training set which comprises a plurality of RGB image samples marked with tunnel lining cracks; performing pruning processing on the first tunnel lining crack detection model based on the RGB image sample to obtain a second tunnel lining crack detection model; adding a global attention mechanism into the second tunnel lining crack detection model to obtain a third tunnel lining crack detection model; and training the third tunnel lining crack detection model based on an RGB image sample to obtain a trained third tunnel lining crack detection model. According to the method, channel pruning is performed on the YOLOv5s model, and a global attention mechanism is added, so that the model size is remarkably reduced and the training efficiency is improved while relatively high accuracy is kept.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of deep learning, in particular to a training method and a detection method of a tunnel lining crack detection model. BACKGROUND

[0002] As important transportation infrastructure, the structural safety of a tunnel is directly related to the safety and reliability of road traffic. Various diseases may occur in the tunnel during long-term use, and cracks are the initial form of disease, which need to be detected in a timely manner.

[0003] The traditional tunnel lining crack detection method mainly relies on manual inspection. This method requires high experience of the responsible inspector, and is easily affected by the subjective judgment of the inspector, resulting in low accuracy and efficiency of the detection result. In addition, with the continuous expansion of tunnel construction scale and the increasingly prominent aging problem, the traditional detection method has been difficult to meet the growing detection demand. With the development of computer deep learning, more and more deep learning models are applied to various defect detection. However, due to the disadvantages of occupying large memory, long computing time and large amount of calculation, the deep learning model is difficult to run in the edge terminal which has certain limitations in computing power, storage capacity and power consumption, so it is crucial to perform lightweight processing on the model.

[0004] At present, the method for lightweight processing of the model is to combine the knowledge distillation algorithm with network pruning, reconstruct the CBS feature extraction module in YOLOv5s using deep separable convolution, obtain a lightweight CBS feature extraction module, and compress the model by FPGM pruning. These methods reduce the model size, but affect the improvement of model accuracy and training efficiency. SUMMARY

[0005] Therefore, the present application provides a training method and a detection method of a tunnel lining crack detection model to solve the above technical problems.

[0006] In a first aspect, the embodiments of the present application provide a training method of a tunnel lining crack detection model, comprising:

[0007] A training set is established, and the training set includes a plurality of RGB image samples labeled with tunnel lining cracks;

[0008] Based on the RGB image samples, a first tunnel lining crack detection model is pruned to obtain a second tunnel lining crack detection model;

[0009] A global attention mechanism is added to the second tunnel lining crack detection model to obtain a third tunnel lining crack detection model;

[0010] The third tunnel lining crack detection model is trained based on RGB image samples to obtain a trained third tunnel lining crack detection model.

[0011] In a possible implementation, the first tunnel lining crack detection model adopts a YOLOv5s model.

[0012] The first tunnel lining crack detection model is pruned based on RGB image samples to obtain a second tunnel lining crack detection model, including:

[0013] The first tunnel lining crack detection model is used to process the RGB image samples to obtain a category prediction value of the lining crack, a confidence and a bounding box prediction value of the lining crack.

[0014] Based on the category prediction value and a category true value of the lining crack, a classification loss value L cls is determined.

[0015] Based on the confidence and a true situation, a confidence loss value L conf is determined.

[0016] Based on the bounding box prediction value and a bounding box true value of the lining crack, a positioning loss value L loc is determined.

[0017] Based on the classification loss value L cls , the confidence loss value L conf and the positioning loss value L loc , a first loss value L original is determined:

[0018] L original =λ cls L cls +λ conf L conf +λ loc L loc

[0019] wherein λ cls , λ conf and λ loc are weight coefficients of the classification loss, the confidence loss and the bounding box loss respectively.

[0020] An L1 regularization loss value is added to the first loss value L original to obtain a second loss value L total :

[0021]

[0022] Wherein, Γ represents a set of scaling factors of all batch normalization layers in the first tunnel lining crack detection model, and γ represents a scaling factor of a batch normalization layer; λ represents a regularization coefficient;

[0023] The second loss value L total updating the parameters of the first tunnel lining crack detection model and all γs;

[0024] sorting all γs in ascending order to obtain a sequence, removing channels corresponding to the first preset number of γs in the sequence, and obtaining a second tunnel lining crack detection model.

[0025] In a possible implementation, a global attention mechanism is added to the second tunnel lining crack detection model to obtain a third tunnel lining crack detection model.

[0026] comprising:

[0027] all C3 modules in the second tunnel lining crack detection model are replaced with C3GC modules with a global attention mechanism.

[0028] In a possible implementation, the processing process of the C3GC module is as follows:

[0029] Setting the feature map input of the C3GC module as X and the feature map output as Z, there is:

[0030]

[0031] Wherein, z i is the feature vector of the i th pixel of the feature map Z; x i is the feature Figure X vector of the i th pixel of the feature map; N p is the total number of pixels of the feature map; W k is a learnable weight matrix for mapping the input features to an attention calculation space to generate an attention coefficient; W v is a learnable weight matrix for mapping the weighted global features back to the original space; exp(·) is an exponential function.

[0032] In a second aspect, the embodiments of the present application provide a detection method, which is implemented based on the third tunnel lining crack detection model trained according to the embodiments of the present application, and comprises:

[0033] obtaining an RGB image containing a tunnel lining crack;

[0034] processing the RGB image by using the third tunnel lining crack detection model trained to obtain a detection result of the tunnel lining crack.

[0035] In a third aspect, an embodiment of the present application provides a training device of a tunnel lining crack detection model, comprising:

[0036] A building unit is configured to build a training set, wherein the training set comprises a plurality of RGB image samples labeled with tunnel lining cracks;

[0037] A pruning unit is configured to prune the first tunnel lining crack detection model based on the RGB image samples to obtain a second tunnel lining crack detection model;

[0038] An expansion unit is configured to add a global attention mechanism to the second tunnel lining crack detection model to obtain a third tunnel lining crack detection model;

[0039] A training unit is configured to train the third tunnel lining crack detection model based on the RGB image samples to obtain a trained third tunnel lining crack detection model.

[0040] In a fourth aspect, an embodiment of the present application provides a detection device, comprising:

[0041] An acquisition unit is configured to acquire an RGB image containing tunnel lining crack information;

[0042] A detection unit is configured to process the RGB image by using the trained third tunnel lining crack detection model to obtain a detection result of the tunnel lining crack.

[0043] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the training method or the detection method of the tunnel lining crack detection model according to the computer program.

[0044] In a sixth aspect, an embodiment of the present application provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executable on a processor to implement the training method or the detection method of the tunnel lining crack detection model.

[0045] The present application prunes the channel of the YOLOv5s model and adds a global attention mechanism, thereby achieving significant reduction of the model size and improvement of the training efficiency while maintaining high accuracy. BRIEF DESCRIPTION OF DRAWINGS

[0046] In order to more clearly illustrate the technical solutions in the specific embodiments or prior art of the present application, the drawings needed to be used in the description of the specific embodiments or prior art will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0047] Figure 1 The flow chart of the training method of the tunnel lining crack detection model provided by the embodiments of the present application;

[0048] Figure 2 The structural diagram of the prior art YOLOv5s model provided by the embodiments of the present application;

[0049] Figure 3 The structural diagram of the YOLOv5s model with global attention mechanism added provided by the embodiments of the present application;

[0050] Figure 4 The flow chart of the detection method provided by the embodiments of the present application;

[0051] Figure 5 The weight distribution histogram of the model with λ being 0.0001 provided by the embodiments of the present application;

[0052] Figure 6 The weight distribution histogram of the model with λ being 0.0003 provided by the embodiments of the present application;

[0053] Figure 7 The weight distribution histogram of the model with λ being 0.0005 provided by the embodiments of the present application;

[0054] Figure 8 The accuracy comparison chart of the model under different pruning rates provided by the embodiments of the present application;

[0055] Figure 9 The model precision comparison chart before and after fine-tuning provided by the embodiments of the present application;

[0056] Figure 10 The functional structure diagram of the training device of the tunnel lining crack detection model provided by the embodiments of the present application;

[0057] Figure 11 The functional structure diagram of the detection device provided by the embodiments of the present application;

[0058] Figure 12 The functional structure diagram of the electronic device provided by the embodiments of the present application. DETAILED DESCRIPTION

[0059] To make the purposes, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some but not all of the embodiments of the present application. The components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations.

[0060] Therefore, the detailed description of the embodiments of the present application provided below in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. All other embodiments obtained by a person of ordinary skill in the art without making creative efforts based on the embodiments in the present application are within the scope of protection of the present application.

[0061] First, the design idea of the embodiments of the present application is briefly introduced.

[0062] In order to overcome the shortcomings of the prior art, the present application provides a tunnel lining crack detection model training method, which adopts a combination of channel pruning and global attention mechanism to perform lightweight processing on a YOLOv5s model, thereby achieving significant reduction of model size and improvement of training efficiency while maintaining high accuracy of the model. The model is deployed on an edge terminal Raspberry Pi 5, and it is found that it performs well in tunnel lining crack detection.

[0063] First, the YOLOv5s model is pruned in channels, and an L1 regularization loss function is added to:

[0064]

[0065] wherein, represents the loss function after adding L1 regularization, represents the weight parameter vector of the model, which determines the mapping relationship of the model to the input data, and L1 regularization directly acts on By optimizing the loss function to adjust the values of these weight parameters, sparsification is achieved. (i) represents the i-th RGB image sample, represents the predicted output of the model when given the weight parameter and the input data m (i) , n (i) represents the true value of the i-th RGB image sample, so represents the difference between the predicted value and the true value. N represents the number of samples. λ represents the regularization coefficient, which determines the influence degree of L1 regularization on the model optimization process (the parameter of λ needs to be adjusted), M represents the dimension of the weight parameter, and θ j is the weight parameter the jth element in the vector. is the 1-norm of the weight vector multiplied by the regularization coefficient.

[0066] By using L1 regularization on the scaling factor of the batch normalization (BN) layer in YOLOv5s, the model is trained to be sparse, making the sum of the absolute values of the weights as small as possible. The values of the BN layer after sparsification are sorted to evaluate the importance of the channels. Generally, the smaller the gamma coefficient, the lower the importance of the channel. All the gammas are sorted in ascending order, and by pruning the channels corresponding to the first pre-set number of gammas, the weights and biases of the model are updated, and the convolution, BN layer and activation function, etc. are reconfigured to maintain the original input / output dimensions. The accuracy of the pruned model may decrease and needs to be fine-tuned to restore the performance. The pruned model is fine-tuned to further improve the detection accuracy. The fine-tuning process includes loading the pruned model, retraining it using training data, and adjusting the model's parameters to optimize performance. Through fine-tuning, the accuracy and generalization ability of the pruned model can be further improved.

[0067] Then the Global Context Block is fused with the C3 structure of the Backbone to propose a new feature extraction structure C3GC.

[0068] After introducing the application scenarios and design ideas of the embodiments of the present application, the technical solutions provided by the embodiments of the present application are described below.

[0069] As shown in Figure 1 The training method of the tunnel lining crack detection model provided by the embodiments of the present application includes:

[0070] Step 101: Establish a training set, which includes a plurality of RGB image samples labeled with tunnel lining cracks;

[0071] Step 102: Based on the RGB image samples, the first tunnel lining crack detection model is pruned to obtain a second tunnel lining crack detection model;

[0072] Step 103: Add a global attention mechanism to the second tunnel lining crack detection model to obtain a third tunnel lining crack detection model;

[0073] Step 104: Based on the RGB image samples, the third tunnel lining crack detection model is trained to obtain a trained third tunnel lining crack detection model.

[0074] The method of the embodiment of the application prunes the channel of the YOLOv5s model and increases the global attention mechanism, thereby realizing significant reduction of the model size and improvement of the training efficiency while maintaining high accuracy. Tests show that the method provides an effective solution for the deployment of the tunnel lining crack detection model in edge terminals and has important practical application value and theoretical significance.

[0075] In some embodiments, the first tunnel lining crack detection model adopts a YOLOv5s model, as shown in Figure 2 , wherein, Focus: down-sampling; Conv: convolution; CSP1: CSP module with shortcut; CSP2: CSP module without shortcut; C3: CSP module with 3 convolution layers inside; SPPF: spatial pyramid pooling layer; Concat: concatenation; Upsample: up-sampling; Detect: detection head; CBS: Conv2D+Batch Normalization+SiLU, two-dimensional convolution+batch normalization+SiLU activation function; CBL: Conv2D+Batch Normalization+LeakyReLU, two-dimensional convolution+batch normalization+LeakyReLU activation function;

[0076] In some embodiments, based on the RGB image sample, the first tunnel lining crack detection model is pruned to obtain a second tunnel lining crack detection model; including:

[0077] The first tunnel lining crack detection model is used to process the RGB image sample to obtain a category prediction value of the lining crack, a confidence and a bounding box prediction value of the lining crack;

[0078] Based on the category prediction value and the category true value of the lining crack, a classification loss value L cls is determined;

[0079] Based on the confidence and the true situation, a confidence loss value L conf is determined;

[0080] Based on the bounding box prediction value and the bounding box true value of the lining crack, a positioning loss value L loc is determined;

[0081] Based on the classification loss value L cls , the confidence loss value L conf and the positioning loss value L loc , a first loss value L original is determined:

[0082] L original =λ cls L cls +λconf L conf +λ loc L loc

[0083] Where, λ cls , λ conf and λ loc These are the weight coefficients for classification loss, confidence loss, and bounding box loss, respectively.

[0084] First loss value L original The loss value after adding L1 regularization is used to obtain the second loss value L. total :

[0085]

[0086] Where Γ represents the set of scaling factors for all batch normalized layers in the first tunnel lining crack detection model, γ represents the scaling factor for a batch normalized layer, and λ represents the regularization coefficient;

[0087] Using the second loss value L total The parameters and all γ values ​​of the first tunnel lining crack detection model are updated;

[0088] Sort all γ values ​​in ascending order to obtain a sequence. Remove the channels corresponding to the first preset number of γ values ​​in the sequence to obtain the second tunnel lining crack detection model.

[0089] In some embodiments, a global attention mechanism is incorporated into the second tunnel lining crack detection model to obtain a third tunnel lining crack detection model; including:

[0090] Replace all C3 modules in the second tunnel lining crack detection model with C3GC modules that incorporate a global attention mechanism. For example... Figure 3 As shown, GCC3 is the C3 module for global attention.

[0091] In some embodiments, the processing procedure of the C3GC module is as follows:

[0092] If we set the input feature map of the C3GC module to X and the output feature map to Z, then:

[0093]

[0094] Among them, z i x is the feature vector of the i-th pixel in feature map Z; i Features Figure X The feature vector of the i-th pixel; N p W represents the total number of pixels in the feature map. kis a learnable weight matrix used to map the input features to the attention calculation space to generate the attention coefficients; W v is a learnable weight matrix used to map the weighted global features back to the original space; exp(·) is an exponential function.

[0095] As shown in Figure 4 , the embodiment of the present application provides a detection method, which is realized based on a third tunnel lining crack detection model trained, and includes the following steps:

[0096] Step 201: acquiring an RGB image containing a tunnel lining crack;

[0097] Step 202: processing the RGB image by using the third tunnel lining crack detection model trained to obtain a detection result of the tunnel lining crack.

[0098] The detection method improves the detection accuracy of the tunnel lining crack.

[0099] The specific implementation process of the present application will be described below in combination with a specific application scenario.

[0100] First, model pruning is performed: λ is continuously changed in the range of 0.0001 to 0.0005, Figure 5 、 Figure 6 and Figure 7 are the model weight distribution histograms when λ is 0.0001, 0.0003 and 0.0005 respectively. The vertical axis of the histogram is the number of training times, and the horizontal axis is the distribution of the BN layer weight. With the increase of the number of training times, the peak value of the horizontal axis is constantly close to the vertical axis, which means that most of the BN layers have become sparse. When λ is 0.0001, the model is too slow to be sparsified. At this time, the number of channels with a scaling factor of 0 cannot be found, and channel pruning cannot be performed. When λ is 0.0005, the model is sparsified too fast. At this time, most of the BN layer channels with a scaling factor of 0 are filtered out in the early stage of sparse training, which will affect the accuracy of the model. After many experiments, it is found that when λ is 0.0003, when the number of training rounds is about 90, the peak value of the horizontal axis of the model returns to zero, and at this time the model has basically met the requirements of the pruning test.

[0101] In order to balance the accuracy and complexity, the pruning rate is adjusted from 0.60 to 0.70 at an interval of 0.05. As shown in Figure 8 , when the pruning rate rises to 0.65, the model accuracy changes suddenly, so the pruning rate of 0.65 is the best, and the accuracy comparison diagram is shown as block ①.

[0102] As shown in Figure 9As shown, after 200 rounds of fine-tuning, the accuracy of the pruned model decreased by 6.34% compared with the original YOLOv5s model, and the accuracy after 300 rounds decreased by only 5.83%. It can be seen that while maintaining a high accuracy, the complexity of the pruned model is significantly reduced, indicating that there are a large number of redundant channels in the original YOLOv5s, and the performance is improved after deletion.

[0103] The global attention mechanism is fused to shorten the model training time. The model is named: the original model is YoLov5s, the model after pruning operation is named fine_tune_pruned, and the model after pruning operation and fusing GC attention mechanism is named Global_Context. The results in Table 3 show that the accuracy is slightly improved, compared with the original model, the training time without fusing GC attention mechanism is reduced by 3.01%, and the training time with fusing GC attention mechanism is reduced by 13.8%. Fusing the GC attention mechanism improves the model performance, focusing on crack feature information in crack detection, reducing the attention of the network to background information, thereby improving the results.

[0104] Table 3

[0105] Model mAP Training time / hour YoLov5s 0.9606 6.631 finetune_pruned 0.901 5.896 Global_Context 0.91 5.718

[0106] Connect the Raspberry Pi USB camera to collect images, embed the lightweight model into the Raspberry Pi system, and run the test. Table 4 shows that the performance of the model is compatible with the Raspberry Pi, the model accuracy is only reduced by 9.4%, but the model size is only 32% of the original model, and the detection time is also shorter, confirming the success of the model improvement and the feasibility of the mobile deployment.

[0107] Table 4

[0108] Model Hardware device mAP Average recognition time Model size yolov5s Raspberry Pi 99.5% 0.8 milliseconds 14048 kb Global_Context Raspberry Pi 90.1% 0.6 milliseconds 4490 kb

[0109] In order to verify the effectiveness of the model in identifying cracks, different crack data sets are collected for testing. The test results show that the model realizes significant reduction in model size and improvement in training efficiency while maintaining a high accuracy. Compared with the original YOLOv5s model, the lightweight model proposed in the application has a size of 32% of the original model, and the training time is shortened by 13.8%. These results prove the practicability and effectiveness of the proposed lightweight model in the edge computing environment.

[0110] Based on the same inventive concept, the embodiment of the application provides a training device for a tunnel lining crack detection model. Referring to Figure 10 As shown, the training device 300 for the tunnel lining crack detection model provided in the embodiment of the application at least includes:

[0111] The establishing unit 301 is configured to establish a training set, the training set comprising a plurality of RGB image samples labeled with tunnel lining cracks;

[0112] The pruning unit 302 is configured to perform pruning processing on the first tunnel lining crack detection model based on the RGB image samples to obtain a second tunnel lining crack detection model.

[0113] The expanding unit 303 is configured to add a global attention mechanism to the second tunnel lining crack detection model to obtain a third tunnel lining crack detection model.

[0114] The training unit 304 is configured to train the third tunnel lining crack detection model based on the RGB image samples to obtain a trained third tunnel lining crack detection model.

[0115] It should be noted that the training device 300 of the tunnel lining crack detection model provided in the embodiments of the present application solves the technical problems in the same way as the training method of the tunnel lining crack detection model provided in the embodiments of the present application. Therefore, the implementation of the training device 300 of the tunnel lining crack detection model provided in the embodiments of the present application can be referred to the implementation of the training method of the tunnel lining crack detection model provided in the embodiments of the present application, and the repeated parts will not be described here.

[0116] Based on the same inventive concept, the embodiments of the present application provide a detection device, as shown in Figure 11 The detection device 400 provided in the embodiments of the present application at least comprises:

[0117] The acquisition unit 401 is configured to acquire an RGB image containing tunnel lining crack information.

[0118] The detection unit 402 is configured to process the RGB image using the trained third tunnel lining crack detection model to obtain a detection result of the tunnel lining crack.

[0119] It should be noted that the detection device 400 provided in the embodiments of the present application solves the technical problems in the same way as the detection method provided in the embodiments of the present application. Therefore, the implementation of the detection device 400 provided in the embodiments of the present application can be referred to the implementation of the detection method provided in the embodiments of the present application, and the repeated parts will not be described here.

[0120] Based on the same inventive concept, the embodiments of the present application further provide an electronic device, as shown in Figure 12 The electronic device comprises a memory and a processor, the memory stores an executable program, and the processor executes the executable program to implement the training method of the tunnel lining crack detection model or the detection method.

[0121] The processor can be a general processor, a digital signal processor, an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. The general processor can be a microprocessor or any conventional processor.

[0122] The memory can include a non-transitory memory in a computer readable medium, a random access memory (RAM) and / or a non-volatile memory, such as a read-only memory (ROM) or a flash memory. The memory is an example of a computer readable medium.

[0123] The embodiments of the present application further provide a storage medium carrying one or more computer programs, and the one or more computer programs are executed by a processor to implement the configuration modification method or the configuration update method.

[0124] The storage medium in the embodiments of the present application can be included in an electronic device / system, or can exist separately and not be assembled into the electronic device / system. The storage medium carries one or more programs, and when the one or more programs are executed, the configuration modification method or the configuration update method is implemented.

[0125] According to the embodiments of the present application, the computer readable storage medium can be a non-volatile computer readable storage medium, which can include but is not limited to a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any appropriate combination thereof. In the present application, the computer readable storage medium can be any tangible medium that contains or stores a program, which can be used by or in connection with an instruction execution system, apparatus or device.

[0126] The above examples are only exemplary embodiments of the present application, and are not intended to limit the present application, and the protection scope of the present application is defined by the claims. Those skilled in the art can make various modifications or equivalent replacements to the present application within the spirit and protection scope of the present application, and such modifications or equivalent replacements are also considered to fall within the protection scope of the present application.

Claims

1. A method of training a tunnel lining crack detection model, characterized by, The method comprises the following steps: establishing a training set comprising a plurality of RGB image samples labeled with tunnel lining cracks; pruning a first tunnel lining crack detection model based on the RGB image samples to obtain a second tunnel lining crack detection model; adding a global attention mechanism to the second tunnel lining crack detection model to obtain a third tunnel lining crack detection model; training the third tunnel lining crack detection model based on the RGB image samples to obtain a trained third tunnel lining crack detection model.

2. The method of claim 1, wherein, The first tunnel lining crack detection model adopts a YOLOv5s model; The pruning of the first tunnel lining crack detection model based on the RGB image samples to obtain the second tunnel lining crack detection model comprises the following steps: processing the RGB image samples by using the first tunnel lining crack detection model to obtain class prediction values, confidence and bounding box prediction values of the lining cracks; Based on the category predicted value and the category true value of the lining crack, a classification loss value L is determined cls ; Based on the confidence and the real situation, a confidence loss value L is determined conf ; Based on the bounding box predicted value and the bounding box true value of the lining crack, a positioning loss value L is determined loc ; based on a classification loss value L cls , a confidence loss value L conf , and a positioning loss value L loc , a first loss value L original is determined L original = λ cls L cls + λ conf L conf + λ loc L loc where λ cls , λ conf , and λ loc are weight coefficients for the classification loss, the confidence loss, and the bounding box loss, respectively. In the first loss value L original The loss value after increasing the L1 regularization in the middle, obtains the second loss value L total : wherein Γ represents a set of scaling factors of all batch normalization layers in the first tunnel lining crack detection model, and γ represents a scaling factor of a batch normalization layer; λ represents a regularization coefficient; using the second loss value L total updating the parameters of the first tunnel lining crack detection model and all γ; sorting all γ in ascending order to obtain a sequence, removing the channels corresponding to the first preset number of γ in the sequence to obtain the second tunnel lining crack detection model.

3. The method of claim 2, wherein, The adding of the global attention mechanism to the second tunnel lining crack detection model to obtain the third tunnel lining crack detection model comprises the following steps: replacing all C3 modules in the second tunnel lining crack detection model with C3GC modules with the global attention mechanism.

4. The method of claim 3, wherein, The processing process of the C3GC module is as follows: setting the feature map input of the C3GC module as X and the feature map output as Z, then where z i is the feature vector of the i-th pixel of the feature map Z; x i is the feature vector of the i-th pixel of the feature map X; N p is the total number of pixels of the feature map; W k is a learnable weight matrix that maps the input features to an attention computation space to generate attention coefficients; W v is a learnable weight matrix that maps the weighted global features back to the original space; exp(·) is the exponential function.

5. A detection method based on the third tunnel lining crack detection model implemented after training according to any one of claims 1-4, characterized in that, comprising: obtaining an RGB image containing tunnel lining cracks; processing the RGB image by using the trained third tunnel lining crack detection model to obtain a detection result of the tunnel lining cracks. 6.A device for training a tunnel lining crack detection model, characterized in that, comprising: a establishing unit configured to establish a training set comprising a plurality of RGB image samples labeled with tunnel lining cracks; a pruning unit configured to prune a first tunnel lining crack detection model based on the RGB image samples to obtain a second tunnel lining crack detection model; an expanding unit configured to add a global attention mechanism to the second tunnel lining crack detection model to obtain a third tunnel lining crack detection model; a training unit configured to train the third tunnel lining crack detection model based on the RGB image samples to obtain a trained third tunnel lining crack detection model.

7. A detection device, characterized in that comprising: an obtaining unit configured to obtain an RGB image containing tunnel lining crack information; a detection unit configured to process the RGB image by using the trained third tunnel lining crack detection model to obtain a detection result of the tunnel lining cracks.

8. An electronic device, comprising: comprising: a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1-4 or the method according to claim 5 when executing the computer program.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions, which, when executed by the processor, implement the method of any one of claims 1-4 or the method of claim 5.