Tunnel image crack semi-automatic marking method and system based on shortest path search

By employing shortest path search and crack width optimization methods, the problems of low efficiency and insufficient accuracy in intelligent annotation of tunnel lining cracks were solved, achieving efficient and accurate annotation of fine cracks and improving annotation accuracy and model training accuracy.

CN121725477APending Publication Date: 2026-03-24SHANDONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-16
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Existing intelligent annotation technology for tunnel lining cracks suffers from low annotation efficiency and poor consistency in annotation of small cracks, which affects the accuracy of model training. In particular, the robustness and accuracy of the algorithm are insufficient in the case of micro-cracks and areas with multiple defects in extremely complex backgrounds.

Method used

We employ a shortest path search-based approach, calculating the initial annotation path using a minimum path search algorithm and incorporating crack width information for optimization. This ultimately enables interactive image annotation, establishes image crack region width constraint criteria, and develops a lightweight deployment tool.

Benefits of technology

It significantly improves annotation accuracy and efficiency, achieving efficient and accurate annotation of fine cracks, reducing manual workload and annotation errors, and improving the accuracy of model training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121725477A_ABST
    Figure CN121725477A_ABST
Patent Text Reader

Abstract

The invention discloses a tunnel image crack semi-automatic labeling method and system based on shortest path search, and relates to the technical field of image labeling. The method comprises the following steps: acquiring a tunnel crack image sample, calculating an initial optimal path with an initial label in the tunnel crack image sample by using a minimum path search method, modeling the tunnel crack image sample into a graph structure, defining a corresponding cost function according to the graph structure, and calculating the initial optimal path with the initial label in the tunnel crack image sample. Searching a path with the minimum cost between an appointed starting point and an appointed ending point; introducing crack width information, and further optimizing the fine cracks in the initial optimal path to obtain a final optimal path; and performing interactive image annotation according to the final optimal path. According to the method, efficient and accurate marking of the fine crack is realized, so that the core problem that high-quality marking data is difficult to obtain is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image annotation, in particular to a tunnel image crack semi-automatic annotation method and system based on shortest path search. BACKGROUND

[0002] The statements in this section merely provide background information related to the present application and do not necessarily constitute prior art.

[0003] In the field of tunnel lining crack research, intelligent annotation technology is one of the key research directions at present, and plays an important role in promoting the development of tunnel lining crack detection and related research. Intelligent annotation uses advanced algorithms to automatically label the information of tunnel lining apparent defects, replacing the traditional manual annotation method, improving the annotation efficiency and accuracy, and providing a reliable data basis for crack analysis, evaluation and tunnel maintenance decision.

[0004] In the research of crack annotation technology, the traditional tunnel data annotation method mainly relies on manual work, which not only consumes time and effort, but also the annotation results are easily affected by subjective factors of personnel. The annotators may have different annotation results for the same crack image due to experience, knowledge level and personal judgment; when facing small, complex or weak edge targets, the crack recognition reliability is difficult to guarantee. In recent years, the application of deep learning, low supervision learning, secondary development and multi-sensor cooperation technology has effectively solved the problems of low efficiency and strong subjectivity of traditional manual annotation, providing a key means for the automation and precision of tunnel defect detection, and the related research has made significant progress in algorithm innovation, system development and engineering verification.

[0005] The current intelligent annotation technology of tunnel lining crack has shifted from traditional manual annotation to intelligent and automatic annotation, and has made remarkable achievements in algorithm, system and engineering application. However, it still faces the following technical bottlenecks: in intelligent annotation, the existing annotation mainly relies on manual completion, the annotation efficiency is low, and the consistency of small crack annotation is poor, which greatly affects the model training accuracy and limits the performance of its recognition ability. The algorithm robustness and accuracy of small cracks and multi-disease intersection areas in extreme complex background need to be improved. SUMMARY

[0006] In view of the deficiencies of the prior art, the present application aims to provide a tunnel image crack semi-automatic annotation method and system based on shortest path search, which realizes efficient and accurate annotation of small cracks to solve the core problem of difficult acquisition of high-quality annotation data.

