CN116863134A - Method and system for detecting and dividing length and width of tunnel lining crack - Google Patents
Method and system for detecting and dividing length and width of tunnel lining crack Download PDFInfo
- Publication number
- CN116863134A CN116863134A CN202310707660.2A CN202310707660A CN116863134A CN 116863134 A CN116863134 A CN 116863134A CN 202310707660 A CN202310707660 A CN 202310707660A CN 116863134 A CN116863134 A CN 116863134A
- Authority
- CN
- China
- Prior art keywords
- training
- detection
- crack
- dividing
- length
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 238000001514 detection method Methods 0.000 claims abstract description 73
- 238000012549 training Methods 0.000 claims description 68
- 230000011218 segmentation Effects 0.000 claims description 53
- 230000006870 function Effects 0.000 claims description 33
- 238000012360 testing method Methods 0.000 claims description 28
- 238000012795 verification Methods 0.000 claims description 18
- 238000012417 linear regression Methods 0.000 claims description 12
- 238000005457 optimization Methods 0.000 claims description 9
- 238000004422 calculation algorithm Methods 0.000 claims description 8
- 238000000605 extraction Methods 0.000 claims description 6
- PXFBZOLANLWPMH-UHFFFAOYSA-N 16-Epiaffinine Natural products C1C(C2=CC=CC=C2N2)=C2C(=O)CC2C(=CC)CN(C)C1C2CO PXFBZOLANLWPMH-UHFFFAOYSA-N 0.000 claims description 4
- 238000005259 measurement Methods 0.000 claims description 4
- 238000012545 processing Methods 0.000 claims description 4
- 239000011159 matrix material Substances 0.000 claims description 3
- 230000011514 reflex Effects 0.000 claims description 3
- 238000012216 screening Methods 0.000 claims description 3
- 230000009466 transformation Effects 0.000 claims description 3
- 238000005516 engineering process Methods 0.000 abstract description 6
- 230000007547 defect Effects 0.000 abstract description 5
- 238000013527 convolutional neural network Methods 0.000 description 7
- 238000004364 calculation method Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 3
- 201000010099 disease Diseases 0.000 description 2
- 208000037265 diseases, disorders, signs and symptoms Diseases 0.000 description 2
- 238000012800 visualization Methods 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 230000002068 genetic effect Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000011895 specific detection Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000011426 transformation method Methods 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/26—Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/766—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using regression, e.g. by projecting features on hyperplanes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/77—Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
- G06V10/774—Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02T—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
- Y02T10/00—Road transport of goods or passengers
- Y02T10/10—Internal combustion engine [ICE] based vehicles
- Y02T10/40—Engine management systems
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Evolutionary Computation (AREA)
- Artificial Intelligence (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Computing Systems (AREA)
- Databases & Information Systems (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Software Systems (AREA)
- Image Analysis (AREA)
Abstract
The application discloses a method and a system for detecting and dividing the length and the width of a tunnel lining crack, which are based on a YOLOv8 network model to replace two-stage detection models such as R-CNN, SPP Net, fast R-CN N and the like in the prior art, can ensure high precision while improving the detection and dividing speed of the tunnel lining crack by the model, train the YOLOv8 network model by using an image after data enhancement, ensure that the obtained model meets the detection and dividing precision, ensure that the detection and dividing model can be used for measuring the number, the length and the maximum width of the crack under various complex scenes, has wide application range and strong adaptability, and provides technical support for completely realizing the identification and the detection automation of tunnel defects by utilizing a computer vision technology in the future.
Description
Technical Field
The application belongs to the technical field of tunnel defect detection, and particularly relates to a method and a system for detecting and dividing the length and the width of a tunnel lining crack.
Background
With the rapid development of Chinese economy, the contradiction between the rapid expansion of urban space demand and the limited ground space is increasingly prominent, and the urban underground space is effectively developed and utilized more and more urgently. Tunnel structures have been developed as an important lifeline engineering for mankind to utilize underground space. However, since tunnels are semi-concealed projects built in underground geotechnical media, and our country tunnels are built at different times, different geological conditions and different levels of technology. Over the years of operation, many tunnels have suffered from various ailments, lining cracks being one of the most common and serious ailments. The method realizes automatic and rapid identification and detection of tunnel lining crack defects, has important fundamental significance for safety evaluation of tunnel lining structures and safety operation management of tunnels, is an urgent need in practical engineering application, and is a hotspot and front-edge problem of domestic and foreign research in the field of current tunnel engineering.
For a long time, the detection method of the tunnel lining crack is mainly based on manual measurement, and the method has the defects of low efficiency, high risk degree, strong subjectivity, incapability of ensuring accuracy, time and labor waste and the like. In recent years, due to a larger data set, a stronger computer and a technology capable of training a deeper network, a deep learning algorithm has a great breakthrough in the field of crack identification and obtains a better identification effect than a traditional method, typical target detection algorithms commonly used in the prior art mainly comprise R-CNN, SPP Net and Faster R-CNN, and although the algorithms have higher detection precision, the detection speed is slower, the detection precision and the detection speed are difficult to be compatible, and the detection precision can not meet engineering requirements under the influence of complex environments.
Disclosure of Invention
This section is intended to outline some aspects of embodiments of the application and to briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section as well as in the description of the application and in the title of the application, which may not be used to limit the scope of the application.
The application adopts the following technical scheme.
A method for detecting and dividing the length and width of a tunnel lining crack specifically comprises the following steps:
s1, collecting images of tunnel lining cracks, and obtaining training images after data enhancement;
s2: dividing the training image, reserving a test set, marking the rest images, and randomly dividing the rest images into a training set and a verification set according to a proportion;
s3: inputting a training set into a YOLOv8 network model for pre-training, using a verification set test model to detect and divide performance, using a test set optimization model to train super-parameters, and obtaining a detection and divide model;
s4, collecting images of tunnel lining cracks, and inputting the images into a detection and segmentation model;
and S5, detecting and segmenting the cracks in the tunnel lining crack image by using a detection and segmentation model, and calculating the length and the maximum width of the cracks.
Further, the data enhancement method used in the step S1 is a Mosaic, a random HSV, or an affine transformation.
Further, the tool for marking the image in step S2 is a Roboflow online marking tool, the data set dividing mode is to reserve partial data as a test set, and the dividing ratio of the training set and the verification set is 8:2.
further, the specific steps of the step S3 include:
inputting the training set into a YOLOv8 network model for pre-training, and preliminarily obtaining a detection and segmentation model;
the image is put forward from the test set and is input as a pre-training model, and the model is optimized to train super parameters;
inputting a verification set, and evaluating whether the detection and segmentation accuracy is met or not according to the obtained detection and segmentation result;
and adjusting the training super parameters, and repeating the steps until the optimal training super parameter combination is obtained.
Further, the training super-parameters comprise training round number, optimizer type, initial learning rate, parameter optimization algorithm, batch and segmentation mask downsampling rate of the input image.
Further, the image acquisition mode in the step S4 is at least one of unmanned aerial vehicle system acquisition, smart phone photographing acquisition and single lens reflex acquisition.
Further, the specific steps of the length calculation in step S5 are:
converting the result mask of the crack detection and segmentation module into a uint8 type through an astype function, and converting the result mask into a binary image;
performing skeleton extraction on the binary image through a skeletonizing function in a skeletonizing module, obtaining the finest skeleton structure through a lee method, and searching the boundary length after skeletonizing through a regionoprops function to obtain the skeleton path length of the crack;
carrying out position extraction of non-zero elements on the skeletonized image through an argwhere function to obtain two columns of coordinates representing path pixels, wherein the first column represents x coordinates and the second column represents y coordinates;
creating a linear regression model object through a linear regression function, fitting the coordinates of the path pixels by using a fitting function fit (x, y) function, wherein x is an abscissa array of the path pixels, y is an ordinate array of the path pixels, respectively calculating the minimum value and the maximum value of the x coordinates of the path pixels through min and max functions, and predicting the minimum value and the maximum value of y by using a trained linear regression model;
calculating the length of the path by using Euclidean distance according to the predicted y coordinate and the x coordinate range of the path, namely the length value L of the crack, wherein the Euclidean distance has the following specific expression:
in which x is max 、x min Respectively calculating the minimum value and the maximum value of the x coordinate of the path pixel, y max 、y min The minimum value and the maximum value of the y prediction of the trained linear regression model are respectively.
Further, the specific steps of calculating the width in step S5 are:
converting the result mask of the crack detection and segmentation module into a uint8 type through an astype function, and converting the result mask into a binary image;
finding all crack contours in the image through a findContours function in opencv, designating a contour retrieval mode as a tree retrieval mode to detect all crack contours, establishing a complete hierarchical relationship between the contours, and designating an approximation method of the contours as a simple approximation method so as to reduce the storage space of contour points and only reserve endpoint information;
for each contour, a minimum rectangular area capable of containing the contour is determined by extracting leftmost, rightmost, uppermost and lowermost points on the contour, and half of the minimum side length of the minimum rectangle is calculated as the upper limit of the radius of an inscribed circle to define a precision parameter P r ;
Constructing a grid point coordinate matrix containing all pixel points in a contour rectangular area, traversing each pixel point in a grid, judging whether the point is in the contour by using a pointPolygonTest function, screening out all pixel points in the contour, and adding the coordinates of all pixel points into a list;
randomly selecting a part of pixel points from the list, calculating the corresponding inscribed circle radius, and updating the current maximum radius and the center point;
circularly searching the rest pixel points, calculating the corresponding inscribed circle radius, updating the maximum radius and the center point, finally finding the crack position with the maximum radius from a crack inscribed circle radius list, and obtaining the corresponding center point and diameter value, namely the maximum crack width, wherein the specific expression of the precision parameter Pr is as follows:
wherein R is x 、L x The abscissa values of the leftmost and rightmost points on the contour, D y 、U y The ordinate values of the lowermost and uppermost points on the profile, respectively.
Furthermore, the YOLOv8 network model adopts a lightweight YOLOv8s-seg network structure.
The application further provides a system for detecting and dividing the length and the width of the tunnel lining crack, which is used for realizing the method for detecting and dividing, and comprises the following steps:
the image processing module is used for collecting images of tunnel lining cracks and obtaining training images after data enhancement;
the image dividing module is used for dividing the training image, reserving a test set, marking the rest images, and dividing the rest images into a training set and a verification set according to a proportion at random;
the model training module is used for inputting a training set into the YOLOv8 network model for pre-training, testing the detection and segmentation performance by using a verification set, and training the super-parameters by using a test set optimization model to obtain a detection and segmentation model;
the image acquisition module is used for acquiring images of tunnel lining cracks and inputting the images into the detection and segmentation model;
and the crack measurement module is used for detecting and segmenting the cracks in the tunnel lining crack image by using the detection and segmentation model, and calculating the length and the maximum width of the cracks.
Compared with the prior art, the application has the beneficial effects that:
according to the application, two-stage detection models such as R-CNN, SPP Net and Fas ter R-CNN in the prior art are replaced based on the YOLOv8 network model, the high precision can be ensured while the detection and segmentation speeds of the tunnel lining cracks by the model are improved, the YOLOv8 network model is trained by using the image after data enhancement, the obtained model is ensured to meet the detection and segmentation precision, the detection and segmentation model can be used for measuring the number, the length and the maximum width of cracks in various complex scenes, the application range is wide, the adaptability is strong, and the technical support is provided for fully realizing the recognition and detection automation of tunnel diseases by utilizing the computer vision technology in the future.
Drawings
FIG. 1 is a schematic flow chart of the overall method of the present application;
FIG. 2 is a flow chart illustrating the operation of the present application;
FIG. 3 is a schematic diagram of the process of optimizing and training the super-parameters by using the YOLOv8 model;
FIG. 4 is a schematic view of a tunnel lining crack image under the influence of external conditions acquired in the present application;
FIG. 5 is a schematic diagram of the model detection and segmentation results according to the present application;
FIG. 6 is a graph showing the calculation results of the crack length and the maximum width according to the present application;
fig. 7 is a schematic structural diagram of a detection segmentation system in the present application.
Detailed Description
In order that the above-recited objects, features and advantages of the present application will become more readily apparent, a more particular description of the application will be rendered by reference to specific embodiments thereof which are illustrated in the appended drawings.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application, but the present application may be practiced in other ways other than those described herein, and persons skilled in the art will readily appreciate that the present application is not limited to the specific embodiments disclosed below.
Further, reference herein to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic can be included in at least one implementation of the application. The appearances of the phrase "in one embodiment" in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. The present application provides the following examples.
As shown in fig. 1 to 6, the present embodiment provides a technical solution:
a method for detecting and dividing the length and width of a tunnel lining crack specifically comprises the following steps:
s1, collecting images of tunnel lining cracks, and obtaining training images after data enhancement.
The data enhancement method used in the embodiment is Mosaic, random HSV and affine transformation, the random HSV method is mainly used for adjusting chromaticity, saturation and brightness of the image, the affine transformation method is mainly used for adjusting inversion, translation and scaling of the image, and one or more methods can be combined according to actual requirements to conduct data enhancement processing on the image.
S2: dividing the training images, reserving a test set, marking the rest images, and dividing the rest images into a training set and a verification set according to a proportion.
In this embodiment, the tool for marking the image is a Roboflow online marking tool, the data set dividing mode is to reserve a small part of data as a test set, and the dividing ratio of the training set and the verification set is 8:2,8: the fully random division ratio of 2 is the ratio commonly used in neural network training.
S3: inputting the training set into a YOLOv8 network model for pre-training, testing the performance of detection and segmentation by using a verification set testing model, and training the super-parameters by using a testing set optimizing model to obtain the detection and segmentation model.
The latest version of YOLOv8 which is better in disease detection and segmentation is selected to replace two-stage detection models such as R-CNN, SPP Net, faster R-CNN and the like in the prior art and the YOLO model of a more original version, so that the process of constructing the tunnel lining crack detection and segmentation model is simplified, and meanwhile, high precision can be ensured.
In the embodiment, the YOLOv8 network model adopts a lightweight YOLOv8s-seg network structure, and compared with Faster-R-CNN with the detection speed of 0.259 s/sheet, the trained model has the detection speed of up to 0.013 s/sheet, the segmentation speed of up to 0.154 s/sheet and the recognition speed of high.
The specific steps of step S3 in this embodiment include:
inputting the training set into a YOLOv8 network model for pre-training, and preliminarily obtaining a detection and segmentation model;
the image is put forward from the test set and is input as a pre-training model, and the model is optimized to train super parameters;
inputting a verification set, and evaluating whether the detection and segmentation accuracy is met or not according to the obtained detection and segmentation result;
and adjusting the training super-parameters, and repeating the steps until the optimal training super-parameter combination is obtained, wherein the detection parameters are a confidence threshold and a cross ratio threshold.
The training hyper-parameters in this embodiment include training round number, optimizer type, initial learning rate, parameter optimization algorithm, batch and segmentation mask downsampling rate of the input image.
S4, collecting images of tunnel lining cracks, and inputting the images into a detection and segmentation model.
In step S4 of this embodiment, the image acquisition mode is at least one of unmanned aerial vehicle system acquisition, smart phone photographing acquisition and single lens reflex acquisition.
And S5, detecting and segmenting the cracks in the tunnel lining crack image by using a detection and segmentation model, and calculating the length and the maximum width of the cracks.
The specific steps of the length calculation in step S5 of this embodiment are:
converting the result mask of the crack detection and segmentation module into a uint8 type through an astype function, and converting the result mask into a binary image;
performing skeleton extraction on the binary image through a skeletonizing function in a skeletonizing module, obtaining the finest skeleton structure through a lee method, and searching the boundary length after skeletonizing through a regionoprops function to obtain the skeleton path length of the crack;
carrying out position extraction of non-zero elements on the skeletonized image through an argwhere function to obtain two columns of coordinates representing path pixels, wherein the first column represents x coordinates and the second column represents y coordinates;
creating a linear regression model object through a linear regression function, fitting the coordinates of the path pixels by using a fitting function fit (x, y) function, wherein x is an abscissa array of the path pixels, y is an ordinate array of the path pixels, respectively calculating the minimum value and the maximum value of the x coordinates of the path pixels through min and max functions, and predicting the minimum value and the maximum value of y by using a trained linear regression model;
calculating the length of the path by using Euclidean distance according to the predicted y coordinate and the x coordinate range of the path, namely the length value L of the crack, wherein the Euclidean distance has the following specific expression:
in which x is max 、x min Respectively calculating the minimum value and the maximum value of the x coordinate of the path pixel, y max 、y min The minimum value and the maximum value of the y prediction of the trained linear regression model are respectively.
The specific steps of the width calculation in step S5 of this embodiment are:
converting the result mask of the crack detection and segmentation module into a uint8 type through an astype function, and converting the result mask into a binary image;
finding all crack contours in the image through a findContours function in opencv, designating a contour retrieval mode as a tree retrieval mode to detect all crack contours, establishing a complete hierarchical relationship between the contours, and designating an approximation method of the contours as a simple approximation method so as to reduce the storage space of contour points and only reserve endpoint information;
for each contour, a minimum rectangular area capable of containing the contour is determined by extracting leftmost, rightmost, uppermost and lowermost points on the contour, and half of the minimum side length of the minimum rectangle is calculated as the upper limit of the radius of an inscribed circle to define a precision parameter P r Precision parameter P r For controlling the accuracy of the iterative solution of the inscribed circle.
Constructing a grid point coordinate matrix containing all pixel points in a contour rectangular area, traversing each pixel point in a grid, judging whether the point is in the contour by using a pointPolygonTest function, screening out all pixel points in the contour, and adding the coordinates of all pixel points into a list;
randomly selecting a part of pixel points from the list, calculating the corresponding inscribed circle radius, and updating the current maximum radius and the center point;
circularly searching the rest pixel points, calculating the corresponding inscribed circle radius, updating the maximum radius and the center point, finally finding the crack position with the maximum radius from a crack inscribed circle radius list, and obtaining the corresponding center point and diameter value, namely the maximum crack width, wherein the specific expression of the precision parameter Pr is as follows:
wherein R is x 、L x The abscissa values of the leftmost and rightmost points on the contour, D y 、U y The ordinate values of the lowermost and uppermost points on the profile, respectively.
According to the embodiment, the image contour and skeleton analysis technology is embedded into the YOLOv8 model, parameters such as the number, the length and the maximum width of tunnel lining cracks can be accurately detected while the tunnel lining cracks are detected and segmented in a high-precision and rapid manner under the influence of complex external conditions, and technical support is provided for the complete realization of tunnel defect identification and detection automation by utilizing a computer vision technology in the future.
In the following, specific explanation is made on the embodiment, 9722 open source data sets of the crack are collected, and a detection and segmentation model based on the length and the maximum width of the crack of the tunnel lining of YOLOv8 is constructed by adopting a YOLOv8s-seg network structure according to the collected data sets.
After the data set is enhanced and marked, 200 images are reserved as test sets, and the rest data sets are divided according to the method and sent into a YOLOv8 network model for pre-training. The optimal training super-parameter combination is obtained after parameter adjustment, the training round number is set to 800, the optimizer type is set to SGD, the initial learning rate is set to 0.01, the parameter optimization algorithm is a genetic algorithm, the batch of input images is set to 8, and the segmentation mask downsampling rate is set to 4. And setting the final detection parameter confidence coefficient threshold value to be 0.2, and constructing a detection and segmentation model based on the length and the maximum width of the tunnel lining crack of YOLOv 8.
The test data of the detection and segmentation model based on the length and the maximum width of the tunnel lining crack of YOLOv8 are shown in table 1, the specific detection and segmentation visualization results are shown in fig. 4 and 5, the number, the length and the maximum width visualization results are shown in fig. 6, and the detection and segmentation method and the system based on the length and the maximum width of the tunnel lining crack of YOLOv8 in the embodiment can be used for measuring the number, the length and the maximum width of the crack under various complex scenes, and have wide application range and strong adaptability.
Table 1: test data sheet for detection model
As shown in fig. 7, the present application further provides a system for detecting and dividing the length and width of a tunnel lining crack, which is characterized in that the system is used for implementing the above-mentioned method for detecting and dividing, and includes:
the image processing module is used for collecting images of tunnel lining cracks and obtaining training images after data enhancement;
the image dividing module is used for dividing the training image, reserving a test set, marking the rest images, and dividing the rest images into a training set and a verification set according to a proportion at random;
the model training module is used for inputting a training set into the YOLOv8 network model for pre-training, testing the detection and segmentation performance by using a verification set, and training the super-parameters by using a test set optimization model to obtain a detection and segmentation model;
the image acquisition module is used for acquiring images of tunnel lining cracks and inputting the images into the detection and segmentation model;
and the crack measurement module is used for detecting and segmenting the cracks in the tunnel lining crack image by using the detection and segmentation model, and calculating the length and the maximum width of the cracks.
The foregoing is a further elaboration of the present application in connection with the detailed description, and it is not intended that the application be limited to the specific embodiments shown, but rather that a number of simple deductions or substitutions be made by one of ordinary skill in the art without departing from the spirit of the application, should be considered as falling within the scope of the application as defined in the appended claims.
Claims (10)
1. The method for detecting and dividing the length and the width of the tunnel lining crack is characterized by comprising the following specific steps:
s1, collecting images of tunnel lining cracks, and obtaining training images after data enhancement;
s2: dividing the training image, reserving a test set, marking the rest images, and randomly dividing the rest images into a training set and a verification set according to a proportion;
s3: inputting a training set into a YOLOv8 network model for pre-training, using a verification set test model to detect and divide performance, using a test set optimization model to train super-parameters, and obtaining a detection and divide model;
s4, collecting images of tunnel lining cracks, and inputting the images into a detection and segmentation model;
and S5, detecting and segmenting the cracks in the tunnel lining crack image by using a detection and segmentation model, and calculating the length and the maximum width of the cracks.
2. The method for detecting and dividing the length and width of the tunnel lining crack according to claim 1, wherein the data enhancement method used in the step S1 is a Mosaic, a random HSV, an affine transformation.
3. The method for detecting and dividing the length and the width of the tunnel lining crack according to claim 1, wherein the tool for marking the image in the step S2 is a Roboflow online marking tool, the data set dividing mode is to reserve partial data as a test set, and the dividing ratio of the training set to the verification set is 8:2.
4. the method for detecting and dividing the length and the width of the tunnel lining crack according to claim 1, wherein the specific step of step S3 includes:
inputting the training set into a YOLOv8 network model for pre-training, and preliminarily obtaining a detection and segmentation model;
extracting images from the test set, inputting the images as a pre-training model, and optimizing model training super-parameters;
inputting a verification set, and evaluating whether the detection and segmentation accuracy is met or not according to the obtained detection and segmentation result;
and adjusting the training super parameters, and repeating the steps until the optimal training super parameter combination is obtained.
5. The method for detecting and dividing the length and width of a tunnel lining crack according to claim 4, wherein the training super-parameters comprise training round number, optimizer type, initial learning rate, parameter optimization algorithm, batch of input images and division mask downsampling rate.
6. The method for detecting and dividing the length and the width of the tunnel lining crack according to claim 1, wherein the image acquisition mode in the step S4 is at least one of unmanned aerial vehicle system acquisition, smart phone photographing acquisition and single lens reflex acquisition.
7. The method for detecting and dividing the length and the width of the tunnel lining crack according to claim 1, wherein the specific steps of calculating the length in step S5 are as follows:
converting the result mask of the crack detection and segmentation module into a uint8 type through an astype function, and converting the result mask into a binary image;
performing skeleton extraction on the binary image through a skeletonizing function in a skeletonizing module, obtaining the finest skeleton structure through a lee method, and searching the boundary length after skeletonizing through a regionoprops function to obtain the skeleton path length of the crack;
carrying out position extraction of non-zero elements on the skeletonized image through an argwhere function to obtain two columns of coordinates representing path pixels, wherein the first column represents x coordinates and the second column represents y coordinates;
creating a linear regression model object through a linear regression function, fitting the coordinates of the path pixels by using a fitting function fit (x, y) function, wherein x is an abscissa array of the path pixels, y is an ordinate array of the path pixels, respectively calculating the minimum value and the maximum value of the x coordinates of the path pixels through min and max functions, and predicting the minimum value and the maximum value of y by using a trained linear regression model;
calculating the length of the path by using Euclidean distance according to the predicted y coordinate and the x coordinate range of the path, namely the length value L of the crack, wherein the Euclidean distance has the following specific expression:
in which x is max 、x min Respectively calculating the minimum value and the maximum value of the x coordinate of the path pixel, y max 、y min The minimum value and the maximum value of the y prediction of the trained linear regression model are respectively.
8. The method for detecting and dividing the length and the width of the tunnel lining crack according to claim 1, wherein the specific steps of calculating the width in step S5 are as follows:
converting the result mask of the crack detection and segmentation module into a uint8 type through an astype function, and converting the result mask into a binary image;
finding all crack contours in the image through a findContours function in opencv, designating a contour retrieval mode as a tree retrieval mode to detect all crack contours, establishing a complete hierarchical relationship between the contours, and designating an approximation method of the contours as a simple approximation method so as to reduce the storage space of contour points and only reserve endpoint information;
for each contour, a minimum rectangular area capable of containing the contour is determined by extracting leftmost, rightmost, uppermost and lowermost points on the contour, and half of the minimum side length of the minimum rectangle is calculated as the upper limit of the radius of an inscribed circle to define a precision parameter P r ;
Constructing a grid point coordinate matrix containing all pixel points in a contour rectangular area, traversing each pixel point in a grid, judging whether the point is in the contour by using a pointPolygonTest function, screening out all pixel points in the contour, and adding the coordinates of all pixel points into a list;
randomly selecting a part of pixel points from the list, calculating the corresponding inscribed circle radius, and updating the current maximum radius and the center point;
circularly searching the rest pixel points, calculating the corresponding inscribed circle radius, updating the maximum radius and the center point, finally finding the crack position with the maximum radius from a crack inscribed circle radius list, and obtaining the corresponding center point and diameter value, namely the maximum crack width, wherein the specific expression of the precision parameter Pr is as follows:
wherein R is x 、L x Respectively on the outlineThe abscissa values of the leftmost and rightmost points, D y 、U y The ordinate values of the lowermost and uppermost points on the profile, respectively.
9. The method for detecting and dividing the length and width of a tunnel lining crack according to any one of claims 1 to 8, wherein the YOLOv8 network model adopts a lightweight YOLOv8s-seg network structure.
10. A tunnel lining crack length and width detection and segmentation system, characterized in that the system is used for realizing the detection and segmentation method as set forth in any one of claims 1-8, and comprises the following steps:
the image processing module is used for collecting images of tunnel lining cracks and obtaining training images after data enhancement;
the image dividing module is used for dividing the training image, reserving a test set, marking the rest images, and dividing the rest images into a training set and a verification set according to a proportion at random;
the model training module is used for inputting a training set into the YOLOv8 network model for pre-training, testing the detection and segmentation performance by using a verification set, and training the super-parameters by using a test set optimization model to obtain a detection and segmentation model;
the image acquisition module is used for acquiring images of tunnel lining cracks and inputting the images into the detection and segmentation model;
and the crack measurement module is used for detecting and segmenting the cracks in the tunnel lining crack image by using the detection and segmentation model, and calculating the length and the maximum width of the cracks.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310707660.2A CN116863134A (en) | 2023-06-15 | 2023-06-15 | Method and system for detecting and dividing length and width of tunnel lining crack |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310707660.2A CN116863134A (en) | 2023-06-15 | 2023-06-15 | Method and system for detecting and dividing length and width of tunnel lining crack |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116863134A true CN116863134A (en) | 2023-10-10 |
Family
ID=88229514
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310707660.2A Pending CN116863134A (en) | 2023-06-15 | 2023-06-15 | Method and system for detecting and dividing length and width of tunnel lining crack |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116863134A (en) |
-
2023
- 2023-06-15 CN CN202310707660.2A patent/CN116863134A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109446992B (en) | Remote sensing image building extraction method and system based on deep learning, storage medium and electronic equipment | |
US20210319561A1 (en) | Image segmentation method and system for pavement disease based on deep learning | |
CN111444821A (en) | Automatic identification method for urban road signs | |
CN111985552B (en) | Method for detecting diseases of thin strip-shaped structure of airport pavement under complex background | |
CN112200143A (en) | Road disease detection method based on candidate area network and machine vision | |
CN111611861B (en) | Image change detection method based on multi-scale feature association | |
CN112927253B (en) | Rock core FIB-SEM image segmentation method based on convolutional neural network | |
CN111582093A (en) | Automatic small target detection method in high-resolution image based on computer vision and deep learning | |
CN111353396A (en) | Concrete crack segmentation method based on SCSEOCUnet | |
CN116485717B (en) | Concrete dam surface crack detection method based on pixel-level deep learning | |
CN110969620A (en) | Method and device for detecting magnetic shoe ripple defects | |
CN114066808A (en) | Pavement defect detection method and system based on deep learning | |
CN110599459A (en) | Underground pipe network risk assessment cloud system based on deep learning | |
CN113435407B (en) | Small target identification method and device for power transmission system | |
CN111524117A (en) | Tunnel surface defect detection method based on characteristic pyramid network | |
CN111986164A (en) | Road crack detection method based on multi-source Unet + Attention network migration | |
CN113240623A (en) | Pavement disease detection method and device | |
CN113420619A (en) | Remote sensing image building extraction method | |
CN115393587A (en) | Expressway asphalt pavement disease sensing method based on fusion convolutional neural network | |
CN116403109A (en) | Building identification and extraction method and system based on improved neural network | |
CN113326846A (en) | Rapid bridge apparent disease detection method based on machine vision | |
CN114596316A (en) | Road image detail capturing method based on semantic segmentation | |
CN116258854A (en) | Pavement crack segmentation method based on dense connection strategy and image gradient | |
CN113610024B (en) | Multi-strategy deep learning remote sensing image small target detection method | |
CN112785610B (en) | Lane line semantic segmentation method integrating low-level features |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |