PID paper element intelligent recognition and topological reconstruction method based on visual detection

By using an improved YOLOv11 network and PaddleOCR technology, the system automatically identifies and reconstructs the components and their logical relationships in PID drawings, solving the problem of low identification and reconstruction efficiency in existing technologies. This achieves efficient digitization and topology map generation, and supports interactive interfaces and multimodal information processing.

CN121281087BActive Publication Date: 2026-03-27CHICHENG TECH
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-09
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing technologies cannot effectively and automatically identify components in PID drawings and understand their logical relationships, resulting in slow and inefficient manual drawing, low efficiency in digitization and management, and a lack of integrated visualization interfaces and topology reconstruction capabilities.

Method used

An improved YOLOv11 network structure is adopted, which combines attention mechanism and feature extraction module to automatically locate and classify components. PaddleOCR is used for text recognition, and pipeline detection and topology reconstruction are combined to generate digital drawings and topology diagrams, providing an interactive and intuitive analysis interface.

Benefits of technology

It achieves end-to-end automatic conversion from drawings to digital models, improving efficiency, target detection accuracy and robustness. The generated topology map data structure can be used for subsequent analysis and application, supports multimodal information collaborative processing, and improves correlation accuracy and drawing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121281087B_ABST
    Figure CN121281087B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of PID drawing element intelligent identification and topological reconstruction method based on visual detection, by using multi-modal information collaborative extraction: component detection based on improved YOLOv11 and all text annotations in the drawing are identified using PaddleOCR, pipeline identification algorithm and merging filtering method based on pixel point's probability Hough transform, and T type connecting point is identified and defined as a kind of special topological node, the positioning information acquisition of component and text in PID drawing is realized, and regular expression and Euclidean distance are used to associate component and text, then image element is converted into topological graph model with semantic relationship, realize the end-to-end automation process of "detection-association-reconstruction", finally in the form of image interface display, provide data basis for subsequent drawing analysis, system simulation, equipment management and other applications, end-to-end automatic conversion, greatly improve efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of computer vision and industrial automation, and particularly relates to a PID drawing element intelligent identification and topology reconstruction method based on visual detection, which is used for intelligent identification, element association and automatic reconstruction of a process industry pipeline and instrument flowchart. BACKGROUND

[0002] PID (P&ID Diagram, PID), i.e. a process industry pipeline and instrument flowchart, is the basis for detailed engineering design. Compressors, instruments, containers, valves and other components and their labels all use unified component symbols and text formats. Traditionally, PIDs are mainly drawn by hand, but the slow speed and low efficiency of hand-drawing seriously affect project progress. The digitization, inspection and management of PID drawings rely on manual visual inspection, which is inefficient and prone to errors.

[0003] Currently, deep learning technology has made breakthrough progress in the field of computer vision. Target detection algorithms based on convolutional neural networks (CNN) are widely used in industrial detection due to their detection capabilities, among which the YOLO series algorithm has become a mainstream tool due to its high efficiency and real-time performance.

[0004] Simple target detection (YOLO) can only frame components and cannot understand their association.

[0005] Simple OCR can only recognize text and cannot correspond text to specific components.

[0006] In addition, existing technologies lack a method for re-associating and reconstructing a complete and analyzable topology structure from detected discrete elements (components, pipelines, text), and have not achieved an end-to-end automated process of "detection-association-reconstruction".

[0007] In addition, for traditional methods, reliance on traditional template matching and residual networks (ResNet) makes the technology relatively outdated and less adaptable to complex drawings. Text recognition uses a custom model based on a neural network classifier, which may lack the generalization ability and accuracy of PaddleOCR. Repainting is only done through the interface of the PID drawing software, without a user interface or interactive function, mainly solving the problem of drawing redrawing, and the output is a static drawing, which lacks a topology structure and is difficult to support advanced applications.

[0008] Some existing automated tools lack integrated visual interfaces, and the analysis results are detached from the original drawings, making it difficult for users to visually verify and interact with them, and the analysis results cannot be conveniently exported and utilized.

[0009] Therefore, there is an urgent need in the art for a solution that can automatically identify all elements in a PID diagram and understand their logical relationships, and then generate a digitized drawing or a topology graph. SUMMARY

[0010] In order to overcome the problems existing in the prior art, the present application provides a PID drawing element intelligent identification and topology reconstruction method based on visual detection.

[0011] In order to achieve the above-mentioned purposes, the present application provides the following technical solutions for PID drawings:

[0012] A PID drawing element intelligent identification and topology reconstruction method based on visual detection, comprising the following steps:

[0013] S1, pre-processing the PID drawing image;

[0014] S2, preparing a drawing recognition data set and establishing a PID drawing element identification model and a character recognition model;

[0015] S3, detecting and identifying by the PID drawing element identification model, after the labeled data is standardized, inputting the data into an enhancement module;

[0016] S4, using the target mode detection method of YOLOv11, embedding attention mechanism and replacing feature extraction module, forming improved YOLOv11 network structure, performing model training and reasoning, and realizing automatic positioning and classification of elements; a more advanced deep learning model such as improved YOLOv11 is used, and attention mechanisms such as CBAM and dynamic convolution modules (ODConv) are embedded as replacement feature extraction modules. These technologies can significantly improve the accuracy and robustness of target detection, and perform model training and reasoning to realize automatic positioning and classification of elements;

[0017] S5, applying the character recognition model to detect the character information in the image, associating the recognized characters with the corresponding elements, and establishing the labeling information of the elements;

[0018] S6, performing line detection on the PID drawing image pre-processed in step S1, merging and filtering the recognized pipelines to obtain the start and end point coordinates of the pipelines, and grouping the pipelines with intersection points;

[0019] S7, according to the pipeline grouping result, detecting the T-type nodes of the pipelines in the group, and drawing the topology structure according to the connection relationship between the elements, T-type nodes and pipelines;

