A method for identifying pipelines and symbols in a PID drawing

By employing a two-stage localization mechanism and an adaptive classification strategy for the symbol detection module, along with a pipeline detection method based on structural response kernel groups, the problem of identifying multiple types of pipelines and symbols in PID drawings has been solved. This achieves high-precision and stable recognition results, supporting automated parsing and digital reconstruction of drawings.

CN120689899BActive Publication Date: 2026-01-27UNIV OF JINAN +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510829116.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-20
Publication Date
2026-01-27
Estimated Expiration
2045-06-20

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately identify the various types of pipelines and symbols in complex PID drawings. In particular, when faced with complex structural forms, large variations in symbol scale, and intersecting lines, the recognition accuracy and robustness are insufficient, making it difficult to meet the automated parsing requirements of industrial drawings.

Method used

The symbol detection module employs a two-stage localization mechanism and an adaptive classification strategy. Simple symbols are classified using a standard convolutional classification network, while complex symbols are classified using a direction-aware convolutional module. For pipeline detection, a structure response kernel group is designed to extract pipelines by recognizing pixel-level structure types and tracing paths, combined with endpoint guidance.

Benefits of technology

It significantly improves the recognition accuracy and robustness of symbols and pipelines in PID drawings, enhances the detection accuracy and path extraction stability in complex scenarios, and supports automated processing and digital reconstruction of drawings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120689899B_ABST
    Figure CN120689899B_ABST
Patent Text Reader

Abstract

The application provides a kind of identification method for pipeline and symbol in PID drawing, it is related to image recognition field, for the complexity of structure and the diversity of symbol in drawing, from data set construction, symbol detection to pipeline identification, a complete intelligent identification process is designed, two-stage positioning mechanism and adaptive classification strategy are introduced in symbol detection module, simple symbol is identified by standard convolution classification network, and complex symbol introduces direction perception convolution module, multi-channel feature extraction and local enhancement strategy to realize high-precision classification;In the pipeline detection aspect, a set of structure response kernel is designed to obtain the structure type and reliability of each pixel point, the path tracking and extraction are completed from the end point, and fine-grained pipeline type discrimination is carried out after extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image processing, and specifically relates to a method for identifying pipelines and symbols in PID drawings. Background Technology

[0002] Process piping and instrumentation diagrams (PID diagrams) are key technical documents in industrial process design, operation, and management, widely used in the petrochemical industry. These diagrams describe the components of equipment, pipelines, valves, and instruments using standardized symbols and line types, serving as a crucial foundation for digital and visual management of production systems. With the development of intelligent manufacturing and industrial digitalization, an automated diagram parsing technology is needed to extract the structure of diagram elements. Currently, some methods have attempted to use image processing or deep learning to recognize pipelines and symbols in PID diagrams, but they still face several challenges in practical applications. First, PID diagrams contain a wide variety of pipeline structures, including straight lines, broken lines, double lines, and dashed lines, with complex routing, width, and topological relationships. Second, the diagrams contain numerous standardized symbols of varying shapes and sizes, which differ under different diagram standards. Therefore, an intelligent recognition method is needed that can accurately identify multiple types of pipelines and symbols, possesses good robustness and diagram adaptability, to support automatic structural parsing and subsequent diagram reconstruction of PID diagrams.

[0003] Image structure analysis and visual recognition technologies have made significant progress driven by deep learning. Convolutional neural networks have demonstrated powerful feature modeling capabilities in object detection, edge extraction, and image recognition in static images. Meanwhile, novel models such as anchor-free localization structures and Transformer architectures have further improved structure localization accuracy and context modeling capabilities. However, existing drawing recognition methods still suffer from insufficient generalization, inaccurate localization, and limited feature representation when dealing with complex structural forms, large symbol scale variations, and intersecting lines. These limitations make it difficult to meet the analysis requirements of highly complex engineering drawings. To address these issues, this invention proposes a method for recognizing pipelines and symbols in PID drawings. This method detects symbols and pipelines separately, proposing different recognition methods based on their characteristics. Symbol detection incorporates a two-stage localization mechanism and an adaptive classification strategy, classifying simple and complex symbols using different methods. A structural response kernel group is designed to construct a response space for pipeline detection, achieving pixel-level structure type perception and continuous path reconstruction. This method effectively improves detection accuracy and path extraction stability in complex scenes while ensuring complete structural recognition. Summary of the Invention

[0004] This invention provides a method for identifying pipelines and symbols in PID drawings. It aims to locate and classify symbols and pipelines in PID drawings through a symbol detection module and a pipeline detection module. The symbol detection module introduces a two-stage localization mechanism and an adaptive classification strategy. Simple symbols are identified using a standard convolutional classification network, while complex symbols are classified with high precision using a direction-aware convolutional module, multi-channel feature extraction, and local enhancement strategies. For pipeline detection, a set of structural response kernels is designed to obtain the structural type and confidence level of each pixel. Path tracing and extraction are completed starting from the endpoints, and the pipeline type is then classified in detail after path extraction.

[0005] To achieve the above objectives, the present invention provides the following technical solution: a method for identifying pipelines and symbols in PID drawings, comprising the following steps.

[0006] S1, PID drawing image dataset creation.

[0007] S2. Construct a symbol detection module, which is divided into a localization task and a classification task. The localization task completes the localization of the symbol position through two stages. The classification task improves the shortcomings of traditional symbol classification, which cannot make full use of system resources by using the same strategy. It classifies the symbols in the candidate region according to the symbol complexity, and uses different classification methods for simple symbols and complex symbols.

