Terminal block drawing automatic classification and loop visualization method based on deep learning network

By constructing an electrical symbol semantic knowledge base and an improved deep neural network, the problem of missing symbol logical associations in terminal block drawings was solved, enabling automatic classification and circuit visualization of terminal block drawings, and generating a structured functional logic diagram.

CN121661667APending Publication Date: 2026-03-13SUQIAN POWER SUPPLY COMPANY OF JIANGSU PROVINCE POWER
0 Cites -1 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-05
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing technologies, when processing terminal block drawings, lack the integration of knowledge from the field of electrical engineering and cannot understand the logical relationships between symbols in the circuit, resulting in fragmented identification results and an inability to form a complete signal flow and functional circuit.

Method used

An electrical symbol semantic knowledge base is constructed, and combined with an improved deep neural network, automatic classification and circuit visualization of terminal block drawings are achieved through semantic-driven sliding window positioning and functional logic reasoning.

Benefits of technology

It achieves complete information capture and logical reconstruction of terminal block drawings, generates structured functional logic diagrams, and improves the interpretability and practical value of the analysis results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121661667A_ABST
    Figure CN121661667A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of artificial intelligence, and discloses a terminal block drawing automatic classification and loop visualization method based on a deep learning network, and the method comprises the following steps: constructing an electrical symbol semantic knowledge base containing multiple types of key electrical symbol structured attributes; performing standardized preprocessing on the to-be-analyzed terminal block drawing to obtain image and text data; identifying key electrical symbols and positions thereof by using an improved deep neural network; querying a knowledge base based on an identification result, executing semantic-guided coarse-to-fine sliding window positioning, and capturing associated context elements; fusing the symbol, the context and the text data, reconstructing loop logic, and generating structured loop data; and finally, constructing a functional logic map and visually outputting the functional logic map. According to the method, semantic association between the electrical identifiers in the terminal block drawing is achieved, and the category of the terminal block drawing and the complete signal flow direction and function loop are clearly displayed for engineers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method for automatic classification and circuit visualization of terminal block drawings based on deep learning networks. Background Technology

[0002] With the ongoing development of smart grids and digital substations, electrical drawings, as core engineering documents that convey equipment connections, signal flows, and functional logic, have become crucial for improving construction accuracy and operational efficiency through efficient parsing and intelligent reconstruction. Terminal block drawings, as detailed representations of secondary circuit designs, precisely describe the wiring relationships of control, protection, and measurement circuits; their parsing quality directly impacts the reliability, security, and maintainability of the power system. However, these drawings are typically numerous, diverse in format, densely packed with graphic elements, and semantically complex. Traditional methods relying on manual experience for interpretation are not only inefficient but also prone to misinterpretation due to fatigue or negligence, failing to meet the stringent requirements of modern power systems for high automation and traceability.

[0003] Currently, mainstream technical solutions focus on automating the extraction of elements from drawings using computer vision and optical character recognition (OCR) technologies. Typical methods include combining OCR engines with basic image processing algorithms to detect and locate text, lines, and symbols in drawings. However, these methods essentially remain at a superficial level of visual perception of the drawings, treating them as ordinary images for indiscriminate "bottom-up" processing. For example, they might use a fixed-size sliding window for global scanning or employ a general object detection model to recognize pre-defined graphic symbols. The fundamental limitation of this processing model is its lack of integration with electrical engineering knowledge. It fails to understand the functional roles of symbols (such as input terminals and tripping actuators) and their logical connections within circuits, resulting in fragmented information in the recognition results. Even if symbols and text are successfully recognized, the system cannot effectively establish semantic relationships between them, let alone deduce complete signal flow and functional circuits.

[0004] Therefore, in order to address the above problems, there is an urgent need to propose a new method for classifying and visualizing terminal block drawings. Summary of the Invention

[0005] This invention overcomes the shortcomings of the prior art and provides a method for automatic classification of terminal block drawings and visualization of circuits based on deep learning networks.

[0006] To achieve the above objectives, the technical solution adopted by this invention is as follows: a method for automatic classification of terminal block drawings and visualization of circuits based on deep learning networks, comprising the following steps:

[0007] S1. Construct an electrical symbol semantic knowledge base, which stores the structured attributes of multiple key electrical symbols appearing in terminal block drawings;

[0008] S2. Perform standardized preprocessing on the terminal block drawing file to be parsed to obtain standardized drawing image data and text data;

[0009] S3. The improved deep neural network is used to process the drawing image data to identify the key electrical symbols and their location information in the terminal block drawing;

[0010] S4. Based on the identified key electrical symbols, query the semantic knowledge base of the electrical symbols to obtain semantic guidance information, and perform coarse-to-fine sliding window positioning driven by the semantic guidance information to capture the context elements associated with the key electrical symbols;

[0011] S5. Integrate the key electrical symbols, the context elements, and the text data to reconstruct the loop logic and generate structured loop data;

[0012] S6. Construct a functional logic diagram based on the loop data and output it visually.

[0013] In a preferred embodiment of the present invention, the structured attributes of each type of key electrical symbol in the electrical symbol semantic knowledge base include at least one of the following: standard graphic template, electrical function description, typical connection rules, expected associated text type, and circuit category.

