Method for identifying pipelines and symbols in PID drawing

By combining the symbol detection module and the pipeline detection module, adopting a two-stage positioning and adaptive classification strategy, and combining the structural response kernel group for pixel-level recognition, the problem of identifying multiple types of pipelines and symbols in PID drawings is solved, and high-precision and stable drawing parsing effects are achieved.

CN120689899AActive Publication Date: 2025-09-23UNIV OF JINAN +1
View PDF 6 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing technologies have difficulty accurately identifying multiple types of pipelines and symbols in PID drawings, especially in the case of complex structures, large changes in symbol scales, and line interference. The recognition accuracy and robustness are insufficient, making it difficult to meet the needs of automated parsing of industrial drawings.

Method used

A combination method of symbol detection module and pipeline detection module is adopted. The symbol detection module adopts a two-stage positioning mechanism and adaptive classification strategy. Simple symbols use standard convolutional classification network, and complex symbols introduce direction-aware convolution module; the pipeline detection module performs pixel-level recognition through structure response kernel group, combined with endpoint tracking and path extraction.

Benefits of technology

It significantly improves the recognition accuracy and robustness of symbols and pipelines in PID drawings, enhances 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 CN120689899A_ABST
    Figure CN120689899A_ABST
Patent Text Reader

Abstract

The invention provides an identification method for pipelines and symbols in a PID drawing, relates to the field of image identification, and designs a complete intelligent identification process from data set construction, symbol detection to pipeline identification in order to solve the problems of structural complexity and symbol diversity in the drawing. A two-stage positioning mechanism and a self-adaptive classification strategy are introduced into the symbol detection module, simple symbols are identified through a standard convolution class network, and complex symbols are introduced into a direction perception convolution module and a multi-channel feature extraction and local enhancement strategy to realize high-precision classification; in the aspect of pipeline detection, a group of structure response kernels are designed to obtain the structure type and credibility of each pixel point, path tracking and extraction are completed from an end point, and fine-grained pipeline type discrimination is performed after extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] PID drawings (Process Piping and Instrumentation Diagrams) are key technical documents in the design, operation, and management of industrial processes and are widely used in the petrochemical industry. These drawings depict equipment, pipelines, valves, and instruments using standardized symbols and line types, forming an important foundation for the digital and visual management of production systems. With the development of intelligent manufacturing and industrial digitalization, automated drawing parsing technology is needed to extract the structure of drawing elements. Currently, some methods have attempted to use image processing or deep learning to recognize pipelines and symbols in PID drawings, but these methods still face multiple challenges in practical applications. First, the pipeline structures in PID drawings are diverse, including straight lines, broken lines, double lines, and dash-dot lines, with complex directions, widths, and topological relationships. Second, the drawings contain a large number of standardized symbols of varying shapes and sizes, and these symbols may behave differently under different drawing standards. Therefore, an intelligent recognition method that can accurately identify multiple types of pipelines and symbols, with good robustness and drawing adaptability, is needed to support the automatic structural parsing and subsequent reconstruction of PID drawings.

[0003] Image structure parsing and visual recognition technologies have made significant progress, driven by deep learning. Convolutional neural networks have demonstrated powerful feature modeling capabilities for object detection, edge extraction, and image recognition in static images. Furthermore, new models such as anchor-free localization structures and the Transformer architecture have further improved structure localization accuracy and context modeling capabilities. However, existing drawing recognition methods still suffer from insufficient generalization, inaccurate localization, and monotonous feature representation when dealing with complex structural morphology, large symbol scale variations, and interlaced line interference, making them difficult to meet the requirements of parsing highly complex engineering drawings. To address these issues, this paper proposes a method for pipeline and symbol recognition in PID drawings. This method detects symbols and pipelines separately and proposes different recognition methods based on their characteristics. Symbol detection incorporates a two-stage localization mechanism and an adaptive classification strategy, using different methods to classify simple and complex symbols. A structural response kernel is designed to construct a response space for pipeline detection, enabling pixel-level structural type perception and continuous path reconstruction. This method effectively improves detection accuracy and path extraction stability in complex scenarios while ensuring complete structural recognition. Summary of the Invention

[0004] The present invention provides a method for identifying pipelines and symbols in PID drawings. The method aims to realize the positioning and classification of symbols and pipelines in PID drawings through a symbol detection module and a pipeline detection module. A two-stage positioning mechanism and an adaptive classification strategy are introduced into the symbol detection module. Simple symbols are recognized through a standard convolution classification network, while complex symbols are classified with high precision by introducing a direction-aware convolution module, multi-channel feature extraction, and a local enhancement strategy. In terms of pipeline detection, a set of structural response kernels are designed to obtain the structural type and credibility of each pixel point, and path tracing and extraction are completed starting from the endpoint. After the path extraction is completed, the pipeline type is classified in detail.

[0005] In order to achieve the above-mentioned object, the present invention provides the following technical solution: a method for identifying pipelines and symbols in PID drawings, comprising the following steps.