[0008] S3. Construct a pipeline detection module, define a set of structural response kernels to cover all pipeline types, scan the drawing image through the structural response kernels to obtain the response intensity of each pixel to different structural line types, identify the structural type of each pixel from the response group and quantify the confidence level, start from the endpoint pixel, extract the complete continuous path along the direction of structural type matching, merge repeated line segments, standardize the path structure and output the pipeline coordinates and type.

[0009] S4. Construct a pipeline and symbol recognition model for PID drawings. The model consists of a pipeline detection module and a symbol detection module. Input a PID drawing image, and obtain the location information and corresponding types of pipelines and symbols in the PID drawing through the pipeline detection module and the symbol detection module, respectively.

[0010] Preferably, in step S1, a text detection model is used to automatically identify text regions in the drawing image, and the text regions are filled with white to obtain a drawing image with text information removed. The image with text removed is divided into regions using a sliding window with a step size of 128. The standard deviation of pixel grayscale values ​​within each region is calculated to represent the structural complexity of each region. Non-maximum suppression is applied to the complexity map to extract local peak points, which are used as the center points of the segmented image blocks. The cropping size of each image block is set to 1024×1024. For selected center points that are too close together, density suppression is applied to avoid excessive repetition. For regions with low values ​​in the complexity map, it is determined whether the standard deviation is lower than the structural complexity threshold. Regions lower than the structural complexity threshold are discarded to avoid wasting storage and training resources on blank areas. The coordinates of the top-left corner of the segmented drawing image in the original drawing image are recorded. The segmented image is then labeled with pipelines and symbols to obtain the PID drawing dataset, which is divided into a training set and a validation set.

[0011] Preferably, in step S1, the dataset creation method first accurately identifies and whitens the text regions in the drawing using a text detection model to remove semantic interference; then, a sliding window is used to calculate the local grayscale standard deviation to construct a structural complexity map, and non-maximum suppression is combined to extract highly complex regions as the center points for image cutting, dividing a large-sized drawing image into multiple smaller images, thereby improving model training speed and recognition accuracy; a standard deviation threshold is set to effectively filter blank images, ensuring that all images are valid images; finally, high-quality images are generated for pipeline and symbol annotation, providing a high-quality data foundation for subsequent model training and improving the accuracy and generalization ability of the recognition model.

[0012] Preferably, in step S2, the symbol detection module includes a positioning task and a classification task. The positioning task first determines the precise location of the symbol in the drawing, and then the classification task classifies the symbols in the candidate area. The specific steps are as follows:

[0013] S21. The localization task is divided into two stages. The first stage predicts the initial position of the symbol, and the second stage corrects the position from the first stage to ensure accurate localization. In the first stage, an anchor-free detector is used for preliminary localization of the symbol position. The anchor-free detector outputs the bounding box information of the symbol (coordinates of the top left corner and the bottom right corner). In the second stage, a region alignment mechanism is first used to finely sample the candidate box region. During the process, the floating-point precision of the coordinates is maintained to avoid spatial offset caused by traditional integer quantization operations. Sub-pixel level feature extraction is performed on the boundary region through interpolation to generate a feature representation with spatial consistency for the symbol region. The aligned feature region is input into the boundary regression module. The boundary regression module learns the feature region boundary correction amount by learning the geometric information and boundary relationships within the feature region, including the horizontal and vertical position fine-tuning values ​​and the scaling factors of width and height. The initial bounding box information is updated according to the feature region boundary correction amount to obtain accurate symbol position information. The symbol position information is the local coordinates of the segmented image. The global symbol position information needs to be based on the local coordinates plus the coordinates of the top left corner of the segmented drawing image in the original drawing image.

[0014] S22. The classification task first employs an adaptive symbol classification strategy, calculating symbol complexity based on the area, closure, and number of edges of candidate region symbols. The calculated symbol complexity is then compared with a predefined symbol complexity threshold. By comparison, the symbols in the drawings are divided into simple symbols (small area, closed structure, few edge segments) and complex symbols (large area, open structure, many edge segments), and the symbol complexity is... The specific calculation formula is as follows:

[0015] ;

[0016] In the formula, A is the area of ​​the symbol, C is the degree of closure of the symbol (from 0 to 1, where 0 represents completely open and 1 represents completely closed), and E is the number of edges of the symbol. To adjust the factor, For the complementarity of symbolic features, For simple symbols, convolutional layers are used to extract edge and texture features of candidate regions. Max pooling is then used to reduce the size of the feature maps, improving the network's robustness to positional and scale changes. High-level feature fusion is then performed via fully connected layers, and finally, a classification head maps the extracted features to symbol categories. For complex symbols, candidate regions are input into a multi-directional perceptual convolutional module. This module consists of direction-aware convolutional kernels with specific orientations. Convolutional operations extract and enhance line structures distributed along specific directions within the symbol, highlighting connectivity features and configuration contours. The direction-aware convolutional kernels are direction-selective two-dimensional convolutional kernels that can generate stronger responses to specific directional structures in the image. The specific mathematical model is as follows:

[0017] ;