[0020] S8, according to the component, text detection and pipeline detection results are used for drawing reconstruction and visual output.

[0021] As preferred, step S1 specifically comprises:

[0022] S11, converting the original color image into a gray-scale image;

[0023] S12, performing denoising processing on the gray-scale image;

[0024] S13, performing Gaussian blur processing on the denoised gray-scale image;

[0025] S14, performing binarization processing on the blurred image to obtain an initial binary image;

[0026] S15, performing morphological closing operation on the initial binary image to obtain an optimized binary image.

[0027] As preferred, step S2 specifically comprises:

[0028] S21, establishing a drawing recognition data set: by segmenting the PID drawing files of various components, and then marking all components;

[0029] S22, generating a txt annotation file according to the YOLO DETECT format annotation rule:

[0030] (i) component classification;

[0031] (ii) the annotation box format is: normalized center point coordinates, normalized annotation box length and width;

[0032] S23, component recognition is performed through improved YOLOv11 and the annotation file of S22 to detect components, and the position, confidence and category attributes of the components are obtained through the detected model;

[0033] S24, the text recognition model is detected by importing the PP-OCRv5 model of PaddleOCR; PaddleOCR (PP-OCRv5) is integrated for text recognition, which is a leading OCR tool in the industry, supporting multiple languages and complex scenarios, with higher accuracy. The recognized text is associated with the corresponding component, and the annotation information of the component is established.

[0034] As preferred, in step S3, the enhanced data includes geometric enhancement, color space enhancement, advanced composite enhancement, automation and regularization enhancement, advanced color space enhancement, and image quality simulation enhancement; the specific steps are:

[0035] (1) Geometric augmentation: including random horizontal flip, random vertical flip, random translation, random scaling, and perspective transform;

[0036] (2) Color space augmentation: controlling random perturbation of image hue, saturation, and brightness by parameters;

[0037] (3) Advanced composite augmentation: including progressive Mosaic augmentation, and MixUp augmentation;

[0038] (4) Automation and regularization augmentation: including RandAugment automatic augmentation strategy and random erasing;

[0039] (5) Advanced color space augmentation:

[0040] Grayscale: converting the image to grayscale with a probability of 50%;

[0041] Contrast limited adaptive histogram equalization: enhancing local contrast of the image with a probability of 10%;

[0042] Brightness and contrast perturbation: adjusting global brightness and contrast within a range of ±0.1 with a probability of 30%;

[0043] Gamma correction: performing non-linear brightness adjustment within a range of [90, 110] with a probability of 20%;

[0044] (6) Image quality simulation augmentation:

[0045] Image compression simulation: simulating JPEG compression artifacts within a quality range of 90-100 with a probability of 10%;

[0046] Sharpening augmentation: highlighting image edge details while avoiding excessive noise with a probability of 30% and a controlled mild parameter.

[0047] Multiple levels of data augmentation strategies are performed, including geometric augmentation, color space augmentation, advanced composite augmentation, etc., and specific parameters (such as probability and range) are provided, which can significantly improve the model's generalization ability.

[0048] As a preferred, the step S4 specifically comprises:

[0049] S41. Feature extraction module optimization: A full-dimensional dynamic convolution module is introduced for the neck structure, and a four-dimensional attention mechanism with a parallel strategy is constructed. The Conv module in the neck part of the original YOLOv11 is replaced with the ODConv feature extraction module. On the basis of traditional convolution, for the first time, four-dimensional dynamic adjustment of spatial dimension, input / output channel dimension and number of convolution kernels is realized simultaneously. This can improve accuracy and reduce a certain amount of parameters. It has strong generalization ability. For PID drawing detection, ODConv has multi-scale perception capability and can dynamically focus on target regions of different sizes. The dynamic nature of its convolution kernel dimension allows the kernel weights to be adaptively adjusted according to the pose of the target. It naturally has the ability to adapt to samples and has better robustness and accuracy.

[0050] S42. Attention Mechanism Embedding: The CBAM attention mechanism is embedded before the SPPF layer of the network. It includes channel attention and spatial attention mechanisms for feature refinement. For the original detection model, the detection accuracy for small targets is insufficient. CBAM enables the network to more clearly identify these small but critical components, effectively suppress the response of these irrelevant background regions, and enhance the response of the foreground region where the component is located. This can reduce the probability of false detection and amplify the most discriminative features among them, thus distinguishing similar components.

[0051] S43, Hardware Environment Configuration;

[0052] S44. Training parameter settings;

[0053] S43. The effectiveness was verified through multiple rounds of ablation experiments.

[0054] YOLOv11's high-precision detection: It adopts an improved backbone and neck architecture (such as C3k2 blocks and SPPF structures) to enhance feature extraction capabilities, perform well in complex scenes, and optimizes the training process and lightweight design to achieve millisecond-level latency. It can quickly process the large number of drawings to meet the detection requirements. Through module-level reconstruction (such as RCS-OSA and C3k2 fusion), it reduces computational costs and memory usage while maintaining accuracy.

[0055] Preferably, step S5 specifically includes:

[0056] S51. Call the text detection module of the PaddleOCR model to locate the text lines in the region to be recognized; call the text recognition module of the PaddleOCR model to recognize the characters in the located text lines.

[0057] S52, the labeling information of the component is combined with the component category information, the corresponding component labeling and type information are saved, and the recognized text is associated to the component through the classification results of the regular expression and the Euclidean distance.

[0058] As preferred, step S6 specifically comprises:

[0059] S61, using a probability function, a line segment is recognized by detecting edges in the image based on the principle of Hough transform;

[0060] S62, pipeline merging rules are set, the pipeline merging rules are to find pipelines of the same horizontal line and the same vertical line to group, the pipelines of the same group are sorted according to the center values of the two end points, different groups are operated respectively, and if the horizontal or vertical center coordinates of the current line segment and the center coordinates of the previous line segment are less than or equal to the set value, the two line segments are merged into a new line segment;