[0014] In a preferred embodiment of the present invention, the semantically driven coarse-to-fine sliding window positioning specifically includes:

[0015] The drawing image data is coarsely scanned using a sliding window of the first size to locate the region of interest containing key electrical symbols;

[0016] Based on the category of the key electrical symbols, query the typical connection rules corresponding to the key electrical symbols from the semantic knowledge base of electrical symbols;

[0017] The parameters of the fine-grained search window of the second size are dynamically determined based on the typical connection rules, including window size, position, and search range;

[0018] The fine search window is used to perform a fine scan around the region of interest, simultaneously identifying the contextual elements of both text and graphic types.

[0019] In a preferred embodiment of the present invention, the parameters of the fine search window of the second size are dynamically adjusted according to the resolution of the terminal block drawing file.

[0020] In a preferred embodiment of the present invention, the loop logic reconstruction includes:

[0021] Establish the physical connection relationship between key electrical symbols and terminals based on geometric proximity;

[0022] Bind text labels to corresponding terminals based on spatial proximity;

[0023] Establish cable connection relationships between terminals based on wire number consistency matching;

[0024] Based on the aforementioned typical connection rules, logical verification and missing connection inference are performed on the established connection relationships.

[0025] In a preferred embodiment of the present invention, during the process of binding text tags to corresponding terminals based on spatial proximity, when there are multiple candidate text tags around a single terminal, the optimal binding text is selected by calculating confidence weight based on distance.

[0026] In a preferred embodiment of the present invention, the missing connection inference means that when two symbols conform to the logical connection relationship defined by the typical connection rule but have not established a physical or cable connection, and their spatial distance is less than a set threshold, a virtual connection edge is added to the two symbols in the loop data.

[0027] In a preferred embodiment of the present invention, the improved deep neural network is based on the ResNet50 architecture and the improvement includes the introduction of a spatial attention mechanism and a region proposal network to achieve end-to-end symbol recognition and localization.

[0028] In a preferred embodiment of the present invention, in step S1, the construction of the electrical symbol semantic knowledge base includes: defining typical connection rules for each type of key electrical symbol; the typical connection rules are described in a formal rule language and are used to constrain the target symbol type, spatial search orientation and maximum connection distance that the symbol must connect to in the loop.

[0029] In a preferred embodiment of the present invention, in step S6, the construction of the functional logic graph includes: mapping the structured loop data into an attribute graph model; the attribute graph model includes nodes representing electrical symbols, terminals and cables, and edges representing physical connections, cable connections and logical connection relationships, wherein nodes and edges carry key-value pairs for describing their electrical functional attributes.

[0030] An electronic device includes one or more processors for storing one or more programs, which, when executed by the one or more processors, cause the one or more processors to perform the aforementioned method for automatic classification and circuit visualization of terminal block drawings based on deep learning networks.

[0031] A storage medium storing a computer program, wherein the computer program is configured to execute the aforementioned method for automatic classification and circuit visualization of terminal block drawings based on deep learning networks when it is run.

[0032] This invention addresses the shortcomings of the prior art and has the following beneficial effects:

[0033] (1) This invention provides an automatic classification and circuit visualization method for terminal block drawings based on deep learning networks. By constructing a structured electrical symbol semantic knowledge base, the traditional domain knowledge that relies on engineers' experience is transformed into formatted data that can be queried and executed by machines. This makes the system's identification and information extraction process no longer blind, but actively guided by semantic knowledge. It gives the computer system a "domain cognition" ability similar to human experts, enabling it to understand the role and related logic of symbols in the circuit. Compared with the existing technology that only performs visual feature matching and lacks semantic understanding, this application ensures the goal orientation of the entire parsing process, laying a solid and reliable foundation for the subsequent realization of complete and accurate circuit logic reconstruction.

[0034] (2) This invention provides an automatic classification and loop visualization method for terminal block drawings based on deep learning networks. It adopts a semantic-driven coarse-to-fine sliding window positioning strategy. Based on the semantic information of the identified key symbols, it dynamically generates an asymmetric, target-specific fine search window instead of using a mechanical scanning with fixed size and step size. This design enables the information extraction process to focus on the local area related to the core functional symbols, thereby achieving accurate and complete capture of contextual elements such as terminals and wire numbers. Compared with the defects of the indiscriminate sliding window in the prior art, which is prone to the breakage of functional unit information due to boundary cutting, this method significantly improves the completeness of information capture.

[0035] (3) This invention provides an automatic classification and loop visualization method for terminal block drawings based on deep learning networks. In the loop logic reconstruction stage, a functional logic reasoning and virtual connection edge inference mechanism based on typical connection rules are introduced, which enables the system to perform logical verification of established physical connections and cable connections according to the rules in the knowledge base, and to intelligently complete symbol pairs that conform to the logic but are not directly connected on the drawing. This gives the system a certain fault tolerance and reasoning ability, and can automatically repair any drawing omissions or non-standard parts in the drawing, thereby outputting a more complete and reasonable loop model. This provides a directly usable knowledge base for subsequent advanced applications such as automatic drawing verification and intelligent fault diagnosis, and greatly improves the practical value of the output results.