[0018] In the formula, k is the radius of the convolution kernel; The direction of the convolution kernel. For the angle Constructed direction template, coordinate position The pixel values ​​at the location are then used; subsequently, a local adaptive histogram equalization algorithm is used to enhance the contrast between lines and background in the region, making the linear structure with low grayscale contrast clearer and enhancing the saliency of complex primitives. The enhanced image is then input into a multi-branch neural network containing local detail channels, topological contour channels, and orientation-aware channels to extract the texture features, connection patterns, and orientation features of complex symbols, respectively. Subsequently, a feature fusion mechanism is used to integrate multi-source information to generate a total feature vector. During the model training phase, a structural template is defined for each class of complex symbols based on the total feature vector. During the verification phase, the total feature vector of the candidate region is matched with the structural template to obtain the target symbol category.

[0019] Preferably, in step S2, the symbol detection module significantly improves the accuracy and robustness of symbol recognition in PID drawings by introducing a two-stage localization mechanism and an adaptive symbol classification strategy. The first stage uses an anchor-free detector to quickly predict the initial symbol position, while the second stage uses a boundary alignment module to accurately align regional features and correct boundaries, thereby optimizing the accuracy of symbol position. The classification task uses adaptive classification based on symbol complexity, dividing symbols in the drawing into simple and complex symbols. The adaptive symbol classification strategy aims to automatically select an appropriate classification method based on the symbol type, size, and shape information of the input drawing, avoiding the use of complex classification mechanisms for simple symbols and saving computational resources. The overall design, while efficiently processing symbols, fully considers the diversity and complexity of symbol forms in the drawing, exhibiting significant advantages such as high accuracy, strong robustness, and adaptability to complex symbols, providing reliable technical support for the automated processing and digital modeling of PID drawings.

[0020] Preferably, in step S3, the pipeline detection module outputs the pipeline coordinates and type, and the specific steps are as follows.

[0021] S31. PID drawing pipeline types include nine types: thick pipeline, thin pipeline, thick dashed pipeline, thin dashed pipeline, O-type pipeline, wavy pipeline, double-layer pipeline (one layer of dashed line and one layer of solid line), double-point type pipeline, and double short-line type pipeline. A set of structural response kernels is defined. Covering all pipeline types, each response core and the segmented drawing image. Perform a convolution operation to generate a response graph. , indicating in Credibility score under the response kernel , The pixel coordinates are used to obtain the final set of response maps. The structural response kernel includes: a solid line kernel. (Detecting continuous solid lines in each direction in the drawing image), dashed line core (Detecting periodically discontinuous dashed line structures), dotted line - short dashed line core (Detects discontinuous paths composed of dots and small horizontal lines), wavy line core (Detection of approximately periodic curved line segments), dual-core (Detection of parallel bilinear structure); where, solid line core The matrix has a 5×5 structure. In the 0° direction, the third column is 1 and the rest are 0. Rotating the 0° direction matrix yields solid line kernels for the 45°, 90°, and 135° directions; dashed line kernels are also obtained. The constructor is , For continuous length, The interval length, For the number of repetitions, Constructing a line segment; dotted line - dashed line core Constructed from a sparse point structure and Gaussian smoothing, supporting non-uniform point lattices; wavy line core. Compress and map the cosine function onto the kernel template. T represents the period of the wavy line. Control wave amplitude bandwidth; dual-core It consists of two parallel main bands and a suppression axis, used to represent virtual and real parallel lines, and identifies the double-layer structure by the response difference between the left and right bands;

[0022] S32. Calculate the response value of pixel p in the drawing image using the response map set SRI. The index of the maximum response value in the response map set is the structure type label of that pixel. , For structure type tags, , To retrieve the index of the maximum value, Let p be the coordinates of pixel p, and the maximum response value be the credibility score for this tag structure type. ,like If the value is 1, then pixel p belongs to the solid line pipeline category. Solid line pipelines are further divided into thick pipelines, thin pipelines, and O-type lines; if... If pixel p is 2, then it belongs to the dashed line pipeline type. Dashed line pipelines are divided into thick dashed pipelines and thin dashed pipelines; if If pixel p is 3, then it belongs to the dot-line-dashed-line pipeline. The dot-line-dashed-line pipeline is divided into double-dot type pipeline and double-short-line type pipeline; if If the value is 4, then pixel p belongs to the wavy pipeline; if If the value is 5, then pixel p belongs to the point double pipeline;

[0023] S33. Extract the complete continuous path based on the structure type label and confidence score. Calculate the response of pixels surrounding pixel p, and determine the structure type label and confidence score of the surrounding pixels. The path extraction process may encounter the following three situations: If the confidence score of the pixels surrounding pixel p is lower than the existence threshold, then pixel p is an isolated pixel and considered an invalid pipeline; if there are more than one valid pixel surrounding pixel p, then that pixel is an intermediate pixel and a middle component of the pipeline; if there is only one valid pixel surrounding pixel p, then that pixel is an endpoint pixel; find the endpoint. For each pixel, the endpoint pixel coordinates are recorded as the starting coordinates. The next pixel is found based on the structure type label. If the next pixel is an intermediate pixel, it is added to the path, its coordinates are recorded, and the search continues. If the next pixel is an endpoint pixel, it is added to the path and recorded as the ending coordinates. When the structure type is a dashed pipeline, searching across pixels is allowed. The resulting path coordinates are local pipeline coordinates. Global pipeline position information requires adding the coordinates of the top-left corner of the segmented drawing image within the original drawing image to the local coordinates.

