A bridge crack detection method based on image recognition

By constructing candidate crack maps from short-time images of bridge surfaces and performing temporal consistency evaluation and reflection feature processing, the problem of character regions interfering with crack detection in bridge inspection is solved. Stable crack identification and false detection suppression within character regions are achieved, meeting the requirements of continuity and reliability in engineering inspection.

CN122265141APending Publication Date: 2026-06-23WEIFANG HIGHWAY DEV GRP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610126006.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-29
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

Existing bridge inspection technologies struggle to accurately distinguish between character areas and crack areas, leading to false detections and breaks in crack detection results, which affects the accuracy of crack length assessment and location.

Method used

By acquiring short-time images of the bridge surface, candidate crack maps are constructed and temporal consistency is evaluated. Specular reflection gating is formed by combining reflection features to suppress false crack responses. Stable crack result maps are output using spatial connectivity and morphological constraints.

Benefits of technology

Crack identification and false detection suppression were achieved on bridge surfaces with significant character interference, maintaining crack continuity and reliability, and meeting the continuity and reliability requirements of engineering inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122265141A_ABST
    Figure CN122265141A_ABST
Patent Text Reader

Abstract

The application discloses a bridge crack detection method based on image recognition and concretely relates to the field of bridge detection, which is used to solve the problems of misjudgment, missed detection and crack breakage caused by the similar shape of the code or steel stamp characters on the bridge surface and the crack fine lines; the edge graph is generated from the original image, the character candidate area is limited based on the edge density and the contrast on both sides of the edge, the character mask and the character skeleton are constructed in the character candidate area, the cost graph is constructed by combining the multi-directional line top-hat transformation inside the character mask, the minimum cost path is quantified to pass through the uniform cost and attach the uniform distance, the classification model is used to output the crossing coefficient to separate the crossing candidate set and the homologous candidate set, the sample block matching is used to generate the background graph without characters and the residual fine line graph in the character repair area to complete the missing section of the crossing candidate set and remove the corresponding pixels of the homologous candidate set, and the crack result pixel graph is output.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of bridge inspection, and more specifically, to a method for detecting bridge cracks based on image recognition. Background Technology

[0002] In bridge appearance inspections and periodic checks, high-definition imaging is used to capture fine crack textures on the surface of concrete or steel structures. Bridge webs and beam ends commonly feature inkjet numbers, inspection marks, and stamped characters. The strokes of these characters are thin lines that are similar to cracks in terms of grayscale contrast and edge shape. The area around the characters is often accompanied by water seepage marks, laitance textures, and construction scratches, resulting in multiple types of fine line candidates in the visual inspection results, which are superimposed on each other.

[0003] Current crack detection methods often use segmentation networks or edge enhancement to obtain crack candidate images, followed by direct thinning and connectivity analysis. Character strokes are often misidentified as cracks and included in subsequent statistics. When using morphological filtering or character erasure, real cracks that cross the character area are easily erased, causing the crack centerline to break within the character area. The continuity of crack connectivity and direction is disrupted, further leading to deviations in crack length assessment and crack location. Therefore, it is necessary to distinguish between cracks crossing the character area and thin lines of the same origin strokes, while maintaining the continuous representation of cracks crossing the character area during character removal.

[0004] To address the aforementioned problems, a technical solution is provided. Summary of the Invention

[0005] To overcome the aforementioned deficiencies of the prior art, embodiments of the present invention provide a bridge crack detection method based on image recognition. This method acquires short-time images of the bridge surface, constructs a crack candidate map, and extracts a candidate set of crack centerlines. Temporal consistency is evaluated on the candidate lines within a short timeframe. Simultaneously, a specular reflection gating system is formed based on reflection features to suppress pseudo-crack responses that vary with illumination. Subsequently, a crack result map is output by combining spatial connectivity and morphological constraints. This achieves stable identification and filtering of high-light interference scenes without adding dedicated peripherals, thus solving the problems mentioned in the background art.

[0006] To achieve the above objectives, the present invention provides the following technical solution: S1: Acquire the original image and obtain the edge map. Calculate the edge density and contrast on both sides of the edge map to filter the candidate boundary segment set. Generate the search range based on the connectivity aggregation and region expansion of the candidate boundary segment set. S2: Within the search range, perform connected component labeling on the edge map and obtain the stroke connected component set by jointly filtering based on pixel area, aspect ratio and thickness estimate. Use this to generate a character mask and thin it to obtain the character skeleton and the intersection set of the endpoint set. S3: The intersection of the character mask boundary determines the entry and exit points. A cost map is constructed within the character mask, and the minimum cost path is searched to obtain the average cost of penetration and the average distance of attachment. The average cost of penetration and the average distance of attachment are input into the classification model to output the crossing coefficient and generate the crossing candidate set and the homologous candidate set accordingly. S4: The character mask derives the character repair region and generates a character removal background image and residual thin line image within the character repair region. The intersection of the residual thin line image and the boundary of the crossing candidate set forms a connected seed set and completes the missing segments of the crossing candidate set. The homologous candidate set forms a homologous removal region within the character repair region and outputs the crack result pixel image.

[0007] Furthermore, step S1 includes: Edge detection is performed on the original image to obtain an edge map. The pixel values ​​of the edge map are binary sets. The edge density is statistically analyzed in a fixed neighborhood based on the edge map and limited to a normalized intensity range. The contrast on both sides of the edge is calculated based on the sampling bands on both sides of the edge normal in the original image and limited to a normalized intensity range. A set of candidate boundary segments is generated according to the joint criterion of edge density and contrast on both sides of the edge.

[0008] Furthermore, step S1 also includes: Eight-neighbor connectivity aggregation is performed on the candidate boundary fragment set to obtain connected components. For each connected component, a minimum bounding rectangle region is generated and the region is expanded. The expanded region is cropped to keep it within the effective range of the original image. The union of all expanded regions is taken to obtain the search range. The search range includes the candidate boundary fragment set and is used as the spatial input boundary for character mask extraction.

[0009] Furthermore, step S2 includes: The edge map is constrained by applying value constraints to the edge map based on the search range. The eight-neighbor connected components are marked on the edge map. The stroke connected component set is obtained by filtering according to the joint criteria of pixel area, aspect ratio, and thickness estimate.