[0036] (4) This invention provides an automatic classification and loop visualization method for terminal block drawings based on deep learning networks. Finally, a functional logic diagram is constructed for visualization output, and the structured loop data is mapped to an attribute graph model. This process transforms the internal data structure of the machine into an intuitive graphical interface that is easy for human engineers to understand and operate, which greatly improves the interpretability and usability of the analysis results, enabling engineers to quickly grasp the loop logic and perform verification analysis. Attached Figure Description

[0037] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0038] Figure 1 This is a flowchart of the steps of a preferred embodiment of the present invention. Detailed Implementation

[0039] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0040] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein. Therefore, the scope of protection of the invention is not limited to the specific embodiments disclosed below.

[0041] Application Overview

[0042] In electrical engineering, especially in the operation and maintenance systems of smart grids and substations, terminal block drawings serve as the core carrier describing the connection relationships between equipment, signal flow, and functional logic. Efficient and accurate parsing and semantic reconstruction of these drawings are crucial for improving the automation and intelligence levels of design, construction, acceptance, and operation and maintenance. However, existing technologies struggle to establish a connection between the visual feature recognition of the drawing content and the semantic understanding of electrical functions when processing such drawings.

[0043] Current mainstream technologies primarily rely on computer vision and optical character recognition (OCR) to detect and recognize graphic elements (such as lines and symbols) and text in drawings at the pixel level. While these methods continuously improve the accuracy of element detection, they essentially treat drawings as ordinary images for segmentation and recognition, employing a bottom-up and indiscriminate traversal logic. For example, they might use a sliding window of fixed size and step size to traverse the entire drawing, or use a general object detection model to recognize preset symbol categories. The drawback of this approach is its lack of integration with electrical engineering knowledge. It cannot understand the role of the recognized symbols in the circuit, whether they are signal inputs, outputs, or actuators, and it cannot guide and optimize the recognition process based on the functional logic relationships of the symbols. This leads to common problems in existing technical solutions, such as fragmented information capture, lack of semantic association, and poor usability of results. The reasons for these problems are: fixed windows easily cut off complete electrical functional units (such as a complete tripping circuit), making it impossible to restore the complete signal path later; even if symbols and text are accurately identified individually, the system has difficulty automatically and accurately binding the "wire number" text with the corresponding "terminal" graphic, and the "terminal number" text with the "terminal" graphic, and it is even more impossible to infer the logical relationship between symbols; the final output is mostly isolated recognition boxes and text lists, which cannot form a structured and semantic loop model that can be used for subsequent analysis, verification, and simulation.

[0044] To address the aforementioned problems, this invention provides an automatic classification and circuit visualization method for terminal block drawings based on deep learning networks. By constructing an electrical symbol semantic knowledge base and using it as the core to drive a semantically and functionally guided parsing process, it optimizes the process from visual features of the drawings to functional semantics. Specifically, this invention solves the typical problems of visual perception and functional semantics disconnect and fragmented circuit information in terminal block drawing parsing scenarios by constructing a structured electrical symbol semantic knowledge base and deploying an improved deep neural network with semantic awareness capabilities.

[0045] The beneficial effects of this solution are as follows: First, this invention pre-embeds and deeply embeds domain knowledge (such as symbol functions and connection rules) into each stage of recognition and information extraction, making the entire process knowledge-guided recognition. Second, the "semantic-driven coarse-to-fine sliding window positioning" strategy proposed in this invention is no longer a mechanical, indiscriminate image scanning, but rather a purposeful search for related elements in the surrounding area based on the semantic information of the identified key symbols, greatly improving the completeness and accuracy of information capture. Finally, through functional logic reasoning, this invention can output a structured functional logic graph containing rich semantic information, rather than a simple list of recognition results, realizing the intelligent construction of drawings rather than simply listing them.

[0046] Example 1

[0047] like Figure 1 As shown, an automatic classification and loop visualization method for terminal block drawings based on deep learning networks includes the following steps: S1, constructing an electrical symbol semantic knowledge base, which stores the structured attributes of multiple key electrical symbols appearing in the terminal block drawings; S2, performing standardized preprocessing on the terminal block drawing file to be parsed to obtain standardized drawing image data and text data; S3, processing the drawing image data using an improved deep neural network to identify the key electrical symbols and their location information in the terminal block drawings; S4, based on the identified key electrical symbols, querying the electrical symbol semantic knowledge base to obtain semantic guidance information, and performing coarse-to-fine sliding window positioning driven by the semantic guidance information to capture the context elements associated with the key electrical symbols; S5, fusing the key electrical symbols, the context elements, and the text data to reconstruct the loop logic and generate structured loop data; S6, constructing a functional logic graph based on the loop data and performing visualization output.

[0048] Specifically, in the method of the present invention, step S1, which constructs a database containing symbolic graphics and textual descriptions, is relatively simple. However, the difficulty lies in how to transform engineers' domain experience into formalized "typical connection rules" that can be understood and executed by machines. These rules must not only describe the logical connection relationships between symbols, but also be transformed into specific constraints on the search space, such as direction and distance, so as to dynamically guide subsequent visual search behavior. This requires the design of the knowledge base to go beyond simple enumeration and must have the ability to support spatial reasoning and logical inference.