[0006] S1. Preparation of PID drawing image dataset.

[0007] S2. Construct a symbol detection module, which is divided into positioning task and classification task. The positioning task completes the positioning of the symbol through two stages. The classification task improves the disadvantage that the traditional symbol classification cannot fully utilize system resources by using the same strategy. The symbols in the candidate area are classified by symbol complexity, and different classification methods are used for simple symbols and complex symbols.

[0008] S3. Build a pipeline detection module and define a set of structural response kernels that cover all pipeline types. Scan the drawing image using the structural response kernel to obtain the response intensity of each pixel to different structural line types. Identify the structural type of each pixel in the response group and quantify the credibility. Starting from the endpoint pixel, extract the complete continuous path along the direction of the structural type matching, merge repeated line segments, standardize the path structure, and output the pipeline coordinates and type.

[0009] S4. Construct a PID drawing pipeline and symbol recognition model. The model consists of a pipeline detection module and a symbol detection module. The PID drawing image is input and the position information and corresponding types of pipelines and symbols in the PID drawing are obtained 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 areas in a drawing image, and the text areas are filled with white to obtain a drawing image with text information removed; a sliding window with a step size of 128 is used to divide the image from which text is removed into regions, the standard deviation of the pixel grayscale in each region is calculated to represent the structural complexity of each region, the complexity map is subjected to non-maximum suppression to extract local peak points, the local peak points are used as the center points of the segmented blocks, the cropping size of each image is set to 1024×1024, and density suppression is performed for areas where the distance between the selected center points is too close to avoid a large number of repetitions, and for areas with lower values ​​in the complexity map, whether the standard deviation is lower than the structural complexity threshold is determined, and areas below the structural complexity threshold are discarded to avoid wasting storage and training resources in blank areas; the coordinates of the upper left corner of the segmented drawing image in the original drawing image are recorded, and the segmented image is annotated with pipelines and symbols to obtain a PID drawing data set, and the data set is divided into a training set and a validation set.

[0011] Preferably, in step S1, the dataset production method first uses a text detection model to accurately identify and whiten the text area in the drawing 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 high-complexity areas as cutting center points, and a large-size drawing image is divided into multiple small-size images to improve the model training speed and recognition accuracy; a standard deviation threshold is set to effectively filter blank images to ensure that all images are valid images; finally, high-quality images are generated for pipeline and symbol annotation, which provides a high-quality data foundation for subsequent model training and improves 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 position of the symbol in the drawing, and then the classification task classifies the symbols in the candidate area. The specific steps are: S21. The positioning task is divided into two stages. The first stage predicts the initial position of the symbol, and the second stage corrects the boundary of the position in the first stage to ensure accurate positioning. The first stage uses the anchor-free detector to perform preliminary positioning of the symbol position. The anchor-free detector outputs the symbol's bounding box information (upper left corner coordinates and lower right corner coordinates). The second stage first uses the region alignment mechanism to finely sample the candidate box area. During the process, the floating-point precision of the coordinates is maintained to avoid the spatial offset caused by traditional integer quantization operations. The boundary area is extracted at the sub-pixel level by interpolation to generate a feature representation with spatial consistency for the symbol area. The aligned feature area is input into the boundary regression module. The boundary regression module obtains the feature area boundary correction value by learning the geometric information and boundary relationship within the feature area, including the horizontal and vertical position fine-tuning values ​​and the width and height scaling factors. The initial bounding box information is updated according to the feature area boundary correction value 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 adopts the adaptive symbol classification strategy, calculates the symbol complexity by the area, closure and edge number of the candidate region symbol, and compares the calculated symbol complexity with the set 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). The specific calculation formula is: ; Where A is the area of ​​the symbol, C is the degree of closure of the symbol (from 0 to 1, 0 means completely open, 1 means completely closed), and E is the number of edges of the symbol. is the adjustment factor, is the complementarity of symbolic features, ; For simple symbols, the convolution layer is used to extract the edge and texture features of the candidate area, and then the maximum pooling is used to reduce the size of the feature map to improve the network's robustness to position and scale changes. After that, the high-level features of the symbol are fused through full connection, and finally the extracted features are mapped to the symbol category through the classification head; For complex symbols, the complex symbol candidate area is input into the multi-directional perception convolution module, which is composed of direction-aware convolution kernels with specific directions. The convolution operation extracts and strengthens the line structure distributed along a specific direction in the symbol, highlighting the connection features and configuration contours. The direction-aware convolution kernel is a two-dimensional convolution kernel with direction selectivity, which can produce a stronger response to the specific direction structure in the image. The direction-aware convolution response The specific mathematical model is: ; Where k is the convolution kernel radius; is the direction of the convolution kernel, For angle Constructed direction template, is the coordinate position The pixel values ​​at the locations are obtained; the local adaptive histogram equalization algorithm is then used to enhance the contrast between the lines and the background in the region, so that the linear structure with low grayscale contrast is expressed more clearly and the contour saliency of the complex primitives is enhanced. The enhanced image is input into a multi-branch neural network containing a local detail channel, a topological contour channel and a direction perception channel to extract the texture features, connection morphology and direction features of the complex symbols respectively; the multi-source information is then integrated through the feature fusion mechanism to generate a total feature vector. In the model training phase, a structural template is defined for each type of complex symbol based on the total feature vector. In the verification phase, the total feature vector of the candidate region is matched with the structural template to obtain the target symbol category.