[0007] In order to achieve the above-mentioned purpose, the present application is realized by the following technical scheme: The first aspect of the present application provides a tunnel image crack semi-automatic annotation method based on shortest path search, comprising the following steps: Obtain tunnel crack image samples, and use the minimum path search method to calculate the initial optimal path with initial labels in the tunnel crack image samples. The tunnel crack image samples are modeled as a graph structure, and the corresponding cost function is defined according to the graph structure to search for the path with the minimum cost between the specified start point and end point. By incorporating crack width information, the fine cracks in the initial optimal path are further optimized to obtain the final optimal path; Interactive image annotation is performed based on the final optimal path.

[0008] A second aspect of the present invention provides a semi-automatic tunnel image crack annotation system based on shortest path search, comprising: The path calculation module is configured to acquire tunnel crack image samples and use the minimum path search method to calculate the initial optimal path with initial labels in the tunnel crack image samples. The tunnel crack image samples are modeled as a graph structure, and a corresponding cost function is defined according to the graph structure to search for the path with the minimum cost between the specified start point and end point. The path optimization module is configured to incorporate crack width information to further optimize the fine cracks in the initial optimal path, thereby obtaining the final optimal path. The crack annotation module is configured to perform interactive image annotation based on the final optimal path.

[0009] A third aspect of the present invention provides a computer-readable storage medium storing a computer program adapted to be loaded by a processor and to execute steps in the semi-automatic annotation method for tunnel image cracks based on shortest path search as described in the first aspect of the present invention.

[0010] A fourth aspect of the present invention provides a computer device comprising: A processor, adapted to execute computer programs; A computer-readable storage medium storing a computer program, which, when executed by the processor, implements the semi-automatic tunnel image crack annotation method based on shortest path search as described in the first aspect of the present invention.

[0011] A fifth aspect of the present invention provides a computer program product or computer program comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of the semi-automatic tunnel image crack annotation method based on shortest path search as described in the first aspect of the present invention.

[0012] The above one or more technical solutions have the following beneficial effects: This invention discloses a semi-automatic method and system for annotating cracks in tunnel images based on shortest path search. Addressing the issue of high-quality training data requirements for deep learning methods, this method uses shortest path search for crack annotation in tunnel images, constructs a constraint criterion for the width of the crack region, and establishes a lightweight deployment tool for crack annotation. The annotation time is significantly reduced compared to traditional methods, resulting in a substantial improvement in annotation accuracy and efficiency. It achieves lightweight deployment of crack annotation tools and efficient and accurate annotation of fine cracks, thus solving the core problem of the difficulty in obtaining high-quality annotation data.

[0013] In the semi-automatic annotation process of this invention, the user can determine the starting point of the crack by clicking with the mouse. When the mouse moves close to the crack area, the "crack snapping" function is automatically triggered in real time, displaying a path that matches the crack direction. After the operator clicks to determine the crack endpoint, the crack path can be initially locked. Subsequently, the crack width is accurately calculated through an optimized algorithm, and the annotation results are superimposed on the original image. Ultimately, the operator can complete the accurate annotation of fine cracks with only simple operations, significantly reducing manual workload and annotation errors.

[0014] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of this application 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 only some embodiments of this application. 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 the semi-automatic tunnel image crack annotation method based on shortest path search in Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of the semi-automatic annotation process of tunnel image cracks based on shortest path search in Embodiment 1 of the present invention; Figure 3 This is a schematic diagram of the DexiNed edge detection algorithm in Embodiment 1 of the present invention; Figure 4 This is a schematic diagram of linearized crack annotation in Embodiment 1 of the present invention. Figure 5 This is a schematic diagram of dynamic programming optimization in Embodiment 1 of the present invention. Figure 6 This is a schematic diagram of crack annotation optimization in Embodiment 1 of the present invention. Detailed Implementation

[0017] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0018] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof. The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0019] Example 1: Embodiment 1 of this invention provides a semi-automatic annotation method for tunnel image cracks based on shortest path search. It proposes an annotation algorithm based on shortest path search, effectively addressing the need for accurate annotation in complex scenarios such as blurred edges and noise interference. By integrating crack width calculation methods and width constraint criteria, the algorithm performance is further optimized, ultimately constructing an intelligent annotation method capable of efficiently handling minute cracks.

[0020] like Figure 1 As shown, the specific steps include: Step 1: Obtain tunnel crack image samples and use the minimum path search method to calculate the initial optimal path with initial annotations in the tunnel crack image samples.