[0049] Step S4 is the core step of this application. Traditional sliding windows are static and blind. To achieve "semantic drive", the size, shape, position and search strategy of the window need to be adjusted in real time according to the type of symbol currently identified. For example, when a "trip coil" is identified, the system should be able to automatically search for terminals and wire numbers in a specific range below and to the left of it, instead of mechanically traversing the entire image. The key technology involved is how to accurately map the semantic information of the symbol (obtained from the knowledge base) into a series of geometric parameters in the image space (window center offset, size, step size), and design an efficient algorithm to perform this asymmetric and non-uniform local scanning, while ensuring that the processing speed is not seriously affected.

[0050] In the loop data construction phase of steps S5-S6, the system needs to correlate multi-source data from visual recognition (symbols, terminal positions) and text recognition (terminal numbers, wire numbers). In actual drawings, there are often cases of text ambiguity, overlap, and positional ambiguity. For example, multiple wire number texts may appear around a terminal; how can we accurately determine which wire number belongs to that terminal? When the connection relationship recognized by visual recognition is inconsistent with the connection relationship based on wire number matching, which should prevail? How to design confidence assessment and conflict resolution strategies to ensure the reliability of the fusion results is crucial to the practicality of the entire system.

[0051] In summary, the establishment of the method of this invention requires the deep integration of multiple technical fields such as knowledge representation, computer vision, natural language processing and graph model reasoning, rather than simply combining existing technologies.

[0052] To achieve automatic classification of terminal block drawings and visualization of circuits, this invention constructs a complete end-to-end processing system, aiming to prove that the method is feasible and achievable.

[0053] Each step will be explained in detail below.

[0054] Specifically, in step S1, an electrical symbol semantic knowledge base is constructed.

[0055] Step S1 of this invention first constructs a structured electrical symbol semantic knowledge base. This knowledge base is preferably implemented in the form of a relational database table (such as SQLite). The database table contains at least the following core fields to describe the structured attributes of each type of key electrical symbol:

[0056] Symbol ID: Used to uniquely identify a class of symbols, such as TRIP_COIL (trip coil) and PROTECT_CONTACT (protection outlet contact); this field is usually text type and serves as the primary key of the table.

[0057] Standard graphic template: This stores standard vector graphics (such as SVG format) or feature descriptors for this type of symbol, used to assist in symbol matching or for visual reference. In actual recognition, deep learning models are relied upon more heavily, and this template can serve as an auxiliary verification method.

[0058] Functional Role: Describes the function of a symbol in a loop using predefined enumerated values, such as "trip actuator," "signal source," "common reference point," "input terminal," and "output terminal." This attribute is crucial for subsequent logical reasoning.

[0059] Typical Connection Rule: This is the core of the knowledge base. This field describes, in a formal rule language, the type of object, spatial orientation, and constraints that this type of symbol should connect to in a typical loop. For example, for TRIP_COIL, the rule might be: "Must be connected to a TERMINAL, and through this terminal, one side should ultimately connect to PROTECT_CONTACT, and the other side should ultimately connect to GROUND." In a concrete implementation, this rule can be parsed as a guide for searching the surrounding area, such as "Search for terminals within ±80 pixels to the left / right and ±50 pixels above / below the symbol." The typical connection rule, described in a formal rule language, constrains the type of target symbol that the symbol must connect to in the loop, the spatial search orientation, and the maximum connection distance. This is the foundation for subsequent semantic-driven search and logical verification.

[0060] Associated TextType: Specifies the type of text label that typically accompanies this symbol in the drawing, such as "terminal number," "wire number," or "equipment code." This guides the system on what type of text should be identified around the symbol after it is located.

[0061] Circuit Category: This indicates which type of circuit the symbol usually appears in, such as "trip circuit", "closing circuit", "signal circuit", "measurement circuit", etc., for subsequent visual classification and filtering.

[0062] In summary, the structured attributes of each type of key electrical symbol in the electrical symbol semantic knowledge base include standard graphic templates, electrical function descriptions, typical connection rules, expected associated text types, and the circuit category to which they belong. These attributes together constitute the knowledge base necessary for realizing this invention.

[0063] The construction of the electrical symbol semantic knowledge base involves the analysis of a large number of standard drawings and design specifications. Domain experts manually annotate and verify the data to ensure its accuracy and completeness. The electrical symbol semantic knowledge base is loaded into memory during system initialization for frequent queries in subsequent steps.

[0064] Furthermore, after completing step S1, step S2 is performed to perform standardized preprocessing on the terminal block drawing file to be parsed, thereby obtaining standardized drawing image data and text data; thus preparing standardized drawing data for the computer.

[0065] Specifically, step S2 involves standardizing the terminal block drawing file (usually in PDF format) to be parsed. In reality, the drawings received may come from different design software, and the scan clarity varies, making direct processing difficult. The purpose of standardizing the terminal block drawing file is to unify input data from different sources and of different qualities into a standardized format that can be processed by subsequent deep learning models and OCR engines, facilitating accurate analysis in subsequent steps. Step S2 specifically includes:

[0066] S201. Use open-source libraries such as Apache PDFBox to parse PDF files and separate them into vector graphics layers and text layers. This step can obtain text information without loss and avoid errors caused by re-identifying text from the rendered image.

[0067] S202. Render the vector graphics layer as a fixed resolution (e.g., 800x600 pixels) RGB bitmap, uniformly set the background color to white (RGB[255,255,255]) and the line color to black (RGB[0,0,0]), apply a slight Gaussian blur (e.g., σ=0.8) to suppress scanning noise, and achieve image data standardization based on this; the implementation of image data standardization is used to ensure the consistency of neural network input.

[0068] S203. Extract the bounding box coordinates and actual Unicode string content of each text object in its original coordinate system from the text layer. Cache this text information in a structured format such as JSON and record its mapping relationship with the standardized image coordinate system. The above text data extraction and caching are prerequisites for subsequent steps.

[0069] Based on the above steps, a standardized and consistent data source is provided for all subsequent steps, which not only ensures the stability of the neural network in recognizing symbols in the subsequent process, but also provides a reliable foundation for the accurate association of text and graphics.

[0070] Furthermore, in step S3, the improved deep neural network is used to process the drawing image data to identify the key electrical symbols and their location information in the terminal block drawing;

[0071] Specifically, the purpose of step S3 is to simultaneously complete the classification of drawing types and the detection and recognition of key electrical symbols; the improved deep neural network is based on the classic ResNet50 architecture and includes the following two improvements:

[0072] One approach is to introduce a spatial attention mechanism at the network front end, enabling the network to focus on key areas in the image that are richer in information, such as areas with dense lines, thereby suppressing background interference and improving the ability to detect small symbols and dense targets.

[0073] Second, a region proposal network is used to efficiently generate candidate target regions, replacing the global pooling layer in the original ResNet50 architecture. The introduction of the region proposal network can efficiently generate candidate regions that may contain targets, which is particularly suitable for handling multi-scale, multi-target scenes in the graph.

[0074] After the above improvements, the network, trained on large-scale labeled data, can simultaneously output the type classification results of the drawing and the categories and precise bounding box positions of all key electrical symbols in the drawing, thus providing a basis for visual perception in subsequent steps. The improved deep neural network is based on the ResNet50 architecture, and the improvements include the introduction of a spatial attention mechanism and a region proposal network to achieve end-to-end symbol recognition and localization, which significantly improves the detection performance of multi-scale, dense targets in the drawing.

[0075] Furthermore, in step S4, based on the identified key electrical symbols, the semantic knowledge base of the electrical symbols is queried to obtain semantic guidance information, and a coarse-to-fine sliding window positioning driven by the semantic guidance information is performed to capture the context elements associated with the key electrical symbols; this step is the core step in realizing semantic guidance, and its purpose is to solve the fatal defect of "fragmentation" in information capture by traditional methods.

[0076] Specifically, step S4 is implemented by referencing the way human experts read drawings: when an engineer finds a key component (such as a trip coil) on a drawing, he will not scan the entire drawing indiscriminately, but will purposefully look for related information such as terminals and wire numbers in a specific direction based on his knowledge and experience.

[0077] Specifically, step S4 is executed in two sub-steps: The first sub-step is a coarse-grained scanning stage. In this stage, the system uses a large sliding window (e.g., 400 pixels wide and 300 pixels high), the first-size sliding window, to traverse the entire standardized image with a large step size (e.g., 200 pixels). For each image sub-block covered by the window, the system calls a lightweight symbol detection model for fast inference. For example, only the first few layers of the improved network in S3 are run. The purpose is simply to determine whether "a key electrical symbol exists in the window area" and to give a preliminary category judgment. Once a window is determined to contain at least one key symbol, the system marks the window area as a region of interest. A region of interest refers to a local area in the image that may contain a complete functional unit (e.g., a trip coil and its directly connected terminals and labels). The purpose of the coarse scan is not precise localization, but to quickly narrow down the scope of the subsequent fine search with extremely high efficiency, avoiding intensive calculations on the entire image, thereby improving overall processing efficiency.

[0078] The second step is to perform fine-grained localization. For each identified region of interest, especially for each key symbol detected within it, the system immediately queries the electrical symbol semantic knowledge base based on its SymbolID to obtain its typical connection rules and expected associated text types. Then, the system dynamically generates one or more asymmetric fine-grained search windows, i.e., fine-grained search windows of a second size. The parameters of the second-sized fine-grained search window (including window size, position, and search range) can be dynamically adjusted according to the resolution of the terminal block drawing file. For example, high-DPI drawings use larger windows and step sizes, while low-DPI drawings use smaller windows and step sizes to maintain consistency in physical scale perception. For example, if a "trip coil (TRIP_COIL)" is identified, and the knowledge base rule indicates "search for the terminal below it and the wire number text on the left," the system will generate a rectangular window extending downwards to search for the terminal graphic and another rectangular window extending to the left to search for the text. These windows are smaller than the coarse scan window (e.g., 120x180 pixels), but with a smaller search step size to ensure capture accuracy. Finally, the system performs a small-step sliding scan within these dynamically generated fine windows, simultaneously calling a high-precision OCR engine (such as Tesseract) to recognize all text within the window, and running a lightweight graphic detector (such as one based on MobileNetV2, specifically designed for detecting terminals and cable endpoints) to obtain the position of graphic elements. This synchronous calling means that text recognition and graphic detection are completed in a single scan cycle, ensuring the spatial and temporal synchronization of all captured associated elements, thus guaranteeing accurate association in the future.