[0013] 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 positioning mechanism and an adaptive symbol classification strategy; the first stage quickly predicts the initial symbol position through the anchor-free detector, and the second stage accurately aligns the regional features through the boundary alignment module and performs boundary correction, thereby optimizing the accuracy of the symbol position; the classification task is based on the complexity of the symbol to perform adaptive classification, and the symbols in the drawing are divided into simple symbols and complex symbols. The adaptive symbol classification strategy aims to automatically select the appropriate classification method according to the symbol type, size, and shape information of the input drawing according to the symbol complexity, avoid the use of complex classification mechanisms for simple symbols, and save computing resources; the overall design fully considers the diversity and complexity of symbol forms in the drawing when efficiently processing symbols, and has the significant advantages of high precision, strong robustness, and adaptability to complex symbols, providing reliable technical support for the automated processing and digital modeling of PID drawings.

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

[0015] S31, PID drawing pipeline types include thick pipeline, thin pipeline, thick dotted pipeline, thin dotted pipeline, O-shaped pipeline, wavy pipeline, double-layer pipeline (one dotted line and one solid line), double-point pipeline and double short-line pipeline. Define a set of structural response kernels. , covering all pipeline types, each response core and the segmented drawing image Perform convolution operation to generate a response map , indicating that Credibility score under the response kernel, , is the pixel coordinate value, and the response map set is finally obtained ; Structural response kernel includes: solid line kernel (Detect continuous solid lines in all directions in the drawing image), dotted line kernel (detecting periodically discontinuous dashed line structures), dot-dash kernel (detects discontinuous paths consisting of dots and small horizontal lines), wavy line kernel (detection of approximately periodic curved line segments), double line kernel (Detection of parallel double-line structure); where the solid line core The structure is a 5×5 matrix, the 0° direction is a matrix with the third column as 1 and the rest as 0. By rotating the 0° direction matrix, the solid line kernels in the 45°, 90°, and 135° directions are obtained; the dotted line kernel The constructor is , is the continuous length, is the interval length, is the number of repetitions, For line segment construction; dot-dash kernel Constructed by sparse point structure and Gauss smoothing, supporting non-uniform lattices; wavy line kernel Compress and map the cos function onto the kernel template, , T is the period of the wave line, Control wave amplitude bandwidth; dual-line core It consists of two parallel main bands and an inhibitory central axis to express virtual and real parallel lines, and to identify double-layer structures through the response difference between the left and right bands; S32. Calculate the response amount of the pixel point p in the drawing image using the response map set SRI. The maximum response amount in the response map set is subscripted as the structural type label of the pixel point. , is the structure type tag, , To obtain the maximum value subscript operation, is the coordinate of pixel point p, and the maximum response is the credibility score of the label structure type. ,like If is 1, the pixel point p belongs to the solid line pipeline, which is divided into thick pipeline, thin pipeline and O-shaped line; If is 2, the pixel point p belongs to the dotted line pipeline, which is divided into thick dotted pipeline and thin dotted pipeline; if If is 3, the pixel point p belongs to the dot-line-short dash pipeline, which is divided into double-dot pipeline and double-short dash pipeline; if If is 4, the pixel point p belongs to the wave pipeline; if If it is 5, the pixel point p belongs to the double-layer pipeline; S33. Extract a complete continuous path based on the structure type label and credibility score, calculate the response amount of the pixels around the pixel point p, and determine the structure type label and credibility score of the surrounding pixels. The following three situations will be encountered during path extraction: If the credibility score of the pixels around the pixel point p is lower than the existence threshold, the pixel point p is an isolated pixel and is regarded as an invalid pipeline; if there are more than one valid pixel points around the pixel point p, the pixel point is an intermediate pixel point and is an intermediate component of the pipeline; if there is only one valid pixel point around the pixel point p, the pixel point is an endpoint pixel; find the endpoint Pixel, record the endpoint pixel coordinates as the starting point coordinates, and find the next pixel point according to the structure type label. If the next pixel point is an intermediate pixel point, add the next pixel point to the path, record the pixel point coordinates, and continue to find the next pixel point; if the next pixel point is an endpoint pixel, add the next pixel point to the path and record it as the end point coordinates; when the structure type is a dotted line pipeline, searching for the next pixel point allows cross-pixel searching; the obtained path coordinates are local pipeline coordinates, and the global pipeline 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; S34. After extracting the complete path, the paths with the structural types of solid line pipelines, dashed line pipelines and dotted-dashed line pipelines are divided in detail. The solid line pipelines are divided into thick pipelines, thin pipelines and O-shaped pipelines. The Sobel operator is used to calculate the width of the path, and the Fourier frequency domain is introduced to assist in periodic judgment. If the path width has periodic changes, the path is an O-shaped line; if the path does not have periodic changes and the average width exceeds the pipeline width threshold, the path is a thick pipeline; if the path does not have periodic changes and the average width is lower than the pipeline width threshold, then This path is a thin pipeline. Dashed pipelines are divided into thick and thin dashed pipelines. The Sobel operator is used to calculate the width of the path. 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. Dot-dash pipelines are divided into double-dot pipelines and double-short-line pipelines. Double-dot templates and double-short-line templates are manually designed, and the dot-dash pipeline path is matched with the template to obtain the matching degree of the two types of pipelines. This path is a pipeline type with a high matching degree.

