A method and device for generating a wiring diagram based on CAD image recognition
By using a CAD image recognition method, wiring diagrams can be automatically identified and generated, solving the problem of low efficiency in vectorization of power grid design drawings. This automates the drawing of diagrams in the power dispatching system, improving recognition accuracy and work efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NARI TECH CO LTD
- Filing Date
- 2023-02-28
- Publication Date
- 2026-04-14
AI Technical Summary
In existing power dispatching systems, the vectorization process of power grid design drawings relies on manual operation, resulting in low efficiency and an inability to efficiently and automatically identify and generate wiring diagrams.
A CAD image recognition-based method is adopted, which utilizes electrical element recognition model, text recognition model and line segment recognition model, combined with neural network model, to automatically identify and generate wiring diagrams. This includes image preprocessing, element annotation, text annotation, line segment recognition and interval recognition, and generates G-files.
It has enabled the automated drawing of wiring diagrams in power dispatching systems, improved work efficiency, enhanced the recognition accuracy of graphic elements, text and connection information, and simplified the process of combining power grid graphics.
Smart Images

Figure CN116541912B_ABST
Abstract
Description
Technical Field
[0001] This invention pertains to the field of power dispatch automation technology, specifically relating to a method and apparatus for generating wiring diagrams based on CAD image recognition. Background Technology
[0002] With the changes in the power grid structure, the construction and renovation of power plants and lines have become more frequent, resulting in a large number of complex design drawings that have been scanned or photographed and urgently need to be vectorized by staff.
[0003] However, the current method of relying on manual vectorization is time-consuming and labor-intensive, so it is necessary to study an automatic recognition method for electrical wiring diagrams. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and apparatus for generating wiring diagrams based on CAD image recognition, which improves the efficiency of diagram vectorization and realizes the automation of diagram drawing.
[0005] To achieve the above objectives, the present invention is implemented using the following technical solution:
[0006] In a first aspect, the present invention provides a method for generating wiring diagrams based on CAD image recognition, comprising the following steps:
[0007] Step S1: Obtain the CAD image to be identified.
[0008] Step S2: Perform image preprocessing on the CAD image to be identified to obtain a preprocessed image;
[0009] Step S3: Input the preprocessed image into the electrical element recognition model to obtain a CAD image with the marked recognition element annotation box and an electrical element recognition file. The electrical recognition file includes the coordinates of the upper left and lower right corners of the recognized element annotation box and the element type.
[0010] Step S4: Based on the graphic element annotation box obtained in step S3, fill the annotation box area with white pixel values on the CAD image obtained in step S2 to obtain a CAD image with the graphic elements covered.
[0011] Step S5: Use the text recognition model to perform text annotation recognition on the CAD image obtained in step S4, and annotate the CAD image and text recognition file with the recognized text annotation box. The text recognition file includes the coordinates of the upper left and lower right corners of the recognized text annotation box and the text content.
[0012] Step S6: Based on the text annotation box obtained in step S5, fill the annotation box area with white pixel values on the CAD image obtained in step S4 to obtain a CAD image that covers the graphic elements and text.
[0013] Step S7: Perform line segment recognition on the CAD image obtained in step S6 to obtain a line segment recognition file. The content of the line segment recognition file includes the coordinates of the start and end points of the line segments.
[0014] Step S8: The obtained electrical element annotation boxes, text annotation boxes and line segments are clustered and combined in local regions, and the combined images are aligned and stitched together. Interval recognition is used to connect the elements with connecting line segments to obtain the interval recognition result. The coordinates in the interval template are adjusted according to the interval recognition result and written into the interval recognition file. At the same time, the element coordinates in the electrical element recognition file and the line segment coordinates in the line segment recognition file are modified.
[0015] Step S9: Based on the contents of the bay identification file, electrical element identification file, text identification file, and line segment identification file, write the elements, text, and line segments into the G file according to the power system graphic description specification to generate the wiring diagram.
[0016] Furthermore, in step S1, obtaining the CAD image to be identified includes converting a CAD file in PDF format to a CAD image in PNG or JPG format.
[0017] Furthermore, in step S2, image preprocessing is performed on the CAD image to be identified, including:
[0018] The CAD image to be identified is subjected to image dilation, erosion, recoloring, Gaussian blurring, and sharpening.
[0019] Furthermore, in step S3, the electrical primitive recognition model is obtained by training and debugging based on the YoLoV3 algorithm using a power grid-specific electrical primitive training image dataset;
[0020] The input to the electrical element recognition model is a preprocessed image, and the output is a CAD image with the marked boxes of the recognized elements and an electrical element recognition result file. The recognition file includes the coordinates of the upper left and lower right corners of the recognized element boxes and the element type.
[0021] Furthermore, in step S5, a text recognition model is used to perform text annotation recognition on the image obtained in step S4, including:
[0022] The text recognition model was obtained by training and debugging using a text training dataset based on the PaddleOCR algorithm;
[0023] The text recognition model takes a CAD image with the graphic elements covered as input and outputs a CAD image with the text annotation boxes marked and a text recognition result file. The recognition file includes the coordinates of the upper left and lower right corners of the recognized text annotation boxes and the text content.
[0024] Furthermore, in step S7, the method for line segment identification includes:
[0025] By continuously traversing horizontal pixels to detect horizontal line segments, and simultaneously splicing and length thresholding of the horizontal line segments, the main line in the image is identified.
[0026] By extracting the skeleton of horizontal and vertical line segments in the image, the connecting line segments are identified and integrated based on the skeleton information.
[0027] Furthermore, in step S8, the association relationship is constructed using interval identification, including:
[0028] Interval Division: Based on the previous busbar determination and the recognition results of electrical elements, the convergence area of elements in the original image is simply divided to preliminarily determine some areas that may be intervals. This determination result is then included in the next step of interval determination.
[0029] Interval determination: Determine the regions divided in the previous step. Use the interval serialization method to model the type and distribution of primitives in the interval. Use the model to match the interval regions with the preset interval types, thereby constructing the relationship between primitives.
[0030] Furthermore, the bay template is a collection of regional graphic elements that frequently appear in power grid wiring diagrams, including 2 / 3 bays and bus tie bays, and the bay templates are all made in the form of G files.
[0031] Furthermore, in step S9, a G-file is generated using the recognition results, including:
[0032] It is divided into two parts: interval output and primitive output. Interval output is the output of the determined intervals in a regionalized manner. The G file is created by reading the primitives, text and connection relationships in the interval template. Primitive output is the formatted output of other regions other than the intervals that were not successfully determined to the G file.
[0033] In a second aspect, the present invention provides an apparatus for generating wiring diagrams based on CAD image recognition, comprising a processor and a storage medium;
[0034] The storage medium is used to store instructions;
[0035] The processor is configured to operate according to the instructions to perform the steps of the method according to the first aspect.
[0036] Compared with the prior art, the beneficial effects achieved by the present invention are as follows:
[0037] 1. This invention adopts a method for generating wiring diagrams based on CAD image recognition, which realizes the automation of diagram drawing, improves the manual vectorization method of power control system, effectively improves work efficiency, identifies graphic elements, text and connection information in sequence, and the graphic elements and text are occluded after recognition to reduce interference to subsequent recognition and improve recognition accuracy.
[0038] 2. This invention constructs a proprietary identification model for electrical elements in power grid diagrams. By combining the YoLoV3 algorithm with the proprietary electrical element model, the recognition rate of electrical elements in power plant diagrams is improved.
[0039] 3. This invention constructs a proprietary relationship model for interval identification, which transforms the complex relationship between elements in the drawing into a module identification problem of interval areas in the drawing, thereby achieving accurate identification of power grid control graphic combinations.
[0040] 4. This invention conducts research and application of image recognition technology in the traditional power grid diagram generation scenario. By using a neural network model to identify information such as the type, location, text markings, and connection of graphic elements in the CAD design drawings of power plants, and combining the empirical rules of power grids, the graphic elements are recombined and generated to realize the automation of diagram drawing and effectively improve work efficiency. Attached Figure Description
[0041] Figure 1 This is a flowchart of the method described in this invention. Detailed Implementation
[0042] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention.
[0043] Example 1:
[0044] This embodiment provides a method for generating wiring diagrams based on CAD image recognition, such as... Figure 1 As shown, it includes the following steps:
[0045] Step S1, Input the original CAD recognition image: Input the plant site diagram image to be recognized.
[0046] Step S2, Image Preprocessing: By performing operations such as image dilation, erosion, recoloring, Gaussian blurring, and sharpening on the original power plant wiring diagram, stains on the image are removed to a certain extent, stamps are removed, and features are highlighted.
[0047] Step S3: Use the electrical element recognition model to recognize electrical elements: By using a power grid-specific electrical element training image dataset, a high-recognition-rate element recognition model is obtained through training and debugging based on the YoLoV3 algorithm. This model is then used to recognize electrical elements in the power plant diagram to be identified.
[0048] Step S4: Based on the graphic element annotation box obtained in step S3, fill the annotation box area with white pixel values on the CAD image obtained in step S2 to obtain a CAD image with the graphic elements covered.
[0049] Step S5: Use a text recognition model to recognize text annotations: By using a text training dataset, a text recognition model with a high recognition rate is obtained through training and debugging based on the PaddleOCR algorithm. This model is then used to recognize the text annotations in the site map to be identified.
[0050] Step S6: Based on the text annotation box obtained in step S5, fill the annotation box area with white pixel values on the CAD image obtained in step S4 to obtain a CAD image that covers the graphic elements and text.
[0051] Step S7, line segment recognition: On the one hand, horizontal line segments are detected by continuously traversing horizontal pixels, and horizontal line segments are spliced and length thresholded to identify the main line in the image; on the other hand, the skeleton of horizontal and vertical line segments in the image is extracted, and the line segments are identified and integrated based on the skeleton information.
[0052] Step S8, using interval recognition to construct association relationships: This includes two steps: interval region division and interval determination. Interval division involves using the previous busbar determination, combined with the electrical element recognition results, to perform a simple division of the element convergence area in the original image, initially identifying some potentially interval regions. This determination result is then incorporated into the next step for interval determination. Interval determination involves judging the regions divided in the previous step. An interval serialization method is used to model the type and distribution of elements within the interval. This model is then used to match the interval regions with preset interval types, thereby constructing the association relationships between elements.
[0053] The bay templates in this implementation method are collections of regional graphic elements that frequently appear in power grid wiring diagrams, including 2 / 3 bays, bus tie bays, etc., and the templates are all made in the form of G files.
[0054] Step S9: Generate a G file using the recognition results. This step consists of two parts: interval output and primitive output. Interval output involves regionalizing the identified intervals by reading the primitives, text, and connection relationships in the interval template to create the G file. Primitive output involves formatting and outputting other regions outside the unidentified intervals into the G file.
[0055] In summary, the method and apparatus for generating wiring diagrams based on CAD image recognition of the present invention rely on the existing power grid dispatch and control system. Based on the neural network model, it identifies information such as the type, location, text markings, and connection of graphic elements in the CAD design drawings of power plants and substations. Combined with the empirical rules of the power grid, it reorganizes and generates graphic elements to realize the automation of drawing model, which can effectively improve the work efficiency of users and has good prospects for promotion.
[0056] Example 2:
[0057] This embodiment provides a device for generating wiring diagrams based on CAD image recognition, including a processor and a storage medium;
[0058] The storage medium is used to store instructions;
[0059] The processor is configured to operate according to the instructions to perform the steps of the method according to Embodiment 1.
[0060] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0061] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0062] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0063] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0064] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for generating wiring diagrams based on CAD image recognition, characterized in that, Includes the following steps: Step S1: Obtain the CAD image to be recognized; Step S2: Perform image preprocessing on the CAD image to be identified to obtain a preprocessed image; Step S3: Input the preprocessed image into the electrical element recognition model to obtain a CAD image with the marked recognition element annotation boxes and an electrical element recognition file. The electrical recognition file includes the recognized element annotation boxes and the element type. Step S4: Based on the graphic element annotation box obtained in step S3, fill the annotation box area with white pixel values on the CAD image obtained in step S2 to obtain a CAD image with the graphic elements covered. Step S5: Use the text recognition model to perform text annotation recognition on the CAD image obtained in step S4, and obtain the CAD image with the recognized text annotation boxes and the text recognition file. The content of the text recognition file includes the recognized text annotation boxes and the text content. Step S6: Based on the text annotation box obtained in step S5, fill the annotation box area with white pixel values on the CAD image obtained in step S4 to obtain a CAD image that covers the graphic elements and text. Step S7: Perform line segment recognition on the CAD image obtained in step S6 to obtain a line segment recognition file. The content of the line segment recognition file includes line segments. Step S8: The obtained electrical element annotation boxes, text annotation boxes and line segments are clustered and combined in local regions, and the combined images are aligned and stitched together. Interval recognition is used to connect the elements with connecting line segments to obtain the interval recognition result. The coordinates in the interval template are adjusted according to the interval recognition result and written into the interval recognition file. At the same time, the element coordinates in the electrical element recognition file and the line segment coordinates in the line segment recognition file are modified. Step S9: Based on the contents of the modified bay identification file, electrical element identification file, text identification file, and line segment identification file, write the elements, text, and line segments into the G file according to the power system graphic description specification to generate the wiring diagram.
2. The method for generating wiring diagrams based on CAD image recognition according to claim 1, characterized in that, In step S1, the CAD image to be identified is obtained, including converting the CAD file in PDF format to a CAD image in PNG or JPG format.
3. The method for generating wiring diagrams based on CAD image recognition according to claim 1, characterized in that, In step S2, image preprocessing is performed on the CAD image to be identified, including: The CAD image to be identified is subjected to image dilation, erosion, recoloring, Gaussian blurring, and sharpening.
4. The method for generating wiring diagrams based on CAD image recognition according to claim 1, characterized in that, In step S3, the electrical primitive recognition model is obtained by training and debugging based on the YoLoV3 algorithm using a power grid-specific electrical primitive training image dataset. The input to the electrical element recognition model is the preprocessed image after step S2, and the output is the CAD image with the marked recognition element annotation boxes and the electrical element recognition result file. The recognition file includes the coordinates of the upper left and lower right corners of the recognized element annotation boxes and the element type.
5. The method for generating wiring diagrams based on CAD image recognition according to claim 1, characterized in that, In step S5, a text recognition model is used to perform text annotation recognition on the image obtained in step S4, including: The text recognition model was obtained by training and debugging using a text training dataset based on the PaddleOCR algorithm; The input to the text recognition model is the CAD image with the primitives covered, obtained from S4. The output is the CAD image with the recognized text annotation boxes and the text recognition result file. The content of the recognition file includes the coordinates of the upper left and lower right corners of the recognized text annotation boxes and the text content.
6. The method for generating wiring diagrams based on CAD image recognition according to claim 1, characterized in that, In step S7, the method for line segment identification includes: By continuously traversing horizontal pixels to detect horizontal line segments, and simultaneously splicing and length thresholding of the horizontal line segments, the main line in the image is identified. By extracting the skeleton of horizontal and vertical line segments in the image, the connecting line segments are identified and integrated based on the skeleton information.
7. The method for generating wiring diagrams based on CAD image recognition according to claim 1, characterized in that, In step S8, the elements are connected using connecting line segments using interval recognition, including: Interval division: Based on the previous busbar determination and the electrical element recognition results, the element convergence area in the original image is simply divided to preliminarily determine some areas that may be intervals. This determination result is then included in the next step of interval determination. Interval determination: Determine the regions divided in the previous step. Use the interval serialization method to model the type and distribution of primitives in the interval. Use the model to match the interval regions with the preset interval types, thereby constructing the relationship between primitives.
8. The method for generating wiring diagrams based on CAD image recognition according to claim 1, characterized in that, The bay template is a collection of regional graphic elements that frequently appear in power grid wiring diagrams, including 2 / 3 bays and bus tie bays. All bay templates are made in the form of G files.
9. The method for generating wiring diagrams based on CAD image recognition according to claim 1, characterized in that, In step S9, a G-file is generated using the recognition results, including: It is divided into two parts: interval output and primitive output. Interval output is the output of the determined intervals in a regionalized manner. The G file is created by reading the primitives, text and connection relationships in the interval template. Primitive output is the formatted output of other regions other than the intervals that were not successfully determined to the G file.
10. An apparatus for generating wiring diagrams based on CAD image recognition, comprising a processor and a storage medium; The storage medium is used to store instructions; The processor is configured to operate according to the instructions to perform the steps of the method according to any one of claims 1-9.
Citation Information
Patent Citations
Distribution network graph model management method and device
CN114676959A
Substation secondary drawing visual editing and digital configuration device and method and application
CN115238428A