[0061] S63, the lengths of all lines in the group are judged, and if less than the set value, the lines are filtered;

[0062] S64, generally, the edge recognition of the line may cause the end point of the line to deviate, for the grouping of the corner point, whether the end points of two lines are less than a threshold value (usually set to width*0.01 to avoid the threshold value being too large and being grouped with other lines) or whether there is an intersection in the line segment part is judged according to the relationship between the lines, and the lines are grouped.

[0063] As preferred, step S7 specifically comprises:

[0064] S71, the grouped pipeline information is obtained through step S6, whether it is a corner point is first judged, then whether the end point of a line and the line segment of another line are less than a threshold value (usually set to width*0.01) or have an intersection is judged in the group, whether a T-shaped node is formed is judged, and the T-shaped nodes in different line groups are separated and grouped;

[0065] S72, a corresponding node is created in the undirected graph for each recognized component and T-shaped node;

[0066] S73, a direct connection relationship between components is established: when the Euclidean distance between two components is less than a direct connection threshold value, an edge is established between the corresponding two component nodes in the undirected graph;

[0067] S74, a connection relationship between components and T-shaped nodes is established: for each line segment group, all components connected by the group and all T-shaped nodes recognized in the group are connected, and edges are established between the corresponding component nodes and T-shaped nodes in the undirected graph;

[0068] S75, optimizing the connection of components and T-junctions: for each component connected to the same group of T-junctions, calculate the distance between it and each T-junction in the group, and only keep the connection between it and the nearest T-junction, remove the redundant connection with other T-junctions;

[0069] S76, establishing the connection between T-junctions: for multiple T-junctions in the same line segment group, sort them according to their spatial positions, and sequentially establish edges between adjacent T-junctions to form a continuous pipeline path;

[0070] S77, removing redundant direct connections of components: for two components connected indirectly through T-junctions, if there is a direct edge connection between them, remove the direct edge;

[0071] S78, processing line segment groups without T-junctions: for line segment groups that do not identify T-junctions but connect multiple components, directly establish edges between all corresponding component nodes in the undirected graph.

[0072] The present application can realize the function of topological relationship recognition, and can automatically generate the connection relationship between components through the detection of T-junctions and the construction of an undirected graph, realizing the end-to-end conversion from a drawing to a digital topological model.

[0073] As a preferred, step S8 specifically comprises:

[0074] S81, according to the detected components and pipelines, mark the corresponding components and pipelines on the original drawing to form a corresponding detection result;

[0075] S82, according to the detected components, text and pipeline results, a new image is newly created, and a redrawn image based on the detection results is drawn on it;

[0076] S83, creating an image interface display, the image interface includes a display unit, an image processing unit and a graphical user interface, the graphical user interface includes an image display area, a topological display area, a control panel area and a text association display area;

[0077] The display unit is used to display the image of the process piping and instrument flow diagram;

[0078] The image processing unit is used for target detection and optical character recognition on the image to identify components, text and pipelines in the image;

[0079] The graphical user interface includes:

[0080] The image display area is used to present the image and the visualization result processed by the image processing unit, and the visualization result includes components and their categories marked by different identification boxes, and connection relationships;

[0081] a topology display area for displaying the connection relationship between the components in the form of a topology graph, wherein a node represents a component or a T-shaped connection point, and an edge represents a pipeline connection;

[0082] a control panel area providing at least one user interactive control, including: an image selection control for receiving a user instruction to load the image; a processing trigger control for receiving a user instruction to start the analysis process of the image processing unit; a display switching control for receiving a user instruction to switch between the detected image and the redrawn image; and an image export control for receiving a user instruction to export the image currently displayed in the image display area to an external storage device;

[0083] a text association display area for displaying the association information of corresponding text and components, one component may correspond to multiple text information, separated by commas.

[0084] Preferably, the control panel area of the graphical user interface further includes a parameter setting control for receiving user input parameter modification instructions, the parameters including topology node display size and font size, and whether to display the annotation information in the topology image can also be selected; the image processing unit re-executes the analysis process according to the modified parameters and updates the image display area and the topology display area;

[0085] The graphical interface dynamically updates the content of the image display area in response to the operation of the display switching control, and performs the image export function in response to the operation of the image export control.

[0086] The graphical user interface (GUI) development provides image display, topology visualization, control panel and text association area, and user interactive operation (such as parameter adjustment, image export) supports real-time processing and custom parameters, suitable for different drawing quality and needs.

[0087] Compared with the prior art, the beneficial effects of the present application are as follows:

[0088] (1) End-to-end automatic conversion from drawing to digital model is realized, greatly improving the efficiency;

[0089] (2) Improved YOLOv11 is used, ODConv and CBAM modules are used to determine the target area where different component features are located, to refine local fine-grained features and improve the feature representation ability of the network;

[0090] (3) Using YOLOv11, optical character recognition PaddleOCR, the method of pipeline recognition and merging rules based on pixel point probability Hough line transformation realizes the positioning, classification, character detection and recognition of components in the PID drawing image, these technologies can significantly improve the accuracy and robustness of target detection, have higher accuracy, adopt the latest computer vision technology and end-to-end process, and are more in line with the current industrial automation demand;

[0091] (4) Support multi-modal information collaborative processing (vision + text), associate characters and components through regular expressions and Euclidean distance, and improve the association accuracy;

[0092] (5) The generated by the present application is not a simple picture, but a topological graph data structure with rich implied information, which provides a data basis for subsequent drawing analysis, system simulation, equipment management and the like, focuses on topological relationship recognition, and the generated structured data (such as undirected graph) can be used for subsequent system simulation, equipment management and the like, and has strong expansibility;