[0010] Furthermore, step S2 also includes: The set of connected stroke components is joined to obtain the edge set. The edge set is closed and filled with holes to generate a character mask. The character mask is thinned to obtain the character skeleton. The character skeleton is used to extract the endpoint set and intersection set by counting eight neighbors.

[0011] Furthermore, step S3 includes: Crack segmentation is performed on the original image to obtain a crack candidate map. The crack candidate map is used to generate a crack binary map using the quantile determination rule. The crack binary map is thinned to obtain a crack centerline map. The crack centerline map is decomposed into eight-neighbor connected components to obtain a crack centerline candidate set.

[0012] Furthermore, step S3 also includes: The character mask generates the character mask boundary. The intersection of the crack centerline candidate and the character mask boundary is used to obtain the intersection point set. When the number of pixels in the intersection point set is not less than two, the arc length order is established and the in-point and out-point are determined. When the number of pixels in the intersection point set is less than two, the crack centerline candidate is added to the same source candidate set.

[0013] Furthermore, step S3 also includes: A multi-directional linear top-hat transformation is performed within the character mask to obtain a linear response map, which is then normalized to generate a cost map. The minimum cost path is searched on the cost map for the in-point and out-point, and the average cost of penetration and the average distance of attachment are calculated. The average cost of penetration and the average distance of attachment are input into the classification model to obtain the crossing coefficient and to divide the crossing candidate set and the homologous candidate set.

[0014] Furthermore, step S4 includes: The character mask is morphologically dilated to generate the character restoration region. The character-removed background image copies the pixel values ​​of the original image outside the character restoration region. The character-removed background image is then restored within the character restoration region using sample block matching and the optimal source block pixels are copied in a consistent pixel offset manner.

[0015] Furthermore, step S4 also includes: The original image and the de-character background image generate residual thin line maps within the character restoration area. The intersection of the candidate set and the boundary of the character restoration area forms a connected seed set. The pixels in the residual thin line map that are connected to the eight neighbors of the connected seed set constitute the crossing completion set. After the homologous candidate set forms a homologous removal area within the character restoration area, the crack result pixel map is output.

[0016] The technical effects and advantages of the image recognition-based bridge crack detection method of the present invention are as follows: This invention links character region determination, crossing discrimination, and pixel-level completion within the same processing chain. The search range defined by edge density and contrast on both sides of the edge focuses character mask extraction on the vicinity of stroke boundaries. The minimum cost path provides a fine dark line penetration pathway within the character mask, which, together with the character skeleton distance field, forms a distinguishable penetration average cost and attachment average distance. The crossing coefficient stably divides the crack centerline candidate set into a crossing candidate set and a homologous candidate set. The background image and residual fine line image within the character repair area fill in the missing segments of the crossing candidate set and remove the stroke pixels corresponding to the homologous candidate set, ensuring that the output crack result maintains connectivity within the character-covered area without introducing pseudo-cracks. Through these constraints, the fine line representation and character stroke representation of the crack result pixel image within the character area are effectively separated, while the crack fine line representation outside the character area maintains the original connected component structure, facilitating subsequent crack localization and connectivity analysis. Attached Figure Description

[0017] Figure 1 This is a schematic flowchart of a bridge crack detection method based on image recognition according to the present invention. Detailed Implementation

[0018] 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, and 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.

[0019] Example 1: Figure 1 This invention presents a bridge crack detection method based on image recognition, comprising: S1: Acquire the original image and obtain the edge map. Calculate the edge density and contrast on both sides of the edge map to filter the candidate boundary segment set. Generate the search range based on the connectivity aggregation and region expansion of the candidate boundary segment set.

[0020] S2: Within the search range, perform connected component labeling on the edge map and obtain the stroke connected component set by jointly filtering based on pixel area, aspect ratio and thickness estimate. This generates a character mask and thins it to obtain the intersection set of the character skeleton and endpoint set.

[0021] S3: The intersection of the character mask boundary determines the entry and exit points. A cost map is constructed within the character mask, and the minimum cost path is searched to obtain the average cost of penetration and the average distance of attachment. The average cost of penetration and the average distance of attachment are input into the classification model to output the crossing coefficients and generate the crossing candidate set and the homologous candidate set accordingly.

[0022] S4: The character mask derives the character repair region and generates a character removal background image and residual thin line image within the character repair region. The intersection of the residual thin line image and the boundary of the crossing candidate set forms a connected seed set and completes the missing segments of the crossing candidate set. The homologous candidate set forms a homologous removal region within the character repair region and outputs the crack result pixel image.

[0023] This invention addresses the issue of crack detection on bridge surfaces with inkjet or stamped characters. It proposes an image recognition-based method to solve the problem of false detections and crack formations caused by the similarity between character strokes and crack shapes. The overall concept revolves around "first limiting the influence range of the character, then determining the crack crossing relationship within the character range, and finally completing and eliminating crack results." It collaboratively analyzes character structural information and crack candidate information within the same coordinate system to obtain stable and reliable crack output results.

[0024] Specifically, the method first generates an edge map from the original image and uses the fine and high-contrast boundary segments in the edge map to construct a search range, limiting character mask extraction to candidate regions that correspond to the character stroke boundaries. Then, within the search range, the edge map undergoes connectivity analysis and filtering to form a character mask. Within the character mask, thinning is performed to obtain the character skeleton and its endpoint and intersection sets, thus obtaining the spatial topological representation of the character strokes. Based on this, the method obtains a candidate set of crack centerlines through crack segmentation. For candidate lines intersecting the character mask, the entry and exit points are determined based on the character mask boundaries. A cost map oriented towards the thin line structure is constructed within the character mask, and the minimum cost path from the entry point to the exit point is searched to obtain the average cost of penetration. Simultaneously, the average attachment distance is obtained based on the character skeleton distance field. The average cost of penetration and the average attachment distance are input into a classification model to output a crossing coefficient, achieving the separation of the crossing candidate set and the homologous candidate set. Finally, a background image with characters removed is generated within the character mask-defined area, and a residual line map is formed. This residual line map is used to perform pixel-level completion of missing segments in the candidate set within the character area, and corresponding pixel areas of the same candidate set are removed. The output shows crack results that include the completed candidate sets but do not contain any same candidate sets. Through this processing chain, the present invention achieves a unified balance between crack identification and false detection suppression on bridge surfaces with significant character interference, meeting the requirements of engineering inspection for continuity and reliability.