[0079] Based on the above step S4, the information extraction process is equipped with "function-oriented" cognitive ability, which can ensure that the context information of the functional unit with each key symbol as the core is captured completely and continuously, thus laying a solid foundation for reconstructing the complete loop logic.

[0080] Furthermore, after completing step S4, step S5 is executed to fuse the key electrical symbols, the context elements, and the text data to reconstruct the loop logic and generate structured loop data. Specifically, the purpose of step S5 is to combine the discrete, multimodal data (such as graphic symbols and text labels) obtained in the preceding steps into a coherent data model that accurately reflects the actual electrical connections and functional logic. The specific implementation steps are as follows:

[0081] First, geometric topological association is performed. The system calculates the Euclidean distance between each key electrical symbol and all terminal graphics captured in step S4. If the distance is less than a preset threshold (e.g., 35 pixels), it is assumed that they have a direct physical connection on the drawing, and a connection edge is established for them in the data structure. This step realizes the establishment of physical connection relationships between key electrical symbols and terminals based on geometric proximity.

[0082] Next, text binding is performed. For each terminal graphic, the system searches for the text objects captured in step S4 within a small neighborhood (e.g., a circular area with a radius of 20 pixels). Based on the text's content characteristics (e.g., pure numbers might be terminal numbers, alphanumeric combinations might be line numbers) or directly on its type label, the "terminal number" text content is bound to the terminal's TerminalID attribute, and the "line number" text content is bound to the terminal's CableID attribute. This step achieves text label binding to the corresponding terminal based on spatial proximity. During the binding process, when multiple candidate text labels exist around a single terminal, a distance-based confidence weight calculation can be used to select the optimal bound text. For example, the normalized distance d_norm between each text and the terminal center is calculated, and a confidence weight of weight = 1 - d_norm is assigned, selecting the text with the highest weight.

[0083] Next, wire number matching is performed. The system iterates through all terminals that have been bound to a CableID, pairing terminals with the same CableID together, assuming they are physically connected via the same cable, even if they may be far apart on the drawing. This step extends local connections to global connections across the drawing, establishing cable connection relationships between terminals based on wire number consistency matching.

[0084] Finally, functional logic reasoning is performed. The system logically verifies the previously established physical and cable connections based on typical connection rules defined in the electrical symbol semantic knowledge base. For example, it checks whether a trip coil is ultimately connected to a protective contact and ground via terminals and cables. More importantly, when the system finds that two symbols should logically be directly connected according to the knowledge base rules, but are not connected via terminals or wire numbers on the drawing, and their spatial distance is relatively close (e.g., less than 50 pixels), the system infers a logical connection between them and adds a virtual connection edge to the loop model. This virtual connection edge represents the system's ability to reason based on domain knowledge. Its purpose and effect are to give the system a certain degree of fault tolerance and completion capability, automatically handling potential drawing omissions or non-standardizations in the drawings, thereby generating a more logically complete and reasonable loop model, greatly improving the practical value of the output results. This step enables logical verification and missing connection inference of established connections based on the typical connection rules. The missing connection inference refers to adding a virtual connection edge to the loop data when two symbols conform to the logical connection relationship defined by the typical connection rules but have not established a physical or cable connection, and their spatial distance is less than a set threshold.

[0085] Ultimately, all these associations and inferences are integrated into a structured dataset, typically consisting of a list of nodes and a list of edges. Nodes represent entities such as symbols and terminals, while edges represent various connections. Each node and edge carries rich attribute information.

[0086] In summary, the loop logic reconstruction includes four core sub-steps: establishing physical connections based on geometric proximity, performing text binding based on spatial proximity, establishing cable connections based on wire number consistency matching, and performing logical verification and missing connection inference based on typical connection rules.

[0087] Further, in step S6, a functional logic diagram is constructed based on the loop data and visualized. Step S6 is the final hurdle to realize the engineering application value of this invention. The goal of this step is to transform the structured, machine-readable loop data generated in step S5 into a graphical form that human engineers can intuitively and efficiently understand and operate.

[0088] Specifically, the system maps the node list and edge list to a data structure called a property graph. Constructing the functional logic graph involves mapping the structured loop data to a property graph model. This property graph model includes nodes representing electrical symbols, terminals, and cables, and edges representing physical connections, cable connections, and logical connection relationships. Each node and edge carries key-value pairs describing its electrical functional attributes, such as the node's FunctionalRole and CableID, and the edge's ConnectionType and SignalFlow. A property graph is a data model suitable for representing network relationships. Its characteristic is that each node and each edge in the graph can be associated with a set of key-value pairs (attributes) to describe its features. For example, a node can have attributes such as "type," "functional role," and "coordinates"; an edge can have attributes such as "connection type" and "signal flow direction," making it highly suitable for expressing the rich semantics of electrical loops.

