A method for aligning data of defects detected in a pipe
By acquiring a list of defect features, calculating the matching cost, and using the Hungarian algorithm to generate alignment results, the problems of low alignment rate of defect detection data in pipelines and insufficient cross-pipeline matching capability are solved, achieving more efficient data alignment and matching.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SINOMACH SENSING TECH CO LTD
- Filing Date
- 2026-03-02
- Publication Date
- 2026-05-01
AI Technical Summary
Existing pipeline defect detection data has a low alignment rate and lacks cross-segment matching capability. Existing methods fail to systematically and thoroughly process defect matching details, resulting in inaccurate data alignment.
The method involves obtaining a list of defect features, performing preprocessing operations, calculating the matching cost, generating alignment results using the Hungarian algorithm, determining the matching degree by dividing the bounding box into rectangles and using the intersection-union ratio, constructing a bipartite graph for final matching, and generating the target alignment result.
It improved the alignment rate of defect detection data within pipelines, increased the matching capability across pipe sections, and ensured the accuracy and consistency of data alignment.
Smart Images

Figure CN121765198B_ABST
Abstract
Description
A method for aligning defect detection data in pipelines Technical Field
[0001] This application relates to the field of pipeline data technology, and in particular to a method for aligning defect detection data within a pipeline. Background Technology
[0002] Pipeline inspection is a core technical means to ensure the integrity management of long-distance oil and gas pipelines, enabling quantitative safety status assessments of in-service pipelines. By operating detectors equipped with high-precision sensors inside the pipeline, key structural parameters such as pipe wall metal loss, geometric deformation, and weld defects can be systematically collected, providing a data foundation for pipeline suitability evaluation. However, due to differences in equipment precision and operating conditions used in different inspection cycles, coupled with varying standards followed by different analysis institutions and the subjectivity of human interpretation, systematic deviations exist in the geometric location coordinates and feature boundary selection ranges of the same physical defect presented in different inspection reports.
[0003] To address these challenges, the pipeline inspection industry has introduced defect clustering methods based on industry standards (such as ASME and DNV) to group spatially adjacent defects into a single unit. Building upon this, multi-dimensional matching rules (combining relative mileage, circumferential angle, and cluster relationships) are used for precise mapping, effectively handling complex defect matching issues such as one-to-many and many-to-many relationships. Automatic matching is achieved using a dual threshold judgment method based on mileage difference and circumferential distribution difference. Specifically, when the mileage difference and circumferential distribution difference of two defects in two batches of data are both less than a preset threshold, they are identified as the same defect and marked. For unmatched defects, a combination of manual intervention and automatic alignment, combined with alignment results from features such as valves and elbows, dynamically stretches or shrinks the defect mileage, ultimately achieving accurate association across multiple batches of defect data.
[0004] While the aforementioned studies have made significant progress in the field of pipeline inspection data alignment, a deeper analysis reveals that existing methods still have certain limitations. These works generally focus on eliminating systematic errors and aligning macroscopic features, while defect alignment is treated as a subordinate step in the overall process and has not been systematically and thoroughly explored. Specifically, existing methods do not adequately consider many key details in the defect matching process, resulting in low alignment rates of pipeline inspection data and a lack of cross-segment matching capabilities. Summary of the Invention
[0005] This application provides a method for aligning defect detection data in pipelines to address the technical problems of low alignment rate and lack of cross-segment matching capability in existing pipeline defect detection data.
[0006] This application provides a method for aligning defect detection data in pipelines, including:
[0007] Obtain a list of defect features; the list of defect features is used to store the data to be aligned.
[0008] The data to be aligned is preprocessed; the preprocessing operation includes: obtaining the axial coordinates, angle parameters and circumferential coordinates of the defect features;
[0009] Calculate the first matching cost based on the axial coordinate and the angle parameter;
[0010] Combine any two defect features of the same type from the first defect feature list and the second defect feature list, and generate a first cost matrix based on the first matching cost; the rows and columns of the first cost matrix correspond to the defect features in the first defect feature list and the second defect feature list, respectively; the element values of the first cost matrix correspond to the matching cost of the combined defect features.
[0011] The first cost matrix is solved using the Hungarian algorithm to generate the first alignment result of the defect features;
[0012] A virtual pipe section is obtained by extending a preset length to both sides of the circumferential weld seam of the pipe to be tested;
[0013] Obtain the circumferential weld defect features within the virtual pipe section, and generate a second alignment result of the circumferential weld defect features based on the circumferential weld defect features;
[0014] Based on the defect features, a rectangular bounding box is defined; the x-coordinate of the center coordinate of the rectangular bounding box is the axial coordinate of the defect feature, and the y-coordinate of the center coordinate of the rectangular bounding box is the circumferential coordinate of the defect feature; the length of the rectangular bounding box is the axial length of the defect feature, and the width of the rectangular bounding box is the circumferential width of the defect feature.
[0015] Determine whether the rectangular bounding box crosses the boundary. If so, divide the rectangular bounding box into rectangular sub-boundaries using the boundary. The boundary is the straight line of the pipe to be tested at the 12 o'clock position.
[0016] Based on the first alignment result and the second alignment result, determine the first and second unmatched rectangular sub-frames;
[0017] Calculate the intersection-union ratio of the first rectangular subframe and the second rectangular subframe, and the intersection-union ratio of the second rectangular subframe and the first rectangular subframe;
[0018] If the intersection-union ratio is greater than the preset intersection-union ratio threshold, then the corresponding first rectangular sub-frame and second rectangular sub-frame are added to the candidate set;
[0019] The candidate set is deduplicated using column indexes to obtain the target candidate set;
[0020] The first alignment result, the second alignment result, and the target candidate set are merged to obtain the target matching set;
[0021] Based on the target matching set, a bipartite graph is constructed; the bipartite graph is used to display the number of matches between the first rectangular sub-frame and the second rectangular sub-frame;
[0022] Based on the bipartite graph, the first rectangular sub-frame and the second rectangular sub-frame are matched to generate a target alignment result.
[0023] In some embodiments, the method further includes:
[0024] Verify whether the column names of the defect feature list exist in the column index; the column names include: feature type, axial mileage, clock direction, length, width, and depth;
[0025] If not, an invalid message will be sent to the designated device and the process will be terminated; the designated device is an electronic device capable of receiving electronic information.
[0026] If so, convert the information corresponding to the column name into a string format and fill the NaN value with an empty string;
[0027] Obtain the number of empty strings and extract the index number of the row containing the empty strings;
[0028] A data integrity verification file is generated based on the number of empty strings and their index numbers.
[0029] In some embodiments, the step of obtaining the number of empty strings and extracting the index number of the row containing the empty strings includes:
[0030] Get the number of first empty strings in the column where the column name is the feature type and the axial mileage is located, and the index number of the row where the first empty string is located, and generate a list of first empty question marks;
[0031] Obtain the first target set of records in the column where the column name is located; the first target set of records includes: metal increase, metal corrosion, abnormal circumferential weld, abnormal straight weld, abnormal spiral weld, branch pipe, tee, and suspected oil theft hole;
[0032] Obtain the row containing the records in the first target set and generate the first subset;
[0033] Obtain the number of second empty strings whose column name is in the column of the clock direction in the first subset, and the index number of the row where the second empty string is located, and generate a list of second empty string issues;
[0034] Obtain the second target set of records in the column where the column name is located; the second target set of records includes: metal corrosion, circumferential weld anomaly, straight weld anomaly, and spiral weld anomaly;
[0035] Obtain the row containing the records of the second target set and generate the second subset;
[0036] Obtain the number of third empty strings in the second subset whose column names are the columns containing the length, width, and depth, and the index number of the row containing the third empty string, and generate a list of third empty string issues.
[0037] In some embodiments, the step of generating a data integrity verification file based on the number of empty strings and the index number includes:
[0038] The first blank problem list, the second blank problem list, and the third blank problem list are summarized to generate a data integrity verification file.
[0039] In some embodiments, the step of preprocessing the data to be aligned includes:
[0040] The axial coordinates of the defect feature are obtained by calculating the difference between the center coordinates of the defect feature and the coordinates of the nearest upstream circumferential weld.
[0041] Based on the clock position coordinates of the defect feature corresponding to the circumferential direction of the pipeline under test, the angle parameters of the defect feature are calculated; the angle parameters are:
[0042] ;
[0043] In the formula, ( : The defect feature corresponds to the clock position coordinates in the circumferential direction of the pipe under test. The defect characteristics are characterized as corresponding to the axial length of the pipe under test; The defect characteristics are characterized as corresponding to the circumferential width of the pipe under test;
[0044] Based on the angle parameter, the circumferential coordinates of the defect feature are calculated; the circumferential coordinates are:
[0045] ;
[0046] In the formula, The outer diameter of the pipe to be tested corresponds to the defect feature.
[0047] In some embodiments, the step of calculating the first matching cost based on the axial coordinate and the angle parameter includes:
[0048] Obtain the target axial coordinates and target angle parameters of the defect features corresponding to the first and second defect feature lists under the same pipe section and the same type of defect features;
[0049] Calculate the distance cost based on the target axial coordinates;
[0050] Calculate the minimum angle difference between the target angle parameters in either the clockwise or counterclockwise direction of the pipe to be tested;
[0051] The minimum angle difference is normalized to obtain the angle cost.
[0052] The distance cost and the angle cost are weighted and averaged according to a preset weight to obtain the first matching cost; the first matching cost is:
[0053] total_cost=0.5×cost_dist+0.5×0.15×cost_angle;
[0054] In the formula, cost_dist is the distance cost; cost_angle is the angle cost.
[0055] Specifically, when the distance cost is greater than a preset distance threshold and the angle cost is greater than a preset angle threshold, the corresponding distance cost and angle cost are deleted.
[0056] In some embodiments, the step of generating a second alignment result of the circumferential weld defect features based on the circumferential weld defect features includes:
[0057] Preprocessing operation is performed on the defect characteristics of the circumferential weld;
[0058] Calculate the second matching cost based on the axial coordinate and the angle parameter;
[0059] Combine any two circumferential weld defect features of the same type from the first circumferential weld defect features and the second circumferential weld defect features, and generate a second cost matrix based on the second matching cost.
[0060] The second cost matrix is solved using the Hungarian algorithm to generate the second alignment result of the circumferential weld defect features.
[0061] In some embodiments, the step of calculating the intersection-union ratio of the first rectangular subframe and the second rectangular subframe includes:
[0062] Calculate the intersection area between the first rectangular subframe and the second rectangular subframe, as well as the total area of the first rectangular subframe and the second rectangular subframe;
[0063] Based on the intersection area and the total area, calculate the intersection-union ratio of the first rectangular sub-frame and the second rectangular sub-frame.
[0064] In some embodiments, the step of matching the first rectangular sub-frame and the second rectangular sub-frame based on the bipartite graph to generate a target alignment result includes:
[0065] If a first rectangular subframe matches multiple second rectangular subframes, then the second rectangular subframe with the largest corresponding depth is matched with the first rectangular subframe; if there are second rectangular subframes with the same depth, then the second rectangular subframe with the largest intersection-union ratio is matched with the first rectangular subframe.
[0066] If multiple first rectangular sub-frames match a second rectangular sub-frame, then the first rectangular sub-frame with the largest corresponding depth is matched with the second rectangular sub-frame; if there are first rectangular sub-frames with the same depth, then the first rectangular sub-frame with the largest intersection-union ratio is matched with the second rectangular sub-frame.
[0067] If multiple first rectangular subframes match multiple second rectangular subframes, then the second rectangular subframe with the largest corresponding depth is matched with the first rectangular subframe; and it is determined whether the second rectangular subframe is matched by multiple first rectangular subframes. If so, the target first rectangular subframe is determined by weighted arbitration using the intersection-union ratio and the center distance between the first rectangular subframe and the second rectangular subframe, so that the second rectangular subframe matches only one more first rectangular subframe.
[0068] In some embodiments, the method further includes:
[0069] Based on the target alignment results, an alignment report is generated; the alignment report is used to display the matching objects, unmatched objects, and conflict resolution records of the defect features; the conflict resolution records correspond to the process of determining the target first rectangular sub-frame using weighted arbitration based on the intersection-union ratio and the center distance between the first rectangular sub-frame and the second rectangular sub-frame.
[0070] This application provides a method for aligning defect detection data in pipelines, comprising: acquiring a defect feature list; the defect feature list being used to store data to be aligned; performing preprocessing operations on the data to be aligned; the preprocessing operations comprising: acquiring the axial coordinates, angle parameters, and circumferential coordinates of the defect features; calculating a first matching cost based on the axial coordinates and the angle parameters; combining any two defect features of the same type from the first defect feature list and the second defect feature list, and generating a first cost matrix based on the first matching cost; the rows and columns of the first cost matrix corresponding to the first defect feature list and the second defect feature list, respectively. The feature list includes defect features; the element values of the first cost matrix correspond to the matching cost of the combined defect features; the first cost matrix is solved using the Hungarian algorithm to generate a first alignment result of the defect features; a virtual pipe section is obtained by extending a preset length to both sides of the circumferential weld of the pipe under test; the circumferential weld defect features within the virtual pipe section are obtained, and a second alignment result of the circumferential weld defect features is generated based on the circumferential weld defect features; a rectangular bounding box is defined based on the defect features; the horizontal coordinate of the center of the rectangular bounding box is the axial coordinate of the defect feature, and the vertical coordinate of the center of the rectangular bounding box is the circumferential coordinate of the defect feature. Coordinates; the length of the rectangular bounding box is the axial length of the defect feature, and the width of the rectangular bounding box is the circumferential width of the defect feature; determine whether the rectangular bounding box crosses the boundary, and if so, divide the rectangular bounding box with the boundary to form rectangular sub-frames; the boundary is the straight line of the pipe to be tested in the 12 o'clock direction; based on the first alignment result and the second alignment result, determine the first and second mismatched rectangular sub-frames; calculate the intersection-union ratio of the first and second rectangular sub-frames and the intersection-union ratio of the second and first rectangular sub-frames; if the intersection-union ratio is greater than a preset intersection-union ratio threshold, then... The corresponding first and second rectangular sub-frames are added to the candidate set; the candidate set is deduplicated using column indexes to obtain the target candidate set; the first alignment result, the second alignment result, and the target candidate set are merged to obtain the target matching set; a bipartite graph is constructed based on the target matching set; the bipartite graph is used to display the number of matches between the first and second rectangular sub-frames; based on the bipartite graph, the first and second rectangular sub-frames are matched to generate the target alignment result, thereby improving the alignment rate of pipeline defect detection data and increasing the cross-pipeline matching capability through the pipeline defect detection data alignment method. Attached Figure Description
[0071] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0072] Figure 1 is a flowchart of the generation process of the first alignment result and the second alignment result in this application;
[0073] Figure 2 is a flowchart of the target alignment result generation process in this application;
[0074] Figure 3 is a schematic diagram of the virtual pipe section in this application;
[0075] Figure 4 is a schematic diagram of the bipartite graph in one embodiment of this application;
[0076] Figure 5 is a schematic diagram of the bipartite graph in this application under another embodiment;
[0077] Figure 6 is a schematic diagram of the bipartite graph in this application under another embodiment;
[0078] Figure 7 shows the clock position of the pipeline under test in the circumferential direction in this application. Detailed Implementation
[0079] To enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in 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 in this application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this application.
[0080] For example, through a systematic analysis of existing pipeline inspection data alignment technologies, the following five key common problems that urgently need to be solved can be summarized:
[0081] (1) Alignment improvement requirement: It is necessary to significantly improve the alignment success rate of defect features in the data obtained by the split-type internal detector and the historical detection data of multiple rounds, so as to overcome the difficulties in data association caused by differences in detection equipment, changes in operating conditions and different human interpretation standards. (2) Lack of cross-segment matching capability: Existing methods generally lack an effective alignment mechanism for the distribution of circumferential weld anomalies that may cross adjacent pipe segments, resulting in insufficient matching integrity of such defects. (3) Limitations of complex cluster alignment: Current technologies are mostly limited to simple "one-to-one" defect matching, which is difficult to effectively handle the complex correspondences such as "one-to-many", "many-to-one" and "many-to-many" that are common in high-density defect groups, thus limiting its applicability in real complex working conditions. (4) Insufficient intelligent auxiliary decision-making: In the process of cluster alignment, it is not possible to provide optimized matching suggestions based on multi-dimensional information such as defect depth and defect cross area level, resulting in a large workload of manual review and insufficient decision-making basis. (5) Lack of consistency in multi-strategy collaboration: When multiple alignment strategies are used for joint analysis, there is a lack of effective conflict resolution and result integration mechanisms, making it difficult to guarantee the consistency, reliability and fit of the final alignment conclusions with the specific analysis task requirements.
[0082] To address the above technical problems, this application provides a method for aligning defect detection data inside pipelines. The method for aligning defect detection data inside pipelines is described below:
[0083] Figure 1 shows the flowchart for generating the first alignment result and the second alignment result in this application.
[0084] This application provides a method for aligning defect detection data in pipelines, including:
[0085] For example, the defect feature list is the core basis for defect alignment. However, due to uncontrollable factors such as database update delays, some information in the defect feature list may be missing. To ensure the reliability of data in subsequent processing, a critical information integrity assessment needs to be conducted after obtaining the data to be processed, specifically through the following three progressive steps:
[0086] First, for each record in the defect feature list, check whether there are any blank spaces in the "Feature Type" and "Axial Mileage" columns. These two columns are the basic fields for determining the defect type and axial positioning, and their integrity directly affects the spatial alignment accuracy.
[0087] Secondly, for components or defects whose "feature type" is "metal addition," "metal corrosion," "circumferential weld anomaly," "straight weld anomaly," "spiral weld anomaly," "branch pipe," "tee," or "suspected oil theft hole," which require description based on clock direction, a special check is performed on the blank space in the "clock direction" column. The characterization of such components or defects requires spatial orientation in conjunction with clock position; the lack of clock direction information will lead to incorrect description of the defect location.
[0088] Third, for the four defect types requiring quantifiable dimensional parameters—"metal corrosion," "circumferential weld anomaly," "straight weld anomaly," and "spiral weld anomaly"—further verification was conducted on the blanking of the "length," "width," and "depth" columns. Dimensional parameters are key indicators for assessing defect severity; their absence directly affects the accuracy of defect classification.
[0089] The method includes the following steps:
[0090] S10: Verify whether the column names of the defect feature list exist in the column index; the column names include: feature type, axial mileage, clock direction, length, width, and depth; if not, send an invalid prompt message to the setting device and terminate the process; the setting device is an electronic device capable of receiving electronic information.
[0091] Specifically, the pandas.read_excel interface is called to read the Excel file containing the feature list to be verified; then the column names to be verified (i.e., "feature type", "axial mileage", etc.) are verified to see if they exist in the DataFrame column index. If they do not exist, an invalid column name message is thrown and the process is terminated to avoid misjudgment due to misspelled column names or missing fields.
[0092] S20: If so, convert the information corresponding to the column name into a string format and fill the NaN value with an empty string.
[0093] Specifically, for the columns to be inspected ("Feature Type", "Axial Mileage", "Clock Direction", "Length", "Width", "Depth"), the astype(str) method is used to convert them into string format, and NaN values are forced to be filled with empty strings (fillna('')) to ensure that all cells can participate in string operations and eliminate the impact of inconsistent data types on space detection.
[0094] S30: Obtain the number of empty strings and extract the index number of the row containing the empty strings.
[0095] Specifically, first use isnull().sum() to get the exact count of null values, then use df[df['column name'].isnull()].index.tolist() to extract the index number of the row containing the null values (note that Excel row numbers need to be increased by 2, because the index starts from 0 and the header row needs to be skipped).
[0096] The step of obtaining the number of empty strings and extracting the index number of the row containing the empty strings includes the following sub-steps:
[0097] S31: Obtain the number of first empty strings whose column names are the feature type and the axial mileage column, and the index number of the row where the first empty string is located, and generate a list of first empty question marks.
[0098] Specifically, for the "Feature Type" and "Axial Mileage" columns, the detection logic of step S30 is applied to obtain the basic field blank problem list (first blank problem list).
[0099] S32: Obtain the first target set of records in the column where the column name is located; the first target set of records includes: metal increase, metal corrosion, abnormal circumferential weld, abnormal straight weld, abnormal spiral weld, branch pipe, tee, and suspected oil theft hole.
[0100] S33: Obtain the row containing the record of the first target set and generate the first subset.
[0101] S34: Obtain the number of second empty strings whose column name is the column where the clock direction is located in the first subset, and the index number of the row where the second empty string is located, and generate a list of second empty string issues.
[0102] Specifically, for records whose target set is "Feature Type" ("Metal Addition", "Metal Corrosion", "Circumferential Weld Anomaly", "Straight Weld Anomaly", "Spiral Weld Anomaly", "Branch Pipe", "Tee", "Suspected Oil Theft Hole"), the rows that meet the conditions in the "Feature Type" column are first filtered using the isin() method to obtain a subset DataFrame; then, the "Clock Direction" column is extracted from this subset and the blank detection in step S30 is performed to generate a blank problem list (second blank problem list) for the "Clock Direction" column that is only for this type of part or defect.
[0103] S35: Obtain the second target set records in the column where the column name is located; the second target set records include: metal corrosion, circumferential weld anomaly, straight weld anomaly, and spiral weld anomaly.
[0104] S36: Obtain the row containing the record of the second target set and generate the second subset.
[0105] S37: Obtain the number of third empty strings in the second subset whose column names are the columns of the length, width, and depth, and the index number of the row where the third empty string is located, and generate a list of third empty string issues.
[0106] Specifically, for records with "feature type" as "metal corrosion", "circumferential weld anomaly", "straight weld anomaly" or "spiral weld anomaly", a conditional filtering logic similar to steps S31-S34 is adopted. First, a subset of DataFrames of the target defect type is extracted, and then the space detection in step S30 is performed on the three columns of "length", "width" and "depth" respectively to generate an independent list of space problems for each column (the third list of space problems).
[0107] S40: Generate a data integrity verification file based on the number of empty strings and their index numbers.
[0108] The step of generating a data integrity verification file based on the number and index number of the empty strings includes the following sub-steps:
[0109] S41: Summarize the first list of blank spaces, the second list of blank spaces, and the third list of blank spaces to generate a data integrity verification file. By summarizing the first list of blank spaces, the second list of blank spaces, and the third list of blank spaces, the total number of blank spaces and the distribution of row numbers are counted according to "basic fields", "clock parameters", and "size parameters". The row numbers and column names are written to a txt file for manual verification.
[0110] For any blank space issues found in any of the above inspection steps, the corresponding line number and missing content are recorded simultaneously, and the results are saved to a txt file for verification. Only after manual verification confirms that there are no errors can the process proceed to the next step.
[0111] S100: Obtain a list of defect features; the list of defect features is used to store the data to be aligned; the defect features refer to the defect area information defined from the data to be aligned after analysis, usually represented by a rectangular bounding box, and quantitatively described using center coordinates plus length and width values. Wherein, in the center coordinates (x, y), x represents the mileage position of the defect in the pipeline axial direction, y represents the clock position of the defect in the pipeline circumferential direction (e.g., 3:15), and the length and width values correspond to the axial length and circumferential width, respectively.
[0112] S200: Perform preprocessing operations on the data to be aligned; the preprocessing operations include: obtaining the axial coordinates, angle parameters, and circumferential coordinates of the defect features.
[0113] The step of preprocessing the data to be aligned includes the following sub-steps:
[0114] S210: Calculate the difference between the center coordinates of the defect feature and the coordinates of the nearest upstream circumferential weld to obtain the axial coordinates of the defect feature. Since the split-type inspection data has significant mileage errors, and these errors are usually large, directly using absolute mileage for processing can easily lead to serious matching errors. Therefore, this application uses the aligned circumferential weld data as a reference to zero out pipe section errors: Specifically, calculate the difference between the center position of each defect and the position of the nearest upstream circumferential weld, and use this difference as the axial coordinate of the defect. In subsequent alignment operations, all axial coordinate calculations are based on this relative value, thereby avoiding the interference of absolute mileage errors on the matching results.
[0115] S220: Based on the clock position coordinates of the defect feature corresponding to the circumferential direction of the pipeline under test, calculate the angle parameters of the defect feature; derive the corresponding angle information based on the clock direction information of the defect feature, and record the angle information in a newly created "Angle Information" column. Specifically, for features with valid clock direction data, this application converts the clock direction representation into an angle value representation based on the following formula conversion rule: taking the 12 o'clock position as 0° reference, the angle increases sequentially in the clockwise direction, mapping clock descriptions such as "3 o'clock", "6 o'clock", and "9 o'clock" to "90°", "180°", and "270°" respectively, thereby realizing the corresponding conversion between clock information and angle values, and providing standardized angle parameters for subsequent alignment calculations.
[0116] The angle parameter is:
[0117] ;
[0118] In the formula, ( : The defect feature corresponds to the clock position coordinates in the circumferential direction of the pipe under test. The defect characteristics are characterized as corresponding to the axial length of the pipe under test; The defect characteristics are characterized as corresponding to the circumferential width of the pipe under test.
[0119] S230: Based on the aforementioned angle parameters, calculate the circumferential coordinates of the defect feature. Since the circumferential coordinates of the defect are required in subsequent alignment operations, this application obtains the circumferential coordinates based on the angle parameters during the data preprocessing stage. Specifically, using the 12 o'clock position as the zero point reference, the angle parameters and the outer diameter of the pipe section are substituted into the following formula for calculation, thereby obtaining the circumferential coordinate information of the corresponding position. To facilitate subsequent data processing and alignment operations, a separate data column is created specifically to store the calculation results of the circumferential coordinates.
[0120] The circumferential coordinates are:
[0121] ;
[0122] In the formula, The outer diameter of the pipe to be tested corresponds to the defect feature.
[0123] S300: Calculate the first matching cost based on the axial coordinate and the angle parameter.
[0124] The step of calculating the first matching cost based on the axial coordinate and the angle parameter includes the following sub-steps:
[0125] S310: Obtain the target axial coordinates and target angle parameters of the defect features corresponding to the first and second defect feature lists under the same pipe section and the same type of defect features. The first and second defect feature lists correspond to defect data of the same pipe under test measured at different times, i.e., data to be aligned.
[0126] Specifically, firstly, two feature list files and a weld reference table file are read separately. Based on the coordinate information in the weld reference table, the defect and feature records in each feature list are divided according to their respective pipe sections, aggregating the data within the same pipe section into a group. The records for each pipe section are then independently saved as a dictionary structure containing feature attributes (such as angle information, distance relative to the upstream weld, feature type, etc.), thus forming two dictionary sets, each based on a pipe section (corresponding to two rounds of inspection data). Subsequently, according to the pipe section correspondence recorded in the weld reference table, the pipe section dictionaries that can correspond in the two rounds of data are paired and grouped into a unified dictionary for subsequent cross-round matching and analysis based on the pipe section dimension. The dictionary allows the acquisition of the target axial coordinates and target angle parameters of the defect features corresponding to the first and second defect feature lists for the same pipe section and the same type of defect features.
[0127] S320: Based on the target axial coordinates, calculate the distance cost; normalize the relative distance according to the average pipe section length (12m), and then calculate the absolute value of the difference between the normalized values of the two sets of data to obtain the distance cost, which reflects the proximity of the axial positions.
[0128] The distance cost is:
[0129]
[0130] In the formula, This refers to the i-th defect feature in the first defect feature list; This is the j-th defect feature in the second defect feature list. The average pipe section length is set to 12.
[0131] S330: Calculate the minimum angle difference between the target angle parameters in either the clockwise or counterclockwise direction of the pipe to be tested.
[0132] S340: Normalize the minimum angle difference to obtain the angle cost; calculate the minimum angle difference between the two sets of features (considering the 360° boundary of the circle, take the minimum angle in the clockwise or counterclockwise direction), and divide it by 360° to normalize it to obtain the angle cost, which reflects the consistency of the circumferential direction.
[0133] The cost of the angle mentioned is:
[0134] ;
[0135] In the formula, The circumferential angle of the i-th defect feature in the first defect feature list; The circumferential angle is the j-th defect feature in the second defect feature list.
[0136] S350: The distance cost and the angle cost are weighted and averaged according to preset weights to obtain the first matching cost; the distance cost and the angle cost are weighted and averaged according to preset weights to obtain the preliminary comprehensive matching cost (first matching cost). Given the differences in dimensions and actual alignment tolerance between angle and distance, this application introduces a hyperparameter to balance the angle cost, taking into account the contribution ratio of both.
[0137] The cost of the first matching is:
[0138] total_cost=0.5×cost_dist+0.5×0.15×cost_angle;
[0139] In the formula, cost_dist represents the distance cost, and cost_angle represents the angle cost. The preset weights are all 0.5, and the hyperparameter for balancing the angle cost dimensions is 0.15.
[0140] Specifically, when the distance cost exceeds a preset distance threshold and the angle cost exceeds a preset angle threshold, the corresponding distance cost and angle cost are deleted. To avoid obviously unreasonable matching, this application sets preset distance thresholds and preset angle thresholds. When the absolute distance difference or absolute angle difference between two sets of features exceeds the corresponding threshold, it is determined that they should not be matched, and a very high cost is imposed to exclude them, thereby ensuring the rationality of the matching results.
[0141] S400: Combine any two defect features of the same type from the first defect feature list and the second defect feature list, and generate a first cost matrix based on the first matching cost. The rows and columns of the first cost matrix correspond to the defect features in the first defect feature list and the second defect feature list, respectively. The element values of the first cost matrix correspond to the matching cost of the combined defect features. Combine defect features of the same category in the two sets of data pairwise, call the cost function to generate matching costs, and form a two-dimensional cost matrix. The rows and columns of the matrix correspond to the features in the first defect feature list and the second defect feature list, respectively, and the element values are the matching cost of the corresponding feature combination.
[0142] S500: The first cost matrix is solved using the Hungarian algorithm to generate the first alignment result of the defect features. This application uses the Hungarian algorithm to achieve spatial alignment of pipe section defects and other features in split-type inspection data. The core idea is to construct a matching cost matrix between features and find the globally optimal match to ensure that the same defect or feature is correctly matched in two rounds of data. By using the Hungarian algorithm to find the matching scheme with the minimum total cost in the cost matrix, the matching pairs that meet the threshold conditions and their costs are returned. This algorithm guarantees the best one-to-one pairing globally and avoids mismatches caused by local optima.
[0143] For example, after merging the matching results obtained from each pipe section, all matching records are uniformly sorted according to a predefined priority sorting rule to generate structured alignment results, facilitating subsequent analysis and verification. The sorting rule is as follows: priority is given to sorting in ascending order of axial mileage; when two or more records have the same axial mileage, they are further sorted in ascending order of angle information, thereby ensuring that the matching results have a clear order and comparability in spatial location.
[0144] It is worth noting that the Hungarian algorithm is a current technique and will not be described in detail here.
[0145] S600: Extend a preset length to both sides of the circumferential weld of the pipe to be tested to obtain a virtual pipe section.
[0146] S700: Obtain the circumferential weld defect features within the virtual pipe section, and generate a second alignment result of the circumferential weld defect features based on the circumferential weld defect features.
[0147] The step of generating a second alignment result of the circumferential weld defect features based on the circumferential weld defect features includes the following sub-steps:
[0148] S710: Perform preprocessing operation on the defect characteristics of the circumferential weld.
[0149] S720: Calculate the second matching cost based on the axial coordinate and the angle parameter.
[0150] S730: Combine any two circumferential weld defect features of the same type from the first and second circumferential weld defect features, and generate a second cost matrix based on the second matching cost. The first and second circumferential weld defect features correspond to circumferential weld defect data of the same pipeline under test measured at different times.
[0151] S740: Solve the second cost matrix using the Hungarian algorithm to generate the second alignment result of the circumferential weld defect features.
[0152] It is worth noting that the process of generating the second alignment result can refer to the process of generating the first alignment result, and will not be repeated here.
[0153] For example, for anomalies in circumferential welds, factors such as manual annotation deviations, differences in inspection perspectives, and actual signal offsets, or the defect center itself not being strictly located at the weld centerline, often result in a slight offset of the annotated defect center to the left or right of the weld. Such minor spatial deviations, when segmenting data according to pipe section boundaries, may cause anomalies that should belong to the same circumferential weld to be classified into adjacent different pipe sections. This makes it impossible for pipe section-based matching methods to identify them as the same defect, ultimately leading to matching failure. Existing methods generally do not specifically address this special case, thus significantly limiting the matching accuracy of circumferential weld anomalies.
[0154] To address the aforementioned issues, this application, after aligning defect features within the same pipe section, adds a cross-pipe matching operation targeting anomalies in the circumferential weld. The core logic of this operation is similar to the intra-pipe matching, both constructing a cost matrix based on angle and relative distance information and solving for the globally optimal match using the Hungarian algorithm. However, targeted adjustments are made to the spatial partitioning strategy:
[0155] Differences in pipe segmentation methods: Intra-segment matching cuts data according to the actual start and end boundaries of the pipe segment; while cross-pipe matching uses the geometric center of the circumferential weld as the reference and constructs virtual pipe segments by extending 0.1m to the left and right sides, as shown in Figure 3, and includes circumferential weld anomalies that may fall into adjacent pipe segments due to label offset into the same matching unit.
[0156] Matching process consistency: Except for the different spatial division range, cross-pipe matching is consistent with intra-pipe matching in terms of cost calculation (integrating axial relative distance and circumferential angle difference), threshold filtering, weight balancing and Hungarian algorithm solution, ensuring the universality and stability of the method system.
[0157] The virtual pipe segment expansion strategy described above can effectively accommodate the slight offset of the anomaly marking position of the circumferential weld, and make the cross-pipe scattered data originally caused by the cutting boundary converge into the same matching space, which significantly improves the matching success rate of circumferential weld anomalies in cross-pipe scenarios and makes up for the shortcomings of existing methods in such special cases.
[0158] Building upon the basic alignment results, further expansion and compensation matching operations are performed to address matching omissions and mismatches caused by annotation bias, differences in detection perspective, and periodic boundary conditions. The core objective is to balance the circumferential periodic features of the pipe section surface with complex many-to-many matching scenarios, achieving alignment results with higher completeness and accuracy. The overall execution process is as follows:
[0159] Figure 2 shows the flowchart for generating the target alignment result in this application.
[0160] S800: Based on the defect features, divide a rectangular bounding box; the horizontal coordinate of the center coordinate of the rectangular bounding box is the axial coordinate of the defect feature, and the vertical coordinate of the center coordinate of the rectangular bounding box is the circumferential coordinate of the defect feature; the length of the rectangular bounding box is the axial length of the defect feature, and the width of the rectangular bounding box is the circumferential width of the defect feature.
[0161] Specifically, based on the dictionary data obtained from the pipe segment alignment step, a rectangular bounding box is constructed for each record according to its length, width information, and center point coordinates (including axial and circumferential coordinates). The axial direction corresponds to the X-direction, and the circumferential direction corresponds to the Y-direction, thus providing a unified and standardized geometric representation for subsequent intersection-over-union (IoU) calculations.
[0162] S900: Determine whether the rectangular bounding box crosses the boundary. If so, divide the rectangular bounding box with the boundary to form a rectangular sub-box. The boundary is the straight line of the pipeline to be tested in the 12 o'clock direction.
[0163] Specifically, in actual annotation, the rectangular bounding box of a defect feature may cross the 0° / 360° circumferential boundary (i.e., across the 12 o'clock direction), as shown in Figure 7, forming a surrounding region that cannot be directly represented in a standard Cartesian coordinate system. To correctly handle such cases in intersection-union calculations, this application designs a rectangular splitting module in periodic space: when a rectangular bounding box is detected to have its circumferential range crossing the boundary, it is automatically divided into two rectangular sub-boxes located entirely within the standard interval (without crossing the boundary), as shown in Figure 6. Each rectangular sub-box can be correctly represented in conventional geometric operations. The splitting principle ensures that the union of the two sub-boxes is completely equivalent to the original box on the pipe section surface without losing any regional information, thus guaranteeing the accuracy of subsequent spatial overlap measurements.
[0164] S1000: Based on the first alignment result and the second alignment result, determine the first and second mismatched rectangular sub-frames.
[0165] S1100: Calculate the intersection-union ratio of the first rectangular sub-frame and the second rectangular sub-frame, and the intersection-union ratio of the second rectangular sub-frame and the first rectangular sub-frame.
[0166] The step of calculating the intersection-union ratio of the first rectangular sub-frame and the second rectangular sub-frame includes the following sub-steps:
[0167] S1110: Calculate the intersection area between the first rectangular subframe and the second rectangular subframe, as well as the total area of the first rectangular subframe and the second rectangular subframe.
[0168] S1120: Based on the intersection area and the total area, calculate the intersection-union ratio of the first rectangular sub-frame and the second rectangular sub-frame.
[0169] Specifically, in calculating the Intersection over Union (IoU), a strategy of splitting first and then calculating the intersection and union is adopted to address potential bounding box scenarios: First, the two rectangles to be compared are split to obtain several sets of non-boundary rectangular sub-boxes; then, the intersection area is calculated for each pair of rectangular sub-boxes, and the total intersection area is obtained; similarly, the sum of the areas of all rectangular sub-boxes of each rectangular bounding box is calculated as the total area of that rectangular bounding box, and the union area is then obtained; finally, the intersection area is divided by the union area to obtain the true IoU value. This process ensures that even if the defect features are distributed on both sides of the circumferential boundary, an accurate overlap measurement can be obtained, providing a reliable geometric basis for subsequent matching and conflict resolution.
[0170] S1200: If the intersection-union ratio is greater than the preset intersection-union ratio threshold, then the corresponding first rectangular sub-frame and second rectangular sub-frame are added to the candidate set.
[0171] Specifically, after the first stage of matching based on center location loss, a batch of unmatched objects (unmatched defective features) remains. To compensate for missed matches caused by center location deviation, the intersection-union ratio (IUR) of unmatched objects with unmatched objects from another dataset is calculated in two directions: starting from the unmatched objects of the previous round, the IUR is calculated with objects in the current round; simultaneously, the IUR is also calculated with unmatched objects from the current round and objects from the previous round. Only when the IUR is higher than a preset IU threshold is the two considered to have significant spatial overlap and can be included in the candidate set as potential matching pairs. This process fully utilizes the similarity of defective features in shape and coverage, compensating for reasonable matches that may be missed by relying solely on center distance.
[0172] S1300: Use column indexing to deduplicate the candidate set to obtain the target candidate set.
[0173] Specifically, the screening in the two directions mentioned above will generate two types of candidate pairs: one type is where an object from the previous round (denoted as A) matches an unmatched object in the current round (denoted as unmatched B), which can be represented as A and unmatched B; the other type is where an object in the current round (denoted as B) matches an unmatched object from the previous round (denoted as unmatched A), which can be represented as unmatched A and unmatched B. Since the same pair of objects may be detected in both directions of calculation, to avoid duplication and unify the matching relationship, the candidate pair set needs to be merged and deduplicated: first, using the object index pair (index A, index B) as a unique identifier, records from different sources but pointing to the same object pair are merged, and their intersection-union ratio information is retained; if the same object pair meets the conditions in multiple directions, it is uniformly regarded as the same candidate match. After deduplication, all qualified candidate pairs are gathered into a target candidate set, which serves as the input for the second stage of refined matching, providing a complete set of alternatives for subsequent conflict identification and recommendation matching.
[0174] S1400: Merge the first alignment result, the second alignment result, and the target candidate set to obtain the target matching set.
[0175] Specifically, the matching results based on the center position (first alignment result), the matching results based on the circumferential weld position (second alignment result), and the target candidate set based on the intersection-union ratio (IUU) from the supplementary matching stage are first merged to form a complete target matching set. Then, the number of times each object in the target matching set is matched is counted. If an object establishes a matching relationship with multiple other objects, it is marked as a "one-to-many" or "many-to-one" situation; if multiple objects form cross-matching relationships, it is further identified as a "many-to-many" complex matching relationship. By discovering and explicitly defining all potential conflicting matches, the foundation for subsequent refined resolution is laid.
[0176] S1500: Based on the target matching set, construct a bipartite graph; the bipartite graph is used to display the number of matches between the first rectangular sub-frame and the second rectangular sub-frame.
[0177] Specifically, based on the identified matching relationships, a bipartite graph is constructed, where nodes are divided into group A (from the first rectangular subframe) and group B (from the second rectangular subframe). This bipartite graph represents the association between matching pairs. Breadth-first search (BFS) traverses this graph, grouping directly or indirectly connected object nodes into the same "main cluster." This ensures that objects with matching dependencies are in the same conflict group, thus avoiding the fragmentation of associations during conflict resolution. For each main cluster, the number of members in its A and B groups is further analyzed: if the main cluster contains only a single A object but corresponds to multiple B objects, it is marked as a "one-to-many" cluster, as shown in Figure 4; if it contains multiple A objects but corresponds to only a single B object, it is a "many-to-one" cluster, as shown in Figure 5; if both groups have more than one member, a "many-to-many" cluster is formed, as shown in Figure 6. Then, each cluster is assigned a cluster ID. In particular, for "many-to-many" clusters, this application further employs a method of "independently dividing sub-clusters according to A members" to improve the clarity of the representation of the matching results. Specifically, the A members within the parent cluster are indexed and sorted. For each sorted A member, a sub-cluster is created, numbered as parent cluster ID - sub-cluster sequence number (e.g., 4-1, 4-2, ...). This sub-cluster contains: the current A member itself; and all B members that match this A member within the main cluster (i.e., B members with edges to this A). Note: The same B may appear in multiple sub-clusters because it may match multiple A members. This hierarchical numbering of the main and sub-clusters allows the problem to be limited to a local scope during subsequent conflict resolution, avoiding the complexity explosion caused by global traversal.
[0178] S1600: Based on the bipartite graph, match the first rectangular sub-frame and the second rectangular sub-frame to generate the target alignment result. Existing alignment strategies, while completing basic matching, often result in the same defect or feature appearing multiple times in the result record due to the clustered matching mechanism, forming so-called matching conflicts. To ensure the uniqueness of data records, the most representative pair should be retained in each group of conflicting matches, and the remaining matches should be grouped into the same cluster for traceability. Defect size (especially depth), as the most critical indicator in detection, naturally becomes the core basis for conflict resolution.
[0179] The step of matching the first rectangular sub-frame and the second rectangular sub-frame based on the bipartite graph to generate a target alignment result includes the following sub-steps:
[0180] S1610: If a first rectangular subframe matches multiple second rectangular subframes, then the second rectangular subframe with the largest corresponding depth is matched with the first rectangular subframe; if there are second rectangular subframes with the same depth, then the second rectangular subframe with the largest intersection-union ratio is matched with the first rectangular subframe.
[0181] Specifically, in a one-to-many scenario, the combination with the largest B depth and the largest intersection-union ratio under the condition of the same depth is selected as the recommended match.
[0182] S1620: If multiple first rectangular sub-frames match a second rectangular sub-frame, then the first rectangular sub-frame with the largest corresponding depth is matched with the second rectangular sub-frame; if there are first rectangular sub-frames with the same depth, then the first rectangular sub-frame with the largest intersection-union ratio is matched with the second rectangular sub-frame.
[0183] Specifically, in the many-to-one scenario, the combination with the largest depth of A and the largest intersection-union ratio under the condition of the same depth is selected as the recommended match.
[0184] S1630: If multiple first rectangular sub-frames match multiple second rectangular sub-frames, then match the second rectangular sub-frame with the largest corresponding depth to the first rectangular sub-frame; and determine whether the second rectangular sub-frame is matched by multiple first rectangular sub-frames. If so, use the intersection-union ratio and the center distance between the first rectangular sub-frame and the second rectangular sub-frame as a weighted arbitration to determine the target first rectangular sub-frame, so that the second rectangular sub-frame only matches one more first rectangular sub-frame.
[0185] Specifically, in more complex many-to-many scenarios, the process first coordinates all candidate relationships of A / B at the parent cluster level. Each A preferentially selects the B with the highest depth from its own B list for initial allocation. Then, within the parent cluster, iterative checks are performed to resolve conflicts where multiple A's occupy a B. The winner is determined by a weighted arbitration based on the intersection-union ratio and center distance. If necessary, the remaining unallocated B's are allocated to unmatched A's, thus ensuring that each B is matched with at most one A. This conflict resolution process, based on defect size classification, takes into account the uniqueness of matching, business importance, and spatial consistency, effectively improving the accuracy and usability of cluster alignment results.
[0186] In this embodiment, the method further includes the following steps:
[0187] S1700: Based on the target alignment result, generate an alignment report; the alignment report is used to display the matching objects, unmatched objects, and conflict resolution records of the defect features; the conflict resolution records correspond to the process of determining the target first rectangular sub-frame using weighted arbitration of the intersection-union ratio and the center distance between the first rectangular sub-frame and the second rectangular sub-frame.
[0188] Specifically, after completing basic matching, supplementary matching, and recommended matching following conflict resolution, the system integrates all matching results into a structured alignment report. This integration process covers key fields such as matching type, cluster number, stage source, geometric parameters (axial and circumferential center coordinates, length and width dimensions), depth information, intersection-over-union ratio, whether a match is recommended, and conflict information. It also incorporates other original attributes from the defect feature list to ensure the completeness and traceability of the output. Finally, all matched pairs, unmatched objects, and conflict resolution records are organized into a comprehensive matching result output, which can be directly used for subsequent analysis, visualization, or business decision-making, achieving a closed-loop delivery from raw detection to high-precision alignment results.
[0189] This application provides a method for aligning defect data detected within pipelines. Unlike existing research that devotes significant space to preliminary steps such as weld (pipe section) alignment, this application directly addresses the practical challenges encountered during defect alignment through in-depth design. Existing comparison methods generally suffer from a significant deficiency: they fail to consider the cross-pipe section matching requirements that may exist for circumferential weld anomalies. This design flaw leads to a situation in practical engineering applications where, due to labeling errors, the same circumferential weld anomaly is marked on two adjacent pipe sections in different inspection rounds. Existing methods lack a cross-pipe section matching mechanism, resulting in a technical gap in alignment processing in such cases, thus hindering the improvement of overall alignment rates. Regarding cluster defect processing, this application abandons the approach of simply clustering multiple defects into a single group for matching. Instead, it introduces intersection-union (IUU) as the core criterion, achieving accurate matching of complex relationships such as independent many-to-many, many-to-one, and one-to-many correspondences. This method makes the comparison relationships between defects clearer and more intuitive, while significantly improving the flexibility of defect bounding box matching. Based on the above alignment framework, this application further constructs a multi-priority optimal matching suggestion mechanism. This mechanism comprehensively considers key geometric and morphological features such as defect depth, cross area, and center distance to provide optimal matching suggestions for clustering. This not only enriches the information dimensions of the alignment results but also provides clear decision support for subsequent manual review, effectively reducing workload and improving analysis efficiency. Furthermore, for the multiple matching strategies that may be involved in the alignment process, this application assigns usage priorities to different matching results based on actual matching needs, ensuring the uniqueness and reliability of the final alignment results and avoiding the problem of conflicting conclusions that may result from multiple strategies operating in parallel.
[0190] The above detailed embodiments further illustrate the purpose, technical solution, and beneficial effects of the embodiments of this application. It should be understood that the above are merely specific embodiments of the embodiments of this application and are not intended to limit the protection scope of the embodiments of this application. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solutions of the embodiments of this application should be included within the protection scope of the embodiments of this application.
Claims
1. A method for aligning defect detection data inside a pipeline, characterized in that, include: Get the list of defect features; The defect feature list is used to store data to be aligned; Perform preprocessing operations on the data to be aligned; The preprocessing operation includes: acquiring the axial coordinates, angle parameters, and circumferential coordinates of the defect features; calculating a first matching cost based on the axial coordinates and angle parameters; combining any two defect features of the same type from the first defect feature list and the second defect feature list, and generating a first cost matrix based on the first matching cost; the rows and columns of the first cost matrix correspond to the defect features in the first defect feature list and the second defect feature list, respectively; the element values of the first cost matrix correspond to the matching cost of the combined defect features; solving the first cost matrix using the Hungarian algorithm to generate a first alignment result of the defect features; extending a preset length to both sides of the circumferential weld of the pipe under test as the center to obtain a virtual pipe section; acquiring the circumferential weld defect features within the virtual pipe section, and generating a second alignment result of the circumferential weld defect features based on the circumferential weld defect features; dividing a rectangular bounding box based on the defect features; the horizontal coordinate of the center coordinate of the rectangular bounding box is the axial coordinate of the defect feature, and the vertical coordinate of the center coordinate of the rectangular bounding box is the circumferential coordinate of the defect feature; the rectangular bounding box... The length is the axial length of the defect feature, and the width of the rectangular bounding box is the circumferential width of the defect feature. It is determined whether the rectangular bounding box crosses a boundary; if so, the rectangular bounding box is divided by the boundary to form rectangular sub-frames. The boundary is the straight line of the pipe under test at the 12 o'clock direction. Based on the first alignment result and the second alignment result, unmatched first and second rectangular sub-frames are determined. The intersection-union ratio (IUR) of the first and second rectangular sub-frames and the IUR of the second rectangular sub-frame are calculated. If the IUR is greater than a preset IUR threshold, the corresponding first and second rectangular sub-frames are added to the candidate set. The candidate set is deduplicated using column indexing to obtain a target candidate set. The first alignment result, the second alignment result, and the target candidate set are merged to obtain a target matching set. A bipartite graph is constructed based on the target matching set. The bipartite graph displays the number of matches between the first and second rectangular sub-frames. Based on the bipartite graph, the first and second rectangular sub-frames are matched to generate target alignment results.
2. The method for aligning defect detection data in a pipeline according to claim 1, characterized in that, The method further includes: verifying whether the column names of the defect feature list exist in the column index; the column names include: feature type, axial mileage, clock direction, length, width, and depth; if not, sending an invalid prompt message to the designated device and terminating the process; the designated device is an electronic device capable of receiving electronic information; if yes, converting the information corresponding to the column name into a string format and filling NaN values with empty strings; obtaining the number of empty strings and extracting the index number of the row where the empty strings are located; and generating a data integrity verification file based on the number of empty strings and the index number.
3. The method for aligning defect detection data in a pipeline according to claim 2, characterized in that, The step of obtaining the number of empty strings and extracting the index number of the row containing the empty strings includes: obtaining the number of first empty strings whose column name is the column containing the feature type and the axial mileage, and the index number of the row containing the first empty strings, generating a first list of empty space issues; obtaining a first target set record in the column containing the feature type; the first target set record includes: metal increase, metal corrosion, circumferential weld anomaly, straight weld anomaly, spiral weld anomaly, branch pipe, tee, suspected oil theft hole; obtaining the row containing the first target set record, generating a first subset; obtaining the number of second empty strings in the first subset whose column name is the column containing the clock direction, and the index number of the row containing the second empty strings, generating a second list of empty space issues; obtaining a second target set record in the column containing the feature type; the second target set record includes: metal corrosion, circumferential weld anomaly, straight weld anomaly, spiral weld anomaly; obtaining the row containing the second target set record, generating a second subset; obtaining the number of third empty strings in the second subset whose column name is the column containing the length, width, and depth, and the index number of the row containing the third empty strings, generating a third list of empty space issues.
4. The method for aligning defect detection data in a pipeline according to claim 3, characterized in that, The step of generating a data integrity verification file based on the number and index number of the empty strings includes: summarizing the first list of empty space issues, the second list of empty space issues, and the third list of empty space issues to generate a data integrity verification file.
5. The method for aligning defect detection data in a pipeline according to claim 1, characterized in that, The step of preprocessing the data to be aligned includes: calculating the difference between the center coordinates corresponding to the defect feature and the coordinates of the nearest upstream circumferential weld to obtain the axial coordinates of the defect feature; and calculating the angle parameters of the defect feature based on the clock position coordinates of the defect feature corresponding to the circumferential direction of the pipeline under test. The angle parameters are: In the formula, ( : The defect feature corresponds to the clock position coordinates in the circumferential direction of the pipe under test. The defect characteristics are characterized as corresponding to the axial length of the pipe under test; The defect feature is characterized as corresponding to the circumferential width of the pipe under test; based on the angle parameter, the circumferential coordinates of the defect feature are calculated; the circumferential coordinates are: In the formula, The outer diameter of the pipe to be tested corresponds to the defect feature.
6. The method for aligning defect detection data in a pipeline according to claim 1, characterized in that, The step of calculating the first matching cost based on the axial coordinates and the angle parameters includes: obtaining the target axial coordinates and target angle parameters of the defect features corresponding to the first and second defect feature lists under the same pipe section and the same type of defect features; calculating the distance cost based on the target axial coordinates; calculating the minimum angle difference between the target angle parameters in the clockwise or counterclockwise direction of the pipe to be tested; normalizing the minimum angle difference to obtain the angle cost; and calculating the first matching cost by weighting the distance cost and the angle cost according to a preset weight; the first matching cost is: total_cost = 0.5 × cost_dist + 0.5 × 0.15 × cost_angle; where cost_dist is the distance cost; cost_angle is the angle cost; and when the distance cost is greater than a preset distance threshold and the angle cost is greater than a preset angle threshold, the corresponding distance cost and angle cost are deleted.
7. The method for aligning defect detection data in a pipeline according to claim 1, characterized in that, The step of generating a second alignment result of the circumferential weld defect features based on the circumferential weld defect features includes: performing a preprocessing operation on the circumferential weld defect features; calculating a second matching cost based on the axial coordinates and the angle parameters; combining any two circumferential weld defect features of the same type from the first and second circumferential weld defect features, and generating a second cost matrix based on the second matching cost; and solving the second cost matrix using the Hungarian algorithm to generate the second alignment result of the circumferential weld defect features.
8. The method for aligning defect detection data in a pipeline according to claim 1, characterized in that, The step of calculating the intersection-union ratio of the first rectangular sub-frame and the second rectangular sub-frame includes: calculating the intersection area between the first rectangular sub-frame and the second rectangular sub-frame, and the total area of the first rectangular sub-frame and the second rectangular sub-frame; and calculating the intersection-union ratio of the first rectangular sub-frame and the second rectangular sub-frame based on the intersection area and the total area.
9. The method for aligning defect detection data in a pipeline according to claim 1, characterized in that, The step of matching the first rectangular sub-frame and the second rectangular sub-frame based on the bipartite graph to generate a target alignment result includes: if one first rectangular sub-frame matches multiple second rectangular sub-frames, then the second rectangular sub-frame with the largest corresponding depth is matched with the first rectangular sub-frame; if there are second rectangular sub-frames with the same depth, then the second rectangular sub-frame with the largest corresponding intersection-union ratio is matched with the first rectangular sub-frame; if multiple first rectangular sub-frames match one second rectangular sub-frame, then the first rectangular sub-frame with the largest corresponding depth is matched with the second rectangular sub-frame; if there are first rectangular sub-frames with the same depth, then the first rectangular sub-frame with the largest corresponding intersection-union ratio is matched with the second rectangular sub-frame; if multiple first rectangular sub-frames match multiple second rectangular sub-frames, then the second rectangular sub-frame with the largest corresponding depth is matched with the first rectangular sub-frame; and determining whether the second rectangular sub-frame is matched by multiple first rectangular sub-frames, if so, then using the intersection-union ratio and the center distance between the first rectangular sub-frame and the second rectangular sub-frame as a weighted arbitration to determine the target first rectangular sub-frame, so that the second rectangular sub-frame only matches one more first rectangular sub-frame.
10. A method for aligning defect detection data in a pipeline according to claim 9, characterized in that, The method further includes: generating an alignment report based on the target alignment result; the alignment report is used to display the matching objects, unmatched objects, and conflict resolution records of the defect features; the conflict resolution records correspond to the process of determining the target first rectangular sub-frame using weighted arbitration based on the intersection-union ratio and the center distance between the first rectangular sub-frame and the second rectangular sub-frame.
Citation Information
Patent Citations
Petroleum pipeline inner wall defect detection system
CN120468291A
Defect segmentation loss evaluation method based on space consistency optimization
CN121074078A