[0025] The bridge surface simultaneously contains concrete textures, construction marks, water seepage marks, and inkjet or stamped characters. Directly entering the connected region analysis within the entire map will generate a large number of boundary connected components unrelated to the characters. Character mask extraction is prone to deviating from the stroke positions of the inkjet or stamped characters, thereby affecting the stable generation of the character skeleton and interfering with the subsequent discrimination process of the candidate set of crack center lines within the character region.

[0026] S101: Input constraints and boundaries before calculating the search range Figure 1 To induce chemical reactions.

[0027] In the original image, inkjet or stamped characters are usually represented by high-contrast fine line strokes. If connected region analysis is directly expanded on the whole image, bridge surface texture, water seepage marks, and construction line boundaries will generate a large number of irrelevant connected segments, making it difficult to stably limit character mask extraction to the vicinity of character stroke boundaries.

[0028] After the original image enters step S1, it first undergoes brightness uniformity processing. The processing method is to linearly map the brightness components of the original image to the range of zero to one according to the minimum and maximum values. After mapping, the brightness values ​​are kept within the range of zero to one. Then, an edge map is output based on edge detection. The pixel values ​​of the edge map only include two categories: zero and one. Zero values ​​represent non-edge pixels, and one values ​​represent edge pixels. The edge map serves as the only edge position input for subsequent calculation of edge density and contrast on both sides of the edge. In step S2, the edge map is further used for connected region analysis within the search range.

[0029] S102: Construction and value range limitation of the candidate boundary segment set.

[0030] Character stroke boundaries have two visible features: one is that edge pixels exhibit higher edge density in local areas, and the other is that the difference in average brightness on both sides of the stroke edge is more obvious. By using these two features, a set of candidate boundary segments that are closer to the character stroke boundaries can be screened out in the edge map, thereby limiting the search range to the vicinity of the character without relying on additional acquisition parameters.

[0031] Edge density is calculated using the edge map as input. A local neighborhood is established for each edge pixel location. The local neighborhood uses a square window with a fixed side length. When the window boundary intersects with the original image boundary, a boundary truncation method is used. The calculation is only performed within the effective range of the original image. The calculation order of edge density is as follows: first, count the number of pixels with an edge map value of 1 within the square window; then, count the total number of pixels within the square window; finally, divide the former by the latter to obtain the edge density. The edge density value is limited to the range of zero to one.

[0032] The calculation of contrast on both sides of the edge takes the original image and the edge map as input, and is only performed on positions where the edge map has a value of one. For each edge pixel, the edge normal direction is first determined. The edge normal direction is provided by the direction information generated during the edge detection process. When the direction information is unavailable, the edge direction is determined by the brightness gradient direction of the original image and its perpendicular direction is taken as the normal direction. Then, sampling bands are constructed on both sides of the edge along the normal direction. The sampling band is a thin strip-shaped region, parallel to the edge direction. The width of the strip-shaped region is fixed and covers several pixels near the edge. The length of the strip-shaped region is fixed and symmetrically distributed across both sides of the edge. When the sampling band goes out of bounds, the out-of-bounds pixel rejection method is used. Only pixels within the effective range of the original image are used. The calculation order of contrast on both sides of the edge is as follows: first calculate the average brightness of the positive side sampling band, then calculate the average brightness of the negative side sampling band, and finally take the absolute value of the difference between the two as the contrast on both sides of the edge. The contrast value on both sides of the edge is limited to the range of zero to one.

[0033] The candidate boundary segment set is constructed using edge density and contrast on both sides of the edge as joint criteria, retaining only edge pixels that simultaneously satisfy the condition that edge density is not lower than the density threshold and contrast on both sides of the edge is not lower than the contrast threshold.

[0034] Example: When there are inkjet-printed numbers on the bridge web, the edges of the inkjet-printed strokes form continuous and locally dense edge stripes in the edge map. At the same time, the two sides of the stroke edge correspond to dark ink and light concrete respectively, and the contrast between the two sides of the edge is significant. Although the edge of the stain can generate edge pixels, the edge density usually shows a sparse distribution or the contrast between the two sides of the edge is unstable. After screening by joint criteria, the set of candidate boundary segments covers the boundary area of ​​the inkjet-printed strokes.

[0035] S103: Connectivity aggregation and expansion generation of search range.

[0036] Step S2 requires performing connected component analysis within the search range to extract the character mask. If the search range is too large, it will introduce too many non-character connected regions; if the search range is too small, it will truncate the character stroke boundaries, resulting in an incomplete character mask. The candidate boundary segment set has already been limited to the vicinity of the character stroke boundaries. Further employing connected component aggregation and spatial expansion can stably form a search range that covers the complete character region.

[0037] Connectivity aggregation takes a set of candidate boundary segments as input and uses the eight-neighbor connectivity rule to merge spatially adjacent candidate boundary segment pixels into multiple connected components. For each connected component, a minimum bounding rectangle region is calculated, which is expressed in pixel coordinates and completely covers the corresponding connected component. Then, morphological dilation expansion is performed on the minimum bounding rectangle region, which expands the boundary outward with a preset pixel radius. When the expanded region intersects with the effective range of the original image, a boundary clipping method is used to ensure that the search range is always within the effective range of the original image. Finally, the union of all expanded rectangle regions is taken to obtain the search range, which is expressed in pixel coordinates and includes all candidate boundary segment pixels.

[0038] Step S1 takes the original image as input and outputs an edge map and a search range. The search range is obtained by connecting and expanding the set of candidate boundary segments in the edge map that meet the conditions of edge density and contrast on both sides of the edge. The search range serves as the spatial input boundary for step S2, so that the extraction of character mask and character skeleton focuses on the area adjacent to the strokes of inkjet or stamped characters.