[0016] Preferably, in step S3, a high-precision recognition method based on a structural response kernel group 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 types of structural kernels within the local neighborhood of pixels, the structural type assignment and credibility quantification of each pixel are achieved; combined with the endpoint-guided directional growth strategy, the pipeline path is completely extracted and the coordinates are located; further fusion of edge width analysis and frequency domain periodicity judgment is achieved to achieve fine classification of similar pipeline morphologies; this method has good continuity recognition ability, structural adaptability, and type discrimination, and can still achieve stable and accurate pipeline extraction in a complex drawing environment, significantly improving the intelligence level and practicality of automatic drawing parsing.

[0017] Compared with the prior art, the present invention has the following beneficial effects: The present 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 a structural response core group, high-precision recognition of multiple types of drawings and pipelines in PID drawings is achieved. Compared with the existing technology, the present invention shows significant advantages in symbol classification accuracy, pipeline continuity extraction, preprocessing and drawing versatility, and can effectively improve the efficiency and reliability of intelligent analysis and digital reconstruction of industrial drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 The present invention provides a flow chart of a method for identifying pipelines and symbols in PID drawings.

[0019] Figure 2 This is the PID drawing image provided by the present invention after removing the text area segmentation.

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

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

[0022] Figure 5 This is an example diagram of pipeline types provided by the present invention. DETAILED DESCRIPTION

[0023] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0024] See also Figures 1 to 5The present invention provides a method for identifying pipelines and symbols in PID drawings. The positioning and classification of symbols and pipelines in PID drawings are achieved through a symbol detection module and a pipeline detection module. A two-stage positioning mechanism and an adaptive classification strategy are introduced in the symbol detection module. Simple symbols are recognized through a standard convolution classification network, while complex symbols are classified with high precision by introducing a direction-aware convolution module, a multi-channel feature extraction and a local enhancement strategy. In terms of pipeline detection, a set of structural response kernels are designed to obtain the structural type and credibility of each pixel point, and path tracking and extraction are completed starting from the endpoint. After extraction, fine-grained pipeline type discrimination is completed by combining width analysis and frequency domain periodicity detection, and template matching is used to distinguish point-line structures, which effectively improves the detection accuracy and extraction stability, and prepares for subsequent PID drawing reconstruction.

[0025] See Figure 1 As shown, a method for identifying pipelines and symbols in PID drawings in an embodiment of the present application.

[0026] S1. Preparation of PID drawing image dataset.

[0027] Further, if Figure 2 As shown, a text detection model is used to automatically identify text areas in drawing images, and the text areas are filled with white to obtain drawing images with text information removed; a sliding window with a step size of 128 is used to divide the image with text removed into regions, and the standard deviation of the pixel grayscale in each region is calculated to represent the structural complexity of each region. The complexity map is subjected to non-maximum suppression to extract local peak points, and the local peak points are used as the center points of the segmented blocks. The cropping size of each image is set to 1024×1024. For the selected center points that are too close, density suppression is performed to avoid a large number of repetitions. For areas with lower values ​​in the complexity map, it is determined whether the standard deviation is lower than the structural complexity threshold. Areas below the structural complexity threshold are discarded. The structural complexity threshold of this experiment is set to 12 to avoid wasting storage and training resources in blank areas; the coordinates of the upper left corner of the segmented drawing image in the original drawing image are recorded, and the segmented image is annotated with pipelines and symbols to obtain a PID drawing dataset, which is divided into a training set and a validation set.

[0028] S2. Construct a symbol detection module, which is divided into positioning task and classification task. The positioning task completes the positioning of the symbol through two stages. The classification task improves the disadvantage that the traditional symbol classification cannot fully utilize system resources by using the same strategy. The symbols in the candidate area are classified by symbol complexity, and different classification methods are used for simple symbols and complex symbols.

[0029] Further, if Figure 3As shown, the symbol detection module includes positioning tasks and classification tasks. The positioning task first determines the exact position of the symbol in the drawing, and then the classification task classifies the symbols in the candidate area. The specific steps are as follows.