[0024] S34. After extracting the complete path, the paths with structure types of solid line pipelines, dashed line pipelines, and dotted-short-dashed line pipelines are further subdivided. Solid line pipelines are divided into thick pipelines, thin pipelines, and O-type lines. The Sobel operator is used to calculate the path width, and Fourier frequency domain is introduced to assist in periodicity judgment. If the path width exhibits periodic changes, the path is an O-type line; if the path does not exhibit periodic changes and the average width exceeds the pipeline width threshold, the path is a thick pipeline; if the path does not exhibit periodic changes and the average width is below the pipeline width threshold, then... This path is a thin pipeline; dashed pipelines are divided into thick dashed pipelines and thin dashed pipelines. The Sobel operator is used to calculate the path width. If the average path width exceeds the pipeline width threshold, the path is a thick dashed pipeline; if the average path width is lower than the pipeline width threshold, the path is a thin dashed pipeline; dotted-line-short-dash pipelines are divided into double-dot pipelines and double-short-line pipelines. Double-dot templates and double-short-line templates are manually designed. The paths of dotted-line-short-dash pipelines are matched with the templates to obtain the matching degree of the two types of pipelines. This path is the pipeline type with a high matching degree.

[0025] Preferably, in step S3, a high-precision identification method based on structural response kernel groups is proposed to address the problems of diverse pipeline types, complex structures, and susceptibility to interference in PID drawings. By performing response calculations of multiple structural kernel types within the local neighborhood of a pixel, the structural type of each pixel is assigned and its reliability is quantified. Combined with an endpoint-guided directional growth strategy, the pipeline path is completely extracted and its coordinates are located. Furthermore, edge width analysis and frequency domain periodicity judgment are integrated to achieve fine classification of similar pipeline morphologies. This method possesses excellent continuity recognition capability, structural adaptability, and type differentiation, and can still achieve stable and accurate pipeline extraction even in complex drawing environments, significantly improving the intelligence level and practicality of automatic drawing parsing.

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

[0027] This invention provides a method for identifying pipelines and symbols in PID drawings. By constructing a symbol detection mechanism driven by structural complexity and a pixel-level pipeline extraction method composed of structural response kernel groups, it achieves high-precision identification of multiple types of drawings and pipelines in PID drawings. Compared with the prior art, this invention shows significant advantages in symbol classification accuracy, pipeline continuity extraction, preprocessing, and drawing universality, and can effectively improve the efficiency and reliability of intelligent parsing and digital reconstruction of industrial drawings. Attached Figure Description

[0028] Figure 1 This is a flowchart of a method for identifying pipelines and symbols in PID drawings provided by the present invention.

[0029] Figure 2 This is a PID drawing image after removing and segmenting the text region, as provided by the present invention.

[0030] Figure 3 This is a structural diagram of the symbol detection module provided by the present invention.

[0031] Figure 4 This is a structural diagram of the pipeline detection module provided by the present invention.

[0032] Figure 5 This is an example diagram of pipeline types provided by the present invention. Detailed Implementation

[0033] The technical solutions in the embodiments of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0034] Please see Figures 1 to 5 This invention provides a method for identifying pipelines and symbols in PID drawings. It achieves the localization and classification of symbols and pipelines in PID drawings through a symbol detection module and a pipeline detection module. The symbol detection module introduces a two-stage localization mechanism and an adaptive classification strategy. Simple symbols are identified using a standard convolutional classification network, while complex symbols are classified with high precision using a direction-aware convolutional module, multi-channel feature extraction, and local enhancement strategies. For pipeline detection, a set of structural response kernels is designed to obtain the structural type and confidence level of each pixel. Path tracing and extraction are completed starting from the endpoints. After extraction, width analysis and frequency domain periodic detection are combined to complete fine-grained pipeline type discrimination. Template matching is used to distinguish point and line structures, effectively improving detection accuracy and extraction stability, preparing for subsequent PID drawing reconstruction.

[0035] Please see Figure 1 As shown in the embodiment of this application, there is a method for identifying pipelines and symbols in PID drawings.

[0036] S1, PID drawing image dataset creation.

[0037] Furthermore, such as Figure 2 As shown, a text detection model is used to automatically identify text regions in the drawing image. These text regions are then filled with white to obtain a drawing image with text removed. A sliding window with a stride of 128 is used to divide the text-removed image into regions. The standard deviation of pixel grayscale values ​​within each region is calculated to represent the structural complexity of each region. Non-maximum suppression is applied to the complexity map to extract local peak points, which are then used as the center points of the segmented image blocks. The cropping size of each image block is set to 1024×1024. Density suppression is applied to areas where the selected center points are too close together to avoid excessive repetition. For regions with low values ​​in the complexity map, it is determined whether the standard deviation is below the structural complexity threshold. Regions below the structural complexity threshold are discarded. In this experiment, the structural complexity threshold is set to 12 to avoid wasting storage and training resources on blank areas. The coordinates of the top-left corner of the segmented drawing image in the original drawing image are recorded. The segmented image is then labeled with pipelines and symbols to obtain the PID drawing dataset, which is divided into a training set and a validation set.

[0038] S2. Construct a symbol detection module, which is divided into a localization task and a classification task. The localization task completes the localization of the symbol position through two stages. The classification task improves the shortcomings of traditional symbol classification, which cannot make full use of system resources by using the same strategy. It classifies the symbols in the candidate region according to the symbol complexity, and uses different classification methods for simple symbols and complex symbols.

[0039] Furthermore, such as Figure 3As shown, the symbol detection module includes a positioning task and a classification task. The positioning task first determines the precise location of the symbol in the drawing, and then the classification task classifies the symbols in the candidate area. The specific steps are as follows.