[0039] The search range has been limited to the spatial location of the characters, but construction line edges and stain edges are still mixed in within the search range. If connected components are not filtered, the character mask will absorb non-character boundaries and cause morphological distortion. The intersection set of the character skeleton and the endpoint set will also be distorted, resulting in instability in the location of the character mask boundary intersection and the calculation of the character skeleton distance field.

[0040] S201: Generation of search range constraint edge map.

[0041] The connection component marking is performed only within the search range, which reduces the participation of edge pixels far from the character region in the aggregation, ensuring that the spatial boundary of the generated character mask is consistent with step S1.

[0042] Using the edge map and the search range as input, a judgment is performed on each pixel position. If the pixel position is within the search range, the edge map value is retained; if the pixel position is not within the search range, the value is set to zero, resulting in a search range constrained edge map. Both the edge map and the search range constrained edge map maintain binary set values, where zero represents a non-edge pixel and one represents an edge pixel. The search range constrained edge map serves as the only input edge object for connected component labeling.

[0043] S202: Connected component labeling and stroke connected component filtering.

[0044] In the edge map constrained by the search range, the strokes of inkjet or stamped characters are represented as groups of thin lines connected components. Pixels at the edge of construction lines usually form connected components with large spans, while pixels at the edge of stains usually form connected components with unstable thickness. Filtering connected components requires constraining both geometric span and thickness stability to output a set of connected stroke components.

[0045] Connected component marking is performed on the edge map constrained by the search range according to the eight-neighbor connectivity rule to form a set of connected components. The pixel area is defined as the number of pixels on the internal edge of the connected component and is limited to a positive integer. The width of the outer rectangle is defined as the number of pixels covered by the outer rectangle in the horizontal direction, the height of the outer rectangle is defined as the number of pixels covered by the outer rectangle in the vertical direction, and the aspect ratio is defined as the ratio of the number of pixels on the long side to the number of pixels on the short side of the outer rectangle and is limited to not less than one. The thickness estimate is obtained in two steps: First, morphological closing operation is performed on the connected component using the outer rectangle of the connected component as the clipping region, and hole filling is performed to obtain the stroke region. The stroke region values ​​are kept as a binary set. Second, distance transformation is performed on the stroke region to obtain the distance field, and the median value of the distance field is calculated on the skeleton pixels of the stroke region. Twice the median value is defined as the thickness estimate. The thickness estimate is in pixels and is positive. Connected component filtering uses a joint criterion, which includes that the pixel area is within a preset area range, the aspect ratio does not exceed the upper limit of the preset aspect ratio, and the thickness estimate is within a preset thickness range. The stroke connected component set is filtered out.

[0046] Example: When the inkjet-printed numbers on the bridge web are within the search range, the connected component markings obtain several stroke edge connected components. After the closing operation and hole filling, the stroke area is a continuous band. After the distance transformation, the thickness estimate stably falls into the preset thickness range. The edge connected components of the construction joint at the beam end are in a long straight through shape. The aspect ratio exceeds the upper limit of the preset aspect ratio and is excluded in the screening.

[0047] S203: Character mask generation.

[0048] The set of connected components of the strokes still belongs to the edge pixel form. Step S3 requires the character mask to cover the inside of the strokes to form the influence range of the characters. The boundary of the character mask needs to be used for the entry and exit point positioning of the candidate crack center line. The character mask needs to maintain binary consistency and avoid stroke breakage that leads to internal omissions.

[0049] Perform a union operation on the set of connected stroke components to form an edge set, and keep the values ​​of the edge set as binary sets. Perform a morphological closing operation on the edge set to connect the broken stroke boundaries, and then perform hole filling on the closing operation result to obtain a character mask. Keep the values ​​of the character mask as binary sets, with zero representing non-character areas and one representing character areas. The character mask serves as the spatial constraint input of step S3 and as the boundary object for locating the intersection points of the character mask boundaries.

[0050] S204: Extraction of the intersection set of character skeleton and endpoint set.

[0051] Step S3 requires a character skeleton to represent the direction of the stroke center and to be used for distance transformation to generate a distance field. The endpoint set and intersection set are used to characterize the topological structure of the character stroke and participate in traversal discrimination. The character skeleton needs a single pixel width to stably calculate the neighborhood count.

[0052] Iterative thinning of the character mask yields the character skeleton, with the character skeleton values ​​maintained as a binary set. For each skeleton pixel in the character skeleton, the number of skeleton pixels in its eight-neighborhood is counted to form a neighborhood count, with the neighborhood count value limited to the range of zero to eight. The endpoint set is defined as the set of skeleton pixel coordinates with a neighborhood count equal to one, and the intersection set is defined as the set of skeleton pixel coordinates with a neighborhood count not less than three. The character skeleton, endpoint set, and intersection set are output to step S3, where the character skeleton is used for distance transformation to generate a distance field, and the endpoint set and intersection set are used for auxiliary localization for structural relationship discrimination.

[0053] Step S2 takes the edge map and search range as input, first generates the search range constrained edge map and performs eight-neighbor connected component labeling, and obtains the stroke connected component set by jointly filtering based on pixel area, aspect ratio, and thickness estimate, then generates a character mask and thins it to obtain the character skeleton, and extracts the endpoint set and intersection set from the character skeleton. The character mask and character skeleton are used as the structural constraint objects in step S3 to directly participate in the determination of entry and exit points and the calculation of attached features.

[0054] The character mask and character skeleton have been formed, but the candidate set of crack center lines in the character area includes both crack crossing lines and stroke homologous lines. It is difficult to reliably distinguish them by simply relying on connectivity or local appearance similarity. Especially when the character strokes are strongly contrasted, the homologous lines will show a thin line shape similar to the crack. It is necessary to introduce evidence of the through-path in the character mask and evidence of the character skeleton attachment to complete the diversion determination.

[0055] S301: Crack candidate map and crack centerline candidate set acquisition.

[0056] The candidate set of crack centerlines needs to intersect with the character mask boundary to form in-point and out-point. The candidate set of crack centerlines needs to be output in the form of a set of pixel coordinates and be consistent with the coordinates of the original image.