[0030] 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 boundary of the position in the first stage to ensure accurate positioning. The first stage uses an anchor-free detector to perform preliminary localization of the symbol position. The anchor-free detector outputs the symbol's bounding box information (upper left corner coordinates and lower right corner coordinates). The second stage first uses a region alignment mechanism to fine-sample the candidate box area. The process maintains the floating-point precision of the coordinates to avoid the spatial offset caused by traditional integer quantization operations. The boundary region is extracted at the sub-pixel level 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 geometric information and boundary relationship within the feature region to obtain the feature region boundary correction value, including horizontal and vertical position fine-tuning values ​​and width and height scaling factors. The initial bounding box information is updated based on the feature region boundary correction value to obtain accurate symbol position information. The symbol position information is the local coordinates of the segmented image. The global symbol position information requires adding the coordinates of the upper left corner of the segmented drawing image in the original drawing image to the local coordinates.

[0031] S22, the classification task first adopts the adaptive symbol classification strategy, calculates the symbol complexity by the area, closure and edge number of the candidate region symbol, and compares the calculated symbol complexity with the set symbol complexity threshold In comparison, the symbol complexity threshold is set to 3, and 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). The specific calculation formula is: ; Where, The value range is , A is the area of ​​the symbol, C is the degree of closure of the symbol (from 0 to 1, 0 means completely open, 1 means completely closed), E is the number of edges of the symbol, is the adjustment factor, and its value range is , the initial value is set to 0.5, which controls the impact of the complementarity part on the complexity score. is the complementarity of symbolic features, , which represents the nonlinear relationship between symbols; for simple symbols, a 3×3 convolution layer is used to extract the edge and texture features of the candidate area, and then the maximum pooling is used to reduce the size of the feature map to improve the network's robustness to position and scale changes. After that, the high-level features of the symbol are fused through full connection, and finally the extracted features are mapped to the symbol category through the classification head; for complex symbols, the complex symbol candidate area is input into the multi-directional perception convolution module, which is composed of direction-aware convolution kernels with specific directions. The convolution operation extracts and strengthens the line structure distributed along a specific direction in the symbol, highlighting the connection features and configuration contours. The direction-aware convolution kernel is a two-dimensional convolution kernel with direction selectivity, which can produce a stronger response to structures in specific directions (such as horizontal, vertical, oblique up, oblique down, etc.) in the image. The direction-aware convolution response The specific mathematical model is: ; Where k is the radius of the convolution kernel, , corresponding to 3×3, 5×5, and 7×7 convolution kernels, respectively. is the direction of the convolution kernel, , For angle Constructed direction template, is the coordinate position The pixel values ​​at the locations are obtained; the local adaptive histogram equalization algorithm is then used to enhance the contrast between the lines and the background in the region, so that the linear structure with low grayscale contrast is expressed more clearly and the contour saliency of the complex primitives is enhanced. The enhanced image is input into a multi-branch neural network containing a local detail channel, a topological contour channel and a direction perception channel to extract the texture features, connection morphology and direction features of the complex symbols respectively; the multi-source information is then integrated through the feature fusion mechanism to generate a total feature vector. In the model training phase, a structural template is defined for each type of complex symbol based on the total feature vector. In the verification phase, the total feature vector of the candidate region is matched with the structural template to obtain the target symbol category.

[0032] S3. Build a pipeline detection module and define a set of structural response kernels that cover all pipeline types. Scan the drawing image using the structural response kernel to obtain the response intensity of each pixel to different structural line types. Identify the structural type of each pixel in the response group and quantify the credibility. Starting from the endpoint pixel, extract the complete continuous path along the direction of the structural type matching, merge repeated line segments, standardize the path structure, and output the pipeline coordinates and type.

[0033] Further, if Figure 4 and Figure 5 As shown, the pipeline detection module outputs pipeline coordinates and types. The specific steps are as follows.

[0034] S31, PID drawing pipeline types include thick pipeline, thin pipeline, thick dotted pipeline, thin dotted pipeline, O-shaped pipeline, wavy pipeline, double-layer pipeline (one dotted line and one solid line), double-point pipeline and double short-line pipeline. Define a set of structural response kernels. , covering all pipeline types, each response core and the segmented drawing image Perform convolution operation to generate a response map , indicating that Credibility score under the response kernel, , is the pixel coordinate value, and the response map set is finally obtained ; Structural response kernel includes: solid line kernel (Detect continuous solid lines in all directions in the drawing image), dotted line kernel (detecting periodically discontinuous dashed line structures), dot-dash kernel (detects discontinuous paths consisting of dots and small horizontal lines), wavy line kernel (detection of approximately periodic curved line segments), double line kernel (Detection of parallel double-line structure); where the solid line core The structure is a 5×5 matrix, the 0° direction is a matrix with the third column as 1 and the rest as 0. By rotating the 0° direction matrix, the solid line kernels in the 45°, 90°, and 135° directions are obtained; the dotted line kernel The constructor is , is the continuous length, is the interval length, is the number of repetitions, For line segment construction, for example, the dashed line kernel with continuous length, interval length and number of repetitions all being 2 is ; dot-dash core Constructed by sparse point structure and Gauss smoothing, it supports non-uniform lattices. Examples of point-line kernel matrices are: ; Wavy line core Compress and map the cos function onto the kernel template, , T is the period of the wave line, , Control the wave amplitude bandwidth, the value range is , the initial value is set to 0.4; the dual-line kernel It consists of two parallel main bands and an inhibitory central axis to express virtual and real parallel lines. It identifies double-layer structures by the difference in left and right band responses. An example of a double-line kernel matrix is: .