[0040] S21. The localization task is divided into two stages. The first stage predicts the initial position of the symbol, and the second stage corrects the position from the first stage to ensure accurate localization. In the first stage, an anchor-free detector is used for preliminary localization of the symbol position. The anchor-free detector outputs the bounding box information of the symbol (coordinates of the upper left and lower right corners). In the second stage, a region alignment mechanism is first used to finely sample the candidate box region. During the process, floating-point precision of the coordinates is maintained to avoid spatial offset caused by traditional integer quantization operations. Sub-pixel level feature extraction is performed on the boundary region through interpolation to generate a feature representation with spatial consistency for the symbol region. The aligned feature region is input into the boundary regression module. The boundary regression module learns the feature region boundary correction amount by learning the geometric information and boundary relationships within the feature region, including the horizontal and vertical position fine-tuning values ​​and the scaling factors of width and height. The initial bounding box information is updated according to the feature region boundary correction amount to obtain accurate symbol position information. The symbol position information is the local coordinates of the segmented image. The global symbol position information needs to be based on the local coordinates plus the coordinates of the upper left corner of the segmented drawing image in the original drawing image.

[0041] S22. The classification task first employs an adaptive symbol classification strategy, calculating symbol complexity based on the area, closure, and number of edges of candidate region symbols. The calculated symbol complexity is then compared with a predefined symbol complexity threshold. For comparison, the symbol complexity threshold is set to 3, categorizing symbols in drawings into simple symbols (small area, closed structure, few edge segments) and complex symbols (large area, open structure, many edge segments). The symbol complexity... The specific calculation formula is as follows:

[0042] ;

[0043] In the formula, The range of values ​​is A represents the area of ​​the symbol, C represents the degree of closure of the symbol (from 0 to 1, where 0 represents completely open and 1 represents completely closed), and E represents the number of edges of the symbol. The adjustment factor has a range of values. The initial value is set to 0.5 to control the impact of the complementarity component on the complexity score. For the complementarity of symbolic features, This represents the non-linear relationship between symbols. For simple symbols, a 3×3 convolutional layer is used to extract edge and texture features of candidate regions. Then, max pooling is used to reduce the size of the feature map, improving the network's robustness to position and scale changes. Afterward, a fully connected layer is used for high-level feature fusion of the symbols. Finally, a classification head maps the extracted features to symbol categories. For complex symbols, the candidate regions are input into a multi-directional perceptual convolutional module. This module consists of direction-aware convolutional kernels with specific orientations. Through convolution operations, it extracts and enhances the line structures distributed along specific directions in the symbols, highlighting connection features and configuration contours. The direction-aware convolutional kernel is a direction-selective two-dimensional convolutional kernel that can produce a stronger response to specific directional structures in the image (such as horizontal, vertical, diagonally upward, diagonally downward, etc.). The specific mathematical model is as follows:

[0044] ;

[0045] In the formula, k is the radius of the convolution kernel. These correspond to convolution kernels of 3×3, 5×5, and 7×7, respectively. The direction of the convolution kernel. , For the angle Constructed direction template, coordinate position The pixel values ​​at the location are then used; subsequently, a local adaptive histogram equalization algorithm is used to enhance the contrast between lines and background in the region, making the linear structure with low grayscale contrast clearer and enhancing the saliency of complex primitives. The enhanced image is then input into a multi-branch neural network containing local detail channels, topological contour channels, and orientation-aware channels to extract the texture features, connection patterns, and orientation features of complex symbols, respectively. Subsequently, a feature fusion mechanism is used to integrate multi-source information to generate a total feature vector. During the model training phase, a structural template is defined for each class of complex symbols based on the total feature vector. During the verification phase, the total feature vector of the candidate region is matched with the structural template to obtain the target symbol category.

[0046] S3. Construct a pipeline detection module, define a set of structural response kernels to cover all pipeline types, scan the drawing image through the structural response kernels to obtain the response intensity of each pixel to different structural line types, identify the structural type of each pixel from the response group and quantify the confidence level, start from the endpoint pixel, extract the complete continuous path along the direction of structural type matching, merge repeated line segments, standardize the path structure and output the pipeline coordinates and type.

[0047] Furthermore, such as Figure 4 and Figure 5 As shown, the pipeline detection module outputs the pipeline coordinates and type. The specific steps are as follows.

[0048] S31. PID drawing pipeline types include nine types: thick pipeline, thin pipeline, thick dashed pipeline, thin dashed pipeline, O-type pipeline, wavy pipeline, double-layer pipeline (one layer of dashed line and one layer of solid line), double-point type pipeline, and double short-line type pipeline. A set of structural response kernels is defined. Covering all pipeline types, each response core and the segmented drawing image. Perform a convolution operation to generate a response graph. , indicating in Credibility score under the response kernel , The pixel coordinates are used to obtain the final set of response maps. The structural response kernel includes: a solid line kernel. (Detecting continuous solid lines in each direction in the drawing image), dashed line core (Detecting periodically discontinuous dashed line structures), dotted line - short dashed line core (Detects discontinuous paths composed of dots and small horizontal lines), wavy line core (Detection of approximately periodic curved line segments), dual-core (Detection of parallel bilinear structure); where, solid line core The matrix has a 5×5 structure. In the 0° direction, the third column is 1 and the rest are 0. Rotating the 0° direction matrix yields solid line kernels for the 45°, 90°, and 135° directions; dashed line kernels are also obtained. The constructor is , For continuous length, The interval length, For the number of repetitions, For line segment construction, for example, a dashed line core with a continuous length, interval length, and repetition count of 2. Dotted line - dashed line core Constructed from a sparse point structure and Gaussian smoothing, it supports non-uniform point lattices. An example of a point-line kernel matrix is ​​shown below: ;Wave line core Compress and map the cosine function onto the kernel template. T represents the period of the wavy line. , Control the wave amplitude bandwidth, with a value range of [value range missing]. The initial value is set to 0.4; dual-core Composed of two parallel main bands and a suppression axis, it is used to represent virtual and real parallel lines. The two-layer structure is identified by the difference in response between the left and right bands. An example of a dual-line kernel matrix is ​​as follows: .