[0021] In one specific implementation, the core key to achieving pixel-level accurate annotation in the crack intelligent annotation method lies in precisely matching the crack morphology, that is, finding an optimal path between a specified crack start and end point that perfectly matches the actual crack shape. This task essentially boils down to searching for the optimal path and accurately determining the crack width. To this end, this embodiment designs an interactive annotation tool based on the intelligent scissors algorithm and shortest path search to obtain the shortest annotation path. This method transforms the crack annotation problem into a shortest path search problem on an image graph, and designs a suitable cost function to guide the path to fit the actual edge, such as... Figure 2 As shown.

[0022] Step 1.1: Model the tunnel crack image samples as a graph structure.

[0023] In this implementation diagram structure, each pixel of the image is used as a vertex, and adjacent pixels are connected by edges.

[0024] Step 1.2: Define the corresponding cost function based on the graph structure.

[0025] Specifically, the cost function in this embodiment aims to find a path P from the starting point s to any pixel r in the image pixel grid, minimizing the path cost g(P). Each pixel in the graph structure can be considered a node. The path cost is the sum of the mean local cost of all edges in the path and a linear penalty term for the path length. The linear penalty term for path length controls the trade-off between path length and edge strength. Directly using the sum of local costs would lead to the shortest path "taking a shortcut," choosing a shorter spatial path in the background region at bends, thus cutting off the crack. Therefore, a linear penalty term must be added to control the tortuosity of the crack. For the current pixel q and its neighboring pixels r, the local cost function is defined as l(q,r). For path P, the node sequence from s to r is s=p1→p2→…→pn=r, containing n nodes and n-1 edges. The total cost function is defined as follows: (1).

[0026] Where n is the number of path nodes and j is the path node index; Let be the penalty coefficient, when Approaching 0 may result in infinitely long paths; when As the number of integers approaches infinity, this algorithm is equivalent to the breadth-first search algorithm. Based on experience... The default value is 0.2. If the actual operation path is too convoluted, the α value needs to be increased; if the path ignores weak edges, the α value needs to be decreased. value.

[0027] To calculate the local cost function, edge detection is first performed on the image to generate an edge intensity map, where the edge intensity of each pixel r is defined as E(r). To guide the shortest path algorithm to prioritize traversing regions with high edge intensity in the image, a lower cost value needs to be assigned to strong edge regions through a cost function design, thereby establishing a negative correlation between edge intensity and path cost. The defined local cost function is as follows: (2).

[0028] in, As a local cost function, the edge strength E(r) is pre-normalized to the range [0,1].

[0029] The edge intensity E(r) in formula (2) can be calculated using any edge detection operator. In this embodiment, two different types of edge detection operators were tested: one is the classic Sobel operator, i.e., the Canny edge response; the other is the deep learning-based edge detection method, the DexiNed edge detection network. Since E(r) needs to be a continuous edge response function, there is no need to use the nonmaximum suppression and binarization techniques in Canny edge detection to obtain the binary mask of the edge.

[0030] The core objective of DexiNed is to generate fine-grained edge maps that closely resemble human visual perception. It combines the multi-scale feature fusion advantages of the Holistically-Nested Edge Detection (HED) network with the efficient depthwise separable convolutions of the Xception network. As an end-to-end general-purpose model, it can adapt to various edge detection tasks without pre-training or fine-tuning. Its specific structure is as follows: Figure 3 As shown, DexiNed mainly consists of two parts: Dexi (Dense Extreme Inception Network) and UB (Upsampling Block). Dexi is the encoder structure, containing six main blocks (Block 1 to Block 6). It borrows the deep feature extraction approach from Xception but uses standard convolutions to efficiently capture edge features, while introducing main connections and edge connections. Each main block consists of multiple sub-blocks, typically containing two 3×3 convolutional layers followed by batch normalization and ReLU activation. Downsampling between blocks is achieved through 3×3 max pooling with a stride of 2. UB is the key component, responsible for upsampling the multi-scale feature maps extracted by Dexi to the input image resolution and generating intermediate edge maps to preserve subtle edge structures. Furthermore, DexiNed employs a deep supervision strategy, calculating a weighted cross-entropy loss on the intermediate edge maps output by each UB, balancing the weights of edge and non-edge pixels to optimize network parameters.

[0031] Step 1.3: Search for the path with the minimum cost between the specified start and end points to obtain the optimal annotation path that accurately fits the crack edge.

