Electric power drawing topological structure extraction method and device, equipment and storage medium
By employing a three-stage processing framework based on pixel connectivity and geometric constraints, along with a deep learning model, the problem of insufficient semantic understanding of electrical connections in the automatic recognition technology of power drawings is solved, generating accurate and concise topology structures that meet the needs of power grid analysis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-29
- Publication Date
- 2026-03-31
AI Technical Summary
Existing automatic power drawing recognition technology cannot understand the deep semantics of electrical connections, leading to frequent errors when dealing with complex engineering scenarios. Furthermore, the generated topology models contain redundant information, affecting the accuracy and efficiency of power grid analysis.
A three-stage processing framework based on pixel connectivity and geometric constraints is adopted, including basic connectivity detection, cross-line disambiguation, and error relation optimization. It combines a deep learning model to identify cross-lines and endpoints, ensuring the accuracy and simplicity of the topology.
It achieves semantic enhancement from physical connection to electrical connection, accurately extracts topology structure, eliminates virtual connection errors, and generates a concise topology model consisting purely of key primary equipment and their connection relationships, meeting the needs of power grid dispatching and analysis.
Smart Images

Figure CN121768030A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of power drawing processing technology, and in particular to a method, apparatus, equipment and storage medium for extracting the topology of power drawings. Background Technology
[0002] With the digital construction and intelligent transformation of the power grid, building a precise and efficient "digital twin" power grid has become an industry consensus and an urgent need. Therefore, automatic recognition and topology reconstruction technologies for power grid maps have become a core bridge connecting the physical power grid and the digital world. At the same time, their development level directly restricts the deepening and popularization of advanced smart grid applications.
[0003] In related technologies, automatic recognition technology for electrical drawings heavily relies on line detection based on Hough transform and its improved algorithms. The core idea of this method is to first vectorize the drawing image, converting it into geometric shapes composed of line segments, arcs, etc., and then infer the electrical connections by analyzing the spatial relationships of these geometric elements (such as intersections and endpoint distances). This "geometry-driven" paradigm has inherent limitations; for example, it cannot understand the deep semantics of electrical connections, leading to frequent errors when handling complex but common engineering scenarios.
[0004] Therefore, there is an urgent need for a method for extracting the topology of power drawings that combines low-level pixel connection information with high-level electrical connection semantics. Summary of the Invention
[0005] This application provides a method, apparatus, device, and storage medium for extracting the topology of electrical drawings, which can accurately extract low-level pixel connection information and high-level electrical connection semantic information, ensuring the correctness of the topology.
[0006] In a first aspect, one embodiment of this application provides a method for extracting the topology structure of power grid drawings, including: The target electrical drawing is identified to obtain a set of elements; the set of elements includes the location information of at least one element and the connection relationship between elements, and each element indicates an electrical component; For each bus element, the initial topology indicated by the element set is updated by applying at least two elements connected to the bus element to obtain the first topology. The first topology is updated based on the intersection primitives included in the first topology to obtain the second topology.
[0007] Secondly, one embodiment of this application provides a power drawing topology extraction device, comprising: The identification unit is used to: identify the target power drawing to obtain a set of graphic elements; wherein the set of graphic elements includes the location information of at least one graphic element and the connection relationship between the graphic elements, and each graphic element indicates an electrical component; The processing unit is configured to: for each bus element, apply at least two elements connected by the bus element to update the initial topology indicated by the element set, thereby obtaining a first topology; The processing unit is further configured to: update the first topology based on the intersection primitives included in the first topology to obtain the second topology.
[0008] Thirdly, one embodiment of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any of the above methods.
[0009] Fourthly, one embodiment of this application provides a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implement the steps of any of the above methods.
[0010] Fifthly, one embodiment of this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above methods.
[0011] In this embodiment, the target power drawing is first subjected to basic connection detection. This identification process yields a set of elements, including the location information of at least one element and the connection relationships between elements, with each element indicating an electrical component. Next, an ambiguous process for eliminating cross-line ambiguities is performed, primarily including eliminating busbar cross-line ambiguities and eliminating ordinary cross-line ambiguities. For eliminating busbar connection line ambiguities, for each busbar element, at least two elements connected to the busbar element are used to update the initial topology indicated by the element set, resulting in a first topology. For eliminating ordinary cross-line ambiguities, the first topology is updated based on the cross-point elements included in the first topology, resulting in a second topology. This design ensures that the obtained second topology accurately extracts both low-level pixel connection information and high-level electrical connection semantic information from the target power drawing, guaranteeing the correctness of the obtained topology. Attached Figure Description
[0012] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 A schematic diagram of a power drawing topology extraction method provided in an embodiment of this application; Figure 2 A flowchart illustrating a method for extracting the topology of power drawings according to an embodiment of this application; Figure 3 A schematic diagram illustrating busbar crossover optimization according to an embodiment of this application; Figure 4 A schematic diagram illustrating a general cross-line optimization according to an embodiment of this application; Figure 5 A schematic diagram of a primitive endpoint provided in an embodiment of this application; Figure 6 This is a schematic diagram of a power drawing topology extraction device provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0014] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.
[0015] For ease of understanding, the terms used in the embodiments of this application are explained below: (1) Pixel connectivity is the core concept in digital image processing that describes the spatial connection relationship between pixels. The core is the "neighborhood + gray-level similarity criterion". It is determined to be connected only when there is a path between two pixels that conforms to the rules. Common types include 4-connectivity, 8-connectivity and m-connectivity. It is widely used in target segmentation, connected component labeling and other scenarios.
[0016] The number of any elements in the accompanying drawings is for illustrative purposes only and not as a limitation, and any naming is for distinction only and has no limiting meaning.
[0017] As the cornerstone of a nation's critical infrastructure, the safe, stable, and efficient operation of the power system directly impacts national welfare and economic development. Currently, the global energy landscape is undergoing profound changes, with the construction of a new power system primarily based on renewable energy entering a rapid development phase. This transformation places unprecedentedly high standards and stringent requirements on the planning, design, dispatching, operation, fault handling, and intelligent management of the power grid. Against this backdrop, promoting the digital and intelligent transformation of the power grid and building a precise and efficient "digital twin" power grid has become an industry consensus and an urgent need. The foundation for realizing this grand vision lies in how to quickly and accurately transform the massive amounts of physical power grid assets, existing in the form of unstructured drawings, into structured topology data models that can be recognized, analyzed, and computed by computers. Therefore, the automatic recognition and topology reconstruction technology of power grid drawings naturally becomes a core bridge and technological bottleneck connecting the physical power grid and the digital world, and its development level directly restricts the deepening and popularization of advanced smart grid applications. However, in achieving this goal, the automatic recognition technology of power grid drawings still faces fundamental technical bottlenecks, resulting in a significant gap between its output and actual engineering applications.
[0018] Current mainstream technologies heavily rely on line detection based on Hough transform and its improved algorithms. The core idea of this method is to first vectorize the drawing image, converting it into geometric shapes composed of line segments, arcs, etc., and then infer their electrical connections by analyzing the spatial relationships of these geometric elements (such as intersections and endpoint distances). This "geometry-driven" paradigm has inherent limitations: it cannot understand the deep semantics of electrical connections, leading to frequent errors when dealing with complex but common engineering scenarios.
[0019] Based on the aforementioned shortcomings, the automatic recognition technology for power drawings in related technologies faces the following core challenges that urgently need to be addressed: Challenge 1: The problem of accurately extracting topological connections.
[0020] It is of paramount importance to overcome the limitations of purely geometric analysis and develop an identification mechanism that can understand the semantics of electrical connections, thereby fundamentally eliminating loose and missing connections and ensuring the accuracy of topological connection relationships.
[0021] Challenge 2: The problem of missing reasoning in complex connection logic.
[0022] Enabling the identification system to possess basic electrical logic reasoning capabilities, enabling it to identify not only direct connections but also indirect connections achieved through common connection points such as busbars, is key to constructing a complete and accurate topology model.
[0023] Challenge 3: The problem of topology redundancy filtering in response to business needs.
[0024] Power grid dispatching and analysis typically focus only on primary equipment such as circuit breakers, disconnectors, lines, and transformers that constitute the main grid structure. However, the numerous secondary devices (such as relays and meters) and auxiliary devices (such as surge arresters and grounding switches) included in actual drawings represent redundant information for the main grid topology. The lack of effective semantic filtering capabilities in related technologies results in topology models containing a large number of irrelevant nodes and branches, leading to data bloat and severely interfering with the computational efficiency and accuracy of subsequent power grid analysis software (such as power flow calculations and state estimation). Therefore, enabling the system to intelligently identify and focus on the core primary equipment topology without relying on complex manual annotation is a crucial challenge for achieving directly usable results.
[0025] To address this, this application provides a method for extracting the topology of power drawings based on pixel connectivity and geometric constraints. The core of this method lies in combining low-level pixel connectivity information with high-level electrical connection semantics, and through a progressive three-stage processing framework, achieving intelligent conversion from pixel-level connected domains to an accurate and concise topology network.
[0026] Figure 1 A schematic diagram of a power drawing topology extraction method provided in this application embodiment is shown below. Figure 1 The three-stage processing procedure is as follows: Phase 1: Basic connectivity testing.
[0027] This stage forms the foundation of topology construction, aiming to extract the most direct physical connection information from the drawing. First, connected component analysis of the black pixels is performed on the preprocessed binarized drawing, grouping physically directly connected pixel regions into the same connected component (connected pixel set). This effectively segments and aggregates continuous lines and symbols in the image. Based on this, a preliminary set of connection relationships is established: for any two connected components, if there is pixel adjacency between them, a preliminary connection relationship is determined to exist. This stage accurately captures all direct and unambiguous physical connections, providing a reliable data foundation for subsequent in-depth analysis.
[0028] Phase 2: Cross-line disambiguation (including bus cross-line optimization and ordinary cross-line optimization).
[0029] This stage is crucial for improving topology recognition accuracy, specifically addressing the semantic distinction between "physical intersections" and "electrical connections." For all connected component intersections marked in the first stage, this stage introduces deep analysis based on geometric constraint rules. By precisely calculating the extension direction of the line segments at the intersection, the distance between the endpoints, and the topological context, the nature of the intersection is intelligently determined. Only intersections that meet the geometric characteristics of busbar cross connections are identified as cross-busbar connection nodes. Typical "cross intersections" (i.e., two line segments intersect in the middle) are determined to be line crossings without electrical connections and are thus excluded from the topology. This step fundamentally eliminates virtual connection errors caused by line crossings.
[0030] Phase 3: Optimizing and eliminating erroneous relationships.
[0031] This stage is the final guarantee for ensuring the simplicity and correctness of the topology model. Based on the number of endpoints in a predefined library of core primary equipment types (including circuit breakers, disconnectors, transformers, lines, etc.), the system automatically filters out errors in the first stage of identification caused by text obscuring the drawings or electrical components being too close together. This ensures that the final output topology structure consists purely of key primary equipment and their connections, directly meeting the business needs of power grid dispatching and analysis, and eliminating redundant information.
[0032] Traditional methods treat all visual intersections as electrical connections, generating numerous erroneous topologies. This application employs a three-stage detection algorithm to accurately distinguish between "electrical connections" and "spatial crossings" based on geometric constraints, successfully eliminating invalid connections and ensuring the correctness of topological relationships. Through these three progressive stages, this application achieves semantic improvement from "physical connections" to "electrical connections" and focused optimization from "all connections" to "core connections," ultimately generating an accurate, concise topology that can be directly used for power grid analysis.
[0033] To further illustrate the technical solutions provided in the embodiments of this application, a detailed description is provided below in conjunction with the accompanying drawings and specific implementation methods. Although the embodiments of this application provide method operation steps as shown in the following embodiments or drawings, the method may include more or fewer operation steps based on conventional or non-inventive methods. In steps where there is no logically necessary causal relationship, the execution order of these steps is not limited to the execution order provided in the embodiments of this application.
[0034] The following is combined Figure 1 The application scenarios shown are explained in three stages.
[0035] refer to Figure 2 This application provides a method for extracting the topology of power grid drawings, including the following steps: S201: Identify the target power drawing to obtain a set of graphic elements.
[0036] S202: For each bus element, apply at least two elements connected by the bus element to update the initial topology indicated by the element set to obtain the first topology.
[0037] S203: Update the first topology based on the intersection primitives included in the first topology to obtain the second topology.
[0038] In this embodiment, the target power drawing is first subjected to basic connection detection. This identification process yields a set of elements, including the location information of at least one element and the connection relationships between elements, with each element indicating an electrical component. Next, an ambiguous process for eliminating cross-line ambiguities is performed, primarily including eliminating busbar cross-line ambiguities and eliminating ordinary cross-line ambiguities. For eliminating busbar connection line ambiguities, for each busbar element, at least two elements connected to the busbar element are used to update the initial topology indicated by the element set, resulting in a first topology. For eliminating ordinary cross-line ambiguities, the first topology is updated based on the cross-point elements included in the first topology, resulting in a second topology. This design ensures that the obtained second topology accurately extracts both low-level pixel connection information and high-level electrical connection semantic information from the target power drawing, guaranteeing the correctness of the obtained topology.
[0039] S201 mainly corresponds to the first stage (basic connection line detection stage). The target electrical drawing can be a scanned or digitized version of a user-provided paper drawing. Electrical components in the target electrical drawing are detected, and the coordinates of the detection frames for each component are obtained. Each electrical component can be represented as a graphic element. In practical applications, graphic elements can also represent busbars or intersections, etc., but this is just an example and does not constitute a specific limitation. A set of graphic elements includes the position information of at least one graphic element and the connection relationships between the graphic elements.
[0040] Optionally, the primitive set includes a primitive location information set and a primitive connection relationship set. In a specific example, the primitive set can be generated through steps A1-A2.
[0041] A1: Input the target power drawing into the pre-trained first model to obtain a set of primitive location information.
[0042] The element location information set includes the center coordinates, width, height, and element type of the detection box for each element. Optionally, the element location information set can be... express, Each primitive Represented as the following quintuple: .
[0043] in, The coordinates of the element's center; The width and height of the element; As a primitive type, Indicates circuit breaker, Indicates busbar, This refers to a transformer.
[0044] A2: For each pair of primitives, determine the pair of connection points of the primitives to obtain the set of primitive connection relationships.
[0045] Optionally, the element relationship diagram can be used express, ,in This represents a set of element location information; This represents the set of connection relationships between graphic elements.
[0046] For each pair of connected primitives Store a set of join point pairs: .in For primitives The coordinates of the connection point on the side, Let J represent the coordinates of the connection point on the j-th side of the graphic element.
[0047] Thus, the display format of the primitive set can be called the initial topology, and the initial topology will be optimized next.
[0048] Before introducing this step, which involves S202, let's first explain the various sets: (1) Boundary pixel set: For each primitive, the boundary pixels of its detection box constitute the boundary pixel set.
[0049] (2) Black pixel set: The pixel value of each pixel is less than a set pixel threshold. For example, the black pixel set uses... express, , representing all line pixels in the drawing, where each pixel satisfies the following constraints:
[0050] in For pixel grayscale values, Set the black threshold (that is, set the pixel threshold).
[0051] (3) Expand the boundary pixel set. Based on the expansion threshold, perform the expansion pixel boundary operation on the detection box of the primitive to ensure that the primitive detection box intersects with the black pixels.
[0052] (4) Connected pixel set: The set of pixels that form a defined connected path.
[0053] Next, steps B1-B3 are used to determine the set of connected pixels: B1: For each primitive, determine the set of extended boundary pixels of the primitive based on the primitive's detection bounding box and the set extension threshold.
[0054] First, perform a pixel boundary expansion operation on the primitive's detection bounding box to ensure that the primitive's detection bounding box intersects with black pixels. For the primitive... Define the extended boundary pixel set The horizontal boundary is:
[0055] The vertical boundary is:
[0056] Coordinate calculation:
[0057] In this example, the expansion threshold is set to .
[0058] B2: Determine the intersection of the extended boundary pixel set and the black pixel set.
[0059] Among them, the extended boundary pixel set The intersection with the black pixel set P is used It means that, among them, It can include multiple pixels.
[0060] B3: For each pixel in the intersection, take that pixel as the starting pixel and perform a search based on the starting pixel to determine the connected path.
[0061] Among them, the intersection any pixel in For example, taking this pixel as the starting pixel, using iterative depth-first search (DFS), starting from this pixel and expanding along the black pixels, all connected points are found. These points form a connected path, and the points on the determined connected path constitute the connected pixel set of the current primitive. The pixel distance between any two adjacent pixels on the connected path is less than a set distance threshold. In a specific example, pixel distance can be represented by Chebyshev distance: For two pixels and Define Chebyshev distance:
[0062] Optionally, the connected path can be represented as follows:
[0063] in The neighborhood threshold is set to 5 in this application in order to eliminate pixel breaks in the wiring diagram and to identify the connection relationship of the dashed lines.
[0064] In a specific example, the algorithm for generating a set of connected pixels is implemented as follows: Input: starting pixel Let P be the set of black pixels, τ be the neighborhood threshold, and W and H be the image width and height. Output: Connected pixel set C, last connected point
[0065] stack{\{p_0\}} / / Initialize the search stack and push the seed point onto the stack. / / Collection of visited pixels, initially empty / / Set of connected pixels, initially empty / / The final join point is initialized as the seed point. / / Pop the top pixel p from the stack / / Determine if p is an unvisited black pixel / / Mark p as visited / / Add p to the connected component / / Update the last connection point to the current point p
[0066] stack←stack∪neighbors / / Add neighboring pixels to the search stack
[0067] end if
[0068] end while
[0069] return / / When the search stack is empty, the algorithm terminates and returns the result.
[0070] The algorithm described above, by systematically exploring the neighborhood of each black pixel, can accurately aggregate physically connected pixel regions into a connected component (i.e., a connected pixel set). The record of the last connection point p_last helps locate the boundary of this connected component in subsequent steps.
[0071] In practical applications, if and only if the primitive boundary points Connect to primitives via black pixels boundary points The following relationship must be satisfied: It can determine the primitives A connection exists. The algorithm for this process is as follows: Input: Primitive set E, black pixel set P Output: Relationship graph R = { } / / Initialize the relation set / / Initialize the global set of visited pixels for each do / / Iterate through each primitive / / Generate the boundary of each primitive for each do / / Traverse boundary pixels if then continue / / Skip non-black or already visited pixels end if / / Perform a depth-first search global_visited←global_visited∪ C / / Update the global visited collection for each do / / Check if the connected region is connected to other primitives
[0072] if intersection= then / / Take the first intersection point / / Add connection relationship end if end for end for end for return
[0073] In this embodiment, the topology extraction process based on pixel connectivity analysis and reasoning overcomes the problems of traditional line detection methods, such as difficulty in identifying real topological connections between primitives and inability to handle complex scenarios such as cross-primitive connections, and achieves automatic conversion from drawing images to accurate topology models.
[0074] Based on the above technical solutions, this application proposes a topology optimization method based on cross-line classification to address the technical problem of misjudgment of topology relationships caused by cross-lines in electrical wiring diagrams. This method first identifies and classifies cross-lines into two categories based on the type of graphic elements they connect: "busbar cross-lines" and "ordinary cross-lines (also known as ordinary cross-lines)." Then, it applies corresponding geometric constraints and logical reasoning rules to the differentiated electrical connection semantics inherent in different categories of cross-lines, thereby achieving accurate reconstruction of the topology structure and effectively improving the accuracy of the extraction results.
[0075] In step S202, Figure 3 This is a schematic diagram of busbar crossover optimization provided in an embodiment of this application. First, the optimization process of the busbar crossover will be explained: The primitive set includes primitives of different types; cross-line primitives of the bus type can be called bus primitives. For each bus primitive, the initial topology indicated by the primitive set is updated by applying at least two primitives connected to the bus primitive, resulting in the first topology.
[0076] Optionally, this process can be achieved through steps C1-C3: In electrical system drawings, a busbar serves as a connection node, and the electrical components on both sides of it are actually connected through the busbar. A busbar crossover refers to a pair of elements on both sides of the same busbar, and these pairs of elements may be indirectly connected through the busbar.
[0077] See Figure 3 In the initial topology identification results, there were instances of misjudgment of connection relationships. Specifically, the direct connection relationship between "element 25 and bus 14" that should have existed was not correctly detected, and two incorrect connection relationships were identified: "bus 15 - element 25" and "bus 14 - bus 15". To correct such errors and improve the accuracy of the topology network, this application introduces the following connection relationship optimization algorithm.
[0078] C1: For each busbar element, in the set of connected pixels of the busbar element, determine the connection points between at least two elements connected to the busbar and the busbar element respectively.
[0079] Taking busbar b (busbar 15 in the diagram) as an example, it connects to two electrical elements a (busbar 14 in the diagram) and (Element 25 in the diagram), they form a pair of elements on both sides of the busbar:
[0080] in, busbar The set of adjacent primitives, The distance is perpendicular to the direction of the generatrix. busbar With primitives The connection point.
[0081]
[0082] The above formula means that there are primitives. and primitives All with busbar There is a connection, and the two elements have different connection points with the busbar. and There is no direct connection between them. When the above three conditions are met, the connection point... When two elements are close to each other in a direction perpendicular to the generatrix, it is assumed that they should be connected. That is, for a horizontal generatrix, the connection point of two elements is very close in the Y-axis direction, and for a vertical generatrix, the connection point of two elements is very close in the X-axis direction.
[0083] C2: Calculate the distance between any two connection points, and determine the first and second connection points corresponding to the minimum distance.
[0084] The first connection point is the connection point between the first graphic element and the busbar graphic element, and the second connection point is the connection point between the second graphic element and the busbar graphic element.
[0085] In a specific example, it is necessary to find the minimum distance index pair on both sides of the bus, and then find the two closest connection points on the bus to establish a cross-bus connection. The index pair must satisfy the following conditions: For the sequence of coordinates of the connecting points, To find the index pairs that minimize distance.
[0086] The algorithm flow is as follows: Input: Primitive set E, preliminary relational graph
[0087] Output: Optimized relationship graph / / Extract primitives a Side connection point / / Extract primitives a With busbar b connection point / / Extract primitives Side connection point / / Extract primitives With busbar b Contact points / / Discovery and Associated primitive clusters / / Discovery and Associated primitive clusters / / Graphic elements a and direct connection for each do / / Connect primitives a and Side cluster elements
[0088] end for
[0089] for each do / / Connect primitives and a Side cluster elements
[0090] end for
[0091] for each do / / Fully connected elements between clusters end for return R 1.
[0092] C3: Based on the initial topology, clear the connection between the first element and the bus element, as well as the connection between the second element and the bus element, and add the connection between the first element and the second element to obtain the first topology.
[0093] In the example above, the connection between bus 14 and bus 15 is cleared, and the connection between bus 15 and element 25 is cleared. The connection between bus 14 and element 25 is then added to update the initial topology and obtain the first topology.
[0094] Regarding S203, in electrical wiring diagrams, visual crossings of lines may only represent spatial overlap rather than actual electrical connections. However, in the initial detection stage based on pixel connectivity, such "pseudo-crossings" are often misidentified as valid connection nodes, leading to topology distortion. Therefore, this step proposes a common cross-line optimization algorithm, which corrects the initial identification results by introducing geometric feature analysis and contextual reasoning to eliminate connection errors caused by pseudo-crossings. Optionally, this process can be implemented through steps D1-D4: D1: Based on the first topology, obtain the set of intersection point primitives.
[0095] Based on observation of electrical wiring diagrams, line intersections typically exhibit regular geometric shapes (such as cross shapes or approximately wavy shapes), possessing significant distinguishable features. To utilize this feature, this application employs a deep learning-based object detection method, training a YOLOv8 model to scan the drawing image to automatically and accurately identify and locate all intersecting lines in the diagram, thereby recognizing intersection primitives.
[0096] Specifically, a dedicated dataset was constructed and the model was trained. The trained model was then used to achieve accurate detection of intersecting lines. The specific implementation process is as follows;
[0097] Step 1: Data preparation and labeling.
[0098] We collected 300 power wiring diagrams with different connection types and drawing styles. All images were scaled to a fixed size of 1024×1024 pixels. Then, we used a labeling tool to finely label the cross lines in the images. The labeling information included the bounding box coordinates of the cross lines and the category label "cross" (the type of graphic element).
[0099] Step 2: Data augmentation.
[0100] To improve the robustness and generalization ability of the model, online and offline data augmentation was performed on the original dataset. The augmentation operations included: random horizontal flipping, random rotation (-15° to +15°), random adjustment of brightness and contrast, and addition of Gaussian noise. After data augmentation, the total dataset size was expanded to 1000 images, effectively preventing model overfitting.
[0101] Step 3: Model training.
[0102] This application uses the YOLOv8 model as the detection framework, and the specific training process is as follows: Initialization: Use weights pre-trained on the COCO dataset as initial parameters for the model to accelerate model convergence.
[0103] Parameter settings: The training cycle is set to 60 rounds, and the batch size is set to 64. The optimizer used is AdamW, the initial learning rate is set to 1e-3, and a cosine annealing scheduling strategy is used to dynamically adjust the learning rate.
[0104] Training and Validation: The augmented dataset is randomly divided into training, validation, and test sets in an 8:1:1 ratio. During training, the average precision of the model on the validation set is monitored in real time, and the weights of the best-performing model are saved.
[0105] Results: The final trained model can efficiently and accurately locate and identify various intersecting lines in the drawing, providing reliable input for subsequent topological disambiguation.
[0106] In this way, the intersections identified by the trained model during the intersection optimization stage are regarded as a special kind of "intersection primitive". In practical applications, when identifying primitive sets in target power drawings, this trained model can also be used in combination with basic connection detection algorithms to establish preliminary topological connections including these intersections. This is just an example and does not constitute a specific limitation.
[0107] D2: For each intersection primitive in the intersection primitive set, determine the individual pixels connected to the intersection primitive.
[0108] D3: Group the pixels according to their arrangement direction.
[0109] Figure 4 This is a schematic diagram illustrating a general intersection optimization method provided in an embodiment of this application. For intersection point e_cross, elements are grouped according to the coordinates of the connection points of the intersection lines. That is, elements connected to the same position of the intersection line (e.g., intersection point element number 192) are grouped together. The grouping results are as follows: ; in For intersecting lines and primitives In the sequence of connection points, the points on the side of the intersecting lines. For the Chebyshev distance, in this application For two connection points grouped together. Their connection point (p, q) lies on the same straight line, which proves that p and q are connected.
[0110] Optional, the grouping logic is as follows:
[0111] For example, in the grouping results, group 1 includes intersection element 180 and intersection element 201, and group 2 includes intersection element 190 and intersection element 197.
[0112] In this application, δ=3 is set. For example, for intersection element 192 in the figure, the connection points of intersection elements 190, 195, and 197 are connected, and intersection element 180 and 201 are connected. The complete algorithm flow is as follows.
[0113] Input: Relationship diagram (Including crossing lines)
[0114] Output: Optimized relationship graph (No intersecting lines)
[0115] for each where type( ) == 'cross' do / / Iterate through all intersecting lines
[0116] groups GroupByConnectionPoint( (, cross) / / Connecting point grouping
[0117] append_rela / / Initialize the set of processed connection point pairs
[0118] for each do
[0119] for each do
[0120] if = then continue / / Skip the same intersection
[0121] if and then continue / / Skip non-collinear points
[0122] if then continue / skip processed point pairs = ConnectSameLineEntities / / Connect groups of elements on the same line end for end for end for D4: For each group, clear the connection relationships between other intersection elements and intersection elements within the group.
[0123] In the example above, the connection between intersection element 180 and intersection element 192, the connection between intersection element 201 and intersection element 192, the connection between intersection element 190 and intersection element 192, and the connection between intersection element 197 and intersection element 192 can be cleared.
[0124] In this application embodiment, a cross-line disambiguation rule based on geometric constraints is introduced to overcome the topological ambiguity problem caused by line crossings in drawings.
[0125] Based on the above technical solution, due to the non-standard drawing of the original drawings, there are problems such as text and primitive overlap and excessively close spacing between primitives, which leads to erroneous connection relationships in the first stage based on pixel connectivity detection. Therefore, a topology relationship verification and correction mechanism is introduced in the third stage to specifically eliminate such erroneous connections caused by drawing flaws, ensuring the accuracy of the final topology structure. Specifically, after obtaining the second topology structure, it can be updated based on the number of endpoints of each primitive included in the second topology structure to obtain the target topology structure. This process mainly corresponds to the erroneous relationship optimization and elimination in the third stage.
[0126] Optionally, the number of physical endpoints that should exist for the 13 electrical elements is defined. For example, a circuit breaker should have two terminals, and a voltage transformer should have one terminal. Figure 5 This is a schematic diagram of a graphic element endpoint provided in an embodiment of this application, wherein the dashed rectangle is a schematic diagram of the endpoint.
[0127] Optionally, the process of optimizing and eliminating erroneous relationships can be implemented through steps E1-E4: E1: Among the various primitives included in the second topology, identify at least one first primitive with a number of endpoints greater than a preset threshold, and crop at least one first primitive to obtain at least one target primitive with a one-to-one correspondence.
[0128] Taking the first primitive as an example, the number of its endpoints is used This indicates that the preset quantity threshold is used. It means that if Greater than If the number of endpoints exceeds a preset threshold, the first primitive is cropped to form a target primitive. Applying the same method, all first primitives with more than a preset threshold are processed in the same way to obtain multiple corresponding target primitives.
[0129] Optionally, in this embodiment, a dedicated dataset is constructed to train the model, and the trained model is used to achieve accurate detection of primitive endpoints. The specific implementation process is as follows: Step 1: Data preparation and labeling.
[0130] A total of 1000 image samples containing various electrical elements such as circuit breakers, disconnect switches, and transformers were collected. Professional technicians meticulously labeled the endpoints of each element in the images, with the labeling information consisting of a bounding box centered on the endpoint and its category label "endpoint". Since endpoint targets occupy a small portion of the image, a high-precision labeling strategy was employed to ensure accurate positioning.
[0131] Step 2: Model selection and training.
[0132] Given the small size and indistinct features of endpoint targets, this application selects the Fast R-CNN model framework based on region proposal for endpoint detection. The specific training process is as follows: The backbone network operates by using a ResNet-50 model pre-trained on the ImageNet dataset as the feature extraction backbone to fully leverage its powerful feature representation capabilities.
[0133] The process of the Region Proposal Network (RPN): The RPN network is used to generate candidate regions that may contain endpoints by setting appropriate anchor scales and aspect ratios to accommodate the small size characteristics of endpoint targets.
[0134] The classification and regression process is as follows: For the candidate regions generated by RPN, fixed-size features are extracted using the RoI pooling layer, thereby completing the accurate classification of endpoints and the fine-tuning regression of bounding boxes.
[0135] Training details: The model training cycle was set to 100 epochs, using a stochastic gradient descent optimizer with a momentum of 0.9 and a weight decay factor of 1e-4. The initial learning rate was set to 0.005, and then decayed to one-tenth of its original value at 2 / 3 and 5 / 6 of the total training epochs.
[0136] E2: Input each target primitive in at least one target primitive into a pre-trained model to determine the estimated location information of at least one endpoint included in the target primitive.
[0137] The pre-trained model is the aforementioned endpoint detection model, which crops the primitives in the image. The data is input into the trained endpoint detection model, and the model outputs the estimated location information of the endpoints, that is, the set of detection results. Each detection box Represented by a quintuple, specifically as , which respectively represent the x-coordinate and y-coordinate of the center point of the detection box, the width of the box, the height of the box, and the confidence level of the detection result.
[0138] E3: For each endpoint, determine whether the endpoint is a pseudo-connection based on the endpoint's estimated location information and the endpoint's set location information.
[0139] The endpoint location information is determined based on the connected pixel set of the target primitive.
[0140] Optionally, the implementation of identifying endpoints with false connections can be as follows: If the estimated position information of an endpoint indicates a first position different from the set position information of the endpoint, the endpoint is determined to be a false connection endpoint. That is, if the detection box coincides with the originally detected endpoint, it represents a real connection point; otherwise, it is considered a false connection point, and the erroneous relationship is excluded.
[0141] For example, the algorithm implementation process of this procedure is as follows: Input: primitives Relationship diagram Endpoint detector M, original image I Output: Optimized relational graph R
[0142] for each do / / Count the current number of connections / / Query the expected number of endpoints for this type of primitive.
[0143] return
[0144] end if / / No endpoint detected, leave as is return
[0145] end if / / Sort by confidence level and get Top-K selected_pixels / / Select nearest neighbor connection point / / Reconstruct topology end for return
[0146] E4: Based on the second topology, delete the endpoints of the illusory connections to obtain the target topology.
[0147] The above embodiments effectively distinguish between real electrical connections and visually non-connected intersections by analyzing the spatial structural characteristics of intersections, and establish direct topological connections between elements on the same line, thereby eliminating false connections and significantly improving the accuracy of topological relationships.
[0148] In summary, the embodiments of this application achieve accurate cross-element topology detection and can intelligently ignore non-core components. Specifically, it can penetrate element boundaries to identify indirect electrical connections between devices, truly realizing logical topology extraction across elements. Simultaneously, through a predefined device filtering mechanism, it can automatically ignore secondary or auxiliary components in the drawing that are irrelevant to the analysis, such as surge arresters and grounding switches, directly outputting the pure topology of primary equipment of interest to power grid dispatching, thus eliminating redundant information.
[0149] Furthermore, the structured topology data output in this application is crucial for constructing a "digital twin" power grid. This technology transforms traditionally manually interpreted blueprints into network models that computers can directly recognize, providing an accurate and reliable data foundation for subsequent advanced applications such as power flow calculation, fault analysis, and intelligent scheduling. This significantly improves the automation level and decision-making efficiency of power grid planning, operation, and maintenance.
[0150] like Figure 6 As shown, based on the same inventive concept as the above-mentioned method for extracting the topology of power drawings, this application embodiment also provides a device for extracting the topology of power drawings, including an identification unit 61 and a processing unit 62.
[0151] The identification unit 61 is used to: identify the target power drawing to obtain a set of graphic elements; wherein the set of graphic elements includes the location information of at least one graphic element and the connection relationship between the graphic elements, and each graphic element indicates an electrical component; Processing unit 62 is configured to: for each bus element, apply at least two elements connected by the bus element to update the initial topology indicated by the element set to obtain a first topology; The processing unit 62 is further configured to: update the first topology based on the intersection primitives included in the first topology to obtain the second topology.
[0152] In an optional implementation, the processing unit 62 is further configured to: Based on the number of endpoints of each primitive included in the second topology, the second topology is updated to obtain the target topology.
[0153] In one alternative implementation, the processing unit 62 is specifically used for: In the various primitives included in the second topology, at least one first primitive with a number of endpoints greater than a preset threshold is identified, and at least one first primitive is cropped to obtain at least one target primitive with a one-to-one correspondence. Each target primitive in at least one target primitive is input into a pre-trained model to determine the estimated location information of at least one endpoint included in the target primitive; For each endpoint, based on the endpoint's estimated location information and the endpoint's set location information, it is determined whether the endpoint is a pseudo-connected endpoint; wherein, the endpoint's set location information is determined based on the connected pixel set of the target primitive; Based on the second topology, the endpoints of the illusory connections are removed to obtain the target topology.
[0154] In one alternative implementation, the processing unit 62 is specifically used for: If the estimated location information of the endpoint indicates a first location that is different from the set location information of the endpoint that indicates a second location, then the endpoint is determined to be a pseudo-connection endpoint.
[0155] In one optional implementation, the primitive set includes a primitive location information set and a primitive connection relationship set; The identification unit 61 is specifically used for: The target power drawing is input into the pre-trained first model to obtain a set of primitive location information; the primitive location information set includes the center coordinates, width, height and primitive type of the detection box of each primitive. For each pair of primitives, determine the pair of connection points of the primitives to obtain the set of primitive connection relationships.
[0156] In one alternative implementation, the processing unit 62 is specifically used for: For each busbar element, in the set of connected pixels of the busbar element, determine the connection points between the busbar element and at least two other elements connected to it. Calculate the distance between any two connection points and determine the first and second connection points corresponding to the minimum distance; where the first connection point is the connection point between the first graphic element and the busbar graphic element, and the second connection point is the connection point between the second graphic element and the busbar graphic element. Based on the initial topology, the connection between the first element and the bus element, as well as the connection between the second element and the bus element, are cleared, and the connection between the first element and the second element is added to obtain the first topology.
[0157] In one alternative implementation, the processing unit 62 is specifically used for: Based on the first topology, obtain the set of intersection point primitives; For each intersection primitive in the intersection primitive set, determine the individual pixels connected to the intersection primitive; Group the pixels according to their arrangement direction; For each group, clear the connection relationships between other intersection elements and intersection elements within the group.
[0158] In an optional implementation, the processing unit 62 is further configured to determine the set of connected pixels for each primitive in the following manner: For each primitive, the set of pixels representing the extended boundary of the primitive is determined based on the primitive's detection bounding box and the set extension threshold. Determine the intersection of the extended boundary pixel set and the black pixel set; wherein the pixel value of each pixel in the black pixel set is less than a set pixel threshold; For each pixel in the intersection, the pixel is taken as the starting pixel, and a search is performed based on the starting pixel to determine the connected path; wherein, the pixel distance between two adjacent pixels on the connected path is less than a set distance threshold, and each pixel constitutes a connected pixel set of the primitive.
[0159] The power drawing topology extraction method and apparatus proposed in this application adopt the same inventive concept as the above-mentioned power drawing topology extraction method and can achieve the same beneficial effects, so it will not be described again here.
[0160] Based on the same inventive concept as the aforementioned method for extracting the topology of power drawings, this application also provides an electronic device, which may specifically be a desktop computer, portable computer, smartphone, tablet computer, personal digital assistant (PDA), server, etc. Figure 7 As shown, the electronic device may include a processor 701 and a memory 702.
[0161] The processor 701 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0162] Memory 702, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory is any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. Memory 702 in the embodiments of this application may also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0163] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned computer storage medium can be any available medium or data storage device that a computer can access, including but not limited to: mobile storage devices, random access memory (RAM), magnetic storage (e.g., floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (e.g., CDs, DVDs, BDs, HVDs, etc.), and semiconductor storage (e.g., ROMs, EPROMs, EEPROMs, non-volatile memory (NAND flash), solid-state drives (SSDs)) and other media capable of storing program code.
[0164] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods of the various embodiments of this application. The aforementioned storage medium includes: mobile storage devices, random access memory (RAM), magnetic storage (e.g., floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (e.g., CDs, DVDs, BDs, HVDs, etc.), and semiconductor storage (e.g., ROMs, EPROMs, EEPROMs, non-volatile memory (NAND flash), solid-state drives (SSDs), etc.) and other media capable of storing program code.
[0165] Based on the same inventive concept, this application also provides a computer program product, which includes computer program code. When the computer program code is run on a computer, it causes the computer to execute any of the power drawing topology extraction methods discussed above. Since the principle of the above computer program product in solving the problem is similar to that of the power drawing topology extraction method, the implementation of the above computer program product can refer to the implementation of the method, and repeated details will not be repeated.
[0166] The above embodiments are only used to provide a detailed description of the technical solutions of this application. However, the description of the above embodiments is only for the purpose of helping to understand the methods of the embodiments of this application and should not be construed as a limitation on the embodiments of this application. Any changes or substitutions that can be easily conceived by those skilled in the art should be covered within the protection scope of the embodiments of this application.
Claims
1. A power graph topology extraction method, characterized by, The method comprises: identifying a target power diagram to obtain a graph element set; wherein the graph element set comprises position information of at least one graph element and a connection relationship between graph elements, and each graph element indicates an electrical element; for each bus graph element, applying at least two graph elements connected to the bus graph element to update an initial topology structure indicated by the graph element set to obtain a first topology structure; updating the first topology structure based on a cross point graph element included in the first topology structure to obtain a second topology structure.
2. The method of claim 1, wherein, The method further comprises: updating the second topology structure based on the number of end points of each graph element included in the second topology structure to obtain a target topology structure.
3. The method of claim 2, wherein, The updating of the second topology structure based on the number of end points of each graph element included in the second topology structure to obtain a target topology structure comprises: identifying at least one first graph element with a number of end points greater than a preset threshold from the graph elements included in the second topology structure, and cropping the at least one first graph element to obtain at least one target graph element in a one-to-one correspondence; inputting each target graph element in the at least one target graph element into a pre-trained model to determine estimated position information of at least one end point included in the target graph element; for each end point, determining whether the end point is a false connection end point based on the estimated position information of the end point and the set position information of the end point; wherein the set position information of the end point is determined based on a connected pixel set of the target graph element; deleting the false connection end point based on the second topology structure to obtain a target topology structure.
4. The method of claim 3, wherein, The determination of whether the end point is a false connection end point based on the estimated position information of the end point and the set position information of the end point comprises: if a first position indicated by the estimated position information of the end point is different from a second position indicated by the set position information of the end point, it is determined that the end point is a false connection end point.
5. The method of claim 1, wherein, The graph element set comprises a graph element position information set and a graph element connection relationship set; The identification of the target power diagram to obtain a graph element set comprises: inputting the target power diagram into a pre-trained first model to obtain a graph element position information set; wherein the graph element position information set comprises center coordinates, width, height and a graph element type of a detection box of each graph element; for each graph element pair, determining a connection point pair of the graph element pair to obtain a graph element connection relationship set.
6. The method of claim 1, wherein, The updating of the initial topology structure indicated by the graph element set to obtain a first topology structure for each bus graph element by applying at least two graph elements connected to the bus graph element comprises: for each bus graph element, determining connection points of at least two graph elements connected to the bus graph element in a connected pixel set of the bus graph element; calculating distances between any two connection points respectively, and determining a first connection point and a second connection point corresponding to a minimum distance; wherein the first connection point is a connection point of a first graph element and the bus graph element, and the second connection point is a connection point of a second graph element and the bus graph element; On the basis of the initial topology structure, the connection relationship of the first graph element and the bus graph element and the connection relationship of the second graph element and the bus graph element are removed, and the connection relationship of the first graph element and the second graph element is added, to obtain a first topology structure.
7. The method of claim 1, wherein, The first topology structure is updated based on the intersection point graph element included in the first topology structure, to obtain a second topology structure, including: Based on the first topology structure, an intersection point graph element set is obtained. For each intersection point graph element in the intersection point graph element set, each pixel point connected to the intersection point graph element is determined. The pixel points are grouped according to the arrangement direction of the pixel points. For each group, the connection relationship of other intersection point graph elements in the group and the intersection point graph element is removed.
8. The method according to claim 3 or 6, characterized in that, The method further includes determining the connected pixel set of each graph element by the following method: For each graph element, an extended boundary pixel set of the graph element is determined according to the detection frame of the graph element and a set extension threshold value. The intersection of the extended boundary pixel set and a black pixel set is determined; each pixel in the black pixel set has a pixel value less than a set pixel threshold value. For each pixel point in the intersection, the pixel point is taken as a starting pixel point, and a connected path is determined based on the starting pixel point; the pixel distance between two adjacent pixel points on the connected path is less than a set distance threshold value, and each pixel point constitutes the connected pixel set of the graph element.
9. An electrical power graph topology extraction apparatus, characterized by, Including: The recognition unit is configured to recognize a target electric power drawing to obtain a graph element set; the graph element set includes position information of at least one graph element and connection relationships between graph elements, and each graph element indicates an electrical element. The processing unit is configured to update an initial topology structure indicated by the graph element set to obtain a first topology structure, for each bus graph element, by applying at least two graph elements connected to the bus graph element. The processing unit is further configured to update the first topology structure based on an intersection point graph element included in the first topology structure to obtain a second topology structure.
10. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the method of any one of claims 1 to 8.
11. A computer-readable storage medium having stored thereon computer program instructions, wherein, The computer program instructions are executed by the processor to implement the steps of the method of any one of claims 1 to 8.