[0093] (6) The regular expression and Euclidean distance are used to associate the components and characters, the detection result is combined, the PID drawing is redrawn, compared with the traditional hand-drawn drawing and other detection methods, the real-time speed detection based on yolov11 and the line detection method based on pixel level can reduce the time of drawing the PID drawing and improve the drawing efficiency of the PID drawing. BRIEF DESCRIPTION OF DRAWINGS

[0094] Figure 1 The flowchart of the present application;

[0095] Figure 2 The schematic diagram of the present application using labelimg marking tool to mark the image;

[0096] Figure 3 The network structure diagram of the improved YOLOv11 of the present application;

[0097] Figure 4 The structure diagram of ODConv module of the present application;

[0098] Figure 5 The structure diagram of CBAM module of the present application;

[0099] Figure 6 The schematic diagram of the original PID drawing of the present application;

[0100] Figure 7 The pipeline detection algorithm and the detected pipeline graph based on the pipeline detection algorithm of the present application;

[0101] Figure 8 The detection graph in the image interface of the present application;

[0102] Figure 9 A topology diagram in the image interface of the present application;

[0103] Figure 10 A control menu diagram in the image interface of the present application;

[0104] Figure 11 A redrawn diagram in the image interface of the present application. DETAILED DESCRIPTION

[0105] In order to better understand the above technical solutions, the above technical solutions will be described in detail below in combination with the drawings of the specification and specific embodiments.

[0106] Reference Figures 1-7 The present application provides a PID drawing element intelligent identification and topology reconstruction method based on visual detection, and provides an interactive and intuitive PID drawing analysis interface (image interface) with integrated functions, including the following steps:

[0107] S1, pre-processing the PID drawing image to obtain a new image;

[0108] S2, preparing a drawing data set and establishing a component identification model and a character recognition model;

[0109] S3, using YOLOv11 detection, after standardizing the labeled data, inputting the data into an enhancement module, mainly for color space enhancement, grayscale, gamma correction, sharpening and advanced composite enhancement;

[0110] S4, using the target mode detection method of YOLOv11, embedding attention mechanism and replacing feature extraction module, forming an improved YOLOv11 network structure, and performing model training and reasoning to realize automatic positioning and classification of components;

[0111] S5, applying the PP-OCRv5 model of PaddleOCR to detect the text information in the image, using regular expressions and Euclidean distance to associate the recognized text with the corresponding components, and establishing the labeling information of the components;

[0112] S6, applying a pixel-based probability Hough line transformation pipeline recognition algorithm to detect the lines in the PID drawing image pre-processed in S1, merging the recognized lines and filtering some short line noise, obtaining the start and end point coordinates of the lines, and grouping the lines with intersection points;

[0113] S7, according to the pipeline grouping result, detecting the T-type nodes of the pipelines in the group, and drawing the topology according to the connection relationship between the components, T-type nodes and pipelines;

[0114] S8, according to the detection result carries out drawing reconstruction and visual output, provides an interface for PID drawing analysis, the graphical user interface (GUI) displays the original drawing, visualizes the analysis process, presents the topological relationship, the text associated information and the user control function are organically integrated in the same interface.

[0115] In this embodiment, further, step S1 pre-processes the PID original image as shown in the drawing: Figure 6

[0116] S11, the original color image is converted into a gray scale image;

[0117] S12, a non-local average denoising algorithm is used to denoise the gray scale image;

[0118] S13, the denoised gray scale image is subjected to Gaussian blur processing;

[0119] S14, the image subjected to the blur processing is subjected to binaryzation processing using an adaptive threshold algorithm, to obtain an initial binary image;

[0120] S15, the initial binary image is subjected to morphological closing operation, to remove small noise points in the image and connect adjacent pixel regions, to finally obtain an optimized binary image.

[0121] In this embodiment, further, step S2 prepares the drawing recognition data set to establish the component recognition model and the text recognition model:

[0122] S21, the drawing recognition data set is established by segmenting the PID drawing file, a large number of PID drawings including various components, and then the positions and categories of all components are labeled by labelimg;

[0123] S22, a txt annotation file is generated according to the YOLO DETECT format annotation rule, and the image is annotated by labelimg (as shown in the drawing) to generate the txt annotation file: Figure 2

[0124] (i) the component category is marked as 13 categories: Pump, General Equipment, Motor, Valve, Pipeline Connection, Filter, Mixer, Flow Indicator, Heat Exchanger, Vessel, Peripheral Equipment, Compressor, Instrument;​​

[0125] (ii) The label box format is: normalized center point coordinates, normalized label box length and width;

[0126] S23, the identification of the component is performed through YOLOv11 and the label file of S22, the position, confidence and category attribute of the component can be obtained through the detected model;

[0127] S24, the text recognition model is detected by importing the PP-OCRv5 model of PaddleOCR.

[0128] In the embodiment, further, in step S3, after the YOLOv11 detection, the standardized label data is input into a data enhancement module, mainly for geometric enhancement, color space enhancement, automatic and regularization enhancement, image quality simulation enhancement and advanced composite enhancement, etc., specifically including:

[0129] S31, basic geometric and spatial enhancement: including random horizontal flip (fliplr: 0.5), random vertical flip (flipud: 0.5), random translation (translate: 0.1), random scaling (scale: 0.5) and perspective transformation (perspective: 0.0002);

[0130] S32, basic color space enhancement: the random disturbance of image hue, saturation and brightness is controlled through parameters hsv_h: 0.015, hsv_s: 0.7, hsv_v: 0.4;

[0131] S33, advanced composite enhancement: including gradual Mosaic enhancement (mosaic: 0.8) and MixUp enhancement with a probability of 30% (mixup: 0.3);

[0132] S34, automatic and regularization enhancement: including RandAugment automatic enhancement strategy (auto_augment:randaugment) and random erasing with a probability of 40% (erasing: 0.4);

[0133] S35, advanced color space enhancement:

[0134] * Grayscale: with a probability of 50% (A.ToGray, p=0.5), the image is converted into a grayscale image, forcing the model to learn features that are not dependent on color;