[0032] Specifically, for each pixel (x, y) in the image, it is treated as a vertex of the graph. Then, edges are added to each vertex and its surrounding 8 pixels. Since the cost function is not symmetric, these edges are all directed. When a point s is clicked on the image as the starting point, also called the source point or seed point, Dijkstra's algorithm is used to calculate the shortest path from the starting point s to other pixels in the image.

[0033] The real-time connection 2D dynamic programming graph search algorithm is used to find the shortest path in real time on an image pixel grid. Its core idea is to use a user-selected starting point as the source point, and then dynamically expand the tree to find the pixels with the minimum path cost, recording the optimal predecessor node for each pixel, thus constructing a shortest path tree from the source point to any target pixel. When the user moves the mouse, the optimal path can be traced back in real time, allowing for interactive display of crack direction.

[0034] The real-time connection 2D dynamic programming graph search algorithm mainly consists of a forward cost propagation stage and a real-time path backtracking stage. The forward cost propagation stage pre-computes the forward portion of the dynamic programming, searching for neighborhood pixels that minimize the total cost function. The real-time path backtracking stage backtracks in real time based on the location, displaying the optimal path from the source point to the current location.

[0035] The specific steps in the first stage are as follows: First, a zero-cost list of pixel activities is initialized. When the user selects a starting pixel in the image, the algorithm first adds that starting pixel to an activity list and sets its initial cost to 0.

[0036] Subsequently, the minimum cost pixel is removed from the pixel activity list and marked as expanded.

[0037] Next, the total cost of neighboring pixels is calculated, and neighboring pixels with costs exceeding a preset threshold are removed from the list. For each processed pixel, the algorithm checks its unprocessed neighboring pixels and calculates the cumulative path cost from the current pixel to these neighboring pixels. If a neighboring pixel obtains a lower cost from this path, its total cost is updated, and the pixel is added to the active list, while its best predecessor node is recorded.

[0038] In the second stage of actual operation, when the user moves the mouse to the target point, based on the calculated optimal path information, the system traces back from the target point to the source point along the predecessor pointer, and obtains the corresponding pixel sequence.

[0039] At this point, the paths of fine cracks in an image can be labeled using a simple operation. However, the paths obtained through the shortest path search algorithm do not include crack width information. Therefore, the next step is to calculate the crack width based on the optimal path, i.e., to optimize the automatic labeling of fine cracks.

[0040] Step 2: Introduce crack width information to further optimize the fine cracks in the initial optimal path to obtain the final optimal path.

[0041] This embodiment, based on the shortest path search method to obtain the optimal path between two points of a specified crack, introduces crack width information to achieve refined annotation of the crack region. After obtaining the optimal path between two points, multiple continuous curves can be generated by combining multiple sets of source points, thus forming a binarized initial annotation map. The specific steps for accurately estimating the crack width are as follows: Step 2.1: Linearize the labeled path.

[0042] Specifically, the branched and network cracks in the initial annotation of the annotation path are decomposed into a series of linear crack blocks.

[0043] Step 2.1.1: Obtain the curve region representation of the annotation path of the input initial annotation.

[0044] More specifically, given the initial annotation results, the centerline of the crack region is first extracted using existing algorithms, and then the connected contours are extracted from the skeleton.

[0045] In this embodiment, the center line of the crack center region is extracted using the Zhang-Suen skeletonization algorithm, and the connected contour is extracted from the skeleton using the Suzuki boundary tracing method. Other existing algorithms can also be used. Since the Zhang-Suen skeletonization algorithm and the Suzuki boundary tracing method are existing methods in this field, they will not be described in detail here.

[0046] Step 2.1.2: Perform redundancy removal and reconnection operations on the curve region.

[0047] More specifically, since boundary tracking algorithms traverse each pixel twice to obtain a closed contour, the extracted contour usually contains a large number of redundant points. Therefore, this embodiment removes these redundancies to ensure that each skeleton point is traversed only once. To reduce errors caused by breaks, contours with closely spaced endpoints are reconnected, and a minimum length threshold for retaining contours is set to suppress interference from noisy skeleton points.

[0048] Step 2.1.3: Transform each curved region into a linear patch.

