A process single-line chart weld opening AI identification method, medium and system
By employing dual-channel analysis and ant colony pheromone diffusion path tracing algorithms, the problem of inaccurate identification of weld joints in single-line diagrams of process pipelines under complex topology pipeline structures has been solved, achieving automated and high-precision weld joint identification and numbering.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA CONSTRUCTION INDUSTRIAL & ENERGY ENGINEERING GROUP CO LTD
- Filing Date
- 2026-03-26
- Publication Date
- 2026-07-07
Smart Images

Figure CN121904800B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of weld joint recognition technology, and more specifically, relates to an AI recognition method, medium and system for weld joints in a process single-line diagram. Background Technology
[0002] Process piping single-line diagrams are core design documents in engineering construction fields such as petrochemicals and power generation. Accurate identification and numbering of weld symbols are fundamental to welding management and quality traceability. Traditionally, weld identification relies on manual marking on paper or electronic drawings, with numbering done manually by engineers along the pipeline direction. With the development of computer vision technology, some systems have attempted to locate weld symbols using template matching or traditional target detection methods. However, these methods are sensitive to drawing quality, lack stability on scanned or slightly blurred drawings, and the overall inference of large-format PDF drawings places extremely high demands on video memory.
[0003] In existing technologies, current weld joint recognition systems, when dealing with complex pipeline topologies containing branches, merging points, or loops, lack the ability to perceive the global flow direction of the pipeline. This makes it difficult to arrange the detected weld joint candidate boxes sequentially according to engineering practices, relying on rules or manual intervention for numbering. Consequently, in scenarios with complex pipeline topologies, frequent omissions or disordered numbering occur. In other words, existing technologies suffer from the technical problem of failing to accurately identify weld joints on single-line diagrams of process pipelines in complex pipeline topologies. Summary of the Invention
[0004] In view of this, the present invention provides an AI recognition method, medium and system for weld joints in process single-line diagrams, which can solve the technical problem in the prior art that weld joints in process pipeline single-line diagrams cannot be accurately recognized under complex topology pipeline structures.
[0005] The present invention is implemented as follows: The first aspect of the present invention provides an AI recognition method for weld joints in a process single-line diagram, comprising the following steps:
[0006] The input process piping single-line diagram PDF file is parsed using a dual-channel method. The vector channel extracts the geometric information of the closed path, while the raster channel divides the page into tiles. The width ratio of the redundant overlapping area is set between adjacent tiles, and a global coordinate mapping table is generated.
[0007] The closed path geometric analysis results of the vector channel and the image tiles of the raster channel are respectively fed into the curvature-sensing weld detection model. The weld candidate boxes and candidate box confidence scores in each tile are output. Overlapping and redundant candidate boxes are eliminated by non-maximum suppression algorithm. The boxes are restored to the page coordinate system through the global coordinate mapping table to obtain the page-level weld candidate box set.
[0008] Based on the pipeline skeleton diagram, an ant colony pheromone diffusion path tracking algorithm is executed. Virtual ants start from the pipeline starting point and crawl along the pipeline skeleton diagram. They release marker pheromones at the corresponding nodes of each weld joint candidate box. After multiple rounds of cooperation, the pheromone concentration converges, and the weld joint sorting sequence is determined according to the arrival time of the pheromones.
[0009] Based on the confidence of candidate boxes in the page-level weld candidate box set, the ratio of the number of remaining boxes after non-maximum suppression to the number of initial candidate boxes, and the ratio of the convergence rounds to the maximum allowed rounds of the ant colony pheromone diffusion path tracking algorithm, the adaptive numbering confidence comprehensive score is calculated. Different numbering strategies are output to the system according to the interval to which the adaptive numbering confidence comprehensive score belongs. Automatic numbering is performed on the weld sorting sequence according to the user-defined numbering rules. Numbering labels are superimposed on the PDF layer to generate a weld information table that is bidirectionally associated with the drawing.
[0010] Automatic perspective correction is performed on the images of construction workers' certificates uploaded by mobile devices. The homography transformation matrix is calculated by detecting the four corner points of the certificate. The distorted image is restored to an orthophoto image and then sent to the character recognition module. The recognition results output by the character recognition module are automatically filled into the corresponding fields of the weld information table.
[0011] When a subcontractor submits a field change in the weld information table, it triggers an approval process. The system determines whether to re-execute the ant colony pheromone diffusion path tracing algorithm to verify the uniqueness of the weld based on the type of the changed field. After the approval is granted, the weld information table data is synchronized to the welding management platform.
[0012] Specifically, the dual-channel parsing involves the vector channel performing path geometry analysis on the vector layer of the process piping single-line diagram PDF file, extracting closed arc paths as candidate geometric elements for weld joints; and the raster channel dividing the process piping single-line diagram PDF file page into square tiles with a side length not exceeding 2048 pixels after rasterization at 300dpi. The output results of the vector channel and the raster channel are then fused with confidence weights in the global coordinate system.
[0013] Specifically, the redundant overlap region width ratio refers to the overlapping region of adjacent tiles in both the horizontal and vertical directions, where the pixel width corresponds to the redundant overlap region width ratio. The redundant overlap region width ratio is 15%.
[0014] Specifically, the global coordinate mapping table records the offset of the top-left pixel of each tile in the complete coordinate system of the single-line diagram PDF file of the process pipeline before tile segmentation. After detection, the local coordinates of the weld candidate box in each tile are added to the offset of the corresponding tile to restore them to page-level absolute coordinates.
[0015] Specifically, the curvature-aware weld detection model adopts an encoder-decoder architecture. The encoder consists of 12 stacked Transformer blocks, each containing a multi-head self-attention module, a curvature-aware bias injection module, and a feedforward network. The curvature-aware bias injection module superimposes a curvature a priori bias matrix obtained by linear projection of the local curvature map of the input image block onto the query-key dot product similarity matrix of each attention head. The local curvature map is described by the maximum eigenvalue field of the Hessian matrix.
[0016] The curvature-sensing weld detection model further includes: the output features of the encoder's 3rd, 6th, and 9th layers are spliced with the input of the corresponding decoder layer through skip connections to form a three-level cross-layer feature fusion path; the decoder performs multi-scale feature pyramid upsampling on the fused feature map and outputs weld candidate box prediction maps at three scales; the weld candidate box prediction maps enter the iterative refinement module to perform three bounding box regression iterations on the preliminary detection boxes.
[0017] Specifically, the non-maximum suppression algorithm sorts all candidate weld boxes output by the curvature-sensing weld detection model in descending order of candidate box confidence, calculates the intersection-union ratio (IUR) of the highest-ranked candidate weld box with all other candidate weld boxes, marks candidate weld boxes with IUR exceeding the IUR threshold as redundant boxes and deletes them. The IUR threshold is set to 0.4.
[0018] Specifically, the ant colony pheromone diffusion path tracking algorithm refines the pipeline skeleton graph into a single-pixel-width skeleton graph, constructs an adjacency graph with skeleton pixels as nodes, calculates the transition probability of each adjacent node according to the product of pheromone concentration and path length for each virtual ant, releases pheromone concentration increments that are inversely proportional to the total path length of this round when the virtual ant reaches the node corresponding to the weld joint candidate box, and performs a volatilization decay with a volatilization coefficient of 0.1 on the global pheromone after each round.
[0019] The formula for calculating the adaptive numbering confidence score is as follows: ,in The average confidence level of candidate boxes for the current batch of drawings. The confidence level is the normalized baseline value. This represents the ratio of the number of remaining candidate boxes after non-maximum suppression to the initial number of candidate boxes. This represents the ratio of the convergence rounds to the maximum allowed rounds in the ant colony pheromone diffusion path tracing algorithm. , , The weighting coefficients and .
[0020] Specifically, the step of outputting different numbering strategies to the system based on the interval to which the adaptive numbering confidence comprehensive score value belongs is when... A fully automatic numbering strategy is adopted at times; when When a low-confidence flag is overlaid on the automatically numbered result, a review prompt is sent to the operator; when The automatic numbering process is suspended and a manual verification request is sent to the operator. At the same time, the number of tile divisions in the current drawing is increased by one level, and the step of outputting the candidate weld frames in each tile is executed again.
[0021] Specifically, the automatic perspective correction involves detecting the pixel coordinates of the four corner points of the document, establishing a set of point pairs between the pixel coordinates of the four corner points and the corresponding target coordinates under a standard orthophoto view, and then solving a system of linear equations to obtain... homography transformation matrix Perform on each pixel in the distorted image The defined projection transformation maps the trapezoidal region of perspective distortion into a rectangular orthophoto image.
[0022] Specifically, the training dataset for the curvature-sensing weld detection model is established by collecting no fewer than 500 single-line process piping diagrams (PDFs) from different design institutes, covering both A0 and A1 sizes, as well as scanned copies and original PDFs. Engineers annotate the boundary boxes of the weld symbols one by one, and perform four types of data augmentation operations on the original images: random brightness shift, random Gaussian noise, random perspective transformation, and random blur kernel convolution. Each original drawing is augmented to generate 8 augmented samples.
[0023] Specifically, the training of the curvature-aware weld detection model involves initializing the encoder's Transformer block parameters with ImageNet pre-trained weights. The loss function consists of a weighted sum of the classification cross-entropy loss and the GIoU bounding box regression loss, with an initial weight ratio of 1:2. The AdamW optimizer is used, with an initial learning rate set to... Every 5 training rounds, decay by cosine annealing to [value missing]. The model was trained for 100 rounds, and the model weights corresponding to the highest mAP on the validation set were saved.
[0024] The curvature-sensing weld detection model also employs a sparse attention masking mechanism, which enables full attention calculation only for image block tokens near the pipeline skeleton region, while using local window attention for non-pipeline skeleton regions, in order to reduce the memory usage during large-format drawing inference.
[0025] Specifically, the approval process involves the system determining whether to re-execute the ant colony pheromone diffusion path tracing algorithm to verify the uniqueness of the weld joint based on the type of the changed field. After the approval is passed, the weld joint information table data is synchronized to the welding management platform.
[0026] Specifically, the iterative refinement module performs three bounding box regression iterations on the initial detection box, using the previous residual error as a condition input for each iteration, to calculate the position offset of the bounding box and gradually converge to the precise weld position.
[0027] A second aspect of the present invention provides a computer-readable storage medium storing program instructions, which, when executed in a computer, are used to perform the above-described method for AI recognition of weld joints in a single-line diagram of a process.
[0028] A third aspect of the present invention provides an AI recognition system for weld joints on a single-line process diagram, comprising the aforementioned computer-readable storage medium, wherein the system is a computer, the computer-readable storage medium is disposed within the system, and the system is provided with a microprocessor for executing program instructions stored in the computer-readable storage medium.
[0029] This invention employs a detection mechanism that combines dual-channel analysis with a curvature-sensing weld detection model, along with an ant colony pheromone diffusion path tracing algorithm to achieve weld sorting. This solves the technical problem that welds in single-line diagrams of process pipelines cannot be automatically, accurately, and sequentially consistent in their identification and numbering under complex topological pipeline structures.
[0030] This invention overcomes the shortcomings of single-channel detection stability under conditions of inconsistent drawing quality by using confidence-weighted fusion of vector and raster channels. The curvature-aware bias injection module encodes the geometric prior of the weld arc into the attention calculation process, enabling the detection model to generate stable activation of the arc structure without relying on the statistical regularity of a large number of samples. The sparse attention mask concentrates computational resources on the effective area of the pipeline skeleton, overcoming the bottleneck of limited video memory for large-format drawing inference. The ant colony pheromone diffusion path tracking algorithm, through the positive feedback accumulation and evaporation decay of pheromones, gives rise to the optimal traversal path consistent with the pipeline flow direction at the group level, making the weld sorting sequence naturally adaptable to branch pipeline networks with arbitrary topologies, without the need to design sorting rules separately for different layouts.
[0031] In summary, this invention solves the technical problem mentioned in the background art that the weld joints of single-line diagrams of process pipelines cannot be automatically, accurately, and sequentially consistently identified and numbered in complex pipeline topology structures. Attached Figure Description
[0032] Figure 1 This is a flowchart of the method of the present invention.
[0033] Figure 2 This is a histogram showing the confidence distribution of candidate weld boxes in a single-line diagram of a process pipeline.
[0034] Figure 3This is a line graph showing the convergence process of the ant colony pheromone diffusion path tracing algorithm with branch pipeline topology. Detailed Implementation
[0035] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below.
[0036] like Figure 1 The diagram shown is a flowchart of a process single-line diagram weld joint AI recognition method provided by the first aspect of the present invention. This method includes the following steps:
[0037] S01. Start dual-channel parsing on the input process piping single-line diagram PDF file. The vector channel extracts the geometric information of the closed path, and the raster channel performs tiled segmentation of the page. The width ratio of redundant overlapping areas is set between adjacent tiles to generate a global coordinate mapping table.
[0038] S02. The closed path geometric analysis results of the vector channel and the image tiles of the raster channel are respectively fed into the curvature-sensing weld detection model. The weld candidate boxes and candidate box confidence scores in each tile are output. Overlapping and redundant candidate boxes are eliminated by non-maximum suppression algorithm. The boxes are restored to the page coordinate system through the global coordinate mapping table to obtain the page-level weld candidate box set.
[0039] S03. Based on the pipeline skeleton diagram, execute the ant colony pheromone diffusion path tracking algorithm. Virtual ants start from the pipeline starting point and crawl along the pipeline skeleton diagram. They release marker pheromones at the corresponding nodes of each weld candidate box. After multiple rounds of cooperation, the pheromone concentration converges. The weld sorting sequence is determined according to the arrival time of the pheromones.
[0040] S04. Based on the confidence of candidate boxes in the page-level weld candidate box set, the ratio of the number of remaining boxes after non-maximum suppression to the number of initial candidate boxes, and the ratio of the convergence rounds to the maximum allowed rounds of the ant colony pheromone diffusion path tracking algorithm, calculate the comprehensive score of adaptive numbering confidence. Output different numbering strategies to the system according to the interval to which the comprehensive score of adaptive numbering confidence belongs. Perform automatic numbering on the weld sorting sequence according to the user-defined numbering rules, overlay numbering labels on the PDF layer, and generate a weld information table that is bidirectionally associated with the drawing.
[0041] S05. Perform automatic perspective correction on the construction worker ID card images uploaded by the mobile terminal, calculate the homography transformation matrix using the four corner points of the ID card, restore the distorted image to an orthophoto image, and then send it to the character recognition module. The recognition results output by the character recognition module are automatically filled into the corresponding fields of the weld information table.
[0042] S06. Changes to fields submitted by subcontractors in the weld information table trigger the approval process. The system determines whether to re-execute the ant colony pheromone diffusion path tracing algorithm in S03 to verify the uniqueness of the weld based on the type of the changed field. After the approval is passed, the weld information table data is synchronized to the welding management platform.
[0043] The specific meaning of the dual-channel analysis is as follows: the vector channel performs path geometry analysis on the vector layer of the process piping single-line diagram PDF file and extracts closed arc paths as candidate geometric elements for welds; the raster channel rasterizes the process piping single-line diagram PDF file page at 300dpi and divides it into square tiles with a side length of no more than 2048 pixels. Adjacent tiles retain overlapping areas corresponding to the pixel width of the redundant overlapping area in both the horizontal and vertical directions. The output results of the vector channel and the raster channel are weighted and fused in the global coordinate system to generate a set of page-level weld candidate boxes. The width ratio of the redundant overlapping area is obtained in the following way: on a test set containing 200 A0-size drawings from different design institutes, the overlap ratio is gradually increased from 5% to 30% in 5% increments. The number of missed detections caused by the truncation of weld symbols is counted, and the curve of the missed detection rate changing with the overlap ratio is plotted. The minimum overlap ratio corresponding to the first drop of the missed detection rate to below 1% is taken. After 3 rounds of independent experiments, the average value is taken, and the width ratio of the redundant overlapping area is determined to be 15%.
[0044] The specific structure of the curvature-aware weld detection model is as follows: the model adopts an encoder-decoder architecture. The encoder consists of 12 stacked Transformer blocks, each containing a multi-head self-attention module, a curvature-aware bias injection module, and a feedforward network. The curvature-aware bias injection module superimposes a curvature a priori bias matrix onto the query-key dot product similarity matrix of each attention head. The curvature a priori bias matrix is obtained by linearly projecting the local curvature map of the input image block. The local curvature map uses the maximum eigenvalue field of the Hessian matrix to describe the curvature of the curve at each pixel in the image, enabling the curvature-aware weld detection model to generate a stronger activation response to the arc structure region when calculating the attention weights. The output features of layers 3, 6, and 9 of the encoder are directly concatenated with the input of the corresponding decoder layer through skip connections, forming a three-level cross-layer feature fusion path that combines shallow edge features with deep semantic features. The decoder performs multi-scale feature pyramid upsampling on the fused feature map and outputs weld joint candidate box prediction maps at three scales. The weld joint candidate box prediction maps enter the iterative refinement module, which performs three bounding box regression iterations on the preliminary detection boxes. Each iteration uses the previous residual error as a conditional input to calculate the position offset of the bounding box, gradually converging to the precise weld joint position. The sparse attention masking mechanism only enables full attention calculation for image block tokens near the pipeline skeleton region, and uses local window attention for non-pipeline skeleton regions, reducing the memory usage during large-format drawing inference. The technical advantages of the curvature-aware weld detection model are as follows: Curvature-aware bias directly encodes the geometric prior of the weld circle into the attention calculation process, enabling the curvature-aware weld detection model to generate stable feature activation for arc structures without relying on a large number of samples, thus improving detection stability in scenarios with inconsistent drawing quality and large differences in weld symbol size; Skip connections retain shallow edge information, avoiding excessive smoothing of the edge information of the small weld circle during deep feature extraction; The iterative refinement module gradually corrects the positioning deviation through multiple rounds of regression with residual conditionalization, making the final output weld coordinate accuracy better than the result of a direct single regression; Sparse attention mask concentrates computational resources in the effective area of the pipeline skeleton, enabling the reasoning process of large-format drawings to run stably under memory-constrained conditions.
[0045] The specific steps for establishing the training dataset for the curvature-aware weld detection model include: collecting no fewer than 500 PDFs of single-line process piping diagrams from different design institutes, covering A0 and A1 sizes, and including both scanned copies and original PDFs, with drawing quality ranging from clear to slightly blurry; having engineers annotate the bounding boxes of weld symbols in each drawing; and performing four types of data augmentation operations on the original images: random brightness shift, random Gaussian noise, random perspective transformation, and random blur kernel convolution, expanding each original drawing to generate 8 augmented samples, thus forming the training dataset for the curvature-aware weld detection model.
[0046] The training steps of the curvature-aware weld detection model specifically include: initializing the encoder's Transformer block parameters with ImageNet pre-trained weights; randomly initializing the curvature-aware bias injection module and the iterative refinement module; the loss function is composed of a weighted sum of the classification cross-entropy loss and the GIoU bounding box regression loss, with an initial weight ratio of 1:2. This 1:2 ratio is determined by searching the range of 0.5 to 3.0 on the validation set with a step size of 0.1 and taking the point with the highest F1 score; and using the AdamW optimizer with an initial learning rate set to... Every 5 training rounds, decay by cosine annealing to [value missing]. The training process consists of 100 rounds. After each round, the mAP is calculated on the validation set, and the curvature-sensing weld detection model weight corresponding to the highest mAP is saved.
[0047] The formula for calculating the adaptive numbering confidence score is as follows: ;in The confidence score is an adaptive numbering system score, dimensionless. The average candidate bounding box confidence level for the current batch of drawings, dimensionless. The confidence level is a normalized baseline value, dimensionless, and takes the value of 0.9. This 0.9 is determined by statistically analyzing the mean of the confidence level distribution of candidate bounding boxes corresponding to high-quality detection results on 200 marked drawings. The ratio of the number of remaining boxes after non-maximum suppression to the initial number of candidate boxes is dimensionless. The ratio of the convergence rounds to the maximum allowed rounds in the ant colony pheromone diffusion path tracing algorithm is dimensionless. , , These are three weighted coefficients, dimensionless, and The , , By traversing the validation set using a grid search , , And satisfy Of all combinations, the combination with the highest accuracy in weld joint numbering was selected, and the average value was determined after three rounds of independent experiments; the comprehensive score of adaptive numbering confidence was used. When the system uses a fully automatic numbering strategy, it directly outputs the numbering results; when the adaptive numbering confidence score is... When the system automatically assigns a low-confidence flag to the numbering result, it sends a review prompt to the operator; when the adaptive numbering confidence score is... At this time, the system suspends the automatic numbering process and sends a manual verification request to the operator. At the same time, it increases the number of tile divisions in the current drawing by one level from the default value and re-executes S02.
[0048] The specific implementation of the ant colony pheromone diffusion path tracing algorithm is as follows: the pipeline skeleton graph is refined into a single-pixel-width skeleton graph, and an adjacency graph is constructed using the skeleton pixels as nodes; during initialization, the pheromone concentration of each skeleton edge is set to a uniform initial pheromone concentration value. The uniform initial pheromone concentration value The fastest convergence value was determined by searching the range of 0.1 to 1.0 on 50 drawings with a step size of 0.1. Each virtual ant starts from the pipeline origin and calculates the transition probability of each adjacent node according to the product of pheromone concentration and the reciprocal of path length. When the virtual ant reaches the node corresponding to the weld joint candidate box, it releases an increase in pheromone concentration at that node. The pheromone, the concentration increment The pheromone is inversely proportional to the total path length of the virtual ant in this round; after each round, the global pheromone undergoes evaporation decay, with the evaporation coefficient... The value is set to 0.1. This 0.1 is determined by searching 100 drawings containing branch pipelines with a step size of 0.05 from 0.05 to 0.5, selecting the value corresponding to the highest path coverage completeness, and then taking the average value after 5 rounds of cross-validation. After multiple iterations, the pheromone concentration distribution is stable, and the weld joint candidate box corresponding to the node along the optimal path is output as a weld joint sorting sequence according to the first arrival time of the virtual ants. The technical effect of the ant colony pheromone diffusion path tracking algorithm is as follows: Traditional weld joint numbering relies on manual labeling along the pipeline direction, which is prone to omissions or disordered order when there are branches, merging, or loops in the pipeline; the ant colony pheromone diffusion path tracking algorithm decomposes the global path optimization process into local decision-making by multiple virtual ants. Through the positive feedback accumulation and volatilization decay of pheromones, the optimal traversal path that conforms to the pipeline flow direction emerges at the group level, making the weld joint sorting sequence naturally consistent with the flow direction of engineering practice, and can adaptively handle branch pipeline networks with arbitrary topologies without designing separate sorting rules for different pipeline layouts.
[0049] The homography transformation matrix specifically means: for an image of a construction worker's identification document captured by a mobile device, the pixel coordinates of the four corner points of the document are detected; a set of point pairs is established by comparing the pixel coordinates of the four corner points with the corresponding target coordinates under a standard orthophoto view; and the result is obtained by solving a system of linear equations. homography transformation matrix Perform on each pixel in the distorted image The defined projection transformation maps the trapezoidal region with perspective distortion into a rectangular orthophoto image, eliminating text distortion caused by handheld shooting angle deviation before sending it to the character recognition module.
[0050] The specific meaning of the non-maximum suppression algorithm is as follows: For all weld candidate boxes output by the curvature-aware weld detection model, they are sorted in descending order of candidate box confidence. The intersection-union ratio (IUR) of the highest-ranked weld candidate box with all other weld candidate boxes is calculated sequentially. Weld candidate boxes with IUR exceeding the IUR threshold are marked as redundant boxes and deleted. The above process is repeated until there are no more weld candidate boxes. The remaining weld candidate boxes are the deduplicated page-level weld candidate box set. The IUR threshold is 0.4. The 0.4 is determined by progressively searching on the annotated drawing with a step size of 0.05 from 0.3 to 0.6, taking the highest corresponding value of the harmonic mean of recall and precision, and then taking the average value after 5 rounds of cross-validation.
[0051] Specifically, the global coordinate mapping table means that before tile segmentation, the offset of the top left pixel of each tile in the complete coordinate system of the single-line diagram PDF file of the process pipeline is recorded. After detection, the local coordinates of the weld candidate box in each tile are added to the offset of the corresponding tile, and uniformly restored to the page-level absolute coordinates. This ensures that the coordinates of the weld candidate boxes from different tiles are subjected to non-maximum suppression and weld sorting sequence generation in the same coordinate system.
[0052] The specific implementation of step S01 is as follows: For the input process piping single-line diagram PDF file, the system simultaneously starts a parallel parsing process with both the vector channel and the raster channel. The vector channel performs path geometry analysis on the vector layer of the PDF file, traversing all path elements and extracting paths that satisfy the closed arc condition as candidate geometric elements for weld joints. This process utilizes the precise coordinate information of the PDF vector structure and is unaffected by image noise. The raster channel rasterizes the PDF page into a bitmap at a resolution of 300 dpi, and then divides the page into square tiles with a side length of no more than 2048 pixels. Adjacent tiles retain a redundant overlap area of 15% pixel width in both the horizontal and vertical directions to prevent the weld joint symbol from being truncated when it is located exactly at the tile boundary, resulting in missed detection. This overlap ratio is determined by progressively searching on a test set of 200 A0-size drawings with a step size of 5%, taking the minimum value where the missed detection rate is first lower than 1%, and averaging it after 3 rounds. Before tile-based segmentation, the system records the offset of the top-left pixel of each tile in the full page coordinate system and establishes a global coordinate mapping table to provide a basis for restoring the tile-level local detection results to the page-level absolute coordinates.
[0053] The specific implementation of step S02 is as follows: The geometric analysis results of the vector closed path output in step S01 and the images of each grating tile are input into the curvature-aware weld detection model. The curvature-aware weld detection model adopts an encoder-decoder architecture. The encoder consists of 12 stacked Transformer blocks. Each Transformer block has a curvature a priori bias matrix superimposed on the query-key dot product similarity matrix of the standard multi-head self-attention module. This bias matrix is obtained by linearly projecting the local curvature map of the input image block. The local curvature map uses the maximum eigenvalue field of the Hessian matrix to quantify the curvature of the curve at each pixel, enabling the model to generate a stronger activation response to the arc structure region when calculating the attention weight. The output features of layers 3, 6, and 9 of the encoder are spliced with the corresponding decoder layer inputs through skip connections to form a three-level cross-layer feature fusion path, preserving shallow edge details. The decoder outputs weld candidate box prediction maps at three scales, which then enter the iterative refinement module. The bounding box regression is performed three times with the previous residual error as the conditional input, gradually converging to the accurate weld position. Meanwhile, the sparse attention masking mechanism only performs full attention calculation on image patches near the pipeline skeleton region, while using local window attention in other regions, effectively reducing the memory usage for large-format drawing inference. After the model outputs the candidate boxes and confidence scores for weld joints within each tile, all candidate boxes are sorted in descending order of confidence score using a non-maximum suppression algorithm. The intersection-union ratio (IUR) of the highest confidence box with the remaining boxes is calculated sequentially, and boxes with an IUR exceeding 0.4 are marked as redundant and deleted. This threshold is determined by searching the annotated drawing in steps of 0.05 from 0.3 to 0.6, taking the highest corresponding value of the harmonic mean of recall and precision, and performing five rounds of cross-validation. The coordinates of the deduplicated candidate boxes are added to the corresponding tile offset in the global coordinate mapping table to restore the page-level absolute coordinates, forming a page-level set of weld joint candidate boxes.
[0054] The specific implementation of step S03 is as follows: Based on the pipeline skeleton graph, the pipeline skeleton graph is first refined into a skeleton graph with a single pixel width. An adjacency graph is constructed with skeleton pixels as nodes, and the edge weight is determined by the reciprocal of the path length. During initialization, the pheromone concentration of each skeleton edge is set to a uniform initial value. This value is determined by searching for the fastest convergence value in the range of 0.1 to 1.0 on 50 drawings with a step size of 0.1. Each virtual ant starts from the pipeline starting point and calculates the transition probability of each adjacent node based on the product of pheromone concentration and path length, and selects the next hop node for crawling based on probability; when the virtual ant reaches the node corresponding to the weld joint candidate box, it releases a concentration increment inversely proportional to the total path length of this round. The shorter the path, the higher the concentration of pheromones released by the virtual ants, thus positively reinforcing the superior path. After each round of traversal of all virtual ants, a volatile coefficient is applied to the global pheromone levels. The pheromone concentration attenuation value is determined by searching 100 drawings of branched pipelines in increments of 0.05 from 0.05 to 0.5, selecting the value with the highest path coverage completeness, and performing five rounds of cross-validation. After multiple iterations, the pheromone concentration distribution stabilizes and converges. The weld joint candidate box nodes along the optimal path are output as a weld joint sorting sequence according to the first arrival time of the virtual ants. This sequence is naturally consistent with the pipeline flow direction and can adaptively handle pipeline networks with arbitrary topologies containing branches, merging, and loops.
[0055] The specific implementation of step S04 is as follows: based on the average candidate box confidence level in the page-level weld joint candidate box set. The ratio of the number of remaining boxes after non-maximum suppression to the number of initial candidate boxes. The ratio of the convergence rounds to the maximum allowed rounds in the ant colony pheromone diffusion path tracing algorithm According to the formula Calculate the adaptive numbering confidence score. The confidence level normalized baseline value Take 0.9 as the weighting coefficient. , , Determined by grid search of the validation set and satisfying .when When the system uses a fully automatic numbering strategy, it directly outputs the numbering results; when... When the system automatically assigns a low-confidence flag to the result and sends a review prompt to the operator; when At this point, the system suspends the automatic numbering process and sends a manual verification request to the operator. Simultaneously, it increases the tile segmentation count of the current drawing by one level and re-executes step S02 to improve detection accuracy with finer-grained segmentation. After confirming the numbering strategy, it automatically numbers the weld joints according to the user-defined numbering rules, overlays the numbering annotations on the corresponding layer in the PDF, and generates a weld joint information table that is bidirectionally linked to the drawing, thus achieving a correspondence between the numbering results and the drawing.
[0056] The specific implementation of step S05 is as follows: For the construction worker ID image uploaded by the mobile terminal, the system first performs automatic perspective correction, detects the pixel coordinates of the four corner points of the ID, establishes a set of point pairs with the corresponding target coordinates under the standard orthophoto view, and obtains the result by solving a system of linear equations. homography transformation matrix Perform on each pixel in the distorted image The defined projection transformation maps the trapezoidal region with perspective distortion into a rectangular orthophoto image, eliminating text distortion caused by handheld shooting angle deviation. The orthophoto image is then sent to the character recognition module, which recognizes key fields such as name and document number on the document. The recognition results are automatically filled into the corresponding fields in the weld information table, avoiding errors introduced by manual data entry.
[0057] The specific implementation of step S06 is as follows: The field change event submitted by the subcontractor in the weld information table triggers the approval process. The system determines whether the ant colony pheromone diffusion path tracing algorithm needs to be re-executed based on the type of the changed field. If the change involves the weld location or pipeline connection relationship, the ant colony pheromone diffusion path tracing algorithm is re-executed to verify the uniqueness of the weld and prevent duplicate or missing numbers due to field changes. After the review is approved, the system synchronizes the weld information table data to the welding management platform to complete the data closure of the entire process.
[0058] It should be noted that the key technologies of this invention include: a curvature-aware bias injection mechanism that quantifies the geometric prior of the weld arc in the form of the maximum eigenvalue field of the Hessian matrix and injects it directly in the form of a bias matrix during the attention calculation stage. This ensures the model's activation response to the arc structure at the mechanism level, rather than relying on statistical induction from a large number of samples, thus maintaining stable detection capabilities under conditions of varying drawing quality; an ant colony pheromone diffusion path tracking algorithm that decomposes the global path optimization problem into local transfer decisions of multiple virtual ants, strengthening high-quality paths through pheromone positive feedback accumulation and suppressing local optima through evaporation attenuation, ensuring that the weld sorting sequence remains consistent with the pipeline flow direction at the population emergence level, without the need for separate rule design for different topologies; and a dual-channel confidence-weighted fusion that complements the geometric accuracy of the vector layer with the visual perception capability of the raster layer, covering the quality differences between native PDFs and scanned documents. The synergistic effect of these three mechanisms simultaneously improves detection accuracy, sorting consistency, and adaptability to diverse drawing sources. No single mechanism can independently achieve complete end-to-end automation.
[0059] It should be noted that this invention also solves the following technical problems: In mobile construction sites, the input of construction personnel's certificate information relies on manual copying or manual photography followed by secondary input. Perspective distortion introduced by handheld shooting leads to a decrease in the accuracy of the character recognition module, and incorrectly entered personnel information is difficult to reliably bind to the weld information table. This invention detects the coordinates of the four corner points of the certificate image uploaded from the mobile device, and uses a homography transformation matrix to restore the trapezoidal area of perspective distortion into an orthographic rectangular image. This eliminates the text distortion introduced by the shooting angle deviation from a geometric transformation perspective, and then sends the image to the character recognition module. This allows the recognition module to complete character extraction with higher feature matching accuracy when receiving geometrically regular image input. The recognition result is automatically filled into the weld information table, thus solving the technical problems of insufficient character recognition accuracy and unreliable input of personnel information into the weld information table due to perspective distortion in mobile certificate images.
[0060] A second aspect of the present invention provides a computer-readable storage medium storing program instructions, which, when executed in a computer, are used to perform the above-described method for AI recognition of weld joints in a single-line diagram of a process.
[0061] A third aspect of the present invention provides an AI recognition system for weld joints in a process single-line diagram, comprising the aforementioned computer-readable storage medium. The system is any one of a computer, a server, or a microcontroller. The computer-readable storage medium is disposed within the system, and the system is provided with a microprocessor that executes the program instructions stored in the computer-readable storage medium.
[0062] Specifically, the principle of this invention is:
[0063] The fundamental reason why this invention can solve the aforementioned core technical problems lies in the organic combination of three mechanisms: weld geometry prior, multi-channel information fusion, and swarm intelligence path optimization. The curvature-aware bias injection module directly introduces a local curvature map based on the maximum eigenvalue field of the Hessian matrix during the attention calculation stage, automatically enhancing the attention weight at the arc structure. This ensures the stability of the feature activation of the weld symbol from a mechanism perspective, without relying on statistical compensation of data distribution. Dual-channel parsing integrates the geometric accuracy of the vector path with the visual perception capability of the raster image, allowing the two types of information to complement each other and effectively covering the differences between the original PDF and scanned drawings. The ant colony pheromone diffusion path tracking algorithm transforms the global optimal path problem into local transfer decisions by multiple virtual ants. The positive feedback mechanism of pheromones strengthens high-quality paths, and the evaporation attenuation mechanism suppresses local optimal traps, ultimately resulting in a globally optimal traversal sequence that conforms to the pipeline flow direction. From an algorithmic structure perspective, this ensures the logical consistency of weld sorting under any topology. The synergy of these three mechanisms allows the solution of this invention to logically and completely cover the entire technical requirements from weld detection to sequential numbering.
[0064] The following provides a specific embodiment 1 of the present invention, and the specific implementation of each step in this embodiment 1 is described in detail below.
[0065] The specific implementation of step S01 is as follows: Dual-channel parsing is initiated on the input process piping single-line diagram PDF file. The vector channel performs path geometry analysis on the vector layers in the PDF file, extracting closed arc paths as candidate geometric elements for weld joints; the raster channel rasterizes the PDF page at 300dpi and divides it into square tiles with a side length not exceeding 2048 pixels, retaining the width ratio of redundant overlapping areas in both the horizontal and vertical directions for adjacent tiles. The overlapping area corresponding to the pixel width. The following experimental steps were used to determine the overlap ratio: On a test set containing 200 A0-size drawings from different design institutes, the overlap ratio was gradually increased from 5% to 30% in increments of 5%. The number of missed detections due to truncated weld symbols was counted, and a curve showing the change in the missed detection rate as a function of the overlap ratio was plotted. The minimum overlap ratio corresponding to the first drop in the missed detection rate below 1% was taken. The average value was calculated after three rounds of independent experiments to determine the overlap ratio. The percentage is 15%. Before tiled segmentation, the offset of the top-left pixel of each tile in the full coordinate system of the PDF page is recorded to form a global coordinate mapping table, which is used in subsequent steps to restore the local coordinates to page-level absolute coordinates. The output results of the vector channel and the raster channel are fused with confidence weight in the global coordinate system, and the overall confidence score after fusion is... The formula is expressed as follows:
[0066] ;
[0067] In the formula, The overall confidence level after fusing the vector channel and the grating channel is dimensionless. The confidence score of the candidate boxes output by the vector channel is dimensionless. The confidence level of the candidate boxes output by the raster channel is dimensionless. This is a normalized confidence level reference value, dimensionless, with an empirical value of 1.0. The fusion weights for vector channels are dimensionless. The fusion weights for the grating channels are dimensionless. and The sum is typically 1, and the two values are determined by the highest combination of the harmonic mean of recall and precision on the validation set. The fusion generates a page-level set of candidate weld boxes.
[0068] The specific implementation of step S02 is as follows: The closed path geometric analysis results of the vector channel and the image tiles of the raster channel are respectively fed into the curvature-aware weld detection model. This model adopts an encoder-decoder architecture. The encoder consists of 12 stacked Transformer blocks, each containing a multi-head self-attention module, a curvature-aware bias injection module, and a feedforward network. The curvature-aware bias injection module superimposes a curvature a priori bias matrix onto the query-key dot product similarity matrix of each attention head. , The image is obtained by linear projection of the local curvature map of the input image patch, using the Hessian matrix. Maximum eigenvalue field Describes the curvature of the curve at each pixel, where The matrix representing the second-order partial derivatives of the image grayscale values with respect to pixel coordinates is expressed by the following formula:
[0069] ;
[0070] In the formula, Image at pixel position The grayscale value at that location is dimensionless. , These are the horizontal and vertical coordinates of a pixel, in pixels. for A real symmetric matrix whose elements are right , The second partial derivative of , in units of It describes the curvature distribution of gray levels within the neighborhood of a pixel. Pick The larger of the two feature values reflects the maximum curvature of the curve at that pixel, measured in units of... ; the first a priori bias matrix Depend on The field-learnable linear projection layer is mapped to a matrix of the same dimension as the attention score matrix and then superimposed, enabling the model to produce a stronger activation response to circular arc structure regions. This is a dimensionless matrix. The output features of layers 3, 6, and 9 of the encoder are directly concatenated with the inputs of the corresponding decoder layers via skip connections, forming a three-level cross-layer feature fusion path. The decoder performs multi-scale feature pyramid upsampling on the fused feature map, outputting weld joint candidate box prediction maps at three scales. The prediction maps enter the iterative refinement module, performing three bounding box regression iterations on the initial detection boxes. The next iteration is based on the first... residual error of the second time As a conditional input, calculate the bounding box position offset. The formula is expressed as follows:
[0071] ;
[0072] In the formula, For the first The position offset vector for the next iteration. The unit is pixels. For the first The bounding box coordinate vector output by the next iteration, in pixels. For the first The residual error vector of the next iteration, in pixels. For The regression subnetwork has parameters, with both input and output in pixels. The set of learnable parameters for the regression subnetwork is determined through optimization during the training process. The sparse attention masking mechanism only enables full attention computation for image patches near the pipeline skeleton region; local window attention is used for non-pipeline skeleton regions, reducing memory usage during large-format drawing inference. After the model outputs candidate weld boxes and their confidence scores for each tile, overlapping and redundant candidate boxes are eliminated using a non-maximum suppression algorithm. The non-maximum suppression algorithm sorts all candidate boxes in descending order of confidence score and calculates the intersection-union ratio (IUU) of the highest-ranked candidate box with the remaining candidate boxes. ,Will Exceeding the crossover ratio threshold The candidate boxes are marked as redundant and deleted. This process is repeated until no more candidate boxes are available. and For candidate box index, The empirical value is 0.4. This value is determined by progressively searching for the highest corresponding value of the harmonic mean of recall and precision on the annotated drawings with a step size of 0.05 from 0.3 to 0.6, and taking the average after 5 rounds of cross-validation. Subsequently, the local coordinates of the candidate boxes within each tile are restored to the page coordinate system by adding the corresponding tile offset using a global coordinate mapping table, resulting in a set of page-level weld joint candidate boxes. For the training dataset, at least 500 single-line process piping diagrams (PDFs) from different design institutes were collected, covering A0 and A1 sizes, as well as both scanned copies and original PDFs. Engineers annotated the weld joint symbols and bounding boxes one by one. Four types of data augmentation operations—random brightness shift, random Gaussian noise, random perspective transformation, and random blur kernel convolution—were performed on the original images, generating 8 augmented samples for each original drawing. In the training steps, the encoder Transformer block parameters were initialized with ImageNet pre-trained weights, and the curvature-aware bias injection module and iterative refinement module were randomly initialized; the loss function... Classification cross-entropy loss GIoU bounding box regression loss The weighted summation is expressed by the following formula:
[0073] ;
[0074] In the formula, Total training loss, dimensionless For classification cross-entropy loss, dimensionless The GIoU bounding box regression loss is dimensionless. These are the classification loss weights, dimensionless. The regression loss weight coefficients are dimensionless, representing the initial weight ratio. This ratio is determined by searching the range of 0.5 to 3.0 on the validation set with a step size of 0.1 to find the highest F1 score. The AdamW optimizer is used, with an initial learning rate of [value missing]. Every 5 training rounds, decay by cosine annealing to [value missing]. The training process is repeated for 100 rounds. After each round, the mAP is calculated on the validation set, and the model weight corresponding to the highest mAP is saved.
[0075] The specific implementation of step S03 is as follows: An ant colony pheromone diffusion path tracing algorithm is executed based on the pipeline skeleton graph. First, the pipeline skeleton graph is refined into a single-pixel-width skeleton graph, and an adjacency graph is constructed using the skeleton pixels as nodes. ,in It is a set of skeleton pixel nodes. This is the set of edges between adjacent nodes. Each skeleton edge is initialized during this process. The pheromone concentration is set to a uniform initial pheromone concentration value. , The value was determined by searching the range of 0.1 to 1.0 on 50 drawings with a step size of 0.1 and finding the value with the fastest convergence speed. This is a dimensionless quantity. Each virtual ant starts from the pipeline origin and calculates the transition probability of each adjacent node based on the product of the pheromone concentration and the reciprocal of the path length. The transition probability formula is expressed as follows:
[0076] ;
[0077] In the formula, For the first Virtual ants from nodes Transfer to node The probability, dimensionless For the edge The current pheromone concentration, dimensionless For nodes With nodes The Euclidean distance between them, in pixels This is a path length normalization reference value, in pixels, with an empirical value of 1 pixel, used for elimination. Dimensionality ensures that the transition probability remains dimensionless. The heuristic weight for pheromone concentration is dimensionless, with an empirical value of 1, and can be adjusted within the range of 1 to 5. The power-law weight of the path length heuristic factor is dimensionless, with an empirical value of 2, and can be adjusted within the range of 1 to 5. For the first Only virtual ants on the node The set of accessible adjacent nodes Number the virtual ants by index Indexing adjacent nodes For nodes With adjacent nodes The Euclidean distance between them, in pixels. When the virtual ant reaches the node corresponding to the weld joint candidate box. At that time, the concentration increment is released at that node. pheromones, Total path length in this round They are inversely proportional, as expressed by the formula below:
[0078] ;
[0079] In the formula, The increment of pheromone concentration in a single event is dimensionless. This is the pheromone intensity coefficient, dimensionless, with an empirical value of 1. It can be adjusted within the range of 0.1 to 10 based on the weld density in the drawing. For the first The total path length of the virtual ant in this round is expressed in pixels. This is a normalized reference value for the path length, in pixels, and is related to the transition probability formula. The meaning is consistent, used to... Treat it as a dimensionless quantity, thereby... Maintain dimensionless properties. At the end of each round, global pheromones undergo evaporation decay, updated using the following formula:
[0080] ;
[0081] In the formula, The volatility coefficient is dimensionless and has an empirical value of 0.1. This value was determined by searching 100 drawings containing branch pipelines in increments of 0.05 from 0.05 to 0.5 to find the value corresponding to the highest path coverage completeness, and then averaging the results after 5 rounds of cross-validation. For the first Only virtual ants are on the edge in this round. The increment of pheromones released is dimensionless, and its value is the amount of pheromone released when the ant passes through the edge. The time allocated Quantity, and The dimensions are consistent. After multiple iterations, the pheromone concentration distribution stabilizes, and the weld joint candidate box nodes along the optimal path are output as a weld joint sorting sequence according to the arrival time of the first virtual ant.
[0082] The specific implementation of step S04 is as follows: Based on the confidence of candidate boxes in the page-level weld joint candidate box set, the ratio of the number of remaining boxes after non-maximum suppression to the initial number of candidate boxes, and the ratio of the convergence rounds to the maximum allowed rounds of the ant colony pheromone diffusion path tracing algorithm, the adaptive numbering confidence comprehensive score is calculated, and the formula is expressed as follows:
[0083] ;
[0084] In the formula, The confidence score is an adaptive numbering system score, dimensionless. The average candidate bounding box confidence level for the current batch of drawings, dimensionless. The confidence level is a normalized baseline value, dimensionless, with an empirical value of 0.9. It is determined by statistically analyzing the mean of the confidence level distribution of candidate bounding boxes corresponding to high-quality detection results on 200 annotated drawings. The ratio of the number of remaining boxes after non-maximum suppression to the initial number of candidate boxes is dimensionless. The ratio of the convergence rounds to the maximum allowed rounds in the ant colony pheromone diffusion path tracing algorithm is dimensionless. , , These are three weighted coefficients, dimensionless, and By traversing the validation set using a grid search method , , And satisfy Of all combinations, the combination with the highest accuracy in weld joint numbering was selected, and the average value was taken after three rounds of independent experiments to determine the final result. When the system uses a fully automatic numbering strategy, it directly outputs the numbering results; when... When the system automatically assigns a low-confidence flag to the result and sends a review prompt to the operator; when At this point, the system suspends the automatic numbering process and sends a manual verification request to the operator. Simultaneously, it increases the tile division number of the current drawing by one level from the default value and re-executes step S02. Automatic numbering is then performed on the weld joint sorting sequence according to the user-defined numbering rules, and numbering labels are overlaid on the PDF layer to generate a weld joint information table that is bidirectionally linked to the drawing.
[0085] The specific implementation of step S05 is as follows: Automatic perspective correction is performed on the construction worker ID image uploaded from the mobile device. The pixel coordinates of the four corner points of the ID are detected, and a set of point pairs is established by comparing the pixel coordinates of the four corner points with the corresponding target coordinates under a standard orthophoto view. The results are obtained by solving a system of linear equations. homography transformation matrix The formula is expressed as follows:
[0086] ;
[0087] In the formula, for Homography transformation matrix, dimensionless For the matrix of the first Line 1 Column elements, Dimensionless, obtained by solving a system of linear equations simultaneously from the pixel coordinates of the four diagonal points and the target coordinates. This represents the homogeneous coordinate column vector of each pixel in the distorted image. implement The defined projection transformation yields the homogeneous coordinate column vector under the orthographic view. The formula is expressed as follows:
[0088] ;
[0089] In the formula, Let be the column vector of homogeneous pixel coordinates in the distorted image. and These are the horizontal and vertical coordinates of a pixel in the distorted image, respectively, both being dimensionless normalized coordinates. The transformed homogeneous coordinate column vector. , , These are the three components of the transformed homogeneous coordinates, all of which are dimensionless and are normalized to take... As the pixel coordinates of the orthophoto viewpoint. Each element is dimensionless. and All are dimensionless homogeneous coordinate column vectors, with consistent dimensions on both sides of the equation. After mapping the perspective-distorted trapezoidal region into a rectangular orthophoto image, it is fed into the character recognition module, and the recognition results are automatically filled into the corresponding fields of the weld information table.
[0090] The specific implementation of step S06 is as follows: When the subcontractor submits a field change in the weld information table, the approval process is triggered. The system determines whether to re-execute the ant colony pheromone diffusion path tracking algorithm in step S03 to verify the uniqueness of the weld based on the type of the changed field. After the review is approved, the weld information table data is synchronized to the welding management platform.
[0091] To better understand and implement this invention, a specific application scenario of the invention is provided below as Example 2: To verify the effectiveness of the invention, technicians set up a test environment and selected a single-line diagram PDF file of the process pipeline of a petrochemical plant expansion and renovation project as the test object to conduct a complete technical verification of the entire process of the method of the invention. A total of 32 drawings were used for the test, covering sizes A0 and A1, and the sources included original PDFs and scanned copies. Among them, the scanned drawings had varying degrees of slight blurring, and some drawings contained three or more levels of branch pipeline topology, which were highly representative.
[0092] In step S01, the technician simultaneously initiates dual-channel parsing of 32 PDF files. The vector channel performs closed arc path extraction on the vector layer of each drawing, while the raster channel rasterizes the drawing at 300 dpi resolution and divides it into tiles with a side length of no more than 2048 pixels. Adjacent tiles are set with a 15% redundant overlap area width ratio. Each A0 drawing generates an average of about 24 tiles. The global coordinate mapping table records the offset of the top left pixel of each tile in the full page coordinate system, providing a reference for subsequent coordinate reconstruction.
[0093] In step S02, technicians input the dual-channel outputs into the curvature-aware weld detection model. The model's curvature-aware bias injection module generates a local curvature map based on the maximum eigenvalue field of the Hessian matrix and injects it into each layer's attention calculation in the form of a curvature a priori bias matrix, resulting in a stronger activation response in the arc structure region. The sparse attention masking mechanism limits the full attention calculation to the vicinity of the pipeline skeleton region, while local window attention is used in non-skeleton regions, ensuring stable inference of large-format drawings under memory-constrained conditions. After removing redundant candidate boxes using a non-maximum suppression algorithm with an intersection-union threshold of 0.4, the local coordinates of each tile are restored to page-level absolute coordinates using a global coordinate mapping table, ultimately obtaining a page-level weld candidate box set. The detection statistics of 32 drawings are shown in Table 1.
[0094] Table 1. Statistical Table of Weld Inspection for Various Types of Drawings
[0095]
[0096] As shown in Table 1, the average confidence of the candidate boxes of the original PDF drawings is higher than that of the scanned drawings. Due to the slight blurring of the scanned drawings, the confidence is slightly lower. However, the dual-channel confidence weighted fusion mechanism effectively makes up for the shortcomings of the single raster channel on the scanned drawings. The detection results of the two types of source drawings are all within the effective processing range.
[0097] In step S03, the technicians selected an A0 drawing containing a three-level branch pipeline as a typical case to verify the ant colony pheromone diffusion path tracing algorithm. Figure 3As shown, the pipeline skeleton diagram in this drawing, after refinement, constructs an adjacency graph containing four main branch nodes. The ant colony pheromone diffusion path tracing algorithm uses a uniform initial pheromone concentration... Initially, virtual ants crawl node by node according to the transition probability of the product of pheromone concentration and path length. At each weld joint candidate frame, they release a concentration increment inversely proportional to the path length at the corresponding node, with a volatility coefficient... The global pheromone was attenuated in each round. After multiple iterations, the pheromone concentration distribution stabilized. The weld sorting sequence output along the optimal path was completely consistent with the flow direction in engineering practice. There were no omissions in the weld numbers at each branch, which verified the adaptive ability of the ant colony pheromone diffusion path tracking algorithm to complex topology structures.
[0098] In step S04, the technicians calculated the adaptive numbering confidence score for each of the 32 drawings. Based on the average confidence level of the candidate boxes in each drawing. Non-maximum suppression retention rate The ratio of the convergence rounds to the maximum allowed rounds in the ant colony pheromone diffusion path tracing algorithm Substitute into the formula Calculate the confidence level normalized baseline value. A score of 0.9 is assigned. The overall score distribution for each drawing is shown in Table 2.
[0099] Table 2. Distribution of Adaptive Numbering Confidence Level Comprehensive Score
[0100]
[0101] As shown in Table 2, 26 drawings were directly assigned to the fully automatic numbering strategy, 5 drawings received review prompts, and 1 drawing with poor scan quality triggered manual review. After increasing the number of tile segments, step S02 was re-executed. After re-inspection, the overall score of this drawing rose to 0.71, entering the review prompt range. The adaptive strategy switching mechanism functioned normally. After automatically numbering the weld joints according to the user-defined numbering rules, the system overlaid the numbering labels on the corresponding layer of the PDF and generated a weld joint information table that is bidirectionally linked to the drawing.
[0102] In step S05, technicians simulate construction workers using a mobile device to photograph welder's identification documents, with a perspective deviation of approximately 15 to 30 degrees at the shooting angle. The system detects the pixel coordinates of the four corner points of the document and solves... homography transformation matrix The system maps the trapezoidal region with perspective distortion into a rectangular orthophoto image. After eliminating text distortion, the image is sent to the character recognition module. The recognition results are automatically filled into the welder's name and ID number fields in the weld information table, eliminating the need for manual data entry throughout the process.
[0103] In step S06, the subcontractor submits modifications to several fields in the weld information table through the system. The system determines whether to re-execute the ant colony pheromone diffusion path tracking algorithm based on the type of the changed fields. The system automatically triggers uniqueness verification for changes involving weld positions. After the verification is approved, all weld information table data is synchronized to the welding management platform to achieve data closure.
[0104] Compared to traditional methods, this invention brings the following technological advancements: Traditional methods rely on manual labeling and sorting of weld joints. In complex topologies with branching pipelines, manual sorting cannot systematically perceive the pipeline flow direction from the perspective of the globally optimal path. However, the ant colony pheromone diffusion path tracking algorithm, through the pheromone positive feedback and evaporation decay swarm emergence mechanism, automatically converges to the optimal traversal sequence consistent with the pipeline flow direction without human intervention, fundamentally eliminating the logical defects of manual sorting in complex topologies. The curvature-aware bias injection mechanism embeds the geometric prior of the weld joint arc into the attention calculation in the form of a quantized bias matrix, enabling feature activation to have an inherent ability to perceive the arc structure at the mechanism level, overcoming the inherent limitations of traditional template matching methods that are sensitive to drawing quality and lack stability on scanned parts. The dual-channel confidence weighted fusion complements vector accuracy and raster visual perception, enabling the system to effectively process drawings from both native PDF and scanned sources, while traditional single detection methods cannot simultaneously take into account the differences between the two sources.
[0105] It should be noted that the variables involved in this invention are explained in detail in Tables 3 and 4.
[0106] Table 3. Variable Explanation Table (Part 1)
[0107]
[0108] Table 4. Variable Explanation Table (Part Two)
[0109]
[0110] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for artificial intelligence recognition of weld joints in a process single-line diagram, characterized in that, Includes the following steps: The input process piping single-line diagram PDF file is parsed using a dual-channel method. The vector channel extracts the geometric information of the closed path, while the raster channel divides the page into tiles. The width ratio of the redundant overlapping area is set between adjacent tiles, and a global coordinate mapping table is generated. The closed path geometric analysis results of the vector channel and the image tiles of the raster channel are respectively fed into the curvature-aware weld detection model, and the weld candidate boxes and candidate box confidence scores in each tile are output. After processing, a page-level weld candidate box set is obtained. Based on the pipeline skeleton diagram, an ant colony pheromone diffusion path tracking algorithm is executed. Virtual ants start from the pipeline starting point and crawl along the pipeline skeleton diagram. They release marker pheromones at the corresponding nodes of each weld joint candidate box. After multiple rounds of cooperation, the pheromone concentration converges, and the weld joint sorting sequence is determined according to the arrival time of the pheromones. Based on the confidence scores of candidate boxes in the page-level weld candidate box set, the ratio of the number of remaining boxes after non-maximum suppression to the initial number of candidate boxes, and the ratio of the convergence rounds to the maximum allowed rounds of the ant colony pheromone diffusion path tracing algorithm, the adaptive numbering confidence score is calculated. Different numbering strategies are output to the system according to the interval to which the adaptive numbering confidence score belongs. The weld sorting sequence is automatically numbered according to the user-defined numbering rules. Numbering labels are superimposed on the PDF layer, and a weld information table that is bidirectionally associated with the drawing is generated and output.
2. The artificial intelligence recognition method for weld joints in a single-line process diagram according to claim 1, characterized in that, The dual-channel parsing specifically involves the vector channel performing path geometry analysis on the vector layer of the process piping single-line diagram PDF file, extracting closed arc paths as candidate geometric elements for weld joints; and the raster channel dividing the process piping single-line diagram PDF file page into square tiles with a side length not exceeding 2048 pixels after rasterization at 300dpi. The output results of the vector channel and the raster channel are then fused with confidence weights in the global coordinate system.
3. The artificial intelligence recognition method for weld joints in a single-line process diagram according to claim 2, characterized in that, The redundant overlap region width ratio is specifically the overlapping region of adjacent tiles in the horizontal and vertical directions, which retains the pixel width corresponding to the redundant overlap region width ratio. The redundant overlap region width ratio is 15%.
4. The artificial intelligence recognition method for weld joints in a single-line process diagram according to claim 3, characterized in that, It also includes performing automatic perspective correction on the images of construction workers' certificates uploaded by mobile devices, using the detection of the four corner points of the certificate to calculate the homography transformation matrix, restoring the distorted image to an orthophoto image and then sending it to the character recognition module, and automatically filling the recognition results output by the character recognition module into the corresponding fields of the weld information table. Among them, changes to fields submitted by subcontractors in the weld information table trigger the approval process. The system determines whether to re-execute the ant colony pheromone diffusion path tracing algorithm to verify the uniqueness of the weld based on the type of the changed field. After the approval is passed, the weld information table data is synchronized to the welding management platform.
5. The artificial intelligence recognition method for weld joints in a single-line process diagram according to claim 4, characterized in that, The curvature-aware weld detection model specifically adopts an encoder-decoder architecture. The encoder consists of 12 stacked Transformer blocks. Each Transformer block contains a multi-head self-attention module, a curvature-aware bias injection module, and a feedforward network. The curvature-aware bias injection module superimposes a curvature a priori bias matrix obtained by linear projection of the local curvature map of the input image block onto the query-key dot product similarity matrix of each attention head. The local curvature map is described by the maximum eigenvalue field of the Hessian matrix.
6. The artificial intelligence recognition method for weld joints in a single-line process diagram according to claim 5, characterized in that, Specifically, the global coordinate mapping table records the offset of the top-left pixel of each tile in the complete coordinate system of the single-line diagram PDF file of the process pipeline before tile segmentation. After detection, the local coordinates of the weld candidate box in each tile are added to the offset of the corresponding tile to restore them to page-level absolute coordinates.
7. The artificial intelligence recognition method for weld joints in a single-line process diagram according to claim 6, characterized in that, The nonmaximum suppression algorithm specifically involves sorting all candidate weld boxes output by the curvature-sensing weld detection model in descending order of candidate box confidence, calculating the intersection-union ratio (IUR) of the highest-ranked candidate weld box with all other candidate weld boxes, marking candidate weld boxes with IUR exceeding the IUR threshold as redundant boxes and deleting them. The IUR threshold is set to 0.
4.
8. The artificial intelligence recognition method for weld joints in a single-line process diagram according to claim 7, characterized in that, The ant colony pheromone diffusion path tracking algorithm specifically refines the pipeline skeleton graph into a single-pixel-width skeleton graph, constructs an adjacency graph with skeleton pixels as nodes, calculates the transition probability of each adjacent node according to the product of pheromone concentration and path length for each virtual ant, and releases pheromone concentration increments that are inversely proportional to the total path length in this round when the virtual ant reaches the node corresponding to the weld candidate box. After each round, a volatilization decay with a volatilization coefficient of 0.1 is performed on the global pheromone.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program instructions, which, when executed in a computer, are used to perform the AI recognition method for weld joints in a process single-line diagram as described in any one of claims 1-8.
10. A process single-line diagram weld joint AI recognition system, characterized in that, The system comprises the computer-readable storage medium of claim 9, wherein the system is a computer, the computer-readable storage medium is disposed within the system, and the system is provided with a microprocessor that executes program instructions stored in the computer-readable storage medium.
Citation Information
Patent Citations
Chemical single line diagram material identification method, device and equipment and storage medium
CN120932256A
Frame field generation for enhanced image feature extraction
US20250329026A1