[0135] * Contrast Limited Adaptive Histogram Equalization: with a probability of 10% (A.CLAHE, p=0.1), the local contrast of the image is enhanced;

[0136] * brightness and contrast perturbation: adjust global brightness and contrast in a small range (±0.1) with 30% probability (A.RandomBrightnessContrast, p=0.3);

[0137] * gamma correction: non-linear brightness adjustment in the range [90, 110] with 20% probability (A.RandomGamma, p=0.2);

[0138] S36, image quality simulation enhancement:

[0139] * image compression simulation: simulate JPEG compression artifacts in the 90-100 quality range with 10% probability (A.ImageCompression, p=0.1) to improve the robustness of the model to compressed images;

[0140] * sharpening enhancement: highlight image edge details while avoiding excessive noise with 30% probability (A.Sharpen, p=0.3) and control light parameters (alpha=(0.1,0.2)).

[0141] The numerical results of the experimental group YOLOv11 and the experimental group with data enhancement means added to YOLOv11 (+ basic enhancement + advanced composite enhancement + automatic and regularization enhancement + advanced color space enhancement + image quality simulation enhancement) are shown in Table 1:

[0142] Table 1

[0143]

[0144] In Table 1, the experimental group YOLOv11 has no enhancement means, while the experimental group with data enhancement means added has obvious improvement in various numerical values.

[0145] Although data enhancement is a general technique, the contribution of the present application lies in the construction of a multi-level and progressive enhancement pipeline. Simply stacking all enhancement strategies may lead to performance saturation or even decline (such as overfitting or image distortion). The combination of enhancement strategies in this embodiment (such as S31 to S36) involves a variety of advanced enhancements (such as Mosaic, MixUp, RandAugment, CLAHE, etc.), and the parameter probability and amplitude are carefully adjusted to avoid overfitting or performance decline. This combination effect is not easy to expect. For example, advanced color space enhancement and image quality simulation enhancement require adjustment of parameters for specific data sets.

[0146] From the data in Table 1, mAP50-95 is improved from 0.734 to 0.769 (absolute improvement of 3.5%), which is generally considered significant in the target detection task, especially when the baseline model (YOLOv11) is already high. In the COCO dataset, an improvement of 1-2% in mAP50-95 often requires substantial improvements, and an improvement of 3.5% indicates that the enhancement strategy is effective. In addition, the precision and recall rates are both above 0.9, indicating that the model has improved recall ability while maintaining high precision. However, through systematic enhancement combination, a synergistic effect beyond expectation is achieved, which exceeds the expectation of simple enhancement. Multiple data enhancement methods not only improve precision and recall, but also improve robustness, generalization ability, and detection ability in various complex environments, ensuring a certain accuracy even if the image is blurred or in other simple cases.

[0147] In this embodiment, the target mode detection method of YOLOv11 in step S4 is further embedded with attention mechanism and replaced with feature extraction module, forming an improved YOLOv11 network structure as shown in Figure 3 The ODConv module is added in the neck (Neck) part Figure 3 The CBAM module is added in the backbone part (backbone part) Figure 3 The left part,

[0148] The backbone provides basic features, the neck performs feature fusion and enhancement, and the head completes classification and bounding box regression based on the fused features. The backbone extracts shallow to deep features of the image through convolution layers, and optimizes network performance through residual connection and bottleneck structure, and uses depth separable convolution to further reduce computational complexity; the neck is located between the backbone and the head, and is responsible for fusing feature maps of different scales;

[0149] S41, feature extraction module optimization, the neck structure introduces a full-dimensional dynamic convolution module, namely ODConv as shown in the structure diagram Figure 3 ODConv is a more general but elegant dynamic convolution design that uses a multi-dimensional attention mechanism and parallel strategy to learn supplementary attention for convolution kernels, which involves all four dimensions of convolution kernel space at any convolution layer (i.e. spatial size of each convolution kernel, input channel number, output channel number and number of convolution kernels), which will make the convolution operation have differences in each dimension of the input by multiplying different attention along the position, channel, filter and kernel dimensions Figure 3As shown in the structural diagram, better performance is provided to capture rich context information by multiplying the convolution kernel by four types of attention: position-by-position multiplication operation along the spatial dimension, channel-by-channel multiplication operation along the input channel dimension, filter-by-filter multiplication operation along the output channel dimension, and kernel-by-kernel multiplication operation along the kernel space of the convolution kernel, replacing the partial Conv module in the original YOLOv11 with the ODConv feature extraction module;

[0150] S42, attention mechanism embedding, embedding CBAM attention mechanism before the SPPF layer of the network, the two modules of channel attention and spatial attention can be combined in parallel or serial order, such as Figure 4 As shown, CBAM includes two independent sub-modules, a channel attention module and a spatial attention module, the input feature first passes through the channel attention module to generate a channel attention map, and then passes through the spatial attention module to generate a spatial attention map, and the attention mechanisms in the channel and space are performed respectively. The final output feature is the element-wise multiplication result of the input feature and the two attention maps, CBAM emphasizes important features and ensures that the model focuses on the target area, thereby improving the accuracy of single segmentation;

[0151] S44, hardware environment configuration: CPU, GPU, SSD, software environment Python+PyTorch+CUDA;

[0152] S45, training parameter setting: epochs=200, imgsze=640, batch=48, using AdamW optimizer;

[0153] S43, verify effectiveness through multiple rounds of ablation experiments.

[0154] After data augmentation, ablation experiments of ODConv module and CBAM module are carried out independently and in combination. The improvement effects of different network structures are shown in Table 2:

[0155] Table 2

[0156]

[0157] Generally, simple stacking of high-performance modules often leads to diminishing returns due to functional overlap or conflict, and even causes training instability.