[0057] The original image is input into the pre-trained crack segmentation network, which outputs a crack candidate map. The value of each pixel in the crack candidate map is limited to the range of zero to one. The crack candidate map is binarized to obtain a crack binary map, and the value of the crack binary map is limited to zero and one. The crack binary map is thinned to obtain a crack centerline map, and the value of the crack centerline map is limited to zero and one. The crack centerline map is decomposed into eight-neighbor connected component analysis to obtain a crack centerline candidate set. Each crack centerline candidate in the crack centerline candidate set is a set of pixel coordinates.

[0058] Example: The construction, training and optimization process of the pre-trained crack segmentation network is as follows: it is used to input the original image and output crack candidate images. The pixel values ​​of the crack candidate images fall within the range of zero to one and maintain the same coordinate system as the original image.

[0059] First, a training dataset was constructed by collecting original images of the bridge surface, covering typical working conditions such as dry surfaces, wet surfaces, oblique illumination highlights, shadow occlusion, inkjet or stamped characters, water seepage marks, and construction textures. Each original image was labeled with pixel-level crack annotations, with crack pixels labeled as positive and the remaining pixels as background. To alleviate the learning bias caused by the low proportion of crack pixels, the training samples were generated by block cropping and stratified sampling was performed. Stratified sampling included image blocks in the neighborhood of the crack centerline and image blocks without cracks but containing fine line interference. Image blocks with fine line interference preferentially came from reflective filament areas and character stroke edges, so that the network repeatedly encountered easily misdetected targets such as "background filaments, character strokes, and texture edges" during the training phase. At the same time, data augmentation was performed on the image blocks, including brightness and contrast perturbation, local highlight simulation, shadow occlusion simulation, slight blurring and compression artifact simulation, random rotation and scaling, and random cropping and flipping. The augmented annotation mask maintained the same geometric transformation as the image block.

[0060] Secondly, a crack segmentation network structure is constructed. The crack segmentation network adopts an encoder-decoder architecture. The encoder consists of multiple convolutional modules and outputs multi-scale features. The decoder restores the spatial resolution by upsampling step by step and performs jump-fusion with the same-scale features of the encoder. The output uses a single-channel convolutional layer to map to a single-channel probability map and connects to an activation function to form a crack candidate map. The encoder parameters are initialized with pre-trained weights from a general image dataset to obtain stable edge and texture representations. The decoder parameters are randomly initialized. The network input is a normalized image patch. The normalization method is the same as the brightness uniformity rule in step S1. The network output crack candidate map has the same size as the input image patch. Each pixel in the crack candidate map represents the crack confidence and is limited to the range of zero to one.

[0061] Then, training and optimization are performed. The training objective uses a combination of region consistency loss and hard sample suppression loss. Region consistency loss constrains the overlap between crack candidate images and crack annotations at the pixel level, while hard sample suppression loss increases the penalty intensity for interfering pixels in the background region. Together, they help the network form a clearer boundary between crack lines and background filaments. The training process uses mini-batch iterative updates, and the optimization algorithm uses gradient descent with momentum or adaptive moment estimation. The learning rate uses piecewise decay or cosine annealing strategies. During training, a validation set is set up, and the segmentation index is calculated on the validation set at fixed intervals. The optimal validation set index is selected. The network parameters are used as the pre-trained crack segmentation network. To further improve the robustness to oblique illumination highlights on wet surfaces, an online hard example mining strategy is added during the training phase. After each training cycle, the online hard example mining strategy counts the false detection regions in the validation set and feeds the image blocks corresponding to the false detection regions back into the training sampling pool of the next cycle, so that the network can continuously learn the difference that "background filaments and cracks look similar but have different spatial morphology and context". After training, the network parameters are frozen and the inference model is exported. In step S3, the inference model receives the original image and outputs crack candidate images, which are used for subsequent crack binarization, thinning, and crack centerline candidate set extraction.

[0062] S302: In-point and out-point determination and pairing rules.

[0063] The search for through-paths inside a character mask requires in-point and out-point as endpoints. The in-point and out-point are determined by the intersection of the candidate crack centerline and the character mask boundary. The number of intersections may exceed two and a deterministic pairing rule is required to avoid result drift.

[0064] The character mask generates a character mask boundary, which is defined as the character mask minus the character mask erosion result while maintaining a binary value. Each crack centerline candidate is intersected with the character mask boundary using pixel coordinates to obtain a set of intersection points. When the number of pixels in the intersection point set is not less than two, the crack centerline candidate first determines its starting endpoint, defined as the first endpoint obtained by sorting the crack centerline candidate endpoints in the set according to row coordinate priority and then column coordinate priority. The crack centerline candidate accumulates pixel by pixel along the eight-neighborhood link from the starting endpoint to form an arc length order. The in-point is defined as the intersection point with the smallest arc length order value in the intersection point set, and the out-point is defined as the intersection point with the largest arc length order value in the intersection point set. When the number of pixels in the intersection point set is less than two, the crack centerline candidate directly enters the same-source candidate set for output.

[0065] Example: When a through crack appears in the inkjet digit area, the candidate crack center line passes through the character mask boundary to form two intersection points. The entry point is located on one side of the character mask boundary, and the exit point is located on the other side of the character mask boundary. When the inkjet stroke edges form homogeneous line segments, the set of intersection points is often concentrated near the character mask boundary, and the intersection points at both ends of the arc length sequence fall at both ends of the same stroke bypass path.

[0066] S303: Construction of linear response and cost maps.

[0067] The character mask contains both ink strokes and concrete background. Crossing cracks, it appears as continuous thin dark lines within the character mask. The linear response needs to emphasize the thin dark lines in multiple directions and suppress large uniform areas. The cost map needs to map the thin dark lines to low cost to support minimum cost path search.

[0068] The character mask defines the region by cropping the original image to obtain the mask image, which retains only the pixel brightness within the character mask. A preset direction set is used to cover multiple linear directions. Preset linear structuring elements generate morphological closing operation structuring elements in each direction. The morphological closing operation is performed on the mask image to obtain the closing operation map. The closing operation map and the mask image are then compared to obtain the directional response map. The multi-directional linear response map is defined as the pixel-wise maximum value of all directional response maps. Linear response normalization uses a linear mapping between the minimum and maximum responses within the character mask and limits the normalization value to the range of zero to one. When the maximum response equals the minimum response, the normalization result is set to a fixed constant to eliminate the risk of division by zero and maintain reproducibility. The cost map is defined as the complementary quantity of the normalized linear response and limits its value to the range of zero to one. The cost map only participates in path search within the character mask.

