Plant station wiring diagram primitive segmentation method, system and device and computer storage medium
By using DINOv3 and ResNet50 to extract multi-scale features from the plant wiring diagram, and combining adaptive feature pooling and post-processing techniques, the problem of insufficient primitive localization and recognition capabilities of target detection networks is solved, achieving high-precision and robust primitive segmentation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-19
- Publication Date
- 2026-04-14
AI Technical Summary
Existing target detection networks have limited capabilities in locating and recognizing elements in plant wiring diagrams, which restricts the level of element recognition in wiring diagrams.
An initial segmentation network, including the backbone networks DINOv3 and ResNet50, is used to extract multi-scale semantic and detail features. Feature fusion and optimization are performed through adaptive feature pooling layers and a segmentation head. Combined with adaptive window sliding and post-processing techniques, high-precision primitive segmentation is achieved.
It significantly improves the recognition accuracy and boundary integrity of electrical elements in plant wiring diagrams, enhances the adaptability to the diversity of element scales, uneven distribution and structural complexity, and ensures the engineering practicality of the output results.
Smart Images

Figure CN121861680A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of graphic element segmentation technology, and in particular to a method, system, equipment, and computer storage medium for segmenting graphic elements in plant wiring diagrams. Background Technology
[0002] In recent years, many deep learning-based detection and recognition technologies have been actively promoted and applied in the field of document and drawing inspection. Among the various recognition technologies, object detection networks are favored due to their fast detection speed and accurate recognition results. However, object detection networks have limited capabilities in locating and recognizing wiring diagram elements, which restricts the level of wiring diagram element recognition. Summary of the Invention
[0003] In view of this, the purpose of the present invention is to overcome the shortcomings of the prior art and provide a method, system, device and computer storage medium for segmenting elements of a plant wiring diagram.
[0004] This invention provides the following technical solution: In a first aspect, the present invention proposes a method for segmenting elements in a plant wiring diagram, comprising: The training data of the plant wiring diagram primitives are input into the initial segmentation network; the initial segmentation network includes a backbone network, an adaptive feature pooling layer, and a segmentation head. Multi-scale semantic features are extracted from the training data of the plant wiring diagram primitives using DINOv3 in the backbone network, and multi-scale detail features are extracted from the training data of the plant wiring diagram primitives using ResNet50 in the backbone network. The multi-scale semantic features and the multi-scale detail features are aligned and fused to obtain multi-scale fused features; The multi-scale fusion features are input into the adaptive feature pooling layer to obtain the target fusion features; The target fusion features are input into the segmentation head to obtain primitive segmentation prediction values; The total loss is calculated based on the training data of the plant wiring diagram elements and the predicted value of element segmentation. The network parameters of the initial segmentation network are adjusted based on the total loss to obtain the element segmentation network. Input the wiring diagram of the plant to be segmented into the element segmentation network to obtain the initial element segmentation result; The initial primitive segmentation result is post-processed and optimized to obtain the target primitive segmentation result.
[0005] In one embodiment, the formula for calculating the total loss is: In the formula, For the total loss, For classifying losses, For bounding box regression loss, For mask segmentation loss, For scale perception loss, All are coefficients; The formula for calculating the scale-aware loss is as follows: In the formula, As weight, The number of primitive instances in the primitive segmentation prediction value; For the first Classification loss for each primitive instance; The formula for calculating the weight is: In the formula, For the first The pixel area of a primitive instance It is a very small constant.
[0006] In one embodiment, the step of extracting multi-scale semantic features from the plant wiring diagram primitive training data using DINOv3 in the backbone network, and extracting multi-scale detail features from the plant wiring diagram primitive training data using ResNet50 in the backbone network, includes: The first semantic feature, the second semantic feature, and the third semantic feature are obtained by extracting features from the training data of the wiring diagram of the plant using DINOv3, and are used as the multi-scale semantic features. The ResNet50 is used to convolve and downsample the training data of the plant wiring diagram primitives to obtain the first detail feature, the second detail feature, the third detail feature, and the fourth detail feature, which are used as the multi-scale detail features.
[0007] In one embodiment, the multi-scale fusion feature includes a first fusion feature, a second fusion feature, and a third fusion feature. The step of aligning and fusing the multi-scale semantic features and the multi-scale detail features to obtain the multi-scale fusion feature includes: The first semantic feature and the second detail feature are bidirectionally fused to obtain the first fused feature; The second semantic feature and the third detail feature are bidirectionally fused to obtain the second fused feature; The third semantic feature and the fourth detail feature are bidirectionally fused to obtain the third fused feature.
[0008] In one embodiment, the step of inputting the wiring diagram of the substation to be segmented into the element segmentation network to obtain the initial element segmentation result includes: Calculate the current primitive density based on the number of primitives in the current sliding window and the current area of the current sliding window; The adaptive window size and adaptive step size are calculated based on the preset base window size, preset base step size, preset primitive density threshold, and the current primitive density. Based on the adaptive window size and the adaptive step size, the sub-diagram of the plant wiring diagram to be divided is adaptively clipped using a sliding window to obtain the sub-diagram of the plant wiring diagram. The sub-diagram of the plant wiring diagram is input into the element segmentation network to obtain the sub-diagram element segmentation mask; The initial primitive segmentation result is obtained by mapping the sub-graph primitive segmentation mask.
[0009] In one embodiment, the formula for calculating the adaptive window size is: In the formula, For the adaptive window size, The preset base window size, This is the first preset adjustment coefficient. The preset primitive density threshold, The current primitive density; The formula for calculating the adaptive step size is: In the formula, The adaptive step size, The preset base step size, This is the second preset adjustment coefficient.
[0010] In one embodiment, the post-processing optimization of the initial primitive segmentation result to obtain the target primitive segmentation result includes: Perform a morphological closing operation on the initial primitive segmentation result to obtain a closed segmentation result; The closed segmentation result is filled with holes to obtain a filled segmentation result; Edge smoothing is performed on the filled segmentation result to obtain the target primitive segmentation result.
[0011] Secondly, this invention proposes a plant wiring diagram element segmentation system, comprising: The input module is used to input the training data of the plant wiring diagram primitives into the initial segmentation network; the initial segmentation network includes a backbone network, an adaptive feature pooling layer, and a segmentation head; The extraction module is used to extract multi-scale semantic features from the training data of the plant wiring diagram primitives through DINOv3 in the backbone network, and to extract multi-scale detail features from the training data of the plant wiring diagram primitives through ResNet50 in the backbone network. The fusion module is used to align and fuse the multi-scale semantic features and the multi-scale detail features to obtain multi-scale fused features. The pooling module is used to input the multi-scale fused features into the adaptive feature pooling layer to obtain the target fused features; The prediction module is used to input the target fusion features into the segmentation head to obtain primitive segmentation prediction values; The adjustment module is used to calculate the total loss based on the training data of the plant wiring diagram elements and the element segmentation prediction value, and adjust the network parameters of the initial segmentation network according to the total loss to obtain the element segmentation network. The segmentation module is used to input the wiring diagram of the plant to be segmented into the element segmentation network to obtain the initial element segmentation result; The optimization module is used to perform post-processing optimization on the initial primitive segmentation result to obtain the target primitive segmentation result.
[0012] Thirdly, the present invention proposes a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, it implements the plant wiring diagram element segmentation method as described in the first aspect.
[0013] Fourthly, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the plant wiring diagram element segmentation method as described in the first aspect.
[0014] This invention discloses a method, system, device, and computer storage medium for segmenting plant wiring diagram elements. The method involves inputting training data of plant wiring diagram elements into an initial segmentation network. This initial segmentation network includes a backbone network, an adaptive feature pooling layer, and a segmentation head. Multi-scale semantic features are extracted from the training data using DINOv3 in the backbone network, and multi-scale detail features are extracted using ResNet50 in the backbone network. The multi-scale semantic features and multi-scale detail features are aligned and fused to obtain multi-scale fused features. These multi-scale fused features are then input into the adaptive feature pooling layer to obtain target fused features. The target fused features are input into the segmentation head to obtain element segmentation prediction values. A total loss is calculated based on the plant wiring diagram element training data and the element segmentation prediction values. The network parameters of the initial segmentation network are adjusted based on the total loss to obtain an element segmentation network. The plant wiring diagram to be segmented is input into the element segmentation network to obtain the initial element segmentation result. The initial element segmentation result is then post-processed and optimized to obtain the target element segmentation result. In this way, by collaboratively extracting multi-scale semantic and detail features using DINOv3 and ResNet50, and combining adaptive feature pooling and end-to-end optimization strategies, the recognition accuracy and boundary integrity of electrical elements in plant wiring diagrams are significantly improved. Compared with existing technologies, this solution not only enhances the adaptability to the diversity of element scales, uneven distribution, and structural complexity, but also ensures the engineering practicality of the output results through post-processing, achieving high-precision, high-robustness, and high-versatility automated element segmentation. Attached Figure Description
[0015] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope of protection of the present invention. In the various drawings, similar components are numbered similarly.
[0016] Figure 1 A flowchart illustrating the subdivision method for plant wiring diagram elements proposed in this embodiment is shown. Figure 2 A schematic diagram of the network structure of the initial segmentation network proposed in this embodiment is shown; Figure 3 This illustrates another flowchart of the plant wiring diagram element segmentation method proposed in this embodiment; Figure 4 A schematic diagram of the backbone network proposed in this embodiment is shown; Figure 5 This illustration shows another flowchart of the plant wiring diagram element segmentation method proposed in this embodiment; Figure 6This illustration shows another flowchart of the subdivision method for plant wiring diagram elements proposed in this embodiment; Figure 7 This illustration shows another flowchart of the subdivision method for plant wiring diagram elements proposed in this embodiment; Figure 8 A schematic diagram of the sub-system for plant wiring diagrams proposed in this embodiment is shown.
[0017] Explanation of reference numerals in the attached diagram: 800 - Plant Wiring Diagram Element Segmentation System; 801 - Input Module; 802 - Extraction Module; 803 - Fusion Module; 804 - Pooling Module; 805 - Prediction Module; 806 - Adjustment Module; 807 - Segmentation Module; 808 - Optimization Module. Detailed Implementation
[0018] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0019] The components of the embodiments of the invention described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0020] In the following, the terms “comprising,” “having,” and their cognates, which may be used in various embodiments of the invention, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as excluding, firstly, the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations thereof.
[0021] Furthermore, the terms "first," "second," and "third" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0022] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of the invention pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be interpreted as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of the invention.
[0023] Example 1 This disclosure provides a method for segmenting elements in a plant wiring diagram.
[0024] Please see Figure 1 The method for segmenting elements in the wiring diagram of this plant includes steps S101 to S108, and each step is described in detail below.
[0025] Step S101: Input the training data of the plant wiring diagram primitives into the initial segmentation network; the initial segmentation network includes a backbone network, an adaptive feature pooling layer, and a segmentation head.
[0026] In this embodiment, the training data of the plant wiring diagram elements is input into the initial segmentation network for network training. The training data includes the plant wiring diagram and its corresponding element category identifiers, used to train the initial segmentation network into a network structure capable of segmenting plant wiring diagram elements.
[0027] Please see Figure 2 The initial segmentation network consists of a backbone network, adaptive feature pooling layers, and a segmentation head, providing a structural foundation for subsequent multimodal feature extraction and fusion. This overall network design balances semantic understanding and detail preservation, significantly improving the model's ability to understand primitive structures in complex industrial drawings and overcoming the representational limitations of traditional single-backbone networks when processing high-density, multi-scale electrical symbols.
[0028] As an example, a semantic segmentation network training and validation set was constructed based on 110 power plant wiring diagram image files. The image types included in the images include, but are not limited to: disconnectors, switches, grounding disconnectors, three-winding transformers, two-winding transformers, autotransformers, capacitors, reactors, and instrument transformers. The LabelMe annotation tool was used to label the element categories corresponding to each element in all wiring diagrams, and the generated annotation results were converted into JSON files in the COCO semantic segmentation dataset format.
[0029] It should be noted that before the training data of the plant wiring diagram elements is input into the initial segmentation network, the parameters of the initial segmentation network need to be initialized, and the training data of the plant wiring diagram elements should be augmented by random rotation, flipping, and scaling.
[0030] Step S102: Extract multi-scale semantic features from the training data of the plant wiring diagram primitives using DINOv3 in the backbone network, and extract multi-scale detail features from the training data of the plant wiring diagram primitives using ResNet50 in the backbone network.
[0031] In this embodiment, deep semantic features are extracted from the training data of the wiring diagram elements in the plant wiring diagram through DINOv3 in the backbone network to obtain multi-scale semantic features, which enhances the model's ability to recognize high-level semantics of abstract elements (such as circuit breakers, disconnect switches, etc.) in the plant wiring diagram, especially showing stronger generalization in small sample or class imbalance scenarios.
[0032] Meanwhile, multi-scale detail features are extracted from the training data of the wiring diagram primitives in the backbone network through ResNet50, which effectively captures primitive edges, line connection relationships and local texture information, making up for the shortcomings of the pure Transformer architecture in preserving low-level visual features.
[0033] Please see Figure 3 In one specific embodiment, step S102 includes steps S1021 to S1022, and each step is described in detail below.
[0034] Step S1021: The DINOv3 is used to extract features from the training data of the power plant wiring diagram elements to obtain the first semantic feature, the second semantic feature and the third semantic feature, which are used as the multi-scale semantic features.
[0035] In this embodiment, feature extraction is performed on the training data of the power plant wiring diagram primitives using DINOv3 to obtain first, second, and third semantic features at different depths, which serve as multi-scale semantic features. The feature map scales of the first, second, and third semantic features can be [amount missing] times that of the original diagram. .
[0036] For example, please see Figure 4 After Attention Blocks 1 through 5, the output size... The first semantic feature; after Attention Block 6, the output size The second semantic feature; after Attention Block 11, the output size The third semantic feature.
[0037] Step S1022: Convolution and downsampling are performed on the training data of the power plant wiring diagram primitives using the ResNet50 to obtain the first detail feature, the second detail feature, the third detail feature, and the fourth detail feature, which are used as the multi-scale detail features.
[0038] In this embodiment, ResNet50 is used to convolve and downsample the training data of the power plant wiring diagram primitives to generate first detail features, second detail features, third detail features and fourth detail features with rich fine granularity, as multi-scale detail features.
[0039] This is an example; please see again. Figure 4 The training data of the power plant wiring diagram primitives were convolved and downsampled four times using ResNet50. For Stage 1, the downsampled size was... Output the first detail feature P1; for Stage 2, the downsampled size Output the second detail feature P2; for Stage 3, the downsampled size Output the third detail feature P3; for Stage 4, the downsampled size Output the fourth detail feature P4.
[0040] Based on three-level semantic features and four-level detail features, feature maps of different depths correspond to different receptive fields and resolution levels, forming a complete multi-scale feature pyramid. This fine-grained division is beneficial for subsequent cross-level feature alignment and fusion, ensuring that information from macro-layout to micro-structure is fully modeled, and is particularly suitable for scenarios where primitives of vastly different sizes coexist in plant and site maps.
[0041] Step S103: Align and fuse the multi-scale semantic features and the multi-scale detail features to obtain multi-scale fused features.
[0042] In this embodiment, the parallel generated strong semantic features (multi-scale semantic features) and strong detail features (multi-scale detail features) are aligned and fused with feature maps through simple linear interpolation upsampling and convolution operations. This enables the semantic features to dynamically focus on key regions, while the detail features can be selectively enhanced based on the semantic context, significantly improving the robustness of primitive recognition under complex background interference.
[0043] In one specific embodiment, the multi-scale fusion feature includes a first fusion feature, a second fusion feature, and a third fusion feature. Step S103 includes: bidirectionally fusing the first semantic feature with the second detail feature to obtain the first fusion feature; bidirectionally fusing the second semantic feature with the third detail feature to obtain the second fusion feature; and bidirectionally fusing the third semantic feature with the fourth detail feature to obtain the third fusion feature.
[0044] In this embodiment, the first semantic feature and the second detail feature are bidirectionally fused (Bu-Fusion) to obtain the first fused feature; the second semantic feature and the third detail feature are bidirectionally fused to obtain the second fused feature; and the third semantic feature and the fourth detail feature are bidirectionally fused to obtain the third fused feature.
[0045] Understandably, the high-level semantic and mid-level detail misalignment fusion strategy ensures both semantic consistency and spatial resolution matching, alleviating the spatial distortion problem caused by downsampling. This fusion path is carefully designed to maximize information complementarity while maintaining computational efficiency and improving segmentation boundary accuracy.
[0046] Step S104: Input the multi-scale fusion features into the adaptive feature pooling layer to obtain the target fusion features.
[0047] In this embodiment, the multi-scale fused features are input into the adaptive feature pooling layer for adaptive feature pooling to obtain the target fused features. This achieves the fusion of the rich contextual information of DINOv3 and the strong detail localization accuracy information output by ResNet50, thereby improving the segmentation accuracy. At the same time, the adaptive feature pooling layer can dynamically adjust the pooling range and weights according to the content distribution of the input feature map, thereby more accurately aggregating key contextual information.
[0048] Step S105: Input the target fusion features into the segmentation head to obtain primitive segmentation prediction values.
[0049] In this embodiment, the target fusion features are input to the segmentation head to obtain primitive segmentation prediction values, including segmentation masks and primitive categories, thereby achieving pixel-level accurate segmentation output.
[0050] Step S106: Calculate the total loss based on the training data of the plant wiring diagram elements and the predicted value of element segmentation, and adjust the network parameters of the initial segmentation network based on the total loss to obtain the element segmentation network.
[0051] In this embodiment, the total loss is calculated based on the training data of the wiring diagram elements and the predicted value of element segmentation according to the formula for calculating the total loss. The network parameters of the initial segmentation network are then adjusted according to the total loss to obtain the element segmentation network.
[0052] The formula for calculating the total loss is as follows: In the formula, For the total loss, For classifying losses, For bounding box regression loss, For mask segmentation loss, For scale perception loss, All are coefficients.
[0053] The formula for calculating scale-perception loss is: In the formula, As weight, The number of primitive instances in the primitive segmentation prediction; The first element in the primitive segmentation prediction value The classification loss of each primitive instance is used to measure the mask predicted by the model. With the real mask The difference at each pixel; the weight is calculated using the following formula: In the formula, The first element in the primitive segmentation prediction value The pixel area of a primitive instance It is a very small constant.
[0054] Understandably, the scale-aware loss function dynamically adjusts the optimization direction during training through a statistical (target area) weighting mechanism, which solves the common scale imbalance problem in segmentation networks. Experiments show that the scale-aware loss improves the detection capability of complex scenes such as plant wiring diagrams that contain a large number of small primitives.
[0055] It should be added that classification loss Using the cross-entropy loss function: ,in, The first element in the primitive segmentation prediction value The real label of each primitive instance The first element in the primitive segmentation prediction value The predicted probability of a primitive instance. This represents the number of primitive categories.
[0056] Bounding box regression loss Using smoothed L1 loss: ,in, The first element in the primitive segmentation prediction value The true bounding box coordinates of each primitive instance The first element in the primitive segmentation prediction value The predicted bounding box coordinates of each primitive instance. This represents the number of bounding boxes.
[0057] Masking segmentation loss Using binary cross-entropy loss: ,in, The first element in the primitive segmentation prediction value The actual mask pixel value of each primitive instance The first element in the primitive segmentation prediction value The predicted mask pixel values of each primitive instance This represents the total number of pixels.
[0058] It should be noted that the segmentation accuracy of the trained primitive segmentation network can be evaluated using mean accuracy (mAP), intersection-to-union ratio (IoU), and pixel accuracy. In addition, the model network parameters can be adjusted based on the validation results during training to further improve the segmentation accuracy.
[0059] Step S107: Input the wiring diagram of the plant to be segmented into the element segmentation network to obtain the initial element segmentation result.
[0060] In this embodiment, the wiring diagram of the plant to be segmented is input into the trained primitive segmentation network for inference. Similar to the training method, the initial primitive segmentation result is obtained.
[0061] Please see Figure 5 In one specific embodiment, step S107 includes steps S1071 to S1075, and each step is described in detail below.
[0062] Step S1071: Calculate the current primitive density based on the number of primitives in the current sliding window and the current area of the current sliding window.
[0063] In this embodiment, by quantifying the density of electrical elements within a local area based on the number of elements and the area of the current sliding window, an objective basis is provided for subsequent adaptive parameter adjustments. This dynamically reflects the spatial distribution characteristics of the substation wiring diagram in different areas, and is particularly suitable for situations where equipment is unevenly distributed in complex substation drawings. For example, higher element density values are automatically identified in high-density areas such as busbar areas and switchgear concentrated areas, while correspondingly lower values are assigned to sparse wiring areas. This achieves an initial leap in understanding image content from "geometric location" to "structural semantics," improving the intelligence and responsiveness of the segmentation strategy.
[0064] Step S1072: Calculate the adaptive window size and adaptive step size based on the preset basic window size, preset basic step size, preset primitive density threshold, and the current primitive density.
[0065] In this embodiment, the sliding window size and movement step size are dynamically adjusted according to the real-time primitive density, which effectively overcomes the contradiction between efficiency and accuracy in the traditional fixed sliding window method: when the current primitive density is low (i.e., the primitive sparse area), a larger window size and a smaller step size decay are used, which can maintain a certain overlap rate while ensuring coverage and avoid missed detection; when the current primitive density is close to or exceeds the preset threshold, the system automatically shrinks the window to focus on local details and significantly reduces the step size, increases the sampling frequency, and enhances the ability to identify small targets in high-density areas.
[0066] The formula for calculating the adaptive window size is as follows: In the formula, To adapt to window size, To preset the base window size, This is the first preset adjustment coefficient. To preset the primitive density threshold, This represents the current primitive density.
[0067] The formula for calculating the adaptive step size is: In the formula, For adaptive step size, To preset the base step size, This is the second preset adjustment coefficient.
[0068] Step S1073: Based on the adaptive window size and the adaptive step size, perform adaptive sliding window clipping on the substation wiring diagram to be segmented to obtain the substation wiring diagram.
[0069] In this embodiment, adaptive sliding window clipping is performed on the sub-diagram of the plant wiring diagram to be segmented based on the adaptive window size and the adaptive step size, thereby obtaining the sub-diagram of the plant wiring diagram and achieving efficient and accurate element segmentation.
[0070] Step S1074: Input the sub-diagram of the plant wiring diagram into the primitive segmentation network to obtain the sub-diagram primitive segmentation mask.
[0071] In this embodiment, a primitive segmentation network is used to perform refined semantic segmentation on the adaptively cropped sub-graph of the plant wiring diagram to obtain a sub-graph primitive segmentation mask.
[0072] Step S1075: Map the sub-graph primitive segmentation mask to obtain the initial primitive segmentation result.
[0073] In this embodiment, if there are after cutting The power plant wiring diagram, and the coordinates of the upper left corner of the original diagram are listed below. .
[0074] For the detection results of each sub-diagram of the plant wiring diagram, the coordinates of each pixel in the mask area can be divided according to the primitives of that sub-diagram. (Assume the mask area has) (each pixel) and the coordinates of the upper left corner of the wiring diagram of the plant in the original image. Adjust the sub-image primitive segmentation mask to the detection location relative to the original image. If a detection is detected in a wiring sub-image of a certain plant / station... Mask of each target In the original diagram Mask of each target The formula for calculating s is: ,in for: , express The number of pixels in the mask region, This indicates the position of the top-left corner of the subgraph within the original graph.
[0075] It should be noted that when training the primitive segmentation network, adaptive sliding window clipping can also be performed on the plant wiring diagram in the training data according to steps S1071~S1073 to improve the training accuracy.
[0076] Step S108: Post-processing optimization is performed on the initial primitive segmentation result to obtain the target primitive segmentation result.
[0077] In this embodiment, the initial primitive segmentation result is post-processed and optimized to obtain the target primitive segmentation result, thereby improving the geometric regularity and visual readability of the output mask and meeting the stringent requirements of the automation parsing of engineering drawings for the usability of the results.
[0078] Please see Figure 6 In one specific embodiment, step S108 includes steps S1081 to S1083, and each step is described in detail below.
[0079] Step S1081: Perform a morphological closing operation on the initial primitive segmentation result to obtain the closed segmentation result.
[0080] In this embodiment, the morphological closing operation is used to connect adjacent regions and fill small holes, resulting in a closed segmentation result. Its calculation expression is: ,in, For structural elements (such as circular or rectangular cores). and These are dilation and erosion operations, respectively. Specifically, they are implemented based on the OpenCV function `morphologyEx`, using the MORPH_CLOSE operation and specifying an appropriate kernel.
[0081] Step S1082: Fill the voids in the closed segmentation result to obtain the filled segmentation result.
[0082] In this embodiment, the hole filling algorithm is used to fill the holes inside the mask, resulting in the filled segmentation result. Its calculation expression is: ,in, This function fills holes based on connected component analysis. Specifically, it can be implemented using OpenCV's `floodFill` function, or by finding and filling the internal contours.
[0083] Step S1083: Smooth the edges of the filled segmentation result to obtain the target primitive segmentation result.
[0084] In this embodiment, Gaussian filtering is applied to smooth the mask edges to obtain the target primitive segmentation result. Its calculation expression is: ,in, For Gaussian kernel function, Standard deviation (usually set to) ), This represents a convolution operation. Specifically, it is implemented using OpenCV's Gaussian Blur or bilateral filter, followed by binarization.
[0085] Please see Figure 7 The original power plant wiring diagram is input into the element segmentation network in this embodiment for element segmentation, resulting in a power plant wiring element segmentation result diagram. The original power plant wiring diagram is then input into a general target detection network for element segmentation, resulting in a power plant wiring element detection result diagram. It can be seen that the segmentation result in the power plant wiring element segmentation result diagram is more accurate than the segmentation result in the power plant wiring element detection result diagram.
[0086] The proposed sub-segmentation method for plant wiring diagrams in this embodiment involves inputting the training data of the plant wiring diagram elements into an initial segmentation network. This initial segmentation network includes a backbone network, an adaptive feature pooling layer, and a segmentation head. Multi-scale semantic features are extracted from the training data using DINOv3 in the backbone network, and multi-scale detail features are extracted using ResNet50 in the backbone network. The multi-scale semantic features and multi-scale detail features are aligned and fused to obtain multi-scale fused features. These multi-scale fused features are then input into the adaptive feature pooling layer to obtain target fused features. The target fused features are input into the segmentation head to obtain element segmentation prediction values. A total loss is calculated based on the plant wiring diagram element training data and the element segmentation prediction values. The network parameters of the initial segmentation network are adjusted based on the total loss to obtain the element segmentation network. The plant wiring diagram to be segmented is input into the element segmentation network to obtain the initial element segmentation result. The initial element segmentation result is then post-processed and optimized to obtain the target element segmentation result. In this way, by collaboratively extracting multi-scale semantic and detail features using DINOv3 and ResNet50, and combining adaptive feature pooling and end-to-end optimization strategies, the recognition accuracy and boundary integrity of electrical elements in plant wiring diagrams are significantly improved. Compared with existing technologies, this solution not only enhances the adaptability to the diversity of element scales, uneven distribution, and structural complexity, but also ensures the engineering practicality of the output results through post-processing, achieving high-precision, high-robustness, and high-versatility automated element segmentation.
[0087] Example 2 Furthermore, this disclosure provides a plant wiring diagram element segmentation system 800, please refer to [link to relevant documentation]. Figure 8 The system includes: The input module 801 is used to input the training data of the plant wiring diagram primitives into the initial segmentation network; the initial segmentation network includes a backbone network, an adaptive feature pooling layer, and a segmentation head. Extraction module 802 is used to extract multi-scale semantic features from the training data of the plant wiring diagram primitives through DINOv3 in the backbone network, and to extract multi-scale detail features from the training data of the plant wiring diagram primitives through ResNet50 in the backbone network. The fusion module 803 is used to align and fuse the multi-scale semantic features and the multi-scale detail features to obtain multi-scale fused features. Pooling module 804 is used to input the multi-scale fused features into the adaptive feature pooling layer to obtain the target fused features; Prediction module 805 is used to input the target fusion features into the segmentation head to obtain primitive segmentation prediction values; The adjustment module 806 is used to calculate the total loss based on the training data of the plant wiring diagram elements and the element segmentation prediction value, and adjust the network parameters of the initial segmentation network based on the total loss to obtain the element segmentation network. The segmentation module 807 is used to input the wiring diagram of the plant to be segmented into the element segmentation network to obtain the initial element segmentation result; The optimization module 808 is used to perform post-processing optimization on the initial primitive segmentation result to obtain the target primitive segmentation result.
[0088] Optionally, the formula for calculating the total loss is: In the formula, For the total loss, For classifying losses, For bounding box regression loss, For mask segmentation loss, For scale perception loss, All are coefficients; The formula for calculating the scale-aware loss is as follows: In the formula, As weight, The number of primitive instances in the primitive segmentation prediction value; For the first Classification loss for each primitive instance; The formula for calculating the weight is: In the formula, For the first The pixel area of a primitive instance It is a very small constant.
[0089] Optionally, the extraction module 802 is further configured to extract features from the training data of the plant wiring diagram primitives using the DINOv3 to obtain a first semantic feature, a second semantic feature, and a third semantic feature, which are used as the multi-scale semantic features; and to perform convolution and downsampling on the training data of the plant wiring diagram primitives using the ResNet50 to obtain a first detail feature, a second detail feature, a third detail feature, and a fourth detail feature, which are used as the multi-scale detail features.
[0090] Optionally, the multi-scale fusion feature includes a first fusion feature, a second fusion feature, and a third fusion feature. The fusion module 803 is used to perform bidirectional fusion of the first semantic feature and the second detail feature to obtain the first fusion feature; to perform bidirectional fusion of the second semantic feature and the third detail feature to obtain the second fusion feature; and to perform bidirectional fusion of the third semantic feature and the fourth detail feature to obtain the third fusion feature.
[0091] Optionally, the segmentation module 807 is further configured to: calculate the current primitive density based on the number of primitives in the current sliding window and the current sliding window area; calculate the adaptive window size and adaptive step size based on the preset basic window size, preset basic step size, preset primitive density threshold, and the current primitive density; perform adaptive sliding window clipping on the substation wiring diagram to be segmented based on the adaptive window size and the adaptive step size to obtain the substation wiring sub-diagram; input the substation wiring sub-diagram into the primitive segmentation network to obtain the sub-diagram primitive segmentation mask; and map the sub-diagram primitive segmentation mask to obtain the initial primitive segmentation result.
[0092] Optionally, the formula for calculating the adaptive window size is: In the formula, For the adaptive window size, The preset base window size, This is the first preset adjustment coefficient. The preset primitive density threshold, The current primitive density is given; the formula for calculating the adaptive step size is: In the formula, The adaptive step size, The preset base step size, This is the second preset adjustment coefficient.
[0093] Optionally, the optimization module 808 is used to perform a morphological closing operation on the initial primitive segmentation result to obtain a closed segmentation result; to fill the holes in the closed segmentation result to obtain a filled segmentation result; and to smooth the edges of the filled segmentation result to obtain the target primitive segmentation result.
[0094] The system provided in this embodiment can execute the steps of the substation wiring diagram element segmentation method provided in Embodiment 1. To avoid repetition, these steps will not be repeated.
[0095] The substation wiring diagram primitive segmentation system proposed in this embodiment inputs the substation wiring diagram primitive training data into an initial segmentation network. The initial segmentation network includes a backbone network, an adaptive feature pooling layer, and a segmentation head. Multi-scale semantic features are extracted from the substation wiring diagram primitive training data using DINOv3 in the backbone network, and multi-scale detail features are extracted from the substation wiring diagram primitive training data using ResNet50 in the backbone network. The multi-scale semantic features and multi-scale detail features are aligned and fused to obtain multi-scale fused features. The multi-scale fused features are input into the adaptive feature pooling layer to obtain target fused features. The target fused features are input into the segmentation head to obtain primitive segmentation prediction values. The total loss is calculated based on the substation wiring diagram primitive training data and primitive segmentation prediction values. The network parameters of the initial segmentation network are adjusted based on the total loss to obtain a primitive segmentation network. The substation wiring diagram to be segmented is input into the primitive segmentation network to obtain the initial primitive segmentation result. The initial primitive segmentation result is post-processed and optimized to obtain the target primitive segmentation result. In this way, by collaboratively extracting multi-scale semantic and detail features using DINOv3 and ResNet50, and combining adaptive feature pooling and end-to-end optimization strategies, the recognition accuracy and boundary integrity of electrical elements in plant wiring diagrams are significantly improved. Compared with existing technologies, this solution not only enhances the adaptability to the diversity of element scales, uneven distribution, and structural complexity, but also ensures the engineering practicality of the output results through post-processing, achieving high-precision, high-robustness, and high-versatility automated element segmentation.
[0096] Example 3 Furthermore, this disclosure provides a computer device including a memory and a processor. The memory stores a computer program, which, when executed by the processor, implements the plant wiring diagram element segmentation method described in Embodiment 1.
[0097] The device provided in this embodiment can execute the steps of the substation wiring diagram element segmentation method provided in Embodiment 1. To avoid repetition, it will not be described again.
[0098] Example 4 This disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the plant wiring diagram element segmentation method described in Embodiment 1.
[0099] In this embodiment, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0100] The computer-readable storage medium provided in this embodiment can implement the sub-element segmentation method of the plant wiring diagram provided in Embodiment 1. To avoid repetition, it will not be described again here.
[0101] In all examples shown and described herein, any specific values should be interpreted as merely exemplary and not as limitations; therefore, other examples of exemplary embodiments may have different values.
[0102] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0103] The above-described embodiments are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention.
Claims
1. A method for segmenting elements in a plant wiring diagram, characterized in that, include: The training data of the plant wiring diagram primitives are input into the initial segmentation network; the initial segmentation network includes a backbone network, an adaptive feature pooling layer, and a segmentation head. Multi-scale semantic features are extracted from the training data of the plant wiring diagram primitives using DINOv3 in the backbone network, and multi-scale detail features are extracted from the training data of the plant wiring diagram primitives using ResNet50 in the backbone network. The multi-scale semantic features and the multi-scale detail features are aligned and fused to obtain multi-scale fused features; The multi-scale fusion features are input into the adaptive feature pooling layer to obtain the target fusion features; The target fusion features are input into the segmentation head to obtain primitive segmentation prediction values; The total loss is calculated based on the training data of the plant wiring diagram elements and the predicted value of element segmentation. The network parameters of the initial segmentation network are adjusted based on the total loss to obtain the element segmentation network. Input the wiring diagram of the plant to be segmented into the element segmentation network to obtain the initial element segmentation result; The initial primitive segmentation result is post-processed and optimized to obtain the target primitive segmentation result.
2. The method for segmenting elements in a plant wiring diagram according to claim 1, characterized in that, The formula for calculating the total loss is as follows: In the formula, For the total loss, For classifying losses, For bounding box regression loss, For mask segmentation loss, For scale perception loss, All are coefficients; The formula for calculating the scale-aware loss is as follows: In the formula, As weight, The number of primitive instances in the primitive segmentation prediction value; For the first Classification loss for each primitive instance; The formula for calculating the weight is: In the formula, For the first The pixel area of a primitive instance It is a very small constant.
3. The method for segmenting elements in a plant wiring diagram according to claim 1, characterized in that, The step of extracting multi-scale semantic features from the training data of the plant wiring diagram primitives using DINOv3 in the backbone network, and extracting multi-scale detail features from the training data of the plant wiring diagram primitives using ResNet50 in the backbone network, includes: The first semantic feature, the second semantic feature, and the third semantic feature are obtained by extracting features from the training data of the wiring diagram of the plant using DINOv3, and are used as the multi-scale semantic features. The ResNet50 is used to convolve and downsample the training data of the plant wiring diagram primitives to obtain the first detail feature, the second detail feature, the third detail feature, and the fourth detail feature, which are used as the multi-scale detail features.
4. The method for segmenting elements in a plant wiring diagram according to claim 3, characterized in that, The multi-scale fusion feature includes a first fusion feature, a second fusion feature, and a third fusion feature. The step of aligning and fusing the multi-scale semantic features and the multi-scale detail features to obtain the multi-scale fusion feature includes: The first semantic feature and the second detail feature are bidirectionally fused to obtain the first fused feature; The second semantic feature and the third detail feature are bidirectionally fused to obtain the second fused feature; The third semantic feature and the fourth detail feature are bidirectionally fused to obtain the third fused feature.
5. The method for segmenting elements in a plant wiring diagram according to claim 1, characterized in that, The step of inputting the wiring diagram of the substation to be segmented into the element segmentation network to obtain the initial element segmentation result includes: Calculate the current primitive density based on the number of primitives in the current sliding window and the current area of the current sliding window; The adaptive window size and adaptive step size are calculated based on the preset base window size, preset base step size, preset primitive density threshold, and the current primitive density. Based on the adaptive window size and the adaptive step size, the sub-diagram of the plant wiring diagram to be divided is adaptively clipped using a sliding window to obtain the sub-diagram of the plant wiring diagram. The sub-diagram of the plant wiring diagram is input into the element segmentation network to obtain the sub-diagram element segmentation mask; The initial primitive segmentation result is obtained by mapping the sub-graph primitive segmentation mask.
6. The method for segmenting elements in a plant wiring diagram according to claim 5, characterized in that, The formula for calculating the adaptive window size is: In the formula, For the adaptive window size, The preset base window size, This is the first preset adjustment coefficient. The preset primitive density threshold, The current primitive density; The formula for calculating the adaptive step size is: In the formula, The adaptive step size, The preset base step size, This is the second preset adjustment coefficient.
7. The method for segmenting elements in a plant wiring diagram according to claim 1, characterized in that, The post-processing optimization of the initial primitive segmentation result to obtain the target primitive segmentation result includes: Perform a morphological closing operation on the initial primitive segmentation result to obtain a closed segmentation result; The closed segmentation result is filled with holes to obtain a filled segmentation result; Edge smoothing is performed on the filled segmentation result to obtain the target primitive segmentation result.
8. A plant wiring diagram element segmentation system, characterized in that, include: The input module is used to input the training data of the plant wiring diagram primitives into the initial segmentation network; the initial segmentation network includes a backbone network, an adaptive feature pooling layer, and a segmentation head; The extraction module is used to extract multi-scale semantic features from the training data of the plant wiring diagram primitives through DINOv3 in the backbone network, and to extract multi-scale detail features from the training data of the plant wiring diagram primitives through ResNet50 in the backbone network. The fusion module is used to align and fuse the multi-scale semantic features and the multi-scale detail features to obtain multi-scale fused features. The pooling module is used to input the multi-scale fused features into the adaptive feature pooling layer to obtain the target fused features; The prediction module is used to input the target fusion features into the segmentation head to obtain primitive segmentation prediction values; The adjustment module is used to calculate the total loss based on the training data of the plant wiring diagram elements and the element segmentation prediction value, and adjust the network parameters of the initial segmentation network based on the total loss to obtain the element segmentation network. The segmentation module is used to input the wiring diagram of the plant to be segmented into the element segmentation network to obtain the initial element segmentation result; The optimization module is used to perform post-processing optimization on the initial primitive segmentation result to obtain the target primitive segmentation result.
9. A computer device, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program, which, when executed by the processor, implements the plant wiring diagram element segmentation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the substation wiring diagram element segmentation method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Wiring diagram primitive identification method and device, electronic equipment and storage medium
CN119478592A
Multi-modal depth perception and adaptive segmentation full-spectrum primitive intelligent identification method, system and device for primary main wiring diagram of plant station, and medium
CN121482822A