[0089] Then, the system uses a graphics rendering engine (such as the QGraphicsView system in the Qt framework) to draw this property graph into a two-dimensional visualization. During the visualization process, different types of nodes (such as terminals and symbols) are distinguished by different shapes (such as circles and rectangles) and colors (such as red for trip-related components and blue for signal inputs); different types of edges (such as physical connections, cable connections, and virtual connections) are also represented by different line types (solid lines and dashed lines) and colors.

[0090] The ultimate goal of step S6 is to build a bridge from machine intelligence to human wisdom. The effect is to greatly improve the interpretability and practicality of the analysis results, so that engineers no longer need to face tedious data tables or messy recognition boxes, but can perform loop verification, fault analysis and other tasks on an intuitive and interactive graphical interface, thus truly integrating automated analysis technology into actual engineering practice. The final visualization results can be exported as vector formats such as SVG, which is convenient for integration into other systems or for report writing.

[0091] Example 2

[0092] Based on the complete framework constructed in Example 1, this embodiment has carried out in-depth optimization and refinement of several key technical aspects, aiming to further improve the robustness, accuracy and adaptability of the system when dealing with complex real-world scenarios.

[0093] For the improved deep neural network in step S3, this embodiment enhances both the model structure and training strategy. In terms of model structure, the Spatial Attention Module (SAM) is lightweighted by replacing the standard convolutional layers with depthwise separable convolutions. Depthwise separable convolution is an efficient convolution computation method that decomposes standard convolution into two steps: first, depthwise convolution (channel-wise convolution), and then pointwise convolution (1x1 convolution). This decomposition significantly reduces the number of model parameters and floating-point operations without significantly sacrificing the model's expressive power. The purpose of step S3 is to reduce the model's computational complexity and memory footprint, making the improved network easier to deploy on edge devices or servers with relatively limited computing resources, thereby broadening the application scenarios of this invention.

[0094] For the semantically driven fine-grained search window in step S4, this embodiment introduces a resolution-aware dynamic adjustment mechanism. The core of the resolution-aware dynamic adjustment mechanism is that the system accurately acquires or calculates the DPI (Dots Per Inch) value of the original PDF drawing during the preprocessing stage in step S2; the DPI value is an indicator of the accuracy of image scanning or printing, which directly determines how many pixels correspond to each physical unit size (e.g., 1 millimeter) on the drawing. Then, the system dynamically adjusts the size and sliding step of the fine search window based on the DPI value. The specific adjustment strategy is as follows: set a baseline DPI value (e.g., 200 DPI) and a corresponding baseline window size (e.g., 120x180 pixels) and step (e.g., 5 pixels). When the system detects that the DPI of the current drawing is > 300, it will proportionally enlarge the size of the fine window (e.g., to 150x220 pixels) and the step (e.g., to 7 pixels); when the DPI is ≤ 150, it will correspondingly shrink the window size (e.g., to 100x150 pixels) and the step (e.g., to 4 pixels); for drawings with a DPI between 150 and 300, the baseline parameters are used. The fundamental purpose of introducing this dynamic adjustment mechanism is to make the system's search behavior based on the real physical scale, rather than a fixed pixel scale. Specifically, regardless of whether the scanning resolution of the drawing is high or low, the physical range that the system intends to search (e.g., the area within 2 mm around key symbols) remains consistent. The direct effect of this is to significantly improve the system's adaptability to drawings from different sources and of different qualities, that is, to improve the system's robustness and avoid the problems of the search range being too small (missed detection) or too large (introducing noise) due to resolution differences, thus ensuring the consistency of information extraction results.

[0095] Regarding the multimodal information fusion for constructing loop data in step S5, this embodiment quantifies and refines the text binding and virtual connection inference steps. In the text binding step, when multiple candidate text labels (such as multiple possible "line numbers") exist around a single terminal, the system uses a distance-based confidence weight calculation method to make the optimal decision. Specifically, for each candidate text Text_k surrounding terminal T_j, the Euclidean distance d_k between it and the terminal center is calculated, and then normalized to obtain d_norm_k = d_k / R_text (where R_text is the text binding search radius, for example, 20 pixels). Subsequently, a confidence weight weight_k = 1 - d_norm_k is assigned to this text. Finally, the system selects the text with the highest weight_k as the final binding result for that terminal. Simultaneously, a confidence threshold (e.g., 0.3) is set. If the highest weight value is lower than this threshold, the system determines that the binding result is unreliable and marks the terminal as "line number missing".

[0096] The purpose of introducing a confidence-weighted mechanism is to transform text binding from a "hard decision" process with only a definite evaluation of right and wrong into a quantifiable "soft decision" process with an evaluation of uncertainty. On the one hand, the confidence-weighted mechanism automatically selects the most likely binding through quantitative comparison. On the other hand, it can identify edge cases with high uncertainty due to text ambiguity, overlap, or positional ambiguity, and trigger subsequent manual review processes through the marker of missing line numbers. This mechanism greatly avoids problems such as the system not prompting for incorrect bindings, thereby improving the reliability and credibility of the entire system.