[0069] S304: Calculation of minimum cost path, average cost of penetration, and average distance of attachment.

[0070] The in-point and out-point have been determined, the cost map has been established, the minimum cost path is used to express the most likely fine dark line through-path within the character mask, the through-path average cost is used to quantify the average cost of the through-path and keep it dimensionless, and the attachment average distance is used to quantify the proximity of the through-path to the character skeleton and keep it in pixel units.

[0071] An eight-neighborhood pixel grid is established within the character mask. The pixel node cost is given by the pixel value in the cost map. The cumulative cost of the path from the in point to the out point is defined as the sum of the pixel node costs on the path. The Dijkstra algorithm is used to search for the minimum cost path with the minimum cumulative cost within the character mask. The average cost of the path is defined as the cumulative cost of the minimum cost path divided by the number of pixels in the minimum cost path. The average cost of the path is limited to the range of zero to one and remains dimensionless. The character skeleton is subjected to a distance transformation to generate a distance field. The distance field is defined as the shortest Euclidean distance from each pixel to the pixel set of the character skeleton. The distance field is in pixels and its value is a non-negative real number. The attachment average distance is calculated by reading the distance field along the minimum cost path to form a distance sequence. The distance sequence is arranged in non-descending order and then truncated and averaged. The truncation rule is defined as removing elements with the same preset ratio at both ends of the sequence and then taking the arithmetic mean of the remaining elements. When the number of pixels in the path is insufficient to complete the truncation, the median value of the distance sequence is used as the attachment average distance.

[0072] Example: When there is a crack in the inkjet character area, the minimum cost path runs through the character mask along the dark line of the crack. The distance sequence exists simultaneously in the segments near and far from the character skeleton, and the average distance of the main body is retained horizontally at the end. When the inkjet strokes are of the same origin, the minimum cost path is close to the direction of the stroke center, and the main body of the distance sequence is concentrated in a smaller pixel distance range.

[0073] S305: Generation of crossing coefficients and splitting of crossing candidate set and homologous candidate set.

[0074] The average cost of penetration describes the strength of the cost of the penetration path within the character mask, the average attachment distance describes the proximity of the penetration path to the character skeleton, and the crossing coefficient needs to map the two types of evidence to a unified scale and output a clear diversion result for step S4 to perform pixel-level completion and removal.

[0075] For each crack centerline candidate that satisfies the condition of having at least two intersection point pixels, an input pair is constructed. The input pair consists of the average cost of penetration and the average distance of attachment, and the order is kept fixed. The trained classification model receives the input pair and outputs the crossing coefficient, which is limited to the range of zero to one. The crossing coefficient judgment threshold is also limited to the range of zero to one. Crack centerline candidates with crossing coefficients not less than the judgment threshold are added to the crossing candidate set, crack centerline candidates with crossing coefficients less than the judgment threshold are added to the same source candidate set, and crack centerline candidates with intersection point pixels less than two are added to the same source candidate set.

[0076] In one embodiment, the pre-trained classification model employs a multilayer perceptron structure. The input to the classification model is the feature vector calculated in step S3. The feature vector is composed of the penetration average cost and the attachment average distance in a fixed order. The penetration average cost is limited to the range of zero to one and is dimensionless, while the attachment average distance is in pixels and is non-negative. The training samples are generated from bridge surface images with ground truth crack annotations. The training images first execute steps S1 to S3 according to the same process as the inference stage to obtain the penetration average cost and attachment average distance corresponding to each crack centerline candidate. Then, based on the ground truth crack... The connectivity between the sample and the character mask is used for sample labeling. Samples where the truth crack forms an in-point and out-point at the character mask boundary and maintains the same connectivity component as the truth crack inside the character mask are labeled as "crossing". Samples that fall inside the character mask, extend along the character stroke shape, and do not have a connectivity relationship with the truth crack are labeled as "homogeneous". The model structure is set as follows: the input layer contains two input nodes, the hidden layer consists of two fully connected layers using a linear rectified activation function (16 neurons in the first hidden layer, 8 neurons in the second hidden layer), and the output layer has one neuron using a logical activation function. The logic function outputs the crossing coefficient, which is limited to the range of zero to one. To eliminate dimensional differences, the input features are standardized before training. The crossing average cost remains unchanged, and the attachment average distance is first logarithmically compressed and then linearly mapped to zero. The upper and lower bounds of the linear mapping are determined by the minimum and maximum values ​​of the attachment average distance in the training set and remain unchanged during the deployment phase. The training objective uses binary classification cross-entropy loss, and sample imbalance is controlled by stratified sampling. Stratified sampling ensures that each mini-batch contains both crossing samples and homologous samples. The training optimization uses an adaptive moment estimation algorithm, the learning rate uses a cosine annealing strategy, and the parameter update uses a weight decay regularization term combined with an early stopping mechanism. The early stopping criterion is determined by the stability of the classification index on the validation set. When the validation set index no longer improves within a certain number of consecutive rounds, training stops and the model parameters with the optimal validation set index are rolled back as the training completion parameters. The crossing coefficient judgment threshold is determined and fixed in the training phase by the minimum splitting error criterion on the validation set. It is used in the inference phase to map the crossing coefficient to the crossing candidate set and the homologous candidate set, so that the classification output can directly enter step S4 to perform completion and elimination.

[0077] Step S3 takes the original image, character mask, and character skeleton as input, obtains a candidate set of crack centerlines through the crack candidate map, determines the entry and exit points of the crack centerline candidates that intersect with the character mask, constructs a linear response map within the character mask and normalizes it to generate a cost map, searches for the minimum cost path to calculate the average cost of penetration, and calculates the average distance of attachment from the distance field of the character skeleton. The average cost of penetration and the average distance of attachment are input into the classification model to output the crossing coefficient, thereby splitting the crack centerline candidate set into a crossing candidate set and a homologous candidate set and providing them to step S4 for completion and elimination.