[0158] From Table 2, on the optimized data enhancement strong baseline model (mAP50-95 = 0.769), further introduce ODConv and CBAM modules, the core indicator mAP50-95 is improved to 0.791 (absolute improvement + 0.022, relative improvement + 2.8%). Given that the baseline model performance is already at a high level, this improvement is significant, beyond the scope of simple incremental improvement, fully verifying the technical superiority and innovative value of the network structure improvement scheme in the component detection task.

[0159] Although the code integration process of the module is direct, how to scientifically select the module type, determine its best position in the network, and match with appropriate training strategy to stimulate its performance potential, rather than cause negative effects. The present embodiment determines the cooperative embedding scheme of ODConv and CBAM through systematic ablation experiment (S45), and adjusts the training parameters, finally realizes the stable improvement of performance.

[0160] The ablation experiment of Table 2 shows that the use of ODConv or CBAM alone is effective, but there are short boards (such as the recall rate may drop below 0.9). While maintaining high recall rate, the present invention achieves the highest precision and comprehensive mAP. This proves that the two are functionally complementary rather than redundant, achieving the effect of "1+1>2", which cannot be directly expected in advance. The internal mechanism is that the ODConv module enriches the context diversity of features through full-dimensional dynamic convolution, while the CBAM attention mechanism strengthens the response of key features through channel and spatial dimension filtering. The two work together to realize the optimization closed loop from "feature generation" to "feature selection", so as to improve the accuracy while maintaining a high recall rate, and finally drive the mAP50-95 index to obtain significant leap. This positive synergistic effect between specific modules needs to be revealed and verified through rigorous experimental design.

[0161] The final result makes the precision and recall rate both above 90%, and the map50 reaches 0.942, achieving significant progress.

[0162] In the present embodiment, further, the PP-OCRv5 model of PaddleOCR is applied in step S5 to detect the text information in the image, and the recognized text is associated with the corresponding component by using regular expression and Euclidean distance, and the labeling information of the component is established:

[0163] S51, call the text detection module of the PaddleOCR model to position the text line in the to-be-recognized text area; call the text recognition module of the PaddleOCR model to recognize the characters in the positioned text line;

[0164] S52, the text recognition result is identified and extracted by a defined regular expression pattern to classify specific information (such as label, size, material, pressure, temperature, flow direction indication, etc.) in the text into the corresponding component list;

[0165] S53, the labeling information of the component is combined with the component category information to save the corresponding component label and type information, and the recognized text (such as "P-101") is associated to the component through the classification result of the regular expression, and if it is not classified, it is associated to the nearest component according to the Euclidean distance according to a certain threshold. The threshold value can be used as an adjustable parameter point.

[0166] In this embodiment, further, in step S6, a pixel-based probability Hough line transformation pipeline recognition algorithm is applied to the PID drawing image after preprocessing in S1 to detect lines. The detected lines are merged and filtered to remove short line noise. The results of the detected lines are shown in FIG. 8, and the start and end point coordinates of the pipelines are obtained. Pipelines with intersection points are grouped as follows: Figure 7

[0167] S61, a probability HoughLinesP() function is used to detect edges in the image based on the principle of Hough Transform to identify line segments. It is mainly used to detect straight line segments in binary images and returns the end point coordinates of these line segments;

[0168] S62, the pipeline merging rule is to find pipelines on the same horizontal line and the same vertical line and group them. The pipelines in the same group are sorted according to the center value of the two end points. If the difference between the horizontal or vertical center coordinates of the current line segment and the center coordinates of the previous line segment is less than or equal to a certain value, the two line segments are merged into a new line segment. The start point of the merged line segment is the smaller value of the start points of the two line segments, and the end point is the larger value of the end points of the two line segments. The other coordinate value is the average of the coordinate values of the two line segments;

[0169] S63, the length of all lines in the group is judged, and if it is less than a certain value, it is filtered;

[0170] Most of the threshold values are relative threshold values, which change dynamically according to the size of the picture;

[0171] S64, according to the relationship between the lines, it is judged whether the end points of the two lines are too close (whether less than a threshold value (usually set to width*0.01 to avoid too large threshold value and other lines being grouped together)) or whether there is an intersection point in the line segment. These lines are grouped together, mainly for corner points and T-shaped structures, and the intersection point is not counted. The final line detection result is shown in FIG. 9 as green lines. Figure 7

[0172] ​​In this embodiment, further, step S7 detects the T-junctions of the pipelines in the group according to the pipeline grouping result, and draws the topology according to the connection relationship of the components and the T-junctions and the pipelines:

[0173] S71, obtain the grouped pipeline information through step S6, first determine whether it is an inflection point, that is, whether the endpoints of two lines are too close (whether less than a threshold value (usually set to width*0.01)), then determine whether the endpoint of a line and the line segment of another line are too close or have intersection points to determine whether a T-junction is formed, and then separate the T-junctions in different line groups;

[0174] S72, create a corresponding node in the undirected graph for each identified component and T-junction;

[0175] S73, establish a direct connection relationship between components: when the Euclidean distance between two components is less than a direct connection threshold, an edge is established between the corresponding two component nodes in the undirected graph;

[0176] S74, establish a connection relationship between components and T-junctions: for each line segment group, connect all components connected by it to all T-junctions identified in the group, and establish edges between the corresponding component nodes and T-junctions in the undirected graph;

[0177] S75, optimize the connection between components and T-junctions: for each component connected to the same group of T-junctions, calculate the distance between it and each T-junction in the group, and only keep the connection between it and the nearest T-junction, and remove the redundant connection with other T-junctions;

[0178] S76, establish a connection between T-junctions: for multiple T-junctions in the same line segment group, sort them according to their spatial positions, and sequentially establish edges between adjacent T-junctions to form a continuous pipeline path;

[0179] S77, remove redundant direct connections between components: for two components indirectly connected through T-junctions, if there is a direct edge connection between them, remove the direct edge;