[0049] More specifically, this process is achieved by resampling the curve region along a set of sampling lines perpendicular to the curve direction: at each curve point, a linear patch is sampled centered on that point. Therefore, the height of the linear patch is equal to the curve length, and the width... It is equal to the length of the sampling line. It should be noted that a larger... While larger errors in the initial annotations can be tolerated, it will increase the computational burden and introduce more erroneous annotations.

[0050] Step 2.2: Based on the assumption that there is an intensity difference between the crack and the background, extract the optimal strip region.

[0051] Specifically, for each linearized crack image, the crack region should appear as a band-like structure extending from the first row to the last row of the image. To extract the optimal band-like region, this embodiment is based on the assumption that there is an intensity difference between the crack and the background, and optimizes the crack annotation by maximizing this intensity difference.

[0052] Step 2.2.1: Set a crack region cost function based on contrast constraints, shape constraints and continuity constraints to determine the crack width.

[0053] More specifically, accurately determining the crack width is a crucial step in improving crack annotation accuracy. This step aims to automatically identify the width of the crack region in the linearized crack image using an optimization algorithm, thereby achieving precise crack annotation. In each linearized region, there exists a linear crack that runs through the first and last rows of the image; its band-like area represents the crack range to be extracted.

[0054] For a given linearized crack region, the goal is to find the optimal strip crack region starting from the top row AB and ending at the last row CD, such as... Figure 4 As shown. Because the crack region is linear and connected, therefore, each row... The segment intersecting with the crack area [ , ],in , Let x and y represent the x-coordinates of the left and right boundaries of the i-th row in the crack region, respectively. The resulting crack region can be easily represented as a set of parameters. in It is the number of rows. It is the first The width of the crack.

[0055] To obtain the optimal crack region Assuming the crack region has a significant brightness difference from the background and its shape should be similar to the initial annotation, maintaining connectivity and smoothness, this embodiment designs a crack region cost function defined as follows: (3).

[0056] in, Let α be the cost function for the crack region, and β be constant weighted parameters. , and These are constraints related to contrast, shape, and continuity, respectively. It should be noted that, in the method of this embodiment, and It is jointly optimized, thus producing a 2D strip region.

[0057] (1) Contrast constraint criterion.

[0058] The contrast constraint term is used to determine the crack width by judging the difference in brightness between the crack region and the background. By setting different width parameters, the corresponding contrast cost is calculated, and the parameter that minimizes the cost is selected as the optimal crack width. To calculate the contrast cost, the difference in each row needs to be calculated, and then the differences in all rows are summed. Therefore, the contrast cost function is defined as follows: (4), (5).

[0059] in, Indicates the first Regional differences in lines For constant parameters, The function can be converted and normalized to a cost value. Regularization is used for flat regions because cracks are not obvious in flat regions, therefore... All configurations, Most will be close to 1. In this case... This will penalize results with a larger width. (This is from an example.) It was set to 0.1, therefore Will follow The increase is slow, and it only works on cracks with very low contrast.

[0060] To calculate regional differences In this embodiment, the difference of regional means is used to approximate the Laplace operator of Gauss, and then an integral graph is used to accelerate the calculation. The formula is as follows: (6).

[0061] in, In response to Laplace, Representing an interval The regional mean. Since the brightness of the crack region in the image is lower than its surrounding area, if it is known... The width of the crack region is Therefore, we can assume that the crack region This corresponds to the location with the largest Laplace response value. Therefore, the above Laplace response can be used as the photometric difference for calculation, i.e. It is important to note that if the crack area is not always darker than the background, the response value should be taken as an absolute value.

[0062] For a region of arbitrary width, the mean This can be efficiently calculated using an integral array. For a simpler and more intuitive approach, row indices are temporarily omitted in this embodiment. and use If we represent an integral array of a row of data, then the difference between the calculation regions can be defined as: (7).

[0063] in, This represents the regional difference.

[0064] This method completes in constant time, for any width. All are applicable. However, since the width of each crack row and the width under different configurations are different, it is also necessary to further refine the design. Normalization is performed.

[0065] (2) Shape constraint method.

[0066] The shape constraint term limits the variation in crack width by calculating the difference between the width of each line and the initial annotation width. During optimization, the shape constraint term penalizes width parameters that differ significantly from the initial annotation width, thus ensuring that the variation in crack width remains within a reasonable range. In the initial annotation, shape differences can be expressed through line width... Calculate based on the difference: (8), (9).