[0078] The candidate set for crossing may have broken or missing segments within the character mask area. The candidate set of the same origin and the candidate set for crossing may have pixel overlap within the character area. Directly outputting the candidate set for crossing will result in discontinuous crack results. Directly removing the candidate set of the same origin may miss the real pixels of the crack crossing in the character area. It is necessary to generate a background image for removing characters and a residual line image within the character repair area. The residual line image is used to provide pixel-level completion basis and limit the scope of removal.

[0079] S401: Character repair area generation is consistent with the input object.

[0080] The character mask covers the area inside the stroke. Near the boundary of the character mask, there is a blending zone between the stroke edge and the background texture. The range of the background image to be generated needs to cover the blending zone to eliminate stroke afterimages, while avoiding over-expansion that introduces textures far from the character area.

[0081] The character restoration region is obtained by morphological dilation of the character mask. The morphological dilation adopts a fixed pixel radius neighborhood rule. When there is a pixel with a value of 1 in the character mask in the neighborhood, the character restoration region has a value of 1 at the pixel position. Otherwise, it has a value of zero. The value range of the character restoration region is limited to zero or 1. The character restoration region is cropped at the boundary with the effective range of the original image to keep it within the effective range. It crosses the candidate set and the same source candidate set to maintain the pixel coordinate set expression and keep it consistent with the coordinates of the original image.

[0082] S402: Generate background image without text.

[0083] If there are inkjet or stamped stroke textures within the character restoration area, the background image for removing the characters needs to replace the stroke texture within the character restoration area with a concrete texture consistent with the area outside the character restoration area. Pixel replacement needs to maintain the original image brightness scale and avoid smoothing out the cracks and fine dark lines.

[0084] The background image with characters removed directly copies the pixel values ​​of the original image outside the character restoration area. The background image with characters removed within the character restoration area is restored using a sample block matching-based method. The restoration methods are executed in the following order: The first step is to determine the target boundary set, which consists of the boundary pixels between the character restoration area and the non-character restoration area; The second step is to establish a fixed-size repair block for each target pixel in the target boundary set. Pixels within the repair block that fall in the non-character repair area are defined as known pixels, and pixels within the repair block that fall in the character repair area are defined as pixels to be repaired. The third step is to search for candidate source blocks within the non-character repair area. Candidate source blocks must fall entirely within the non-character repair area. The fourth step is to calculate the absolute value of the brightness difference of the original image pixel by pixel at the known pixel positions of the repair block and take the average. The candidate source block with the smallest average value is determined as the optimal source block. The fifth step is to copy the corresponding pixels in the optimal source block to the positions of the pixels to be repaired in the repair block in a consistent pixel offset manner. Step 6: Update the pixels that have been filled in the character repair area and recalculate the target boundary set. Repeat the above steps until the pixels to be repaired in the character repair area are cleared. The pixel value range of the background image is consistent with that of the original image and is limited to the range of zero to one.

[0085] Example: The digital area of ​​the bridge web is photographed on site. The character repair area covers the digital strokes and the surrounding mixed band. The target boundary set forms a closed band along the outer contour of the number. The optimal source block is selected from the concrete texture area outside the number. After copying, the continuous concrete texture appears inside the character repair area and the stroke shape no longer appears.

[0086] S403 residual fine line plot generation.

[0087] The differences between the background image after character removal and the original image within the character restoration area mainly come from stroke texture and crack fine dark lines. The residual fine line map needs to suppress low-frequency texture differences and highlight fine line structure differences. The residual fine line map needs to output a binary fine line representation with a single pixel width for connectivity completion.

[0088] The residual amplitude map is calculated only within the character restoration area, and is zero outside the character restoration area. Within the character restoration area, the residual amplitude map calculates the absolute value of the brightness difference between the original image and the de-characterized background image based on pixel position. The residual normalized map is linearly mapped to the range of zero to one using minimum and maximum values ​​within the character restoration area. When the maximum value equals the minimum value, the residual normalized map is zero within the character restoration area. The residual linear response map is obtained by performing a multi-directional linear top-hat transform on the residual normalized map. The multi-directional linear top-hat transform constructs a linear structuring element for each preset direction and performs a closing operation, then subtracts it from the residual normalized map. The residual linear response map takes the pixel-wise maximum value of the response in all directions and limits it to the range of zero to one. The residual binary map is generated by using a quantile determination rule from the residual linear response map. The quantile determination rule selects the corresponding value of a preset quantile as a threshold from the set of residual linear response values ​​within the character restoration area. The residual thin line map is obtained by performing thinning on the residual binary map. The value range of the residual thin line map is limited to zero or one.

[0089] S404: Complete the candidate set for crossing and remove candidates from the same source set.

[0090] When there are missing segments in the candidate set within the character restoration area, the thin line components connected to the candidate set in the residual thin line diagram can provide a basis for filling in the missing segment pixels. The stroke lines corresponding to the same candidate set need to be excluded from the output results. The same source elimination boundary needs to be limited to the character restoration area to avoid affecting the candidate pixels outside the character restoration area.

[0091] The candidate pixel image for crossing is transformed into a binary pixel representation from the candidate set for crossing, and the candidate pixel image for the same source is transformed into a binary pixel representation from the candidate set for the same source. The value range of the binary pixels is limited to zero or one. The connected seed set is defined as the intersection of the candidate pixel image for crossing and the boundary of the character restoration region. The boundary of the character restoration region is obtained by the difference between the character restoration region and the erosion result of the character restoration region and maintains the binary representation. The complete set for crossing is defined as the set of all thin line pixels in the residual thin line image that are connected to the eight neighbors of the connected seed set. The same source elimination region is defined as the region obtained by performing morphological dilation on the same source candidate pixel image within the character restoration region. The same source elimination region takes zero outside the character restoration region. The crack result pixel image is obtained by taking the union of the candidate pixel image for crossing and the complete set for crossing and then excluding the same source elimination region. The value range of the crack result pixel image is limited to zero or one and maintains the same coordinates as the original image.