[0049] S32. Calculate the response value of pixel p in the drawing image using the response map set SRI. In this method, a pixel refers to the information calculated within a 5×5 area centered on that pixel. In the response map set, the index of the largest response value is the structure type label of that pixel. , For structure type tags, , To retrieve the index of the maximum value, Let p be the coordinates of pixel p, and the maximum response value be the credibility score for this tag structure type. ,like If the value is 1, then pixel p belongs to the solid line pipeline category. Solid line pipelines are further divided into thick pipelines, thin pipelines, and O-type lines; if... If pixel p is 2, then it belongs to the dashed line pipeline type. Dashed line pipelines are divided into thick dashed pipelines and thin dashed pipelines; if If pixel p is 3, then it belongs to the dot-line-dashed-line pipeline. The dot-line-dashed-line pipeline is divided into double-dot type pipeline and double-short-line type pipeline; if If the value is 4, then pixel p belongs to the wavy pipeline; if If the value is 5, then pixel p belongs to the point double pipeline.

[0050] S33. Extract the complete continuous path based on the structure type label and confidence score. Calculate the response of pixels surrounding pixel p, and determine the structure type label and confidence score of the surrounding pixels. The path extraction process may encounter the following three situations: If the confidence score of the pixels surrounding pixel p is lower than the existence threshold (set to 50 in this experiment), then pixel p is an isolated pixel and considered an invalid pipeline; if there is more than one valid pixel surrounding pixel p, and the valid pixel is a pixel with a confidence score higher than the existence threshold, then this pixel is an intermediate pixel and a middle component of the pipeline; if there is only one valid pixel surrounding pixel p... If the pixel is a solid point, then that pixel is the endpoint pixel. Once the endpoint pixel is found, its coordinates are recorded as the starting coordinates. The next pixel is then searched based on the structure type label. If the next pixel is an intermediate pixel, it is added to the path, its coordinates are recorded, and the search continues. If the next pixel is an endpoint pixel, it is added to the path and recorded as the ending coordinates. When the structure type is a dashed pipeline, searching across pixels is allowed. The resulting path coordinates are local pipeline coordinates. The global pipeline position information needs to be added to the local coordinates along with the coordinates of the top-left corner of the segmented drawing image in the original drawing image.

[0051] S34. After extracting the complete path, the paths with structure types of solid line pipelines, dashed line pipelines, and dotted-short-dashed line pipelines are further subdivided. Solid line pipelines are divided into thick pipelines, thin pipelines, and O-type lines. The Sobel operator is used to calculate the path width, and Fourier frequency domain is introduced to assist in periodicity judgment. If the path width exhibits periodic changes, the path is an O-type line; if the path does not exhibit periodic changes and the average width exceeds the pipeline width threshold, the path is a thick pipeline; if the path does not exhibit periodic changes and the average width is below the pipeline width threshold, the path is a thin pipeline. The width threshold is set to 5 pixels. Dashed pipelines are divided into thick and thin dashed pipelines. The Sobel operator is used to calculate the path width. If the average path width exceeds the pipeline width threshold, the path is a thick dashed pipeline; if the average path width is lower than the pipeline width threshold, the path is a thin dashed pipeline. Dotted-dash pipelines are divided into double-dot and double-short-line pipelines. Double-dot and double-short-line templates are manually designed. The paths of dotted-dash pipelines are matched with the templates to obtain the matching degree of the two types of pipelines. The path with the higher matching degree is the pipeline type. The matching algorithm implementation code is as follows:

[0052] def match_templates(input_region, templates):

[0053] scores = [] # Initialize a list to store the maximum score for each template match.

[0054] for tpl in templates: # Iterate through all template images to be matched (double-dot templates, double-short-line templates)

[0055] result = cv2.matchTemplate(input_region, tpl, cv2.TM_CCOEFF_NORMED) # TM_CCOEFF_NORMED: Normalized correlation coefficient matching method, output value range [-1, 1], the larger the value, the better the match.

[0056] # Extract the minimum and maximum values ​​from the matching results (the maximum value represents the best match).

[0057] min_val, max_val, _, _ = cv2.minMaxLoc(result) # min_val and max_val are the matching scores; _ represents the positions of the corresponding minimum and maximum values.

[0058] scores.append(max_val) # Add the maximum matching score of the current template to the results list.

[0059] return scores # [score_dot, score_line] # Returns the maximum matching score across all templates.

[0060] S4. Construct a pipeline and symbol recognition model for PID drawings. The model consists of a pipeline detection module and a symbol detection module. Input a PID drawing image, and obtain the location information and corresponding types of pipelines and symbols in the PID drawing through the pipeline detection module and the symbol detection module, respectively.

