A bridge crack detection method, system and storage medium based on YOLO algorithm
By applying the YOLO algorithm in bridge crack detection, the existing detection methods are solved, efficient and accurate crack detection is achieved, and reliable data support for bridge maintenance and safety assessment is provided.
Patent Information
- Application Number
- CN202411319743.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2044-09-23
AI Technical Summary
Existing bridge crack detection methods are inefficient and prone to missed detection, especially in resource-constrained environments, and are not adaptable when dealing with cracks of different features, and are easily affected by noise and image quality.
The YOLO algorithm is used to detect the bridge image, obtain the information of the crack and bounding box information, divide the crack into the corresponding grid cells, and calculate the bounding coordinates of the grid cells and the density of the cracks, and obtain the comprehensive coefficient of the cracks to judge its severity.
It significantly improves the real-time and accuracy of crack detection, reduces resource consumption, enhances the detection adaptability of cracks with different characteristics, and provides reliable data to support bridge maintenance and safety assessment.
Smart Images

Figure CN119107317B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of bridge crack detection, and in particular to a bridge crack detection method, system and storage medium based on a YOLO algorithm. Background Art
[0002] As bridges play an increasingly important role in transportation systems, bridge operation and maintenance management has become the key to ensuring their safety and durability. However, bridge operation and maintenance work faces multiple challenges, among which crack detection is particularly important. It not only affects the structural performance and service life of the bridge, but also affects the safety of vehicles and pedestrians.
[0003] During the long-term use of bridges, they are easily affected by various factors such as vehicle loads and environmental corrosion, and cracks are prone to appear. If these cracks are not detected and repaired in time, they may gradually expand and eventually lead to the overall failure of the bridge structure. Traditional crack detection methods mainly rely on manual detection and simple sensor technology, which are inefficient and easy to miss. In recent years, the application of computer vision (CV) technology in crack detection has gradually emerged. Using high-definition cameras and image processing algorithms, cracks on the bridge surface can be quickly and accurately identified and evaluated.
[0004] In the prior art, publication number CN118196026A discloses a bridge crack detection method and system, including: taking an image of a bridge through a depth camera, converting the image of the bridge into a grayscale image, generating a bridge data set; processing the bridge data set to obtain a processed data set; constructing a convolutional neural network and a long short-term memory network, using the output of the long short-term memory network as a soft label to train the convolutional neural network to obtain a visual detection model; inputting the processed data set into the visual detection model for calculation to obtain crack detection results. In the present invention, the long short-term memory network can encode sequence data and extract abstract feature representations. Using the output of the long short-term memory network as the input of the convolutional neural network model can provide the convolutional neural network model with richer and higher-level feature representations, which helps to improve the ability to effectively identify and distinguish cracks.
[0005] However, there are still the following shortcomings. From the above statements, it can be seen that this method combines CNN and LSTM networks, the network structure is complex, the parameters are many, the training process is time-consuming and requires high computing resources, and it is difficult to achieve real-time detection in a resource-constrained environment. Although the LSTM network can encode sequence data and extract abstract features, it is not adaptable when processing cracks with different characteristics and is easily affected by noise and image quality, resulting in a decrease in detection accuracy.
[0006] The above information disclosed in this Background section is only for enhancement of understanding of the background of the present disclosure and therefore it may contain information that does not constitute the prior art that is already known to one of ordinary skill in the art. Summary of the invention
[0007] The object of the present invention is to provide a bridge crack detection method, system and storage medium based on the YOLO algorithm to solve the problems raised in the above background technology.
[0008] To achieve the above object, the present invention provides the following technical solutions:
[0009] A bridge crack detection method based on the YOLO algorithm, the specific steps include:
[0010] S1. Collect an image of the crack area of the bridge, convert the image into a grayscale image, use the YOLO algorithm to detect the grayscale image, obtain the crack information and bounding box information, the crack information includes the starting point coordinates, end point coordinates and center coordinates, the bounding box information includes the center coordinates, width and height, divide the grayscale image into several grid cells, calculate the boundary coordinates of each grid cell, and divide the detected cracks into the corresponding grid cells, traverse all grid cells, add a crack bounding box to each grid cell, and save the image of the crack bounding box;
[0011] S2. according to the center coordinates, width and height of the crack boundary box in the image, four boundaries of the crack boundary box are obtained, and the starting point coordinates and the end point coordinates of the crack boundary box are determined according to the four boundaries of the crack boundary box, and the positional relationship between the crack and the boundary box is determined according to the center coordinates, starting point coordinates, and end point coordinates of the crack and the center coordinates, starting point coordinates, and end point coordinates of the crack boundary box;
[0012] S3. Determine the number and size of cracks in the image according to the positional relationship between the cracks and the bounding box. When the center coordinates, starting point coordinates and end point coordinates of the cracks and the crack bounding box are consistent, use the original crack bounding box to obtain a first crack bounding box. When the starting point coordinates and end point coordinates of the cracks are between the starting point coordinates and end point coordinates of the crack bounding box, draw a new crack bounding box on the image with the crack bounding box to obtain a second crack bounding box. When the starting point coordinates and end point coordinates of the cracks are outside the starting point coordinates and end point coordinates of the crack bounding box, draw a new crack bounding box on the image with the crack bounding box to obtain a third crack bounding box.
[0013] S4. according to the first crack boundary box, the second crack boundary box and the third crack boundary box, the starting point coordinates and the ending point coordinates of the first crack boundary box, the second crack boundary box and the third crack boundary box are obtained, and the total density of the grid unit cracks is obtained according to the starting point coordinates and the ending point coordinates, the length and width of the cracks are respectively obtained according to the first crack boundary box, the second crack boundary box and the third crack boundary box, and the total area of the cracks is obtained according to the length and the width of the cracks, and the density of the cracks and the total area of the cracks are processed to obtain a comprehensive coefficient of the cracks;
[0014] S5. Compare the comprehensive coefficient of the crack with a preset comprehensive coefficient threshold to determine the severity of the crack.
[0015] Furthermore, an image of the crack area of the bridge is collected, the image is converted into a grayscale image, and the grayscale image is detected using the YOLO algorithm to obtain the crack information and bounding box information. The crack information includes the starting point coordinates, the end point coordinates and the center coordinates, and the bounding box information includes the center coordinates, width and height. The process is as follows:
[0016] Use the depth camera to collect images of the bridge crack area to obtain the original image I orig ,The collected original image is converted into a grayscale image according to the following formula:
[0017] I gray =0.299·I R +0.587·I G +0.114·I B
[0018] Among them, I gray is a grayscale image, I R ,I G ,I B are the pixel values of the red, green, and blue channels of the original image, respectively;
[0019] Assume the input image size is W t ×H t , the YOLO algorithm divides the image into S×S grids, and obtains the size of each grid unit according to the following formula:
[0020]
[0021] Among them, W' t is the width of each grid cell, H' t is the height of each grid unit, S is the number of grids, that is, the number of grids in each row and column, and W t is the width of the image, H t is the height of the image;
[0022] Each grid cell predicts k bounding boxes. For the (i, j)th grid cell, the information of the predicted mth bounding box is given. The value range of m is 1, 2, ..., m, k, where m is the index of the bounding box and k is the number of bounding boxes. The information of the bounding box includes: the center coordinates (x box_center ,y box_center ), width W box , height H box ;
[0023] Based on the predicted value of each grid cell, calculate the bounding box center coordinates:
[0024]
[0025] Where i is the column index of the current grid cell, j is the row index of the current grid cell, and t x is the offset of the center point of the bounding box in the grid unit on the x-axis, t y is the offset of the center point of the bounding box in the grid unit on the y-axis, σ is the Sigmoid function, defined as
[0026] Based on the predicted value of each grid cell, the bounding box width W box and height H box :
[0027] W box =W t ·e tw
[0028] H box =H t ·e th
[0029] Among them, tw is the relative scale factor of the bounding box width, and th is the relative scale factor of the bounding box height;
[0030] The YOLO algorithm is used to detect the starting point coordinates, end point coordinates and center coordinates of each crack.
[0031] The center coordinates of the crack are the center coordinates of the predicted bounding box:
[0032] (x center ,y center )=(x box_center ,y box_center )
[0033] x start =x box_center -W box / 2
[0034] y start =y box_center -Hbox / 2
[0035] x end =x box_center +W box / 2
[0036] y end =y box_center +H box / 2
[0037] The starting and ending coordinates of the crack are (x box_center -W box / 2,y box_center -H box / 2)、(x box_center +W box / 2,y box_center +H box / 2).
[0038] Furthermore, the boundary coordinates of each grid cell are calculated, and the detected cracks are divided into corresponding grid cells. All grid cells are traversed, a crack boundary box is added to each grid cell, and the image of the crack boundary box is saved as follows:
[0039] For each grid cell (i, j), its position on the image needs to be determined, that is, the coordinates of its upper left corner and lower right corner. The coordinates of the upper left corner of the grid cell (i, j) are:
[0040] (x left ,y top )=(i×W' t , j×H' t )
[0041] Among them, (x left ,y top ) is the coordinate of the upper left corner of the grid cell (i, j);
[0042] The coordinates of the lower right corner of the grid cell (i, j) are:
[0043] (x right ,y bottom )=((i+1)×W' t , (j+1)×H' t )
[0044] Among them, (x right ,y bottom ) is the coordinate of the lower right corner of the grid cell (i, j);
[0045] Calculate the top-left and bottom-right coordinates of the crack bounding box:
[0046]
[0047] The starting point coordinate of the crack boundary box is the upper left corner of the crack boundary box, the end point coordinate of the crack boundary box is the lower right corner coordinate of the crack boundary box, and the four boundaries of the crack boundary box are x box_left 、x box_right ,y box_top ,y box_bottom ;
[0048] Determine the range of mesh cells within which the crack bounding box resides:
[0049]
[0050] Traverse the grid cell range, i' start ≤i≤i' end , j' start ≤j≤j' end , and add the crack bounding box information in each grid cell:
[0051] Traverse i from i' start to i' end ;
[0052] Traverse j from j' start to j' end ;
[0053] The crack bounding box information, i.e. x center ,y center , W box , H box Add to the storage list of grid cell (i, j);
[0054] Iterate over all grid cells and draw the crack bounding box on the image using the OpenCV library. The process is as follows:
[0055] Import OpenCV library;
[0056] Read the grayscale image to be processed;
[0057] Traverse all grid cells and obtain the crack bounding box information in each grid cell;
[0058] Get the upper left corner coordinates (x box_left ,y box_top ) and the lower right corner coordinate (x box_right ,y box_bottom ), draw a rectangular bounding box on the image;
[0059] Save the image with the crack bounding box.
[0060] Further, according to the center coordinates, starting point coordinates, end point coordinates of the crack and the center coordinates, starting point coordinates, and end point coordinates of the crack boundary box, the process of determining the positional relationship between the crack and the boundary box is as follows:
[0061] The crack is completely within the bounding box: the center point, starting point, and end point of the crack are all within the bounding box, and the relationship is expressed as:
[0062] x box_left ≤x crack_center ≤x box_right
[0063] y box_top ≤y crack_center ≤y box_bottom
[0064] x box_left ≤x crack_start ≤x box_right
[0065] y box_top ≤y crack_start ≤y box_bottom
[0066] x box_left ≤x crack_end ≤x box_right
[0067] y box_top ≤y crack_end ≤y box_bottom
[0068] The crack is partially within the bounding box: The center point of the crack is within the bounding box, but the starting point or end point is outside the bounding box. The relationship is expressed as:
[0069] x box_left ≤x crack_center ≤x box_right and y box_top ≤y crack_center ≤y box_bottom
[0070] and
[0071] [(x crack_start <x box_left x crack_start >x box_right or y crack_start <y box_top or y crack_start >y box_bottom )
[0072] or
[0073] (x crack_end <x box_leftx crack_end >x box_right or y crack_end <y box_top or y crack_end >y box_bottom )]
[0074] The crack is not within the bounding box: The center point of the crack is not within the bounding box. The relationship is expressed as:
[0075] x crack_center <x box_left x crack_center >x box_right
[0076] or
[0077] y crack_center <y box_top or y crack_center >y box_bottom .
[0078] Furthermore, the specific process of step S3 is as follows:
[0079] When the center coordinates, starting point coordinates, and end point coordinates of the crack and the crack boundary box are consistent, the original crack boundary box is used to obtain the center coordinates, starting point coordinates, and end point coordinates of the first crack boundary box. The relationship is as follows:
[0080]
[0081] When the starting point and ending point coordinates of the crack are between the starting point and ending point coordinates of the crack bounding box, draw the second crack bounding box. The coordinates of the bounding box are determined according to the new starting point and ending point. The relationship is as follows:
[0082] x box_left <x crack_start <x box_right
[0083] y box_top <y crack_start <y box_bottom
[0084] x box_left <x crack_end <x box_right
[0085] y box_top <y crack_end <y box_bottom
[0086] The start and end points of the second crack bounding box are:
[0087]
[0088] When the starting point coordinates and the end point coordinates of the crack are outside the starting point coordinates and the end point coordinates of the crack bounding box, a third crack bounding box is drawn. The coordinates of the bounding box are determined according to the new starting point and end point as well as the minimum and maximum boundary values. The relationship is as follows:
[0089] (x crack_start <x box_left x crack_start >x box_right )
[0090] or
[0091] (y crack_start <y box_top or y crack_start >y box_bottom )
[0092] or
[0093] (x crack_end <x box_left x crack_end >x box_right )
[0094] or
[0095] (y crack_end <y box_top or y crack_end >y box_bottom )
[0096] The start and end points of the third crack bounding box are:
[0097]
[0098] Furthermore, according to the starting point coordinates and the ending point coordinates of the first crack boundary box, the second crack boundary box, and the third crack boundary box, the process of obtaining the density of the cracks in each grid unit is as follows:
[0099] The size of the grid cell is S×S, and the coordinate of the upper left corner of the entire area is (x min ,y min ), the coordinate of the lower right corner is (y max ,y max ), the coordinates of the upper left corner and lower right corner of each grid cell (i, j) are:
[0100]
[0101] For each crack bounding box, determine which grid cells it overlaps with;
[0102] First Crack Bounding Box
[0103] Starting point coordinates: (x box_left ,y box_top ), end point coordinates: (x box_right ,y box_bottom );
[0104] Second crack bounding box
[0105] Starting point coordinates: (x new_box_left ,y new_box_top ), end point coordinates: (x new_box_right ,y new_box_bottom );
[0106] Third Crack Bounding Box
[0107] Starting point coordinates: (min(x new_box_left , x box_left ), min(y new_box_top ,y box_top )),
[0108] End point coordinates: (max(x new_box_right , x box_right ), max(y new_box_bottom ,y box_bottom ));
[0109] For each crack bounding box, determine the extent of the grid cells it covers:
[0110]
[0111]
[0112] Where δ is the index of the crack bounding box, δ∈[1, 2, 3];
[0113] For each crack bounding box, update the crack density of the covered grid cells. Assume that the density counter is D(i,j) with an initial value of 0. For each crack bounding box, perform the following operations:
[0114] and
[0115] D(i,j)' δ =D(i, j)+1
[0116] The total density of cracks in the grid unit is:
[0117]
[0118] Through the above steps, the density counter of each covered grid cell will be increased accordingly, and the total density MD of cracks in the grid cell will be calculated.
[0119] Furthermore, the length and width of the crack are obtained according to the first crack boundary box, the second crack boundary box and the third crack boundary box, respectively, and the total area of the crack is obtained according to the length and width of the crack as follows:
[0120] For each crack bounding box, the length and width of the crack can be calculated from the start and end coordinates.
[0121] The length L1 and width W1 of the first crack bounding box are obtained according to the following formula:
[0122] L1=|x box_right -x box_left ∣
[0123] W1=|y box_bottom -y box_top ∣
[0124] The length L2 and width W2 of the second crack bounding box are obtained according to the following formula:
[0125] L2=|x new_box_right -x new_box_left ∣
[0126] W2=|y new_box_bottom -y new_box_top ∣
[0127] The length L3 and width W3 of the third crack bounding box are obtained according to the following formula:
[0128] L3=|max(x new_box_right , x box_right )-min(x new_box_left , x box_left )∣
[0129] W3=|max(y new_box_bottom ,y box_bottom )-min(y new_box_top ,y box_top )∣
[0130] The size of the crack is expressed as area, which is calculated from the length and width according to the following formula:
[0131] The first crack bounding box area A1:
[0132] A1=L1×W1
[0133] The second crack bounding box area A2:
[0134] A2=L2×W2
[0135] The area of the third crack boundary box A3:
[0136] A3=L3×W3
[0137] Total area of cracks MJ:
[0138] MJ=A1+A2+A3.
[0139] Furthermore, the density and area size of the cracks are processed to obtain the comprehensive coefficient XS of the cracks, according to the following formula:
[0140] XS=MJ·MD
[0141] The process of comparing the comprehensive coefficient of the crack with the preset comprehensive coefficient threshold and judging the severity of the crack is as follows:
[0142] If XS≤YZ, the severity of the crack is judged to be "mild";
[0143] If XS>YZ, the severity of the crack is judged to be "serious".
[0144] A bridge crack detection system based on the YOLO algorithm, the system is used to execute any of the above-mentioned bridge crack detection methods based on the YOLO algorithm, comprising:
[0145] The data acquisition module is used to collect images of the crack area of the bridge, convert the images into grayscale images, use the YOLO algorithm to detect the grayscale images, obtain the crack information and bounding box information, the crack information includes the starting point coordinates, the end point coordinates and the center coordinates, the bounding box information includes the center coordinates, width and height, divide the grayscale image into several grid units, calculate the boundary coordinates of each grid unit, divide the detected cracks into the corresponding grid units, traverse all grid units, add a crack bounding box to each grid unit, and save the image of the crack bounding box;
[0146] A marking module is used to obtain four boundaries of the crack boundary box according to the center coordinates, width and height of the crack boundary box in the image, determine the starting point coordinates and the end point coordinates of the crack boundary box according to the four boundaries of the crack boundary box, and determine the positional relationship between the crack and the boundary box according to the center coordinates, starting point coordinates, and end point coordinates of the crack and the center coordinates, starting point coordinates, and end point coordinates of the crack boundary box;
[0147] a classification module, for determining the number and size of cracks in the image according to the positional relationship between the cracks and the bounding box; when the center coordinates, the starting coordinates and the ending coordinates of the crack and the crack bounding box are consistent, using the original crack bounding box to obtain a first crack bounding box; when the starting coordinates and the ending coordinates of the crack are between the starting coordinates and the ending coordinates of the crack bounding box, drawing a new crack bounding box on the image with the crack bounding box to obtain a second crack bounding box; when the starting coordinates and the ending coordinates of the crack are outside the starting coordinates and the ending coordinates of the crack bounding box, drawing a new crack bounding box on the image with the crack bounding box to obtain a third crack bounding box;
[0148] a data processing module, for obtaining the starting point coordinates and the ending point coordinates of the first crack boundary box, the second crack boundary box and the third crack boundary box according to the first crack boundary box, the second crack boundary box and the third crack boundary box, and obtaining the total density of the grid unit cracks according to the starting point coordinates and the ending point coordinates, respectively obtaining the length and the width of the cracks according to the first crack boundary box, the second crack boundary box and the third crack boundary box, and obtaining the total area of the cracks according to the length and the width of the cracks, performing data processing on the density of the cracks and the total area of the cracks to obtain a comprehensive coefficient of the cracks;
[0149] The judgment module is used to compare the comprehensive coefficient of the crack with a preset comprehensive coefficient threshold to judge the severity of the crack.
[0150] A storage medium is used to store a computer program, and when the computer program is executed by a processor, it implements any of the above-mentioned bridge crack detection methods based on the YOLO algorithm.
[0151] Compared with the prior art, the present invention has the following beneficial effects:
[0152] The present invention significantly improves the real-time and accuracy of crack detection by converting the bridge image taken by the depth camera into a grayscale image and using the YOLO algorithm for detection. The YOLO algorithm can quickly obtain the boundary box information and position relationship of the crack with its efficient target detection capability, and realizes refined crack area detection by dividing the crack into corresponding grid units. Compared with the prior art, the present invention not only has obvious advantages in processing speed and resource consumption, but also has significantly improved the detection accuracy and adaptability of cracks, especially in obtaining the comprehensive coefficient of cracks and judging their severity. Through the comprehensive analysis of the number, size and density of cracks, reliable data support is provided for the maintenance and safety assessment of bridges. BRIEF DESCRIPTION OF THE DRAWINGS
[0153] Figure 1 It is a schematic diagram of the overall method flow of the present invention;
[0154] Figure 2 This is a block diagram of the module composition of the present invention. DETAILED DESCRIPTION
[0155] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments.
[0156] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The words "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may 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.
[0157] Example:
[0158] See also Figure 1 , the present invention provides a technical solution:
[0159] A bridge crack detection method based on the YOLO algorithm, the specific steps include:
[0160] S1. Collect an image of the crack area of the bridge, convert the image into a grayscale image, use the YOLO algorithm to detect the grayscale image, obtain the crack information and bounding box information, the crack information includes the starting point coordinates, end point coordinates and center coordinates, the bounding box information includes the center coordinates, width and height, divide the grayscale image into several grid cells, calculate the boundary coordinates of each grid cell, and divide the detected cracks into the corresponding grid cells, traverse all grid cells, add a crack bounding box to each grid cell, and save the image of the crack bounding box;
[0161] S2. according to the center coordinates, width and height of the crack boundary box in the image, four boundaries of the crack boundary box are obtained, and the starting point coordinates and the end point coordinates of the crack boundary box are determined according to the four boundaries of the crack boundary box, and the positional relationship between the crack and the boundary box is determined according to the center coordinates, starting point coordinates, and end point coordinates of the crack and the center coordinates, starting point coordinates, and end point coordinates of the crack boundary box;
[0162] S3. Determine the number and size of cracks in the image according to the positional relationship between the cracks and the bounding box. When the center coordinates, starting point coordinates and end point coordinates of the cracks and the crack bounding box are consistent, use the original crack bounding box to obtain a first crack bounding box. When the starting point coordinates and end point coordinates of the cracks are between the starting point coordinates and end point coordinates of the crack bounding box, draw a new crack bounding box on the image with the crack bounding box to obtain a second crack bounding box. When the starting point coordinates and end point coordinates of the cracks are outside the starting point coordinates and end point coordinates of the crack bounding box, draw a new crack bounding box on the image with the crack bounding box to obtain a third crack bounding box.
[0163] S4. according to the first crack boundary box, the second crack boundary box and the third crack boundary box, the starting point coordinates and the ending point coordinates of the first crack boundary box, the second crack boundary box and the third crack boundary box are obtained, and the total density of the grid unit cracks is obtained according to the starting point coordinates and the ending point coordinates, the length and width of the cracks are respectively obtained according to the first crack boundary box, the second crack boundary box and the third crack boundary box, and the total area of the cracks is obtained according to the length and the width of the cracks, and the density of the cracks and the total area of the cracks are processed to obtain a comprehensive coefficient of the cracks;
[0164] S5. Compare the comprehensive coefficient of the crack with a preset comprehensive coefficient threshold to determine the severity of the crack.
[0165] On the basis of the above embodiment, an image of the bridge crack area is collected, the image is converted into a grayscale image, the grayscale image is detected using the YOLO algorithm, and the crack information and bounding box information are obtained. The crack information includes the starting point coordinates, the end point coordinates and the center coordinates, and the bounding box information includes the center coordinates, width and height. The process is as follows:
[0166] Use the depth camera to collect images of the bridge crack area to obtain the original image I orig ,Convert the collected original image (RGB image) into a grayscale image according to the following formula:
[0167] I gray =0.299·I R +0.587·I G +0.114·I B
[0168] Among them, I gray is a grayscale image, I R ,I G ,I B are the pixel values of the red, green, and blue channels of the original image, respectively;
[0169] Assume the input image size is W t ×H t, the YOLO algorithm divides the image into S×S grids, and obtains the size of each grid unit according to the following formula:
[0170]
[0171] Among them, W' t is the width of each grid cell, H' t is the height of each grid unit, S is the number of grids, that is, the number of grids in each row and column, and W t is the width of the image, H t is the height of the image;
[0172] Each grid cell predicts k bounding boxes. For the (i, j)th grid cell, the information of the predicted mth bounding box is given. The value range of m is 1, 2, ..., m, k, where m is the index of the bounding box and k is the number of bounding boxes. The information of the bounding box includes: the center coordinates (x box_center ,y box_center ), width W box , height H box ;
[0173] Based on the predicted value of each grid cell, calculate the bounding box center coordinates:
[0174]
[0175] Where i is the column index of the current grid cell, j is the row index of the current grid cell, and t x is the offset of the center point of the bounding box in the grid unit on the x-axis, t y is the offset of the center point of the bounding box in the grid unit on the y-axis, σ is the Sigmoid function, defined as
[0176] Based on the predicted value of each grid cell, the bounding box width W box and height H box :
[0177] W box =W t ·e tw
[0178] H box =H t ·e th
[0179] Among them, tw is the relative scale factor of the bounding box width, and th is the relative scale factor of the bounding box height;
[0180] The YOLO algorithm is used to detect the starting point coordinates, end point coordinates and center coordinates of each crack.
[0181] The center coordinates of the crack are the center coordinates of the predicted bounding box:
[0182] (x center ,y center )=(x box_center ,y box_center )
[0183] x start =x box_center -W box / 2
[0184] y start =y box_center -H box / 2
[0185] x end =x box_center +W box / 2
[0186] y end =y box_center +H box / 2
[0187] The starting and ending coordinates of the crack are (x box_center -W box / 2,y box_center -H box / 2)、(x box_center +W box / 2,y box_center +H box / 2).
[0188] On the basis of the above embodiment, the boundary coordinates of each grid unit are calculated, and the detected cracks are divided into corresponding grid units, all grid units are traversed, a crack boundary box is added to each grid unit, and the image of the crack boundary box is saved as follows:
[0189] For each grid cell (i, j), its position on the image needs to be determined, that is, the coordinates of its upper left corner and lower right corner. The coordinates of the upper left corner of the grid cell (i, j) are:
[0190] (x left ,y top )=(i×W' t , j×H' t )
[0191] Among them, (x left ,y top ) is the coordinate of the upper left corner of the grid cell (i, j);
[0192] The coordinates of the lower right corner of the grid cell (i, j) are:
[0193] (x right ,y bottom )=((i+1)×W' t , (j+1)×H' t )
[0194] Among them, (x right ,y bottom ) is the coordinate of the lower right corner of the grid cell (i, j);
[0195] Calculate the top-left and bottom-right coordinates of the crack bounding box:
[0196]
[0197] The starting point coordinate of the crack boundary box is the upper left corner of the crack boundary box, the end point coordinate of the crack boundary box is the lower right corner coordinate of the crack boundary box, and the four boundaries of the crack boundary box are x box_left 、x box_right ,y box_top ,y box_bottom ;
[0198] Determine the range of mesh cells within which the crack bounding box resides:
[0199]
[0200] Traverse the grid cell range (i' start ≤i≤i' end , j' start ≤j≤j' end ) and add the crack bounding box information in each grid cell:
[0201] Traverse i from i' start to i' end ;
[0202] Traverse j from j' start to j' end ;
[0203] The crack bounding box information (x center ,y center , W box , H box ) is added to the storage list of grid cell (i, j);
[0204] Iterate over all grid cells and draw the crack bounding box on the image using the OpenCV library. The process is as follows:
[0205] Import OpenCV library;
[0206] Read the grayscale image to be processed;
[0207] Traverse all grid cells and obtain the crack bounding box information (x center ,y center , W box , H box );
[0208] Get the upper left corner coordinates (x box_left ,y box_top ) and the lower right corner coordinate (x box_right ,y box_bottom ), draw a rectangular bounding box on the image;
[0209] Save the image with the crack bounding box.
[0210] On the basis of the above embodiment, the process of determining the positional relationship between the crack and the boundary box according to the center coordinates, starting point coordinates, end point coordinates of the crack and the center coordinates, starting point coordinates and end point coordinates of the crack boundary box is as follows:
[0211] The crack is completely within the bounding box: the center point, starting point, and end point of the crack are all within the bounding box, and the relationship is expressed as:
[0212] x box_left ≤x crack_center ≤x box_right
[0213] y box_top ≤y crack_center ≤y box_bottom
[0214] x box_left ≤x crack_start ≤x box_right
[0215] y box_top ≤y crack_start ≤y box_bottom
[0216] x box_left ≤x crack_end ≤x box_right
[0217] y box_top ≤y crack_end ≤y box_bottom
[0218] The crack is partially within the bounding box: The center point of the crack is within the bounding box, but the starting point or end point is outside the bounding box. The relationship is expressed as:
[0219] x box_left ≤x crack_center ≤x box_right and y box_top ≤ycrack_center ≤y box_bottom
[0220] and
[0221] [(x crack_start <x box_left x crack_start >x box_right or y crack_start <y box_top or y crack_start >y box_bottom )
[0222] or
[0223] (x crack_end <x box_left x crack_end >x box_right or y crack_end <y box_top or y crack_end >y box_bottom )]
[0224] The crack is not within the bounding box: The center point of the crack is not within the bounding box. The relationship is expressed as:
[0225] x crack_center <x box_left x crack_center >x box_right
[0226] or
[0227] y crack_center <y box_top or y crack_center >y box_bottom .
[0228] On the basis of the above embodiment, the number and size of cracks in the image are determined according to the positional relationship between the cracks and the bounding box. When the center coordinates, the starting point coordinates and the end point coordinates of the cracks and the crack bounding box are consistent, the original crack bounding box is used to obtain the first crack bounding box. When the starting point coordinates and the end point coordinates of the cracks are between the starting point coordinates and the end point coordinates of the crack bounding box, a new crack bounding box is drawn on the image with the crack bounding box to obtain the second crack bounding box. When the starting point coordinates and the end point coordinates of the cracks are outside the starting point coordinates and the end point coordinates of the crack bounding box, a new crack bounding box is drawn on the image with the crack bounding box to obtain the third crack bounding box. The process is as follows:
[0229] When the center coordinates, starting point coordinates, and end point coordinates of the crack and the crack boundary box are consistent, the original crack boundary box is used to obtain the center coordinates, starting point coordinates, and end point coordinates of the first crack boundary box. The relationship is as follows:
[0230]
[0231] When the starting point and ending point coordinates of the crack are between the starting point and ending point coordinates of the crack bounding box, draw the second crack bounding box. The coordinates of the bounding box are determined according to the new starting point and ending point. The relationship is as follows:
[0232] x box_left <x crack_start <x box_right
[0233] y box_top <y crack_start <y box_bottom
[0234] x box_left <x crack_end <x box_right
[0235] y box_top <y crack_end <y box_bottom
[0236] The start and end points of the second crack bounding box are:
[0237]
[0238] When the starting point coordinates and the end point coordinates of the crack are outside the starting point coordinates and the end point coordinates of the crack bounding box, a third crack bounding box is drawn. The coordinates of the bounding box are determined according to the new starting point and end point as well as the minimum and maximum boundary values. The relationship is as follows:
[0239] (x crack_start <x box_left x crack_start >x box_right )
[0240] or
[0241] (y crack_start <y box_top or y crack_start >y box_bottom )
[0242] or
[0243] (x crack_end <x box_left x crack_end >x box_right )
[0244] or
[0245] (y crack_end <y box_top or y crack_end >y box_bottom )
[0246] The start and end points of the third crack bounding box are:
[0247]
[0248] On the basis of the above embodiment, according to the starting point coordinates and the ending point coordinates of the first crack boundary box, the second crack boundary box and the third crack boundary box, the process of obtaining the density of the cracks of each grid unit is as follows:
[0249] The size of the grid cell is S×S, and the coordinate of the upper left corner of the entire area is (x min ,y min ), the coordinate of the lower right corner is (y max ,y max ), the coordinates of the upper left corner and lower right corner of each grid cell (i, j) are:
[0250]
[0251] For each crack bounding box, determine which grid cells it overlaps with;
[0252] First Crack Bounding Box
[0253] Starting point coordinates: (x box_left ,y box_top ), end point coordinates: (x box_right ,y box_bottom );
[0254] Second crack bounding box
[0255] Starting point coordinates: (x new_box_left ,y new_box_top ), end point coordinates: (x new_box_right ,y new_box_bottom );
[0256] Third Crack Bounding Box
[0257] Starting point coordinates: (min(x new_box_left , x box_left ), min(y new_box_top ,y box_top )),
[0258] End point coordinates: (max(x new_box_right , x box_right ), max(ynew_box_bottom ,y box_bottom ));
[0259] For each crack bounding box, determine the extent of the grid cells it covers:
[0260]
[0261] Where δ is the index of the crack bounding box, δ∈[1, 2, 3];
[0262] For each crack bounding box, update the crack density of the covered grid cells. Assume that the density counter is D(i,j) with an initial value of 0. For each crack bounding box, perform the following operations:
[0263] and
[0264] D(i,j)' δ =D(i, j)+1
[0265] The total density of cracks in the grid unit is:
[0266]
[0267] Through the above steps, the density counter of each covered grid cell will increase accordingly, and the total density MD of cracks in the grid cell can be calculated.
[0268] On the basis of the above embodiment, the length and width of the crack are respectively obtained according to the first crack boundary box, the second crack boundary box and the third crack boundary box, and the total area of the crack is obtained according to the length and width of the crack as follows:
[0269] For each crack bounding box, the length and width of the crack can be calculated from the start and end coordinates.
[0270] The length L1 and width W1 of the first crack bounding box are obtained according to the following formula:
[0271] L1=|x box_right -x box_left ∣
[0272] W1=|y box_bottom -y box_top ∣
[0273] The length L2 and width W2 of the second crack bounding box are obtained according to the following formula:
[0274] L2=|x new_box_right -x new_box_left ∣
[0275] W2=|ynew_box_bottom -y new_box_top ∣
[0276] The length L3 and width W3 of the third crack bounding box are obtained according to the following formula:
[0277] L3=|max(x new_box_right , x box_right )-min(x new_box_left , x box_left )∣
[0278] W3=|max(y new_box_bottom ,y box_bottom )-min(y new_box_top ,y box_top )∣
[0279] The size of a crack is usually expressed as area, which can be calculated from the length and width according to the following formula:
[0280] The first crack bounding box area A1:
[0281] A1=L1×W1
[0282] The second crack bounding box area A2:
[0283] A2=L2×W2
[0284] The area of the third crack boundary box A3:
[0285] A3=L3×W3
[0286] Total area of cracks MJ:
[0287] MJ=A1+A2+A3.
[0288] On the basis of the above embodiment, the density of cracks and the area size of cracks are processed to obtain the comprehensive coefficient XS of cracks, according to the following formula:
[0289] XS=MJ·MD
[0290] The process of comparing the comprehensive coefficient of the crack with the preset comprehensive coefficient threshold and judging the severity of the crack is as follows:
[0291] If XS≤YZ, the severity of the crack is judged to be "mild";
[0292] If XS>YZ, the severity of the crack is judged to be "serious".
[0293] See also Figure 2 , the present invention also provides a technical solution:
[0294] A bridge crack detection system based on the YOLO algorithm, the system is used to execute any of the above-mentioned bridge crack detection methods based on the YOLO algorithm, comprising:
[0295] The data acquisition module is used to collect images of the crack area of the bridge, convert the images into grayscale images, use the YOLO algorithm to detect the grayscale images, obtain the crack information and bounding box information, the crack information includes the starting point coordinates, the end point coordinates and the center coordinates, the bounding box information includes the center coordinates, width and height, divide the grayscale image into several grid units, calculate the boundary coordinates of each grid unit, divide the detected cracks into the corresponding grid units, traverse all grid units, add a crack bounding box to each grid unit, and save the image of the crack bounding box;
[0296] A marking module is used to obtain four boundaries of the crack boundary box according to the center coordinates, width and height of the crack boundary box in the image, determine the starting point coordinates and the end point coordinates of the crack boundary box according to the four boundaries of the crack boundary box, and determine the positional relationship between the crack and the boundary box according to the center coordinates, starting point coordinates, and end point coordinates of the crack and the center coordinates, starting point coordinates, and end point coordinates of the crack boundary box;
[0297] a classification module, for determining the number and size of cracks in the image according to the positional relationship between the cracks and the bounding box; when the center coordinates, the starting coordinates and the ending coordinates of the crack and the crack bounding box are consistent, using the original crack bounding box to obtain a first crack bounding box; when the starting coordinates and the ending coordinates of the crack are between the starting coordinates and the ending coordinates of the crack bounding box, drawing a new crack bounding box on the image with the crack bounding box to obtain a second crack bounding box; when the starting coordinates and the ending coordinates of the crack are outside the starting coordinates and the ending coordinates of the crack bounding box, drawing a new crack bounding box on the image with the crack bounding box to obtain a third crack bounding box;
[0298] a data processing module, for obtaining the starting point coordinates and the ending point coordinates of the first crack boundary box, the second crack boundary box and the third crack boundary box according to the first crack boundary box, the second crack boundary box and the third crack boundary box, and obtaining the total density of the grid unit cracks according to the starting point coordinates and the ending point coordinates, respectively obtaining the length and the width of the cracks according to the first crack boundary box, the second crack boundary box and the third crack boundary box, and obtaining the total area of the cracks according to the length and the width of the cracks, performing data processing on the density of the cracks and the total area of the cracks to obtain a comprehensive coefficient of the cracks;
[0299] The judgment module is used to compare the comprehensive coefficient of the crack with a preset comprehensive coefficient threshold to judge the severity of the crack.
[0300] A storage medium is used to store a computer program, and when the computer program is executed by a processor, it implements any of the above-mentioned bridge crack detection methods based on the YOLO algorithm.
[0301] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.
[0302] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. Those skilled in the art may appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein may be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed by hardware or software methods depends on the specific application and design constraints of the technical solution.
[0303] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, and may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0304] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.
Claims
1. A bridge crack detection method based on the YOLO algorithm, characterized in that: The specific steps include: S1. Collect an image of the crack area of the bridge, convert the image into a grayscale image, use the YOLO algorithm to detect the grayscale image, obtain the crack information and bounding box information, the crack information includes the starting point coordinates, end point coordinates and center coordinates, the bounding box information includes the center coordinates, width and height, divide the grayscale image into several grid cells, calculate the boundary coordinates of each grid cell, and divide the detected cracks into the corresponding grid cells, traverse all grid cells, add a crack bounding box to each grid cell, and save the image of the crack bounding box; S2. according to the center coordinates, width and height of the crack boundary box in the crack boundary box image, four boundaries of the crack boundary box are obtained, and according to the four boundaries of the crack boundary box, the starting point coordinates and the end point coordinates of the crack boundary box are determined, and according to the center coordinates, starting point coordinates, and end point coordinates of the crack and the center coordinates, starting point coordinates, and end point coordinates of the crack boundary box, the positional relationship between the crack and the boundary box is determined; S3. Determine the number and size of cracks in the image according to the positional relationship between the cracks and the bounding box. When the center coordinates, the starting coordinates and the ending coordinates of the cracks and the crack bounding box are equal, use the original crack bounding box to obtain a first crack bounding box. When the starting coordinates and the ending coordinates of the cracks are between the starting coordinates and the ending coordinates of the crack bounding box, draw a new crack bounding box on the image with the crack bounding box to obtain a second crack bounding box. When the starting coordinates and the ending coordinates of the cracks are outside the starting coordinates and the ending coordinates of the crack bounding box, draw a new crack bounding box on the image with the crack bounding box to obtain a third crack bounding box. S4. according to the first crack boundary box, the second crack boundary box and the third crack boundary box, the starting point coordinates and the ending point coordinates of the first crack boundary box, the second crack boundary box and the third crack boundary box are obtained, and the total density of the grid unit cracks is obtained according to the starting point coordinates and the ending point coordinates, the length and width of the cracks are respectively obtained according to the first crack boundary box, the second crack boundary box and the third crack boundary box, and the total area of the cracks is obtained according to the length and the width of the cracks, and the density of the cracks and the total area of the cracks are processed to obtain a comprehensive coefficient of the cracks; S5. Compare the comprehensive coefficient of the crack with a preset comprehensive coefficient threshold to determine the severity of the crack.
2. The bridge crack detection method based on the YOLO algorithm according to claim 1 is characterized in that: Collect images of the crack area of the bridge, convert the images into grayscale images, use the YOLO algorithm to detect the grayscale images, and obtain the crack information and bounding box information. The crack information includes the starting point coordinates, end point coordinates and center coordinates, and the bounding box information includes the center coordinates, width and height. The process is as follows: Use the depth camera to collect images of the bridge crack area to obtain the original image I orig ,The collected original image is converted into a grayscale image according to the following formula: I gray =0.299·I R +0.587·I G +0.114·I B Among them, I gray is a grayscale image, I R ,I G ,I B are the pixel values of the red, green, and blue channels of the original image, respectively; Assume the input image size is W t ×H t , the YOLO algorithm divides the image into S×S grids, and obtains the size of each grid unit according to the following formula: Among them, W' t is the width of each grid cell, H' t is the height of each grid unit, S is the number of grids, that is, the number of grids in each row and column, and W t is the width of the image, H t is the height of the image; Each grid cell predicts k bounding boxes. For the (i, j)th grid cell, the information of the predicted mth bounding box is given. The value range of m is 1, 2, ..., m, k, where m is the index of the bounding box and k is the number of bounding boxes. The information of the bounding box includes: the center coordinates (x box_center ,y box_center ), width W box , height H box ; Based on the predicted value of each grid cell, calculate the bounding box center coordinates: Where i is the column index of the current grid cell, j is the row index of the current grid cell, and t x is the offset of the center point of the bounding box in the grid unit on the x-axis, t y is the offset of the center point of the bounding box in the grid unit on the y-axis, σ is the Sigmoid function, defined as Based on the predicted value of each grid cell, the bounding box width W box and height H box : W box =W t ·have been tw H box =H t ·e th Among them, tw is the relative scale factor of the bounding box width, and th is the relative scale factor of the bounding box height; The YOLO algorithm is used to detect the starting point coordinates, end point coordinates and center coordinates of each crack. The center coordinates of the crack are the center coordinates of the predicted bounding box: (x center ,and center )=(x box_center ,and box_center ) x start =x box_center -W box / 2 y start =y box_center -H box / 2 x end =x box_center +W box / 2 y end =y box_center +H box / 2 The starting and ending coordinates of the crack are (x box_center -W box / 2,y box_center -H box / 2)、(x box_center +W box / 2,y box_center +H box / 2).
3. The bridge crack detection method based on the YOLO algorithm according to claim 2 is characterized in that: The process of calculating the boundary coordinates of each grid cell, dividing the detected cracks into the corresponding grid cells, traversing all grid cells, adding a crack bounding box to each grid cell, and saving the image of the crack bounding box is as follows: For each grid cell (i, j), its position on the image needs to be determined, that is, the coordinates of its upper left corner and lower right corner. The coordinates of the upper left corner of the grid cell (i, j) are: (x left ,and top )=(i×W' t ,j×H' t ) Among them, (x left ,y top ) is the coordinate of the upper left corner of the grid cell (i, j); The coordinates of the lower right corner of the grid cell (i, j) are: (x right ,y bottom )=((i+1)×W’ t ,(j+1)×H’ t ) Among them, (x right ,y bottom ) is the coordinate of the lower right corner of the grid cell (i, j); Calculate the top-left and bottom-right coordinates of the crack bounding box: The starting point coordinate of the crack boundary box is the upper left corner of the crack boundary box, the end point coordinate of the crack boundary box is the lower right corner coordinate of the crack boundary box, and the four boundaries of the crack boundary box are x box_left 、x box_right ,y box_top ,y box_bottom ; Determine the range of mesh cells within which the crack bounding box resides: Traverse the grid cell range, i' start ≤i≤i' end , j' start ≤j≤j' end , and add the crack bounding box information in each grid cell: Traverse i from i' start to i' end ; Traverse j from j' start to j' end ; The crack bounding box information, i.e. x center ,y center , W box , H box Add to the storage list of grid cell (i, j); Iterate over all grid cells and draw the crack bounding box on the image using the OpenCV library. The process is as follows: Import OpenCV library; Read the grayscale image to be processed; Traverse all grid cells and obtain the crack bounding box information in each grid cell; Get the upper left corner coordinates (x box_left ,y box_top ) and the lower right corner coordinate (x box_right ,y box_bottom ), draw a rectangular bounding box on the image; Save the image with the crack bounding box.
4. The bridge crack detection method based on the YOLO algorithm according to claim 3 is characterized in that: According to the center coordinates, starting point coordinates, end point coordinates of the crack and the center coordinates, starting point coordinates, and end point coordinates of the crack bounding box, the process of determining the positional relationship between the crack and the bounding box is as follows: The crack is completely within the bounding box: the center point, starting point, and end point of the crack are all within the bounding box, and the relationship is expressed as: x box_left ≤x crack_center ≤x box_right and box_top ≤y crack_center ≤y box_bottom x box_left ≤x crack_start ≤x box_right and box_top ≤y crack_start ≤y box_bottom x box_left ≤x crack_end ≤x box_right and box_top ≤y crack_end ≤y box_bottom The crack is partially within the bounding box: The center point of the crack is within the bounding box, but the starting point or end point is outside the bounding box. The relationship is expressed as: x box_left ≤x crack_center ≤x box_right and y box_top ≤y crack_center ≤y box_bottom and [(x crack_start <x box_left or x crack_start >x box_right or y crack_start <y box_top or y crack_start >y box_bottom ) or (x crack_end <x box_left or x crack_end >x box_right or y crack_end <y box_top or y crack_end >y box_bottom )] The crack is not within the bounding box: The center point of the crack is not within the bounding box. The relationship is expressed as: x crack_center <x box_left or x crack_center >x box_right or y crack_center <y box_top or y crack_center >y box_bottom 。 5. The bridge crack detection method based on the YOLO algorithm according to claim 4 is characterized in that: The specific process of step S3 is as follows: When the center coordinates, starting point coordinates, and end point coordinates of the crack and the crack bounding box are equal, the original crack bounding box is used to obtain the center coordinates, starting point coordinates, and end point coordinates of the first crack bounding box. The relationship is as follows: When the starting point and ending point coordinates of the crack are between the starting point and ending point coordinates of the crack bounding box, draw the second crack bounding box. The coordinates of the bounding box are determined according to the new starting point and ending point. The relationship is as follows: x box_left <x crack_start <x box_right and box_top <y crack_start <y box_bottom x box_left <x crack_end <x box_right and box_top <y crack_end <y box_bottom The start and end points of the second crack bounding box are: When the starting point coordinates and the end point coordinates of the crack are outside the starting point coordinates and the end point coordinates of the crack bounding box, a third crack bounding box is drawn. The coordinates of the bounding box are determined according to the new starting point and end point as well as the minimum and maximum boundary values. The relationship is as follows: (x crack_start <x box_left or x crack_start >x box_right ) or (y crack_start <y box_top or y crack_start >y box_bottom ) or (x crack_end <x box_left or x crack_end >x box_right ) or (y crack_end <y box_top or y crack_end >y box_bottom ) The start and end points of the third crack bounding box are:
6. The bridge crack detection method based on the YOLO algorithm according to claim 5 is characterized in that: According to the starting point coordinates and the ending point coordinates of the first crack boundary box, the second crack boundary box and the third crack boundary box, the process of obtaining the density of the cracks in each grid unit is as follows: The size of the grid cell is S×S, and the coordinate of the upper left corner of the entire area is (x min ,y min ), the coordinate of the lower right corner is (y max ,y max ), the coordinates of the upper left corner and lower right corner of each grid cell (i, j) are: For each crack bounding box, determine which grid cells it overlaps with; First Crack Bounding Box Starting point coordinates: (x box_left ,y box_top ), end point coordinates: (x box_right ,y box_bottom ); Second crack bounding box Starting point coordinates: (x new_box_left ,y new_box_top ), end point coordinates: (x new_box_right ,y new_box_bottom ); Third Crack Bounding Box Starting point coordinates: (min(x new_box_left , x box_left ), min(y new_box_top ,y box_top )), End point coordinates: (max(x new_box_right , x box_right ), max(y new_box_bottom ,y box_bottom )); For each crack bounding box, determine the extent of the grid cells it covers: Where δ is the index of the crack bounding box, δ∈[1, 2, 3]; For each crack bounding box, update the crack density of the covered grid cells. Assume that the density counter is D(i,j) with an initial value of 0. For each crack bounding box, perform the following operations: and D(i,j)’ δ =D(i,j)+1 The total density of cracks in the grid unit is: Through the above steps, the density counter of each covered grid cell will be increased accordingly, and the total density MD of cracks in the grid cell will be calculated.
7. The bridge crack detection method based on the YOLO algorithm according to claim 6 is characterized in that: The process of obtaining the length and width of the cracks according to the first crack boundary box, the second crack boundary box and the third crack boundary box, and obtaining the total area of the cracks according to the length and width of the cracks is as follows: For each crack bounding box, the length and width of the crack can be calculated from the start and end coordinates. The length L1 and width W1 of the first crack bounding box are obtained according to the following formula: L1=∣x box_right -x box_left ∣ W1=∣y box_bottom -y box_top ∣ The length L2 and width W2 of the second crack bounding box are obtained according to the following formula: L2=∣x new_box_right -x new_box_left ∣ W2=∣y new_box_bottom -and new_box_top ∣ The length L3 and width W3 of the third crack bounding box are obtained according to the following formula: L3=∣max(x new_box_right ,x box_right )-min(x new_box_left ,x box_left )∣ <h2 style=";text-align:left;direction:ltr">W3 = ∣max(y<h2 style=";text-align:left;direction:ltr"> new_box_bottom <h2 style=";text-align:left;direction:ltr"> ,y<h2 style=";text-align:left;direction:ltr"> box_bottom <h2 style=";text-align:left;direction:ltr"> )-min(y<h2 style=";text-align:left;direction:ltr"> new_box_top <h2 style=";text-align:left;direction:ltr"> ,y<h2 style=";text-align:left;direction:ltr"> box_top <h2 style=";text-align:left;direction:ltr"> )∣ The size of the crack is expressed as area, which is calculated from the length and width according to the following formula: The first crack bounding box area A1: A1=L1×W1 The second crack bounding box area A2: A2=L2×W2 The area of the third crack boundary box A3: A3=L3×W3 Total area of cracks MJ: MJ=A1+A2+A3.
8. The bridge crack detection method based on the YOLO algorithm according to claim 7 is characterized in that: The density and area of the cracks are processed to obtain the comprehensive coefficient XS of the cracks, based on the following formula: XS=MJ·MD The process of comparing the comprehensive coefficient of the crack with the preset comprehensive coefficient threshold and judging the severity of the crack is as follows: If XS≤YZ, the severity of the crack is judged to be "mild"; If XS>YZ, the severity of the crack is judged to be "serious".
9. A bridge crack detection system based on the YOLO algorithm, the system being used to execute the bridge crack detection method based on the YOLO algorithm according to any one of claims 1 to 8, characterized in that: include: The data acquisition module is used to collect images of the crack area of the bridge, convert the images into grayscale images, use the YOLO algorithm to detect the grayscale images, obtain the crack information and bounding box information, the crack information includes the starting point coordinates, the end point coordinates and the center coordinates, the bounding box information includes the center coordinates, width and height, divide the grayscale image into several grid units, calculate the boundary coordinates of each grid unit, divide the detected cracks into the corresponding grid units, traverse all grid units, add a crack bounding box to each grid unit, and save the image of the crack bounding box; a marking module, for obtaining four boundaries of the crack boundary box according to the center coordinates, width and height of the crack boundary box in the crack boundary box image, determining the starting point coordinates and the ending point coordinates of the crack boundary box according to the four boundaries of the crack boundary box, and determining the positional relationship between the crack and the boundary box according to the center coordinates, starting point coordinates and ending point coordinates of the crack and the center coordinates, starting point coordinates and ending point coordinates of the crack boundary box; a classification module, for determining the number and size of cracks in the image according to the positional relationship between the cracks and the bounding box; when the center coordinates, the starting coordinates and the ending coordinates of the crack and the crack bounding box are all equal, using the original crack bounding box to obtain a first crack bounding box; when the starting coordinates and the ending coordinates of the crack are between the starting coordinates and the ending coordinates of the crack bounding box, drawing a new crack bounding box on the image with the crack bounding box to obtain a second crack bounding box; when the starting coordinates and the ending coordinates of the crack are outside the starting coordinates and the ending coordinates of the crack bounding box, drawing a new crack bounding box on the image with the crack bounding box to obtain a third crack bounding box; a data processing module, for obtaining the starting point coordinates and the ending point coordinates of the first crack boundary box, the second crack boundary box and the third crack boundary box according to the first crack boundary box, the second crack boundary box and the third crack boundary box, and obtaining the total density of the grid unit cracks according to the starting point coordinates and the ending point coordinates, respectively obtaining the length and the width of the cracks according to the first crack boundary box, the second crack boundary box and the third crack boundary box, and obtaining the total area of the cracks according to the length and the width of the cracks, performing data processing on the density of the cracks and the total area of the cracks to obtain a comprehensive coefficient of the cracks; The judgment module is used to compare the comprehensive coefficient of the crack with a preset comprehensive coefficient threshold to judge the severity of the crack.
10. A storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements a bridge crack detection method based on the YOLO algorithm as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Bridge crack detection method and system
CN118196026A
Nuclear power plant concrete defect identification method based on YOLO algorithm
CN117152073A
Data structure, acquisition method and identification method of engineering structure crack
CN117746106A
Cited By
Two-stage concrete crack segmentation method and system considering complex illumination conditions
CN121258988A
Two-stage concrete crack segmentation method and system considering complex lighting conditions
CN121258988B
Bridge damage assessment method and system based on visual segmentation model, and medium
CN122368795A
A bridge damage assessment method and system based on a visual segmentation model and a medium
CN122368795B