[0035] S32. Calculate the response amount of the pixel point p in the drawing image using the response graph set SRI. The pixel point of this method refers to the information calculated within a 5×5 range with the pixel point as the center. , the maximum response in the response graph set is the structural type label of the pixel point, , is the structure type tag, , To obtain the maximum value subscript operation, is the coordinate of pixel point p, and the maximum response is the credibility score of the label structure type. ,like If is 1, the pixel point p belongs to the solid line pipeline, which is divided into thick pipeline, thin pipeline and O-shaped line; If is 2, the pixel point p belongs to the dotted line pipeline, which is divided into thick dotted pipeline and thin dotted pipeline; if If is 3, the pixel point p belongs to the dot-line-short dash pipeline, which is divided into double-dot pipeline and double-short dash pipeline; if If is 4, the pixel point p belongs to the wave pipeline; if If it is 5, the pixel point p belongs to the double-layer pipeline.

[0036] S33. Extract a complete continuous path based on the structure type label and credibility score, calculate the response amount of the pixels around the pixel point p, and determine the structure type label and credibility score of the surrounding pixels. The following three situations will be encountered during path extraction: If the credibility score of the pixels around the pixel point p is lower than the existence threshold, the existence threshold is set to 50 in this experiment, then the pixel point p is an isolated pixel and is regarded as an invalid pipeline; if there is more than one valid pixel point around the pixel point p, and the valid pixel point is a pixel point with a credibility score higher than the existence threshold, then the pixel point is an intermediate pixel point and is an intermediate component of the pipeline; if there is only one valid pixel point around the pixel point p, then the pixel point is an intermediate pixel point and is an intermediate component of the pipeline; if there is only one valid pixel point around the pixel point p, then the pixel point is an intermediate pixel point and is an intermediate component of the pipeline. If the pixel point is an endpoint pixel, then the pixel point is the endpoint pixel; find the endpoint pixel, record the endpoint pixel coordinates as the starting point coordinates, and find the next pixel point according to the structure type label. If the next pixel point is an intermediate pixel point, add the next pixel point to the path, record the pixel point coordinates and continue to find the next pixel point; if the next pixel point is an endpoint pixel, add the next pixel point to the path and record it as the end point coordinates; when the structure type is a dotted line pipeline, cross-pixel search is allowed when looking for the next pixel point; the obtained path coordinates are the local pipeline coordinates, and the global pipeline 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.

[0037] S34. After extracting the complete path, the paths with the structural types of solid line pipelines, dashed line pipelines and dotted-dashed line pipelines are divided in detail. The solid line pipelines are divided into thick pipelines, thin pipelines and O-shaped pipelines. The Sobel operator is used to calculate the width of the path, and the Fourier frequency domain is introduced to assist in periodic judgment. If the path width has periodic changes, the path is an O-shaped line; if the path does not have periodic changes and the average width exceeds the pipeline width threshold, the path is a thick pipeline; if the path does not have periodic changes and the average width is lower than the pipeline width threshold, the path is a thin pipeline, and the pipeline width is The width threshold is set to 5 pixels; the dotted pipelines are divided into thick and thin dotted pipelines. The Sobel operator is used to calculate the width of the path. If the average path width exceeds the pipeline width threshold, the path is a thick dotted pipeline; if the average path width is lower than the pipeline width threshold, the path is a thin dotted pipeline; the dot-dash pipelines are divided into double-dot pipelines and double-short-line pipelines. Double-dot templates and double-short-line templates are manually designed, and the path of the dot-dash pipeline is matched with the template to obtain the matching degree of the two types of pipelines. This path is a pipeline type with a high matching degree. The matching algorithm implementation code is as follows: def match_templates(input_region, templates): scores = [] # Initialize a list to store the maximum score of each template match for tpl in templates: # Traverse all template images to be matched (double-point template, double-short-line template) 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 # Extract the minimum and maximum values ​​in the matching results (the maximum value indicates the best match) min_val, max_val, _, _ = cv2.minMaxLoc(result) # min_val, max_val are matching scores; _ is the location of the corresponding minimum and maximum values scores.append(max_val) # Add the maximum matching score of the current template to the result list return scores # [score_dot, score_line] # Returns the maximum matching score of all templates.

[0038] S4. Construct a PID drawing pipeline and symbol recognition model. The model consists of a pipeline detection module and a symbol detection module. The PID drawing image is input and the position information and corresponding types of pipelines and symbols in the PID drawing are obtained through the pipeline detection module and the symbol detection module respectively.

