A traffic infrastructure synthetic crack image and pixel-level label generation method
By generating crack masks using Voronoi technology and image processing methods, the problems of high cost and high manpower requirements in existing technologies are solved. This enables efficient and realistic crack image and pixel-level label dataset generation, which is suitable for crack detection and segmentation algorithm training.
Patent Information
- Application Number
- CN202511313735.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-15
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2045-09-15
AI Technical Summary
In existing technologies, creating pixel-level labels for cracks requires expensive manpower and time, the accuracy of the labels is greatly affected by human factors, resulting in a scarcity of datasets, and the cost of collecting images of cracks in hidden locations is high, making it difficult to obtain high-quality datasets.
The Voronoi technique is used to generate crack masks. Crack images and pixel-level labels are synthesized from crack-free images through shape reshaping and grayscale assignment. The Voronoi cells are used to generate crack masks with uneven widths. Combined with the watershed algorithm and morphological operations, realistic crack images are generated.
It significantly improves the efficiency of generating crack images and pixel-level labeled datasets. The generated crack images are consistent with real cracks, reducing labor costs. The generated datasets are of high quality and suitable for training crack detection and segmentation algorithms.
Smart Images

Figure CN121120413B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of deep learning crack image and label dataset generation technology, and in particular to a method for generating synthetic crack images and pixel-level labels for transportation infrastructure. Background Technology
[0002] Cracks are one of the most typical defects in transportation infrastructure such as roads, bridges, and tunnels. Accurate crack detection and timely targeted repair measures not only extend the service life of transportation infrastructure but also directly relate to public safety. Current deep learning-based crack detection technology has made some progress. This technology first collects crack images and creates corresponding labels, then uses a deep neural network to learn the mapping relationship between the two, thereby gaining the ability to automatically locate, identify, and even classify cracks in new input images. Among various labels, pixel-level crack labels accurately represent the morphological features of cracks, enabling deep learning models to accurately segment cracks in images.
[0003] However, creating pixel-level labels for cracks typically requires significant manpower and time. Furthermore, label accuracy is heavily influenced by the annotator's experience, effort, and subjective judgment, leading to poor consistency across different images and hindering model learning. These challenges of high annotation costs and poor consistency result in a severe scarcity of high-quality crack images and pixel-level labeled datasets, thus limiting the development of crack detection technology. In addition, collecting images of cracks in concealed areas of infrastructure structures (such as the underside of bridges) is extremely costly, requiring specialized equipment and professional teams. The randomness of crack occurrence in some infrastructure also contributes to crack scarcity, further complicating dataset acquisition. Summary of the Invention
[0004] This invention discloses a method for generating synthetic crack images of transportation infrastructure and pixel-level labels to overcome the aforementioned technical problems.
[0005] To achieve the above objectives, the technical solution of the present invention is as follows: A method for generating synthetic crack images and pixel-level labels for transportation infrastructure includes the following steps: S1: Obtain the image geometry model of a given traffic infrastructure image, and obtain the Voronoi cells in the image geometry model using the Voronoi technique; S2: Filter Voronoi cells to obtain filtered Voronoi cells, and obtain a first group of reshaped Voronoi cells and a second group of reshaped Voronoi cells based on the filtered Voronoi cells. S3: Based on the first group of reshaped Voronoi cells, obtain the mask of the first group of reshaped Voronoi cells; based on the second group of reshaped Voronoi cells, obtain the mask of the second group of reshaped Voronoi cells. S4: Obtain the first crack pixel based on the mask of the first set of reshaped Voronoi cells; obtain the second crack pixel based on the mask of the second set of reshaped Voronoi cells; obtain a crack mask with uneven width based on the first crack pixel and the second crack pixel to generate pixel-level labels. S5: Obtain a grayscale image of a crack-free transportation infrastructure as the target image to obtain the pixel grayscale values of the target image; and according to the crack mask with uneven width, use a stepped grayscale assignment method to obtain the grayscale values of the crack mask with uneven width and the grayscale values of the pixels in the influence range of the crack mask. S6: Based on the gray values of the crack mask with uneven width, the gray values of the pixels in the influence range of the crack mask, and the pixel gray values of the target image, obtain a synthesized crack image of the grayscale image of the transportation infrastructure to complete the generation of the synthesized crack image and pixel-level labels of the transportation infrastructure.
[0006] Furthermore, the method used to obtain the Voronoi cells in the image geometric model is as follows: S11: Establish an image geometric model of the given transportation infrastructure image; S12: Randomly generated in the image geometric model N The first Voronoi core point; among which... N A random integer in the range of 30 to 80; S13: Generate a first random number to increase the probability of local dense cracks. If the first random number is greater than 0.5, then execute S14; if the first random number is not greater than 0.5, then use the first Voronoi core point and execute S16. S14: Select a random point in the image geometric model and establish a square region centered on the random point; S15: Randomly generate within the square area Q The second Voronoi core point; Q The integer is a random integer in the range of 5 to 20; using the first Voronoi core and the second Voronoi core, execute S16; S16: Obtain Voronoi cells based on the image geometric model.
[0007] Furthermore, the side length of the square region is obtained as follows:
[0008] In the formula: The side length of the square region; A random integer in the range of 4 to 10; This represents the number of pixels in the horizontal direction of the synthesized crack image; This represents the number of pixels in the vertical direction of the synthesized crack image; It represents the geometric length corresponding to one pixel.
[0009] Furthermore, the method used to screen Voronoi cells is as follows: S21: Obtain the distance between the centroid of the Voronoi cell and the centroid of the image geometric model, and obtain the Voronoi cell with the smallest distance from the centroid of the image geometric model, which is denoted as the reference Voronoi cell; S22: Obtain the remaining Voronoi cells that have overlapping boundaries with the reference Voronoi cell, and denote them as the first Voronoi cell; S23: Generate a second random number to increase the randomness of the location and number of the selected cell regions: If the second random number is not greater than 0.5, then obtain the remaining Voronoi cells that have overlapping boundaries with the first Voronoi cell. At this time, the remaining Voronoi cells that have overlapping boundaries with the first Voronoi cell, the first Voronoi cell, and the reference Voronoi cell are all the filtered Voronoi cells. If the second random number is greater than 0.5, the remaining Voronoi cells that have overlapping boundaries with the first Voronoi cell are obtained, which are the first remaining Voronoi cells; then, the remaining Voronoi cells that have overlapping boundaries with the first remaining Voronoi cells are obtained. At this time, the remaining Voronoi cells that have overlapping boundaries with the first remaining Voronoi cells, the first remaining Voronoi cells, the first Voronoi cells, and the reference Voronoi cells are all the filtered Voronoi cells.
[0010] Furthermore, the methods used to obtain the first set of reshaped Voronoi cells and the second set of reshaped Voronoi cells are as follows: Two points are randomly generated on each edge of the filtered Voronoi cells, and six points are randomly selected from them. Then: The selected 6 points are moved randomly a first distance toward the centroid of the filtered Voronoi cell. Obtain 6 first vertices, and sequentially connect the undisturbed points from the randomly generated points to the 6 first vertices to obtain the first Voronoi cells with reshaped shapes, thus obtaining the first set of Voronoi cells with reshaped shapes; where, ; , All of these are coefficients for obtaining the first set of Voronoi cells with reshaped shapes; This represents the distance between the vertices and the centroid of the filtered Voronoi cell. Move the six first vertices a random second distance toward or away from the centroid of the selected Voronoi cell. Obtain 6 second vertices, and sequentially connect the undisturbed points from the randomly generated points to the 6 second vertices to obtain the second set of reshaped Voronoi cells; where, ; All of these are coefficients for obtaining the Voronoi cells of the second set of reshaped cells.
[0011] Furthermore, the method for obtaining the mask of the first set of reshaped Voronoi cells is as follows: In the image geometry model, the pixel values at the positions corresponding to the first group of reshaped Voronoi cells are set to 1, and the pixel values at the other positions are set to 0, thus obtaining the mask of the first group of reshaped Voronoi cells. The method for obtaining the mask of the second set of reshaped Voronoi cells is as follows: In the image geometry model, the pixel values at the positions corresponding to the second set of reshaped Voronoi cells are set to 1, and the pixel values at the other positions are set to 0, thus obtaining the mask of the second set of reshaped Voronoi cells.
[0012] Furthermore, the method used to obtain a crack mask with non-uniform width is as follows: S41: Using the watershed algorithm, the first crack pixel and the second crack pixel are obtained based on the first set of shape-reshaped Voronoi cell masks and the second set of shape-reshaped Voronoi cell masks, respectively, so as to obtain the location of the first crack pixel and the location of the second crack pixel. S42: Based on the positions of the first crack pixel and the second crack pixel, a morphological closing operation is performed to obtain a crack mask with uneven width.
[0013] Furthermore, the method used to obtain the grayscale values of the crack mask with uneven width and the grayscale values of the pixels within the crack mask's influence range is as follows: S51: For each pixel at the location of the first crack pixel in the crack mask with uneven width, randomly assign a value to it. h 1 to h The grayscale value of the first crack pixel is obtained from the grayscale values within the range of 2. h 1. h 2 represents the lower and upper limits for assigning grayscale values to the pixels at the location of the first crack pixel, respectively; S52: Randomly select from the pixels at the location of the first crack pixel. k 1% of the pixels, and compare the target image with the selected k 1% of the pixels correspond to the pixel grayscale value minus the random value. j 1. To the selected k Update the grayscale value of 1% of the pixels to obtain the selected [pixels]. k The updated grayscale value of 1% of the pixels; k 1 represents the selection ratio coefficient for the first crack pixel; j 1 is a random value used to update the grayscale value of the first crack pixel; S53: Randomly assign a pixel other than the first crack pixel in the crack mask with uneven width to a pixel in the crack width. h 3 to h The grayscale values within the range of 4 are used to obtain the grayscale values of pixels other than the first crack pixel; h 3. h 4 represents the lower and upper limits for assigning grayscale values to pixels located outside the first crack pixel, respectively; S54: Randomly select from pixels other than the first crack pixel. k 2% of the pixels, and the target image is compared with the selected k 2% of the pixels correspond to the pixel grayscale value minus the random value. j 2. To the selected k Update the grayscale value of 2% of the pixels to obtain the selected [pixels]. k The updated grayscale value of 2% of the pixels; k 2 represents the selection ratio coefficient for pixels other than the first crack pixel; j 2 is a random value used to update the grayscale values of pixels other than the first crack pixel; S55: Based on the grayscale value of the first crack pixel, the selected... k The updated grayscale values of 1% of the pixels, the grayscale values of pixels other than the first crack pixel, and the selected... k The updated grayscale value of 2% of the pixels is used to obtain the grayscale value of the crack mask with uneven width. S56: Perform a morphological dilation operation on the crack mask with non-uniform width to obtain the pixels of the crack mask's influence range, and randomly assign a value to each pixel of the crack mask's influence range. h 5 to h The initial grayscale values of the pixels within the crack mask's influence range are obtained from the grayscale values within the range of 6. h 5. h 6 represents the lower and upper limits for assigning grayscale values to pixels at locations within the influence range of the crack mask, respectively. S57: Randomly select pixels within the influence range of the crack mask. k 3% of the pixels, and the target image is compared with the selected k 3% of the pixels correspond to the pixel grayscale value minus the random value. j 3. To the selected k Update the grayscale value of 3% of the pixels to obtain the selected [pixels]. k The updated grayscale value of 3% of the pixels; thus, the grayscale value of the pixels within the crack mask's influence range is obtained; k 3 represents the selection ratio coefficient for pixels within the influence range of the crack mask; j 3 is a random value used to update the grayscale values of pixels within the influence range of the crack mask.
[0014] Beneficial Effects: The present invention provides a method for generating synthetic crack images and pixel-level labels for transportation infrastructure. This method directly generates crack masks using Voronoi technology and image processing techniques, and then integrates the cracks into crack-free transportation infrastructure images. This significantly improves the efficiency of generating crack images and pixel-level label datasets, overcoming the drawbacks of existing dataset acquisition methods that require significant manpower and time. The cracks generated by the shape reshaping method and multiple image processing operations according to the present invention exhibit significant randomness in distribution, shape, and width, and are closer to real cracks. Furthermore, the non-uniform grayscale crack pixels generated by the stepped grayscale assignment method of the present invention effectively consider background image features, further enhancing the realism of the synthetic crack images. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a flowchart of a method for generating synthetic crack images and pixel-level labels for transportation infrastructure according to the present invention.
[0017] Figure 2 The Voronoi cell generated based on the deployed core points in this embodiment of the invention.
[0018] Figure 3 These are Voronoi cells selected in the embodiments of the present invention.
[0019] Figure 4 These are masks for two sets of shape-reshaping Voronoi cells in embodiments of the present invention.
[0020] Figure 5 These are two sets of crack pixels generated in an embodiment of the present invention.
[0021] Figure 6 This refers to a crack mask with uneven width generated in an embodiment of the present invention.
[0022] Figure 7 This is the target image of the crack that needs to be fused in this embodiment of the invention.
[0023] Figure 8 This is a grayscale image of a non-uniform grayscale crack generated in an embodiment of the present invention.
[0024] Figure 9 This refers to the non-uniform grayscale crack and the pixel grayscale image of the crack mask influence range generated in the embodiments of the present invention.
[0025] Figure 10 This is a synthetic crack image generated in an embodiment of the present invention.
[0026] Figure 11 This is a flowchart illustrating the method for generating synthetic crack images and pixel-level labels for transportation infrastructure in an embodiment of the present invention. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0028] This embodiment introduces a method for generating synthetic crack images and pixel-level labels for transportation infrastructure, including the following steps: Figure 1 and Figure 11 As shown: S1: Obtain the image geometry model of a given traffic infrastructure image, and obtain the Voronoi cells in the image geometry model using the Voronoi technique; Preferably, the method used to obtain Voronoi cells in the image geometric model is as follows: S11: Establish an image geometric model of the given transportation infrastructure image; Specifically, conventional image synthesis methods in the field are used to obtain images of transportation infrastructure. Let the size of the transportation infrastructure image be... a × b ,in, a This represents the number of pixels in the horizontal direction of the synthesized crack image. b This refers to the number of pixels in the vertical direction of the synthesized crack image. In this embodiment, the method for creating an image geometric model corresponding to a given traffic infrastructure image is as follows: the lower left corner of the image geometric model is set as the origin of the coordinate system, and the geometric length corresponding to one pixel is set to... c Therefore, the width of the image geometric model in this coordinate system is a Multiply c Gao Wei b Multiply c .
[0029] In this embodiment, the size of the traffic infrastructure image is 512×512. The geometric length corresponding to one pixel is 0.1. Therefore, the width and height of the image geometric model in this coordinate system are 51.2.
[0030] S12: Randomly generated in the image geometric model N The first Voronoi core point; among which... N A random integer in the range of 30 to 80; S13: Generate a first random number to increase the probability of local dense cracks. If the first random number is greater than 0.5, then execute S14; if the first random number is not greater than 0.5, then use the first Voronoi core point and execute S16. S14: Select a random point in the image geometric model and establish a square region centered on the random point; Preferably, the side length of the square region is obtained as follows:
[0031] In the formula: The side length of the square region; A random integer in the range of 4 to 10; This represents the number of pixels in the horizontal direction of the synthesized crack image; This represents the number of pixels in the vertical direction of the synthesized crack image; The geometric length corresponding to one pixel; S15: Randomly generate within the square area QThe second Voronoi core point; Q The integer is a random integer in the range of 5 to 20; using the first Voronoi core and the second Voronoi core, execute S16; Specifically, N It is a random integer in the range of 30 to 80. Then, a random number in the range of 0 to 1 is generated to increase the probability of dense cracks being generated locally: if the random number is greater than 0.5, a point is randomly selected in the image geometry model, and a boundary is defined with that point as the geometric center, with a side length of... D a square area D for a Multiply c and b Multiply c 1 / of the smaller value e , e The integer is a random integer in the range of 4 to 10, and then randomly generated within the square area. Q The second Voronoi core point, Q It is a random integer in the range of 5 to 20. This is achieved by randomly increasing the integer value within a local region. Q A second Voronoi core point is used to generate locally dense cracks, thereby increasing the randomness of the generated cracks.
[0032] In this embodiment, N The value is 40, and the x and y coordinates of the randomly selected points in the image geometry model are 32.1 and 25.3, respectively. e It's 8. d It is 51.2 / 8. Q It is 10.
[0033] S16: Obtain Voronoi cells based on the image geometric model.
[0034] Specifically, the image geometric model is divided using a first Voronoi kernel point and a second Voronoi kernel point to obtain Voronoi cells. The method for obtaining Voronoi cells is prior art to those skilled in the art, so the specific method for obtaining Voronoi cells will not be described in detail here. Figure 2 The image shows Voronoi cells generated based on the first and second Voronoi core points.
[0035] S2: Filter Voronoi cells to obtain filtered Voronoi cells, and obtain a first group of reshaped Voronoi cells and a second group of reshaped Voronoi cells based on the filtered Voronoi cells. Specifically, in this embodiment, Voronoi cells are screened, and two sets of reshaped Voronoi cells are obtained using the screened Voronoi cells, providing a basis for obtaining a crack mask with uneven width.
[0036] Preferably, the method used to screen Voronoi cells is as follows: S21: Obtain the distance between the centroid of the Voronoi cell and the centroid of the image geometric model, and obtain the Voronoi cell with the smallest distance from the centroid of the image geometric model, which is denoted as the reference Voronoi cell; S22: Obtain the remaining Voronoi cells that have overlapping boundaries with the reference Voronoi cell, and denote them as the first Voronoi cell; S23: Generate a second random number to increase the randomness of the location and number of the selected cell regions: If the second random number is not greater than 0.5, then obtain the remaining Voronoi cells that have overlapping boundaries with the first Voronoi cell. At this time, the remaining Voronoi cells that have overlapping boundaries with the first Voronoi cell, the first Voronoi cell, and the reference Voronoi cell are all the filtered Voronoi cells. If the second random number is greater than 0.5, obtain the remaining Voronoi cells that have overlapping boundaries with the first Voronoi cell, and denot them as the first remaining Voronoi cell; then obtain the remaining Voronoi cells that have overlapping boundaries with the first remaining Voronoi cell. At this time, the remaining Voronoi cells that have overlapping boundaries with the first remaining Voronoi cell, the first remaining Voronoi cell, the first Voronoi cell, and the reference Voronoi cell are all the filtered Voronoi cells.
[0037] Specifically, firstly, the Voronoi cell whose centroid is closest to the centroid of the image geometric model is selected and designated as the reference Voronoi cell. Then, among the remaining Voronoi cells, Voronoi cells with overlapping boundaries with the reference Voronoi cell are selected and designated as the first Voronoi cell. Next, a second random number (ranging from 0 to 1) is generated to increase the randomness of the selected cell region's location and number. If the second random number is not greater than 0.5, Voronoi cells with overlapping boundaries with the first Voronoi cell are selected from the remaining cells. At this point, the remaining Voronoi cells with overlapping boundaries, the first Voronoi cell, and the reference Voronoi cell are considered together. Voronoi cells are used together as the filtered Voronoi cells. If the random number is greater than 0.5, Voronoi cells with overlapping boundaries with the first Voronoi cell are selected from the remaining cells. These Voronoi cells with overlapping boundaries with the first Voronoi cell are recorded as the first remaining Voronoi cells. Next, Voronoi cells with overlapping boundaries with the first remaining Voronoi cell are selected from the remaining cells. At this time, the Voronoi cells with overlapping boundaries with the first remaining Voronoi cell, the first remaining Voronoi cell, the first Voronoi cell, and the reference Voronoi cell are used together as the filtered Voronoi cells.
[0038] In this embodiment, the second random number is 0.35, and the selected Voronoi cells are as follows: Figure 3 As shown, this filtering operation ensures that the synthesized cracks do not always fill the entire image.
[0039] Preferably, the method used to obtain the first group of shape-reshaped Voronoi cells from the screened Voronoi cells is as follows: Two points are randomly generated on each edge of the filtered Voronoi cells, and six points are randomly selected from them. Then: The selected 6 points are moved randomly a first distance toward the centroid of the filtered Voronoi cell. Obtain 6 first vertices, and sequentially connect the undisturbed points among the randomly generated points to the 6 first vertices end-to-end to obtain the first Voronoi cells with reshaped shapes, thus obtaining the first set of Voronoi cells with reshaped shapes; where, ; , All of these are coefficients obtained from the Voronoi cells of the first group of reshaped cells. % 50%; This represents the distance between the vertices and the centroid of the filtered Voronoi cell. Move the six first vertices a random second distance toward or away from the centroid of the selected Voronoi cell. Obtain 6 second vertices, and sequentially connect the undisturbed points from the randomly generated points to the 6 second vertices to obtain the second set of reshaped Voronoi cells; where, ; All of these are coefficients for obtaining the second set of Voronoi cells with reshaped shapes. % 25%; Specifically, two points are randomly generated on each edge of each filtered Voronoi cell. Then, six of these points are randomly selected and moved a certain distance towards the cell's centroid to obtain six first vertices. The ratio of the moved distance to the original distance is... %arrive A random number within the range of %. %~ The larger the % range, the greater the randomness of the subsequent crack shape distortion. Connecting the unmoved points from the randomly generated points to these 6 first vertices sequentially yields the first set of reshaped Voronoi cells. Further, the 6 first vertices are moved a random second distance towards or away from the cell's centroid. The ratio of the distance moved to the original distance is %arrive A random number within the range of %. %~ The larger the % range, the greater the range of width variation of the subsequently generated cracks. By sequentially connecting the randomly generated points that were not moved to these 6 second vertices, a second set of reshaped Voronoi cells is obtained, where... % not exceeding 50%, No more than 25%. For example Figure 4 The images show the first group of reshaped Voronoi cells and the second group of reshaped Voronoi cells. In this embodiment, %and The percentages are 5% and 35% respectively. %and The percentages are 0% and 15% respectively.
[0040] S3: Based on the first group of reshaped Voronoi cells, obtain the mask of the first group of reshaped Voronoi cells; based on the second group of reshaped Voronoi cells, obtain the mask of the second group of reshaped Voronoi cells. Preferably, in the image geometry model, the pixel values at the positions corresponding to the first group of reshaped Voronoi cells are set to 1, and the pixel values at the other positions are set to 0, so that the mask of the first group of reshaped Voronoi cells can be obtained. In the image geometry model, the pixel values at the positions corresponding to the second set of reshaped Voronoi cells are set to 1, and the pixel values at the other positions are set to 0, thus obtaining the mask of the second set of reshaped Voronoi cells.
[0041] Specifically, because the image geometric model just fits a × b Pixels map the image's geometric model into a × b The pixel is then set to 1 for the pixels in the corresponding positions of the first set of reshaped Voronoi cells and the second set of reshaped Voronoi cells, and the remaining pixels are all set to 0. This gives the corresponding masks of the two sets of reshaped Voronoi cells.
[0042] S4: Obtain the first crack pixel based on the mask of the first set of reshaped Voronoi cells; obtain the second crack pixel based on the mask of the second set of reshaped Voronoi cells; obtain a crack mask with uneven width based on the first crack pixel and the second crack pixel, and then generate a pixel-level label. Specifically, multiple image processing operations are performed on the first set of shape-reshaped Voronoi cell masks and the second set of shape-reshaped Voronoi cell masks to obtain a crack mask with uneven width, which can be directly used as a pixel-level label for the crack.
[0043] S41: Using the watershed algorithm, the first crack pixel and the second crack pixel are obtained based on the first set of shape-reshaped Voronoi cell masks and the second set of shape-reshaped Voronoi cell masks, respectively, so as to obtain the location of the first crack pixel and the location of the second crack pixel. Specifically, this embodiment uses the watershed algorithm to operate on the masks of the first and second sets of reshaped Voronoi cells to extract pixels used to segment different cell pixels. These pixels are called segmentation line pixels and are used as crack pixels. Thus, the first crack pixel can be generated based on the mask of the first set of reshaped Voronoi cells, and the second crack pixel can be generated based on the mask of the second set of reshaped Voronoi cells. In this way, the positions of the first crack pixel and the second crack pixel can be obtained. Figure 5 The two sets of crack pixels generated are shown.
[0044] S42: Based on the positions of the first crack pixel and the second crack pixel, a morphological closing operation is performed to obtain a crack mask with uneven width.
[0045] Specifically, in this embodiment, the positions of the first crack pixel and the second crack pixel are directly superimposed, and then a morphological closing operation is performed to fill the holes of the two sets of cracks, resulting in a crack mask with uneven width. This mask can be directly used as a pixel-level label for cracks. Figure 6 The generated crack mask with uneven width is shown, which can be used directly as a pixel-level label for the crack.
[0046] S5: Obtain a grayscale image of a traffic infrastructure without cracks as the target image, and obtain the pixel grayscale values of the target image; and according to the crack mask with uneven width, use a stepped grayscale assignment method to obtain the grayscale values of the crack mask with uneven width (i.e., non-uniform grayscale crack pixels) and the grayscale values of the pixels in the influence range of the crack mask.
[0047] Specifically, based on a crack mask with uneven width, and taking into full account the background features of the target image, a stepped grayscale assignment method is used to generate non-uniform grayscale crack pixels and crack mask influence range pixels, providing a basis for creating a synthetic crack image.
[0048] Specifically, in this embodiment, an arbitrary grayscale image of a transportation infrastructure is acquired and adjusted to a pixel value of a × b The size of the image is used as the target image for fusing the cracks.
[0049] In this embodiment, the target image that needs to be fused with the crack is as follows: Figure 7 As shown.
[0050] S51: For each pixel at the location of the first crack pixel in the crack mask with uneven width, randomly assign a value to it. h 1 to hThe grayscale value of the first crack pixel is obtained from the grayscale values within the range of 2. h 1. h 2 represents the lower and upper limits for assigning grayscale values to the pixels at the location of the first crack pixel, respectively. h 1 , h 2 ; S52: Randomly select from the pixels at the location of the first crack pixel. k 1% of the pixels, and compare the target image with the selected k 1% of the pixels correspond to the pixel grayscale value minus the random value. j 1. To the selected k Update the grayscale value of 1% of the pixels to obtain the selected [pixels]. k The updated grayscale value of 1% of the pixels; k 1 represents the selection ratio coefficient for the first crack pixel; j 1 is a random value used to update the grayscale value of the first crack pixel. j 1 ; Specifically, for each pixel of the first crack pixel, a random value is assigned in... h 1 to h The grayscale values are within a range of 2; to account for the randomness of the actual crack grayscale values and the pixel grayscale levels of the acquired target image, the grayscale values of the crack pixels in the first group are randomly selected. k 1% pixel: Find the corresponding pixel in the target image and subtract a random value from the grayscale value of the corresponding pixel in the target image. j 1. Obtain the grayscale value of the selected pixel. h The value of 1 ranges from 0 to 20; h 2. The value range is from 50 to 90; k The value of 1% ranges from 10% to 50%; j 1. The maximum value does not exceed 90.
[0051] In this embodiment, h 1 and h 2 are 15 and 75 respectively. k 1% is 30%, j 1 is a random value between 0 and 60.
[0052] S53: Randomly assign a pixel other than the first crack pixel in the crack mask with uneven width to a pixel in the crack width. h 3 to h The grayscale values within the range of 4 are used to obtain the grayscale values of pixels other than the first crack pixel; h 3.h 4 represents the lower and upper limits for assigning grayscale values to pixels located outside the first crack pixel, respectively. h 3 , h 4 140; S54: Randomly select from pixels other than the first crack pixel. k 2% of the pixels, and the target image is compared with the selected k 2% of the pixels correspond to the pixel grayscale value minus the random value. j 2. To the selected k Update the grayscale value of 2% of the pixels to obtain the selected [pixels]. k The updated grayscale value of 2% of the pixels; k 2 represents the selection ratio coefficient for pixels other than the first crack pixel; j 2 is a random value used to update the grayscale values of pixels other than the first crack pixel. j 2 ; S55: Based on the grayscale value of the first crack pixel, the selected... k The updated grayscale values of 1% of the pixels, the grayscale values of pixels other than the first crack pixel, and the selected... k The updated grayscale value of 2% of the pixels is used to obtain the grayscale value of the crack mask with uneven width, that is, the crack pixel with non-uniform grayscale. Specifically, in a crack mask with non-uniform width, each pixel except for the first group of crack pixels is randomly assigned a value... h 3 to h Within a range of 4 grayscale values, to account for the randomness of the actual crack grayscale values and the pixel grayscale levels of the acquired target image, pixels were randomly selected from these ranges. k 2% pixel, find the corresponding pixel in the target image, and subtract a random value from the grayscale value of the corresponding pixel in the target image. j 2. Obtain the grayscale value of the selected pixel. h The value of 3 ranges from 20 to 40; h The value of 4 ranges from 90 to 140; k The value of 2% ranges from 30% to 80%; j 2. The maximum value shall not exceed 70.
[0053] In this embodiment, h 3 and h 4 are 30 and 120 respectively. k 2% is 50%, j2 is a random value between 0 and 50. Figure 8 The generated non-uniform grayscale crack grayscale image is shown.
[0054] S56: Perform a morphological dilation operation on the crack mask with non-uniform width to obtain the pixels of the crack mask's influence range, and randomly assign a value to each pixel of the crack mask's influence range. h 5 to h The initial grayscale values of the pixels within the crack mask's influence range are obtained from the grayscale values within the range of 6. h 5. h 6 represents the lower and upper limits for assigning grayscale values to pixels at locations within the influence range of the crack mask, respectively. h 5 , h 6 180; S57: Randomly select pixels within the influence range of the crack mask. k 3% of the pixels, and the target image is compared with the selected k 3% of the pixels correspond to the pixel grayscale value minus the random value. j 3. To the selected k Update the grayscale value of 3% of the pixels to obtain the selected [pixels]. k The updated grayscale value of 3% of the pixels; k 3 represents the selection ratio coefficient for pixels within the influence range of the crack mask; j 3 represents a random value used to update the grayscale values of pixels within the influence range of the crack mask. j 3 50.
[0055] Specifically, the influence of pixels near the crack mask is further considered to determine the grayscale values of pixels within the crack mask's influence range. Specifically, a morphological dilation operation is performed on the crack mask using a structuring element with a width of two pixels. The resulting pixels, excluding the crack mask itself, are defined as pixels within the crack mask's influence range. Each pixel within this influence range is randomly assigned a grayscale value within the crack mask's influence range. h 5 to h Gray values within a range of 6, randomly selected from these pixels k 3% pixels, find the corresponding pixel in the target image, and subtract a random value from the grayscale value of the corresponding pixel in the target image. j 3. Obtain the grayscale value of the selected pixel. h The value of 5 ranges from 40 to 80; h The value of 6 ranges from 140 to 180; k The 3% value ranges from 50% to 80%. j3. The maximum value shall not exceed 50.
[0056] In this embodiment, h 5 and h 6 are 50 and 170 respectively. k 3% is 70%, j 3 is a random value between 0 and 40. Figure 9 The generated non-uniform grayscale crack and the pixel grayscale map of the crack mask's influence range are shown.
[0057] S6: Based on the gray values of the crack mask with uneven width, the gray values of the pixels in the influence range of the crack mask, and the pixel gray values of the target image, obtain a synthesized crack image of the grayscale image of the transportation infrastructure to complete the generation of the synthesized crack image and pixel-level labels of the transportation infrastructure.
[0058] Specifically, the gray values of the crack mask with uneven width at the location of the crack mask, the gray values of the pixels within the crack mask's influence range at the location of the crack mask with uneven width, and the gray values of the pixels in the target image are weighted and linearly superimposed. The weights of the gray values of the crack mask with uneven width and the gray values of the pixels within the crack mask's influence range are: p 1%, the weight of the pixel grayscale value of the target image is p 2%, while the grayscale values of the pixels in the remaining positions of the target image remain unchanged, and the final synthesized crack image is obtained.
[0059] In this embodiment, p 1% and p The resulting synthetic crack images are as follows: 2% for 90% and 10% for 10% respectively. Figure 10 As shown, generate Figure 10 The synthetic crack image shown and Figure 6 The crack mask shown was processed by an Intel(R) Xeon(R) CPU E5-2698B v3@2.00GHz computer processor, with a computation time of only 4.6 seconds. Therefore, this embodiment can significantly improve the efficiency of crack image and pixel-level label dataset generation, making up for the shortcomings of existing methods such as the laborious acquisition of real crack images and the inefficiency of manual crack labeling. It provides an efficient and high-quality dataset guarantee for the training of crack detection, segmentation and other related algorithms.
[0060] In summary, this embodiment has the following beneficial effects: 1. This embodiment directly generates a crack mask, and then synthesizes a composite crack image of a grayscale image of a transportation infrastructure based on the crack mask with uneven width. This avoids the inefficient process of acquiring crack images first and then obtaining pixel-level labels through time-consuming manual annotation, which is common in existing methods. This significantly improves the generation efficiency of crack images and pixel-level label datasets.
[0061] 2. This embodiment improves the randomness and realism of crack distribution, crack morphology, and crack width by randomly generating Voronoi core points, reshaping Voronoi cell shape, and using two sets of masks to reshape Voronoi cells.
[0062] 3. This embodiment improves the realism of the synthesized crack image by using a stepped design for the grayscale of unevenly wide crack pixels and adaptively considering the grayscale features of the target image.
[0063] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for generating synthetic crack images and pixel-level labels for transportation infrastructure, characterized in that, Includes the following steps: S1: Obtain the image geometry model of a given traffic infrastructure image, and obtain the Voronoi cells in the image geometry model using the Voronoi technique; S2: Filter Voronoi cells to obtain filtered Voronoi cells, and obtain a first group of reshaped Voronoi cells and a second group of reshaped Voronoi cells based on the filtered Voronoi cells. S3: Obtain the mask of the first group of reshaped Voronoi cells based on the first group of reshaped Voronoi cells; Based on the second set of reshaped Voronoi cells, obtain the mask of the second set of reshaped Voronoi cells; S4: Obtain the first crack pixel based on the mask of the first set of reshaped Voronoi cells; obtain the second crack pixel based on the mask of the second set of reshaped Voronoi cells; obtain a crack mask with uneven width based on the first crack pixel and the second crack pixel to generate pixel-level labels. S5: Obtain a grayscale image of a crack-free transportation infrastructure as the target image to obtain the pixel grayscale values of the target image; and according to the crack mask with uneven width, use a stepped grayscale assignment method to obtain the grayscale values of the crack mask with uneven width and the grayscale values of the pixels in the influence range of the crack mask. S6: Based on the gray values of the crack mask with uneven width, the gray values of the pixels in the influence range of the crack mask, and the pixel gray values of the target image, obtain a synthesized crack image of the grayscale image of the transportation infrastructure to complete the generation of the synthesized crack image and pixel-level labels of the transportation infrastructure.
2. The method for generating synthetic crack images and pixel-level labels for transportation infrastructure according to claim 1, characterized in that, The method used to obtain Voronoi cells in the image geometric model is as follows: S11: Establish an image geometric model of the given transportation infrastructure image; S12: Randomly generated in the image geometric model N The first Voronoi core point; among which... N A random integer in the range of 30 to 80; S13: Generate a first random number to increase the probability of local dense cracks. If the first random number is greater than 0.5, then execute S14; if the first random number is not greater than 0.5, then use the first Voronoi core point and execute S16. S14: Select a random point in the image geometric model and establish a square region centered on the random point; S15: Randomly generate within the square area Q The second Voronoi core point; Q The integer is a random integer in the range of 5 to 20; using the first Voronoi core and the second Voronoi core, execute S16; S16: Obtain Voronoi cells based on the image geometric model.
3. The method for generating synthetic crack images and pixel-level labels for transportation infrastructure according to claim 2, characterized in that, The side length of the square region is obtained as follows: In the formula: The side length of the square region; A random integer in the range of 4 to 10; This represents the number of pixels in the horizontal direction of the synthesized crack image; This represents the number of pixels in the vertical direction of the synthesized crack image; It represents the geometric length corresponding to one pixel.
4. The method for generating synthetic crack images and pixel-level labels for transportation infrastructure according to claim 2, characterized in that, The method used to screen Voronoi cells is as follows: S21: Obtain the distance between the centroid of the Voronoi cell and the centroid of the image geometric model, and obtain the Voronoi cell with the smallest distance from the centroid of the image geometric model, which is denoted as the reference Voronoi cell; S22: Obtain the remaining Voronoi cells that have overlapping boundaries with the reference Voronoi cell, and denote them as the first Voronoi cell; S23: Generate a second random number to increase the randomness of the location and number of the selected cell regions: If the second random number is not greater than 0.5, then obtain the remaining Voronoi cells that have overlapping boundaries with the first Voronoi cell. At this time, the remaining Voronoi cells that have overlapping boundaries with the first Voronoi cell, the first Voronoi cell, and the reference Voronoi cell are all the filtered Voronoi cells. If the second random number is greater than 0.5, the remaining Voronoi cells that have overlapping boundaries with the first Voronoi cell are obtained, which are the first remaining Voronoi cells; then, the remaining Voronoi cells that have overlapping boundaries with the first remaining Voronoi cells are obtained. At this time, the remaining Voronoi cells that have overlapping boundaries with the first remaining Voronoi cells, the first remaining Voronoi cells, the first Voronoi cells, and the reference Voronoi cells are all the filtered Voronoi cells.
5. The method for generating synthetic crack images and pixel-level labels for transportation infrastructure according to claim 4, characterized in that, The methods used to obtain the first set of reshaped Voronoi cells and the second set of reshaped Voronoi cells are as follows: Two points are randomly generated on each edge of the filtered Voronoi cells, and six points are randomly selected from them. Then: The selected 6 points are moved randomly a first distance toward the centroid of the filtered Voronoi cell. Obtain 6 first vertices, and sequentially connect the undisturbed points from the randomly generated points to the 6 first vertices to obtain the first Voronoi cells with reshaped shapes, thus obtaining the first set of Voronoi cells with reshaped shapes; where, ; , All of these are coefficients for obtaining the first set of Voronoi cells with reshaped shapes; This represents the distance between the vertices and the centroid of the filtered Voronoi cell. Move the six first vertices a random second distance toward or away from the centroid of the selected Voronoi cell. Obtain 6 second vertices, and sequentially connect the undisturbed points from the randomly generated points to the 6 second vertices to obtain the second set of reshaped Voronoi cells; where, ; All of these are coefficients for obtaining the Voronoi cells of the second set of reshaped cells.
6. The method for generating synthetic crack images and pixel-level labels for transportation infrastructure according to claim 5, characterized in that, The method for obtaining the mask of the first set of reshaped Voronoi cells is as follows: In the image geometry model, the pixel values at the positions corresponding to the first group of reshaped Voronoi cells are set to 1, and the pixel values at the other positions are set to 0, thus obtaining the mask of the first group of reshaped Voronoi cells. The method for obtaining the mask of the second set of reshaped Voronoi cells is as follows: In the image geometry model, the pixel values at the positions corresponding to the second set of reshaped Voronoi cells are set to 1, and the pixel values at the other positions are set to 0, thus obtaining the mask of the second set of reshaped Voronoi cells.
7. The method for generating synthetic crack images and pixel-level labels for transportation infrastructure according to claim 6, characterized in that, The method used to obtain a crack mask with non-uniform width is as follows: S41: Using the watershed algorithm, the first crack pixel and the second crack pixel are obtained based on the first set of shape-reshaped Voronoi cell masks and the second set of shape-reshaped Voronoi cell masks, respectively, so as to obtain the location of the first crack pixel and the location of the second crack pixel. S42: Based on the positions of the first crack pixel and the second crack pixel, a morphological closing operation is performed to obtain a crack mask with uneven width.
8. The method for generating synthetic crack images and pixel-level labels for transportation infrastructure according to claim 7, characterized in that, The method used to obtain the grayscale values of the crack mask with uneven width and the grayscale values of the pixels within the crack mask's influence range is as follows: S51: For each pixel at the location of the first crack pixel in the crack mask with uneven width, randomly assign a value to it. h 1 to h The grayscale value of the first crack pixel is obtained from the grayscale values within the range of 2. h 1. h 2 represents the lower and upper limits for assigning grayscale values to the pixels at the location of the first crack pixel, respectively; S52: Randomly select from the pixels at the location of the first crack pixel. k 1% of the pixels, and compare the target image with the selected k 1% of the pixels correspond to the pixel grayscale value minus the random value. j 1. To the selected k Update the grayscale value of 1% of the pixels to obtain the selected [pixels]. k The updated grayscale value of 1% of the pixels; k 1 represents the selection ratio coefficient for the first crack pixel; j 1 is a random value used to update the grayscale value of the first crack pixel; S53: Randomly assign a pixel other than the first crack pixel in the crack mask with uneven width to a pixel in the crack width. h 3 to h The grayscale values within the range of 4 are used to obtain the grayscale values of pixels other than the first crack pixel; h 3. h 4 represents the lower and upper limits for assigning grayscale values to pixels located outside the first crack pixel, respectively; S54: Randomly select from pixels other than the first crack pixel. k 2% of the pixels, and the target image is compared with the selected k 2% of the pixels correspond to the pixel grayscale value minus the random value. j 2. To the selected k Update the grayscale value of 2% of the pixels to obtain the selected [pixels]. k The updated grayscale value of 2% of the pixels; k 2 represents the selection ratio coefficient for pixels other than the first crack pixel; j 2 is a random value used to update the grayscale values of pixels other than the first crack pixel; S55: Based on the grayscale value of the first crack pixel, the selected... k The updated grayscale values of 1% of the pixels, the grayscale values of pixels other than the first crack pixel, and the selected... k The updated grayscale value of 2% of the pixels is used to obtain the grayscale value of the crack mask with uneven width. S56: Perform a morphological dilation operation on the crack mask with non-uniform width to obtain the pixels of the crack mask's influence range, and randomly assign a value to each pixel of the crack mask's influence range. h 5 to h The initial grayscale values of the pixels within the crack mask's influence range are obtained from the grayscale values within the range of 6. h 5. h 6 represents the lower and upper limits for assigning grayscale values to pixels at locations within the influence range of the crack mask, respectively. S57: Randomly select pixels within the influence range of the crack mask. k 3% of the pixels, and the target image is compared with the selected k 3% of the pixels correspond to the pixel grayscale value minus the random value. j 3. To the selected k Update the grayscale value of 3% of the pixels to obtain the selected [pixels]. k The updated grayscale value of 3% of the pixels; thus, the grayscale value of the pixels within the crack mask's influence range is obtained; k 3 represents the selection ratio coefficient for pixels within the influence range of the crack mask; j 3 is a random value used to update the grayscale values of pixels within the influence range of the crack mask.
Citation Information
Patent Citations
Discrete fracture network model construction method based on Voronoi diagram and Gaussian distribution
CN111476900A
Traffic infrastructure crack image data augmentation method and device and medium
CN116824299A