[0061] Furthermore, in step S4, the PID drawing pipeline and symbol recognition model is based on the PyTorch framework and implemented through the PyCharm application. The model is trained using a training set of 1260 images from the PID drawing image dataset, employing a self-supervised learning method. The trained model is then validated using a validation set of 540 images. The PID drawing pipeline and symbol recognition model detects pipelines and symbols in PID drawing images and outputs the location and classification information of the pipelines and symbols for subsequent PID drawing reconstruction. The PID drawing pipeline and symbol recognition model not only improves the accuracy and precision of pipeline and symbol recognition but also increases the detection speed of the model.

[0062] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the inventive concept of the present invention, and these modifications and improvements all fall within the protection scope of the present invention.

Claims

1. A method for identifying pipelines and symbols in PID drawings, characterized in that, Includes the following steps: S1, PID drawing image dataset creation; S2. Construct a symbol detection module, which is divided into localization task and classification task. The localization task completes the localization of symbol positions in two stages. The symbols in the candidate region are classified according to symbol complexity. Different classification methods are used for simple symbols and complex symbols. S21. The first stage of the localization task predicts the initial position of the symbol, and the second stage corrects the position of the symbol in the first stage. In the first stage, an anchor-free detector is used to perform preliminary localization of the symbol position, and the anchor-free detector outputs the bounding box information of the symbol. In the second stage, a region alignment mechanism is used to finely sample the candidate box region, and a sub-pixel level feature extraction is performed on the boundary region through interpolation method to generate a spatially consistent feature representation, which is input into the boundary regression module. The boundary regression module learns the feature region boundary correction amount by learning the geometric information and boundary relationship within the feature region. The initial bounding box information is updated according to the feature region boundary correction amount to obtain accurate symbol position information. The symbol position information is the local coordinates of the segmented image. The global symbol position information needs to be based on the local coordinates plus the coordinates of the upper left corner of the segmented drawing image in the original drawing image. S22. The classification task first employs an adaptive symbol classification strategy, calculating symbol complexity based on the area, closure, and number of edges of candidate region symbols. The calculated symbol complexity is then compared with a predefined symbol complexity threshold D. v By comparison, symbols are divided into simple symbols and complex symbols, and the symbol complexity D is... f The specific calculation formula is as follows: In the formula, A is the area of ​​the symbol, C is the degree of closure of the symbol, E is the number of edges of the symbol, σ is the adjustment factor, and ξ(A, C, E) is the complementarity of the symbol features. Simple symbols are processed using convolution and max pooling, followed by high-level feature fusion through a fully connected layer. The extracted features are then mapped to symbol categories using a classification head. For complex symbols, candidate regions are input into a multi-directional perceptual convolutional module. Convolution operations are used to extract and enhance the line structures distributed along specific directions within the symbols. Subsequently, a local adaptive histogram equalization algorithm is used to enhance the contrast between lines and the background in the region. The enhanced image is then input into a multi-branch neural network containing local detail channels, topological contour channels, and direction-aware channels to extract the texture features, connectivity patterns, and directional features of the complex symbols, respectively. Subsequently, multi-source information is integrated through a feature fusion mechanism to generate a total feature vector. During the model training phase, a structural template is defined for each type of complex symbol based on the total feature vector. During the verification phase, the total feature vector of the candidate region is matched with the structural template to obtain the target symbol category. S3. Construct a pipeline detection module, define a set of structural response kernels to cover all pipeline types, scan the drawing image through the structural response kernels to obtain the response intensity of each pixel to different structural line types, identify the structural type of each pixel from the response group and quantify the confidence level, start from the endpoint pixel, extract the complete continuous path along the direction of structural type matching, merge repeated line segments, standardize the path structure and output the pipeline coordinates and type. S4. Construct a pipeline and symbol recognition model for PID drawings. The model consists of a pipeline detection module and a symbol detection module. Input a PID drawing image, and obtain the location information and corresponding types of pipelines and symbols in the PID drawing through the pipeline detection module and the symbol detection module, respectively.

2. The method for identifying pipelines and symbols in PID drawings according to claim 1, characterized in that, In step S1, a text detection model is used to automatically identify text regions in the drawing image, and the text regions are filled with white to obtain a drawing image with text information removed. The image with text removed is divided into regions using a sliding window with a stride of 128. The standard deviation of pixel grayscale values ​​within each region is calculated to represent the structural complexity of each region. Non-maximum suppression is applied to the complexity map to extract local peaks, which are then used as the center points of the segmented image patches. The cropping size of each image patch is set to 1024×1024. Density suppression is applied to areas where the selected center points are too close together to avoid excessive duplication. For regions with low values ​​in the complexity map, it is determined whether the standard deviation is lower than the structural complexity threshold. Regions with values ​​lower than the structural complexity threshold are discarded to avoid wasting storage and training resources on blank areas. The coordinates of the top-left corner of the segmented drawing image in the original drawing image are recorded. Pipeline and symbol annotations are applied to the segmented images to obtain the PID drawing dataset, which is then divided into a training set and a validation set.

3. The method for identifying pipelines and symbols in PID drawings according to claim 2, characterized in that, In step S2, the orientation-aware convolution kernel is a two-dimensional convolution kernel with orientation selectivity, which can generate a stronger response for specific directional structures in the image. The orientation-aware convolution response R θ The specific mathematical model for (x, y) is: In the formula, k is the radius of the convolution kernel; θ is the direction of the convolution kernel, K θ For the direction template constructed for angle θ, I(x+i, y+j) is the pixel value at coordinate position (x+i, y+j).