[0039] 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 1,260 training sets in the PID drawing image dataset, and the training is started using a self-supervised learning method. The trained model is verified using a 540-image validation set. The PID drawing pipeline and symbol recognition model detects pipelines and symbols in the PID drawing image, and outputs the location information 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 recognition precision and accuracy of pipelines and symbols, but also improves the detection speed of the model.

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

Claims

1. A method for identifying pipelines and symbols in PID drawings, characterized in that: The following steps are involved: S1, PID drawing image dataset preparation; S2. Construct a symbol detection module, which is divided into positioning and classification tasks. The positioning task completes the positioning of the symbol through two stages. The classification task improves the disadvantage of traditional symbol classification that the same strategy cannot fully utilize system resources. The symbols in the candidate area are classified according to the symbol complexity, and different classification methods are used for simple and complex symbols. S3. Build a pipeline detection module and define a set of structural response kernels covering all pipeline types. Scan the drawing image using the structural response kernels to obtain the response strength of each pixel to different structural line types. Identify the structural type of each pixel in the response group and quantify the credibility. Starting from the endpoint pixels, extract the complete continuous path along the direction of the structural type matching, merge repeated line segments, standardize the path structure, and output the pipeline coordinates and type. S4. Construct a PID drawing pipeline and symbol recognition model. The model consists of a pipeline detection module and a symbol detection module. The PID drawing image is input and the position information and corresponding types of pipelines and symbols in the PID drawing are obtained through the pipeline detection module and the symbol detection module respectively.

2. A method for identifying pipelines and symbols in PID drawings according to claim 1, characterized in that: In step S1, the text detection model is used to automatically identify the text area in the drawing image, and the text area is filled with white to obtain the drawing image without the text information; The image with text removed is divided into regions using a sliding window with a step size of 128. The standard deviation of the pixel grayscale in each region is calculated to represent the structural complexity of each region. The complexity map is subjected to non-maximum suppression to extract local peak points, which are used as the center points of the segmented blocks. The cropping size of each image is set to 1024×1024. For the selected center points that are too close, density suppression is performed to avoid a large number of repetitions. For the areas with lower values ​​in the complexity map, it is determined whether the standard deviation is lower than the structural complexity threshold. Areas below the structural complexity threshold are discarded to avoid wasting storage and training resources in blank areas. The coordinates of the upper left corner of the segmented drawing image in the original drawing image are recorded, and the segmented image is annotated with pipelines and symbols to obtain the PID drawing dataset, which is then divided into a training set and a validation set.

3. A method for identifying pipelines and symbols in PID drawings according to claim 2, characterized in that: In step S2, the symbol detection module includes positioning and classification tasks. 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: S21. The positioning task is divided into two stages. The first stage predicts the initial position of the symbol, and the second stage corrects the boundary of the position in the first stage to ensure accurate positioning. The first stage uses the anchor-free detector to perform preliminary positioning of the symbol position. The anchor-free detector outputs the symbol's bounding box information (upper left corner coordinates and lower right corner coordinates). The second stage first uses the region alignment mechanism to finely sample the candidate box area. During the process, the floating-point precision of the coordinates is maintained to avoid the spatial offset caused by traditional integer quantization operations. The boundary area is extracted at the sub-pixel level by interpolation to generate a feature representation with spatial consistency for the symbol area. The aligned feature area is input into the boundary regression module. The boundary regression module obtains the feature area boundary correction value by learning the geometric information and boundary relationship within the feature area, including the horizontal and vertical position fine-tuning values ​​and the width and height scaling factors. The initial bounding box information is updated according to the feature area boundary correction value 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 adopts the adaptive symbol classification strategy, calculates the symbol complexity by the area, closure and edge number of the candidate region symbol, and compares the calculated symbol complexity with the set 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). The specific calculation formula is: ; Where A is the area of ​​the symbol, C is the degree of closure of the symbol (from 0 to 1, 0 means completely open, 1 means completely closed), and E is the number of edges of the symbol. is the adjustment factor, is the complementarity of symbolic features, ; For simple symbols, the convolution layer is used to extract the edge and texture features of the candidate area, and then the maximum pooling is used to reduce the size of the feature map to improve the network's robustness to position and scale changes. After that, the high-level features of the symbol are fused through full connection, and finally the extracted features are mapped to the symbol category through the classification head; For complex symbols, the complex symbol candidate area is input into the multi-directional perception convolution module, which is composed of direction-aware convolution kernels with specific directions. The convolution operation extracts and strengthens the line structure distributed along a specific direction in the symbol, highlighting the connection features and configuration contours. The direction-aware convolution kernel is a two-dimensional convolution kernel with direction selectivity, which can produce a stronger response to the specific direction structure in the image. The direction-aware convolution response The specific mathematical model is: ; Where k is the convolution kernel radius; is the direction of the convolution kernel, For angle Constructed direction template, is the coordinate position The pixel values ​​at the locations are then converted to pixel values. A local adaptive histogram equalization algorithm is then used to enhance the contrast between the lines and the background in the region, making the linear structure with low grayscale contrast more clearly expressed and enhancing the contour saliency of complex primitives. The enhanced image is then fed into a multi-branch neural network containing a local detail channel, a topological contour channel, and a direction perception channel to extract the texture features, connection morphology, and direction features of the complex symbol, respectively. Subsequently, multi-source information is integrated through the feature fusion mechanism to generate a total feature vector. In the model training phase, a structural template is defined for each type of complex symbol based on the total feature vector. In the verification phase, the total feature vector of the candidate area is matched with the structural template to obtain the target symbol category.