[0097] Based on the preferred embodiments of the present invention described above, those skilled in the art can make various changes and modifications without departing from the inventive concept. The technical scope of this invention is not limited to the contents of the specification, but must be determined according to the scope of the claims.

Claims

1. A method for automatic classification and loop visualization of terminal block drawings based on deep learning networks, characterized in that, Includes the following steps: S1. Construct an electrical symbol semantic knowledge base, which stores the structured attributes of multiple key electrical symbols appearing in terminal block drawings; S2. Perform standardized preprocessing on the terminal block drawing file to be parsed to obtain standardized drawing image data and text data; S3. The improved deep neural network is used to process the drawing image data to identify the key electrical symbols and their location information in the terminal block drawing; S4. Based on the identified key electrical symbols, query the semantic knowledge base of the electrical symbols to obtain semantic guidance information, and perform coarse-to-fine sliding window positioning driven by the semantic guidance information to capture the context elements associated with the key electrical symbols; S5. Integrate the key electrical symbols, the context elements, and the text data to reconstruct the loop logic and generate structured loop data; S6. Construct a functional logic diagram based on the loop data and output it visually.

2. The method for automatic classification of terminal block drawings and visualization of circuits based on deep learning networks according to claim 1, characterized in that... , In the aforementioned electrical symbol semantic knowledge base, the structured attributes of each type of key electrical symbol include at least one of the following: standard graphic template, electrical function description, typical connection rules, expected associated text type, and circuit category.

3. The method for automatic classification of terminal block drawings and visualization of circuits based on deep learning networks according to claim 2, characterized in that... , The semantically driven coarse-to-fine sliding window positioning specifically includes: The drawing image data is coarsely scanned using a sliding window of the first size to locate the region of interest containing key electrical symbols; Based on the category of the key electrical symbols, query the typical connection rules corresponding to the key electrical symbols from the semantic knowledge base of electrical symbols; The parameters of the fine-grained search window of the second size are dynamically determined based on the typical connection rules, including window size, position, and search range; The fine search window is used to perform a fine scan around the region of interest, simultaneously identifying the contextual elements of both text and graphic types.

4. The method for automatic classification of terminal block drawings and visualization of circuits based on deep learning networks according to claim 3, characterized in that... , The parameters of the second-sized fine search window are dynamically adjusted according to the resolution of the terminal block drawing file.

5. The method for automatic classification and circuit visualization of terminal block drawings based on deep learning networks according to claim 1, characterized in that... , The circuit logic reconstruction includes: Establish the physical connection relationship between key electrical symbols and terminals based on geometric proximity; Bind text labels to corresponding terminals based on spatial proximity; Establish cable connection relationships between terminals based on wire number consistency matching; Based on the typical connection rules, logical verification and missing connection inference are performed on the established connection relationships.

6. The method for automatic classification of terminal block drawings and visualization of circuits based on deep learning networks according to claim 5, characterized in that... , In the process of binding text tags to corresponding terminals based on spatial proximity, when there are multiple candidate text tags around a single terminal, the optimal binding text is selected by calculating the confidence weight based on distance.

7. The method for automatic classification of terminal block drawings and visualization of circuits based on deep learning networks according to claim 5, characterized in that... , The missing connection inference refers to adding a virtual connection edge to the loop data when two symbols conform to the logical connection relationship defined by the typical connection rule but have not established a physical or cable connection, and their spatial distance is less than a set threshold.

8. The method for automatic classification of terminal block drawings and visualization of circuits based on deep learning networks according to claim 1, characterized in that... , The improved deep neural network is based on the ResNet50 architecture and includes improvements such as the introduction of a spatial attention mechanism and a region proposal network to achieve end-to-end symbol recognition and localization.

9. The method for automatic classification of terminal block drawings and visualization of circuits based on deep learning networks according to claim 1, characterized in that... , In step S1, the construction of the electrical symbol semantic knowledge base includes: defining typical connection rules for each type of key electrical symbol; the typical connection rules are described in a formal rule language and are used to constrain the target symbol type, spatial search orientation and maximum connection distance that the symbol must be connected to in the loop.

10. The method for automatic classification of terminal block drawings and visualization of circuits based on deep learning networks according to claim 1, characterized in that... , In step S6, constructing the functional logic graph includes mapping the structured loop data into an attribute graph model; the attribute graph model includes nodes representing electrical symbols, terminals and cables, and edges representing physical connections, cable connections and logical connection relationships, wherein nodes and edges carry key-value pairs for describing their electrical functional attributes.

11. An electronic device comprising one or more processors for storing one or more programs, characterized in that, When the one or more programs are executed by the one or more processors, the one or more processors perform the method for automatic classification of terminal block drawings and visualization of circuits based on deep learning networks, as described in any one of claims 1-10.

12. A storage medium storing a computer program, characterized in that, in, The computer program is configured to execute, at runtime, the method for automatic classification of terminal block drawings and visualization of circuits based on deep learning networks, according to any one of claims 1-10.