[0180] S78, process line segment groups without T-junctions: for line segment groups that do not identify T-junctions but connect multiple components, directly establish edges between all corresponding component nodes in the undirected graph.

[0181] In this embodiment, further, step S8 reconstructs the drawing according to the detection result and outputs the visualization, provides a system for PID drawing analysis, the GUI displays the original drawing, visualizes the analysis process, presents the topology relationship, and organically integrates the text associated information and user control functions in the same interface, such asFigures 8-11 , comprising:

[0182] S81, according to the detected components and pipeline results, mark the corresponding components and pipelines on the original drawing to form the corresponding detection results, such as Figure 8 the detection results of FIG. 8B;

[0183] S82, according to the detected components, text and pipeline results, create a new image, and draw a redrawn image based on the detection results on the new image, which is not a simple image copy, but an intelligent reconstruction based on the recognition results such as Figure 11 the redrawn results of FIG. 8C;

[0184] S83, create an image interface display to better integrate multiple results organically in the same interface:

[0185] a display unit for displaying an image of the process piping and instrument flow diagram;

[0186] an image processing unit for target detection and optical character recognition on the image to identify components, text and pipelines in the image;

[0187] a graphical user interface, the graphical user interface comprising:

[0188] an image display area for presenting the image and the visualization results processed by the image processing unit, the visualization results including components and their categories annotated with different bounding boxes, and connection relationships, as shown in Figure 8 FIG. 8D, Figure 8 wherein v represents a valve, T represents a T-shaped node, and I represents an instrument;

[0189] a topology display area for displaying the connection relationships between the components in the form of a topology graph, wherein nodes represent components or T-shaped connection points, and edges represent pipeline connections, as shown in Figure 9 FIG. 8E;

[0190] a control panel area providing at least one user interaction control, such as Figure 10 shown in FIG. 8F, the user interaction control including: an image selection control (select picture) for receiving user instructions to load the image; a processing trigger control (start processing) for receiving user instructions to start the analysis process of the image processing unit; a display switching control (display redrawn image) for receiving user instructions to switch between the detection image and the redrawn image, wherein Figure 8 the detection image is displayed, Figure 11 the redrawn image is displayed; an image export control (export picture) for receiving user instructions to export the image currently displayed in the image display area to an external storage device;

[0191] Text association display area, in Figure 10 The block displays the association information of the corresponding text and components, one component may correspond to multiple text information, and the text information is separated by a comma.

[0192] The control panel area of the graphical user interface further includes a parameter setting control for receiving a parameter modification instruction input by a user, the parameters including a topology node size and a font size, and whether to display the label information in the topology image can also be selected; the image processing unit re-executes the analysis process according to the modified parameters and updates the image display area and the topology display area;

[0193] The graphical interface dynamically updates the content of the image display area in response to the operation of the display switching control, and performs the image export function in response to the operation of the image export control.

[0194] The present application realizes the positioning information acquisition of components and text in the PID drawing by adopting multi-modal information collaborative extraction: component detection based on improved YOLOv11, identification of all text labels in the image by adopting PaddleOCR, pipeline identification algorithm and merging filtering method based on pixel point probability Hough transform, and identification and definition of T-shaped connection points as a special topology node, and associates components and text by using regular expressions and Euclidean distance, and converts image elements into a topology graph model with semantic relationship, realizes the end-to-end automatic process of "detection-association-reconstruction", finally displays in the form of a graphical interface, provides a data basis for subsequent drawing analysis, system simulation, equipment management and other applications, and realizes end-to-end automatic conversion, greatly improves the efficiency.

[0195] The above embodiments are only used to illustrate the technical solutions of the present application, but not limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A PID drawing element intelligent recognition and topological reconstruction method based on visual detection, characterized in that, The method comprises the following steps: S1, pre-processing the PID drawing image; S2, preparing a drawing recognition data set and establishing a PID drawing component recognition model and a character recognition model; S3, detecting and recognizing through the PID drawing component recognition model, inputting the standardized labeled data into a data enhancement module; S4, using a target mode detection method of YOLOv11, embedding an attention mechanism and replacing a feature extraction module to form an improved YOLOv11 network structure, and performing model training and reasoning to realize automatic positioning and classification of components; S5, applying a character recognition model to detect character information in the image, associating the recognized characters with corresponding components, and establishing labeled information of the components; S6, performing line detection on the PID drawing image pre-processed in step S1, merging and filtering the recognized pipelines to obtain the start and end point coordinates of the pipelines, and grouping the pipelines with intersection points; S7, detecting T-shaped nodes of the pipelines in the group according to the pipeline grouping result, and drawing a topology structure according to the connection relationship between the components, T-shaped nodes and pipelines; S8, reconstructing the drawing and visually outputting according to the component, character detection and pipeline detection results; Specifically, step S7 comprises: S71, obtaining the grouped pipeline information through step S6, first judging whether it is an inflection point, then judging whether the endpoint of a line and the line segment of another line in the group are less than a threshold value or have intersection points, judging whether a T-shaped node is formed, and then separating the T-shaped nodes in different line groups; S72, creating a corresponding node in the undirected graph for each recognized component and T-shaped node; S73, establishing a direct connection relationship between components: when the Euclidean distance between two components is less than a direct connection threshold value, an edge is established between the corresponding component nodes in the undirected graph; S74, establishing a connection relationship between components and T-shaped nodes: for each line segment group, all components connected thereto are connected with all T-shaped nodes recognized in the group, and edges are established between the corresponding component nodes and T-shaped nodes in the undirected graph; S75, optimizing the connection between components and T-shaped nodes: for each component connected to the same T-shaped node group, the distance between the component and each T-shaped node in the group is calculated, and only the connection between the component and the nearest T-shaped node is retained, and the redundant connection with other T-shaped nodes is removed; S76, establishing a connection between T-shaped nodes: for multiple T-shaped nodes in the same line segment group, the T-shaped nodes are sorted according to their spatial positions, and edges are established between adjacent T-shaped nodes in sequence to form a continuous pipeline path; S77, removing redundant direct connections between components: for two components indirectly connected through T-shaped nodes, if there is a direct edge connection between them, the direct edge is removed; S78, processing line segment groups without T-shaped nodes: for line segment groups that do not recognize T-shaped nodes but connect multiple components, edges are established between all corresponding component nodes in the undirected graph.