[0067] in, This represents the width of the initial crack region in the i-th row. This indicates the degree to which the width of the crack region in the i-th row deviates from the width of the initial crack region. It is a threshold used to suppress the influence of minor differences caused by the initial annotation error correction. In the implementation of this embodiment, It is fixed at 10. Obviously, because... For width Less than For fine cracks, shape constraints will have no effect. In fact, shape constraints are mainly introduced to improve robustness to wide cracks. Compared to fine cracks, wide cracks may have greater shape variations and are more prone to mislabeling because strong edges are not on the boundary.

[0068] (3) Continuity constraint method.

[0069] The continuity constraint ensures the connectivity and smoothness of the crack region, thereby making the crack region annotation results more accurate and natural. It can be measured by the regional differences between adjacent rows. (37) (38).

[0070] in, This represents the continuity constraint cost function, used to measure whether the left and right boundaries of the crack region between the i-th row and the previous (i-1)-th row are smooth and continuous. These represent the x-coordinate and width of the left boundary of the crack region in row i-1, respectively. It approximates the distance between the left and right endpoints of two adjacent rows. It is a threshold representing the maximum allowed distance; in this embodiment, the threshold is set to... The purpose of the continuity constraint is to ensure connectivity, by selecting a smaller one. The value can also achieve good results.

[0071] Through the above calculations, the function in formula (30) can be fully expressed as: (39) (40).

[0072] in, The cost function term representing the contrast constraint measures the brightness difference between the crack region in the i-th row and its background. , W is the width of the input linearized crack region. Therefore, for each row, the parameter space can be represented as... The mesh is defined. For the entire linearized crack region, the parameter space is... The volume space. To obtain the optimal solution, dynamic programming can be used in the volume parameter space, and the optimal solution should be the connection path between the planes in the parameter space.

[0073] Step 2.2.2: Solve the cost function of the crack region in the volume parameter space using dynamic programming.

[0074] More specifically, we first perform a forward traversal using dynamic programming, recording the predecessor information of the previous row's node in top-down order, such as... Figure 5 As shown. Secondly, each node only calculates the contrast cost; subsequent rows of nodes, during the top-down scan, calculate the cost based on the current coordinates. The optimal predecessor node is searched within the neighborhood of the corresponding position in the previous row. The dynamic programming table is updated by summing the total cost of the predecessor node, the contrast cost of the current row, and the continuity cost. Once all nodes are updated, the node with the minimum total cost can be found in the two-dimensional space of the last row. The optimal path to this node is determined by backtracking. Based on the width w and the coordinate sequence of the right endpoint, the left and right boundaries of each row of cracks can be determined, such as... Figure 6 As shown.

[0075] Step 2.3: Map the extracted optimal strip region results back to the original image space to obtain the final, refined annotation results.

[0076] Step 3: Perform interactive image annotation based on the final optimal path.

[0077] Specifically, after generating the optimal path pointer, the system supports dynamically selecting the required crack segment. The free control point can be moved with the mouse, and the crack path updates in real time, adaptively adjusting to the new minimum-cost path based on the optimal path pointer tracing back from the free point to the source point. For the same pair of starting points, different mouse positions will generate different optimal paths in real time. Since accurately locating the source point directly on the object's edge is usually difficult and tedious, the system provides a cursor snapping function to facilitate source point placement. This function forces the mouse pointer to snap to the pixel with the largest gradient magnitude within a specified neighborhood. The neighborhood size can be adjusted between 1×1 (i.e., snapping disabled) and 15×15 (allowing a maximum offset of 7 pixels in the x and y directions). Therefore, when moving the mouse, the pointer automatically jumps to or snaps to neighboring pixels representing good static edge points, significantly improving the accuracy and efficiency of edge positioning.

[0078] To further enrich the training dataset, especially for acquiring crack images with consistent geometric appearance features against various complex backgrounds, this embodiment innovatively proposes an automatic image crack annotation and optimization method based on shortest path search. It establishes a constraint criterion for the width of the image crack region, and implements a lightweight crack annotation tool deployment, greatly improving annotation accuracy and efficiency while reducing the workload of fine crack annotation tasks. The method involves inputting a starting point and using a shortest path search algorithm to find the shortest path from a specified seed point to other pixels in the image, where the path cost is determined by edge detection results. Image annotation is then performed by drawing the path and calculating the crack width.

