A lightweight tunnel crack detection method based on improved YOLOv5s
By improving the YOLOv5s network model, using the improved inverse residual IntertedR module and standard convolution Conv module, the existing model has solved the problems of large parameters, slow detection speed or low accuracy, and the accuracy of tunnel crack detection has been improved. and lightweight model.
Patent Information
- Application Number
- CN202410636610.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-05-22
AI Technical Summary
The existing models used for tunnel crack detection have problems such as large number of model parameters, slow detection speed or low accuracy.
The improved YOLOv5s network model is adopted, and the Backbone part of the original YOLOv5s network model is improved, and the improved inverse residual IntertedR module and standard convolution Conv module are used to reduce the amount of parameters and improve the detection speed.
The YOLOv5s model is lightweight, which improves the accuracy of tunnel crack detection and reduces the complexity of the model, making it suitable for deployment on small devices.
Smart Images

Figure CN118447370B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of tunnel crack detection, and in particular to a lightweight tunnel crack detection method based on improved YOLOv5s. Background Art
[0002] In recent years, with the rapid economic growth, the scale of tunnel construction has become larger and larger. Since tunnels have been under the influence of various factors such as topography and geology during long-term operation, tunnels will suffer from different degrees of diseases during the construction process and even in the later use process after completion. Among them, cracks are the most common disease on the tunnel lining surface. Therefore, the treatment of tunnel diseases has gradually become a hot topic of social concern.
[0003] With the rapid development of computers, image processing algorithms have gradually been applied to crack detection due to their advantages of high precision, automation, and long distance. Among them, although mathematical image algorithms can quickly identify cracks, their recognition accuracy is seriously affected by light brightness, and the recognition accuracy of tunnel cracks still needs to be improved. The deep learning target detection algorithm is relatively more versatile and more suitable for the detection of tunnel lining cracks. The deep learning model needs to be modeled and trained based on the database. For tunnel crack image acquisition, a tunnel crack acquisition vehicle is generally used, and cameras and other devices are built to complete image acquisition. However, the existing models for tunnel crack detection still have problems such as large model parameters, slow detection speed, or low accuracy. Summary of the invention
[0004] The purpose of the present invention is to provide a lightweight tunnel crack detection method based on improved YOLOv5s to solve the problems in the prior art of large model parameters, slow detection speed or low accuracy.
[0005] In order to achieve the above-mentioned purpose, the present invention provides a lightweight tunnel crack detection method based on improved YOLOv5s, comprising the following steps: collecting real tunnel images and establishing a tunnel image database; screening and processing the images in the tunnel image database, and constructing a training set and a test set; establishing an improved YOLOv5s network model; training the improved YOLOv5s network model using the training set, and testing the improved YOLOv5s network model using the test set; wherein, the method for establishing the improved YOLOv5s network model specifically comprises: improving the Backbone part of the original YOLOv5s network model, wherein the Backbone part of the improved YOLOv5s network model consists of a plurality of improved inverted residual IntertedR modules and a plurality of standard convolution Conv modules; on the basis of a Mobilenetv2 network model with a step size of 2, changing the convolution kernel at the depth convolution position from 3*3 to 5*5, and obtaining an improved inverted residual IntertedR module.
[0006] Furthermore, the structure of the improved inverted residual IntertedR module includes: a ConvBNRelu6 layer with a convolution kernel size of 1*1, a ConvBNRelu6 layer with a convolution kernel size of 5*5, and a Conv layer with a convolution kernel size of 1*1.
[0007] Furthermore, the improved inverted residual IntertedR module includes the following steps when processing the feature map: inputting the feature map into the ConvBNRelu6 layer with a convolution kernel size of 1*1 for dimensionality increase, then performing feature extraction through the ConvBNRelu6 layer with a convolution kernel size of 5*5, and then performing dimensionality reduction through the Conv layer with a convolution kernel size of 1*1, and when the step size is equal to 1 or the input channel is equal to the output channel, adding the obtained feature map to the initial input feature map to form the output feature map.
[0008] Furthermore, the standard convolution Conv module consists of a 2D convolution layer + a Bn layer + a SiLU activation function.
[0009] Furthermore, the structure of the Backbone part of the improved YOLOv5s network model specifically includes: the first layer: standard convolution Conv module, the number of channels = 32, the convolution kernel size = 3*3; the second layer: standard convolution Conv module, the number of channels = 32, the convolution kernel size = 3*3; the third layer: the inverted residual IntertedR module, the number of channels = 64; the fourth layer: the standard convolution Conv module, the number of channels = 64, the convolution kernel size = 3*3; the fifth layer: the inverted residual IntertedR module, the number of channels = 160; the sixth layer: the standard convolution Conv module, the number of channels = 160, the convolution kernel size = 3*3; the seventh layer: the standard convolution Conv module, the number of channels = 160, the convolution kernel size = 3*3; the eighth layer: the inverted residual IntertedR module, the number of channels = 320; the ninth layer: the standard convolution Conv module, the number of channels = 320, the convolution kernel Size = 3*3; Tenth layer: standard convolution Conv module, number of channels = 320, convolution kernel size = 3*3; Eleventh layer: standard convolution Conv module, number of channels = 320, convolution kernel size = 3*3; Twelfth layer: standard convolution Conv module, number of channels = 360, convolution kernel size = 3*3; Thirteenth layer: standard convolution Conv module, number of channels = 360, convolution kernel size = 3*3; Fourteenth layer: standard convolution Conv module, number of channels = 360, convolution kernel size = 3*3; Fifteenth layer: inverted residual IntertedR module, number of channels = 396; Sixteenth layer: standard convolution Conv module, number of channels = 396, convolution kernel size = 3*3; Seventeenth layer: standard convolution Conv module, number of channels = 396, convolution kernel size = 3*3; Eighteenth layer: standard convolution Conv module, number of channels = 420, convolution kernel size = 3*3.
[0010] Furthermore, the first layer performs a convolution operation on the input feature map, and the feature map becomes half of the original one; the second layer performs a convolution operation on the feature map, and the feature map remains unchanged; the third layer performs a dimensionality increase and dimensionality reduction operation on the feature map, and the feature map becomes half of the original one; the fourth layer performs a convolution operation on the feature map, and the feature map remains unchanged; the fifth layer performs a dimensionality increase and dimensionality reduction operation on the feature map, and the feature map becomes half of the original one; the sixth layer performs a convolution operation on the feature map, and the feature map remains unchanged; the seventh layer performs a convolution operation on the feature map and further fuses the feature map; the eighth layer performs a dimensionality increase and dimensionality reduction operation on the feature map, and the feature map becomes half of the original one; the ninth layer performs a dimensionality increase and dimensionality reduction operation on the feature map. The dimensionality reduction operation remains unchanged on the feature map; the tenth layer performs a convolution operation on the feature map, and the feature map remains unchanged; the eleventh layer performs a convolution operation on the feature map, and the feature map remains unchanged; the twelfth layer performs a convolution operation on the feature map, and the feature map remains unchanged; the thirteenth layer performs a convolution operation on the feature map, and the feature map remains unchanged; the fourteenth layer performs a convolution operation on the feature map and further fuses the feature map; the fifteenth layer performs a dimensionality increase and dimensionality reduction operation on the feature map, and the feature map becomes half of the original size; the sixteenth layer performs a convolution operation on the feature map, and the feature map remains unchanged; the seventeenth layer performs a convolution operation on the feature map, and the feature map remains unchanged; the eighteenth layer performs a convolution operation on the feature map, and the feature map remains unchanged.
[0011] Furthermore, the improved YOLOv5s network model is trained using the loss function, and the loss function is the loss function ISIoU, and the formula is as follows:
[0012]
[0013] in,
[0014]
[0015]
[0016]
[0017]
[0018]
[0019] In the formula, IoU means intersection over union; Δ means angle cost; Ω means shape cost; α means parameter; are the horizontal and vertical coordinates of the center of the real frame; are the horizontal and vertical coordinates of the center of the prediction box; (c w ,c h ) is the width and height of the minimum bounding rectangle of the real box and the predicted box; (w,h) is the width and height of the predicted box; (w gt ,h gt ) are the width and height of the real frame.
[0020] The present invention provides a lightweight tunnel crack detection method based on improved YOLOv5s, which realizes the lightweight of the YOLOv5s model and improves the accuracy of tunnel crack detection.
[0021] Based on the implementations provided in the above aspects, this application can also be further combined to provide more implementations. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0023] Figure 1 The network structure diagram of the improved YOLOv5s network model designed for the present invention;
[0024] Figure 2 This is a network structure diagram of the improved inverted residual IntertedR module proposed in the present invention;
[0025] Figure 3 An input tunnel image when performing tunnel crack detection using the lightweight tunnel crack detection method based on improved YOLOv5s provided by the present invention;
[0026] Figure 4 The lightweight tunnel crack detection method based on improved YOLOv5s provided by the present invention is obtained Figure 3 The corresponding output image of the crack detection results. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only embodiments of a part of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention. Unless otherwise specified, the technical means used in the embodiments are conventional means well known to those skilled in the art.
[0028] The present invention relates to the technical field of tunnel crack detection, and in particular to a lightweight tunnel crack detection method, which belongs to the technical field of digital image processing. The present invention adopts an inverted residual structure IntertedR to reduce the number of parameters and the amount of calculation of the algorithm. In order to improve the problem of reduced accuracy caused by convolution kernel inactivation in the inverted residual structure, it is further proposed to expand the receptive field by increasing the convolution kernel; the present invention also designs a loss function Loss ISIoU To measure the difference between the predicted value and the actual value and improve the detection performance of the model.
[0029] In a specific optional embodiment of the present invention, a lightweight tunnel crack detection method based on improved YOLOv5s is provided, comprising the following steps:
[0030] Step 1: Collect real tunnel images and establish a tunnel image database;
[0031] A lightweight visual acquisition device, a sports SLR high-speed continuous shooting camera, and a strong light source of >300LUX are used to dynamically collect images of a tunnel lining as the dataset for this article.
[0032] Step 1.1: The power generation equipment (generator) provides 220V working voltage for the light source and control circuit;
[0033] 220V is AC power supply, which is converted into DC signal through rectification, filtering and voltage stabilization circuit, and then provided to the vehicle speed output mechanism, camera control mechanism and image acquisition mechanism.
[0034] Step 1.2: After the control circuit is working, the camera is controlled to shoot according to the driving distance (adjustable). After parameter adjustment and the cooperation of the external shooting environment, a clear and complete image of the inner surface of the tunnel is captured at a speed of 20km / h.
[0035] Specifically, a visual acquisition system was built on site, and different cameras, shooting methods, lighting, and vehicle speeds were used to capture images.
[0036] Optionally, in step 1, the lightweight visual acquisition device includes an equipment support mechanism, a vehicle speed output mechanism, a camera control mechanism, an image acquisition mechanism and a control circuit. The vehicle speed output mechanism includes a vehicle speed sensor and a frequency divider, the vehicle speed sensor is connected to the frequency divider, the frequency divider is connected to the camera control mechanism, and the camera control mechanism is connected to the image acquisition mechanism. By installing a camera control mechanism and an image acquisition mechanism on the equipment support mechanism, the image acquisition mechanism includes an adjustable angle single-lens reflex camera, a lens and a light source, and the illumination directions of the two are kept consistent. The vehicle speed output mechanism designed by modifying the vehicle speed sensor, that is, by connecting and designing a 4-frequency division circuit through two jk triggers, the pulse signal frequency of the vehicle speed sensor is reduced. In conjunction with the camera control mechanism, the focus of the single-lens reflex camera itself and the switch of the mechanical shutter can be controlled, that is, the modified vehicle speed sensor is connected to the camera trigger control terminal after passing through the focus relay and the shutter relay, thereby controlling the camera to take pictures. The automatic acquisition of the tunnel lining image is completed. The entire lightweight tunnel acquisition equipment is highly flexible and can adjust the shooting trigger distance and shooting angle in time according to needs; it is highly automatic, and the camera control mechanism first finds the vehicle speed sensor from the drive axle housing or transmission housing of the vehicle, and then re-encodes the pulse signal output by the modified vehicle speed sensor through the designed frequency division circuit, and can control the camera to focus and shoot autonomously according to the vehicle's driving distance; it has strong capture capabilities and can capture clear pictures under dark environments and high-speed movement conditions; it has strong adaptability and can be installed on any vehicle. After the vehicle speed sensor is modified, it can be connected and used, and can be quickly installed and deployed.
[0037] Step 2: Filter the images in the tunnel image database and process them to obtain the processed data set, and construct the training set and test set;
[0038] Step 2.1: Preprocess the images in the tunnel image database to obtain a processed data set;
[0039] Optionally, after cropping the image at 640×640, rotation, translation, noise, filtering and other effects were performed to expand the data set, and finally a processed data set containing 1700 crack images and 300 crack-free images was formed.
[0040] Step 2.2: Divide the processed data set into a training set and a test set in the ratio of 8:2. The training set is used to train the network, and the test set is used to judge the performance of the model after training.
[0041] Step 3: Establish an improved YOLOv5s network model;
[0042] Step 3.1: Improve the backbone network Backbone of the original YOLOv5s network model, and use the improved inverted residual IntertedR module combined with the standard convolution Conv module to replace the backbone network CSPDarknet53 of the original YOLOv5s network model for feature extraction.
[0043] like Figure 1 As shown, the present invention provides a network for extracting information features from a training set, that is, a structure of an improved YOLOv5s network model provided by the present invention, including:
[0044] First layer: standard convolution Conv module, number of channels = 32, convolution kernel size = 3*3, convolution operation is performed on the input image, and the feature map becomes half of the original;
[0045] The second layer: standard convolution Conv module, number of channels = 32, convolution kernel size = 3*3, convolution operation is performed on the feature map, and the feature map remains unchanged;
[0046] The third layer: the inverted residual IntertedR module, the number of channels = 64, performs dimensionality up-down operations on the feature map, and the feature map becomes half of the original;
[0047] The fourth layer: standard convolution Conv module, number of channels = 64, convolution kernel size = 3*3, convolution operation is performed on the feature map, and the feature map remains unchanged;
[0048] The fifth layer: the inverse residual IntertedR module, the number of channels = 160, performs dimensionality reduction operations on the feature map, and the feature map becomes half of the original;
[0049] The sixth layer: standard convolution Conv module, number of channels = 160, convolution kernel size = 3*3, convolution operation is performed on the feature map, and the feature map remains unchanged;
[0050] The seventh layer: standard convolution Conv module, the number of channels = 160, the convolution kernel size = 3*3, performs convolution operation on the feature map, and further fuses the feature map;
[0051] The eighth layer: the inverse residual IntertedR module, the number of channels = 320, performs dimensionality up-down operations on the feature map, and the feature map becomes half of the original;
[0052] The ninth layer: standard convolution Conv module, number of channels = 320, convolution kernel size = 3*3, the feature map is upgraded and reduced in dimension, and the feature map remains unchanged;
[0053] The tenth layer: standard convolution Conv module, number of channels = 320, convolution kernel size = 3*3, convolution operation is performed on the feature map, and the feature map remains unchanged;
[0054] Eleventh layer: standard convolution Conv module, number of channels = 320, convolution kernel size = 3*3, convolution operation is performed on the feature map, and the feature map remains unchanged;
[0055] Layer 12: Standard convolution Conv module, number of channels = 360, convolution kernel size = 3*3, convolution operation is performed on the feature map, and the feature map remains unchanged;
[0056] Thirteenth layer: standard convolution Conv module, number of channels = 360, convolution kernel size = 3*3, convolution operation is performed on the feature map, and the feature map remains unchanged;
[0057] The 14th layer: standard convolution Conv module, number of channels = 360, convolution kernel size = 3*3, convolution operation on the feature map, and further fusion of the feature map;
[0058] The fifteenth layer: the inverted residual IntertedR module, the number of channels = 396, performs dimensionality reduction operations on the feature map, and the feature map becomes half of the original;
[0059] The 16th layer: standard convolution Conv module, number of channels = 396, convolution kernel size = 3*3, convolution operation is performed on the feature map, and the feature map remains unchanged;
[0060] The 17th layer: standard convolution Conv module, number of channels = 396, convolution kernel size = 3*3, convolution operation is performed on the feature map, and the feature map remains unchanged;
[0061] The eighteenth layer: standard convolution Conv module, number of channels = 420, convolution kernel size = 3*3, convolution operation is performed on the feature map, and the feature map remains unchanged.
[0062] The network structure of the original YOLOv5s network model includes a C3 module, which is a module containing residual connections. The backbone network of the improved YOLOv5s network model does not include the C3 module, thereby reducing the number of C3 modules in the improved YOLOv5s network model, thereby reducing the amount of calculation by reducing the residual connections of the C3 modules in the network structure of the original YOLOv5s network model.
[0063] Among them, the standard convolution Conv module consists of a two-dimensional convolution layer + a Bn layer + a SiLU activation function.
[0064] Among them, the improved inverted residual IntertedR module is improved on the basis of the lightweight network Mobilenetv2. It is improved on the inverted residual structure with a step size of 2. At the same time, in order to improve the convolution inactivation problem of the inverted residual structure, the convolution kernel 3*3 at the depth convolution position is changed to the convolution kernel 5*5. The parameter amount is reduced through the depth-wise separable convolution to obtain the improved inverted residual IntertedR structure, so that the output is not easy to approach 0 under the nonlinear activation of the activation function.
[0065] Mobilenetv2 is a lightweight network that includes two cases:
[0066] stride=1 It increases the number of channels through 1×1 convolution, and after the dimension is increased, it reduces the parameters and calculation amount of the model through 3×3DW convolution, and then reduces the number of channels through 1×1 convolution. When the input channel is equal to the output channel, a shortcut operation is performed to add the input and the dimension-reduced output, and then the next operation is performed.
[0067] stride=2input≠outputIt increases the dimension through 1×1 convolution, then passes through 3×3DW convolution, and then reduces the dimension through 1×1 convolution. At this time, no Add operation is performed.
[0068] Mobilenetv2 is a process of first increasing the dimension and then reducing the dimension, which is opposite to the residual structure provided by the ResNet network, so it is called the inverted residual structure. In addition, when the number of feature maps is increased, the case where the step size is equal to 1 will increase the model calculation amount and running time due to the addition operation.
[0069] Therefore, in the model designed in this paper, the Mobilenetv2 inverted residual structure with a step size of 2 is adopted and improved.
[0070] In the actual training process of the Mobilenetv2 network structure, since the convolution kernel of the depthwise separable convolution is smaller than that of the conventional convolution, the output is easy to approach 0 under the nonlinear activation of the activation function, which will lead to the problem of convolution kernel inactivation. Therefore, in order to improve the problem of decreased accuracy caused by convolution kernel inactivation, the present invention expands the convolution kernel of the depthwise convolution to 5. The expansion of the convolution kernel can not only increase the receptive field, but also improve the problem of reduced accuracy.
[0071] like Figure 2As shown, the improved inverted residual IntertedR module provided by the present application is improved on the basis of the Mobilenetv2 structure with a step size of 2. When the structure of the improved inverted residual IntertedR module provided by the present application is used, the feature map is input into the ConvBNRelu6 layer with a convolution kernel size of 1*1 for dimension increase, and the feature is extracted through the ConvBNRelu6 layer with a convolution kernel size of 5*5, and the dimension is reduced through the Conv layer with a convolution kernel size of 1*1. When the step size is equal to 1 or the input channel is equal to the output channel, the obtained feature map is added to the feature map at the beginning of the input to form the output feature map.
[0072] In order to improve the inactivation problem of convolution of inverted residual structure, the present invention enlarges the convolution kernel so that the output is not easy to approach 0 under the nonlinear activation of the activation function, and reduces the number of parameters and the amount of calculation through depth-separable convolution.
[0073] Step 3.2: This paper also designs a new loss function ISIoU
[0074] ISIoU formula:
[0075]
[0076] in:
[0077]
[0078]
[0079]
[0080]
[0081]
[0082] In the formula, IoU means intersection over union; Δ means angle cost; Ω means shape cost; α means parameter; are the horizontal and vertical coordinates of the center of the real frame; are the horizontal and vertical coordinates of the center of the prediction box; (c w ,c h ) is the width and height of the minimum bounding rectangle of the real box and the predicted box; (w,h) is the width and height of the predicted box; (w gt ,h gt ) are the width and height of the real frame.
[0083] The loss function is used to evaluate the degree of error between the model's predicted results and the actual results. A smaller loss value means that the model's predicted results are closer to the actual results, and vice versa.
[0084] Based on the traditional IoU, CIoU takes into account the aspect ratio of the predicted box and the real box; DIoU combines the distance between the center points of the bounding box and the overlapping area; SIoU combines angle loss, distance loss, shape loss, and IoU loss; GIoU comprehensively considers the global information of the box; EIoU adds center point loss, width loss, and length loss.
[0085] The design idea of the newly designed loss function ISIOU in this application is: if the predicted box and the real box are congruent quadrilaterals, they can completely overlap. Congruent quadrilaterals refer to the lengths being equal, the widths being equal, and the angles being equal. And because the bounding box is a rectangular box, it is at right angles. Therefore, the ISIOU loss function provided in this application adds the judgment conditions of length and width on the basis of the SIOU loss function (combined with angle loss, distance loss, shape loss, and IoU loss), and proposes a new ISIOU loss function designed in this article.
[0086] The new loss function ISIoU provided in this application was compared with other loss functions. The experimental results are shown in Table 1:
[0087] Table 1 Comparative experimental table of loss functions
[0088] Model YOLOv5s Accuracy Recall R mAP@.5 mAP@.5:.95 +CIoU (original) 0.798 0.862 0.913 0.525 +DIoU 0.781 0.865 0.91 0.524 +SIoU 0.789 0.874 0.913 0.521 +GIoU 0.8 0.843 0.909 0.521 +EIoU 0.801 0.839 0.91 0.527 +ISIoU 0.807 0.848 0.913 0.518
[0089] According to the comparative experimental table of loss functions, the advantages of the new loss function ISIoU proposed in this design are obvious. The accuracy P is the best, and the recall R and map@.5 are better than GIOU and EIOU.
[0090] The new loss function provided by the present invention is beneficial to improving the detection accuracy of the lightweight tunnel crack detection method based on the improved YOLOv5s.
[0091] Step 4: Use the training set to train and improve the YOLOv5s network model to obtain a trained lightweight crack tunnel detection network model;
[0092] When training the improved YOLOv5s network model, the loss function is also used to train the improved YOLOv5s network model.
[0093] Specifically, the loss function is used to measure the difference between the predicted value and the actual value, and the model parameters are adjusted according to the value of the loss function. When the value of the loss function converges or reaches the preset number of training times, the trained lightweight crack tunnel detection network model is obtained.
[0094] Step 5: Use the test set to test the trained lightweight crack tunnel detection network model to obtain the detection results.
[0095] Will be like Figure 3The tunnel image shown is input into the trained lightweight crack tunnel detection network model, and the following is obtained: Figure 4 The image of the crack detection result output is shown. It can be seen that the lightweight tunnel crack detection method based on improved YOLOv5s provided by the present invention can realize accurate detection of tunnel cracks.
[0096] The present invention is based on the Pycharm development platform, uses the Python 3.7 computer programming language, uses the Pytorch1.7.1 module, and uses the NVIDIA GeForce RTX 3070 GPU to train the model. The batch-size is set to 16, the initial learning rate is 0.01, and the network parameters are debugged before training to ensure that each network can achieve optimal performance after training as much as possible.
[0097] The original YOLOv5s network model is compared with the improved YOLOv5s network model proposed in the present invention, and the results are shown in Table 2:
[0098] Table 2
[0099]
[0100] The patent focus of the present invention is to reduce the number of parameters and the amount of calculation. From the results of the three performance indicators of parameter quantity, GFLOPS, and FPS provided in Table 2, the algorithm proposed in the present invention, i.e., the improved YOLOv5s network model, has reduced the number of parameters by 3292136, the amount of calculation by 3.8, and the reasoning speed by 10.83 compared with the original YOLOv5s network model. The reduction in the number of parameters and the amount of calculation means that the algorithm provided by this application is more lightweight and reduces the complexity of the model. The reduction in parameters and the amount of calculation makes it lighter, thereby reducing storage requirements and transmission costs, reducing model complexity in models with high requirements for computing resources and memory, and making it easier to deploy on small devices, which is convenient for real-time detection.
[0101] The present invention belongs to the technical field of digital image processing and provides a lightweight tunnel crack detection method. The present invention adopts an inverted residual structure IntertedR to reduce the number of parameters and the amount of calculation of the algorithm. In order to improve the problem of reduced accuracy caused by convolution kernel inactivation in the inverted residual structure, it is further proposed to expand the receptive field by increasing the convolution kernel; the present invention designs a loss function Loss_ISIoU to measure the difference between the predicted value and the actual value, thereby improving the detection performance of the model.
[0102] The entire lightweight tunnel acquisition equipment is highly flexible and can adjust the shooting trigger distance and shooting angle in time according to needs; it is highly automatic, and the camera control mechanism can re-encode the output vehicle speed pulse signal, and can control the camera's autonomous focus and shooting according to the vehicle's travel distance; it has strong capture capabilities and can capture clear images under dark environments and high-speed movement conditions; it has strong adaptability and can be installed on any vehicle. After the vehicle's speed sensor is modified, it can be connected and used, and can be quickly installed and deployed.
[0103] The present invention improves the network structure of YOLOv5s, adopts an improved inverse residual IntertedR module combined with a Conv structure to form a backbone network of the improved YOLOv5s network model, greatly reducing the number of parameters. At the same time, in order to improve the convolution inactivation problem of the inverse residual structure, the convolution kernel is enlarged, so that the output is not easy to approach 0 under the nonlinear activation of the activation function.
[0104] The lightweight tunnel crack detection method based on improved YOLOv5s provided in the preferred embodiment of the present invention not only realizes the lightweight of the improved YOLOv5s network model, but also improves the accuracy of tunnel crack detection.
[0105] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
[0106] Unless otherwise defined, the technical terms or scientific terms used in the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, similar words such as "one", "one" or "the" do not indicate quantity restrictions, but indicate that there is at least one. Similar words such as "include" or "comprise" mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Similar words such as "connect" or "connected" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
Claims
1. A lightweight tunnel crack detection method based on improved YOLOv5s, characterized in that: The steps include: Collect real tunnel images and establish a tunnel image database; Screening and processing the images in the tunnel image database to construct a training set and a test set; Establish and improve the YOLOv5s network model; The improved YOLOv5s network model is trained using the training set, and the improved YOLOv5s network model is tested using the test set; Among them, the method of establishing an improved YOLOv5s network model specifically includes: Improve the Backbone part of the original YOLOv5s network model. The Backbone part of the improved YOLOv5s network model consists of multiple improved inverted residual IntertedR modules and multiple standard convolution Conv modules; Based on the Mobilenetv2 network model with a step size of 2, the convolution kernel at the depth convolution position is changed from 3*3 to 5*5 to obtain the improved inverted residual IntertedR module.
2. The lightweight tunnel crack detection method based on improved YOLOv5s according to claim 1, characterized in that: The structure of the improved inverted residual IntertedR module includes: A ConvBNRelu6 layer with a convolution kernel size of 1*1, a ConvBNRelu6 layer with a convolution kernel size of 5*5, and a Conv layer with a convolution kernel size of 1*1.
3. The lightweight tunnel crack detection method based on improved YOLOv5s according to claim 1 or 2, characterized in that: The improved inverse residual IntertedR module includes the following steps when processing the feature map: The feature map is input into the ConvBNRelu6 layer with a convolution kernel size of 1*1 for dimensionality increase, and then through the ConvBNRelu6 layer with a convolution kernel size of 5*5 for feature extraction, and then through the Conv layer with a convolution kernel size of 1*1 for dimensionality reduction. When the step size is equal to 1 or the input channel is equal to the output channel, the obtained feature map is added to the feature map at the beginning of the input to form the output feature map.
4. The lightweight tunnel crack detection method based on improved YOLOv5s according to claim 1, characterized in that: The standard convolution Conv module consists of a two-dimensional convolution layer + a Bn layer + a SiLU activation function.
5. The lightweight tunnel crack detection method based on improved YOLOv5s according to claim 1, characterized in that: The structure of the Backbone part of the improved YOLOv5s network model specifically includes: First layer: standard convolution Conv module, number of channels = 32, convolution kernel size = 3*3; Second layer: standard convolution Conv module, number of channels = 32, convolution kernel size = 3*3; The third layer: inverted residual IntertedR module, number of channels = 64; Fourth layer: standard convolution Conv module, number of channels = 64, convolution kernel size = 3*3; Fifth layer: inverted residual IntertedR module, number of channels = 160; The sixth layer: standard convolution Conv module, number of channels = 160, convolution kernel size = 3*3; Layer 7: standard convolution Conv module, number of channels = 160, convolution kernel size = 3*3; Layer 8: Inverted residual IntertedR module, number of channels = 320; Ninth layer: standard convolution Conv module, number of channels = 320, convolution kernel size = 3*3; Tenth layer: standard convolution Conv module, number of channels = 320, convolution kernel size = 3*3; Eleventh layer: standard convolution Conv module, number of channels = 320, convolution kernel size = 3*3; Layer 12: standard convolution Conv module, number of channels = 360, convolution kernel size = 3*3; Thirteenth layer: standard convolution Conv module, number of channels = 360, convolution kernel size = 3*3; Layer 14: standard convolution Conv module, number of channels = 360, convolution kernel size = 3*3; Layer 15: Inverted residual IntertedR module, number of channels = 396; Layer 16: standard convolution Conv module, number of channels = 396, convolution kernel size = 3*3; Layer 17: standard convolution Conv module, number of channels = 396, convolution kernel size = 3*3; Layer 18: Standard convolution Conv module, number of channels = 420, convolution kernel size = 3*3.
6. The lightweight tunnel crack detection method based on improved YOLOv5s according to claim 5 is characterized in that: The first layer performs a convolution operation on the input feature map, and the feature map becomes half of the original; The second layer performs a convolution operation on the feature map, and the feature map remains unchanged; The third layer performs dimension increase and dimension reduction operations on the feature map, and the feature map becomes half of the original size; The fourth layer performs a convolution operation on the feature map, and the feature map remains unchanged; The fifth layer performs dimension increase and dimension reduction operations on the feature map, and the feature map becomes half of the original one; The sixth layer performs a convolution operation on the feature map, and the feature map remains unchanged; The seventh layer performs a convolution operation on the feature map to further fuse the feature map; The eighth layer performs dimension increase and dimension reduction operations on the feature map, and the feature map becomes half of the original; The ninth layer performs dimension increase and dimension decrease operations on the feature map, and the feature map remains unchanged; The tenth layer performs a convolution operation on the feature map, and the feature map remains unchanged; The eleventh layer performs a convolution operation on the feature map, and the feature map remains unchanged; The twelfth layer performs a convolution operation on the feature map, and the feature map remains unchanged; The thirteenth layer performs a convolution operation on the feature map, and the feature map remains unchanged; The fourteenth layer performs a convolution operation on the feature map to further fuse the feature map; The fifteenth layer performs dimension up- and dimension down-dimension operations on the feature map, and the feature map becomes half of the original one; The sixteenth layer performs a convolution operation on the feature map, and the feature map remains unchanged; The seventeenth layer performs a convolution operation on the feature map, and the feature map remains unchanged; The eighteenth layer performs a convolution operation on the feature map, and the feature map remains unchanged.
7. The lightweight tunnel crack detection method based on improved YOLOv5s according to claim 1, characterized in that: The improved YOLOv5s network model is trained using a loss function, wherein the loss function is the ISIoU loss function, and the formula is as follows: in, In the formula, IoU means intersection over union; Δ means angle cost; Ω means shape cost; α means parameter; are the horizontal and vertical coordinates of the center of the real frame; are the horizontal and vertical coordinates of the center of the prediction box; (c w ,c h ) is the width and height of the minimum bounding rectangle of the real box and the predicted box; (w,h) is the width and height of the predicted box; (w gt ,h gt ) are the width and height of the real frame.
Citation Information
Patent Citations
Railway tunnel crack detection method based on improved residual network
CN112734734A
Security check picture contraband image detection method and device based on YOLOv5-Mobilenet network model and computer storage medium
CN117218583A