4. A 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 thick pipeline, thin pipeline, thick dotted pipeline, thin dotted pipeline, O-shaped pipeline, wavy pipeline, double-layer pipeline (one dotted line and one solid line), double-point pipeline and double short-line pipeline. Define a set of structural response kernels. , covering all pipeline types, each response core and the segmented drawing image Perform convolution operation to generate a response map , indicating that Credibility score under the response kernel, , is the pixel coordinate value, and the response map set is finally obtained ; Structural response kernels include: solid line kernel (Detect continuous solid lines in all directions in the drawing image), dotted line kernel (detecting periodically discontinuous dashed line structures), dot-dash kernel (detects discontinuous paths consisting of dots and small horizontal lines), wavy line kernel (detection of approximately periodic curved line segments), double line kernel (Detection of parallel double-line structure); where the solid line core The structure is a 5×5 matrix, the 0° direction is a matrix with the third column as 1 and the rest as 0. By rotating the 0° direction matrix, the solid line kernels in the 45°, 90°, and 135° directions are obtained; the dotted line kernel The constructor is , is the continuous length, is the interval length, is the number of repetitions, For line segment construction; dot-dash kernel Constructed by sparse point structure and Gauss smoothing, supporting non-uniform lattices; wavy line kernel Compress and map the cos function onto the kernel template, , T is the period of the wave line, Control wave amplitude bandwidth; dual-line core It consists of two parallel main bands and an inhibitory central axis to express virtual and real parallel lines, and to identify double-layer structures through the response difference between the left and right bands; S32. Calculate the response amount of the pixel point p in the drawing image using the response map set SRI. The maximum response amount in the response map set is subscripted as the structural type label of the pixel point. , is the structure type tag, , To obtain the maximum value subscript operation, is the coordinate of pixel point p, and the maximum response is the credibility score of the label structure type. ,like If is 1, the pixel point p belongs to the solid line pipeline, which is divided into thick pipeline, thin pipeline and O-shaped line; If is 2, the pixel point p belongs to the dotted line pipeline, which is divided into thick dotted pipeline and thin dotted pipeline; if If is 3, the pixel point p belongs to the dot-line-short dash pipeline, which is divided into double-dot pipeline and double-short dash pipeline; if If is 4, the pixel point p belongs to the wave pipeline; if If it is 5, the pixel point p belongs to the double-layer pipeline; S33. Extract a complete continuous path based on the structure type label and credibility score, calculate the response amount of the pixels around the pixel point p, and determine the structure type label and credibility score of the surrounding pixels. The following three situations will be encountered during path extraction: If the credibility score of the pixels around the pixel point p is lower than the existence threshold, the pixel point p is an isolated pixel and is regarded as an invalid pipeline; if there are more than one valid pixel points around the pixel point p, the pixel point is an intermediate pixel point and is an intermediate component of the pipeline; if there is only one valid pixel point around the pixel point p, the pixel point is an endpoint pixel; find the endpoint Pixel, record the endpoint pixel coordinates as the starting point coordinates, and find the next pixel point according to the structure type label. If the next pixel point is an intermediate pixel point, add the next pixel point to the path, record the pixel point coordinates, and continue to find the next pixel point; if the next pixel point is an endpoint pixel, add the next pixel point to the path and record it as the end point coordinates; when the structure type is a dotted line pipeline, searching for the next pixel point allows cross-pixel searching; the obtained path coordinates are local pipeline coordinates, and the global pipeline 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; S34. After extracting the complete path, the paths with the structural types of solid line pipelines, dashed line pipelines, and dotted-dashed line pipelines are divided in detail. The solid line pipelines are divided into thick pipelines, thin pipelines, and O-shaped pipelines. The Sobel operator is used to calculate the width of the path, and the Fourier frequency domain is introduced to assist in periodic judgment. If the path width has periodic changes, the path is an O-shaped line; if the path does not have periodic changes and the average width exceeds the pipeline width threshold, the path is a thick pipeline; if the path does not have periodic changes 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 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. Dot-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 dot-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 the highest 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

  • Method for high-precision identification of PID drawing symbols

    CN116259067A

  • Method for identifying drawing pipeline with high precision

    CN117373050A

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

    CN117373051A