[0079] To achieve efficient and accurate fine crack image annotation, an evaluation was conducted in this embodiment.

[0080] This embodiment selects the CrackForest (CFD) dataset for quantitative comparison and uses project experimental data for qualitative comparison. The CFD crack detection dataset is a dataset specifically designed for training and evaluating crack detection algorithms. It contains 118 crack images and their corresponding labels, all in RGB three-channel format with a size of 480×320 pixels. The high-quality pixel-level annotations provided by this dataset can support the accurate calculation of various evaluation metrics, thereby effectively measuring the effectiveness of different fine crack image annotation methods. On the other hand, since experiments involving manual annotation and annotation tools are required, the number of images in the dataset should not be too large, and the CFD dataset perfectly meets the "few but excellent" requirement of this embodiment. In addition, the Ground Truth provided by the CFD crack detection dataset is presented in the form of a binary mask image, which is achieved by generating a binary mask image with the same size as the original image. Its size is completely consistent with the original image, where crack areas are marked as foreground and non-crack areas are marked as background.

[0081] The experimental procedure consists of three parts: manual annotation of fine cracks in the original images of the CFD dataset; annotation tool for fine cracks in the original images of the CFD dataset; and semi-automatic annotation method designed in this chapter for fine cracks in the original images of the CFD dataset.

[0082] 1. Manual Annotation. Import the fine crack image into the Windows system's built-in drawing software, and use the pen tool to annotate the crack areas. This will give you the manually annotated fine crack results. Although this method can theoretically precisely control the annotation results of each pixel, experiments have shown that due to the limitations of interactive precision, obtaining accurate annotation results is very difficult.

[0083] 2. Existing Annotation Tools. Commonly used image annotation tools include LabelMe and X-Any Labeling, but these tools are not suitable for annotating fine cracks. Currently, there is no effective annotation tool specifically for cracks. For cracks, existing annotation methods mainly use polygon drawing tools to annotate the boundaries of fine cracks with polygons. Actual testing revealed that for high-precision situations like fine cracks, Adobe Photoshop's pen tool is superior in both accuracy and efficiency. Therefore, this experiment uses Photoshop for testing.

[0084] 3. Usage Method of This Embodiment. The semi-automatic annotation method based on this embodiment can perform batch annotation of images. The images are placed in a specified path, and the fine crack image is automatically loaded after the system is started. The crack start point is selected by left-clicking, then the tracking path is moved, and the crack end point is determined by left-clicking again. The system will automatically annotate according to the path. When switching to the next image, the system will save the fine crack annotation results to the specified path.

[0085] All three methods described above can yield fine crack annotations for the corresponding original images. By comparing the annotation results of the three methods with the standard annotation results provided in the CFD crack detection dataset, the performance of the three annotation methods under different metrics can be obtained.

[0086] To comprehensively evaluate the accuracy and efficiency of different annotation methods in fine crack image annotation tasks, this embodiment uses the following three metrics: the Intersection over Union (IoU), a commonly used metric to measure the overlap between the predicted and ground truth regions; the Dice similarity coefficient, which is more sensitive to the annotation performance of small targets; and the total time required to complete the annotation task for a single image, in seconds. The values ​​of IoU and Dice coefficient are both between 0 and 1; higher values ​​indicate a higher degree of overlap between the predicted and ground truth regions, better annotation accuracy, and thus higher accuracy. Since all three annotation methods were validated on the CFD crack detection dataset, the number of images processed and the total number of images processed were identical. Based on the comparison of the usage time for the corresponding images, shorter usage time implies higher annotation efficiency. On the CFD crack detection dataset, the IoU score was 0.46 and the Dice score was 0.62, representing a 91% reduction in annotation time compared to traditional methods.

[0087] Example 2: Embodiment 2 of the present invention provides a semi-automatic tunnel image crack annotation system based on shortest path search, comprising: The path calculation module is configured to acquire tunnel crack image samples and use the minimum path search method to calculate the initial optimal path with initial labels in the tunnel crack image samples. The tunnel crack image samples are modeled as a graph structure, and a corresponding cost function is defined according to the graph structure to search for the path with the minimum cost between the specified start point and end point. The path optimization module is configured to incorporate crack width information to further optimize the fine cracks in the initial optimal path, thereby obtaining the final optimal path. The crack annotation module is configured to perform interactive image annotation based on the final optimal path.