4. The method for identifying pipelines and symbols in PID drawings according to claim 3, characterized in that, In step S3, the pipeline detection module outputs the pipeline coordinates and type. The specific steps are as follows: S31. PID drawing pipeline types include nine types: thick pipeline, thin pipeline, thick dotted pipeline, thin dotted pipeline, O-type pipeline, wavy pipeline, double-layer pipeline, double-point type pipeline, and double short-line type pipeline. A set of structural response kernels K is defined. δ ={K1, K2, K3, K4, K5}, covering all pipeline types, each response core and the segmented drawing image I in Perform a convolution operation to generate a response map R. z (x R y R ) = Conv(I in K z ), indicating that in K z Credibility score under response kernel, z∈{1,2,3,4,5}, (x R y R () represents the pixel coordinates, ultimately resulting in a set of response maps. The structural response kernels include: solid line kernel K1, dashed line kernel K2, dotted-dash line kernel K3, wavy line kernel K4, and double line kernel K5; among them, the solid line kernel K1 has a 5×5 matrix structure, with the third column being 1 and the rest being 0 in the 0° direction. Solid line kernels in the 45°, 90°, and 135° directions are obtained by rotating the 0° direction matrix; the dashed line kernel K2 is constructed using f. shape (L s G s R s = Repeat(L) s [1, ..., 1], G s [0, ..., 0], R s ), L s For continuous length, G s R is the interval length. s The Repeat kernel is used for line segment construction to indicate the number of repetitions; the dotted-line / dashed-line kernel K3 is constructed using a sparse dot structure and Gaussian smoothing, supporting non-uniform dot lattices; the wavy-line kernel K4 maps the cosine function onto the kernel template in a compressed manner. T is the period of the wavy line. Controls wave amplitude bandwidth; the dual-core K5 consists of two parallel main bands and a suppression central axis, used to express virtual and real parallel lines, and identifies the double-layer structure by the response difference between the left and right bands; S32. Calculate the response value of pixel p in the drawing image using the response map set SRI. The index of the maximum response value in the response map set is the structure type label of that pixel. T lab For structure type labels, T lab ∈[1, 2, 3, 4, 5], argmax is the index operation for finding the maximum value, (x p y p () represents the coordinates of pixel p, and the maximum response value is the credibility score for this tag structure type. If T lab If T is 1, then pixel p belongs to the solid line pipeline class. Solid line pipelines are divided into thick pipelines, thin pipelines, and O-type lines; if T lab If T is 2, then pixel p belongs to the dashed line pipeline. Dashed line pipelines are divided into thick dashed pipelines and thin dashed pipelines; if T lab If there are 3 pixels, then pixel p belongs to the dot-line-dashed-line pipeline. The dot-line-dashed-line pipeline is divided into double-dot pipeline and double-short-line pipeline; if T lab If T is 4, then pixel p belongs to the wavy pipeline; if T lab If the value is 5, then pixel p belongs to the point double pipeline; S33. Extract the complete continuous path based on the structure type label and confidence score, calculate the response of the pixels around pixel p, and determine the structure type label and confidence score of the surrounding pixels. The following three situations will be encountered during path extraction: If the confidence score of the pixels around pixel p is lower than the existence threshold, then pixel p is an isolated pixel and is regarded as an invalid pipeline. If pixel p is surrounded by more than one valid pixel, then it is an intermediate pixel and a middle component of the pipeline. If pixel p is surrounded by only one valid pixel, then it is an endpoint pixel. Once the endpoint pixel is found, its coordinates are recorded as the starting coordinates. The next pixel is then searched based on the structure type label. If the next pixel is an intermediate pixel, it is added to the path, its coordinates are recorded, and the search continues. If the next pixel is an endpoint pixel, it is added to the path and recorded as the ending coordinates. When the structure type is a dashed pipeline, searching across pixels is allowed. The resulting path coordinates are local pipeline coordinates. Global pipeline position information requires adding the coordinates of the top-left corner of the segmented drawing image within the original drawing image to the local coordinates. S34. After extracting the complete path, the paths with structure types of solid line pipelines, dashed line pipelines, and dotted-short dashed line pipelines are further subdivided. Solid line pipelines are divided into thick pipelines, thin pipelines, and O-shaped lines. The Sobel operator is used to calculate the path width, and Fourier frequency domain is introduced to assist in periodic judgment. If the path width has a periodic change, the path is an O-shaped line; if the path does not have a periodic change and the average width exceeds the pipeline width threshold, the path is a thick pipeline; if the path does not have a periodic change and the average width is lower than the pipeline width threshold, the path is a thin pipeline. The pipeline width threshold is set to 5 pixels. Dashed line pipelines are divided into thick dashed pipelines and thin dashed pipelines. The Sobel operator is used to calculate the path width. If the average path width exceeds the pipeline width threshold, the path is a thick dashed pipeline; if the average path width is lower than the pipeline width threshold, the path is a thin dashed pipeline. Dotted-line-dash line pipelines are divided into double-dot type pipelines and double-short-line type pipelines. Double-dot type templates and double-short-line type templates are manually designed, and the paths of dotted-line-dash line pipelines are matched with the templates to obtain the matching degree of the two types of pipelines. The path is the pipeline type with the higher matching degree.

Citation Information

Patent Citations

  • Synthetic data generation and building information model (BIM) element extraction from floor plan drawings using machine learning

    CN114641753A

  • Image format pipeline and instrument diagram pipeline identification method based on deep learning

    CN116110071A