2. The PID drawing element intelligent recognition and topology reconstruction method based on visual detection according to claim 1, characterized in that: Step S1 specifically comprises: S11, converting the original color image into a grayscale image; S12, denoising the grayscale image; S13, Gaussian blur processing is performed on the denoised gray image; S14, binaryzation processing is performed on the blurred image to obtain an initial binary image; S15, morphological closing operation is performed on the initial binary image to obtain an optimized binary image. 3.The PID paper element intelligent recognition and topology reconstruction method based on visual detection according to claim 1, characterized in that, Step S2 specifically comprises: S21, establishing a drawing recognition data set: by segmenting the PID drawing files of various components, and then marking all components; S22, generating a txt annotation file according to the DETECT format annotation rules of YOLO: (1) component classification; (2) the annotation box format is: normalized center point coordinates, normalized annotation box length and width; S23, component recognition is performed through improved YOLOv11 and the annotation file of S22 to obtain the position, confidence and category attribute of the component through the detected model; S24, the text recognition model is detected by importing the PP-OCRv5 model of PaddleOCR.

4. The PID paper element intelligent recognition and topology reconstruction method based on visual detection according to claim 1, characterized in that, In step S3, the enhanced data includes geometric enhancement, color space enhancement, advanced composite enhancement, automation and regularization enhancement, advanced color space enhancement, and image quality simulation enhancement; The specific steps are: (1) Geometric enhancement: including random horizontal flip, random vertical flip, random translation, random scaling and perspective transformation; (2) Color space enhancement: random disturbance of image hue, saturation and brightness is controlled by parameters; (3) Advanced composite enhancement: including progressive Mosaic enhancement and MixUp enhancement; (4) Automation and regularization enhancement: including RandAugment automatic enhancement strategy and random erasing; (5) Advanced color space enhancement: Grayscale: with a probability of 50%, the image is converted to grayscale; Contrast limited adaptive histogram equalization: with a probability of 10%, enhance the local contrast of the image; Brightness and contrast disturbance: with a probability of 30%, adjust the global brightness and contrast within the range of ±0.1; Gamma correction: with a probability of 20%, nonlinear brightness adjustment within the range [90, 110]; (6) Image quality simulation enhancement: Image compression simulation: with a probability of 10%, simulate JPEG compression within the 90-100 quality range; Sharpening enhancement: with a probability of 30% and controlled mild parameters, highlight image edge details while avoiding introducing excessive noise.

5. The PID drawing paper element intelligent recognition and topology reconstruction method based on visual detection according to claim 1, characterized in that, Step S4 specifically comprises: S41, feature extraction module optimization, a full-dimensional dynamic convolution module is introduced into the neck structure, and a four-dimensional attention mechanism with parallel strategy is constructed, replacing part of the Conv module in the original YOLOv11 neck with the ODConv feature extraction module; S42, attention mechanism embedding, embedding CBAM attention mechanism before the SPPF layer of the network; S43, hardware environment configuration; S44, training parameter setting; S45, verify effectiveness through multiple rounds of ablation experiments.

6. The PID drawing paper element intelligent recognition and topology reconstruction method based on visual detection according to claim 1, characterized in that, Step S5 specifically comprises: S51, call the text detection module of the PaddleOCR model to locate the text line in the to-be-recognized character region; call the text recognition module of the PaddleOCR model to recognize the characters in the located text line; S52, combine the labeling information of the component with the component category information, save the corresponding component labeling and type information, and associate the recognized text to the component through the classification results of the regular expression and the Euclidean distance.

7. The PID drawing paper element intelligent recognition and topology reconstruction method based on visual detection according to claim 1, characterized in that, Step S6 specifically includes: S61, using a probability function based on the principle of Hough transform, recognize line segments by detecting edges in the image; S62, set pipeline merging rules, which group pipelines that are on the same horizontal line and the same vertical line, sort the pipelines in the same group according to the center values of the two endpoints, and operate different groups respectively; if the difference between the horizontal or vertical center coordinates of the current line segment and the center coordinates of the previous line segment is less than or equal to the set value, then merge the two line segments into a new line segment; S63, judge the length of all lines in the group, and filter if it is less than the set value; S64, judge whether the endpoints of two lines are less than the threshold value or whether there is an intersection in the line segment part, and group these lines. 8.The PID paper element intelligent recognition and topology reconstruction method based on visual detection of claim 1, wherein, Step S8 specifically includes: S81, according to the detected component and pipeline results, mark the corresponding component and pipeline on the original image to form the corresponding detection result; S82, according to the detected component, text and pipeline results, create a new image, and draw a redrawn image based on the detection results on the new image; S83, create an image interface display, which includes a display unit, an image processing unit and a graphical user interface, the graphical user interface includes an image display area, a topology display area, a control panel area and a text association display area.

9. The PID drawing element intelligent recognition and topology reconstruction method based on visual detection according to claim 8, characterized in that, The control panel area of the graphical user interface includes parameter setting controls for receiving user input parameter modification instructions, the parameters including topology nodes, font size and labeling information; The image processing unit re-executes the analysis process according to the modified parameters and updates the image display area and the topology display area.

Citation Information

Patent Citations

  • PID drawing identification and reconstruction system based on end-to-end deep learning

    CN117373051A

  • Welding defect detection method based on deep learning

    CN120355645A

  • Circuit netlist generation method supporting deep learning model multi-stage reasoning

    CN120524876A