PID (Proportion Integration Differentiation) drawing element intelligent identification and topology reconstruction method based on visual inspection
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 problems of low recognition efficiency and insufficient topology generation capability in existing technologies, and achieving efficient digital conversion and topology generation.
Patent Information
- Application Number
- CN202511843043.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-09
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2045-12-09
AI Technical Summary
Existing technologies cannot efficiently and automatically identify and reconstruct the components and their logical relationships in PID drawings, resulting in slow, inefficient, and error-prone manual drawing, and a lack of integrated visualization interfaces and topology generation capabilities.
An improved YOLOv11 network structure is adopted, which combines attention mechanism and feature extraction module to perform component detection and classification, and PaddleOCR is used for text recognition. Digital drawings are generated through pipeline detection and topology reconstruction.
It achieves end-to-end automatic conversion from drawings to digital models, improves recognition accuracy and robustness, and generates a topology graph data structure with rich information, supporting advanced applications and system simulation.
Smart Images

Figure CN121281087A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer vision and industrial automation technology, and specifically relates to a method for intelligent identification and topology reconstruction of PID drawing components based on visual inspection, which is used for intelligent identification, component association and automatic drawing reconstruction of pipeline and instrumentation diagrams in process industries. Background Technology
[0002] PID (P&ID Diagram), or process industry piping and instrumentation diagram, is the basis for detailed engineering design. Compressors, instruments, containers, valves, and other components, along with their labels, must use standardized component symbols and text formats. Traditionally, PIDs were mainly drawn manually, but this was slow and inefficient, severely impacting project schedules. Furthermore, the digitization, inspection, and management of PID drawings relied on manual visual inspection, which was inefficient and prone to errors.
[0003] Currently, deep learning technology has made breakthrough progress in the field of computer vision. Object detection algorithms based on convolutional neural networks (CNN) are widely used in industrial inspection due to their detection capabilities. Among them, the YOLO series of algorithms have become mainstream tools due to their high efficiency and real-time performance.
[0004] Simple object detection (YOLO) can only outline components, but cannot understand their relationships.
[0005] Simple OCR can only recognize text, but cannot match text with specific components.
[0006] In addition, existing technologies lack a method to re-associate and reconstruct a complete and resolvable topology from detected discrete elements (components, pipelines, text), and do not achieve an end-to-end automated process of "detection-association-reconstruction".
[0007] Furthermore, traditional methods rely on relatively outdated template matching and ResNet residual networks, which are 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. It only redraws through the interface of PID drawing software, lacking a user interface or interactive functions. Primarily addressing the problem of drawing redrawing, it outputs static drawings lacking topological structure, making it difficult to support advanced applications.
[0008] Some existing automation tools lack integrated visualization interfaces, the analysis results are detached from the original drawings, users cannot intuitively verify and interact with them, and the analysis results cannot be easily exported and utilized.
[0009] Therefore, there is an urgent need in this field for a solution that can automatically identify all elements in a PID diagram and understand their logical relationships, thereby generating digital drawings or topology diagrams. Summary of the Invention
[0010] To overcome the problems existing in the prior art, this invention provides a method for intelligent identification and topology reconstruction of PID drawing elements based on visual detection. Based on an improved YOLOv11-based PID drawing element identification and automatic reconstruction, this invention provides an interactive, intuitive, and functionally integrated PID drawing analysis interface that can automatically identify all elements in the PID drawing and understand their logical relationships, thereby generating digital drawings or topology diagrams.
[0011] To achieve the above objectives, this invention provides the following technical solution for PID drawings: A method for intelligent identification and topology reconstruction of PID drawing elements based on vision detection includes the following steps: S1. Preprocess the PID drawing image; S2. Prepare the drawing recognition dataset and establish the PID drawing component recognition model and text recognition model; S3. Components are identified and recognized through the PID drawing component recognition model. The labeled data is then standardized and input into the data enhancement module. S4. Using the YOLOv11 target pattern detection method, an attention mechanism and a replacement feature extraction module are embedded to form an improved YOLOv11 network structure for model training and inference, thereby achieving automatic localization and classification of components. More advanced deep learning models, such as the improved YOLOv11, are used, and attention mechanisms such as CBAM and dynamic convolutional modules (ODConv) are embedded as replacement feature extraction modules. These techniques can significantly improve the accuracy and robustness of target detection, enabling automatic localization and classification of components through model training and inference. S5. Apply a text recognition model to detect text information in the image, associate the recognized text with the corresponding components, and establish the component labeling information. S6. Perform line detection on the PID drawing image after preprocessing in step S1, merge and filter the identified pipelines, obtain the start and end coordinates of the pipelines, and group the pipelines with intersections. S7. Based on the pipeline grouping results, detect the T-nodes of the pipelines within the group, and draw the topology based on the connection relationships between components, T-nodes, and pipelines. S8. Based on the results of component, text detection, and pipeline detection, reconstruct and visualize the drawings.
[0012] Preferably, step S1 specifically includes: S11. Convert the original color image to a grayscale image; S12. Denoise the grayscale image; S13. Perform Gaussian blur processing on the denoised grayscale image; S14. Perform binarization on the blurred image to obtain an initial binary image; S15. Perform a morphological closing operation on the initial binary image to obtain an optimized binary image.
[0013] Preferably, step S2 specifically includes: S21. Establish a drawing recognition dataset: This is achieved by segmenting the PID drawing files of various components and then annotating all the components. S22. Generate a txt annotation file based on the YOLO DETECT format annotation rules: (i) Classify the components; (ii) The format of the annotation box is: normalized center point coordinates, normalized annotation box length and width; S23. Component identification is performed by improving YOLOv11 and the annotation file of S22. The location, confidence and category attributes of the components are obtained by the detected model. S24. The text recognition model is used for detection by importing the PP-OCRv5 model of PaddleOCR. It integrates PaddleOCR (PP-OCRv5) for text recognition, which is an industry-leading OCR tool that supports multiple languages and complex scenarios with higher accuracy. It associates the recognized text with the corresponding components and establishes the component's annotation information.
[0014] Preferably, in step S3, the enhanced data includes geometric enhancement, color space enhancement, advanced composite enhancement, automated and regularized enhancement, advanced color space enhancement, and image quality simulation enhancement; the specific steps are as follows: (1) Geometric enhancement: including random horizontal flip, random vertical flip, random translation, random scaling and perspective transformation; (2) Color space enhancement: Random perturbations of image hue, saturation and brightness are controlled by parameters; (3) Advanced composite enhancement: including progressive Mosaic enhancement and MixUp enhancement; (4) Automated and regularized enhancements: including RandAugment's automatic enhancement strategy and random erasure; (5) Enhanced advanced color space: Grayscale conversion: Converts an image to grayscale with a 50% probability; Contrast-limited adaptive histogram equalization: enhances local image contrast with a 10% probability; Brightness and contrast perturbation: Adjusts global brightness and contrast within ±0.1 with a 30% probability; Gamma correction: Performs non-linear brightness adjustment within the range [90, 110] with a 20% probability; (6) Image quality simulation enhancement: Image compression simulation: Simulates JPEG compression artifacts in the 90-100 quality range with a 10% probability; Sharpening Enhancement: Highlights image edge details with a 30% probability and controlled by minor parameters, while avoiding the introduction of excessive noise.
[0015] Multi-level data augmentation strategies are employed, including geometric augmentation, color space augmentation, and advanced composite augmentation, with specific parameters (such as probability and range) provided, which can significantly improve the model's generalization ability.
[0016] Preferably, step S4 specifically includes: 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. 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. S43, Hardware Environment Configuration; S44. Training parameter settings; S43. The effectiveness was verified through multiple rounds of ablation experiments.
[0017] 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.
[0018] Preferably, step S5 specifically includes: 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. S52. The component labeling information is combined with the component category information to save the corresponding component labeling and type information, and the identified text is associated with the component through the classification results of regular expressions and Euclidean distance.
[0019] Preferably, step S6 specifically includes: S61. Using probability functions based on the principle of Hough transform, line segments are identified by detecting edges in the image; S62. Set pipeline merging rules. The pipeline merging rules are 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 values of the two endpoints. Different groups are operated separately. 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 these two line segments are merged into a new line segment. S63. Analyze the length of all lines in the group and filter them if they are less than the set value. S64. Edge recognition of lines may cause line endpoints to shift. For grouping inflection points, the relationship between the lines can be used to determine whether the endpoints of two lines are less than a threshold (usually set to width * 0.01 to avoid the threshold being too large and grouping them with other lines) or whether there are intersections in the line segments, and these lines can be grouped together.
[0020] Preferably, step S7 specifically includes: S71. Obtain the grouped pipeline information through step S6. First, determine whether it is an inflection point. Then, within the group, determine whether the endpoint of one line and the line segment of another line are less than the threshold (usually set to width * 0.01) or have an intersection. Determine whether a T-shaped node is formed. Then, separate the T-shaped nodes in different line groups into separate groups. S72. Create a corresponding node in the undirected graph for each identified component and T-node; S73. Establish direct connection between components: When the Euclidean distance between two components is less than the direct connection threshold, establish an edge between the corresponding two component nodes in the undirected graph. S74. Establish the connection relationship between components and T-nodes: For each line segment group, connect all the components it connects to all the T-nodes identified in the group, and establish edges between the corresponding component nodes and T-nodes in the undirected graph. S75. Optimize the connection between components and T-nodes: For each component connected to the same group of T-nodes, calculate its distance to each T-node in the group, and retain only the connection with the nearest T-node, removing redundant connections with other T-nodes. S76. Establish connections between T-shaped nodes: For multiple T-shaped nodes within the same line segment group, sort them according to their spatial position and establish edges between adjacent T-shaped nodes in sequence to form a continuous pipeline path. S77. Remove redundant direct connections between components: For two components indirectly connected by a T-node, if there is a direct edge connection between them, remove that direct edge. S78. Handling line segment groups without T-nodes: For line segment groups that do not have T-nodes but connect multiple components, directly establish edges between all corresponding component nodes in the undirected graph.
[0021] This invention can realize the topology relationship recognition function. By detecting T-shaped nodes and constructing undirected graphs, it can automatically generate the connection relationship between components, realizing the end-to-end conversion from drawings to digital topology models.
[0022] Preferably, step S8 specifically includes: S81. Based on the detected components and pipelines, mark the corresponding components and pipelines on the original drawing to form the corresponding detection results; S82. Based on the detected components, text, and pipeline results, create a new image and draw a redrawn image based on the detection results on it; S83. Create a graphical interface display, the graphical interface including a display unit, an image processing unit and a graphical user interface, the graphical user interface including an image display area, a topology display area, a control panel area and a text association display area; The display unit is used to display an image of the process piping and instrumentation diagram. An image processing unit is used to perform target detection and optical character recognition on the image to identify components, text, and pipelines in the image; The graphical user interface includes: An image display area is used to present the image and the visualization results processed by the image processing unit. The visualization results include components marked with different identification boxes, their categories, and connection relationships. The topology display area is used to display the connection relationship between the components in the form of a topology diagram, where nodes represent components or T-shaped connection points, and edges represent pipeline connections. The control panel area provides at least one user interaction control, which includes: an image selection control for receiving user instructions to load the image; a processing trigger control for receiving user instructions to start the analysis process of the image processing unit; a display switching control for receiving user instructions to switch between detecting an image and redrawing an image; and an image export control for receiving user instructions to export the image currently displayed in the image display area to an external storage device. The text association display area is used to display the association information between corresponding text and components. One component may correspond to multiple text information, separated by commas.
[0023] Preferably, the control panel area of the graphical user interface further includes parameter setting controls for receiving parameter modification instructions input by the user. The parameters include the display size of topology nodes and the font size, and can also select whether to display the annotation information in the topology image. 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. The graphical interface dynamically updates the content of the image display area in response to operations on the display switching control; and executes the image export function in response to operations on the image export control.
[0024] The graphical user interface (GUI) development provides image display, topology visualization, control panel, and text-linked areas, allowing users to interact with functions such as parameter adjustment and image export. It supports real-time processing and custom parameters to adapt to different drawing qualities and requirements.
[0025] Compared with the prior art, the beneficial effects of the present invention are as follows: (1) It realizes end-to-end automatic conversion from drawings to digital models, which greatly improves efficiency; (2) Using the improved YOLOv11, a combination of data augmentation methods, including ODConv and CBAM modules, is used to determine the target regions where the features of different components are located, refine the local fine-grained features, and improve the feature representation capability of the network; (3) Using YOLOv11, optical character recognition PaddleOCR, and a method based on pixel-based probability Hough line transformation pipeline recognition and merging rules to realize the positioning, classification, text detection and recognition of components in PID drawing images. These technologies can significantly improve the accuracy and robustness of target detection, and have a higher accuracy rate. They adopt the latest computer vision technology and end-to-end process, which is more in line with the current industrial automation needs. (4) Supports multimodal information collaborative processing (visual + text), and improves the accuracy of association by associating text and components through regular expressions and Euclidean distance; (5) The invention generates not simple pictures, but topological graph data structures with rich symbolic information, which provides a data foundation for subsequent applications such as drawing analysis, system simulation, and equipment management. It focuses on topological relationship recognition, and the generated structured data (such as undirected graphs) can be used for subsequent system simulation, equipment management, etc., with strong scalability. (6) Use regular expressions and Euclidean distance to associate components with text, and combine the detection results to complete the redrawing of PID drawings. Compared with traditional hand-drawn drawings and other detection methods, the real-time speed detection based on YOLOv11 and the pixel-level line detection method can reduce the time to draw PID drawings and improve the efficiency of PID drawing. Attached Figure Description
[0026] Figure 1 This is a flowchart of the present invention; Figure 2 This is a schematic diagram illustrating the use of the labelimg annotation tool to annotate an image according to the present invention; Figure 3 This is a diagram of the improved YOLOv11 network structure for this invention; Figure 4 This is a structural diagram of the ODConv module of the present invention; Figure 5 This is a structural diagram of the CBAM module of the present invention; Figure 6 This is a schematic diagram of the original PID drawing for this invention; Figure 7 This invention is based on a pipeline detection algorithm and a pipeline diagram detected after processing. Figure 8 This is the detection image in the graphical interface of the present invention; Figure 9 This is a topological structure diagram of the graphical interface of this invention; Figure 10 This is a diagram of the control menu in the graphical interface of this invention; Figure 11 This refers to the redrawing in the graphical interface of this invention. Detailed Implementation
[0027] To better understand the above technical solutions, the following will provide a detailed explanation of the technical solutions in conjunction with the accompanying drawings and specific embodiments.
[0028] Reference Figures 1-7 This invention provides a method for intelligent identification and topology reconstruction of PID drawing elements based on visual detection, and provides an interactive, intuitive, and functionally integrated PID drawing analysis interface (graphical interface), including the following steps: S1. Preprocess the PID drawing image to obtain a new image; S2. Prepare the drawing dataset and establish component recognition and text recognition models; S3. Using YOLOv11 for detection, the labeled data is standardized and then input into the data enhancement module, mainly for color space enhancement, grayscale conversion, gamma correction, sharpening, and advanced composite enhancement. S4. Using the target pattern detection method of YOLOv11, embedding the attention mechanism and replacing the feature extraction module to form an improved YOLOv11 network structure, performing model training and inference, and realizing automatic localization and classification of components. S5. Use the PP-OCRv5 model of PaddleOCR to detect text information in the image, use regular expressions and Euclidean distance to associate the recognized text with the corresponding components, and establish the component labeling information. S6. Apply the pixel-based probabilistic Hough line transform pipeline recognition algorithm to perform line detection on the PID drawing image preprocessed in S1. Merge the identified pipelines and filter out some excessively short line noise to obtain the start and end coordinates of the pipelines. Group the pipelines with intersections. S7. Based on the pipeline grouping results, detect the T-nodes of the pipelines within the group, and draw the topology based on the connection relationships between components, T-nodes, and pipelines. S8. Based on the detection results, the drawing is reconstructed and visualized, providing an interface for PID drawing analysis. This graphical user interface (GUI) organically integrates the original drawing display, analysis process visualization, topological relationship presentation, text association information, and user control functions into the same interface.
[0029] In this embodiment, further, step S1 processes the image as follows: Figure 6 The original PID image shown is preprocessed as follows: S11. Convert the original color image into a grayscale image; S12. The grayscale image is denoised using a nonlocal averaging denoising algorithm. S13. Perform Gaussian blur processing on the denoised grayscale image; S14. The blurred image is binarized using an adaptive thresholding algorithm to obtain an initial binary image. S15. Perform morphological closing operation on the initial binary image to remove small noise in the image and connect neighboring pixel regions, finally obtaining the optimized binary image.
[0030] In this embodiment, further, in step S2, the drawing recognition dataset is prepared to establish a component recognition model and a text recognition model: S21. The drawing recognition dataset is established by segmenting PID drawing files. It contains a large number of PID drawings including various components, and then labels the location and category of all components using labelimg. S22. Generate a txt annotation file based on the YOLO DETECT format annotation rules, using labelimg (e.g., ...). Figure 2 (As shown) Annotate the image and generate a txt annotation file: (i) Component categories are marked as 13: Pump, General Equipment, Motor, Valve, Pipeline Connection, Filter, Mixer, Flow Indicator, Heat Exchanger, Vessel, Peripheral Equipment, Compressor, and Instrument. (ii) The format of the annotation box is: normalized center point coordinates, normalized annotation box length and width; S23. Component identification uses YOLOv11 and the annotation file of S22 to detect components. The location, confidence level and category attributes of the components can be obtained from the detected model. S24. The text recognition model is used for detection by importing the PP-OCRv5 model from PaddleOCR.
[0031] In this embodiment, further, in step S3, the YOLOv11 detection and labeled data, after standardization, are input into the data enhancement module, mainly performing geometric enhancement, color space enhancement, automated and regularized enhancement, image quality simulation enhancement, and advanced composite enhancement, specifically including: S31, Basic Geometry 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); S32, Basic Color Space Enhancement: The parameters hsv_h: 0.015, hsv_s: 0.7, hsv_v: 0.4 control the random perturbation of image hue, saturation, and brightness; S33, Advanced Composite Enhancement: Includes progressive Mosaic enhancement (mosaic: 0.8) and MixUp enhancement with a 30% probability (mixup: 0.3); S34. Automation and Regularization Enhancement: This includes the RandAugment automatic enhancement strategy (auto_augment: randaugment) and random erasure with a probability of 40% (erasing: 0.4); S35, Enhanced Advanced Color Space: * Grayscale conversion: Convert the image to grayscale with a 50% probability (A.ToGray, p=0.5), forcing the model to learn color-independent features; * Contrast-limited adaptive histogram equalization: enhances local image contrast with a 10% probability (A.CLAHE, p=0.1); * Brightness and contrast perturbation: Adjust global brightness and contrast within a small range (±0.1) with a 30% probability (A. RandomBrightnessContrast, p=0.3); * Gamma correction: Non-linear brightness adjustment within the range [90, 110] with a probability of 20% (A.RandomGamma, p=0.2); S36. Image quality simulation enhancement: * Image compression simulation: Simulate compression artifacts in JPEG compression within the quality range of 90-100 with a 10% probability (A.ImageCompression, p=0.1) to improve the model's robustness to compressed images; * Sharpening Enhancement: Highlights image edge details with a 30% probability (A.Sharpen, p=0.3) and controlled by a slight parameter (alpha=(0.1,0.2)), while avoiding the introduction of too much noise.
[0032] The numerical results of the experimental groups using YOLOv11 and those using data augmentation techniques (+basic augmentation + advanced composite augmentation + automated and regularized augmentation + advanced color space augmentation + image quality simulation augmentation) are shown in Table 1: Table 1
[0033] In Table 1, the experimental group with no data augmentation was YOLOv11, while the experimental group with data augmentation was significantly improved in all aspects.
[0034] Although data augmentation is a general technique, the contribution of this invention lies in constructing a multi-layered, progressive augmentation pipeline. Simply stacking all augmentation strategies may lead to performance saturation or even degradation (such as overfitting or image distortion). The combination of augmentation strategies in this embodiment (such as S31 to S36) involves various advanced augmentations (such as Mosaic, MixUp, RandAugment, CLAHE, etc.), and the parameter probabilities and amplitudes are carefully adjusted to avoid overfitting or performance degradation. The combined effect is not easily predictable. For example, advanced color space augmentation and image quality simulation augmentation require parameter adjustment for specific datasets.
[0035] As shown in Table 1, mAP50-95 improved from 0.734 to 0.769 (an absolute improvement of 3.5%). In object detection tasks, especially when the baseline model (YOLOv11) is already high, this improvement is generally considered significant. In the COCO dataset, a 1-2% improvement in mAP50-95 often requires substantial improvement, while a 3.5% improvement indicates that the augmentation strategy is effective. Furthermore, both precision and recall reached above 0.9, indicating that the model improved recall while maintaining high precision. However, the systematic combination of augmentations achieved an unexpected synergistic effect, exceeding the expectations of simple augmentations. Multiple data augmentation techniques not only improved precision and recall but also enhanced robustness, generalization ability, and strengthened the model's detection capabilities in various complex environments, ensuring a certain level of accuracy even with blurred images or in other simpler situations.
[0036] In this embodiment, further, step S4 uses the YOLOv11 target pattern detection method, embedding an attention mechanism and replacing the feature extraction module to form an improved YOLOv11 network structure, as follows: Figure 3 As shown, an ODConv module has been added to the neck section. Figure 3 The middle section) adds the CBAM module to the backbone section. Figure 3 (left side) The backbone provides basic features, the neck performs feature fusion and enhancement, and the head performs classification and bounding box regression based on the fused features. The backbone extracts shallow to deep features from the image through convolutional layers. The backbone optimizes network performance through residual connections and bottleneck structures, and further reduces computational complexity using depthwise separable convolutions. The neck, located between the backbone and the head, is responsible for fusing feature maps of different scales. S41. Feature extraction module optimization: A full-dimensional dynamic convolution module, ODConv, is introduced for the neck structure. Figure 3 As shown in the diagram, ODConv is a more general yet elegant dynamic convolution design. It utilizes a multidimensional attention mechanism and parallel strategy to learn complementary attention to the convolution kernel. These attentions involve all four dimensions of the kernel space in any convolutional layer (i.e., the spatial size of each kernel, the number of input channels, the number of output channels, and the number of kernels). This progressively multiplies the convolution along the dimensions of position, channel, filter, and kernel by different attentions, resulting in dimensional differences in the convolution operation for the input. Figure 3 The diagram shows its structure. By multiplying four types of attention by convolution kernels: position-by-position multiplication along the spatial dimension, channel-by-channel multiplication along the input channel dimension, filter-by-filter multiplication along the output channel dimension, and kernel-by-kernel multiplication along the kernel dimension of the convolution kernel space, it provides better performance to capture rich contextual information and replaces some Conv modules in the original YOLOv11 with the ODConv feature extraction module. S42. Attention Mechanism Embedding: A CBAM attention mechanism is embedded before the SPPF layer of the network. The channel attention and spatial attention modules can be combined in parallel or sequentially, such as... Figure 4 As shown, CBAM comprises two independent sub-modules: the Channel Attention Module and the Spartial Attention Module. Input features first pass through the Channel Attention Module to generate a channel attention map, and then through the Spartial Attention Module to generate a spatial attention map, performing attention mechanisms on both the channel and spatial sides respectively. The final output feature is the element-wise multiplication of the input features with the two attention maps. CBAM emphasizes important features, ensuring the model focuses on the target region, thereby improving the accuracy of individual segmentations. S44. Hardware environment configuration: CPU, GPU, SSD; Software environment: Python + PyTorch + CUDA. S45. Training parameter settings: epochs=200, imgsze=640, batch=48, using AdamW optimizer; S43. The effectiveness was verified through multiple rounds of ablation experiments.
[0037] After data augmentation, ablation experiments were conducted using the ODConv and CBAM modules independently and in combination. The effects of different network structure improvements are shown in Table 2. Table 2
[0038] Typically, simply stacking high-performance modules often leads to diminishing returns due to functional overlap or conflict, and may even cause training instability.
[0039] As shown in Table 2, on the already optimized data-augmented strong baseline model (mAP50-95=0.769), further introducing the ODConv and CBAM modules improved the core indicator mAP50-95 to 0.791 (absolute improvement +0.022, relative improvement +2.8%). Given that the baseline model performance is already high, this improvement is significant, exceeding the scope of simple incremental improvements, and fully verifying the technical superiority and innovative value of this network structure improvement scheme in component inspection tasks.
[0040] Although the code integration process of the modules is straightforward, the key challenge lies in scientifically selecting the module type, determining its optimal position in the network, and employing appropriate training strategies to unleash its performance potential rather than causing negative effects. This embodiment, through systematic ablation experiments (S45), determined the collaborative embedding scheme of ODConv and CBAM, readjusted the training parameters, and ultimately achieved a robust performance improvement.
[0041] The ablation experiments in Table 2 show that while using ODConv or CBAM alone is effective, it has limitations (such as recall potentially dropping below 0.9). This invention, however, achieves the highest precision and overall mAP while maintaining high recall. This demonstrates that the two modules are complementary rather than redundant, achieving a "1+1>2" effect, which cannot be directly predicted beforehand. The underlying mechanism is that the ODConv module enriches the contextual 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. Working together, they achieve an optimized closed loop from "feature generation" to "feature selection," thereby maintaining a high recall while improving precision, ultimately driving a significant leap in the mAP50-95 metric. This positive synergistic effect between specific modules requires rigorous experimental design to reveal and verify.
[0042] The final result achieved precision and recall rates both above 90%, with map50 reaching 0.942, representing a significant improvement.
[0043] In this embodiment, further, in step S5, the PaddleOCR PP-OCRv5 model is applied to detect text information in the image. Regular expressions and Euclidean distance are used to associate the recognized text with corresponding components, and annotation information for the components is established. S51. Call the text detection module of the PaddleOCR model to locate the text lines in the text region to be recognized; call the text recognition module of the PaddleOCR model to recognize the characters in the located text lines. S52. The text recognition results are used to identify and extract specific information (such as labels, dimensions, materials, pressure, temperature, flow direction indicators, etc.) from the text and classify them into the corresponding component list using defined regular expression patterns; S53. The component labeling information combines component category information, saves the corresponding component labeling and type information, and associates the identified text (such as "P-101") with the component through the classification result of regular expressions. If it is not classified, it is associated with the nearest component based on Euclidean distance according to a certain threshold. Here, the threshold can be used as an adjustable parameter.
[0044] In this embodiment, further, in step S6, a pixel-based probabilistic Hough transform pipeline recognition algorithm is applied to perform line detection on the PID drawing image preprocessed in S1. The identified pipelines are merged and some excessively short line noise is filtered out. The result of the detected lines is as follows: Figure 7 As shown, the coordinates of the start and end points of the pipelines are obtained, and pipelines with intersections are grouped together: S61. The probabilistic HoughLinesP() function, based on the Hough Transform principle, identifies line segments by detecting edges in an image. It is primarily used to detect line segments in binary images and return the coordinates of their endpoints. S62. The pipeline merging rule involves grouping pipelines that share the same horizontal and vertical alignment. Pipelines within the same group are then sorted based on the center values of their two endpoints. Different groups are processed separately. If the difference between the horizontal or vertical center coordinate of the current segment and the center coordinate of the previous segment is less than or equal to a certain value, these two segments are merged into a new segment. The starting point of the merged segment is the smaller of the two starting points, the ending point is the larger of the two ending points, and the other coordinate value is the average of the two segment coordinate values. S63. Analyze the length of all lines in the group and filter them if they are less than a certain value. Most threshold determinations are relative thresholds, dynamically changing based on the image size; S64. Next, based on the relationship between the lines, determine whether the endpoints of two lines are too close (whether they are less than the threshold (usually set to width * 0.01 to avoid grouping them with other lines due to an excessively large threshold) or whether there are intersections in the line segments. Group these lines together, mainly focusing on inflection points and T-shaped structures; cross-shaped nodes are not considered intersections. The final line detection result is as follows: Figure 7 The green lines are displayed.
[0045] In this embodiment, further, step S7 detects the T-nodes of pipelines within a group based on the pipeline grouping results, and draws the topology structure based on the connection relationships between components, T-nodes, and pipelines: S71. Obtain the grouped pipeline information through step S6. First, determine whether it is an inflection point, that is, whether the endpoints of the two lines are too close (whether it is less than the threshold (usually set to width * 0.01)). Then, within the group, determine whether the endpoint of one line is too close to the line segment of another line or whether there is an intersection point to determine whether a T-shaped node is formed. Then, separate the T-shaped nodes in different line groups into separate groups. S72. Create a corresponding node in the undirected graph for each identified component and T-connection point; S73. Establish direct connection between components: When the Euclidean distance between two components is less than the direct connection threshold, establish an edge between the corresponding two component nodes in the undirected graph. S74. Establish the connection relationship between components and T-nodes: For each line segment group, connect all the components connected to it with all the T-nodes identified in the group, and establish edges between the corresponding component nodes and T-nodes in the undirected graph. S75. Optimize the connection between components and T-nodes: For each component connected to the same group of T-nodes, calculate its distance to each T-node in the group, and retain only the connection with the nearest T-node, removing redundant connections with other T-nodes. S76. Establish connections between T-shaped nodes: For multiple T-shaped nodes within the same line segment group, sort them according to their spatial position and establish edges between adjacent T-shaped nodes in sequence to form a continuous pipeline path. S77. Remove redundant direct connections between components: For two components indirectly connected by a T-node, if there is a direct edge connection between them, remove that direct edge. S78. Handling line segment groups without T-nodes: For line segment groups that do not have T-nodes but connect multiple components, edges are directly established between all corresponding component nodes in the undirected graph.
[0046] In this embodiment, further, step S8 reconstructs and visualizes the drawing based on the detection results, providing a system for PID drawing analysis. This GUI organically integrates the original drawing display, analysis process visualization, topological relationship presentation, textual association information, and user control functions into a single interface, such as... Figures 8-11 ,include: S81. Based on the detected components and pipelines, mark the corresponding components and pipelines on the original drawing to form the corresponding detection results, such as... Figure 8 The test results; S82. Based on the detected components, text, and pipelines, create a new image and draw a reconstructed image based on the detection results. This is not a simple image copying, but an intelligent reconstruction based on the recognition results. Figure 11 The redrawing result; S83. Create a graphical interface to better integrate multiple results into a single interface: The display unit is used to display an image of the process piping and instrumentation diagram. An image processing unit is used to perform target detection and optical character recognition on the image to identify components, text, and pipelines in the image; A graphical user interface, comprising: The image display area is used to present the image and the visualization result processed by the image processing unit. The visualization result includes components marked with different bounding boxes, their categories, and connection relationships. Figure 8 exhibit, Figure 8 In this context, 'v' represents a valve, 'T' represents a T-joint, and 'I' represents an instrument. The topology display area is used to display the connection relationships between the components in the form of a topology diagram, where nodes represent components or T-connection points, and edges represent pipeline connections. Figure 9 exhibit; The control panel area should provide at least one user interaction control, such as... Figure 10 As shown, the user interaction control includes: an image selection control (select image), used to receive user instructions to load the image; a processing trigger control (start processing), used to receive user instructions to start the analysis process of the image processing unit; and a display switching control (display redrawn image), used to receive user instructions to switch between the detected image and the redrawn image, wherein... Figure 8 Display the detected image. Figure 11 Display redrawn image; Image export control (export image), used to receive user instructions to export the image currently displayed in the image display area to an external storage device; Text-related display area, in Figure 10The box displays the association information between the corresponding text and the component. One component may correspond to multiple text information, separated by commas. The control panel area of the graphical user interface also includes parameter setting controls for receiving parameter modification instructions input by the user. The parameters include the topology node size and font size, and the user can also choose whether to display the annotation information in the topology image. The image processing unit re-executes the analysis process based on the modified parameters and updates the image display area and the topology display area. The graphical interface dynamically updates the content of the image display area in response to operations on the display switching control; and executes the image export function in response to operations on the image export control.
[0047] This invention employs multimodal information collaborative extraction: based on improved YOLOv11 for component detection and PaddleOCR for recognizing all text annotations in the drawing, a pipeline recognition algorithm based on pixel-based probabilistic Hough transform and a merging and filtering method, and the identification and definition of T-shaped connection points as a special topological node to obtain the location information of components and text in PID drawings. Regular expressions and Euclidean distance are used to associate components with text, and image elements are then transformed into a topological graph model with semantic relationships, realizing an end-to-end automated process of "detection-association-reconstruction." Finally, the results are displayed in a graphical interface, providing a data foundation for subsequent applications such as drawing analysis, system simulation, and equipment management. The end-to-end automatic conversion greatly improves efficiency.
[0048] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
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 topological 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.
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, performing Gaussian blur processing on the denoised grayscale image; S14, performing binaryzation processing on the blurred image to obtain an initial binary image; S15, performing morphological closing operation on the initial binary image to obtain an optimized binary image.
3. The PID drawing 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 various component PID drawing files, and then marking all components to form; S22, generating a txt annotation file according to the YOLO DETECT format annotation rule: (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 class attribute of the component through the detected model; S24, the character 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 as follows: (1) geometric enhancement: including random horizontal flip, random vertical flip, random translation, random scaling and perspective transformation; (2) color space enhancement: controlling the random disturbance of image hue, saturation and brightness through 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: convert the image to grayscale with a probability of 50%; Contrast limited adaptive histogram equalization: enhance local contrast of image with 10% probability; Brightness and contrast perturbation: adjust global brightness and contrast within the range ±0.1 with 30% probability; Gamma correction: nonlinear brightness adjustment within the range [90, 110] with 20% probability; (6) Image quality simulation enhancement: Image compression simulation: simulate JPEG compression artifacts within the 90-100 quality range with 10% probability; Sharpening enhancement: highlight image edge details while avoiding excessive noise with 30% probability and controlled mild parameters.
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 a parallel strategy is constructed, replacing the original Conv module in the neck of YOLOv11 with an 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 component labeling information with the component category information to 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 comprises: S61, use a probability function based on the principle of Hough transform to recognize line segments by detecting edges in the image; S62, set the pipeline merging rule, which is to find pipelines of the same horizontal line and the same vertical line and group them, 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, if less than the set value, filter; 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 S7 specifically comprises: S71, obtain the grouped pipeline information through step S6, first judge whether it is an inflection point, then judge whether the endpoint of a line and the line segment of another line are less than the threshold value or have an intersection in the group, judge whether it constitutes a T-shaped node, and then separate the T-shaped nodes in different line groups; S72, create a corresponding node in the undirected graph for each recognized component and T-shaped node; S73, establish the direct connection relationship between components: when the Euclidean distance between two components is less than the direct connection threshold, an edge is established between the corresponding two component nodes in the undirected graph; S74, establish the connection relationship between the components and the T-junctions: for each line segment group, connect all the components connected to it with all the T-junctions identified in the group, and establish edges between the corresponding component nodes and T-junctions in the undirected graph; 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, remove the redundant connection with other T-junctions; S76, establish the connection between T-junctions: for multiple T-junctions in the same line segment group, sort them according to their spatial positions, and establish edges between adjacent T-junctions in turn to form a continuous pipeline path; 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; 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.
9. The PID drawing paper element intelligent recognition and topology reconstruction method based on visual detection according to claim 1, characterized in that, Step S8 specifically includes: S81, according to the detected components and pipelines, mark the corresponding components and pipelines on the original drawing to form the corresponding detection result; 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 it; 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.
10. The PID drawing element intelligent recognition and topology reconstruction method based on visual detection according to claim 9, characterized in that, The control panel area of the graphical user interface includes parameter setting controls for receiving user input parameter modification instructions, 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
A method and system for deploying maximally redundant trees in a data network
CN106170952A
Road network center line generation method and device based on road topology adaptive search
CN115457394A
Method for detecting operation reliability of power distribution network based on equipment health and network frame topology
CN116341349A
PID drawing identification and reconstruction system based on end-to-end deep learning
CN117373051A
Allocation identification detection method and system based on topology analysis of atlas
CN119006156A
Cited By
Pipeline model modeling method and device based on engineering drawing recognition
CN122336156A