[0092] Example: When a real crack appears in the inkjet character area, two connected seeds are formed at the boundary of the character repair area by traversing the candidate pixel image. The thin line component that runs through the character repair area in the residual thin line image is connected to the connected seeds. The missing segment inside the character repair area is filled along the thin line component by traversing the completion set. The stroke lines corresponding to the same source candidate pixel image are excluded in the same source elimination area.

[0093] Step S4 takes the original image, character mask, crossing candidate set, and homologous candidate set as input. The character mask is morphologically dilated to obtain the character restoration region. Within the character restoration region, a background image is generated by sample block matching and forms a residual thin line image with the original image. The intersection of the crossing candidate set and the boundary of the character restoration region forms a connected seed set to extract the crossing completion set from the residual thin line image. The homologous candidate set forms a homologous removal region within the character restoration region and is excluded from the crack result pixel image. Finally, a continuous crack result pixel image that suppresses the interference of homologous stroke lines is output.

[0094] Specifically, the above are merely preferred embodiments of this application and are not intended to limit this application.

[0095] The preset parameters, such as the density threshold, contrast threshold, and crossing coefficient determination threshold, can be pre-calibrated through offline simulation testing or set to fixed values ​​according to on-site operating procedures.

[0096] In the description of this specification, the references to terms such as "embodiment," "example," and "specific example" indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0097] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to any specific implementation. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention. The invention is limited only by the claims and their full scope and equivalents.

Claims

1. A bridge crack detection method based on image recognition, characterized in that, Including the following steps: S1: Acquire the original image and obtain the edge map. Calculate the edge density and contrast on both sides of the edge map to filter the candidate boundary segment set. Generate the search range based on the connectivity aggregation and region expansion of the candidate boundary segment set. S2: Within the search range, perform connected component labeling on the edge map and obtain the stroke connected component set by jointly filtering based on pixel area, aspect ratio and thickness estimate. Use this to generate a character mask and thin it to obtain the character skeleton and the intersection set of the endpoint set. S3: The intersection of the character mask boundary determines the entry and exit points. A cost map is constructed within the character mask, and the minimum cost path is searched to obtain the average cost of penetration and the average distance of attachment. The average cost of penetration and the average distance of attachment are input into the classification model to output the crossing coefficient and generate the crossing candidate set and the homologous candidate set accordingly. S4: The character mask derives the character repair region and generates a character removal background image and residual thin line image within the character repair region. The intersection of the residual thin line image and the boundary of the crossing candidate set forms a connected seed set and completes the missing segments of the crossing candidate set. The homologous candidate set forms a homologous removal region within the character repair region and outputs the crack result pixel image.

2. The bridge crack detection method based on image recognition according to claim 1, characterized in that, Step S1 includes: Edge detection is performed on the original image to obtain an edge map. The pixel values ​​of the edge map are binary sets. The edge density is statistically analyzed in a fixed neighborhood based on the edge map and limited to a normalized intensity range. The contrast on both sides of the edge is calculated based on the sampling bands on both sides of the edge normal in the original image and limited to a normalized intensity range. A set of candidate boundary segments is generated according to the joint criterion of edge density and contrast on both sides of the edge.

3. The bridge crack detection method based on image recognition according to claim 2, characterized in that, Step S1 also includes: Eight-neighbor connectivity aggregation is performed on the candidate boundary fragment set to obtain connected components. For each connected component, a minimum bounding rectangle region is generated and the region is expanded. The expanded region is cropped to keep it within the effective range of the original image. The union of all expanded regions is taken to obtain the search range. The search range includes the candidate boundary fragment set and is used as the spatial input boundary for character mask extraction.

4. The bridge crack detection method based on image recognition according to claim 3, characterized in that, Step S2 includes: The edge map is constrained by applying value constraints to the edge map based on the search range. The eight-neighbor connected components are marked on the edge map. The stroke connected component set is obtained by filtering according to the joint criteria of pixel area, aspect ratio, and thickness estimate.

5. The bridge crack detection method based on image recognition according to claim 4, characterized in that, Step S2 also includes: The set of connected stroke components is joined to obtain the edge set. The edge set is closed and filled with holes to generate a character mask. The character mask is thinned to obtain the character skeleton. The character skeleton is used to extract the endpoint set and intersection set by counting eight neighbors.

6. The bridge crack detection method based on image recognition according to claim 5, characterized in that, Step S3 includes: Crack segmentation is performed on the original image to obtain a crack candidate map. The crack candidate map is used to generate a crack binary map using the quantile determination rule. The crack binary map is thinned to obtain a crack centerline map. The crack centerline map is decomposed into eight-neighbor connected components to obtain a crack centerline candidate set.

7. The bridge crack detection method based on image recognition according to claim 6, characterized in that, Step S3 also includes: The character mask generates the character mask boundary. The intersection of the crack centerline candidate and the character mask boundary is used to obtain the intersection point set. When the number of pixels in the intersection point set is not less than two, the arc length order is established and the in-point and out-point are determined. When the number of pixels in the intersection point set is less than two, the crack centerline candidate is added to the same source candidate set.

8. The bridge crack detection method based on image recognition according to claim 7, characterized in that, Step S3 also includes: A multi-directional linear top-hat transformation is performed within the character mask to obtain a linear response map, which is then normalized to generate a cost map. The minimum cost path is searched on the cost map for the in-point and out-point, and the average cost of penetration and the average distance of attachment are calculated. The average cost of penetration and the average distance of attachment are input into the classification model to obtain the crossing coefficient and to divide the crossing candidate set and the homologous candidate set.

9. The bridge crack detection method based on image recognition according to claim 8, characterized in that, Step S4 includes: The character mask is morphologically dilated to generate the character restoration region. The character-removed background image copies the pixel values ​​of the original image outside the character restoration region. The character-removed background image is then restored within the character restoration region using sample block matching and the optimal source block pixels are copied in a consistent pixel offset manner.

10. The bridge crack detection method based on image recognition according to claim 9, characterized in that, Step S4 also includes: The original image and the de-character background image generate residual thin line maps within the character restoration area. The intersection of the candidate set and the boundary of the character restoration area forms a connected seed set. The pixels in the residual thin line map that are connected to the eight neighbors of the connected seed set constitute the crossing completion set. After the homologous candidate set forms a homologous removal area within the character restoration area, the crack result pixel map is output.