[0088] Example 3: Embodiment 3 of the present invention provides a computer-readable storage medium storing a computer program adapted for loading by a processor and executing the steps of the semi-automatic tunnel image crack annotation method based on shortest path search as described in Embodiment 1 of the present invention.

[0089] Example 4: Embodiment 4 of the present invention provides a computer device, the device comprising: A processor, adapted to execute computer programs; A computer-readable storage medium storing a computer program, which, when executed by the processor, implements the steps in the semi-automatic tunnel image crack annotation method based on shortest path search as described in Embodiment 1 of the present invention.

[0090] Example 5: Embodiment 5 of the present invention provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps in the semi-automatic tunnel image crack annotation method based on shortest path search as described in Embodiment 1 of the present invention.

[0091] The steps and methods involved in Examples 2, 3, 4 and 5 above correspond to those in Example 1. For specific implementation methods, please refer to the relevant description section of Example 1.

[0092] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application. In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium that a computer can access or a data processing device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, an optical medium, or a semiconductor medium, etc. The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A semi-automatic method for annotating cracks in tunnel images based on shortest path search, characterized in that, Includes the following steps: Obtain tunnel crack image samples, and use the minimum path search method to calculate the initial optimal path with initial labels in the tunnel crack image samples. The tunnel crack image samples are modeled as a graph structure, and the corresponding cost function is defined according to the graph structure to search for the path with the minimum cost between the specified start point and end point. By incorporating crack width information, the fine cracks in the initial optimal path are further optimized to obtain the final optimal path; Interactive image annotation is performed based on the final optimal path.

2. The semi-automatic tunnel image crack annotation method based on shortest path search as described in claim 1, characterized in that, In a graph structure, each pixel of the image is a vertex, and adjacent pixels are connected by edges.

3. The semi-automatic tunnel image crack annotation method based on shortest path search as described in claim 1, characterized in that, The objective of the cost function is to find a path from the starting point to any node in the image pixel grid that minimizes the path cost. The path cost consists of the sum of the mean local cost of all edges in the path and a linear penalty term for the path length.

4. The semi-automatic tunnel image crack annotation method based on shortest path search as described in claim 1, characterized in that, In actual operation, when the user moves the mouse to the target point, based on the calculated optimal path information, the system traces back from the target point along the predecessor pointer to the source point, and obtains the corresponding pixel sequence.

5. The semi-automatic tunnel image crack annotation method based on shortest path search as described in claim 1, characterized in that, The specific steps for further optimizing the fine cracks in the initial optimal path by incorporating crack width information are as follows: Linearize the labeled path; Based on the assumption that there is an intensity difference between the crack and the background, the optimal strip region is extracted; The extracted optimal strip region results are back-mapped back to the original image space to obtain the final, refined annotation results.

6. The semi-automatic tunnel image crack annotation method based on shortest path search as described in claim 5, characterized in that, Based on the assumption of an intensity difference between the crack and the background, the specific steps for extracting the optimal strip region are as follows: A crack width is determined by setting a crack region cost function based on contrast constraints, shape constraints, and continuity constraints. The cost function of the crack region is solved by dynamic programming in the volume parameter space.

7. A semi-automatic tunnel image crack annotation system based on shortest path search, characterized in that, include: The path calculation module is configured to acquire tunnel crack image samples and use the minimum path search method to calculate the initial optimal path with initial labels in the tunnel crack image samples. The tunnel crack image samples are modeled as a graph structure, and a corresponding cost function is defined according to the graph structure to search for the path with the minimum cost between the specified start point and end point. The path optimization module is configured to incorporate crack width information to further optimize the fine cracks in the initial optimal path, thereby obtaining the final optimal path. The crack annotation module is configured to perform interactive image annotation based on the final optimal path.

8. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the semi-automatic annotation method for tunnel image cracks based on shortest path search as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted to be loaded by a processor and executed as described in any one of claims 1-6, for the semi-automatic annotation method of tunnel image cracks based on shortest path search.

10. A computer device, characterized in that, include: A processor, adapted to execute computer programs; A computer-readable storage medium storing a computer program, which, when executed by the processor, implements the semi-automatic annotation method for tunnel image cracks based on shortest path search as described in any one of claims 1-6.